PluginProbe ʕ •ᴥ•ʔ
Admin Columns / 3.1.3
Admin Columns v3.1.3
7.0.19 2.3.5 2.4 2.4.1 2.4.10 2.4.2 2.4.3 2.4.4 2.4.5 2.4.6 2.4.7 2.4.8 2.4.9 2.5.2 2.5.3 2.5.4 2.5.5 2.5.6 2.5.6.1 2.5.6.2 2.5.6.3 2.5.6.4 3.0 3.0.1 3.0.2 3.0.3 3.0.5 3.0.7 3.1 3.1.1 3.1.10 3.1.2 3.1.3 3.1.5 3.2.3 3.2.7 3.3.1 3.4.1 3.4.6 3.4.8 4.0.1 4.0.3 4.1.6 4.2.2 4.2.5 4.3 4.3.2 4.4.1 4.4.4 4.4.5 4.5.5 4.6.1 4.7.18 4.7.19 4.7.20 4.7.7 7.0.13 7.0.14 7.0.16 trunk 1.0 1.1 1.1.3 1.2 1.2.1 1.3 1.3.1 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.5.1 1.4.6 1.4.6.1 1.4.6.2 1.4.6.3 1.4.6.4 1.4.7 1.4.8 1.4.9 2.0.0 2.0.1 2.0.2 2.0.3 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.2 2.2.1 2.2.1.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.5.1 2.2.6 2.2.6.1 2.2.6.2 2.2.6.3 2.2.6.4 2.2.7 2.2.8 2.2.8.1 2.2.9 2.3.1 2.3.2 2.3.3
codepress-admin-columns / classes / Plugin.php
codepress-admin-columns / classes Last commit date
Admin 8 years ago Column 8 years ago Form 8 years ago Helper 8 years ago ListScreen 8 years ago Meta 8 years ago Notice 8 years ago Plugin 8 years ago Relation 8 years ago Settings 8 years ago ThirdParty 8 years ago API.php 8 years ago Addon.php 8 years ago Admin.php 8 years ago Autoloader.php 8 years ago Collection.php 8 years ago Column.php 8 years ago Groups.php 8 years ago Helper.php 8 years ago ListScreen.php 8 years ago ListScreenPost.php 8 years ago ListScreenWP.php 8 years ago Plugin.php 8 years ago PluginInformation.php 8 years ago Preferences.php 8 years ago Relation.php 8 years ago TableScreen.php 8 years ago View.php 8 years ago ViewInterface.php 8 years ago
Plugin.php
128 lines
1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ) {
4 exit;
5 }
6
7 abstract class AC_Plugin extends AC_Addon {
8
9 /**
10 * Check if plugin is network activated
11 *
12 * @return bool
13 */
14 public function is_network_active() {
15 return is_plugin_active_for_network( $this->get_basename() );
16 }
17
18 /**
19 * Calls get_plugin_data() for this plugin
20 *
21 * @see get_plugin_data()
22 * @return array
23 */
24 protected function get_plugin_data() {
25 require_once ABSPATH . 'wp-admin/includes/plugin.php';
26
27 return get_plugin_data( $this->get_file(), false, false );
28 }
29
30 /**
31 * Return a plugin header from the plugin data
32 *
33 * @param $key
34 *
35 * @return false|string
36 */
37 protected function get_plugin_header( $key ) {
38 $data = $this->get_plugin_data();
39
40 if ( ! isset( $data[ $key ] ) ) {
41 return false;
42 }
43
44 return $data[ $key ];
45 }
46
47 /**
48 * Return the prefix that is used by this plugin
49 *
50 * @return string
51 */
52 abstract public function get_prefix();
53
54 /**
55 * Apply updates to the database
56 *
57 * @param null|string $updates_dir
58 */
59 public function install() {
60 if ( 0 === version_compare( $this->get_version(), $this->get_stored_version() ) ) {
61 return;
62 }
63
64 $updater = new AC_Plugin_Updater( $this );
65
66 if ( ! $updater->check_update_conditions() ) {
67 return;
68 }
69
70 $classes = AC()->autoloader()->get_class_names_from_dir( $this->get_plugin_dir() . 'classes/Plugin/Update', $this->get_prefix() );
71
72 foreach ( $classes as $class ) {
73 $updater->add_update( new $class( $this->get_stored_version() ) );
74 }
75
76 $updater->parse_updates();
77 }
78
79 /**
80 * @return string
81 */
82 public function get_version() {
83 return $this->get_plugin_header( 'Version' );
84 }
85
86 /**
87 * @return string
88 */
89 abstract protected function get_version_key();
90
91 /**
92 * @return string
93 */
94 public function get_stored_version() {
95 return get_option( $this->get_version_key() );
96 }
97
98 /**
99 * Update the stored version to match the (current) version
100 */
101 public function update_stored_version( $version = null ) {
102 if ( null === $version ) {
103 $version = $this->get_version();
104 }
105
106 return update_option( $this->get_version_key(), $version );
107 }
108
109 /**
110 * Check if the plugin was updated or is a new install
111 */
112 public function is_new_install() {
113 global $wpdb;
114
115 $sql = "
116 SELECT option_id
117 FROM {$wpdb->options}
118 WHERE option_name LIKE 'cpac_options_%'
119 LIMIT 1
120 ";
121
122 $results = $wpdb->get_results( $sql );
123
124 return empty( $results );
125 }
126
127 }
128