コード例 #1
0
ファイル: rw-shortcodes.php プロジェクト: zakaria340/critique
/**
 * 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
0
 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
0
 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
0
ファイル: rw-core-admin.php プロジェクト: panser/wandromaha
 function rw_admin()
 {
     ratingwidget()->admin = new RatingWidgetPlugin_Admin();
 }
コード例 #5
0
									<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
0
ファイル: top-rated.php プロジェクト: zakaria340/critique
                } 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
0
<?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
0
ファイル: addons.php プロジェクト: kitchenseeker/www
 * 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
0
 /**
  * put your comment there...
  *
  * @return RatingWidgetPlugin_Settings
  */
 function rw_settings()
 {
     return ratingwidget()->settings;
 }
コード例 #10
0
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
0
ファイル: multi-rating.php プロジェクト: zakaria340/critique
 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 &nbsp; 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 = '&nbsp;';
     }
     $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
0
ファイル: rating-widget.php プロジェクト: panser/wandromaha
        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
0
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
0
<?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
0
        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));
                ?>
    <h4><?php 
                echo $typeTitle;
                ?>
</h4>
    <p>
        <label for="<?php 
                echo $this->get_field_id("show_{$type}");
                ?>
">
            <?php 
                $checked = "";
                if ($values["show_{$type}"] == 1) {
                    $checked = ' checked="checked"';
                }
                ?>
        <input type="checkbox" class="checkbox" id="<?php 
                echo $this->get_field_id("show_{$type}");
                ?>
" name="<?php 
                echo $this->get_field_name("show_{$type}");
                ?>
" value="1"<?php 
                echo $checked;
                ?>
 />
             <?php 
                _e("Show for {$type}", WP_RW__ID);
                ?>
        </label>
    </p>
    <?php 
                if (in_array($type, array('posts', 'pages'))) {
                    ?>
    <?php 
                    $styles = array('legacy' => 'Titles (Legacy)', 'thumbs' => 'Thumbs (160px X 100px) + Titles', 'compact_thumbs' => 'Compact Thumbs (50px X 40px) + Titles');
                    ?>
    <p>
        <select id="<?php 
                    echo $this->get_field_id('style');
                    ?>
" name="<?php 
                    echo $this->get_field_name("{$type}_style");
                    ?>
" style="font-size: 11px;">
        <?php 
                    $i = 0;
                    // for old versions
                    ?>
        <?php 
                    foreach ($styles as $key => $val) {
                        ?>
            <option value="<?php 
                        echo $key;
                        ?>
"<?php 
                        if ($key == $values["{$type}_style"] || $i === $values["{$type}_style"]) {
                            echo ' selected="selected"';
                        }
                        ?>
><?php 
                        echo $val;
                        ?>
</option>
            <?php 
                        $i++;
                        ?>
        <?php 
                    }
                    ?>
        </select>
    </p>
    <?php 
                }
                ?>
    <?php 
                /* (1.3.3) - Conditional title display */
                ?>
    <p>
        <label for="<?php 
                echo $this->get_field_id("show_{$type}_title");
                ?>
">
            <?php 
                $checked = "";
                if ($values["show_{$type}_title"] == 1) {
                    $checked = ' checked="checked"';
                }
                ?>
        <input type="checkbox" class="checkbox" id="<?php 
                echo $this->get_field_id("show_{$type}_title");
                ?>
" name="<?php 
                echo $this->get_field_name("show_{$type}_title");
                ?>
" value="1"<?php 
                echo $checked;
                ?>
 />
             <?php 
                _e("Show '" . $type . "' title", WP_RW__ID);
                ?>
        </label>
    </p>
    <p>
        <label for="<?php 
                echo $this->get_field_id("{$type}_title");
                ?>
"><?php 
                _e(ucwords($type) . " Title", WP_RW__ID);
                ?>
:
            <?php 
                $values["{$type}_title"] = empty($values["{$type}_title"]) ? $typeTitle : $values["{$type}_title"];
                ?>
            <input id="<?php 
                echo $this->get_field_id('title');
                ?>
" name="<?php 
                echo $this->get_field_name("{$type}_title");
                ?>
