Skip to content
Snippets Groups Projects
civicrm.shortcodes.modal.php 4.84 KiB
<?php
/*
 +--------------------------------------------------------------------+
 | Copyright CiviCRM LLC. All rights reserved.                        |
 |                                                                    |
 | This work is published under the GNU AGPLv3 license with some      |
 | permitted exceptions and without any warranty. For full license    |
 | and copyright information, see https://civicrm.org/licensing       |
 +--------------------------------------------------------------------+
*/

/**
 *
 * @package CRM
 * @copyright CiviCRM LLC https://civicrm.org/licensing
 *
 */


// This file must not accessed directly
if ( ! defined( 'ABSPATH' ) ) exit;


/**
 * Define CiviCRM_For_WordPress_Shortcodes_Modal Class.
 *
 * @since 4.6
 */
class CiviCRM_For_WordPress_Shortcodes_Modal {

  /**
   * Plugin object reference.
   *
   * @since 4.6
   * @access public
   * @var object $civi The plugin object reference.
   */
  public $civi;


  /**
   * Instance constructor.
   *
   * @since 4.6
   */
  function __construct() {

    // Store reference to CiviCRM plugin object
    $this->civi = civi_wp();

  }


  /**
   * Register hooks to handle the shortcode modal.
   *
   * @since 4.6
   */
  public function register_hooks() {

    // Bail if CiviCRM not installed yet
    if ( ! CIVICRM_INSTALLED ) return;

    // Adds the CiviCRM button to post and page edit screens
    // Use priority 100 to position button to the farright
    add_action( 'media_buttons', array( $this, 'add_form_button' ), 100 );


    // Add the javascript and styles to make it all happen
    add_action('load-post.php', array($this, 'add_core_resources'));