本文整理汇总了PHP中ratingwidget函数的典型用法代码示例。如果您正苦于以下问题:PHP ratingwidget函数的具体用法?PHP ratingwidget怎么用?PHP ratingwidget使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ratingwidget函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: rw_toprated_shortcode
/**
* Top-rated shortcode
*
* @author Leo Fajardo (@leorw)
* @since 2.4.1
* @param array $atts
* @return string
*/
function rw_toprated_shortcode($atts)
{
RWLogger::LogEnterence('rw_toprated_shortcode');
if (RWLogger::IsOn()) {
RWLogger::Log('rw_toprated_shortcode', var_export($atts, true));
}
$atts = shortcode_atts(array('type' => 'posts', 'direction' => 'ltr', 'max_items' => '5', 'min_votes' => '1', 'order' => 'DESC', 'order_by' => 'avgrate', 'created_in' => 'all_time'), $atts);
return ratingwidget()->get_toprated_from_shortcode($atts);
}
示例2: update
function update($new_instance, $old_instance)
{
// Clear transients to refresh data after Top-Rated Widget update.
ratingwidget()->ClearTransients();
$types = $this->GetTypesInfo();
$instance = $old_instance;
$instance['title'] = $new_instance['title'];
$instance['title_max_length'] = (int) $new_instance['title_max_length'];
foreach ($types as $type => $info) {
$instance["show_{$type}"] = (int) $new_instance["show_{$type}"];
$instance["show_{$type}_title"] = (int) $new_instance["show_{$type}_title"];
/* (1.3.3) - Conditional title display */
$instance["{$type}_style"] = $new_instance["{$type}_style"];
$instance["{$type}_title"] = $new_instance["{$type}_title"];
/* (1.3.3) - Explicit title */
$instance["{$type}_count"] = (int) $new_instance["{$type}_count"];
$instance["{$type}_min_votes"] = (int) $new_instance["{$type}_min_votes"];
/* (1.3.7) - Min votes to appear */
$instance["{$type}_orderby"] = $new_instance["{$type}_orderby"];
/* (1.3.7) - Order by */
$instance["{$type}_order"] = $new_instance["{$type}_order"];
/* (1.3.8) - Order */
$instance["{$type}_since_created"] = (int) $new_instance["{$type}_since_created"];
}
return $instance;
}
示例3: GetTopRatedData
public function GetTopRatedData($pTypes = array(), $pLimit = 5, $pOffset = 0, $pMinVotes = 1, $pInclude = false, $pShowOrder = false, $pOrderBy = 'avgrate', $pOrder = 'DESC', $since_created = -1)
{
if (RWLogger::IsOn()) {
$params = func_get_args();
RWLogger::LogEnterence('GetTopRatedData', $params);
}
if (!is_array($pTypes) || count($pTypes) == 0) {
return false;
}
$types = $this->get_rating_types();
$typesKeys = array_keys($types);
$availableTypes = array_intersect($typesKeys, $pTypes);
if (!is_array($availableTypes) || count($availableTypes) == 0) {
return false;
}
$details = array('uid' => $this->account->site_public_key);
$queries = array();
foreach ($availableTypes as $type) {
$options = ratingwidget()->GetOption($types[$type]['options']);
$queries[$type] = array('rclasses' => $types[$type]['classes'], 'votes' => $pMinVotes, 'orderby' => $pOrderBy, 'order' => $pOrder, 'show_order' => $pShowOrder ? 'true' : 'false', 'offset' => $pOffset, 'limit' => $pLimit, 'types' => isset($options->type) ? $options->type : 'star');
if ($since_created >= WP_RW__TIME_24_HOURS_IN_SEC) {
$time = current_time('timestamp', true) - $since_created;
// c: ISO 8601 full date/time, e.g.: 2004-02-12T15:19:21+00:00
$queries[$type]['since_created'] = date('c', $time);
}
if (is_array($pInclude) && count($pInclude) > 0) {
$queries[$type]['urids'] = implode(',', $pInclude);
}
}
$details['queries'] = urlencode(json_encode($queries));
$rw_ret_obj = ratingwidget()->RemoteCall('action/query/ratings.php', $details, WP_RW__CACHE_TIMEOUT_TOP_RATED);
if (false === $rw_ret_obj) {
return false;
}
$rw_ret_obj = json_decode($rw_ret_obj);
if (null === $rw_ret_obj || true !== $rw_ret_obj->success) {
return false;
}
return $rw_ret_obj;
}
示例4: rw_admin
function rw_admin()
{
ratingwidget()->admin = new RatingWidgetPlugin_Admin();
}
示例5: isset
<span class="rw-remove"><a href="#" class="rw-remove-button"></a></span>
</td>
<input type="hidden" class="multi-rating-label" name="multi_rating[criteria][][label]" value="<?php
echo isset($criterion['label']) ? $criterion['label'] : '';
?>
" />
</tr>
<?php
}
?>
<tr class="rw-add-rating-container">
<td colspan="3">
<div class="rw-dash">
<?php
$upgrade_label_text = __('Upgrade to Professional for Unlimited Criteria', WP_RW__ID);
if ($total_criteria >= 3 && !ratingwidget()->_rw_is_running()) {
?>
<a class="rw-add-rating upgrade" href="<?php
echo rw_fs()->get_upgrade_url();
?>
" data-upgrade-href="<?php
echo rw_fs()->get_upgrade_url();
?>
" data-upgrade-text="[+] <?php
echo $upgrade_label_text;
?>
" data-default-text="[+] <?php
_e('Add Rating / Criteria', WP_RW__ID);
?>
">[+] <?php
echo $upgrade_label_text;
示例6: get_post
} else {
$post_id = RatingWidgetPlugin::Urid2PostId($urid);
$wp_object = get_post($post_id);
$title = get_the_title($post_id);
$excerpt = ratingwidget()->GetPostExcerpt($wp_object, 15);
$permalink = get_permalink($post_id);
$thumbnail = ratingwidget()->GetPostImage($wp_object);
}
if ($wp_object) {
// Skip null object
if ($thumbnail) {
$thumbnail = trim($thumbnail);
}
if (empty($thumbnail)) {
$thumbnail = rw_get_plugin_img_path('top-rated/placeholder.png');
}
$short = mb_strlen($title) > 30 ? trim(mb_substr($title, 0, 30)) . '...' : $title;
ratingwidget()->QueueRatingData($urid, $title, $permalink, $rclass);
$html .= "\t\t\t\t\t<li class=\"rw-wp-ui-top-rated-list-item\">\r\n\t\t\t\t\t\t<div>\r\n\t\t\t\t\t\t\t<b class=\"rw-wp-ui-top-rated-list-count\">{$count}</b>\r\n\t\t\t\t\t\t\t<a href=\"{$permalink}\"><img class=\"rw-wp-ui-top-rated-list-item-thumbnail\" src=\"{$thumbnail}\" alt=\"\" /></a>\r\n\t\t\t\t\t\t\t<div class=\"rw-wp-ui-top-rated-list-item-data\">\r\n\t\t\t\t\t\t\t\t<div>\r\n\t\t\t\t\t\t\t\t\t<a class=\"rw-wp-ui-top-rated-list-item-title\" href=\"{$permalink}\" title=\"{$title}\">{$short}</a>\r\n\t\t\t\t\t\t\t\t\t<div class=\"rw-ui-container rw-class-{$rclass} rw-urid-{$urid} rw-prop-readOnly-true\" data-sync=\"false\"></div>\r\n\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t<p class=\"rw-wp-ui-top-rated-list-item-excerpt\">{$excerpt}</p>\r\n\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t</li>";
$count++;
}
}
$html .= '</ul>';
$html .= '</div>';
}
}
// Set a flag that the widget is loaded.
ratingwidget()->TopRatedWidgetLoaded();
$html .= '</div>';
echo $html;
}
示例7: ratingwidget
<?php
$bbpress_support = ratingwidget()->IsBBPressInstalled();
$is_accumulated = $bbpress_support ? rw_settings()->is_user_accumulated : false;
?>
<div id="rw_user_rating_type_settings" class="has-sidebar has-right-sidebar">
<div class="has-sidebar-content">
<div class="postbox rw-body">
<h3><?php
_erw('rating-type');
?>
</h3>
<div class="inside rw-ui-content-container rw-no-radius">
<div class="rw-ui-img-radio rw-ui-hor<?php
if ($is_accumulated) {
echo ' rw-selected';
}
?>
"<?php
if (!$bbpress_support) {
echo ' data-alert="' . __rw('reputational-rating_pro-only-alert') . '"';
}
?>
>
<i class="rw-ui-sprite"></i> <input type="radio" name="rw_accumulated_user_rating"
value="true" <?php
if ($is_accumulated) {
echo ' checked="checked"';
}
?>
示例8: ratingwidget
* Called from addons_settings_page_render method in rating-widget.php
*/
$addons = ratingwidget()->get_addons();
$admin_notice_classes = 'addons-page-notice update-nag';
global $wp_version;
// Use additional class for the different versions of WordPress
// in order to have the correct message styles.
if ($wp_version < 3) {
$admin_notice_classes .= ' updated';
} else {
if ($wp_version >= 3.8) {
$admin_notice_classes .= ' success';
}
}
$message = __('Thanks for subscribing to the waiting list - we will let you know when the Add On is ready.', WP_RW__ID);
ratingwidget()->Notice($message, $admin_notice_classes);
?>
<div class="wrap rw-dir-ltr">
<h2 class="entry-title"><?php
_e('Add Ons for RatingWidget', WP_RW__ID);
?>
</h2>
<form id="rw-addons-page" method="post" action="">
<div id="poststuff">
<div class="postbox rw-body">
<div class="inside rw-ui-content-container rw-no-radius">
<div class="entry-content">
<ul class="rw-addon-grid clearfix">
<?php
foreach ($addons as $idx => $addon) {
$pricing = $addon['pricing'][0];
示例9: rw_settings
/**
* put your comment there...
*
* @return RatingWidgetPlugin_Settings
*/
function rw_settings()
{
return ratingwidget()->settings;
}
示例10: _e
if ('laccount' === $settings->identify_by) {
echo ' checked="checked"';
}
?>
> <span><?php
_e('Identify visitor by Cookie / Device.', WP_RW__ID);
?>
</span>
</div>
<div class="rw-ui-img-radio rw-ui-hor<?php
if ('ip' === $settings->identify_by) {
echo ' rw-selected';
}
?>
"<?php
if (!ratingwidget()->_rw_is_running()) {
?>
data-alert="<?php
_e('Visitor by IP identification is only supported in Professional plan and above.', WP_RW__ID);
?>
"<?php
}
?>
>
<input type="radio" name="rw_identify_by" value="ip" <?php
if ('ip' === $settings->identify_by) {
echo ' checked="checked"';
}
?>
> <span><?php
_e('Identify visitor by IP / Location. <b>Especially for Voting Contests</b> (included in Professional Plan).', WP_RW__ID);
示例11: unset
if ($mr_multi_options->show_summary_rating && $multi_criteria) {
if ($hide_recommendations) {
// Restore the value of hide-recommendations
$mr_embed_options['hide-recommendations'] = 'true';
} else {
unset($mr_embed_options['hide-recommendations']);
}
if (false === $original_uarid) {
unset($mr_embed_options['uarid']);
} else {
// Restore original aggregated rating ID.
$mr_embed_options['uarid'] = $original_uarid;
}
$mr_embed_options['read-only'] = 'true';
$mr_embed_options['force-sync'] = 'true';
$raw_rating = ratingwidget()->EmbedRawRating($mr_summary_urid, $mr_title, $mr_permalink, $mr_element_class, $mr_add_schema, $mr_hor_align, $mr_custom_style, $mr_embed_options);
// Defaults to instead of empty to keep the widths of all rating widgets same
if (isset($mr_multi_options->summary_label)) {
$summary_label = $mr_multi_options->summary_label;
if ($rw_no_labels) {
$rw_no_labels = false;
}
} else {
$summary_label = ' ';
}
$html .= '<tr>';
$html .= '<td><nobr>' . $summary_label . '</nobr></td>';
$html .= '<td>' . $raw_rating . '</td>';
$html .= '</tr>';
}
$dir = isset($mr_general_options->advanced) && isset($mr_general_options->advanced->layout) && is_string($mr_general_options->advanced->layout->dir) ? $mr_general_options->advanced->layout->dir : 'ltr';
示例12: GetTopRated
public function GetTopRated()
{
$rw_ret_obj = $this->GetTopRatedData(array('posts', 'pages'));
if (false === $rw_ret_obj || count($rw_ret_obj->data) == 0) {
return '';
}
$html = '<div id="rw_top_rated_page">';
foreach ($rw_ret_obj->data as $type => $ratings) {
if (is_array($ratings) && count($ratings) > 0) {
$html .= '<div id="rw_top_rated_page_' . $type . '" class="rw-wp-ui-top-rated-list-container">';
if ($instance["show_{$type}_title"]) {
$instance["{$type}_title"] = empty($instance["{$type}_title"]) ? ucwords($type) : $instance["{$type}_title"];
$html .= '<p style="margin: 0;">' . $instance["{$type}_title"] . '</p>';
}
$html .= '<ul class="rw-wp-ui-top-rated-list">';
$count = 1;
foreach ($ratings as $rating) {
$urid = $rating->urid;
$rclass = $types[$type]["rclass"];
$thumbnail = '';
ratingwidget()->QueueRatingData($urid, "", "", $rclass);
switch ($type) {
case "posts":
case "pages":
$id = RatingWidgetPlugin::Urid2PostId($urid);
$post = get_post($id);
$title = trim(strip_tags($post->post_title));
$excerpt = $this->GetPostExcerpt($post, 15);
$permalink = get_permalink($post->ID);
$thumbnail = $this->GetPostFeaturedImage($post->ID);
break;
case "comments":
$id = RatingWidgetPlugin::Urid2CommentId($urid);
$comment = get_comment($id);
$title = trim(strip_tags($comment->comment_content));
$permalink = get_permalink($comment->comment_post_ID) . '#comment-' . $comment->comment_ID;
break;
case "activity_updates":
case "activity_comments":
$id = RatingWidgetPlugin::Urid2ActivityId($urid);
$activity = new bp_activity_activity($id);
$title = trim(strip_tags($activity->content));
$permalink = bp_activity_get_permalink($id);
break;
case "users":
$id = RatingWidgetPlugin::Urid2UserId($urid);
$title = trim(strip_tags(bp_core_get_user_displayname($id)));
$permalink = bp_core_get_user_domain($id);
break;
case "forum_posts":
$id = RatingWidgetPlugin::Urid2ForumPostId($urid);
$forum_post = bp_forums_get_post($id);
$title = trim(strip_tags($forum_post->post_text));
$page = bb_get_page_number($forum_post->post_position);
$permalink = get_topic_link($id, $page) . "#post-{$id}";
break;
}
$short = mb_strlen($title) > 30 ? trim(mb_substr($title, 0, 30)) . "..." : $title;
$html .= '
<li class="rw-wp-ui-top-rated-list-item">
<div>
<b class="rw-wp-ui-top-rated-list-count">' . $count . '</b>
<img class="rw-wp-ui-top-rated-list-item-thumbnail" src="' . $thumbnail . '" alt="" />
<div class="rw-wp-ui-top-rated-list-item-data">
<div>
<a class="rw-wp-ui-top-rated-list-item-title" href="' . $permalink . '" title="' . $title . '">' . $short . '</a>
<div class="rw-ui-container rw-class-' . $rclass . ' rw-urid-' . $urid . ' rw-size-small rw-prop-readOnly-true"></div>
</div>
<p class="rw-wp-ui-top-rated-list-item-excerpt">' . $excerpt . '</p>
</div>
</div>
</li>';
$count++;
}
$html .= "</ul>";
$html .= "</div>";
}
}
// Set a flag that the widget is loaded.
RatingWidgetPlugin::TopRatedWidgetLoaded();
ob_start();
?>
<script type="text/javascript">
// Hook render widget.
if (typeof(RW_HOOK_READY) === "undefined"){ RW_HOOK_READY = []; }
RW_HOOK_READY.push(function(){
RW._foreach(RW._getByClassName("rw-wp-ui-top-rated-list", "ul"), function(list){
RW._foreach(RW._getByClassName("rw-ui-container", "div", list), function(rating){
// Deactivate rating.
RW._Class.remove(rating, "rw-active");
var i = (RW._getByClassName("rw-report-link", "a", rating))[0];
if (RW._is(i)){ i.parentNode.removeChild(i); }
});
});
});
</script>
<?php
$html .= ob_get_clean();
$html .= '</div>';
return $html;
//.........这里部分代码省略.........
示例13: rw_include_once_view
rw_include_once_view("settings/theme.php");
?>
</tr>
<tr id="rw_star_size" class="rw-<?php
echo ($odd = !$odd) ? "odd" : "even";
?>
">
<?php
rw_include_once_view("settings/size.php");
?>
</tr>
<?php
if (rw_fs()->is__premium_only()) {
?>
<?php
if (ratingwidget()->IsBuddyPressInstalled() || ratingwidget()->IsBBPressInstalled()) {
?>
<tr id="rw_rate_background" class="rw-<?php
echo ($odd = !$odd) ? "odd" : "even";
?>
">
<?php
rw_include_once_view("settings/background.php");
?>
</tr>
<?php
}
?>
<?php
}
?>
示例14: rw_settings
<?php
$settings = rw_settings();
$views = array('excerpt', 'archive', 'category', 'search');
if ($settings->IsSaveMode()) {
foreach ($views as $view) {
$settings->{'show_on_' . $view} = isset($_POST['rw_show_on_' . $view]) ? true : false;
ratingwidget()->SetOption('rw_show_on_' . $view, json_encode($settings->{'show_on_' . $view}));
}
} else {
foreach ($views as $view) {
$settings->{'show_on_' . $view} = 'false' !== ratingwidget()->GetOption('rw_show_on_' . $view, false, 'true');
}
}
?>
<div class="has-sidebar has-right-sidebar">
<div class="has-sidebar-content">
<div class="postbox rw-body">
<h3>Post Views Visibility Settings</h3>
<div class="inside rw-ui-content-container rw-no-radius">
<?php
foreach ($views as $view) {
?>
<div class="rw-ui-img-radio rw-ui-hor<?php
if ($settings->{'show_on_' . $view}) {
echo ' rw-selected';
}
?>
">
<input type="checkbox" name="rw_show_on_<?php
echo $view;
示例15: form
function form($instance)
{
$types = array("posts", "pages", "comments");
if (ratingwidget()->IsBuddyPressInstalled()) {
$types[] = "activity_updates";
$types[] = "activity_comments";
$types[] = "users";
}
if (ratingwidget()->IsBBPressInstalled()) {
$types[] = "users";
$types[] = "forum_posts";
}
$orders = array("avgrate", "votes", "likes", "created", "updated");
$orders_labels = array("Average Rate", "Votes Number", "Likes (for Thumbs)", "Created", "Updated");
$show = array();
$items = array();
// Update default values.
$values = array('title' => '', 'title_max_length' => 30);
foreach ($types as $type) {
$values["show_{$type}"] = 'posts' === $type;
$values["{$type}_count"] = WP_RW__TR_DEFAULT_ITEMS_COUNT;
$values["{$type}_min_votes"] = WP_RW__TR_DEFAULT_MIN_VOTES;
$values["{$type}_orderby"] = WP_RW__TR_DEFAULT_ORDERY_BY;
$values["{$type}_order"] = WP_RW__TR_DEFAULT_ORDERY;
$values["show_{$type}_title"] = 0;
$values["{$type}_style"] = WP_RW__TR_DEFAULT_STYLE;
}
$instance = wp_parse_args((array) $instance, $values);
$title = strip_tags($instance['title']);
$titleMaxLength = (int) $instance['title_max_length'];
foreach ($types as $type) {
if (isset($instance["show_{$type}"])) {
$values["show_{$type}"] = (int) $instance["show_{$type}"];
}
if (isset($instance["show_{$type}_title"])) {
$values["show_{$type}_title"] = (int) $instance["show_{$type}_title"];
}
if (isset($instance["{$type}_title"])) {
$values["{$type}_title"] = $instance["{$type}_title"];
}
if (isset($instance["{$type}_style"])) {
$values["{$type}_style"] = $instance["{$type}_style"];
}
if (isset($instance["{$type}_count"])) {
$values["{$type}_count"] = (int) $instance["{$type}_count"];
}
if (isset($instance["{$type}_min_votes"])) {
$values["{$type}_min_votes"] = max(1, (int) $instance["{$type}_min_votes"]);
}
if (isset($instance["{$type}_orderby"])) {
$values["{$type}_orderby"] = $instance["{$type}_orderby"];
}
if (isset($values["{$type}_orderby"]) && !in_array($values["{$type}_orderby"], $orders)) {
$values["{$type}_orderby"] = WP_RW__TR_DEFAULT_ORDERY_BY;
}
if (isset($values["{$type}_order"])) {
$values["{$type}_order"] = strtoupper($instance["{$type}_order"]);
}
if (isset($values["{$type}_order"]) && !in_array($values["{$type}_order"], array("DESC", "ASC"))) {
$values["{$type}_order"] = WP_RW__TR_DEFAULT_ORDERY;
}
}
?>
<div id="rw_wp_top_rated_settings">
<p><label for="<?php
echo $this->get_field_id('title');
?>
"><?php
_e('Widget Title', WP_RW__ID);
?>
: <input id="<?php
echo $this->get_field_id('title');
?>
" name="<?php
echo $this->get_field_name('title');
?>
" type="text" value="<?php
echo esc_attr($title);
?>
" /></label></p>
<p><label for="<?php
echo $this->get_field_id('title_max_length');
?>
"><?php
_e('Title Max Length', WP_RW__ID);
?>
: <input id="<?php
echo $this->get_field_id('title_max_length');
?>
" name="<?php
echo $this->get_field_name('title_max_length');
?>
" type="text" value="<?php
echo esc_attr($titleMaxLength);
?>
" /></label></p>
<?php
foreach ($types as $type) {
$typeTitle = ucwords(str_replace("_", " ", $type));
?>
//.........这里部分代码省略.........