Exemple #1
0
function wpi_template_nopost()
{
    if (is_search()) {
        $terms = get_search_query();
        t('h5', 'Sorry, no matching articles for <strong>' . $terms . '</strong>.');
        t('script', '', array('id' => 'wpi-google-webmaster-widgets', 'type' => 'text/javascript', 'src' => 'http://linkhelp.clients.google.com/tbproxy/lh/wm/fixurl.js'));
        $r = new WP_Query(array('showposts' => 15, 'what_to_show' => 'posts', 'nopaging' => 0, 'post_status' => 'publish'));
        if ($r->have_posts()) {
            ?>
	<hr class="hr-line"/>
	<h3>Recent posts</h3>
			<ul class="xoxo">
			<?php 
            while ($r->have_posts()) {
                $r->the_post();
                ?>
			<li><a href="<?php 
                the_permalink();
                ?>
"><?php 
                if (get_the_title()) {
                    the_title();
                } else {
                    the_ID();
                }
                ?>
 </a></li>
			<?php 
            }
            ?>
			</ul>
<?php 
            wp_reset_query();
        }
    } else {
        $c = _t('img', '', array('src' => wpi_img_url('err.jpg'), 'class' => 'thumb fl'));
        $f = _t('form', _t('div', _t('strong', 'Marvin&apos;s error log:', array('class' => 'pdl')) . _t('textarea', '', array('row' => '8', 'cols' => '60', 'wrap' => 'soft', 'class' => 'db mgt')), array('class' => 'fl')));
        t('div', $c . $f, array('class' => 'span-22 mgt pdt'));
        t('script', '', array('type' => 'text/javascript', 'src' => wpi_get_scripts_url('404')));
        t('div', _t('script', '', array('id' => 'wpi-google-webmaster-widgets', 'type' => 'text/javascript', 'src' => 'http://linkhelp.clients.google.com/tbproxy/lh/wm/fixurl.js')), array('id' => 'google-webmaster', 'class' => 'cb mgt rx hr-line tl span-22 pdt'));
    }
}
Exemple #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'));
 }