• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP zeroise函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中zeroise函数的典型用法代码示例。如果您正苦于以下问题:PHP zeroise函数的具体用法?PHP zeroise怎么用?PHP zeroise使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了zeroise函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: add_recipe_classes

 /**
  * Add special Simmer classes for recipes.
  *
  * @since 1.2.0
  * @see post_class()
  *
  * @param  array        $classes   The existing classes as generated by WordPress.
  * @param  string|array $class     Optional. Any custom classes passed by the post_class() function.
  * @param  int|bool     $recipe_id Optional. The current recipe ID.
  * @return array        $classes   The newly generated recipe classes.
  */
 public function add_recipe_classes($classes, $class = '', $recipe_id = false)
 {
     if (simmer_get_object_type() !== get_post_type($recipe_id) || !$recipe_id) {
         return $classes;
     }
     $classes[] = 'simmer-recipe';
     // Check for ingredients and add the appropriate classes.
     $ingredients = simmer_get_the_ingredients();
     if (!empty($ingredients)) {
         $classes[] = 'simmer-has-ingredients';
         $classes[] = 'simmer-ingredients-' . zeroise(count($ingredients), 2);
     } else {
         $classes[] = 'simmer-no-ingredients';
     }
     // Check for instructions and add the appropriate classes.
     $instructions = simmer_get_the_instructions();
     if (!empty($instructions)) {
         $classes[] = 'simmer-has-instructions';
         $classes[] = 'simmer-instructions-' . zeroise(count($instructions), 2);
     } else {
         $classes[] = 'simmer-no-instructions';
     }
     /**
      * Filter the recipe classes.
      *
      * @since 1.2.0
      *
      * @param array  $classes   The generated recipe classes.
      * @param string $class     Optional. Additional classes to to add, passed by the post_class function.
      * @param int    $recipe_id Optional. The current recipe's ID.
      */
     $classes = apply_filters('simmer_recipe_classes', $classes, $class, $recipe_id);
     return $classes;
 }
开发者ID:robneu,项目名称:simmer,代码行数:45,代码来源:class-simmer-frontend-html-classes.php


示例2: meta_box

 function meta_box()
 {
     global $wpdb, $post, $wp_locale;
     $ed = get_post_meta($post->ID, '_expiration_date', true);
     if ($ed) {
         $edy = date('Y', $ed);
         $edm = date('m', $ed);
         $edd = date('d', $ed);
     } else {
         $edy = $edm = $edd = '';
     }
     $month = '<select id="edm" name="edm" index="5002">';
     $month .= '<option value=""';
     if ($edm == '') {
         $month .= ' selected="selected"';
     }
     $month .= '></option>\\n';
     for ($i = 1; $i < 13; $i = $i + 1) {
         $month .= '<option value="' . zeroise($i, 2) . '"';
         if ($i == $edm) {
             $month .= ' selected="selected"';
         }
         $month .= '>' . $wp_locale->get_month($i) . '</option>';
     }
     $month .= '</select>';
     $day = '<input type="text" id="edd" name="edd" value="' . $edd . '" size="2" maxlength="2" autocomplete="off" index="5003" />';
     $year = '<input type="text" id="edy" name="edy" value="' . $edy . '" size="4" maxlength="4" autocomplete="off" index="5001" />';
     echo '<input type="hidden" name="expiration_date_nonce" value="' . wp_create_nonce('expiration_date') . '">';
     echo '<p>' . __('Post expires at the end of (Year/Month/Day)', 'Hetjens_Expiration_Date') . '<br />' . $year . ' ' . $month . ' ' . $day . '</p>';
     echo '<p>' . __('Leave blank for no expiration date.', 'Hetjens_Expiration_Date') . '</p>';
 }
开发者ID:rtgibbons,项目名称:bya.org,代码行数:31,代码来源:Hetjens_Expiration_Date.php


