@@ -31,30 +31,30 @@ discard block |
||
| 31 | 31 | * CHECK FOR OLD COMPATIBILITY PACKS AND DISABLE IF THEY ARE ACTIVE |
| 32 | 32 | */ |
| 33 | 33 | if (is_admin()) {
|
| 34 | - /** |
|
| 35 | - * Include WordPress core file so we can use core functions to check for active plugins. |
|
| 36 | - */ |
|
| 37 | - include_once(ABSPATH . 'wp-admin/includes/plugin.php'); |
|
| 34 | + /** |
|
| 35 | + * Include WordPress core file so we can use core functions to check for active plugins. |
|
| 36 | + */ |
|
| 37 | + include_once(ABSPATH . 'wp-admin/includes/plugin.php'); |
|
| 38 | 38 | |
| 39 | - if (is_plugin_active('geodirectory-genesis-compatibility-pack/geodir_genesis_compatibility.php')) {
|
|
| 40 | - deactivate_plugins('geodirectory-genesis-compatibility-pack/geodir_genesis_compatibility.php');
|
|
| 41 | - } |
|
| 39 | + if (is_plugin_active('geodirectory-genesis-compatibility-pack/geodir_genesis_compatibility.php')) {
|
|
| 40 | + deactivate_plugins('geodirectory-genesis-compatibility-pack/geodir_genesis_compatibility.php');
|
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | - if (is_plugin_active('geodirectory-x-theme-compatibility-pack/geodir_x_compatibility.php')) {
|
|
| 44 | - deactivate_plugins('geodirectory-x-theme-compatibility-pack/geodir_x_compatibility.php');
|
|
| 45 | - } |
|
| 43 | + if (is_plugin_active('geodirectory-x-theme-compatibility-pack/geodir_x_compatibility.php')) {
|
|
| 44 | + deactivate_plugins('geodirectory-x-theme-compatibility-pack/geodir_x_compatibility.php');
|
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - if (is_plugin_active('geodirectory-enfold-theme-compatibility-pack/geodir_enfold_compatibility.php')) {
|
|
| 48 | - deactivate_plugins('geodirectory-enfold-theme-compatibility-pack/geodir_enfold_compatibility.php');
|
|
| 49 | - } |
|
| 47 | + if (is_plugin_active('geodirectory-enfold-theme-compatibility-pack/geodir_enfold_compatibility.php')) {
|
|
| 48 | + deactivate_plugins('geodirectory-enfold-theme-compatibility-pack/geodir_enfold_compatibility.php');
|
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | - if (is_plugin_active('geodir_avada_compatibility/geodir_avada_compatibility.php')) {
|
|
| 52 | - deactivate_plugins('geodir_avada_compatibility/geodir_avada_compatibility.php');
|
|
| 53 | - } |
|
| 51 | + if (is_plugin_active('geodir_avada_compatibility/geodir_avada_compatibility.php')) {
|
|
| 52 | + deactivate_plugins('geodir_avada_compatibility/geodir_avada_compatibility.php');
|
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | - if (is_plugin_active('geodir_compat_pack_divi/geodir_divi_compatibility.php')) {
|
|
| 56 | - deactivate_plugins('geodir_compat_pack_divi/geodir_divi_compatibility.php');
|
|
| 57 | - } |
|
| 55 | + if (is_plugin_active('geodir_compat_pack_divi/geodir_divi_compatibility.php')) {
|
|
| 56 | + deactivate_plugins('geodir_compat_pack_divi/geodir_divi_compatibility.php');
|
|
| 57 | + } |
|
| 58 | 58 | |
| 59 | 59 | } |
| 60 | 60 | |
@@ -130,19 +130,19 @@ discard block |
||
| 130 | 130 | * @package GeoDirectory |
| 131 | 131 | */ |
| 132 | 132 | function geodir_error_log($log){
|
| 133 | - /* |
|
| 133 | + /* |
|
| 134 | 134 | * A filter to override the WP_DEBUG setting for function geodir_error_log(). |
| 135 | 135 | * |
| 136 | 136 | * @since 1.5.7 |
| 137 | 137 | */ |
| 138 | - $should_log = apply_filters( 'geodir_log_errors', WP_DEBUG); |
|
| 139 | - if ( true === $should_log ) {
|
|
| 140 | - if ( is_array( $log ) || is_object( $log ) ) {
|
|
| 141 | - error_log( print_r( $log, true ) ); |
|
| 142 | - } else {
|
|
| 143 | - error_log( $log ); |
|
| 144 | - } |
|
| 145 | - } |
|
| 138 | + $should_log = apply_filters( 'geodir_log_errors', WP_DEBUG); |
|
| 139 | + if ( true === $should_log ) {
|
|
| 140 | + if ( is_array( $log ) || is_object( $log ) ) {
|
|
| 141 | + error_log( print_r( $log, true ) ); |
|
| 142 | + } else {
|
|
| 143 | + error_log( $log ); |
|
| 144 | + } |
|
| 145 | + } |
|
| 146 | 146 | } |
| 147 | 147 | /** |
| 148 | 148 | * Include all plugin functions. |
@@ -181,72 +181,72 @@ discard block |
||
| 181 | 181 | */ |
| 182 | 182 | if (is_admin() || defined( 'GD_TESTING_MODE' ) || ( defined( 'WP_CLI' ) && WP_CLI )) {
|
| 183 | 183 | |
| 184 | - /** |
|
| 185 | - * Include functions used in admin area only. |
|
| 186 | - * |
|
| 187 | - * @since 1.0.0 |
|
| 188 | - */ |
|
| 189 | - require_once('geodirectory-admin/admin_functions.php');
|
|
| 190 | - /** |
|
| 191 | - * Most actions/hooks used in admin area only are called from here. |
|
| 192 | - * |
|
| 193 | - * @since 1.6.11 |
|
| 194 | - */ |
|
| 195 | - require_once('geodirectory-admin/admin_dummy_data_functions.php');
|
|
| 196 | - /** |
|
| 197 | - * Most actions/hooks used in admin area only are called from here. |
|
| 198 | - * |
|
| 199 | - * @since 1.0.0 |
|
| 200 | - */ |
|
| 201 | - require_once('geodirectory-admin/admin_hooks_actions.php');
|
|
| 202 | - /** |
|
| 203 | - * Most admin JS and CSS is called from here. |
|
| 204 | - * |
|
| 205 | - * @since 1.0.0 |
|
| 206 | - */ |
|
| 207 | - require_once('geodirectory-admin/admin_template_tags.php');
|
|
| 208 | - /** |
|
| 209 | - * Include Google Analytics Class. |
|
| 210 | - * |
|
| 211 | - * @since 1.6.11 |
|
| 212 | - */ |
|
| 213 | - require_once('geodirectory-admin/class.analytics.stats.php');
|
|
| 214 | - /** |
|
| 215 | - * Include any functions needed for upgrades. |
|
| 216 | - * |
|
| 217 | - * @since 1.0.0 |
|
| 218 | - */ |
|
| 219 | - require_once(geodir_plugin_path() . '/upgrade.php'); |
|
| 220 | - if (get_option('geodir_installed') != 1) {
|
|
| 221 | - /** |
|
| 222 | - * Define language constants, here as they are not loaded yet. |
|
| 223 | - * |
|
| 224 | - * @since 1.0.0 |
|
| 225 | - */ |
|
| 226 | - require_once(geodir_plugin_path() . '/language.php'); |
|
| 227 | - /** |
|
| 228 | - * Include the plugin install file that sets up the databases and any options on first run. |
|
| 229 | - * |
|
| 230 | - * @since 1.0.0 |
|
| 231 | - */ |
|
| 232 | - require_once('geodirectory-admin/admin_install.php');
|
|
| 233 | - register_activation_hook(__FILE__, 'geodir_activation'); |
|
| 234 | - } |
|
| 235 | - register_deactivation_hook(__FILE__, 'geodir_deactivation'); |
|
| 236 | - |
|
| 237 | - /* |
|
| 184 | + /** |
|
| 185 | + * Include functions used in admin area only. |
|
| 186 | + * |
|
| 187 | + * @since 1.0.0 |
|
| 188 | + */ |
|
| 189 | + require_once('geodirectory-admin/admin_functions.php');
|
|
| 190 | + /** |
|
| 191 | + * Most actions/hooks used in admin area only are called from here. |
|
| 192 | + * |
|
| 193 | + * @since 1.6.11 |
|
| 194 | + */ |
|
| 195 | + require_once('geodirectory-admin/admin_dummy_data_functions.php');
|
|
| 196 | + /** |
|
| 197 | + * Most actions/hooks used in admin area only are called from here. |
|
| 198 | + * |
|
| 199 | + * @since 1.0.0 |
|
| 200 | + */ |
|
| 201 | + require_once('geodirectory-admin/admin_hooks_actions.php');
|
|
| 202 | + /** |
|
| 203 | + * Most admin JS and CSS is called from here. |
|
| 204 | + * |
|
| 205 | + * @since 1.0.0 |
|
| 206 | + */ |
|
| 207 | + require_once('geodirectory-admin/admin_template_tags.php');
|
|
| 208 | + /** |
|
| 209 | + * Include Google Analytics Class. |
|
| 210 | + * |
|
| 211 | + * @since 1.6.11 |
|
| 212 | + */ |
|
| 213 | + require_once('geodirectory-admin/class.analytics.stats.php');
|
|
| 214 | + /** |
|
| 215 | + * Include any functions needed for upgrades. |
|
| 216 | + * |
|
| 217 | + * @since 1.0.0 |
|
| 218 | + */ |
|
| 219 | + require_once(geodir_plugin_path() . '/upgrade.php'); |
|
| 220 | + if (get_option('geodir_installed') != 1) {
|
|
| 221 | + /** |
|
| 222 | + * Define language constants, here as they are not loaded yet. |
|
| 223 | + * |
|
| 224 | + * @since 1.0.0 |
|
| 225 | + */ |
|
| 226 | + require_once(geodir_plugin_path() . '/language.php'); |
|
| 227 | + /** |
|
| 228 | + * Include the plugin install file that sets up the databases and any options on first run. |
|
| 229 | + * |
|
| 230 | + * @since 1.0.0 |
|
| 231 | + */ |
|
| 232 | + require_once('geodirectory-admin/admin_install.php');
|
|
| 233 | + register_activation_hook(__FILE__, 'geodir_activation'); |
|
| 234 | + } |
|
| 235 | + register_deactivation_hook(__FILE__, 'geodir_deactivation'); |
|
| 236 | + |
|
| 237 | + /* |
|
| 238 | 238 | * Show a upgrade warning message if applicable. |
| 239 | 239 | * |
| 240 | 240 | * @since 1.5.6 |
| 241 | 241 | */ |
| 242 | - global $pagenow; |
|
| 243 | - if ( 'plugins.php' === $pagenow ) |
|
| 244 | - {
|
|
| 245 | - // Better update message |
|
| 246 | - $file = basename( __FILE__ ); |
|
| 247 | - $folder = basename( dirname( __FILE__ ) ); |
|
| 248 | - $hook = "in_plugin_update_message-{$folder}/{$file}";
|
|
| 249 | - add_action( $hook, 'geodire_admin_upgrade_notice', 20, 2 ); |
|
| 250 | - } |
|
| 242 | + global $pagenow; |
|
| 243 | + if ( 'plugins.php' === $pagenow ) |
|
| 244 | + {
|
|
| 245 | + // Better update message |
|
| 246 | + $file = basename( __FILE__ ); |
|
| 247 | + $folder = basename( dirname( __FILE__ ) ); |
|
| 248 | + $hook = "in_plugin_update_message-{$folder}/{$file}";
|
|
| 249 | + add_action( $hook, 'geodire_admin_upgrade_notice', 20, 2 ); |
|
| 250 | + } |
|
| 251 | 251 | |
| 252 | 252 | } |
| 253 | 253 | \ No newline at end of file |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | /** |
| 35 | 35 | * Include WordPress core file so we can use core functions to check for active plugins. |
| 36 | 36 | */ |
| 37 | - include_once(ABSPATH . 'wp-admin/includes/plugin.php'); |
|
| 37 | + include_once(ABSPATH.'wp-admin/includes/plugin.php'); |
|
| 38 | 38 | |
| 39 | 39 | if (is_plugin_active('geodirectory-genesis-compatibility-pack/geodir_genesis_compatibility.php')) {
|
| 40 | 40 | deactivate_plugins('geodirectory-genesis-compatibility-pack/geodir_genesis_compatibility.php');
|
@@ -68,8 +68,8 @@ discard block |
||
| 68 | 68 | * @global string $plugin_file_name Base file name. 'geodirectory/geodirectory.php'. |
| 69 | 69 | */ |
| 70 | 70 | global $wpdb, $plugin_prefix, $geodir_addon_list, $plugin_file_name; |
| 71 | -$plugin_prefix = $wpdb->prefix . 'geodir_'; |
|
| 72 | -$plugin_file_name = basename(plugin_dir_path(__FILE__)) . '/' . basename(__FILE__); |
|
| 71 | +$plugin_prefix = $wpdb->prefix.'geodir_'; |
|
| 72 | +$plugin_file_name = basename(plugin_dir_path(__FILE__)).'/'.basename(__FILE__); |
|
| 73 | 73 | |
| 74 | 74 | /* |
| 75 | 75 | * This will store the cached post custom fields per package for each page load so not to run for each listing. |
@@ -84,24 +84,24 @@ discard block |
||
| 84 | 84 | /** |
| 85 | 85 | * Define constants |
| 86 | 86 | */ |
| 87 | -if(!defined('GEODIRECTORY_PLUGIN_DIR')) define('GEODIRECTORY_PLUGIN_DIR', plugin_dir_path( __FILE__ ));
|
|
| 87 | +if (!defined('GEODIRECTORY_PLUGIN_DIR')) define('GEODIRECTORY_PLUGIN_DIR', plugin_dir_path(__FILE__));
|
|
| 88 | 88 | |
| 89 | 89 | /* |
| 90 | 90 | * Declare database table names. All since version 1.0.0 |
| 91 | 91 | */ |
| 92 | 92 | |
| 93 | 93 | /** Define the database name for the countries table. */ |
| 94 | -if (!defined('GEODIR_COUNTRIES_TABLE')) define('GEODIR_COUNTRIES_TABLE', $plugin_prefix . 'countries');
|
|
| 94 | +if (!defined('GEODIR_COUNTRIES_TABLE')) define('GEODIR_COUNTRIES_TABLE', $plugin_prefix.'countries');
|
|
| 95 | 95 | /** Define the database name for the custom fields table. */ |
| 96 | -if (!defined('GEODIR_CUSTOM_FIELDS_TABLE')) define('GEODIR_CUSTOM_FIELDS_TABLE', $plugin_prefix . 'custom_fields');
|
|
| 96 | +if (!defined('GEODIR_CUSTOM_FIELDS_TABLE')) define('GEODIR_CUSTOM_FIELDS_TABLE', $plugin_prefix.'custom_fields');
|
|
| 97 | 97 | /** Define the database name for the icons table. */ |
| 98 | -if (!defined('GEODIR_ICON_TABLE')) define('GEODIR_ICON_TABLE', $plugin_prefix . 'post_icon');
|
|
| 98 | +if (!defined('GEODIR_ICON_TABLE')) define('GEODIR_ICON_TABLE', $plugin_prefix.'post_icon');
|
|
| 99 | 99 | /** Define the database name for the attachments table. */ |
| 100 | -if (!defined('GEODIR_ATTACHMENT_TABLE')) define('GEODIR_ATTACHMENT_TABLE', $plugin_prefix . 'attachments');
|
|
| 100 | +if (!defined('GEODIR_ATTACHMENT_TABLE')) define('GEODIR_ATTACHMENT_TABLE', $plugin_prefix.'attachments');
|
|
| 101 | 101 | /** Define the database name for the review table. */ |
| 102 | -if (!defined('GEODIR_REVIEW_TABLE')) define('GEODIR_REVIEW_TABLE', $plugin_prefix . 'post_review');
|
|
| 102 | +if (!defined('GEODIR_REVIEW_TABLE')) define('GEODIR_REVIEW_TABLE', $plugin_prefix.'post_review');
|
|
| 103 | 103 | /** Define the database name for the custom sort fields table. */ |
| 104 | -if (!defined('GEODIR_CUSTOM_SORT_FIELDS_TABLE')) define('GEODIR_CUSTOM_SORT_FIELDS_TABLE', $plugin_prefix . 'custom_sort_fields');
|
|
| 104 | +if (!defined('GEODIR_CUSTOM_SORT_FIELDS_TABLE')) define('GEODIR_CUSTOM_SORT_FIELDS_TABLE', $plugin_prefix.'custom_sort_fields');
|
|
| 105 | 105 | |
| 106 | 106 | /* |
| 107 | 107 | * Define our Google Analytic app settings |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | if (!defined('GEODIR_GA_CLIENTID')) define('GEODIR_GA_CLIENTID', '687912069872-sdpsjssrdt7t3ao1dnv1ib71hkckbt5s.apps.googleusercontent.com');
|
| 110 | 110 | if (!defined('GEODIR_GA_CLIENTSECRET')) define('GEODIR_GA_CLIENTSECRET', 'yBVkDpqJ1B9nAETHy738Zn8C'); //don't worry - this don't need to be secret in our case
|
| 111 | 111 | if (!defined('GEODIR_GA_REDIRECT')) define('GEODIR_GA_REDIRECT', 'urn:ietf:wg:oauth:2.0:oob');
|
| 112 | -if (!defined('GEODIR_GA_SCOPE')) define('GEODIR_GA_SCOPE', 'https://www.googleapis.com/auth/analytics');//.readonly
|
|
| 112 | +if (!defined('GEODIR_GA_SCOPE')) define('GEODIR_GA_SCOPE', 'https://www.googleapis.com/auth/analytics'); //.readonly
|
|
| 113 | 113 | |
| 114 | 114 | |
| 115 | 115 | /* |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | if (!defined('GEODIRECTORY_TEXTDOMAIN')) define('GEODIRECTORY_TEXTDOMAIN', 'geodirectory');
|
| 119 | 119 | |
| 120 | 120 | // Load geodirectory plugin textdomain. |
| 121 | -add_action( 'init', 'geodir_load_textdomain' ); |
|
| 121 | +add_action('init', 'geodir_load_textdomain');
|
|
| 122 | 122 | |
| 123 | 123 | /* |
| 124 | 124 | * A function to log GD errors no matter the type given. |
@@ -129,18 +129,18 @@ discard block |
||
| 129 | 129 | * @param mixed $log The thing that should be logged. |
| 130 | 130 | * @package GeoDirectory |
| 131 | 131 | */ |
| 132 | -function geodir_error_log($log){
|
|
| 132 | +function geodir_error_log($log) {
|
|
| 133 | 133 | /* |
| 134 | 134 | * A filter to override the WP_DEBUG setting for function geodir_error_log(). |
| 135 | 135 | * |
| 136 | 136 | * @since 1.5.7 |
| 137 | 137 | */ |
| 138 | - $should_log = apply_filters( 'geodir_log_errors', WP_DEBUG); |
|
| 139 | - if ( true === $should_log ) {
|
|
| 140 | - if ( is_array( $log ) || is_object( $log ) ) {
|
|
| 141 | - error_log( print_r( $log, true ) ); |
|
| 138 | + $should_log = apply_filters('geodir_log_errors', WP_DEBUG);
|
|
| 139 | + if (true === $should_log) {
|
|
| 140 | + if (is_array($log) || is_object($log)) {
|
|
| 141 | + error_log(print_r($log, true)); |
|
| 142 | 142 | } else {
|
| 143 | - error_log( $log ); |
|
| 143 | + error_log($log); |
|
| 144 | 144 | } |
| 145 | 145 | } |
| 146 | 146 | } |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | /* |
| 180 | 180 | * Admin init + activation hooks |
| 181 | 181 | */ |
| 182 | -if (is_admin() || defined( 'GD_TESTING_MODE' ) || ( defined( 'WP_CLI' ) && WP_CLI )) {
|
|
| 182 | +if (is_admin() || defined('GD_TESTING_MODE') || (defined('WP_CLI') && WP_CLI)) {
|
|
| 183 | 183 | |
| 184 | 184 | /** |
| 185 | 185 | * Include functions used in admin area only. |
@@ -216,14 +216,14 @@ discard block |
||
| 216 | 216 | * |
| 217 | 217 | * @since 1.0.0 |
| 218 | 218 | */ |
| 219 | - require_once(geodir_plugin_path() . '/upgrade.php'); |
|
| 219 | + require_once(geodir_plugin_path().'/upgrade.php'); |
|
| 220 | 220 | if (get_option('geodir_installed') != 1) {
|
| 221 | 221 | /** |
| 222 | 222 | * Define language constants, here as they are not loaded yet. |
| 223 | 223 | * |
| 224 | 224 | * @since 1.0.0 |
| 225 | 225 | */ |
| 226 | - require_once(geodir_plugin_path() . '/language.php'); |
|
| 226 | + require_once(geodir_plugin_path().'/language.php'); |
|
| 227 | 227 | /** |
| 228 | 228 | * Include the plugin install file that sets up the databases and any options on first run. |
| 229 | 229 | * |
@@ -240,13 +240,13 @@ discard block |
||
| 240 | 240 | * @since 1.5.6 |
| 241 | 241 | */ |
| 242 | 242 | global $pagenow; |
| 243 | - if ( 'plugins.php' === $pagenow ) |
|
| 243 | + if ('plugins.php' === $pagenow)
|
|
| 244 | 244 | {
|
| 245 | 245 | // Better update message |
| 246 | - $file = basename( __FILE__ ); |
|
| 247 | - $folder = basename( dirname( __FILE__ ) ); |
|
| 246 | + $file = basename(__FILE__); |
|
| 247 | + $folder = basename(dirname(__FILE__)); |
|
| 248 | 248 | $hook = "in_plugin_update_message-{$folder}/{$file}";
|
| 249 | - add_action( $hook, 'geodire_admin_upgrade_notice', 20, 2 ); |
|
| 249 | + add_action($hook, 'geodire_admin_upgrade_notice', 20, 2); |
|
| 250 | 250 | } |
| 251 | 251 | |
| 252 | 252 | } |
| 253 | 253 | \ No newline at end of file |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 2 | +if (!defined('ABSPATH')) { |
|
| 3 | 3 | exit; |
| 4 | 4 | } |
| 5 | 5 | |
@@ -25,13 +25,13 @@ discard block |
||
| 25 | 25 | * The Constructor. |
| 26 | 26 | */ |
| 27 | 27 | public function __construct() { |
| 28 | - if ( function_exists( "__autoload" ) ) { |
|
| 29 | - spl_autoload_register( "__autoload" ); |
|
| 28 | + if (function_exists("__autoload")) { |
|
| 29 | + spl_autoload_register("__autoload"); |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - spl_autoload_register( array( $this, 'autoload' ) ); |
|
| 32 | + spl_autoload_register(array($this, 'autoload')); |
|
| 33 | 33 | |
| 34 | - $this->include_path = untrailingslashit( plugin_dir_path( GD_PLUGIN_FILE ) ) . '/includes/'; |
|
| 34 | + $this->include_path = untrailingslashit(plugin_dir_path(GD_PLUGIN_FILE)).'/includes/'; |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | /** |
@@ -40,8 +40,8 @@ discard block |
||
| 40 | 40 | * @param string $class |
| 41 | 41 | * @return string |
| 42 | 42 | */ |
| 43 | - private function get_file_name_from_class( $class ) { |
|
| 44 | - return 'class-' . str_replace( '_', '-', $class ) . '.php'; |
|
| 43 | + private function get_file_name_from_class($class) { |
|
| 44 | + return 'class-'.str_replace('_', '-', $class).'.php'; |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | /** |
@@ -50,9 +50,9 @@ discard block |
||
| 50 | 50 | * @param string $path |
| 51 | 51 | * @return bool successful or not |
| 52 | 52 | */ |
| 53 | - private function load_file( $path ) { |
|
| 54 | - if ( $path && is_readable( $path ) ) { |
|
| 55 | - include_once( $path ); |
|
| 53 | + private function load_file($path) { |
|
| 54 | + if ($path && is_readable($path)) { |
|
| 55 | + include_once($path); |
|
| 56 | 56 | return true; |
| 57 | 57 | } |
| 58 | 58 | return false; |
@@ -63,36 +63,36 @@ discard block |
||
| 63 | 63 | * |
| 64 | 64 | * @param string $class |
| 65 | 65 | */ |
| 66 | - public function autoload( $class ) { |
|
| 67 | - $class = strtolower( $class ); |
|
| 66 | + public function autoload($class) { |
|
| 67 | + $class = strtolower($class); |
|
| 68 | 68 | |
| 69 | - if ( 0 !== strpos( $class, 'gd_' ) ) { |
|
| 69 | + if (0 !== strpos($class, 'gd_')) { |
|
| 70 | 70 | return; |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - $file = $this->get_file_name_from_class( $class ); |
|
| 73 | + $file = $this->get_file_name_from_class($class); |
|
| 74 | 74 | $path = ''; |
| 75 | 75 | |
| 76 | - if ( strpos( $class, 'wc_addons_gateway_' ) === 0 ) { |
|
| 77 | - $path = $this->include_path . 'gateways/' . substr( str_replace( '_', '-', $class ), 18 ) . '/'; |
|
| 78 | - } elseif ( strpos( $class, 'gd_gateway_' ) === 0 ) { |
|
| 79 | - $path = $this->include_path . 'gateways/' . substr( str_replace( '_', '-', $class ), 11 ) . '/'; |
|
| 80 | - } elseif ( strpos( $class, 'gd_shipping_' ) === 0 ) { |
|
| 81 | - $path = $this->include_path . 'shipping/' . substr( str_replace( '_', '-', $class ), 12 ) . '/'; |
|
| 82 | - } elseif ( strpos( $class, 'gd_shortcode_' ) === 0 ) { |
|
| 83 | - $path = $this->include_path . 'shortcodes/'; |
|
| 84 | - } elseif ( strpos( $class, 'gd_meta_box' ) === 0 ) { |
|
| 85 | - $path = $this->include_path . 'admin/meta-boxes/'; |
|
| 86 | - } elseif ( strpos( $class, 'gd_admin' ) === 0 ) { |
|
| 87 | - $path = $this->include_path . 'admin/'; |
|
| 88 | - } elseif ( strpos( $class, 'gd_payment_token_' ) === 0 ) { |
|
| 89 | - $path = $this->include_path . 'payment-tokens/'; |
|
| 90 | - } elseif ( strpos( $class, 'gd_log_handler_' ) === 0 ) { |
|
| 91 | - $path = $this->include_path . 'log-handlers/'; |
|
| 76 | + if (strpos($class, 'wc_addons_gateway_') === 0) { |
|
| 77 | + $path = $this->include_path.'gateways/'.substr(str_replace('_', '-', $class), 18).'/'; |
|
| 78 | + } elseif (strpos($class, 'gd_gateway_') === 0) { |
|
| 79 | + $path = $this->include_path.'gateways/'.substr(str_replace('_', '-', $class), 11).'/'; |
|
| 80 | + } elseif (strpos($class, 'gd_shipping_') === 0) { |
|
| 81 | + $path = $this->include_path.'shipping/'.substr(str_replace('_', '-', $class), 12).'/'; |
|
| 82 | + } elseif (strpos($class, 'gd_shortcode_') === 0) { |
|
| 83 | + $path = $this->include_path.'shortcodes/'; |
|
| 84 | + } elseif (strpos($class, 'gd_meta_box') === 0) { |
|
| 85 | + $path = $this->include_path.'admin/meta-boxes/'; |
|
| 86 | + } elseif (strpos($class, 'gd_admin') === 0) { |
|
| 87 | + $path = $this->include_path.'admin/'; |
|
| 88 | + } elseif (strpos($class, 'gd_payment_token_') === 0) { |
|
| 89 | + $path = $this->include_path.'payment-tokens/'; |
|
| 90 | + } elseif (strpos($class, 'gd_log_handler_') === 0) { |
|
| 91 | + $path = $this->include_path.'log-handlers/'; |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - if ( empty( $path ) || ! $this->load_file( $path . $file ) ) { |
|
| 95 | - $this->load_file( $this->include_path . $file ); |
|
| 94 | + if (empty($path) || !$this->load_file($path.$file)) { |
|
| 95 | + $this->load_file($this->include_path.$file); |
|
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | 98 | } |