PluginProbe ʕ •ᴥ•ʔ
Rich Showcase for Google Reviews / 3.1
Rich Showcase for Google Reviews v3.1
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 2 years ago class-admin-menu.php 3 years ago class-admin-notice.php 3 years ago class-admin-page.php 3 years ago class-admin-rateus-ajax.php 3 years ago class-admin-rev.php 3 years ago class-admin-tophead.php 3 years ago
class-admin-feed-columns.php
95 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 );
16
17 public function __construct($feed_deserializer) {
18 $this->feed_deserializer = $feed_deserializer;
19 }
20
21 public function register() {
22 add_filter('get_edit_post_link', array($this, 'change_edit_post_link'), 10, 3);
23 add_filter('manage_edit-' . Post_Types::FEED_POST_TYPE . '_columns', array($this, 'get_columns'));
24 add_action('manage_' . Post_Types::FEED_POST_TYPE . '_posts_custom_column', array($this, 'render'), 10, 2);
25 add_filter('post_row_actions', array($this, 'change_post_row_actions'), 10, 2);
26 add_filter('get_the_excerpt', array($this, 'hide_grw_feed_excerpt'), 10, 2);
27 }
28
29 public function change_edit_post_link($link, $id, $context) {
30 if (function_exists('get_current_screen')) {
31 $screen = get_current_screen();
32 if (empty($screen) || $screen->post_type !== Post_Types::FEED_POST_TYPE) {
33 return $link;
34 }
35 return admin_url('admin.php?page=grw-builder&' . Post_Types::FEED_POST_TYPE . '_id=' . $id);
36 } else {
37 return;
38 }
39 }
40
41 public function get_columns($columns) {
42 $columns = $columns;
43 $columns = array(
44 'cb' => '<input type="checkbox">',
45 'title' => __('Title', 'widget-google-reviews'),
46 'ID' => __('ID', 'widget-google-reviews'),
47 'grw_theme' => __('Theme', 'widget-google-reviews'),
48 'date' => __('Date', 'widget-google-reviews'),
49 );
50 return $columns;
51 }
52
53 public function render($column_name, $post_id) {
54 $args = array();
55
56 if (isset($_GET['post_status'])) {
57 $post_status = sanitize_text_field(wp_unslash($_GET['post_status']));
58
59 if ($post_status === 'trash') {
60 $args['post_status'] = array('trash');
61 }
62 }
63
64 $feed = $this->feed_deserializer->get_feed($post_id, $args);
65 if (!$feed) {
66 return null;
67 }
68
69 $connection = json_decode($feed->post_content);
70
71 switch ($column_name) {
72 case 'ID':
73 echo $feed->ID;
74 break;
75 case 'grw_theme':
76 echo isset($connection->options->view_mode) ? self::$plugin_themes[$connection->options->view_mode] : 'List';
77 break;
78 }
79 }
80
81 public function change_post_row_actions($actions, $post) {
82 if (isset($actions) && $post->post_type === Post_Types::FEED_POST_TYPE) {
83 $changed_actions = array(
84 'post-id' => '<span class="grw-admin-column-action">ID: ' . $post->ID . '</span>',
85 );
86 $actions = $changed_actions + $actions;
87 }
88 return $actions;
89 }
90
91 public function hide_grw_feed_excerpt($excerpt, $post = null) {
92 return $post->post_type !== Post_Types::FEED_POST_TYPE ? $excerpt : '';
93 }
94 }
95