function __construct()
 {
     if (RWLogger::IsOn()) {
         $params = func_get_args();
         RWLogger::LogEnterence("RatingWidgetPlugin_TopRatedWidget Constructor", $params, true);
     }
     $this->rw_address = WP_RW__ADDRESS;
     $widget_ops = array('classname' => 'rw_top_rated', 'description' => __('A list of your top rated posts.'));
     parent::__construct(strtolower('RatingWidgetPlugin_TopRatedWidget'), "Rating-Widget: Top Rated", $widget_ops);
     if (RWLogger::IsOn()) {
         RWLogger::LogDeparture("RatingWidgetPlugin_TopRatedWidget Constructor");
     }
 }
 function AddCollectionProductRating()
 {
     RWLogger::LogEnterence('WooCommerce_AddCollectionProductRating');
     global $product;
     $ratingHtml = $this->EmbedRatingByProduct($product, 'collection-product', false);
     echo $ratingHtml;
     RWLogger::LogDeparture('WooCommerce_AddCollectionProductRating');
 }
Пример #3
0
 function SavePostData($post_id)
 {
     if (RWLogger::IsOn()) {
         $params = func_get_args();
         RWLogger::LogEnterence("SavePostData", $params, true);
     }
     // Verify nonce.
     if (!isset($_POST['rw_post_meta_box_nonce']) || !wp_verify_nonce($_POST['rw_post_meta_box_nonce'], basename(__FILE__))) {
         return $post_id;
     }
     // Check autosave.
     if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
         return $post_id;
     }
     if (RWLogger::IsOn()) {
         RWLogger::Log("post_type", $_POST['post_type']);
     }
     // Check permissions.
     if ('page' == $_POST['post_type']) {
         if (!current_user_can('edit_page', $post_id)) {
             return $post_id;
         }
     } else {
         if (!current_user_can('edit_post', $post_id)) {
             return $post_id;
         }
     }
     //check whether this post/page is to be excluded
     $includePost = isset($_POST['rw_include_post']) && "1" == $_POST['rw_include_post'];
     $this->AddToVisibility($_POST['ID'], 'page' == $_POST['post_type'] ? array('page') : array('front-post', 'blog-post'), $includePost);
     $this->SaveVisibility();
     if (RWLogger::IsOn()) {
         RWLogger::LogDeparture("SavePostData");
     }
 }
Пример #4
0
 public function SavePostData($post_id)
 {
     if (RWLogger::IsOn()) {
         $params = func_get_args();
         RWLogger::LogEnterence('SavePostData', $params, true);
     }
     // Verify nonce.
     if (!isset($_POST['rw_post_meta_box_nonce']) || !wp_verify_nonce($_POST['rw_post_meta_box_nonce'], basename(WP_RW__PLUGIN_FILE_FULL))) {
         return $post_id;
     }
     // Check auto-save.
     if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
         return $post_id;
     }
     if (RWLogger::IsOn()) {
         RWLogger::Log('post_type', $_POST['post_type']);
     }
     // Check permissions.
     if ('page' == $_POST['post_type']) {
         if (!current_user_can('edit_page', $post_id)) {
             return $post_id;
         }
     } else {
         if (!current_user_can('edit_post', $post_id)) {
             return $post_id;
         }
     }
     //check whether this post/page is to be excluded
     $includePost = isset($_POST['rw_include_post']) && '1' == $_POST['rw_include_post'];
     // Checks whether this post/page has read-only rating.
     $readonly_post = !isset($_POST['rw_readonly_post']) || '1' !== $_POST['rw_readonly_post'];
     switch ($_POST['post_type']) {
         case 'page':
             $classes = array('page');
             break;
         case 'product':
             $classes = array('collection-product', 'product');
             break;
         case 'topic':
         case 'reply':
             $classes = array('forum-post');
             break;
         case 'post':
         default:
             $classes = array('front-post', 'blog-post');
             break;
     }
     $this->add_to_visibility_list($_POST['ID'], $classes, $includePost);
     $this->SetOption(WP_RW__VISIBILITY_SETTINGS, $this->_visibilityList);
     // Only proceed if the post type is supported.
     if (in_array($_POST['post_type'], array('post', 'page', 'product', 'topic', 'reply'))) {
         // Add/remove to/from the read-only list of post IDs based on the state of the read-only checkbox.
         $this->add_to_readonly($_POST['ID'], array($_POST['post_type']), $readonly_post);
         $this->SetOption(WP_RW__READONLY_SETTINGS, $this->_readonly_list);
     }
     $this->_options->store();
     if (RWLogger::IsOn()) {
         RWLogger::LogDeparture('SavePostData');
     }
     return $post_id;
 }
Пример #5
0
 function RWTopRated()
 {
     if (RWLogger::IsOn()) {
         $params = func_get_args();
         RWLogger::LogEnterence("RWTopRated Constructor", $params, true);
     }
     $this->rw_address = WP_RW__ADDRESS;
     $widget_ops = array('classname' => 'rw_top_rated', 'description' => __('A list of your top rated posts.'));
     $this->WP_Widget("RWTopRated", "Rating-Widget: Top Rated", $widget_ops);
     if (RWLogger::IsOn()) {
         RWLogger::LogDeparture("RWTopRated Constructor");
     }
 }