PluginProbe ʕ •ᴥ•ʔ
Shortcodes and extra features for Phlox theme / 2.5.8
Shortcodes and extra features for Phlox theme v2.5.8
2.17.21 2.17.20 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.6 1.0.9 1.1.0 1.3.0 1.3.1 1.3.10 1.3.14 1.3.2 1.3.3 1.3.6 1.4.0 1.4.1 1.4.2 1.5.0 1.5.2 1.6.0 1.6.2 1.6.4 1.7.0 1.7.2 2.10.0 2.10.1 2.10.3 2.10.5 2.10.7 2.10.8 2.10.9 2.11.0 2.11.1 2.11.2 2.12.0 2.14.0 2.15.0 2.15.2 2.15.4 2.15.5 2.15.6 2.15.7 2.15.8 2.15.9 2.16.0 2.16.1 2.16.2 2.16.3 2.16.4 2.17.0 2.17.1 2.17.12 2.17.13 2.17.14 2.17.15 2.17.16 2.17.2 2.17.3 2.17.4 2.17.5 2.17.6 2.17.8 2.17.9 2.4.12 2.4.13 2.4.14 2.4.16 2.4.18 2.4.19 2.4.9 2.5.0 2.5.1 2.5.10 2.5.11 2.5.12 2.5.13 2.5.14 2.5.15 2.5.16 2.5.17 2.5.19 2.5.2 2.5.20 2.5.3 2.5.7 2.5.8 2.5.9 2.6.0 2.6.1 2.6.10 2.6.12 2.6.13 2.6.14 2.6.15 2.6.16 2.6.17 2.6.19 2.6.2 2.6.20 2.6.4 2.6.5 2.6.7 2.7.0 2.7.1 2.7.10 2.7.11 2.7.12 2.7.13 2.7.14 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 2.7.8 2.7.9 2.8.0 2.8.1 2.8.2 2.8.3 2.8.4 2.8.5 2.8.6 2.8.7 2.8.9 2.9.0 2.9.12 2.9.14 2.9.15 2.9.16 2.9.17 2.9.18 2.9.19 2.9.2 2.9.20 2.9.21 2.9.22 2.9.3 2.9.4 2.9.5 2.9.6 2.9.7 2.9.8
auxin-elements / admin / includes / classes / class-auxels-plugin-check-update.php
auxin-elements / admin / includes / classes Last commit date
class-auxels-plugin-check-update.php 6 years ago class-auxin-dashboard-notice.php 7 years ago class-auxin-license-activation.php 7 years ago class-auxin-notices.php 6 years ago class-auxin-upgrader-ajax-handlers.php 7 years ago class-auxin-upgrader-http-api.php 6 years ago class-auxin-upgrader-plugin.php 7 years ago class-auxin-upgrader-prepare.php 6 years ago class-auxin-upgrader-theme.php 7 years ago
class-auxels-plugin-check-update.php
154 lines
1 <?php
2 /**
3 *
4 *
5 * @package Auxin
6 * @license LICENSE.txt
7 * @author averta
8 * @link http://phlox.pro/
9 * @copyright (c) 2010-2020 averta
10 */
11
12 // no direct access allowed
13 if ( ! defined('ABSPATH') ) {
14 die();
15 }
16
17
18 class AUXELS_Plugin_Check_Update {
19 /**
20 * The plugin current version
21 * @var string
22 */
23 public $current_version;
24
25 /**
26 * The plugin remote update path
27 * @var string
28 */
29 public $update_path;
30
31 /**
32 * Plugin Slug (plugin_directory/plugin_file.php)
33 * @var string
34 */
35 public $plugin_slug;
36
37 /**
38 * Plugin name (plugin_file)
39 * @var string
40 */
41 public $slug;
42
43 /**
44 * The item name while requesting to update api
45 * @var string
46 */
47 public $request_name;
48
49 /**
50 * The item ID in marketplace
51 * @var string
52 */
53 public $plugin_id;
54
55
56 /**
57 * The item name while requesting to update api
58 * @var string
59 */
60 public $plugin_file_path;
61
62 /**
63 * The item name while requesting to update api
64 * @var string
65 */
66 public $banners;
67
68
69 /**
70 * Initialize a new instance of the WordPress Auto-Update class
71 * @param string $current_version
72 * @param string $update_path
73 * @param string $plugin_slug
74 * @param string $slug
75 */
76 function __construct( $current_version, $update_path, $plugin_slug, $slug, $item_request_name = '' ) {
77 // Set the class public variables
78 $this->current_version = $current_version;
79 $this->update_path = $update_path;
80 $this->plugin_slug = $plugin_slug;
81 $this->slug = $slug;
82
83 $this->request_name = empty( $item_request_name ) ? $this->slug : $item_request_name;
84
85 // define the alternative API for checking for updates
86 add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update') );
87 }
88
89
90 /**
91 * Check the plugin version on update plugin transient expired
92 *
93 * @param $transient
94 * @return object $ transient
95 */
96 public function check_update( $transient ) {
97 // Get the remote version
98 $remote_version = $this->get_remote_version();
99
100 return $transient;
101 }
102
103
104 /**
105 * Return the remote version
106 * @return string $remote_version
107 */
108 public function get_remote_version() {
109 global $wp_version;
110
111 $theme_data = wp_get_theme();
112 if( is_child_theme() ) {
113 $theme_data = wp_get_theme( $theme_data->template );
114 }
115
116 if ( ! function_exists( 'get_plugins' ) ) {
117 require_once ABSPATH . 'wp-admin/includes/plugin.php';
118 }
119 $all_plugins = get_plugins();
120 if( ! isset( $all_plugins[ $this->plugin_slug ] ) || empty( $all_plugins[ $this->plugin_slug ] ) ){
121 return;
122 }
123
124 $this_plugin = $all_plugins[ $this->plugin_slug ];
125 if( ! is_array( $this_plugin ) ){
126 $this_plugin = array();
127 }
128 $this_plugin['ID'] = $this->plugin_id;
129 $this_plugin['Name'] = defined('THEME_NAME') ? THEME_NAME : 'Phlox';
130 $this_plugin['Theme'] = $theme_data->Name;
131 $this_plugin['Version'] = defined('THEME_VERSION') ? THEME_VERSION : $theme_data->Version;
132 $this_plugin['Slug'] = defined('THEME_ID') ? THEME_ID : $this->slug;
133 $this_plugin['Activated'] = 0;
134
135 $request = wp_remote_post( $this->update_path, array(
136 'user-agent' => 'WordPress/'.$wp_version.'; '. get_site_url(),
137 'timeout' => ( ( defined('DOING_CRON') && DOING_CRON ) ? 30 : 3),
138 'body' => array(
139 'cat' => 'version-check',
140 'action' => 'final',
141 'type' => 'plugin',
142 'item-name' => $this->request_name,
143 'item-info' => $this_plugin
144 )
145 )
146 );
147
148 if ( ! is_wp_error( $request ) || wp_remote_retrieve_response_code( $request ) === 200 ) {
149 return $request['body'];
150 }
151 return false;
152 }
153 }
154