本文整理汇总了PHP中ap_icon函数的典型用法代码示例。如果您正苦于以下问题:PHP ap_icon函数的具体用法?PHP ap_icon怎么用?PHP ap_icon使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ap_icon函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: suggest_similar_questions
/**
* Show similar questions when asking a question.
*
* @since 2.0.1
*/
public function suggest_similar_questions()
{
if (empty($_POST['value']) || !ap_verify_default_nonce() && !current_user_can('manage_options')) {
wp_die('false');
}
$keyword = sanitize_text_field(wp_unslash($_POST['value']));
$is_admin = (bool) $_POST['is_admin'];
$questions = get_posts(array('post_type' => 'question', 'showposts' => 10, 's' => $keyword));
if ($questions) {
$items = '<div class="ap-similar-questions-head">';
$items .= '<h3>' . ap_icon('check', true) . sprintf(__('%d similar questions found', 'anspress-question-answer'), count($questions)) . '</h3>';
$items .= '<p>' . __('We\'ve found similar questions that have already been asked, click to read them.', 'anspress-question-answer') . '</p>';
$items .= '</div>';
$items .= '<div class="ap-similar-questions">';
foreach ($questions as $p) {
$count = ap_count_answer_meta($p->ID);
$p->post_title = ap_highlight_words($p->post_title, $keyword);
if ($is_admin) {
$items .= '<div class="ap-q-suggestion-item clearfix"><a class="select-question-button button button-primary button-small" href="' . add_query_arg(array('post_type' => 'answer', 'post_parent' => $p->ID), admin_url('post-new.php')) . '">' . __('Select', 'anspress-question-answer') . '</a><span class="question-title">' . $p->post_title . '</span><span class="acount">' . sprintf(_n('1 Answer', '%d Answers', $count, 'anspress-question-answer'), $count) . '</span></div>';
} else {
$items .= '<a class="ap-sqitem clearfix" target="_blank" href="' . get_permalink($p->ID) . '"><span class="acount">' . sprintf(_n('1 Answer', '%d Answers', $count, 'anspress-question-answer'), $count) . '</span><span class="ap-title">' . $p->post_title . '</span></a>';
}
}
$items .= '</div>';
$result = array('status' => true, 'html' => $items);
} else {
$result = array('status' => false, 'message' => __('No related questions found', 'anspress-question-answer'));
}
$this->send($result);
}
示例2: suggest_similar_questions
/**
* Show similar questions when asking a question
* @return void
* @since 2.0.1
*/
public function suggest_similar_questions()
{
if (empty($_POST['value'])) {
return;
}
$keyword = sanitize_text_field($_POST['value']);
$questions = get_posts(array('post_type' => 'question', 'showposts' => 10, 's' => $keyword));
if ($questions) {
$items = '<div class="ap-similar-questions-head">';
$items .= '<h3>' . ap_icon('check', true) . sprintf(__('%d similar questions found', 'ap'), count($questions)) . '</h3>';
$items .= '<p>' . __('We found similar questions that have already been asked, click to read them. Avoid creating duplicate questions, it will be deleted.') . '</p>';
$items .= '</div>';
$items .= '<div class="ap-similar-questions">';
foreach ($questions as $p) {
$count = ap_count_answer_meta($p->ID);
$p->post_title = ap_highlight_words($p->post_title, $keyword);
if (!isset($_POST['is_admin'])) {
$items .= '<a class="ap-sqitem clearfix" href="' . get_permalink($p->ID) . '"><span class="acount">' . sprintf(_n('1 Answer', '%d Answers', $count, 'ap'), $count) . '</span><span class="ap-title">' . $p->post_title . '</span></a>';
} else {
$items .= '<div class="ap-q-suggestion-item clearfix"><a class="select-question-button button button-primary button-small" href="' . add_query_arg(array('post_type' => 'answer', 'post_parent' => $p->ID), admin_url('post-new.php')) . '">' . __('Select', 'ap') . '</a><span class="question-title">' . $p->post_title . '</span><span class="acount">' . sprintf(_n('1 Answer', '%d Answers', $count, 'ap'), $count) . '</span></div>';
}
}
$items .= '</div>';
$result = array('status' => true, 'html' => $items);
} else {
$result = array('status' => false, 'message' => __('No related questions found', 'ap'));
}
ap_send_json($result);
}
示例3: ap_scripts_front
function ap_scripts_front()
{
wp_enqueue_script('jquery');
wp_enqueue_script('jquery-form', array('jquery'), false);
wp_enqueue_script('ap-functions-js', ANSPRESS_URL . 'assets/prod/ap-functions.min.js', array('jquery', 'jquery-form'));
wp_enqueue_script('ap-anspress_script', ANSPRESS_URL . 'assets/prod/anspress_site.min.js', array('jquery', 'jquery-form'), AP_VERSION);
wp_enqueue_script('peity-js', ap_get_theme_url('js/jquery.peity.min.js'), 'jquery', AP_VERSION);
wp_enqueue_script('ap-initial.js', ap_get_theme_url('js/initial.min.js'), 'jquery', AP_VERSION);
wp_enqueue_script('ap-scrollbar.js', ap_get_theme_url('js/jquery.scrollbar.min.js'), 'jquery', AP_VERSION);
wp_enqueue_script('ap-js', ap_get_theme_url('prod/ap.min.js'), array('jquery', 'jquery-form'), AP_VERSION);
wp_enqueue_style('ap-style', ap_get_theme_url('css/main.css'), array(), AP_VERSION);
$custom_css = '
#anspress .ap-q-cells{
margin-left: ' . (ap_opt('avatar_size_qquestion') + 10) . 'px;
}
#anspress .ap-a-cells{
margin-left: ' . (ap_opt('avatar_size_qanswer') + 10) . 'px;
}#anspress .ap-comment-content{
margin-left: ' . (ap_opt('avatar_size_qcomment') + 15) . 'px;
}';
wp_add_inline_style('ap-style', $custom_css);
wp_enqueue_style('ap-fonts', ap_get_theme_url('fonts/style.css'), array(), AP_VERSION);
do_action('ap_enqueue');
wp_enqueue_style('ap-responsive', ap_get_theme_url('css/responsive.css'), array(), AP_VERSION);
wp_enqueue_style('ap-overrides', ap_get_theme_url('css/overrides.css'), array(), AP_VERSION);
echo '<script type="text/javascript">';
echo 'var ajaxurl = "' . admin_url('admin-ajax.php') . '",';
echo 'ap_nonce = "' . wp_create_nonce('ap_ajax_nonce') . '",';
echo 'ap_max_tags = "' . ap_opt('max_tags') . '",';
echo 'disable_hover_card = "' . (ap_opt('disable_hover_card') ? true : false) . '"';
echo '</script>';
wp_localize_script('ap-anspress_script', 'aplang', array('password_field_not_macthing' => __('Password not matching', 'ap'), 'password_length_less' => __('Password length must be 6 or higher', 'ap'), 'not_valid_email' => __('Not a valid email', 'ap'), 'username_less' => __('Username length must be 4 or higher', 'ap'), 'username_not_avilable' => __('Username not available', 'ap'), 'email_already_in_use' => sprintf(__('Email already in use. %sDo you want to reset your password?%s', 'ap'), '<a href="' . wp_lostpassword_url() . '">', '</a>'), 'loading' => __('Loading', 'ap'), 'sending' => __('Sending request', 'ap'), 'adding_to_fav' => __('Adding question to your favorites', 'ap'), 'voting_on_post' => __('Sending your vote', 'ap'), 'requesting_for_closing' => __('Requesting for closing this question', 'ap'), 'sending_request' => __('Submitting request', 'ap'), 'loading_comment_form' => __('Loading comment form', 'ap'), 'submitting_your_question' => __('Sending your question', 'ap'), 'submitting_your_answer' => __('Sending your answer', 'ap'), 'submitting_your_comment' => __('Sending your comment', 'ap'), 'deleting_comment' => __('Deleting comment', 'ap'), 'updating_comment' => __('Updating comment', 'ap'), 'loading_form' => __('Loading form', 'ap'), 'saving_labels' => __('Saving labels', 'ap'), 'loading_suggestions' => __('Loading suggestions', 'ap'), 'uploading_cover' => __('Uploading cover', 'ap'), 'saving_profile' => __('Saving profile', 'ap'), 'sending_message' => __('Sending message', 'ap'), 'loading_conversation' => __('Loading conversation', 'ap'), 'loading_new_message_form' => __('Loading new message form', 'ap'), 'loading_more_conversations' => __('Loading more conversations', 'ap'), 'searching_conversations' => __('Searching conversations', 'ap'), 'loading_message_edit_form' => __('Loading message form', 'ap'), 'updating_message' => __('Updating message', 'ap'), 'deleting_message' => __('Deleting message', 'ap'), 'uploading' => __('Uploading', 'ap'), 'error' => ap_icon('error'), 'warning' => ap_icon('warning'), 'success' => ap_icon('success'), 'not_valid_response' => __('Something went wrong in server side, not a valid response.', 'ap')));
wp_localize_script('ap-site-js', 'apoptions', array('ajaxlogin' => ap_opt('ajax_login')));
}
示例4: ap_user_the_link
</div>
<a class="ap-user-name" href="<?php
ap_user_the_link();
?>
"><?php
ap_user_the_display_name();
?>
</a>
<?php
if (!ap_opt('disable_reputation')) {
echo '<span class="ap-user-reputation">';
printf(__('%s Rep.', 'ap'), ap_user_get_the_reputation());
echo '</span>';
}
?>
</div>
<?php
$menus = ap_get_user_menu(get_current_user_id());
$active_user_page = get_query_var('user_page');
$active_user_page = $active_user_page ? $active_user_page : 'about';
$item_output = '<a id="ap-user-menu-anchor" href="#">' . get_avatar(get_current_user_id(), 20) . ap_user_display_name(get_current_user_id()) . ap_icon('chevron-down', true) . '</a>';
echo '<ul class="ap-user-widget-links">';
foreach ($menus as $m) {
$class = !empty($m['class']) ? ' ' . $m['class'] : '';
echo '<li' . ($active_user_page == $m['slug'] ? ' class="active"' : '') . '><a href="' . $m['link'] . '" class="ap-user-link-' . $m['slug'] . $class . '">' . $m['title'] . '</a></li>';
}
echo '</ul>';
?>
</div>
示例5: walker_nav_menu_start_el
/**
* Add user dropdown and notification menu
* @param string $o Menu html.
* @param object $item Menu item object.
* @param integer $depth Menu depth.
* @param object $args Menu args.
* @return string
*/
public function walker_nav_menu_start_el($o, $item, $depth, $args)
{
if (!is_user_logged_in() && (ap_is_notification_menu($item) || ap_is_profile_menu($item))) {
$o = '';
}
if (!ap_is_profile_active() && (ap_is_notification_menu($item) || ap_is_profile_menu($item))) {
return '';
}
if (in_array('anspress-page-profile', $item->classes) && is_user_logged_in()) {
$menus = ap_get_user_menu(get_current_user_id());
$active_user_page = get_query_var('user_page') ? esc_attr(get_query_var('user_page')) : 'about';
$o = '<a id="ap-user-menu-anchor" class="ap-dropdown-toggle" href="#">';
$o .= get_avatar(get_current_user_id(), 80);
$o .= '<span class="name">' . ap_user_display_name(get_current_user_id()) . '</span>';
$o .= ap_icon('chevron-down', true);
$o .= '</a>';
$o .= '<ul id="ap-user-menu-link" class="ap-dropdown-menu ap-user-dropdown-menu">';
foreach ($menus as $m) {
$class = !empty($m['class']) ? ' ' . $m['class'] : '';
$o .= '<li' . ($active_user_page == $m['slug'] ? ' class="active"' : '') . '>';
$o .= '<a href="' . $m['link'] . '" class="ap-user-link-' . $m['slug'] . $class . '">';
$o .= $m['title'] . '</a>';
$o .= '</li>';
}
$o .= '</ul>';
} elseif (in_array('anspress-page-notification', $item->classes) && is_user_logged_in()) {
$o = '<a id="ap-user-notification-anchor" class="ap-dropdown-toggle ap-sidetoggle ' . ap_icon('globe') . '" href="#">' . ap_get_the_total_unread_notification(false, false) . '</a>';
global $ap_activities;
/**
* Dropdown notification arguments.
* Allow filtering of dropdown notification arguments.
* @since 2.4.5
* @var array
*/
$notification_args = apply_filters('ap_dropdown_notification_args', array('per_page' => 20, 'notification' => true, 'user_id' => ap_get_displayed_user_id()));
$ap_activities = ap_get_activities($notification_args);
ob_start();
ap_get_template_part('user/notification-dropdown');
$o .= ob_get_clean();
}
return $o;
}
示例6: ap_get_notification_icon
function ap_get_notification_icon($type)
{
$icons = array('new_question' => ap_icon('question', true), 'new_answer' => ap_icon('answer', true), 'question_update' => ap_icon('pencil', true), 'answer_update' => ap_icon('pencil', true), 'comment_on_question' => ap_icon('comment', true), 'comment_on_answer' => ap_icon('comment', true), 'new_follower' => ap_icon('user-check', true), 'vote_up' => ap_icon('thumb-up', true), 'answer_selected' => ap_icon('check', true), 'received_reputation' => ap_icon('reputation', true));
$icons = apply_filters('ap_get_notification_icon', $icons);
if (isset($icons[$type])) {
return $icons[$type];
}
}
示例7: ap_display_question_metas
/**
* Append meta display
* @param array $metas
* @param array $question_id
* @return array
* @since 1.0
*/
public function ap_display_question_metas($metas, $question_id)
{
if (ap_question_have_category($question_id) && !is_singular('question')) {
$metas['categories'] = ap_question_categories_html(array('label' => ap_icon('category', true)));
}
return $metas;
}
示例8: ap_display_question_metas
/**
* Append meta display
* @param array $metas
* @param array $question_id
* @return array
* @since 2.0
*/
public function ap_display_question_metas($metas, $question_id)
{
if (ap_question_have_tags($question_id) && !is_singular('question')) {
$metas['tags'] = ap_question_tags_html(array('label' => ap_icon('tag', true), 'show' => 1));
}
return $metas;
}
示例9: ap_avatar_upload_form
function ap_avatar_upload_form()
{
if (ap_get_user_page_user() == get_current_user_id()) {
?>
<form method="post" action="#" enctype="multipart/form-data" data-action="ap-upload-form" class="">
<div class="ap-btn ap-upload-o <?php
echo ap_icon('upload');
?>
">
<span><?php
_e('Upload avatar', 'ap');
?>
</span>
<input type="file" name="thumbnail" class="ap-upload-input" data-action="ap-upload-field">
</div>
<input type='hidden' value='<?php
echo wp_create_nonce('upload');
?>
' name='nonce' />
<input type="hidden" name="action" id="action" value="ap_avatar_upload">
</form>
<?php
}
}
示例10: ap_icon
* AnsPress image upload modal
* Handle image uploading and importing from url
*
* @link http://anspress.io
* @since 2.4
* @author Rahul Aryan <support@anspress.io>
* @package AnsPress
*/
?>
<div class="ap-mediam">
<div class="ap-mediam-types">
<div class="ap-mediam-pc ap-mediam-type clerafix">
<?php
echo ap_icon('cloud-upload', true);
?>
<?php
_e('Upload from computer', 'ap');
?>
</div>
<div class="ap-mediam-pc ap-mediam-type clerafix">
<?php
echo ap_icon('globe', true);
?>
<?php
_e('Image from link', 'ap');
?>
</div>
</div>
</div>
示例11: printf
printf(__('%d answers, %d selected', 'ap'), ap_user_get_the_meta('__total_answers'), ap_user_get_the_meta('__best_answers'));
?>
</li>
<li><?php
echo ap_icon('question', true);
printf(__('%d questions, %d solved', 'ap'), ap_user_get_the_meta('__total_questions'), ap_user_get_the_meta('__solved_answers'));
?>
</li>
<li><?php
echo ap_icon('clock', true);
printf(__('Member for %s', 'ap'), ap_user_get_member_for());
?>
</li>
<li><?php
echo ap_icon('eye', true);
printf(__('%d profile views', 'ap'), ap_user_get_the_meta('__profile_views'));
?>
</li>
<li><?php
echo ap_icon('clock', true);
printf(__('Last seen %s ago', 'ap'), ap_human_time(ap_user_get_the_meta('__last_active'), false));
?>
</li>
</ul>
<?php
dynamic_sidebar('ap-user-about');
?>
</div>
</div>
</div>
示例12: ap_vote_btn
/**
* Output voting button
* @param int $post
* @return null|string
* @since 0.1
*/
function ap_vote_btn($post = false, $echo = true)
{
if (false === $post) {
global $post;
}
if ('answer' == $post->post_type && ap_opt('disable_voting_on_answer')) {
return;
}
if ('question' == $post->post_type && ap_opt('disable_voting_on_question')) {
return;
}
$nonce = wp_create_nonce('vote_' . $post->ID);
$vote = ap_is_user_voted($post->ID, 'vote');
$voted = $vote ? true : false;
$type = $vote ? $vote->type : '';
ob_start();
?>
<div data-id="<?php
echo $post->ID;
?>
" class="ap-vote net-vote" data-action="vote">
<a class="<?php
echo ap_icon('vote_up');
?>
ap-tip vote-up<?php
echo $voted ? ' voted' : '';
echo $type == 'vote_down' ? ' disable' : '';
?>
" data-query="ap_ajax_action=vote&type=up&post_id=<?php
echo $post->ID;
?>
&__nonce=<?php
echo $nonce;
?>
" href="#" title="<?php
_e('Up vote this post', 'ap');
?>
"></a>
<span class="net-vote-count" data-view="ap-net-vote" itemprop="upvoteCount"><?php
echo ap_net_vote();
?>
</span>
<a data-tipposition="bottom" class="<?php
echo ap_icon('vote_down');
?>
ap-tip vote-down<?php
echo $voted ? ' voted' : '';
echo $type == 'vote_up' ? ' disable' : '';
?>
" data-query="ap_ajax_action=vote&type=down&post_id=<?php
echo $post->ID;
?>
&__nonce=<?php
echo $nonce;
?>
" href="#" title="<?php
_e('Down vote this post', 'ap');
?>
"></a>
</div>
<?php
$html = ob_get_clean();
if ($echo) {
echo $html;
} else {
return $html;
}
}
示例13: ap_subscribe_btn_html
/**
* Output subscribe btn HTML
* @param boolean|integer $action_id Question ID or Term ID.
* @param string|false $type Subscribe type.
* @since 2.0.1
*/
function ap_subscribe_btn_html($action_id = false, $type = false)
{
global $question_category, $question_tag;
$filter = apply_filters('ap_subscribe_btn_action_type', array('action_id' => $action_id, 'type' => $type));
$action_id = $filter['action_id'];
$type = $filter['type'];
if (false === $action_id) {
$action_id = get_question_id();
}
$subscribe_type = 'q_all';
if ($type == false) {
$subscribe_type = apply_filters('ap_subscribe_btn_type', 'q_all');
} elseif ($type === 'category' || $type === 'tag') {
$subscribe_type = 'tax_new_q';
}
$subscribed = ap_is_user_subscribed($action_id, $subscribe_type);
$nonce = wp_create_nonce('subscribe_' . $action_id . '_' . $subscribe_type);
$title = !$subscribed ? __('Follow', 'ap') : __('Unfollow', 'ap');
?>
<div class="ap-subscribe-btn" id="<?php
echo 'subscribe_' . $action_id;
?>
">
<a href="#" class="ap-btn<?php
echo $subscribed ? ' active' : '';
?>
" data-query="<?php
echo 'subscribe::' . $nonce . '::' . $action_id . '::' . $subscribe_type;
?>
" data-action="ajax_btn" data-cb="apSubscribeBtnCB">
<?php
echo ap_icon('rss', true);
?>
<span class="text"><?php
echo $title;
?>
</span>
</a>
<b class="ap-btn-counter" data-view="<?php
echo 'subscribe_' . $action_id;
?>
"><?php
echo ap_subscribers_count($action_id, $subscribe_type);
?>
</b>
</div>
<?php
}
示例14: ap_follow_btn_html
function ap_follow_btn_html($userid, $small = false)
{
if (get_current_user_id() == $userid) {
return;
}
$followed = ap_is_user_voted($userid, 'follow', get_current_user_id());
$text = $followed ? __('Unfollow', 'ap') : __('Follow', 'ap');
echo '<a class="btn ap-btn ap-follow-btn ' . ($followed ? 'ap-unfollow ' . ap_icon('unfollow') : ap_icon('follow')) . ($small ? ' ap-tip' : '') . '" href="#" data-action="ap-follow" data-args=\'' . json_encode(array('user' => $userid, 'nonce' => wp_create_nonce('follow_' . $userid))) . '\' title="' . $text . '">' . ($small ? '' : $text) . '</a>';
}
示例15: ap_icon
echo ap_icon('answer', true);
echo ap_question_get_the_answer_count();
?>
</a>
<span class="ap-user-posts-active"><?php
ap_question_the_active_ago();
?>
</span>
<a class="ap-user-posts-ccount ap-tip" href="<?php
ap_question_the_permalink();
?>
" title="<?php
_e('Comments', 'ap');
?>
"><?php
echo ap_icon('comment', true);
echo get_comments_number();
?>
</a>
<div class="no-overflow"><a href="<?php
ap_question_the_permalink();
?>
" class="ap-user-posts-title"><?php
the_title();
?>
</a></div>
</div>
<?php
}
wp_reset_postdata();