PluginProbe ʕ •ᴥ•ʔ
Rich Showcase for Google Reviews / 6.4
Rich Showcase for Google Reviews v6.4
6.9.8 6.9.7 6.9.6 trunk 1.4 1.42 1.43 1.44 1.45 1.46 1.47 1.48 1.49 1.5 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 1.6 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.7 1.6.8 1.6.9 1.7 1.7.1 1.7.2 1.7.3 1.7.4 1.7.5 1.7.6 1.7.7 1.7.8 1.7.9 1.8 1.8.1 1.8.2 1.8.3 1.8.4 1.8.5 1.8.6 1.8.7 1.8.8 1.8.9 1.9 1.9.1 1.9.2 1.9.3 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 2.2 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9 2.3 2.4 2.4.1 2.4.2 2.5 2.5.1 2.6 2.6.1 2.6.2 2.7 2.8 2.9 3.0 3.1 3.2 3.3 3.4 3.5 3.6 3.6.1 3.7 3.8 3.9 4.0 4.1 4.2 4.3 4.4 4.5 4.6 4.7 4.8 4.8.1 4.8.2 5.0 5.1 5.2 5.3 5.4 5.5 5.6 5.7 5.7.1 5.8 5.9 5.9.1 5.9.2 5.9.3 5.9.7 6.0 6.1 6.2 6.3 6.4 6.4.1 6.5 6.6 6.6.1 6.6.2 6.7 6.8 6.8.1 6.8.2 6.9 6.9.1 6.9.2 6.9.3 6.9.4 6.9.4.1 6.9.4.2 6.9.4.3 6.9.4.4 6.9.5
widget-google-reviews / includes / admin / class-admin-feed-columns.php
widget-google-reviews / includes / admin Last commit date
class-admin-feed-columns.php 10 months ago class-admin-menu.php 2 years ago class-admin-notice.php 1 year ago class-admin-page.php 3 years ago class-admin-rateus-ajax.php 1 year ago class-admin-rev.php 1 year ago class-admin-tophead.php 1 year ago
class-admin-feed-columns.php
100 lines
1 <?php
2
3 namespace WP_Rplg_Google_Reviews\Includes\Admin;
4
5 use WP_Rplg_Google_Reviews\Includes\Post_Types;
6
7 class Admin_Feed_Columns {
8
9 private $feed_deserializer;
10
11 private static $plugin_themes = array(
12 'list' => 'List',
13 'slider' => 'Slider',
14 'grid' => 'Grid',
15 'rating' => 'Rating'
16 );
17
18 public function __construct($feed_deserializer) {
19 $this->feed_deserializer = $feed_deserializer;
20 }
21
22 public function register() {
23 add_filter('get_edit_post_link', array($this, 'change_edit_post_link'), 10, 3);
24 add_filter('manage_edit-' . Post_Types::FEED_POST_TYPE . '_columns', array($this, 'get_columns'));
25 add_action('manage_' . Post_Types::FEED_POST_TYPE . '_posts_custom_column', array($this, 'render'), 10, 2);
26 add_filter('post_row_actions', array($this, 'change_post_row_actions'), 10, 2);
27 add_filter('get_the_excerpt', array($this, 'hide_grw_feed_excerpt'), 10, 2);
28 }
29
30 public function change_edit_post_link($link, $id, $context) {
31 if (function_exists('get_current_screen')) {
32 $screen = get_current_screen();
33 if (empty($screen) || $screen->post_type !== Post_Types::FEED_POST_TYPE) {
34 return $link;
35 }
36 return admin_url('admin.php?page=grw-builder&' . Post_Types::FEED_POST_TYPE . '_id=' . $id);
37 } else {
38 return;
39 }
40 }
41
42 public function get_columns($columns) {
43 $columns = $columns;
44 $columns = array(
45 'cb' => '<input type="checkbox">',
46 'title' => __('Title', 'widget-google-reviews'),
47 'ID' => __('ID', 'widget-google-reviews'),
48 'grw_theme' => __('Theme', 'widget-google-reviews'),
49 'grw_shortcode' => __('Shortcode', 'widget-google-reviews'),
50 'date' => __('Date', 'widget-google-reviews'),
51 );
52 return $columns;
53 }
54
55 public function render($column_name, $post_id) {
56 $args = array();
57
58 if (isset($_GET['post_status'])) {
59 $post_status = sanitize_text_field(wp_unslash($_GET['post_status']));
60
61 if ($post_status === 'trash') {
62 $args['post_status'] = array('trash');
63 }
64 }
65
66 $feed = $this->feed_deserializer->get_feed($post_id, $args);
67 if (!$feed) {
68 return null;
69 }
70
71 $connection = json_decode($feed->post_content);
72
73 switch ($column_name) {
74 case 'ID':
75 echo $feed->ID;
76 break;
77 case 'grw_theme':
78 echo isset($connection->options->view_mode) ? self::$plugin_themes[$connection->options->view_mode] : 'List';
79 break;
80 case 'grw_shortcode':
81 echo '<input type="text" value="[grw id=' . $feed->ID . ']" onclick="this.select(); document.execCommand(\'copy\');var sm=this.nextSibling;sm.className=\'\';setTimeout(function() {sm.className=\'grw_hide\';},10);" readonly=""><small>shortcode copied</small>';
82 break;
83 }
84 }
85
86 public function change_post_row_actions($actions, $post) {
87 if (isset($actions) && $post->post_type === Post_Types::FEED_POST_TYPE) {
88 $changed_actions = array(
89 'post-id' => '<span class="grw-admin-column-action">ID: ' . $post->ID . '</span>',
90 );
91 $actions = $changed_actions + $actions;
92 }
93 return $actions;
94 }
95
96 public function hide_grw_feed_excerpt($excerpt, $post = null) {
97 return $post->post_type !== Post_Types::FEED_POST_TYPE ? $excerpt : '';
98 }
99 }
100