Пример #1
0
 public function onLoad()
 {
     $application = $this->_pm->getBootstrap()->getApplication();
     if ($application->getAdapter() instanceof IfwPsn_Wp_Plugin_Application_Adapter_ZendFw) {
         IfwPsn_Wp_Proxy_Action::addAdminInit(array($application->getAdapter(), 'init'));
         IfwPsn_Wp_Proxy_Action::add('load-' . $this->getPageHook(), array($application, 'render'));
     }
 }
Пример #2
0
 /**
  * Registeres the callback method to the WP ajax action
  *
  * @param IfwPsn_Wp_Ajax_Request_Abstract $request
  */
 public function addRequest(IfwPsn_Wp_Ajax_Request_Abstract $request)
 {
     $this->_callback = $request->getCallback();
     IfwPsn_Wp_Proxy_Action::add($request->getAction(), array($this, 'execute'));
     if ($request instanceof IfwPsn_Wp_Ajax_Request_Public) {
         IfwPsn_Wp_Proxy_Action::add('wp_ajax_' . $request->getId(), array($this, 'execute'));
     }
 }
Пример #3
0
 /**
  * Loads the appropriate action for adding contextual help
  */
 public function load()
 {
     if (IfwPsn_Wp_Proxy_Blog::isMinimumVersion('3.3')) {
         // since 3.3 use the add_help_method on the screen object
         IfwPsn_Wp_Proxy_Action::addAdminHead(array($this, 'addHelpTab'));
     } else {
         // before 3.3 use the contextual_help action
         IfwPsn_Wp_Proxy_Action::add('contextual_help', array($this, 'getContextualHelp'), 10, 3);
     }
 }
Пример #4
0
 protected function _init()
 {
     $this->_initAction();
     $this->_initNonce();
     if (method_exists($this, 'getResponse')) {
         IfwPsn_Wp_Proxy_Action::add($this->getAction(), array($this, '_render'));
         if ($this instanceof IfwPsn_Wp_Ajax_Request_Public) {
             IfwPsn_Wp_Proxy_Action::add('wp_ajax_' . $this->getId(), array($this, '_render'));
         }
     }
 }
Пример #5
0
 /**
  * Fetch a post on save / update and store it for later processing
  *
  * @param $post_ID
  * @param $post
  * @param $update
  */
 public function fetchPostOnInsert($post_ID, $post, $update = null)
 {
     // fetch post
     $this->_post = $post;
     if (IfwPsn_Wp_Plugin_Manager::getInstance('Psn')->hasOption('psn_late_execution')) {
         // register container execution for shutdown action
         IfwPsn_Wp_Proxy_Action::add('shutdown', array($this, 'execute'));
     } else {
         $this->execute();
     }
 }
Пример #6
0
 /**
  * @param $target
  */
 public function renderTo($target)
 {
     $this->_target = $target;
     if ($this->_isValid()) {
         // enqueue scripts and styles
         IfwPsn_Wp_Proxy_Script::loadAdmin('wp-pointer', false, array('jquery'));
         IfwPsn_Wp_Proxy_Style::loadAdmin('wp-pointer');
         IfwPsn_Wp_Proxy_Action::addAdminFooterCurrentScreen(array($this, 'renderScript'));
         IfwPsn_Wp_Proxy_Action::add('admin_footer-post-new.php', array($this, 'renderScript'));
         IfwPsn_Wp_Proxy_Action::add('admin_footer-edit.php', array($this, 'renderScript'));
     }
 }
Пример #7
0
 public function init()
 {
     if ($this->_pm->getConfig()->plugin->autoupdate == 1) {
         $updateApi = IfwPsn_Wp_Plugin_Update_Api_Factory::get($this->_pm);
         // check for custom update message
         IfwPsn_Wp_Proxy_Action::add('in_plugin_update_message-' . $this->_pm->getPathinfo()->getFilenamePath(), array($updateApi, 'getUpdateInlineMessage'), 10, 3);
         IfwPsn_Wp_Proxy_Filter::add('pre_set_site_transient_update_plugins', array($updateApi, 'getUpdateData'));
         if ($this->_pm->isPremium()) {
             // check for premium get update info
             IfwPsn_Wp_Proxy_Filter::add('plugins_api', array($updateApi, 'getPluginInformation'), 10, 3);
         }
     }
     $this->_pm->getBootstrap()->getOptionsManager()->registerExternalOption('present_version');
 }
Пример #8
0
 protected function _init()
 {
     IfwPsn_Wp_Proxy_Action::add($this->_pm->getAbbrLower() . '_general_options_init', array($this, 'registerOptionsCallback'));
     IfwPsn_Wp_Proxy_Action::add($this->_pm->getAbbrLower() . '_external_options_init', array($this, 'registerOptionsCallback'));
 }
Пример #9
0
 /**
  * Registers the custom post type
  */
 public function _register()
 {
     if (post_type_exists($this->getId())) {
         return;
     }
     foreach ($this->_taxonomies as $id => $args) {
         if (!empty($args)) {
             register_taxonomy($id, $this->getId(), $args);
         }
     }
     $result = register_post_type($this->getId(), $this->_getArgs());
     if (!is_wp_error($result)) {
         /**
          * Feed include
          */
         if ($this->isFeedInclude() && method_exists($this, 'addToFeed')) {
             IfwPsn_Wp_Proxy_Action::add('request', array($this, 'addToFeed'));
         }
     }
 }
Пример #10
0
 /**
  * Renders additional table controls
  * Calls methods: getExtraControlsTop / getExtraControlsBottom
  *
  * @param $pos
  * @return mixed|void
  */
 public function extra_tablenav($pos)
 {
     $methodName = 'getExtraControls' . ucfirst($pos);
     IfwPsn_Wp_Proxy_Action::add($this->_wpActionPrefix . '_before_controls_top', $this);
     if (method_exists($this, $methodName)) {
         call_user_func(array($this, $methodName));
     }
     IfwPsn_Wp_Proxy_Action::add($this->_wpActionPrefix . '_after_controls_top', $this);
 }
Пример #11
0
 /**
  * Registers a widget
  *
  * @param $widget_classname
  * @return bool|void
  */
 public function register($widget_classname)
 {
     return IfwPsn_Wp_Proxy_Action::add('widgets_init', create_function('', 'return register_widget("' . $widget_classname . '");'));
 }
Пример #12
0
 /**
  * @param bool $html
  */
 public function setHTML($html = true)
 {
     if (is_bool($html)) {
         if ($html == true) {
             IfwPsn_Wp_Proxy_Action::add('phpmailer_init', array($this, 'phpMailerEnableHtml'));
         }
         $this->_isHTML = $html;
     }
 }