示例3: _b_wp_archives_monthly_show

 function _b_wp_archives_monthly_show($options, $wp_num = '')
 {
     $block_style = $options[0] ? $options[0] : 0;
     $with_count = $options[1] == 0 ? false : true;
     $tpl_file = empty($options[2]) ? 'wp_archives_monthly.html' : $options[2];
     $sel_value = '';
     if (current_wp()) {
         if (!empty($_SERVER['PATH_INFO'])) {
             permlink_to_param();
         }
         init_param('GET', 'm', 'string', '');
         init_param('GET', 'year', 'integer', '');
         init_param('GET', 'monthnum', 'integer', '');
         init_param('GET', 'day', 'integer', '');
         if (strlen(get_param('m')) == 6) {
             $sel_value = get_param('m');
         } else {
             if (test_param('year') && test_param('monthnum') && !test_param('day')) {
                 $sel_value = get_param('year') . zeroise(get_param('monthnum'), 2);
             }
         }
     }
     $block['wp_num'] = $wp_num;
     $block['divid'] = 'wpArchive' . $wp_num;
     $block['siteurl'] = wp_siteurl();
     $block['style'] = block_style_get(false);
     $block['block_style'] = $block_style;
     $block['with_count'] = $with_count;
     $now = current_time('mysql');
     $postHandler =& wp_handler('Post');
     $criteria =& new CriteriaCompo(new Criteria('post_date', $now, '<'));
     $criteria->add(new Criteria('post_status', 'publish'));
     $criteria->setSort('post_date');
     $criteria->setOrder('DESC');
     $criteria->setGroupby('YEAR(post_date), MONTH(post_date)');
     $postObjects =& $postHandler->getObjects($criteria, false, 'DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, count(ID) as posts');
     $block['records'] = array();
     if ($postObjects) {
         foreach ($postObjects as $postObject) {
             $this_year = $postObject->getExtraVar('year');
             $this_month = $postObject->getExtraVar('month');
             $_record['url'] = get_month_link($this_year, $this_month);
             $_record['text'] = format_month($this_year, $GLOBALS['month'][zeroise($this_month, 2)]);
             if ($with_count) {
                 $_record['count'] = '&nbsp;(' . $postObject->getExtraVar('posts') . ')';
             } else {
                 $_record['count'] = '';
             }
             $_record['select'] = $sel_value == $this_year . zeroise($this_month, 2) ? 'selected="selected"' : '';
             $block['records'][] = $_record;
         }
     }
     $_wpTpl =& new WordPresTpl('theme');
     $_wpTpl->assign('block', $block);
     if (!$_wpTpl->tpl_exists($tpl_file)) {
         $tpl_file = 'wp_archives_monthly.html';
     }
     $block['content'] = $_wpTpl->fetch($tpl_file);
     return $block;
 }
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:60,代码来源:wp_archives_monthly.php


示例4: render

 public function render($user)
 {
     global $wp_locale;
     echo '<tr>';
     echo '<th><label for="' . $this->_id . '">' . $this->_params['label'] . '</label></th>';
     echo '<td>';
     $time_adj = current_time('timestamp');
     $date = $this->_value($user);
     $jj = $date ? mysql2date('d', $date, false) : gmdate('d', $time_adj);
     $mm = $date ? mysql2date('m', $date, false) : gmdate('m', $time_adj);
     $aa = $date ? mysql2date('Y', $date, false) : gmdate('Y', $time_adj);
     $month = '<label><span class="screen-reader-text">' . __('Month') . '</span><select id="' . $this->_id . '_mm" name="' . $this->_name . '[mm]"' . ">\n";
     for ($i = 1; $i < 13; $i = $i + 1) {
         $monthnum = zeroise($i, 2);
         $monthtext = $wp_locale->get_month_abbrev($wp_locale->get_month($i));
         $month .= "\t\t\t" . '<option value="' . $monthnum . '" data-text="' . $monthtext . '" ' . selected($monthnum, $mm, false) . '>';
         $month .= sprintf(__('%1$s-%2$s'), $monthnum, $monthtext) . "</option>\n";
     }
     $month .= '</select></label>';
     $day = '<label><span class="screen-reader-text">' . __('Day') . '</span><input type="text" id="' . $this->_id . '_jj" name="' . $this->_name . '[jj]" value="' . $jj . '" size="2" maxlength="2"' . ' autocomplete="off" /></label>';
     $year = '<label><span class="screen-reader-text">' . __('Year') . '</span><input type="text" id="' . $this->_id . '_aa" name="' . $this->_name . '[aa]" value="' . $aa . '" size="4" maxlength="4"' . ' autocomplete="off" /></label>';
     echo $day . $month . $year;
     echo $this->_description();
     echo '</td>';
     echo '</tr>';
 }
开发者ID:adriend,项目名称:morepress,代码行数:26,代码来源:Date.php


