| @@ -4,18 +4,17 @@ | ||
| 4 | 4 | * Plugin URI: https://wordpress.org/plugins/wpgetapi/ |
| 5 | 5 | * Description: Connect to external API's and display the API data. |
| 6 | 6 | * Author: WPGetAPI |
| 7 | 7 | * Author URI: https://wpgetapi.com/ |
| 8 | - * Version: 2.2.10 | |
| 8 | + * Version: 1.4.6 | |
| 9 | 9 | * Text Domain: wpgetapi |
| 10 | + * Domain Path: /languages/ | |
| 10 | 11 | * License: GPL2 or later |
| 11 | - * | |
| 12 | + * | |
| 12 | 13 | */ |
| 13 | 14 | |
| 14 | 15 | // Exit if accessed directly. |
| 15 | -if ( ! defined( 'ABSPATH' ) ) { | |
| 16 | - exit; | |
| 17 | -} | |
| 16 | +if ( ! defined( 'ABSPATH' ) ) exit; | |
| 18 | 17 | |
| 19 | 18 | /** |
| 20 | 19 | * Main Class. |
| 21 | 20 | * |
| @@ -20,9 +19,9 @@ | ||
| 20 | 19 | * Main Class. |
| 21 | 20 | * |
| 22 | 21 | * @since 1.0.0 |
| 23 | 22 | */ |
| 24 | -final class WP_Get_API { | |
| 23 | +final class WpGetApi { | |
| 25 | 24 | |
| 26 | 25 | /** |
| 27 | 26 | * @var The one true instance |
| 28 | 27 | * @since 1.0.0 |
| @@ -28,9 +27,9 @@ | ||
| 28 | 27 | * @since 1.0.0 |
| 29 | 28 | */ |
| 30 | 29 | protected static $_instance = null; |
| 31 | 30 | |
| 32 | - public $version = '2.2.10'; | |
| 31 | + public $version = '1.4.6'; | |
| 33 | 32 | |
| 34 | 33 | /** |
| 35 | 34 | * Main Instance. |
| 36 | 35 | */ |
| @@ -60,9 +59,9 @@ | ||
| 60 | 59 | _doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'wpgetapi' ), '1.0.0' ); |
| 61 | 60 | } |
| 62 | 61 | |
| 63 | 62 | /** |
| 64 | - * | |
| 63 | + * | |
| 65 | 64 | * @since 1.0.0 |
| 66 | 65 | */ |
| 67 | 66 | public function __construct() { |
| 68 | 67 | $this->define_constants(); |
| @@ -67,9 +66,9 @@ | ||
| 67 | 66 | public function __construct() { |
| 68 | 67 | $this->define_constants(); |
| 69 | 68 | $this->hooks(); |
| 70 | 69 | $this->includes(); |
| 71 | - | |
| 70 | + | |
| 72 | 71 | do_action( 'wpgetapi_loaded' ); |
| 73 | 72 | } |
| 74 | 73 | |
| 75 | 74 | /** |
| @@ -76,14 +75,12 @@ | ||
| 76 | 75 | * Define Constants. |
| 77 | 76 | * @since 1.0.0 |
| 78 | 77 | */ |
| 79 | 78 | private function define_constants() { |
| 80 | - $this->define( 'WPGETAPIDIR', plugin_dir_path( __FILE__ ) ); | |
| 81 | - $this->define( 'WPGETAPIURL', plugin_dir_url( __FILE__ ) ); | |
| 79 | + $this->define( 'WPGETAPIDIR',plugin_dir_path( __FILE__ ) ); | |
| 80 | + $this->define( 'WPGETAPIURL',plugin_dir_url( __FILE__ ) ); | |
| 82 | 81 | $this->define( 'WPGETAPIBASENAME', plugin_basename( __FILE__ ) ); |
| 83 | 82 | $this->define( 'WPGETAPIVERSION', $this->version ); |
| 84 | - $this->define( 'WPGETAPILICENSEPAGE', 'wpgetapi_plugin_licenses' ); | |
| 85 | - $this->define( 'WPGETAPISTOREURL', 'https://wpgetapi.com' ); | |
| 86 | 83 | } |
| 87 | 84 | |
| 88 | 85 | /** |
| 89 | 86 | * Define hooks. |
| @@ -89,11 +86,13 @@ | ||
| 89 | 86 | * Define hooks. |
| 90 | 87 | * @since 1.4.2 |
| 91 | 88 | */ |
| 92 | 89 | private function hooks() { |
| 90 | + | |
| 93 | 91 | $plugin_file = WPGETAPIBASENAME; |
| 94 | 92 | add_filter( "plugin_action_links_{$plugin_file}", array( $this, 'plugin_action_links' ), 10, 4 ); |
| 95 | 93 | add_filter( 'plugin_row_meta', array( $this, 'filter_plugin_row_meta' ), 10, 4 ); |
| 94 | + | |
| 96 | 95 | } |
| 97 | 96 | |
| 98 | 97 | /** |
| 99 | 98 | * Define constant if not already set. |
| @@ -110,26 +109,20 @@ | ||
| 110 | 109 | * Include required files. |
| 111 | 110 | * @since 1.0.0 |
| 112 | 111 | */ |
| 113 | 112 | public function includes() { |
| 113 | + | |
| 114 | + require_once ( WPGETAPIDIR . '/lib/cmb2/init.php' ); | |
| 114 | 115 | |
| 115 | - if ( isset( $_GET['page'] ) && strpos( $_GET['page'], 'wpgetapi_' ) !== false ) { | |
| 116 | - require_once WPGETAPIDIR . '/lib/cmb2/init.php'; | |
| 117 | - } | |
| 116 | + include_once ( WPGETAPIDIR . 'includes/class-encryption.php' ); | |
| 117 | + include_once ( WPGETAPIDIR . 'includes/class-admin-options.php' ); | |
| 118 | + | |
| 119 | + include_once ( WPGETAPIDIR . 'includes/functions.php' ); | |
| 120 | + include_once ( WPGETAPIDIR . 'includes/class-enqueues.php' ); | |
| 121 | + include_once ( WPGETAPIDIR . 'includes/class-api.php' ); | |
| 118 | 122 | |
| 119 | - require_once WPGETAPIDIR . '/includes/block-editor/block-editor.php'; | |
| 120 | - | |
| 121 | - include_once WPGETAPIDIR . 'includes/class-wpgetapi-encryption.php'; | |
| 122 | - include_once WPGETAPIDIR . 'includes/class-wpgetapi-admin-options.php'; | |
| 123 | - | |
| 124 | - include_once WPGETAPIDIR . 'includes/functions.php'; | |
| 125 | - include_once WPGETAPIDIR . 'includes/class-wpgetapi-api-enqueues.php'; | |
| 126 | - include_once WPGETAPIDIR . 'includes/class-wpgetapi-api.php'; | |
| 127 | - | |
| 128 | - include_once WPGETAPIDIR . 'frontend/functions.php'; | |
| 129 | - include_once WPGETAPIDIR . 'includes/class-wpgetapi-license-handler.php'; | |
| 130 | - | |
| 131 | - include_once WPGETAPIDIR . 'includes/class-wpgetapi-notices.php'; | |
| 123 | + include_once ( WPGETAPIDIR . 'frontend/functions.php' ); | |
| 124 | + | |
| 132 | 125 | } |
| 133 | 126 | |
| 134 | 127 | /** |
| 135 | 128 | * Filters the array of row meta for each plugin in the Plugins list table. |
| @@ -137,9 +130,9 @@ | ||
| 137 | 130 | * @param array<int,string> $plugin_meta An array of the plugin row's meta data. |
| 138 | 131 | * @param string $plugin_file Path to the plugin file relative to the plugins directory. |
| 139 | 132 | * @return array<int,string> An array of the plugin row's meta data. |
| 140 | 133 | */ |
| 141 | - public function filter_plugin_row_meta( array $plugin_meta, $plugin_file ) { | |
| 134 | + function filter_plugin_row_meta( array $plugin_meta, $plugin_file ) { | |
| 142 | 135 | if ( 'wpgetapi/wpgetapi.php' !== $plugin_file ) { |
| 143 | 136 | return $plugin_meta; |
| 144 | 137 | } |
| 145 | 138 | |
| @@ -161,11 +154,11 @@ | ||
| 161 | 154 | * @param mixed[] $plugin_data An array of plugin data. |
| 162 | 155 | * @param string $context The plugin context. |
| 163 | 156 | * @return array<string,string> Array of action links. |
| 164 | 157 | */ |
| 165 | - public function plugin_action_links( $actions, $plugin_file, $plugin_data, $context ) { | |
| 158 | + function plugin_action_links( $actions, $plugin_file, $plugin_data, $context ) { | |
| 166 | 159 | $new = array( |
| 167 | - 'setup' => sprintf( | |
| 160 | + 'setup' => sprintf( | |
| 168 | 161 | '<a href="%s">%s</a>', |
| 169 | 162 | esc_url( admin_url( 'admin.php?page=wpgetapi_setup' ) ), |
| 170 | 163 | esc_html__( 'API Setup', 'wpgetapi' ) |
| 171 | 164 | ), |
| @@ -173,44 +166,15 @@ | ||
| 173 | 166 | |
| 174 | 167 | return array_merge( $new, $actions ); |
| 175 | 168 | } |
| 176 | 169 | |
| 177 | - /** | |
| 178 | - * Whether the current user can manage the WPGetAPI plugin admin | |
| 179 | - * | |
| 180 | - * @return Boolean True if the current user can manage the WPGetAPI plugin admin otheriwise false | |
| 181 | - */ | |
| 182 | - public function current_user_can_manage() { | |
| 183 | - return current_user_can( 'manage_options' ); | |
| 184 | - } | |
| 185 | 170 | |
| 186 | - /** | |
| 187 | - * Whether the current user can manage the WPGetAPI plugin admin | |
| 188 | - * | |
| 189 | - * @return bool | |
| 190 | - */ | |
| 191 | - public function is_wpgetapi_admin_page() { | |
| 192 | - $is_wpgetapi_admin_page = false; | |
| 193 | - if ( $this->current_user_can_manage() && ( isset( $_GET['page'] ) && strpos( $_GET['page'], 'wpgetapi_' ) !== false ) ) { | |
| 194 | - $is_wpgetapi_admin_page = true; | |
| 195 | - } | |
| 171 | +} | |
| 196 | 172 | |
| 197 | - return $is_wpgetapi_admin_page; | |
| 198 | - } | |
| 199 | 173 | |
| 200 | - /** | |
| 201 | - * Check whether any premium addon plugin is active or not. | |
| 202 | - * | |
| 203 | - * @return Boolean True if any premium addon plugin is active otherwise false. | |
| 204 | - */ | |
| 205 | - public function is_any_premium_addon_plugin_active() { | |
| 206 | - return is_plugin_active( 'wpgetapi-extras/wpgetapi-extras.php' ) || is_plugin_active( 'wpgetapi-api-to-posts/wpgetapi-api-to-posts.php' ) || is_plugin_active( 'wpgetapi-oauth/wpgetapi-oauth.php' ); | |
| 207 | - } | |
| 208 | -} | |
| 209 | - | |
| 210 | 174 | /** |
| 211 | 175 | * Run the plugin. |
| 212 | 176 | */ |
| 213 | -function wp_get_api() { | |
| 214 | - return WP_Get_API::instance(); | |
| 177 | +function WpGetApi() { | |
| 178 | + return WpGetApi::instance(); | |
| 215 | 179 | } |
| 216 | -wp_get_api(); | |
| 180 | +WpGetApi(); | |