public function init()
 {
     $this->register_api_fields();
     add_action('edit_form_after_editor', array($this, 'output'));
     add_action('save_post', array($this, 'save_post'));
     add_action('admin_enqueue_scripts', function () {
         if ($this->is_allowed_for_screen()) {
             Plugin::get_instance()->enqueue_builder();
         }
     });
 }
                $info[$requirement->name()] = $requirement->result();
            }
        }
        foreach (Services::get_services() as $file => $service) {
            array_merge($info, call_user_func(array($service, 'intercom_data')));
        }
        $current_user = wp_get_current_user();
        $info['user_hash'] = hash_hmac('sha256', $current_user->user_email, 'fcUEt7Vi4ym5PXdcr2UNpGdgZTEvxX9NJl8YBTxK');
        $info['email'] = $current_user->user_email;
        $info['created_at'] = strtotime($current_user->user_registered);
        $info['app_id'] = '7f1l4qyq';
        $info['name'] = $current_user->display_name;
        $info['widget'] = array('activator' => '#intercom');
        ?>

		<script id="IntercomSettingsScriptTag">
			window.intercomSettings = <?php 
        echo json_encode($info);
        ?>
;
		</script>
		<script>!function(){function e(){var a=c.createElement("script");a.type="text/javascript",a.async=!0,a.src="https://static.intercomcdn.com/intercom.v1.js";var b=c.getElementsByTagName("script")[0];b.parentNode.insertBefore(a,b)}var a=window,b=a.Intercom;if("function"==typeof b)b("reattach_activator"),b("update",intercomSettings);else{var c=document,d=function(){d.c(arguments)};d.q=[],d.c=function(a){d.q.push(a)},a.Intercom=d,a.attachEvent?a.attachEvent("onload",e):a.addEventListener("load",e,!1)}}();</script>

	<?php 
    }
}
if (is_multisite() && !is_main_site()) {
    return;
}
Plugin::get_instance();
 /**
  * Plugin Version
  *
  * @return string
  */
 public static function plugin_version()
 {
     return Plugin::get_instance()->version;
 }
示例#4
0
 function test_it_has_a_singleton_instance()
 {
     $instance1 = Plugin::get_instance();
     $instance2 = Plugin::get_instance();
     $this->assertSame($instance1, $instance2);
 }
 public function __construct($id, $args)
 {
     $this->id = $id;
     $this->plugin = Plugin::get_instance();
     $this->args = wp_parse_args($args, array('title' => null, 'api_prop' => $this->id, 'allowed_modules' => array()));
 }
 public function setUp()
 {
     $this->plugin = Plugin::get_instance();
     $this->schedule_intervals = cron_schedules();
 }
/**
 * Initialize and load plugin
 */
function init()
{
    require_once DPS_ENTITLEMENTS_DIR . 'classes/Singleton.php';
    require_once DPS_ENTITLEMENTS_DIR . 'classes/Plugin.php';
    Plugin::get_instance();
}
 /**
  * Constructor
  *
  * @return void
  */
 protected function init()
 {
     // vars
     $this->plugin = Plugin::get_instance();
 }