示例5: html

    public function html($meta, $repeatable = null)
    {
        global $wp_locale;
        is_array($meta);
        $name = is_null($repeatable) ? $this->_name : $this->_name . '[' . $repeatable . ']';
        $id = is_null($repeatable) ? $this->_id : $this->_id . '_' . $repeatable;
        echo '<tr>';
        echo '
			<th scope="row">
				<label for="' . $id . '_jj">' . $this->_label . '</label>
			</th>
			<td>
        ';
        $jj = $meta ? mysql2date('d', $meta, false) : '';
        $mm = $meta ? mysql2date('m', $meta, false) : '';
        $aa = $meta ? mysql2date('Y', $meta, false) : '';
        $month = '<label><span class="screen-reader-text">' . __('Month') . '</span><select id="' . $id . '_mm" name="' . $name . '[mm]"' . ' ' . $this->_inputAttr() . '>';
        $month .= "\t\t\t" . '<option value="" data-text="" ' . selected('', $mm, false) . '>';
        $month .= "--</option>\n";
        for ($i = 1; $i < 13; $i = $i + 1) {
            $monthnum = zeroise($i, 2);
            $monthtext = $wp_locale->get_month_abbrev($wp_locale->get_month($i));
            $month .= "\t\t\t" . '<option value="' . $monthnum . '" data-text="' . $monthtext . '" ' . selected($monthnum, $mm, false) . '>';
            $month .= sprintf(__('%1$s-%2$s'), $monthnum, $monthtext) . "</option>\n";
        }
        $month .= '</select></label>';
        $day = '<label><span class="screen-reader-text">' . __('Day') . '</span><input type="number" min="1" max="31" id="' . $id . '_jj" name="' . $name . '[jj]" value="' . $jj . '" size="2" maxlength="2"' . ' autocomplete="off" ' . $this->_inputAttr() . '></label>';
        $year = '<label><span class="screen-reader-text">' . __('Year') . '</span><input type="number" id="' . $id . '_aa" name="' . $name . '[aa]" value="' . $aa . '" size="4" maxlength="4"' . ' autocomplete="off" ' . $this->_inputAttr() . '></label>';
        echo $day . $month . $year;
        if (!empty($this->_description)) {
            echo '<p class="description">' . $this->_description . '</p>';
        }
        echo '</td>';
        echo '</tr>';
    }
开发者ID:daidais,项目名称:morepress,代码行数:35,代码来源:Date.php


示例6: get_posted_value

 /**
  * Gets the posted value of the setting.
  *
  * @since  1.0.0
  * @access public
  * @return mixed
  */
 public function get_posted_value()
 {
     // Get the posted year, month, and day.
     $year = !empty($_POST["ccp_{$this->manager->name}_setting_{$this->name}_year"]) ? zeroise(absint($_POST["ccp_{$this->manager->name}_setting_{$this->name}_year"]), 4) : '';
     $month = !empty($_POST["ccp_{$this->manager->name}_setting_{$this->name}_month"]) ? zeroise(absint($_POST["ccp_{$this->manager->name}_setting_{$this->name}_month"]), 2) : '';
     $day = !empty($_POST["ccp_{$this->manager->name}_setting_{$this->name}_day"]) ? zeroise(absint($_POST["ccp_{$this->manager->name}_setting_{$this->name}_day"]), 2) : '';
     $new_date = $year && $month && $day ? "{$year}-{$month}-{$day} 00:00:00" : '';
     return $new_date;
 }
开发者ID:kraftner,项目名称:custom-content-portfolio,代码行数:16,代码来源:class-setting-date.php


示例7: export_plus_date_options

/**
 * Create the date options fields for exporting a given post type.
 *
 * @global wpdb      $wpdb      WordPress database object.
 * @global WP_Locale $wp_locale Date and Time Locale object.
 *
 * @since 3.1.0
 *
 * @param string $post_type The post type. Default 'post'.
 */
function export_plus_date_options($post_type = 'post')
{
    global $wpdb, $wp_locale;
    $start = $wpdb->get_results($wpdb->prepare("\n\t\tSELECT DISTINCT YEAR( post_date ) AS year, MONTH( post_date ) AS month, DAY( post_date ) AS day\n\t\tFROM {$wpdb->posts}\n\t\tWHERE post_type = %s AND post_status != 'auto-draft'\n\t\tORDER BY post_date ASC\n\t\tLIMIT 1\n\t", $post_type));
    if (!$start) {
        return;
    }
    $start_date = array('start_year' => $start[0]->year, 'start_month' => zeroise($start[0]->month, 2), 'start_day' => zeroise($start[0]->day, 2));
    return $start_date;
}
开发者ID:jacobwarduk,项目名称:Export-Plus,代码行数:20,代码来源:export-template.php


示例8: aec_touch_time

