Пример #1
0
 public function onAction_wp_head(tubepress_api_event_EventInterface $event)
 {
     /* no need to print anything in the head of the admin section */
     if ($this->_wpFunctions->is_admin()) {
         return;
     }
     /* this inline JS helps initialize TubePress */
     echo $this->_htmlGenerator->getCSS();
     echo $this->_htmlGenerator->getJS();
 }
Пример #2
0
 public function onAction_init(tubepress_api_event_EventInterface $event)
 {
     /* no need to queue any of this stuff up in the admin section or login page */
     if ($this->_wpFunctions->is_admin() || __FILE__ === 'wp-login.php') {
         return;
     }
     $baseName = basename(TUBEPRESS_ROOT);
     $ajaxUrl = $this->_wpFunctions->plugins_url('web/js/wordpress-ajax.js', "{$baseName}/tubepress.php");
     $version = $this->_environment->getVersion();
     $this->_wpFunctions->wp_register_script('tubepress_ajax', $ajaxUrl, array('tubepress'), "{$version}");
     $this->_wpFunctions->wp_enqueue_script('jquery', false, array(), false, false);
     $this->_wpFunctions->wp_enqueue_script('tubepress_ajax', false, array(), false, false);
     $this->_enqueueThemeResources($this->_wpFunctions, $version);
 }