PluginProbe ʕ •ᴥ•ʔ
The Post Grid – Shortcode, Gutenberg Blocks and Elementor Addon for Post Grid / trunk
The Post Grid – Shortcode, Gutenberg Blocks and Elementor Addon for Post Grid vtrunk
7.9.3 7.9.2 trunk 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.0.5 4.1.0 4.1.1 4.1.2 4.1.3 4.1.4 4.1.5 4.2.0 4.2.1 4.2.2 4.2.3 5.0.0 5.0.1 5.0.2 5.0.3 5.0.4 5.0.5 6.0.0 7.0.0 7.0.1 7.0.2 7.1.0 7.2.0 7.2.1 7.2.10 7.2.11 7.2.2 7.2.3 7.2.4 7.2.5 7.2.6 7.2.7 7.2.8 7.2.9 7.3.0 7.3.1 7.4.0 7.4.1 7.4.2 7.4.3 7.5.0 7.6.0 7.6.1 7.7.0 7.7.1 7.7.10 7.7.11 7.7.12 7.7.13 7.7.14 7.7.15 7.7.16 7.7.17 7.7.18 7.7.19 7.7.2 7.7.20 7.7.21 7.7.22 7.7.3 7.7.4 7.7.5 7.7.6 7.7.7 7.7.8 7.7.9 7.8.0 7.8.1 7.8.2 7.8.3 7.8.4 7.8.5 7.8.6 7.8.7 7.8.8 7.8.9 7.9.0 7.9.1
the-post-grid / app / Controllers / Admin / UpgradeController.php
the-post-grid / app / Controllers / Admin Last commit date
Notice 3 months ago AdminAjaxController.php 1 year ago MetaController.php 1 year ago NoticeController.php 8 months ago PostTypeController.php 3 months ago SettingsController.php 1 year ago SetupWizardController.php 1 month ago UpgradeController.php 2 years ago
UpgradeController.php
98 lines
1 <?php
2 /**
3 * Upgrade Controller class.
4 *
5 * @package RT_TPG
6 */
7
8 namespace RT\ThePostGrid\Controllers\Admin;
9
10 // Do not allow directly accessing this file.
11 if ( ! defined( 'ABSPATH' ) ) {
12 exit( 'This script cannot be accessed directly.' );
13 }
14
15 /**
16 * Upgrade Controller class.
17 */
18 class UpgradeController {
19 /**
20 * Version compare
21 *
22 * @var string
23 */
24 public static $compare_version;
25
26 /**
27 * Class constructor
28 */
29 public function __construct() {
30 self::$compare_version = '6.0.0';
31
32 if ( ! self::check_plugin_version() ) {
33 add_filter( 'plugin_row_meta', [ $this, 'show_update_notification' ], 10, 2 );
34 $this->version_notice();
35 }
36 }
37
38 /**
39 * Plugin version check
40 *
41 * @return bool
42 */
43 public static function check_plugin_version() {
44
45 if ( defined( 'RT_TPG_PRO_VERSION' ) && version_compare( RT_TPG_PRO_VERSION, self::$compare_version, '<' ) ) {
46 return false;
47 }
48
49 return true;
50 }
51
52 /**
53 * Notice
54 *
55 * @return void
56 */
57 public function version_notice() {
58 if ( class_exists( 'RtTpgPro' ) || class_exists( 'rtTPGP' ) ) {
59 add_action(
60 'admin_notices',
61 function () {
62 $class = 'notice notice-error';
63 $text = esc_html__( 'The Post Grid Pro', 'the-post-grid' );
64 $link_pro = '//www.radiustheme.com/downloads/the-post-grid-pro-for-wordpress/';
65
66 if ( class_exists( 'RtTpgPro' ) ) {
67 printf(
68 '<div class="%1$s"><p><a target="_blank" href="%2$s"><strong>The Post Grid Pro</strong></a> is not working properly, You need to update <strong>%3$s</strong> version to %4$s or more to get the pro features.</p></div>',
69 esc_attr( $class ),
70 esc_url( $link_pro ),
71 esc_html( $text ),
72 esc_html( self::$compare_version )
73 );
74 }
75 }
76 );
77 }
78 }
79
80 /**
81 * Notification
82 *
83 * @param array $links Link.
84 * @param string $file File.
85 *
86 * @return array
87 */
88 public function show_update_notification( $links, $file ) {
89 if ( $file == 'the-post-grid-pro/the-post-grid-pro.php' ) {
90 $row_meta['tpg_update'] = '<span style="color: red">The Plugin is not compatible with the post grid free. Please update the plugin to ' . self::$compare_version . ' or more otherwise it will not activate.</span>';
91
92 return array_merge( $links, $row_meta );
93 }
94
95 return (array) $links;
96 }
97 }
98