Beispiel #1
0
 /**
  * add_wpts_button::add_wpts_button()
  * the constructor
  * 
  * @return void
  */
 function add_wpts_button()
 {
     // Set path to editor_plugin.js
     $this->path = wpts_url($path = 'tinymce/');
     // Modify the version when tinyMCE plugins are changed.
     add_filter('tiny_mce_version', array(&$this, 'change_tinymce_version'));
     // init process for button control
     add_action('init', array(&$this, 'addbuttons'));
 }
 function wpts_wp_init()
 {
     global $post, $wpts, $default_tab_settings;
     foreach ($default_tab_settings as $key => $value) {
         if (!isset($wpts[$key])) {
             $wpts[$key] = '';
         }
     }
     if (is_singular() or $wpts['enable_everywhere'] == '1') {
         $enablewpts = get_post_meta($post->ID, 'enablewpts', true);
         if (isset($wpts['posts'])) {
             $wpposts = $wpts['posts'];
         } else {
             $wpposts = '';
         }
         if (isset($wpts['pages'])) {
             $wppages = $wpts['pages'];
         } else {
             $wppages = '';
         }
         // check whether cookie is set for last active tab
         if (isset($wpts['enablecookie'])) {
             $enablecookie = $wpts['enablecookie'];
         } else {
             $enablecookie = '0';
         }
         if (is_page() and (!empty($enablewpts) and $enablewpts == '1' or $wppages != '0') or is_single() and (!empty($enablewpts) and $enablewpts == '1' or $wpposts != '0') or $wpts['enable_everywhere'] == '1') {
             $css = "css/styles/" . $wpts['stylesheet'] . '/style.css';
             wp_enqueue_style('wpts_ui_css', wpts_url($css), false, WPTS_VER, 'all');
             if (isset($wpts['jquerynoload']) and $wpts['jquerynoload'] == '1') {
                 wp_deregister_script('jquery');
                 wp_enqueue_script('jquery-ui-tabs', false, array('jquery-ui-core'), WPTS_VER, true);
             } else {
                 wp_enqueue_script('jquery-ui-tabs', false, array('jquery', 'jquery-ui-core'), WPTS_VER, true);
             }
             if ($enablecookie == '1') {
                 wp_enqueue_script('jquery-cookie', wpts_plugin_url('js/jquery.cookie.js'), array('jquery'), WPTS_VER, true);
             }
             // JS added
             wp_enqueue_script('jquery-posttabs', wpts_plugin_url('js/jquery.posttabs.js'), array('jquery'), WPTS_VER, true);
             global $wpts_count, $wpts_tab_count, $wpts_content, $wpts_prev_post;
             $wpts_count = 0;
             $wpts_tab_count = 0;
             $wpts_prev_post = '';
             $wpts_content = array();
         }
     }
 }