function aec_touch_time($edit = 1, $for_post = 1, $tab_index = 0, $commentID = 0)
{
    global $wp_locale, $post, $aecomments;
    $multi = 0;
    $comment = get_comment($commentID);
    if ($for_post) {
        $edit = !(in_array($post->post_status, array('draft', 'pending')) && (!$post->post_date_gmt || '0000-00-00 00:00:00' == $post->post_date_gmt));
    }
    $tab_index_attribute = '';
    if ((int) $tab_index > 0) {
        $tab_index_attribute = " tabindex=\"{$tab_index}\"";
    }
    // echo '<label for="timestamp" style="display: block;"><input type="checkbox" class="checkbox" name="edit_date" value="1" id="timestamp"'.$tab_index_attribute.' /> '.__( 'Edit timestamp' ).'</label><br />';
    $time_adj = current_time('timestamp');
    $post_date = $for_post ? $post->post_date : $comment->comment_date;
    $jj = $edit ? mysql2date('d', $post_date, false) : gmdate('d', $time_adj);
    $mm = $edit ? mysql2date('m', $post_date, false) : gmdate('m', $time_adj);
    $aa = $edit ? mysql2date('Y', $post_date, false) : gmdate('Y', $time_adj);
    $hh = $edit ? mysql2date('H', $post_date, false) : gmdate('H', $time_adj);
    $mn = $edit ? mysql2date('i', $post_date, false) : gmdate('i', $time_adj);
    $ss = $edit ? mysql2date('s', $post_date, false) : gmdate('s', $time_adj);
    $cur_jj = gmdate('d', $time_adj);
    $cur_mm = gmdate('m', $time_adj);
    $cur_aa = gmdate('Y', $time_adj);
    $cur_hh = gmdate('H', $time_adj);
    $cur_mn = gmdate('i', $time_adj);
    $month = "<select " . ($multi ? '' : 'id="mm" ') . "name=\"mm\"{$tab_index_attribute}>\n";
    for ($i = 1; $i < 13; $i = $i + 1) {
        $month .= "\t\t\t" . '<option value="' . zeroise($i, 2) . '"';
        if ($i == $mm) {
            $month .= ' selected="selected"';
        }
        $month .= '>' . $wp_locale->get_month_abbrev($wp_locale->get_month($i)) . "</option>\n";
    }
    $month .= '</select>';
    $day = '<input type="text" ' . ($multi ? '' : 'id="jj" ') . 'name="jj" value="' . $jj . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" />';
    $year = '<input type="text" ' . ($multi ? '' : 'id="aa" ') . 'name="aa" value="' . $aa . '" size="4" maxlength="4"' . $tab_index_attribute . ' autocomplete="off" />';
    $hour = '<input type="text" ' . ($multi ? '' : 'id="hh" ') . 'name="hh" value="' . $hh . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" />';
    $minute = '<input type="text" ' . ($multi ? '' : 'id="mn" ') . 'name="mn" value="' . $mn . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" />';
    echo '<div class="timestamp-wrap">';
    /* translators: 1: month input, 2: day input, 3: year input, 4: hour input, 5: minute input */
    printf(__('%1$s%2$s, %3$s @ %4$s : %5$s', 'ajaxEdit'), $month, $day, $year, $hour, $minute);
    echo '</div><input type="hidden" id="ss" name="ss" value="' . $ss . '" />';
    if ($multi) {
        return;
    }
    echo "\n\n";
    foreach (array('mm', 'jj', 'aa', 'hh', 'mn') as $timeunit) {
        echo '<input type="hidden" id="hidden_' . $timeunit . '" name="hidden_' . $timeunit . '" value="' . ${$timeunit} . '" />' . "\n";
        $cur_timeunit = 'cur_' . $timeunit;
        echo '<input type="hidden" id="' . $cur_timeunit . '" name="' . $cur_timeunit . '" value="' . ${$cur_timeunit} . '" />' . "\n";
    }
}
开发者ID:EfncoPlugins,项目名称:ajax-edit-comments,代码行数:53,代码来源:comment-editor.php


示例9: antispambot

function antispambot($email_address, $hex_encoding = 0)
{
    $email_no_spam_address = '';
    for ($i = 0, $len = strlen($email_address); $i < $len; $i++) {
        $j = rand(0, 1 + $hex_encoding);
        if ($j == 0) {
            $email_no_spam_address .= '&#' . ord($email_address[$i]) . ';';
        } elseif ($j == 1) {
            $email_no_spam_address .= $email_address[$i];
        } elseif ($j == 2) {
            $email_no_spam_address .= '%' . zeroise(dechex(ord($email_address[$i])), 2);
        }
    }
    return str_replace('@', '&#64;', $email_no_spam_address);
}
开发者ID:josephshambrook,项目名称:josephshambrook-anchor,代码行数:15,代码来源:functions.php