" type="text" value="<?php 
                echo esc_attr($values["{$type}_title"]);
                ?>
" style="width: 120px;" />
        </label>
    </p>
    <p>
        <label for="rss-items-<?php 
                echo $values["{$type}_count"];
                ?>
"><?php 
                _e("How many {$type} would you like to display?", WP_RW__ID);
                ?>
                <select id="<?php 
                echo $this->get_field_id("{$type}_count");
                ?>
" name="<?php 
                echo $this->get_field_name("{$type}_count");
                ?>
">
            <?php 
                for ($i = 1; $i <= 25; $i++) {
                    echo "<option value='{$i}' " . ($values["{$type}_count"] == $i ? "selected='selected'" : '') . ">{$i}</option>";
                }
                ?>
                </select>
        </label>
    </p>
    <p>
        <label for="<?php 
                echo $this->get_field_id("{$type}_min_votes");
                ?>
"><?php 
                _e("Min Votes", WP_RW__ID);
                ?>
 (>= 1):
            <input style="width: 40px; text-align: center;" id="<?php 
                echo $this->get_field_id("{$type}_min_votes");
                ?>
" name="<?php 
                echo $this->get_field_name("{$type}_min_votes");
                ?>
" type="text" value="<?php 
                echo esc_attr($values["{$type}_min_votes"]);
                ?>
" />
        </label>
    </p>
    <p>
        <label for="rss-items-<?php 
                echo $values["{$type}_orderby"];
                ?>
"><?php 
                _e("Order By", WP_RW__ID);
                ?>
:
                <select id="<?php 
                echo $this->get_field_id("{$type}_orderby");
                ?>
" name="<?php 
                echo $this->get_field_name("{$type}_orderby");
                ?>
">
                <?php 
                for ($i = 0, $len = count($orders); $i < $len; $i++) {
                    echo '<option value="' . $orders[$i] . '"' . ($values["{$type}_orderby"] == $orders[$i] ? "selected='selected'" : '') . '>' . $orders_labels[$i] . '</option>';
                }
                ?>
                </select>
        </label>
    </p>
    <p>
        <label for="rss-items-<?php 
                echo $values["{$type}_order"];
                ?>
"><?php 
                _e("Order", WP_RW__ID);
                ?>
:
                <select id="<?php 
                echo $this->get_field_id("{$type}_order");
                ?>
" name="<?php 
                echo $this->get_field_name("{$type}_order");
                ?>
">
                    <option value="DESC"<?php 
                echo $values["{$type}_order"] == "DESC" ? " selected='selected'" : '';
                ?>
>BEST (Descending)</option>
                    <option value="ASC"<?php 
                echo $values["{$type}_order"] == "ASC" ? " selected='selected'" : '';
                ?>
>WORST (Ascending)</option>
                </select>
        </label>
    </p>
<?php 
            }
            ?>
</div>
<?php 
        }
コード例 #16
0
 function __construct()
 {
     RWLogger::LogEnterence('WooCommerce__construct');
     $this->rw = ratingwidget();
     $this->Init();
 }
コード例 #17
0
echo WP_RW__ADMIN_MENU_SLUG;
?>
:hover .wp-menu-image a,
	ul#adminmenu li.toplevel_page_<?php 
echo WP_RW__ADMIN_MENU_SLUG;
?>
.wp-has-current-submenu .wp-menu-image a,
	ul#adminmenu li.toplevel_page_<?php 
echo WP_RW__ADMIN_MENU_SLUG;
?>
.current .wp-menu-image a
	{ background-position: -1px 0; }
	ul#adminmenu li.toplevel_page_<?php 
echo WP_RW__ADMIN_MENU_SLUG;
?>
 .wp-menu-image a img { display: none; }
<?php 
if (!ratingwidget()->_rw_setup_extension()) {
    ?>
	ul#adminmenu li.toplevel_page_<?php 
    echo WP_RW__ADMIN_MENU_SLUG;
    ?>
 ul li:last-child a {
		color: yellowgreen;
		font-weight: bold;
		text-transform: uppercase;
	}
<?php 
}
?>
</style>
コード例 #18
0
 function _rw_execute_over()
 {
     $this->_logger->entrance();
     return ratingwidget()->_rw_setup_extension();
 }
