/** * 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() }
function wpi_register_plugins() { $plugins = get_wpi_plugins(); if (is_array($plugins) && has_count($plugins)) { foreach ($plugins as $plugin) { if (Wpi::loadPlugin($plugin['name'])) { $callback = 'wpi_get_' . $plugin['id'] . '_pluginname'; if (wpi_is_user_func_exists($callback)) { $plugin_filename = (string) call_user_func($callback); if (wpi_is_plugin_active($plugin_filename)) { $init_callback = 'wpi_' . $plugin['id'] . '_init'; if (wpi_is_user_func_exists($init_callback)) { call_user_func($init_callback); } } } } } } else { return false; } }
public function __construct() { global $wp_query; add_filter('query_vars', array($this, 'registerPublicVar')); $this->action('template_redirect', 'processVar'); $this->action('init', 'flushWPRewriteRules'); $this->action('generate_rewrite_rules', 'rewriteRules'); $this->action('init', 'registerWidgets'); if (wpi_option('text_dir') != 'ltr' && !is_admin()) { add_filter('language_attributes', array($this, 'textDirection')); } if (wpi_option('relative_links')) { add_filter('wpi_links_home', 'rel'); add_filter('wpi_links_single', 'rel'); add_filter(wpiFilter::FILTER_LINKS, 'rel'); } // http header $this->action('send_headers', 'httpHeader'); if (wpi_option('banner')) { $this->action(wpiFilter::ACTION_SECTION_PREFIX . 'pathway_after', 'banner'); $this->action(wpiFilter::ACTION_INTERNAL_CSS, 'bannerIntenalCSS'); } // dtd $this->action(wpiFilter::ACTION_DOCUMENT_DTD, 'dtd', 1); if (!wpi_option('meta_rsd')) { remove_filter('wp_head', 'rsd_link', 10, 1); } if (!wpi_option('meta_livewriter')) { remove_filter('wp_head', 'wlwmanifest_link', 10, 1); } if (!wpi_option('meta_wp_generator')) { remove_filter('wp_head', 'wp_generator', 10, 1); } // head $this->action(wpiFilter::ACTION_META_HTTP_EQUIV, 'metaHTTP'); $this->action(wpiFilter::ACTION_META, 'meta'); $this->action(wpiFilter::ACTION_META_LINK, 'metaLink'); $this->action('wp_head', 'registerMetaActionFilters', 2); if (wpi_option('meta_title')) { $this->action('wp_head', 'headTitle', 1); } // custom content $this->action('wp_head', 'headCustomContent', wpiTheme::LAST_PRIORITY); $this->action('wp_footer', 'footerCustomContent', wpiTheme::LAST_PRIORITY); /** * Content */ // header $this->action(wpiFilter::ACTION_TPL_HEADER, 'htmlBlogContentHeader'); // content if (wpi_option('relative_date')) { if (!wpi_user_func_exists('time_since')) { Wpi::getFile('timesince', wpiTheme::LIB_TYPE_IMPORT); } wpi_foreach_hook_filter(array(wpiFilter::FILTER_POST_DATE, wpiFilter::FILTER_COM_DATE), 'wpi_get_relative_date'); } add_action(wpiFilter::ACTION_SECTION_PREFIX . 'meta-title_content', 'wpi_content_meta_title_filter'); $this->action(wpiFilter::ACTION_SECTION_PREFIX . 'content-end_content', 'navLink'); if (!wpi_is_plugin_active('wp-pagenavi/wp-pagenavi.php')) { add_action(wpiFilter::ACTION_POST_PAGINATION, 'wpi_post_link'); } add_filter(wpiFilter::FILTER_COMMENTS_SELECTOR, 'wpi_post_author_selector_filter'); add_filter('get_comment_text', 'wpi_get_comment_text_filter'); // footer $this->action('wp_footer', 'footerCopyright', 1); $this->action(wpiFilter::ACTION_COPYRIGHT_STATEMENTS, 'validationServices'); add_action('wp_footer', 'wpi_register_widgets'); }