Example #1
0
                 }
             } 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;
Example #2
0
        function TopRatedSettingsPageRender()
        {
            ?>
<div class="wrap rw-dir-ltr rw-wp-container">
    <h2><?php 
            echo __('Increase User Retention and Pageviews', WP_RW__ID);
            ?>
</h2>
    <div>
        <p style="font-weight: bold; font-size: 14px;">With the Top-Rated Sidebar Widget readers will stay on your site for a longer period of time.</p>
        <ul>
            <li>
                <ul id="screenshots">
                    <li>
                        <img src="<?php 
            echo rw_get_plugin_img_path('top-rated/legacy.png');
            ?>
" alt="">
                    </li>
                    <li>
                        <img src="<?php 
            echo rw_get_plugin_img_path('top-rated/compact-thumbs.png');
            ?>
" alt="">
                    </li>
                    <li>
                        <img src="<?php 
            echo rw_get_plugin_img_path('top-rated/thumbs.png');
            ?>
" alt="">
                    </li>
                </ul>
                <div style="clear: both;"> </div>
            </li>
            <li>
                <a href="<?php 
            echo get_admin_url(null, 'widgets.php');
            ?>
" class="button-primary" style="margin-left: 20px; display: block; text-align: center; width: 720px;">Add Widget Now!</a>
            </li>
            <li>
                <h3>How</h3>
                <p>Expose your readers to the top rated posts onsite that they might not have otherwise noticed and increase your chance to reduce the bounce rate.</p>
            </li>
            <li>
                <h3>What</h3>
                <p>The Top-Rated Widget is a beautiful sidebar widget containing the top rated posts on your blog.</p>
            </li>
            <li>
                <h3>Install</h3>
                <p>Go to <b><i><a href="<?php 
            echo get_admin_url(null, 'widgets.php');
            ?>
" class="button-primary">Appearence > Widgets</a></i></b> and simply drag the <b>Rating-Widget: Top Rated</b> widget to your sidebar.</p>
                <img src="<?php 
            echo rw_get_plugin_img_path('top-rated/add-widget.png');
            ?>
" alt="">
            </li>
            <li>
                <h3>New</h3>
                <p>Thumbnails: a beautiful new thumbnail display, for themes which use post thumbnails (featured images).</p>
            </li>
            <li>
                <h3>Performance</h3>
                <p>The widget is performant, caching the top posts and featured images' thumbnails as your site is visited.</p>
            </li>
            <li>
                <a href="<?php 
            echo get_admin_url(null, 'widgets.php');
            ?>
" class="button-primary">Add Widget Now!</a>
            </li>
        </ul>
    </div>
    <br />
</div>
<?php 
        }
 /**
  * Retrieves the post's featured image or an image from the gallery if the featured image is not available. Returns a placeholder image if no image is retrieved.
  *
  * @author Leo Fajardo (@leorw)
  * @since 2.5.8
  *
  * @param int $wp_post_id The ID of a WordPress post.
  *
  * @return string
  */
 public function get_rich_snippet_default_image($wp_post_id)
 {
     // Retrieve the post's featured image URL if available.
     $image_url = $this->GetPostFeaturedImage($wp_post_id);
     // Retrieve an image from the gallery if the post's featured image is not available.
     if (empty($image_url)) {
         $image_url = $this->get_attachment_image();
     }
     // Retrieve the URL of the placeholder image if there is no available image from the site.
     if (empty($image_url)) {
         $image_url = rw_get_plugin_img_path('top-rated/placeholder.png');
     }
     return $image_url;
 }
 /**
  * Retrieves the placeholder image that is included in this plugin.
  *
  * @author Leo Fajardo (@leorw)
  * @since  2.7.5
  *
  * @return array
  */
 function get_placeholder_image_src()
 {
     $size = getimagesize(rw_get_plugin_img_path('top-rated/placeholder.png'));
     return array(rw_get_plugin_img_url('top-rated/placeholder.png'), $size[0], $size[1]);
 }