コード例 #19
0
ファイル: rw-shortcodes.php プロジェクト: panser/wandromaha
function rw_get_user_rating($userID = false)
{
    $userID = false === $userID ? get_current_user_id() : $userID;
    return ratingwidget()->EmbedRatingByUser(get_user_by('id', $userID));
}
コード例 #20
0
function rw_get_post_thumb_url($post, $width = 160, $height = 100)
{
    $img = ratingwidget()->GetPostImage($post, WP_RW__CACHE_TIMEOUT_POST_THUMB_EXTRACT);
    return rw_get_img_thumb_url(false !== $img ? $img : get_permalink($post->ID), $width, $height);
}
コード例 #21
0
<?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, $settings->{'show_on_' . $view});
    }
} else {
    foreach ($views as $view) {
        $settings->{'show_on_' . $view} = false !== ratingwidget()->GetOption('rw_show_on_' . $view);
    }
}
?>
<div class="has-sidebar has-right-sidebar">
    <div class="has-sidebar-content">
        <div class="postbox rw-body">
            <h3><?php 
_e('Post Views Visibility Settings', WP_RW__ID);
?>
</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';
    }
    ?>
コード例 #22
0
ファイル: preview.php プロジェクト: samiksha369/majorcraft
<?php

/**
 * @var Freemius           $rw_fs
 * @var RatingWidgetPlugin $rwp
 */
global $rw_fs, $rwp;
$rclass = rtrim(rw_settings_rating_type(), 's');
$has_multi_rating = ratingwidget()->has_multirating_options($rclass);
$multi_criterion = false;
if ($has_multi_rating) {
    $multirating_options = ratingwidget()->get_multirating_options_by_class($rclass);
    // Check if there are more than one criteria so that we can hide or show additional options
    $total_criteria = count($multirating_options->criteria);
    $multi_criterion = $total_criteria > 1;
    if ($total_criteria > 3) {
        $multirating_options->criteria = array_splice($multirating_options->criteria, 0, 3);
    }
}
$options = rw_options();
$default_hide_recommendations = isset($options->hideRecommendations) ? $options->hideRecommendations : false;
$urid_summary_star = 1;
$urid_summary_nero = 2;
$add_label_str = __rw('add-label');
$add_criteria_str = __rw('add-criteria-rating');
?>
<div id="rw_wp_preview" class="postbox rw-body<?php 
echo $multi_criterion ? ' multi-rating' : '';
echo ' rw-' . $options->advanced->layout->dir;
?>
">
コード例 #23
0
    case 'topic':
    case 'reply':
        $excluded_post = false === $rwp->rw_validate_visibility($post->ID, 'forum-post');
        $rclass = 'reply' === $post_type ? 'forum-reply' : 'forum-post';
        break;
    case 'post':
    default:
        $excluded_post = false === $rwp->rw_validate_visibility($post->ID, 'front-post') && false === $rwp->rw_validate_visibility($post->ID, 'blog-post');
        $rclass = 'blog-post';
        break;
}
RWLogger::Log('ShowPostMetaBox', 'Post Type = ' . $post_type);
add_action('admin_footer', array(&$rwp, "rw_attach_rating_js"), 5);
$multirating_options = ratingwidget()->get_multirating_options_by_class($rclass);
$multi_criteria = count($multirating_options->criteria) > 1;
$options = ratingwidget()->get_options_by_class($rclass);
$default_hide_recommendations = isset($options->hideRecommendations) ? $options->hideRecommendations : false;
?>
<p>
	<input type="hidden" name="rw_post_meta_box_nonce" value="<?php 
echo wp_create_nonce(basename(WP_RW__PLUGIN_FILE_FULL));
?>
" />
	<table class="rw-rating-table rw-<?php 
echo $options->advanced->layout->dir;
?>
">
		<?php 
$urid_summary = $rwp->get_rating_id_by_element($post->ID, $rclass, false);
$criteria_id = 1;
foreach ($multirating_options->criteria as $criteria_key => $criteria) {