当前位置: 首页>>代码示例>>PHP>>正文


PHP ap_parameter_empty函数代码示例

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


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

示例1: ap_user_get_display_name_option

/**
 * Return array of user name, to be used in display name user field
 * @param  integer $user_id
 * @return array
 * @since 2.1
 */
function ap_user_get_display_name_option($user_id = false)
{
    $user_id = ap_parameter_empty(@$user_id, @ap_user_get_the_ID());
    $user = ap_user_get_the_meta(false, $user_id);
    $public_display = array();
    if (!empty($user['nickname'])) {
        $public_display[$user['nickname']] = $user['nickname'];
    }
    if (!empty($user['user_login'])) {
        $public_display[$user['user_login']] = $user['user_login'];
    }
    if (!empty($user['first_name'])) {
        $public_display[$user['first_name']] = $user['first_name'];
    }
    if (!empty($user['last_name'])) {
        $public_display[$user['last_name']] = $user['last_name'];
    }
    if (!empty($user['first_name']) && !empty($user['last_name'])) {
        $public_display[$user['first_name'] . ' ' . $user['last_name']] = $user['first_name'] . ' ' . $user['last_name'];
        $public_display[$user['last_name'] . ' ' . $user['first_name']] = $user['last_name'] . ' ' . $user['first_name'];
    }
    return $public_display;
}
开发者ID:VLabsInc,项目名称:WordPressPlatforms,代码行数:29,代码来源:users-loop.php

示例2: ap_answer_get_the_time

/**
 * Return answer time
 * @param  boolean|integer $answer_id      If outside of loop, post ID can be passed.
 * @param  integer         $format         WP time format.
 * @return string
 */
function ap_answer_get_the_time($answer_id = false, $format = '')
{
    $answer_id = ap_parameter_empty($answer_id, @ap_answer_get_the_answer_id());
    return get_post_time($format, true, $answer_id, true);
}
开发者ID:troe,项目名称:anspress,代码行数:11,代码来源:answer-loop.php

示例3: ap_question_get_the_time_relative

function ap_question_get_the_time_relative($question_id = false)
{
    $question_id = ap_parameter_empty($question_id, @ap_question_get_the_ID());
    return ap_human_time(ap_question_get_the_time($question_id, 'U')) . __(' ago', 'ap');
}
开发者ID:haythameyd,项目名称:powrly,代码行数:5,代码来源:question-loop.php

示例4: ap_post_status_description

function ap_post_status_description($post_id = false)
{
    $post_id = ap_parameter_empty($post_id, @ap_question_get_the_ID());
    $post = get_post($post_id);
    $post_type = $post->post_type == 'question' ? __('Question', 'ap') : __('Answer', 'ap');
    if (ap_have_parent_post($post_id) && $post->post_type != 'answer') {
        ?>
        <div id="ap_post_status_desc_<?php 
        echo $post_id;
        ?>
" class="ap-notice blue clearfix">
            <?php 
        echo ap_icon('link', true);
        ?>
            <span><?php 
        printf(__('Question is asked for %s.', 'ap'), '<a href="' . get_permalink(ap_question_get_the_post_parent()) . '">' . get_the_title(ap_question_get_the_post_parent()) . '</a>');
        ?>
</span>
        </div>
    <?php 
    }
    if (is_private_post($post_id)) {
        ?>
        <div id="ap_post_status_desc_<?php 
        echo $post_id;
        ?>
" class="ap-notice gray clearfix">
            <i class="apicon-lock"></i><span><?php 
        printf(__('%s is marked as a private, only admin and post author can see.', 'ap'), $post_type);
        ?>
</span>
        </div>
    <?php 
    }
    if (is_post_waiting_moderation($post_id)) {
        ?>
        <div id="ap_post_status_desc_<?php 
        echo $post_id;
        ?>
" class="ap-notice yellow clearfix">
            <i class="apicon-info"></i><span><?php 
        printf(__('%s is waiting for approval by moderator.', 'ap'), $post_type);
        ?>
</span>
        </div>
    <?php 
    }
    if (is_post_closed($post_id) && $post->post_type != 'answer') {
        ?>
        <div id="ap_post_status_desc_<?php 
        echo $post_id;
        ?>
" class="ap-notice red clearfix">
            <?php 
        echo ap_icon('cross', true);
        ?>
<span><?php 
        printf(__('%s is closed, new answer are not accepted.', 'ap'), $post_type);
        ?>
</span>
        </div>
    <?php 
    }
    if ($post->post_status == 'trash') {
        ?>
        <div id="ap_post_status_desc_<?php 
        echo $post_id;
        ?>
" class="ap-notice red clearfix">
            <?php 
        echo ap_icon('cross', true);
        ?>
<span><?php 
        printf(__('%s has been trashed, you can delete it permanently from wp-admin.', 'ap'), $post_type);
        ?>
</span>
        </div>
    <?php 
    }
}
开发者ID:Krl4,项目名称:anspress,代码行数:80,代码来源:functions.php

示例5: ap_question_get_the_time_relative

function ap_question_get_the_time_relative($question_id = false)
{
    $question_id = ap_parameter_empty($question_id, @ap_question_get_the_ID());
    return ap_question_get_the_time($question_id, 'U');
}
开发者ID:Byrlyne,项目名称:anspress,代码行数:5,代码来源:question-loop.php


注:本文中的ap_parameter_empty函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。