function wpi_default_filters() { $f = array(); $f['stylesheet_directory'] = 'wpi_get_stylesheet_directory_filter'; $f['stylesheet_directory_uri'] = 'wpi_stylesheet_directory_uri_filter'; $f['stylesheet_uri'] = 'wpi_get_stylesheet_uri_filter'; wpi_foreach_hook_filter($f); }
function wpi_current_template() { $section = is_at(); $callback = 'wpi_template_' . $section; if (!wpi_user_func_exists($callback)) { wpi_template_404(); } else { $f = array(); $f['wpi_authordata_display_name'] = 'wpi_author_display_name_filter'; //$f['the_content'] = 'wpi_attachment_image_filters'; if ($section == wpiSection::CATEGORY || $section == wpiSection::TAXONOMY || $section == wpiSection::ARCHIVE || $section == wpiSection::YEAR || $section == wpiSection::MONTH || $section == wpiSection::DAY) { $f['the_content'] = 'wpi_cat_content_filter'; } if ($section == wpiSection::SEARCH) { $f['the_content'] = 'wpi_search_content_filter'; } if ($section == wpiSection::SINGLE || $section == wpiSection::PAGE || $section == wpiSection::HOME) { $f['the_content'] = 'wpi_google_ads_targeting_filter'; } wpi_foreach_hook_filter($f); call_user_func($callback); foreach ($f as $h => $c) { remove_filter($h, $c); } unset($f); } }
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'); }