Exemplo n.º 1
0
/**
 *  author display_name
 *  
 */
function wpi_get_author_name($type = 'hcard')
{
    global $authordata;
    $name = $display_name = apply_filters('the_author', $authordata->display_name);
    $name = $display_name = ent2ncr(htmlentities2($name));
    $author_url = $authordata->user_url;
    $author_url = $author_url != 'http://' ? $author_url : WPI_URL;
    switch ($type) {
        case 'link':
            /** simple links
             *	
             */
            $attribs = array('href' => $author_url, 'class' => 'url fn dc-creator', 'rel' => 'colleague foaf.homepage foaf.maker', 'title' => 'Visit ' . $display_name . ''s Website', 'rev' => 'author:' . $authordata->user_nicename);
            $output = _t('a', $display_name, $attribs);
            break;
        case 'hcard':
            /** convert to microformats
             *	address:a:span
             */
            // split the name
            $name = explode('name', $name);
            if (is_array($name)) {
                if (Wpi::hasCount($name)) {
                    if (isset($name[0])) {
                        $output = _t('span', $name[0], array('class' => 'nickname'));
                    }
                    if (isset($name[1])) {
                        $output = _t('span', $name[0], array('class' => 'given-name')) . ' ';
                        $output .= _t('span', $name[1], array('class' => 'family-name'));
                    }
                }
            } else {
                $output = _t('span', $author_name, array('class' => 'nickname'));
            }
            // author post url;
            $url = get_author_posts_url($authordata->ID, $authordata->user_nicename);
            $url = apply_filters(wpiFilter::FILTER_LINKS, $url);
            $attribs = array('href' => $url, 'class' => 'url fn dc-creator', 'rel' => 'colleague foaf.homepage foaf.maker', 'title' => 'Visit ' . $display_name . ''s Author page', 'rev' => 'author:' . $authordata->user_nicename);
            $output = _t('a', $output, $attribs);
            // microID sha-1 hash
            $hash = get_microid_hash($authordata->user_email, $author_url);
            // wrap hcard
            $output = _t('cite', $output, array('class' => 'vcard microid-' . $hash));
            break;
        default:
            $output = $name;
            break;
    }
    return apply_filters(wpiFilter::FILTER_AUTHOR_NAME . $type, $output);
}
Exemplo n.º 2
0
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;
    }
}
Exemplo n.º 3
0
 /**
  *  Single 'Articles view'
  */
 public function getSingle()
 {
     global $wp_query;
     $wp_title = trim(wp_title('', false));
     $title = string_len($wp_title, 90);
     $pathway = array();
     //  rss
     $pathway['first'] = array('Comments RSS', array('href' => get_post_comments_feed_link(), 'type' => 'application/rss+xml', 'title' => __($title . ' | Comments Feed', WPI_META), 'hreflang' => get_hreflang(), 'rel' => self::RSS_REL, 'class' => 'rtxt rss16', 'rev' => 'feed:rss2'));
     // home
     $pathway['home'] = $this->getFrontpage();
     // category
     $cat = wpi_get_first_cat_obj();
     if (is_object($cat)) {
         $pathway['archive'] = array(wp_specialchars($cat->name), array('href' => get_category_link($cat->term_id), 'title' => __('Topic | Archive for ' . $cat->name, WPI_META), 'rel' => 'tags dc-subject', 'class' => 'cat-link', 'rev' => 'archive:term'));
     }
     unset($cat);
     //  articles
     $articles = array($title, array('href' => get_permalink() . '#iscontent', 'title' => __('Skip to content | ' . self::PSEP . ' ' . $wp_title . ' ', WPI_META), 'hreflang' => get_hreflang(), 'class' => self::DN_ARROW, 'rel' => 'robots-anchortext'));
     if (($page_no = wpi_get_post_current_paged()) != false) {
         $pathway['post'] = $articles;
         $pathway['post'][1]['href'] = str_rem('#content', $pathway['post'][1]['href']);
         $pathway['post'][1]['title'] = str_replace('Skip to content ', 'Back to ', $pathway['post'][1]['title']);
         $title = sprintf(__('Page %d', WPI_META), $page_no);
         $pathway['last'] = array($title, array('href' => Wpi::selfURL() . '#iscontent', 'title' => __('Skip to Content | ' . $title, WPI_META)));
     } else {
         $pathway['last'] = $articles;
     }
     return $pathway;
 }
Exemplo n.º 4
0
function wpi_get_pathway()
{
    if (!class_exists('wpiPathway')) {
        Wpi::getFile('pathway', wpiTheme::LIB_TYPE_CLASS);
    }
    $pt = new wpiPathway();
    return $pt->build();
}
Exemplo n.º 5
0
 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');
 }