Пример #1
0
function wpi_most_download_widget()
{
    if (!wpi_user_func_exists('get_most_downloaded')) {
        return false;
    }
    global $wp_query;
    // asume downloads is located at download page
    if (get_option('download_page_url') != self_uri()) {
        return;
    }
    $limit = 5;
    wpi_widget_start('Most downloads', 'most-downloads');
    $htm = get_most_downloaded($limit, 0, false);
    t('ul', $htm, array('class' => 'select-odd'));
    wpi_widget_end();
}
Пример #2
0
 public function embedScript()
 {
     global $wp_query;
     list($lang, $locale) = explode('-', get_bloginfo('language'));
     $pid = isset($wp_query->post->ID) ? $wp_query->post->ID : 0;
     $js = PHP_EOL . PHP_T;
     $js .= '/*<![CDATA[*/' . PHP_EOL . PHP_T . PHP_T;
     $js .= 'var wpi = {url:' . json_encode(WPI_URL_SLASHIT);
     $js .= ',id:' . json_encode(wpiTemplate::bodyID());
     $js .= ',blogname:' . json_encode(WPI_BLOG_NAME);
     $js .= ',theme_url:' . json_encode(WPI_THEME_URL);
     $js .= ',section:' . json_encode(is_at());
     $js .= ',permalink:' . json_encode(trailingslashit(self_uri()));
     $jspath = json_encode(rel(WPI_THEME_URL . 'public/scripts/'));
     $jsurl = json_encode(wpi_get_scripts_url('%s'));
     $js .= ',script:{path:' . $jspath . ',url:' . $jsurl . '}';
     if (wpi_option('client_time_styles')) {
         $js .= ',pid:' . $pid . ',cl_type:td};jQuery(document).ready(function(){if( $(\'#\'+wpi.id).hasClass(wpi.cl_type) == false){ $(\'#\'+wpi.id).addClass(wpi.cl_type);jQuery.cookie(\'wpi-cl\',wpi.cl_type,{duration: 1/24,path: "/"});};});' . PHP_EOL;
     } else {
         $js .= ',pid:' . $pid . '};' . PHP_EOL;
     }
     // check client cookie;
     if ($wp_query->is_search || $wp_query->is_404) {
         // google webmaster 404 widget
         $js .= PHP_T . PHP_T . 'var GOOG_FIXURL_LANG = \'' . $lang . '\';var GOOG_FIXURL_SITE = wpi.url;' . PHP_EOL;
     }
     $js .= PHP_T . '/*]]>*/' . PHP_EOL . PHP_T;
     echo PHP_T;
     t('script', $js, array('id' => 'wp-js-head-embed', 'type' => 'text/javascript', 'defer' => 'defer', 'charset' => 'utf-8'));
 }
Пример #3
0
function wpi_content_meta_title_filter()
{
    global $wp_query;
    $title = get_the_title();
    $output = false;
    if ($wp_query->is_single || $wp_query->is_page) {
        $htm = _t('strong', $title);
        $htm .= wpi_get_subtitle();
        $output = _t('h1', $htm);
    }
    if ($wp_query->is_category) {
        $title = single_cat_title('', false);
        $htm = _t('strong', $title);
        $output = _t('h1', $htm);
        if (($desc = $wp_query->queried_object->category_description) != '') {
            $output .= _t('blockquote', _t('p', $desc . '&nbsp;'), array('cite' => self_uri(), 'class' => 'entry-summary r'));
        } else {
            $desc = WPI_BLOG_NAME . '&apos;s archive for ' . $title . ', there is ' . $wp_query->queried_object->count . ' articles for this &apos;main&apos; category.';
            $output .= _t('blockquote', _t('p', $desc . '&nbsp;'), array('cite' => self_uri(), 'class' => 'entry-summary r'));
        }
    }
    if ($wp_query->is_tag) {
        $title = single_tag_title('', false);
        $htm = _t('strong', $title);
        $output = _t('h1', $htm, array('title' => $title));
        $desc = WPI_BLOG_NAME . '&apos;s taxonomy archive for ' . $title . ', there is ' . $wp_query->queried_object->count . ' article(s) for this tag.';
        $output .= _t('blockquote', _t('p', $desc . '&nbsp;'), array('cite' => self_uri(), 'class' => 'entry-summary r'));
    }
    if ($wp_query->is_search) {
        $title = get_search_query();
        $htm = _t('small', __('Search results for: ', WPI_META));
        $htm .= _t('strong', $title);
        $output = _t('h1', $htm, array('title' => $title));
    }
    if ($wp_query->is_year) {
        $title = get_the_time('Y');
        $htm = _t('strong', $title);
        $output = _t('small', __('Archive for', WPI_META));
        $output .= _t('h1', $htm, array('title' => $title));
    }
    if ($wp_query->is_month) {
        $title = get_the_time('F, Y');
        $htm = _t('strong', $title);
        $output = _t('small', __('Archive for', WPI_META));
        $output .= _t('h1', $htm, array('title' => $title));
    }
    if ($wp_query->is_day) {
        $title = get_the_time('F jS, Y');
        $htm = _t('strong', $title);
        $output = _t('small', __('Archive for', WPI_META));
        $output .= _t('h1', $htm, array('title' => $title));
    }
    if ($wp_query->is_author) {
        $user = wpi_get_current_author();
        $title = $user->display_name;
        $htm = _t('strong', $title);
        $output = _t('h1', $htm, array('title' => $title));
        $desc = $user->user_description;
        $output .= _t('blockquote', _t('p', $desc . '&nbsp;'), array('cite' => self_uri(), 'class' => 'entry-summary r'));
    }
    if ($wp_query->is_404) {
        $htm = _t('strong', __('404 Not Found', WPI_META));
        $output = _t('h1', $htm, array('title' => $title));
        $desc = 'Sorry, but you are looking for something that isn&apos;t here';
        $output .= _t('blockquote', _t('p', $desc . '&nbsp;'), array('cite' => self_uri(), 'class' => 'entry-summary r'));
    }
    $output = wpi_google_ads_targeting_filter($output);
    if ($output) {
        echo stab(1) . $output;
    }
    //wpi_dump($wp_query); exit;
    unset($output, $section, $title, $htm);
}
Пример #4
0
 public function getHtmlBlogDescription()
 {
     $output = PHP_EOL;
     $output .= self::spacing(1) . _t('p', get_bloginfo('description'), array('id' => 'blog-description', 'class' => 'note site-summary'));
     $output = self::spacing() . _t('blockquote', self::spacing(1) . $output . self::spacing(), array('cite' => self_uri() . '#blog-description', 'class' => 'description'));
     return $output;
 }