示例10: touch_time

 public static function touch_time($edit = false, $tab_index = 0, $multi = 0)
 {
     global $wp_locale;
     $tab_index_attribute = '';
     if ((int) $tab_index > 0) {
         $tab_index_attribute = " tabindex=\"{$tab_index}\"";
     }
     $time_adj = current_time('timestamp');
     $jj = $edit ? mysql2date('d', $post_date, false) : gmdate('d', $time_adj);
     $mm = $edit ? mysql2date('m', $post_date, false) : gmdate('m', $time_adj);
     $aa = $edit ? mysql2date('Y', $post_date, false) : gmdate('Y', $time_adj);
     $hh = $edit ? mysql2date('H', $post_date, false) : gmdate('H', $time_adj);
     $mn = $edit ? mysql2date('i', $post_date, false) : gmdate('i', $time_adj);
     $ss = $edit ? mysql2date('s', $post_date, false) : gmdate('s', $time_adj);
     $cur_jj = gmdate('d', $time_adj);
     $cur_mm = gmdate('m', $time_adj);
     $cur_aa = gmdate('Y', $time_adj);
     $cur_hh = gmdate('H', $time_adj);
     $cur_mn = gmdate('i', $time_adj);
     $month = "<select " . ($multi ? '' : 'id="mm" ') . "name=\"mm\"{$tab_index_attribute}>\n";
     for ($i = 1; $i < 13; $i = $i + 1) {
         $monthnum = zeroise($i, 2);
         $month .= "\t\t\t" . '<option value="' . $monthnum . '"';
         if ($i == $mm) {
             $month .= ' selected="selected"';
         }
         /* translators: 1: month number (01, 02, etc.), 2: month abbreviation */
         $month .= '>' . sprintf(__('%1$s-%2$s'), $monthnum, $wp_locale->get_month_abbrev($wp_locale->get_month($i))) . "</option>\n";
     }
     $month .= '</select>';
     $day = '<input type="text" ' . ($multi ? '' : 'id="jj" ') . 'name="jj" value="' . $jj . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" />';
     $year = '<input type="text" ' . ($multi ? '' : 'id="aa" ') . 'name="aa" value="' . $aa . '" size="4" maxlength="4"' . $tab_index_attribute . ' autocomplete="off" />';
     $hour = '<input type="text" ' . ($multi ? '' : 'id="hh" ') . 'name="hh" value="' . $hh . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" />';
     $minute = '<input type="text" ' . ($multi ? '' : 'id="mn" ') . 'name="mn" value="' . $mn . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" />';
     echo '<div class="timestamp-wrap">';
     /* translators: 1: month, 2: day, 3: year, 4: hour, 5: minute */
     printf(__('%1$s %2$s, %3$s @ %4$s : %5$s'), $month, $day, $year, $hour, $minute);
     echo '</div><input type="hidden" id="ss" name="ss" value="' . $ss . '" />';
     if ($multi) {
         return;
     }
     echo "\n\n";
     foreach (array('mm', 'jj', 'aa', 'hh', 'mn') as $timeunit) {
         echo '<input type="hidden" id="hidden_' . $timeunit . '" name="hidden_' . $timeunit . '" value="' . ${$timeunit} . '" />' . "\n";
         $cur_timeunit = 'cur_' . $timeunit;
         echo '<input type="hidden" id="' . $cur_timeunit . '" name="' . $cur_timeunit . '" value="' . ${$cur_timeunit} . '" />' . "\n";
     }
 }
开发者ID:ronal2do,项目名称:fonda56-theme,代码行数:48,代码来源:class.helper.php


示例11: archives_cloud

function archives_cloud($smallest = 50, $largest = 200, $unit = "%", $cold = "", $hot = "", $before = '', $after = '', $exclude = '')
{
    global $month, $wpdb;
    $now = current_time('mysql');
    $results = $wpdb->get_results('SELECT DISTINCT YEAR(post_date) AS `year`,' . ' MONTH(post_date) AS `month`,' . ' count(ID) AS `posts` ' . ' FROM ' . $wpdb->posts . ' WHERE post_date < "' . $now . '" AND post_status = "publish"' . ' GROUP BY YEAR(post_date), MONTH(post_date)' . ' ORDER BY post_date DESC');
    $content = array();
    foreach ($results as $key => $val) {
        # normalize the values to fit into KingCloud Class content var
        $content[$key]['url'] = get_month_link($val->year, $val->month);
        $content[$key]['text'] = sprintf('%s %d', $month[zeroise($val->month, 2)], $val->year);
        $content[$key]['title'] = $val->posts . ' Artikel';
        $content[$key]['count'] = $val->posts;
    }
    $cloud = new KingCloud($content, $smallest, $largest, $unit, $cold, $hot, $before, $after);
    $cloud->output();
}
开发者ID:jbogota,项目名称:blog-king,代码行数:16,代码来源:king_clouds.php


示例12: export_date_options

 /**
  * Create the date options fields for exporting a given post type.
  *
  * @global wpdb      $wpdb      WordPress database object.
  * @global WP_Locale $wp_locale Date and Time Locale object.
  *
  * @since 3.1.0
  *
  * @param string $post_type The post type. Default 'post'.
  */
 function export_date_options($post_type = 'post')
 {
     global $wpdb, $wp_locale;
     $months = $wpdb->get_results($wpdb->prepare("SELECT DISTINCT YEAR( post_date ) AS year, MONTH( post_date ) AS month FROM {$wpdb->posts} WHERE post_type = %s AND post_status != 'auto-draft' ORDER BY post_date DESC", $post_type));
     $month_count = count($months);
     if (!$month_count || 1 == $month_count && 0 == $months[0]->month) {
         return;
     }
     foreach ($months as $date) {
         if (0 == $date->year) {
             continue;
         }
         $month = zeroise($date->month, 2);
         echo '<option value="' . $date->year . '-' . $month . '">' . $wp_locale->get_month($month) . ' ' . $date->year . '</option>';
     }
 }
