示例#1
0
function wpi_register_widgets()
{
    global $wp_query;
    if (wpi_option('widget_treeview')) {
        wpi_overwrite_widget_cat();
    }
    if (is_active_widget('wp_widget_recent_comments')) {
        remove_filter('wp_head', 'wp_widget_recent_comments_style');
    }
    wpi_grid_sidebar_filter();
    // custom widgets
    wpi_foreach_hook(array('wpi_before_sidebar_4', 'wpi_sidebar_4_nowidget', 'wpi_before_sidebar_7'), 'wpi_widget_post_summary');
    if (wpi_option('widget_related_post')) {
        wpi_foreach_hook(array('wpi_before_sidebar_4', 'wpi_sidebar_4_nowidget'), 'wpi_widget_related_post');
    }
    wpi_foreach_hook(array('wpi_after_sidebar_4', 'wpi_sidebar_4_nowidget'), 'wpi_widget_single_nav');
    // author
    wpi_foreach_hook(array('wpi_before_sidebar_13', 'wpi_sidebar_13_nowidget'), 'wpi_widget_author_stalker_pass');
    // author info
    wpi_foreach_hook(array('wpi_before_sidebar_13', 'wpi_sidebar_13_nowidget'), 'wpi_widget_author_summary');
    add_action('wpi_after_sidebar_7', 'wpi_widget_subpages');
    add_action('wpi_before_sidebar_7', 'wpi_most_download_widget', 11);
}
示例#2
0
 /**
  * Wpi::__construct()
  * 
  * @return
  */
 public function __construct()
 {
     self::getFile(array('filters-enum', 'client', 'style', 'template', 'gravatar', 'sidebar'), 'class');
     self::getFile(array('browscap', 'body_class'), 'import');
     self::getFile(array('utils', 'formatting', 'filters', 'query', 'links', 'template', 'plugin', 'widgets', 'comments', 'author'));
     if (is_admin()) {
         add_action('admin_menu', array($this, 'setThemeOptions'));
         // post template form
         wpi_foreach_hook(array('simple_edit_form', 'edit_form_advanced', 'edit_page_form'), 'wpi_post_metaform');
         wpi_foreach_hook(array('edit_post', 'publish_post', 'save_post', 'edit_page_form'), 'wpi_update_post_form');
         // User profile form
         wpi_foreach_hook(array('profile_personal_options' => 'wpi_profile_options', 'personal_options_update' => 'wpi_profile_options_update'));
     }
     wpi_plugin_init();
     wpi_default_filters();
     // client browser
     $this->Browser = new Browscap(WPI_CACHE_DIR);
     if (is_object($this->Browser)) {
         $this->setBrowscapPref();
     }
     // section
     $this->section = is_at();
     // lost
     // scripts
     if ($this->Browser->JavaScript) {
         self::getFile('scripts', 'class');
         $this->Script = new wpiScripts();
         $js = array('jquery' => 'head', 'tooltip' => 'head', 'footer' => 'footer', 'css' => 'footer');
         if (wpi_option('client_time_styles')) {
             $js['cookie'] = 'head';
             $js['client-time'] = 'head';
         }
         // default scripts library
         $this->registerScript($js);
         if (wpi_option('widget_treeview')) {
             $this->registerScript(array('treeview' => 'head', 'f-treeview' => 'footer'));
         }
         add_action('wp_head', array($this->Script, 'printHead'), 10);
         add_action('wp_head', array($this->Script, 'embedScript'), 10);
         add_action(wpiFilter::ACTION_FOOTER_SCRIPT, array($this->Script, 'printFooter'), 10);
     }
     // stylesheets
     if ($this->Browser->supportsCSS && !is_admin() && !is_feed()) {
         $this->Style = new wpiStyle();
         $this->Style->client_css_version = $this->Browser->CssVersion;
         if (wpi_option('widget_treeview')) {
             $this->Style->register('image-treeview');
         }
         if (is_active_widget('widget_flickrRSS')) {
             // load at active section
             $widget_id = 'flickrrss';
             $active = wpi_widget_active_section($widget_id);
             foreach ($active as $k => $section) {
                 $this->Style->register($widget_id, $section);
             }
             unset($active, $widget_id);
         }
         if (wpi_is_plugin_active('global-translator/translator.php')) {
             $tag = 'translator-image';
             $this->Style->register($tag, wpiSection::SINGLE);
             $this->Style->register($tag, wpiSection::PAGE);
             $this->Style->register($tag, wpiSection::ATTACHMENT);
         }
         if (wpi_option('css_via_header')) {
             $this->Style->printStyles();
         } else {
             add_action(wpiFilter::ACTION_META_LINK, array($this->Style, 'printStyles'));
         }
     }
     // sidebar
     $this->Sidebar = new wpiSidebar();
     $this->Sidebar->setSidebar();
     // custom header
     $this->Template = new wpiTemplate();
     if (defined(WPI_DEBUG)) {
         add_action('wp_footer', array($this, 'debug'));
     }
     // self::debugDefaultFilters()
 }