本文整理汇总了PHP中wp_star_rating函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_star_rating函数的具体用法?PHP wp_star_rating怎么用?PHP wp_star_rating使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp_star_rating函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wp_star_rating
protected function wp_star_rating($args)
{
if (function_exists('wp_star_rating')) {
echo wp_star_rating($args);
return;
}
echo '<div class="star-holder" title="' . sprintf($this->__('based on %s rating(s)'), number_format_i18n($args['number'])) . '">' . '<div class="star star-rating" style="width:' . esc_attr(str_replace(',', '.', $args['rating'])) . 'px"></div>' . '</div>';
}
示例2: kws_show_rating_box
/**
* Print a rating box that shows the star ratings and an upgrade message if a newer version of the plugin is available.
*
* Plugin data is fetched using the `plugins_api()` function, then cached for 2 hours as a transient using the `{$slug}_plugin_info` key.
*
* @uses plugins_api() Get the plugin data
*
* @param string $name The display name of the plugin.
* @param string $slug The WP.org directory repo slug of the plugin
* @param string|float|integer $version The version number of the plugin
*
* @version 1.0
*/
function kws_show_rating_box($name = '', $slug = '', $version)
{
global $wp_version;
?>
<div class="<?php
echo $slug;
?>
-ratingbox alignright" style="padding:9px 0; max-width:400px;">
<?php
// Display plugin ratings
require_once ABSPATH . 'wp-admin/includes/plugin-install.php';
// Get the cached data
$api = get_transient($slug . '_plugin_info');
// The cache data doesn't exist or it's expired.
if (empty($api)) {
$api = plugins_api('plugin_information', array('slug' => $slug));
if (!is_wp_error($api)) {
// Cache for 2 hours
set_transient($slug . '_plugin_info', $api, DAY_IN_SECONDS);
}
}
if (!is_wp_error($api)) {
if (!empty($api->rating)) {
?>
<p><a target="_blank"
href="http://wordpress.org/support/view/plugin-reviews/<?php
echo $slug;
?>
?rate=5#postform"
class="button button-secondary"><?php
_e('Rate this Plugin', 'ctctcf7');
?>
</a>
<strong><?php
_e('← Help spread the word!', 'ctctcf7');
?>
</strong></p>
<?php
if (!empty($api->downloaded)) {
echo sprintf(__('Downloaded %s times.', 'ctctcf7'), number_format_i18n($api->downloaded));
}
if (function_exists('wp_star_rating')) {
$ratings_args = array('rating' => $api->rating, 'type' => 'percent', 'number' => $api->num_ratings);
wp_star_rating($ratings_args);
} else {
?>
<div class="star-holder"
title="<?php
echo esc_attr(sprintf(__('(Average rating based on %s ratings)', 'ctctcf7'), number_format_i18n($api->num_ratings)));
?>
">
<div class="star-rating" style="width: <?php
echo esc_attr($api->rating);
?>
px"></div>
</div>
<?php
}
?>
<div>
<small style="display:block;"><?php
echo sprintf(__('Average rating based on %s ratings.', 'ctctcf7'), number_format_i18n($api->num_ratings));
?>
</small>
</div>
<?php
}
}
// if ( !is_wp_error($api)
if (isset($api->version)) {
if (version_compare($api->version, $version, '>') && version_compare($api->requires, $wp_version, '<=')) {
$message = sprintf(__('%sA newer version of %s is available: %s.%s', 'ctctcf7'), '<a class="thickbox" title="Update ' . esc_html($name) . '" href="' . admin_url('plugin-install.php?tab=plugin-information&plugin=' . $slug . '§ion=changelog&TB_iframe=true&width=640&height=808') . '">', esc_html($name), $api->version, '</a>');
// Don't use make_notice_box so can be reused in other plugins.
echo '<div id="message" class="updated">' . wpautop($message) . '</div>';
} elseif (version_compare($api->requires, $wp_version, '>')) {
echo '<div id="message" class="updated">';
echo wpautop(sprintf(__('There is a newer version of %s available, but your current version of WordPress does not support it.
%sUpdate WordPress%s', 'ctctcf7'), $name, '<a class="button button-secondary" href="' . admin_url('update-core.php') . '">', '</a>'));
echo '</div>';
} else {
echo wpautop(sprintf(__('Version %s (up to date)', 'si-contact-form'), $version));
}
}
?>
</div>
<?php
//.........这里部分代码省略.........
示例3: display_rows
//.........这里部分代码省略.........
$date_format = __('M j, Y @ H:i');
$last_updated_timestamp = strtotime($plugin['last_updated']);
?>
<div class="plugin-card plugin-card-<?php
echo sanitize_html_class($plugin['slug']);
?>
">
<div class="plugin-card-top">
<a href="<?php
echo esc_url($details_link);
?>
" class="thickbox plugin-icon"><img
src="<?php
echo esc_attr($plugin_icon_url);
?>
"/></a>
<div class="name column-name">
<h4><a href="<?php
echo esc_url($details_link);
?>
" class="thickbox"><?php
echo $title;
?>
</a>
</h4>
</div>
<div class="action-links">
<?php
if ($action_links) {
echo '<ul class="plugin-action-buttons"><li>' . implode('</li><li>', $action_links) . '</li></ul>';
}
?>
</div>
<div class="desc column-description">
<p><?php
echo $description;
?>
</p>
<p class="authors"><?php
echo $author;
?>
</p>
</div>
</div>
<div class="plugin-card-bottom">
<div class="vers column-rating">
<?php
wp_star_rating(array('rating' => $plugin['rating'], 'type' => 'percent', 'number' => $plugin['num_ratings']));
?>
<span class="num-ratings">(<?php
echo number_format_i18n($plugin['num_ratings']);
?>
)</span>
</div>
<div class="column-updated">
<strong><?php
_e('Last Updated:');
?>
</strong> <span
title="<?php
echo esc_attr(date_i18n($date_format, $last_updated_timestamp));
?>
">
<?php
printf(__('%s ago'), human_time_diff($last_updated_timestamp));
?>
</span>
</div>
<div class="column-downloaded">
<?php
if ($plugin['active_installs'] >= 1000000) {
$active_installs_text = _x('1+ Million', 'Active plugin installs');
} else {
$active_installs_text = number_format_i18n($plugin['active_installs']) . '+';
}
printf(__('%s Active Installs'), $active_installs_text);
?>
</div>
<div class="column-compatibility">
<?php
if (!empty($plugin['tested']) && version_compare(substr($GLOBALS['wp_version'], 0, strlen($plugin['tested'])), $plugin['tested'], '>')) {
echo '<span class="compatibility-untested">' . __('Untested with your version of WordPress') . '</span>';
} elseif (!empty($plugin['requires']) && version_compare(substr($GLOBALS['wp_version'], 0, strlen($plugin['requires'])), $plugin['requires'], '<')) {
echo '<span class="compatibility-incompatible">' . __('<strong>Incompatible</strong> with your version of WordPress') . '</span>';
} else {
echo '<span class="compatibility-compatible">' . __('<strong>Compatible</strong> with your version of WordPress') . '</span>';
}
?>
</div>
</div>
</div>
<?php
}
// Close off the group divs of the last one
if (!empty($group)) {
echo '</div></div>';
}
}
开发者ID:richardbota,项目名称:WordPress-Theme-Development-with-Bootstrap,代码行数:101,代码来源:class-wp-plugin-install-list-table.php
示例4: _e
<?php
_e("Visit Website", tech_bank);
?>
</a>
<?php
break;
}
?>
</li>
</ul>
</div>
</div>
<div class="plugin-card-bottom plugin-card-bottom_settings">
<div class="vers column-rating">
<?php
wp_star_rating(array("rating" => $plugin["rating"], "type" => "percent", "number" => $plugin["num_ratings"]));
?>
<span class="num-ratings">
(<?php
echo number_format_i18n($plugin["num_ratings"]);
?>
)
</span>
</div>
<div class="column-updated">
<strong><?php
_e("Last Updated:");
?>
</strong> <span title="<?php
echo esc_attr($plugin["last_updated"]);
?>
示例5: install_theme_info
/**
* Prints the info for a theme (to be used in the theme installer modal).
*
* @param object $theme - A WordPress.org Theme API object.
*/
public function install_theme_info($theme)
{
global $themes_allowedtags;
if (empty($theme)) {
return;
}
$name = wp_kses($theme->name, $themes_allowedtags);
$author = wp_kses($theme->author, $themes_allowedtags);
$install_url = add_query_arg(array('action' => 'install-theme', 'theme' => $theme->slug), self_admin_url('update.php'));
$update_url = add_query_arg(array('action' => 'upgrade-theme', 'theme' => $theme->slug), self_admin_url('update.php'));
$status = $this->_get_theme_status($theme);
?>
<div class="install-theme-info"><?php
switch ($status) {
case 'update_available':
echo '<a class="theme-install button-primary" href="' . esc_url(wp_nonce_url($update_url, 'upgrade-theme_' . $theme->slug)) . '" title="' . esc_attr(sprintf(__('Update to version %s'), $theme->version)) . '">' . __('Update') . '</a>';
break;
case 'newer_installed':
case 'latest_installed':
echo '<span class="theme-install" title="' . esc_attr__('This theme is already installed and is up to date') . '">' . _x('Installed', 'theme') . '</span>';
break;
case 'install':
default:
echo '<a class="theme-install button-primary" href="' . esc_url(wp_nonce_url($install_url, 'install-theme_' . $theme->slug)) . '">' . __('Install') . '</a>';
break;
}
?>
<h3 class="theme-name"><?php
echo $name;
?>
</h3>
<span class="theme-by"><?php
printf(__('By %s'), $author);
?>
</span>
<?php
if (isset($theme->screenshot_url)) {
?>
<img class="theme-screenshot" src="<?php
echo esc_url($theme->screenshot_url);
?>
" />
<?php
}
?>
<div class="theme-details">
<?php
wp_star_rating(array('rating' => $theme->rating, 'type' => 'percent', 'number' => $theme->num_ratings));
?>
<div class="theme-version">
<strong><?php
_e('Version:');
?>
</strong>
<?php
echo wp_kses($theme->version, $themes_allowedtags);
?>
</div>
<div class="theme-description">
<?php
echo wp_kses($theme->description, $themes_allowedtags);
?>
</div>
</div>
<input class="theme-preview-url" type="hidden" value="<?php
echo esc_url($theme->preview_url);
?>
" />
</div>
<?php
}
示例6: wp_ulike_about_page
//.........这里部分代码省略.........
?>
</a>
<a target="_blank" class="nav-tab" href="https://wordpress.org/support/view/plugin-reviews/wp-ulike"><?php
echo _e('Reviews', WP_ULIKE_SLUG);
?>
</a>
</h2>
<?php
if (!isset($_GET["credit"])) {
?>
<div class="changelog headline-feature">
<h2><?php
echo _e('Introducing WP ULike', WP_ULIKE_SLUG);
?>
</h2>
<div class="featured-image">
<img src="<?php
echo plugins_url('/assets', dirname(__FILE__));
?>
/img/wp-ulike-intro.png">
</div>
<div class="feature-section">
<div class="col">
<h3><?php
echo _e('About WP ULike', WP_ULIKE_SLUG);
?>
</h3>
<span style="text-align:center">
<?php
$args = array('rating' => 5, 'type' => 'rating', 'number' => 43);
wp_star_rating($args);
?>
</span>
<p><?php
echo _e('WP ULike plugin allows to integrate a beautiful Ajax Like Button into your wordPress website to allow your visitors to like and unlike pages, posts, comments AND buddypress activities. Its very simple to use and supports many options.', WP_ULIKE_SLUG);
?>
</p>
</div>
</div>
<div class="clear"></div>
</div>
<div class="feature-section three-col">
<div class="col">
<div class="svg-container">
<svg viewBox="-10 -10 52 52">
<g filter="">
<use xlink:href="#like"></use>
</g>
</svg>
</div>
<h3><?php
echo _e('WP Ulike Extension', WP_ULIKE_SLUG);
?>
</h3>
<p><?php
echo _e('Right now, WP ULike support wordpress posts / comments, BuddyPress activities & bbPress Topics.', WP_ULIKE_SLUG);
?>
</p>
</div>
<div class="col">
<div class="svg-container">
示例7: envato_market_plugins_column
//.........这里部分代码省略.........
} elseif ('install' === $group && current_user_can('install_plugins')) {
// Install link.
$install_link = add_query_arg(array('page' => envato_market()->get_slug(), 'action' => 'install-plugin', 'id' => $plugin['id']), self_admin_url('admin.php'));
$actions['install'] = '
<a href="' . wp_nonce_url($install_link, 'install-plugin_' . $plugin['id']) . '" class="button button-primary">
<span aria-hidden="true">' . __('Install', 'envato-market') . '</span>
<span class="screen-reader-text">' . sprintf(__('Install %s', 'envato-market'), $name) . '</span>
</a>';
}
if (0 === strrpos(html_entity_decode($author), '<a ')) {
$author_link = $author;
} else {
$author_link = '<a href="' . esc_url($author_url) . '">' . esc_html($author) . '</a>';
}
?>
<div class="col" data-id="<?php
echo esc_attr($plugin['id']);
?>
">
<div class="<?php
echo esc_attr(implode(' ', $classes));
?>
">
<div class="envato-card-top">
<a href="<?php
echo esc_url($url);
?>
" class="column-icon">
<img src="<?php
echo esc_url($plugin['thumbnail_url']);
?>
"/>
</a>
<div class="column-name">
<h4>
<a href="<?php
echo esc_url($url);
?>
"><?php
echo esc_html($name);
?>
</a>
<span class="version" aria-label="<?php
esc_attr_e('Version %s', 'envato-market');
?>
"><?php
echo esc_html(sprintf(__('Version %s', 'envato-market'), isset($plugins[$slug]) ? $plugins[$slug]['Version'] : $version));
?>
</span>
</h4>
</div>
<div class="column-description">
<div class="description">
<?php
echo wp_kses_post(wpautop($description));
?>
</div>
<p class="author">
<cite><?php
esc_html_e('By', 'envato-market');
?>
<?php
echo wp_kses_post($author_link);
?>
</cite>
</p>
</div>
<?php
if (!empty($updateActions)) {
?>
<div class="column-update">
<?php
echo implode("\n", $updateActions);
?>
</div>
<?php
}
?>
</div>
<div class="envato-card-bottom">
<div class="column-rating">
<?php
wp_star_rating(array('rating' => $plugin['rating']['rating'] / 5 * 100, 'type' => 'percent', 'number' => $plugin['rating']['count']));
?>
<span class="num-ratings">(<?php
echo esc_html(number_format_i18n($plugin['rating']['count']));
?>
)</span>
</div>
<div class="column-actions">
<?php
echo implode("\n", $actions);
?>
</div>
</div>
</div>
</div>
<?php
}
}
示例8: install_plugin_information
//.........这里部分代码省略.........
echo esc_url($api->homepage);
?>
"><?php
_e('Plugin Homepage »');
?>
</a>
</li>
<?php
}
if (!empty($api->donate_link) && empty($api->contributors)) {
?>
<li><a target="_blank"
href="<?php
echo esc_url($api->donate_link);
?>
"><?php
_e('Donate to this plugin »');
?>
</a>
</li>
<?php
}
?>
</ul>
</div>
<?php
if (!empty($api->rating)) {
?>
<h3><?php
_e('Average Rating');
?>
</h3>
<?php
wp_star_rating(array('rating' => $api->rating, 'type' => 'percent', 'number' => $api->num_ratings));
?>
<small><?php
printf(_n('(based on %s rating)', '(based on %s ratings)', $api->num_ratings), number_format_i18n($api->num_ratings));
?>
</small>
<?php
}
if (!empty($api->ratings) && array_sum((array) $api->ratings) > 0) {
foreach ($api->ratings as $key => $ratecount) {
// Avoid div-by-zero.
$_rating = $api->num_ratings ? $ratecount / $api->num_ratings : 0;
?>
<div class="counter-container">
<span class="counter-label"><a
href="https://wordpress.org/support/view/plugin-reviews/<?php
echo $api->slug;
?>
?filter=<?php
echo $key;
?>
"
target="_blank"
title="<?php
echo esc_attr(sprintf(_n('Click to see reviews that provided a rating of %d star', 'Click to see reviews that provided a rating of %d stars', $key), $key));
?>
"><?php
printf(_n('%d star', '%d stars', $key), $key);
?>
</a></span>
<span class="counter-back">
<span class="counter-bar" style="width: <?php
echo 92 * $_rating;
示例9: get_option
<div class="recipe-rating">
<?php
global $post;
$settings = get_option('maera_recipes');
?>
<?php
if (!function_exists('wp_star_rating')) {
require_once ABSPATH . 'wp-admin/includes/template.php';
}
wp_star_rating(array('rating' => get_post_meta($post->ID, 'comment_rating-average-rating', true), 'type' => 'rating', 'number' => Maera_Recipes_Reviews::count_votes($post->ID)));
?>
</div>
示例10: display_plugin_card
/**
* Display Plugin Information Card
*
* @since 1.0.0
* @access public
* @return array|string
*/
function display_plugin_card($plugin, $registered = false)
{
?>
<div id="plugin-card-<?php
echo $plugin['id'];
?>
" class="plugin-card">
<div class="plugin-card-top" plugin-id="<?php
echo $plugin['id'];
?>
">
<a href="<?php
echo esc_url($plugin['url']);
?>
" class="plugin-icon" target="_blank">
<img src="<?php
echo esc_attr($plugin['thumbnail']);
?>
" width="80" height="80" style="width:80px;height:80px;" /></a>
<div class="name column-name" style="margin-left: 100px;">
<h4><a href="<?php
echo esc_url($plugin['url']);
?>
" target="_blank"><?php
echo $plugin['item'];
?>
</a></h4>
<?php
if ($registered) {
?>
<p class="meta-links">
<a href="http://codecanyon.net/downloads#item-<?php
echo $plugin['id'];
?>
" target="_blank">Rate Plugin</a> |
<a href="http://bolderelements.net/support/" target="_blank">Get Support</a>
</p>
<?php
}
?>
</div>
<div class="action-links">
<ul class="plugin-action-buttons">
<?php
if ($registered) {
?>
<li><a href="#" class="button remove">Remove Settings</a></li>
<?php
} else {
?>
<li><a href="#" class="button register">Add Purchase Code</a></li>
<!-- <li><a href="<?php
echo esc_url($plugin['live_preview_url']);
?>
">Live Demo</a></li> -->
<?php
}
?>
</ul>
</div>
<div class="desc column-description"></div>
</div>
<div class="plugin-card-bottom">
<div class="vers column-rating">
<?php
wp_star_rating(array('rating' => $plugin['rating_decimal'], 'type' => 'rating', 'number' => 1));
?>
</div>
<div class="column-updated">
<strong><?php
_e('Last Updated');
?>
:</strong> <span title="<?php
echo esc_attr($plugin['last_update']);
?>
">
<?php
printf(__('%s ago'), human_time_diff(strtotime($plugin['last_update'])));
?>
</span>
</div>
<div class="column-downloaded">
<?php
echo sprintf(_n('%s Purchase', '%s Purchases', $plugin['sales']), number_format_i18n($plugin['sales']));
?>
</div>
<div class="column-compatibility">
<strong>Price:</strong> $<?php
echo $plugin['cost'];
?>
USD
</div>
</div>
//.........这里部分代码省略.........
示例11: esc_attr
?>
</strong> <span title="<?php
echo esc_attr(date_i18n($date_format, $last_updated_timestamp));
?>
">
<?php
printf(__('%s ago'), human_time_diff($last_updated_timestamp));
?>
</span>
</div>
<?php
if (isset($plugin['rating'])) {
?>
<div class="vers column-rating">
<?php
wp_star_rating(array('rating' => $plugin['rating'], 'type' => 'percent', 'number' => $plugin['num_ratings']));
?>
<span class="num-ratings">(<?php
echo number_format_i18n($plugin['num_ratings']);
?>
)</span>
</div>
<div class="column-downloaded">
<?php
if ($plugin['active_installs'] >= 1000000) {
$active_installs_text = _x('1+ Million', 'Active plugin installs');
} else {
$active_installs_text = number_format_i18n($plugin['active_installs']) . '+';
}
if ($plugin['downloaded'] >= 1000000) {
$download_text = _x('1+ Million', 'Downloaded');
示例12: learn_press_output_add_ons_list
function learn_press_output_add_ons_list($add_ons, $tab = '')
{
if (!is_array($add_ons) || sizeof($add_ons) == 0) {
printf('<h3>%s</h3>', __('No add-ons found', 'learn_press'));
return false;
}
echo '<ul class="learn-press-add-ons ' . $tab . '">';
foreach ($add_ons as $file => $add_on) {
$action_links = learn_press_get_add_on_action_link($add_on, $file);
/*if ( is_plugin_active( $file ) ) {
$action_links[] = '<input data-state="enabled" type="checkbox" class="lpr-fancy-checkbox" checked="checked" data-plugin="' . $file . '" data-url="' . wp_nonce_url( "plugins.php?action=deactivate&plugin={$file}", 'deactivate-plugin_' . $file ) . '" />';
} else {
$action_links[] = '<input data-state="disabled" type="checkbox" class="lpr-fancy-checkbox" data-plugin="' . $file . '" data-url="' . wp_nonce_url( "plugins.php?action=activate&plugin={$file}", 'activate-plugin_' . $file ) . '" />';
}*/
?>
<li class="plugin-card plugin-card-learnpress" id="learn-press-plugin-<?php
echo $add_on['slug'];
?>
">
<div class="plugin-card-top">
<a href="" class="thickbox plugin-icon"><img src="<?php
echo $add_on['icons']['2x'];
?>
"></a>
<div class="name column-name">
<h4><a href="" class="thickbox"><?php
echo $add_on['name'];
?>
</a></h4>
</div>
<div class="action-links">
<?php
if ($action_links) {
echo '<ul class="plugin-action-buttons"><li>' . implode('</li><li>', $action_links) . '</li></ul>';
}
?>
</div>
<div class="desc column-description">
<p><?php
echo $add_on['short_description'];
?>
</p>
<p class="authors"><?php
printf(__('<cite>By %s</cite>', 'learn_press'), $add_on['author']);
?>
</p>
</div>
</div>
<div class="plugin-card-bottom">
<?php
if (array_key_exists('rating', $add_on)) {
?>
<div class="vers column-rating">
<?php
wp_star_rating(array('rating' => $add_on['rating'], 'type' => 'percent', 'number' => $add_on['num_ratings']));
?>
<span class="num-ratings">(<?php
echo number_format_i18n($add_on['num_ratings']);
?>
)</span>
</div>
<?php
}
?>
<?php
if (array_key_exists('last_updated', $add_on)) {
?>
<?php
$date_format = 'M j, Y @ H:i';
$last_updated_timestamp = strtotime($add_on['last_updated']);
?>
<div class="column-updated">
<strong><?php
_e('Last Updated:', 'learn_press');
?>
</strong> <span title="<?php
echo esc_attr(date_i18n($date_format, $last_updated_timestamp));
?>
">
<?php
printf(__('%s ago', 'learn_press'), human_time_diff($last_updated_timestamp));
?>
</span>
</div>
<?php
}
?>
<?php
if (array_key_exists('active_installs', $add_on)) {
?>
<div class="column-downloaded">
<?php
if ($add_on['active_installs'] >= 1000000) {
$active_installs_text = _x('1+ Million', 'Active plugin installs');
} else {
$active_installs_text = number_format_i18n($add_on['active_installs']) . '+';
}
printf(__('%s Active Installs', 'learn_press'), $active_installs_text);
//.........这里部分代码省略.........
示例13: single_row
/**
* Outputs a given addon using custom markup.
*
* @uses apply_filters() Calls 'appthemes_addons_mp_markup_<screen_id>'
* @uses do_action() Calls 'appthemes_addons_mp_addon_after'
*
* @param object The addon object to output.
*/
public function single_row($addon)
{
ob_start();
?>
<div class="plugin-card">
<div class="plugin-card-top">
<a href="<?php
echo esc_url($addon->link);
?>
" target="_new" class="thickbox plugin-icon"><?php
echo $addon->image;
?>
</a>
<div class="name-top">
<div class="name column-name">
<h4><?php
echo $addon->title;
?>
</h4>
</div>
<div class="action-links price-meta">
<ul class="plugin-action-buttons price">
<li><?php
echo $addon->price;
?>
</li>
</ul>
</div>
</div>
<div class="desc column-description">
<p><?php
echo $addon->description;
?>
</p>
<p class="authors">
<cite><?php
echo sprintf(__('By %1$s', APP_TD), $addon->author_link);
?>
</cite>
</p>
</div>
</div>
<div class="plugin-card-bottom">
<div class="vers column-rating">
<?php
wp_star_rating(array('rating' => (double) $addon->rating, 'number' => $addon->votes));
?>
<span class="num-ratings">(<?php
echo number_format_i18n($addon->votes);
?>
)</span>
</div>
<div class="column-updated">
<strong><?php
echo __('Last Updated:', APP_TD);
?>
</strong>
<span title="<?php
echo esc_attr($addon->last_updated);
?>
"><?php
echo sprintf(__('%1$s ago', APP_TD), $addon->last_updated_h);
?>
</span>
</div>
<div class="column-category">
<strong><?php
echo __('Category:', APP_TD);
?>
</strong> <span title="<?php
echo esc_attr($addon->category_desc);
?>
"><?php
echo $addon->category_desc;
?>
</span>
</div>
<div class="column-requirements">
<strong><?php
echo __('Requirements:', APP_TD);
?>
</strong> <span title="<?php
echo esc_attr($addon->requirements);
?>
"><?php
echo $addon->requirements;
?>
</span>
</div>
</div>
<?php
/**
//.........这里部分代码省略.........
示例14: hocwp_star_rating_result
function hocwp_star_rating_result($args = array())
{
if (!function_exists('wp_star_rating')) {
require_once ABSPATH . 'wp-admin/includes/template.php';
}
$votes = 0;
if (!isset($args['rating'])) {
$id = hocwp_get_value_by_key($args, 'post_id', get_the_ID());
$score = get_post_meta($id, '_kksr_ratings', true);
if (!hocwp_is_positive_number($score)) {
$score = 0;
}
if (!isset($args['number'])) {
$votes = get_post_meta($id, '_kksr_casts', true);
if (!hocwp_is_positive_number($votes)) {
$votes = 0;
}
}
$args['number'] = $votes;
if ($votes != 0) {
$avg = (double) ($score / $votes);
$score = $score ? round($avg, 2) : 0;
}
$args['rating'] = $score;
}
$hide_empty = hocwp_get_value_by_key($args, 'hide_empty');
if ($hide_empty) {
$rating = $args['rating'];
if (!hocwp_is_positive_number($rating)) {
return;
}
}
$before = hocwp_get_value_by_key($args, 'before');
echo $before;
wp_star_rating($args);
$show_count = hocwp_get_value_by_key($args, 'show_count', true);
$number = hocwp_get_value_by_key($args, 'number');
$number = absint($number);
if ($show_count) {
echo '<span aria-hidden="true" class="num-ratings">(' . $number . ')</span>';
}
$after = hocwp_get_value_by_key($args, 'after');
echo $after;
}
示例15: learn_press_output_add_ons_list
function learn_press_output_add_ons_list($add_ons, $tab = '')
{
if (!is_array($add_ons)) {
return false;
}
echo '<ul class="learn-press-add-ons ' . $tab . '">';
foreach ($add_ons as $file => $add_on) {
if (!empty($add_on['options']['tag']) && 'required' === $add_on['options']['tag']) {
continue;
}
$action_links = array();
if (is_plugin_active($file)) {
$action_links[] = '<input data-state="enabled" type="checkbox" class="lpr-fancy-checkbox" checked="checked" data-plugin="' . $file . '" data-url="' . wp_nonce_url("plugins.php?action=deactivate&plugin={$file}", 'deactivate-plugin_' . $file) . '" />';
} else {
$action_links[] = '<input data-state="disabled" type="checkbox" class="lpr-fancy-checkbox" data-plugin="' . $file . '" data-url="' . wp_nonce_url("plugins.php?action=activate&plugin={$file}", 'activate-plugin_' . $file) . '" />';
}
$date_format = 'M j, Y @ H:i';
$last_updated_timestamp = strtotime($add_on['last_updated']);
?>
<li class="plugin-card plugin-card-learnpress">
<div class="plugin-card-top">
<a href="" class="thickbox plugin-icon"><img src="<?php
echo $add_on['Icons']['2x'];
?>
"></a>
<div class="name column-name">
<h4><a href="" class="thickbox"><?php
echo $add_on['Name'];
?>
</a></h4>
</div>
<div class="action-links">
<?php
if ($action_links) {
echo '<ul class="plugin-action-buttons"><li>' . implode('</li><li>', $action_links) . '</li></ul>';
}
?>
</div>
<div class="desc column-description">
<p><?php
echo $add_on['Description'];
?>
</p>
<p class="authors"><?php
printf(__('<cite>By <a href="%s">%s</a></cite>', 'learn_press'), $add_on['AuthorURI'], $add_on['Author']);
?>
</p>
</div>
</div>
<div class="plugin-card-bottom">
<div class="vers column-rating">
<?php
wp_star_rating(array('rating' => $add_on['rating'], 'type' => 'percent', 'number' => $add_on['num_ratings']));
?>
<span class="num-ratings">(<?php
echo number_format_i18n($add_on['num_ratings']);
?>
)</span>
</div>
<div class="column-updated">
<strong><?php
_e('Last Updated:', 'learn_press');
?>
</strong> <span title="<?php
echo esc_attr(date_i18n($date_format, $last_updated_timestamp));
?>
">
<?php
printf(__('%s ago', 'learn_press'), human_time_diff($last_updated_timestamp));
?>
</span>
</div>
<div class="column-downloaded">
<?php
if ($add_on['active_installs'] >= 1000000) {
$active_installs_text = _x('1+ Million', 'Active plugin installs');
} else {
$active_installs_text = number_format_i18n($add_on['active_installs']) . '+';
}
printf(__('%s Active Installs', 'learn_press'), $active_installs_text);
?>
</div>
<div class="column-compatibility">
<?php
if (!empty($add_on['tested']) && version_compare(substr($GLOBALS['wp_version'], 0, strlen($add_on['tested'])), $add_on['tested'], '>')) {
echo '<span class="compatibility-untested">' . __('Untested with your version of WordPress', 'learn_press') . '</span>';
} elseif (!empty($plugin['requires']) && version_compare(substr($GLOBALS['wp_version'], 0, strlen($add_on['requires'])), $add_on['requires'], '<')) {
echo '<span class="compatibility-incompatible">' . __('<strong>Incompatible</strong> with your version of WordPress', 'learn_press') . '</span>';
} else {
echo '<span class="compatibility-compatible">' . __('<strong>Compatible</strong> with your version of WordPress', 'learn_press') . '</span>';
}
?>
</div>
</div>
</li>
<?php
continue;
?>
<li>
//.........这里部分代码省略.........