开发者ID:b0123498765,项目名称:fithealthyandwealthy,代码行数:26,代码来源:uncode_export.php


示例13: get_blix_archive

function get_blix_archive($show_comment_count = 0, $before = '<h4>', $after = '</h4>', $year = 0, $post_type = 'post', $limit = 100)
{
    global $month, $wpdb;
    $result = '';
    if ($year) {
        $AND_year = " AND YEAR(post_date)='{$year}'";
    }
    if ($limit) {
        $LIMIT = " LIMIT {$limit}";
    }
    $arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS year, MONTH(post_date) AS month, count(ID) as posts FROM " . $wpdb->posts . " WHERE post_type='{$post_type}' {$AND_year} AND post_status='publish' GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date DESC");
    if ($arcresults) {
        foreach ($arcresults as $arcresult) {
            $url = get_month_link($arcresult->year, $arcresult->month);
            $text = sprintf('%s %d', $month[zeroise($arcresult->month, 2)], $arcresult->year);
            $result .= get_archives_link($url, $text, '', $before, $after);
            $thismonth = zeroise($arcresult->month, 2);
            $thisyear = $arcresult->year;
            $arcresults2 = $wpdb->get_results("SELECT ID, post_date, post_title, comment_status, guid, comment_count FROM " . $wpdb->posts . " WHERE post_date LIKE '{$thisyear}-{$thismonth}-%' AND post_status='publish' AND post_type='{$post_type}' AND post_password='' ORDER BY post_date DESC {$LIMIT}");
            if ($arcresults2) {
                $result .= "<ul class=\"postspermonth\">\n";
                foreach ($arcresults2 as $arcresult2) {
                    if ($arcresult2->post_date != '0000-00-00 00:00:00') {
                        $url = get_permalink($arcresult2->ID);
                        //$arcresult2->guid;
                        $arc_title = $arcresult2->post_title;
                        if ($arc_title) {
                            $text = strip_tags($arc_title);
                        } else {
                            $text = $arcresult2->ID;
                        }
                        $result .= "<li>" . get_archives_link($url, $text, '');
                        if ($show_comment_count) {
                            $cc = $arcresult2->comment_count;
                            if ($arcresult2->comment_status == "open" or $comments_count > 0) {
                                $result .= " ({$cc})";
                            }
                        }
                        $result .= "</li>\n";
                    }
                }
                $result .= "</ul>\n";
            }
        }
    }
    return $result;
}
开发者ID:rhondamoananui,项目名称:rehub,代码行数:47,代码来源:template-timeline.php


示例14: dt_archives_shortcode

function dt_archives_shortcode()
{
    global $month, $wpdb, $wp_version;
    // a mysql query to get the list of distinct years and months that posts have been created
    $sql = 'SELECT
			DISTINCT YEAR(post_date) AS year,
			MONTH(post_date) AS month,
			count(ID) as posts
		FROM ' . $wpdb->posts . '
		WHERE post_status="publish"
			AND post_type="post"
			AND post_password=""
		GROUP BY YEAR(post_date),
			MONTH(post_date)
		ORDER BY post_date DESC';
    // use get_results to do a query directly on the database
    $archiveSummary = $wpdb->get_results($sql);
    // if there are any posts
    if ($archiveSummary) {
        $output = '<div class="archives">';
        // loop through the posts
        foreach ($archiveSummary as $date) {
            // reset the query variable
            unset($bmWp);
            // create a new query variable for the current month and year combination
            $bmWp = new WP_Query('year=' . $date->year . '&monthnum=' . zeroise($date->month, 2) . '&posts_per_page=-1');
            // if there are any posts for that month display them
            if ($bmWp->have_posts()) {
                // display the archives heading
                $url = get_month_link($date->year, $date->month);
                $text = $month[zeroise($date->month, 2)] . ' ' . $date->year;
                $output .= get_archives_link($url, $text, '', '<h3>', '</h3>');
                $output .= '<ul class="postspermonth">';
                // display an unordered list of posts for the current month
                while ($bmWp->have_posts()) {
                    $bmWp->the_post();
                    $output .= '<li><a href="' . get_permalink($bmWp->post) . '" title="' . esc_html($text, 1) . '">' . wptexturize($bmWp->post->post_title) . '</a></li>';
                }
                $output .= '</ul>';
            }
        }
        $output .= '</div><!-- .archives -->';
        return $output;
    }
}
开发者ID:jainankit,项目名称:suggstme,代码行数:45,代码来源:theme-shortcodes.php


