コード例 #1
0
 /**
  * Adds data to Wpt global object
  * @param string $key
  * @param mixed $value
  * @return self
  */
 protected function addJsData($key, $value)
 {
     if (empty($this->jsData)) {
         $actionTag = !$this->wp->didAction('wp_print_scripts') ? 'wp_print_scripts' : 'wp_print_footer_scripts';
         $this->wp->addAction($actionTag, array($this, 'renderJsData'));
     }
     $this->jsData[$key] = $value;
     return $this;
 }
コード例 #2
0
ファイル: Facade.php プロジェクト: pmanterys/wp-mw-newsletter
 protected function registerWordPressHooks()
 {
     $class = get_class($this);
     $this->wp->addAction('init', array($this, 'registerWordPressEntities'))->addAction('plugins_loaded', array($this, 'loadLocale'))->addShortcode('wptlist', array($this, 'shortcodeList'));
     $isPublicPage = !$this->wp->isAdministrationPage();
     if ($isPublicPage) {
         $this->wp->addFilter('pre_get_posts', array($this, 'setupPostBrowser'))->addFilter('single_template', array($this, 'setupTestPasser'));
         return;
     }
     $this->wp->registerActivationHook(array($this, 'onPluginActivate'))->addFilter('upgrader_post_install', array($this, 'onPluginUpgrade'), 10, 2)->registerDeactivationHook(array($this, 'onPluginDeactivate'))->registerUninstallHook(array($class, 'onPluginUninstall'))->addAction('admin_menu', array($this, 'registerAdminPages'))->addAction('admin_init', array($this, 'setupTestEditorInBackground'))->addFilter('current_screen', array($this, 'setupTestEditor'));
 }