示例15: b_wp_archives_monthly_show

 function b_wp_archives_monthly_show($options, $wp_num = "")
 {
     $block_style = $options[0] ? $options[0] : 0;
     $with_count = $options[1] == 0 ? false : true;
     $id = 1;
     $GLOBALS['use_cache'] = 1;
     if ($wp_num == "") {
         $GLOBALS['wp_id'] = $wp_num;
         $GLOBALS['wp_inblock'] = 1;
         require dirname(__FILE__) . '/../wp-config.php';
         $GLOBALS['wp_inblock'] = 0;
     }
     $sel_value = '';
     if (current_wp()) {
         init_param('GET', 'm', 'string', '');
         init_param('GET', 'year', 'integer', '');
         init_param('GET', 'monthnum', 'integer', '');
         if (strlen(get_param('m')) == 6) {
             $sel_value = get_param('m');
         } else {
             if (test_param('year') && test_param('monthnum')) {
                 $sel_value = get_param('year') . zeroise(get_param('monthnum'), 2);
             }
         }
     }
     ob_start();
     block_style_get($wp_num);
     if ($block_style == 0) {
         // Simple Listing
         echo "<ul class='wpBlockList'>\n";
         get_archives('monthly', '', 'html', '', '', $with_count);
         echo "</ul>\n";
     } else {
         // Dropdown Listing
         echo '<form name="archiveform' . $wp_num . '" id="archiveform' . $wp_num . '" action="#">';
         echo '<select name="archive_chrono" onchange="window.location = (document.forms.archiveform' . $wp_num . '.archive_chrono[document.forms.archiveform' . $wp_num . '.archive_chrono.selectedIndex].value);"> ';
         echo '<option value="">' . _WP_BY_MONTHLY . '</option>';
         get_archives('monthly', '', 'option', '', '', $with_count, $sel_value);
         echo '</select>';
         echo '</form>';
     }
     $block['content'] = ob_get_contents();
     ob_end_clean();
     return $block;
 }
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:45,代码来源:wp_archives_monthly.php


示例16: archives_list_cx

function archives_list_cx()
{
    global $wpdb, $month;
    $lastpost = $wpdb->get_var("SELECT ID FROM {$wpdb->posts} WHERE post_date <'" . current_time('mysql') . "' AND post_status='publish' AND post_type='post' AND post_password='' ORDER BY post_date DESC LIMIT 1");
    $output = get_option('cx_archives_' . $lastpost);
    if (empty($output)) {
        $output = '';
        $wpdb->query("DELETE FROM {$wpdb->options} WHERE option_name LIKE 'cx_archives_%'");
        $q = "SELECT DISTINCT YEAR(post_date) AS year, MONTH(post_date) AS month, count(ID) as posts FROM {$wpdb->posts} p WHERE post_date <'" . current_time('mysql') . "' AND post_status='publish' AND post_type='post' AND post_password='' GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date DESC";
        $monthresults = $wpdb->get_results($q);
        if ($monthresults) {
            foreach ($monthresults as $monthresult) {
                $thismonth = zeroise($monthresult->month, 2);
                $thisyear = $monthresult->year;
                $q = "SELECT ID, post_date, post_title, comment_count FROM {$wpdb->posts} p WHERE post_date LIKE '{$thisyear}-{$thismonth}-%' AND post_date AND post_status='publish' AND post_type='post' AND post_password='' ORDER BY post_date DESC";
                $postresults = $wpdb->get_results($q);
                if ($postresults) {
                    $text = sprintf('%s %d', $month[zeroise($monthresult->month, 2)], $monthresult->year);
                    $postcount = count($postresults);
                    $output .= '<ul class="archives-list"><li><span class="archives-yearmonth">' . $text . ' &nbsp;(' . count($postresults) . '&nbsp;' . __('篇文章', 'freephp') . ')</span><ul class="archives-monthlisting">' . "\n";
                    foreach ($postresults as $postresult) {
                        if ($postresult->post_date != '0000-00-00 00:00:00') {
                            $url = get_permalink($postresult->ID);
                            $arc_title = $postresult->post_title;
                            if ($arc_title) {
                                $text = wptexturize(strip_tags($arc_title));
                            } else {
                                $text = $postresult->ID;
                            }
                            $title_text = __('查看', 'freephp') . ', &quot;' . wp_specialchars($text, 1) . '&quot;';
                            $output .= '<li>' . mysql2date('d日', $postresult->post_date) . ':&nbsp;' . "<a href='{$url}' title='{$title_text}'>{$text}</a>";
                            $output .= '&nbsp;(' . $postresult->comment_count . ')';
                            $output .= '</li>' . "\n";
                        }
                    }
                }
                $output .= '</ul></li></ul>' . "\n";
            }
            update_option('cx_archives_' . $lastpost, $output);
        } else {
            $output = '<div class="errorbox">' . __('目前还没有文章.', 'freephp') . '</div>' . "\n";
        }
    }
    echo $output;
}
开发者ID:beichengandnight,项目名称:daikuanzj,代码行数:45,代码来源:archives.php


示例17: get_tvsc_data_editoriale

function get_tvsc_data_editoriale($post, $args)
{
    $metabox_id = $args['args']['id'];
    global $post, $wp_locale;
    // Use nonce for verification
    wp_nonce_field(plugin_basename(__FILE__), 'tvsc_data_editoriale_nonce');
    $time_adj = current_time('timestamp');
    $month = get_post_meta($post->ID, $metabox_id . '_month', true);
    if (empty($month)) {
        $month = gmdate('m', $time_adj);
    }
    $day = get_post_meta($post->ID, $metabox_id . '_day', true);
    if (empty($day)) {
        $day = gmdate('d', $time_adj);
    }
    $year = get_post_meta($post->ID, $metabox_id . '_year', true);
    if (empty($year)) {
        $year = gmdate('Y', $time_adj);
    }
    $hour = get_post_meta($post->ID, $metabox_id . '_hour', true);
    if (empty($hour)) {
        $hour = gmdate('H', $time_adj);
    }
    $min = get_post_meta($post->ID, $metabox_id . '_minute', true);
    if (empty($min)) {
        $min = gmdate('i', $time_adj);
    }
    $month_s = '<select name="' . $metabox_id . '_month">';
    for ($i = 1; $i < 13; $i = $i + 1) {
        $month_s .= "\t\t\t" . '<option value="' . zeroise($i, 2) . '"';
        if ($i == $month) {
            $month_s .= ' selected="selected"';
        }
        $month_s .= '>' . $wp_locale->get_month_abbrev($wp_locale->get_month($i)) . "</option>\n";
    }
    $month_s .= '</select>';
    echo $month_s;
    echo '<input type="text" name="' . $metabox_id . '_day" value="' . $day . '" size="2" maxlength="2" />';
    echo '<input type="text" name="' . $metabox_id . '_year" value="' . $year . '" size="4" maxlength="4" /> @ ';
    echo '<input type="text" name="' . $metabox_id . '_hour" value="' . $hour . '" size="2" maxlength="2"/>:';
    echo '<input type="text" name="' . $metabox_id . '_minute" value="' . $min . '" size="2" maxlength="2" />';
}
开发者ID:enrike1983,项目名称:aopera,代码行数:42,代码来源:tvsc-data-editoriale.php


示例18: sre2t_the_post_dates

function sre2t_the_post_dates()
{
    global $wpdb, $wp_locale;
    $dateoptions = '';
    $types = "'" . implode("', '", get_post_types(array('public' => true, 'can_export' => true), 'names')) . "'";
    if (function_exists(get_post_stati)) {
        $stati = "'" . implode("', '", get_post_stati(array('internal' => false), 'names')) . "'";
    } else {
        $stati = "'" . implode("', '", get_post_statuses(array('internal' => false), 'names')) . "'";
    }
    if ($monthyears = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, YEAR(DATE_ADD(post_date, INTERVAL 1 MONTH)) AS `eyear`, MONTH(DATE_ADD(post_date, INTERVAL 1 MONTH)) AS `emonth` FROM {$wpdb->posts} WHERE post_type IN ({$types}) AND post_status IN ({$stati}) ORDER BY post_date ASC ")) {
        foreach ($monthyears as $k => $monthyear) {
            $monthyears[$k]->lmonth = $wp_locale->get_month($monthyear->month, 2);
        }
        for ($s = 0, $e = count($monthyears) - 1; $e >= 0; $s++, $e--) {
            //$dateoptions .= "\t<option value=\"" . $monthyears[$s]->year . '-' . zeroise( $monthyears[$s]->month, 2 ) . '">' . $monthyears[$s]->lmonth . ' ' . $monthyears[$s]->year . "</option>\n";
            $dateoptions .= "\t<option value=\"" . $monthyears[$e]->eyear . '-' . zeroise($monthyears[$e]->emonth, 2) . '">' . $monthyears[$e]->lmonth . ' ' . $monthyears[$e]->year . "</option>\n";
        }
    }
    return $dateoptions;
}
开发者ID:venamax,项目名称:trixandtrax-cl,代码行数:21,代码来源:export-to-text_helpers.php


示例19: _b_wp_archives_monthly_show

 function _b_wp_archives_monthly_show($options, $wp_num = '')
 {
     $block_style = $options[0] ? $options[0] : 0;
     $with_count = $options[1] == 0 ? false : true;
     $sel_value = '';
     if (current_wp()) {
         if (!empty($_SERVER['PATH_INFO'])) {
             permlink_to_param();
         }
         init_param('GET', 'm', 'string', '');
         init_param('GET', 'year', 'integer', '');
         init_param('GET', 'monthnum', 'integer', '');
         if (strlen(get_param('m')) == 6) {
             $sel_ 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP zeropad函数代码示例发布时间:2022-05-23
下一篇:
PHP zerif_slug_fonts_url函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap