From 6f4ac5bc9dcbcbaa9bdbd3c003a8d79b7e56028c Mon Sep 17 00:00:00 2001 From: Kiran Prajapati Date: Fri, 23 Feb 2018 13:40:45 +0530 Subject: [PATCH] multiselect bug fix --- includes/admin/admin-functions.php | 4 +- includes/admin/class-geodir-admin-addons.php | 14 +- includes/admin/class-geodir-admin-assets.php | 4 +- .../admin/class-geodir-admin-comments.php | 4 +- .../admin/class-geodir-admin-dummy-data.php | 2 +- .../class-geodir-admin-import-export.php | 8 +- includes/admin/class-geodir-admin-install.php | 149 +++++------------- includes/admin/class-geodir-admin-menus.php | 4 +- includes/admin/class-geodir-admin-notices.php | 4 +- .../admin/class-geodir-admin-post-view.php | 2 +- .../admin/class-geodir-admin-settings.php | 84 +++++----- .../admin/class-geodir-admin-setup-wizard.php | 2 +- includes/admin/class-geodir-admin-tracker.php | 14 +- includes/admin/class-geodir-admin.php | 31 ++-- includes/admin/class-geodir-wp-dashboard.php | 131 ++------------- .../class-geodir-settings-analytics.php | 26 +-- .../class-geodir-settings-cpt-cf-extras.php | 18 +-- .../settings/class-geodir-settings-cpt-cf.php | 24 +-- .../class-geodir-settings-cpt-sorting.php | 24 +-- .../settings/class-geodir-settings-cpt.php | 26 +-- .../settings/class-geodir-settings-design.php | 20 +-- .../settings/class-geodir-settings-emails.php | 32 ++-- .../class-geodir-settings-general.php | 16 +- .../class-geodir-settings-import-export.php | 34 ++-- .../settings/class-geodir-settings-page.php | 16 +- .../views/html-admin-page-status-report.php | 84 +++++----- ...dmin-settings-import-export-categories.php | 3 +- ...-admin-settings-import-export-listings.php | 3 +- includes/admin/views/html-admin-settings.php | 16 +- includes/admin/views/html-notice-install.php | 2 +- .../admin/views/html-notice-theme-support.php | 10 +- includes/admin/views/html-notice-update.php | 10 +- includes/admin/views/html-notice-updated.php | 2 +- includes/class-geodir-ajax.php | 4 +- includes/class-geodir-frontend-scripts.php | 20 +-- includes/class-geodir-permalinks.php | 4 +- includes/class-geodir-post-types.php | 2 +- includes/class-geodir-query.php | 2 +- includes/core-functions.php | 2 +- includes/custom-fields/input-functions.php | 6 +- includes/custom_functions.php | 4 +- includes/formatting-functions.php | 6 +- includes/general_functions.php | 6 +- includes/geodir-ajax-functions.php | 6 +- includes/geodir-shortcode-functions.php | 4 +- includes/geodir-widget-functions.php | 6 +- includes/geodirectory_hooks_actions.php | 4 +- includes/helper-functions.php | 14 +- includes/libraries/wp-background-process.php | 2 +- includes/listing_filters.php | 2 +- includes/post_functions.php | 4 +- includes/taxonomy-functions.php | 8 +- .../widgets/class-geodir-widget-features.php | 4 +- 53 files changed, 365 insertions(+), 568 deletions(-) diff --git a/includes/admin/admin-functions.php b/includes/admin/admin-functions.php index 7cd61a814..6e943f8db 100644 --- a/includes/admin/admin-functions.php +++ b/includes/admin/admin-functions.php @@ -17,7 +17,7 @@ * * @return array */ -function gd_get_screen_ids() { +function geodir_get_screen_ids() { $screen_ids = array( 'geodirectory_page_gd-settings', @@ -365,7 +365,7 @@ function geodir_in_plugin_upgrade_message( $content ) { $notices = (array) preg_split( '~[\r\n]+~', trim( $matches[2] ) ); if ( version_compare( GEODIRECTORY_VERSION, $version, '<' ) ) { - $upgrade_notice .= '
'; + $upgrade_notice .= '
'; foreach ( $notices as $index => $line ) { $upgrade_notice .= wp_kses_post( preg_replace( '~\[([^\]]*)\]\(([^\)]*)\)~', '${1}', $line ) ); } diff --git a/includes/admin/class-geodir-admin-addons.php b/includes/admin/class-geodir-admin-addons.php index d32e3296f..c5f78b240 100644 --- a/includes/admin/class-geodir-admin-addons.php +++ b/includes/admin/class-geodir-admin-addons.php @@ -7,7 +7,7 @@ * @category Admin * @package GeoDirectoru/Admin * @version 2.0.0 - * @info Derived from WC_Admin_Addons + * @info Derived from GeoDir_Admin_Addons */ if ( ! defined( 'ABSPATH' ) ) { @@ -40,12 +40,12 @@ public static function get_tabs(){ * @return array of objects */ public static function get_featured() { - if ( false === ( $featured = get_transient( 'wc_addons_featured' ) ) ) { - $raw_featured = wp_safe_remote_get( 'https://d3t0oesq8995hv.cloudfront.net/add-ons/featured.json', array( 'user-agent' => 'WooCommerce Addons Page' ) ); + if ( false === ( $featured = get_transient( 'geodir_addons_featured' ) ) ) { + $raw_featured = wp_safe_remote_get( 'https://d3t0oesq8995hv.cloudfront.net/add-ons/featured.json', array( 'user-agent' => 'GeoDirectory Addons Page' ) ); if ( ! is_wp_error( $raw_featured ) ) { $featured = json_decode( wp_remote_retrieve_body( $raw_featured ) ); if ( $featured ) { - set_transient( 'wc_addons_featured', $featured, WEEK_IN_SECONDS ); + set_transient( 'geodir_addons_featured', $featured, WEEK_IN_SECONDS ); } } } @@ -65,13 +65,13 @@ public static function get_sections() { return array(); //@todo we prob don't need these yet. - if ( false === ( $sections = get_transient( 'wc_addons_sections' ) ) ) { - $raw_sections = wp_safe_remote_get( 'https://d3t0oesq8995hv.cloudfront.net/addon-sections.json', array( 'user-agent' => 'WooCommerce Addons Page' ) ); + if ( false === ( $sections = get_transient( 'geodir_addons_sections' ) ) ) { + $raw_sections = wp_safe_remote_get( 'https://d3t0oesq8995hv.cloudfront.net/addon-sections.json', array( 'user-agent' => 'GeoDirectory Addons Page' ) ); if ( ! is_wp_error( $raw_sections ) ) { $sections = json_decode( wp_remote_retrieve_body( $raw_sections ) ); if ( $sections ) { - set_transient( 'wc_addons_sections', $sections, WEEK_IN_SECONDS ); + set_transient( 'geodir_addons_sections', $sections, WEEK_IN_SECONDS ); } } } diff --git a/includes/admin/class-geodir-admin-assets.php b/includes/admin/class-geodir-admin-assets.php index 7e96defbf..93162869a 100644 --- a/includes/admin/class-geodir-admin-assets.php +++ b/includes/admin/class-geodir-admin-assets.php @@ -57,7 +57,7 @@ public function admin_styles() { } // Admin styles for GD pages only - if ( in_array( $screen_id, gd_get_screen_ids() ) ) { + if ( in_array( $screen_id, geodir_get_screen_ids() ) ) { // load OSM styles if needed. if($geodir_map_name == 'osm'){ @@ -162,7 +162,7 @@ public function admin_scripts() { // Admin scripts for GD pages only - if ( in_array( $screen_id, gd_get_screen_ids() ) ) { + if ( in_array( $screen_id, geodir_get_screen_ids() ) ) { wp_enqueue_script( 'wp-color-picker' ); // timepicker diff --git a/includes/admin/class-geodir-admin-comments.php b/includes/admin/class-geodir-admin-comments.php index 3bc41f14b..9749494cf 100644 --- a/includes/admin/class-geodir-admin-comments.php +++ b/includes/admin/class-geodir-admin-comments.php @@ -6,7 +6,7 @@ * @category Admin * @package GeoDirectory/Admin * @version 2.0.0 - * @info Uses WC_Admin_Notices class as a base. + * @info Uses GeoDir_Admin_Comments class as a base. */ if ( ! defined( 'ABSPATH' ) ) { @@ -14,7 +14,7 @@ } /** - * GeoDir_Admin_Notices Class. + * GeoDir_Admin_Comments Class. */ class GeoDir_Admin_Comments { diff --git a/includes/admin/class-geodir-admin-dummy-data.php b/includes/admin/class-geodir-admin-dummy-data.php index 656858d2d..c6cfd64a0 100644 --- a/includes/admin/class-geodir-admin-dummy-data.php +++ b/includes/admin/class-geodir-admin-dummy-data.php @@ -14,7 +14,7 @@ /** - * WC_Admin_Menus Class. + * GeoDir_Admin_Dummy_Data Class. */ class GeoDir_Admin_Dummy_Data { diff --git a/includes/admin/class-geodir-admin-import-export.php b/includes/admin/class-geodir-admin-import-export.php index 0a649062b..f80960a13 100644 --- a/includes/admin/class-geodir-admin-import-export.php +++ b/includes/admin/class-geodir-admin-import-export.php @@ -1,6 +1,6 @@ 0 && $line_count > 0 ? ceil( $line_count / $posts_count ) * 100 : 0; @@ -684,7 +684,7 @@ public static function export_posts() { } // WPML wp_send_json( $json ); - gd_die(); + geodir_die(); } else { if ( ! $posts_count > 0 ) { $json['error'] = __( 'No records to export.', 'geodirectory' ); diff --git a/includes/admin/class-geodir-admin-install.php b/includes/admin/class-geodir-admin-install.php index 3fa9f481e..07b5cd1fe 100644 --- a/includes/admin/class-geodir-admin-install.php +++ b/includes/admin/class-geodir-admin-install.php @@ -19,66 +19,10 @@ class GeoDir_Admin_Install { /** @var array DB updates and callbacks that need to be run per version */ private static $db_updates = array( - '2.0.0' => array( - 'wc_update_200_file_paths', - 'wc_update_200_permalinks', - 'wc_update_200_subcat_display', - 'wc_update_200_taxrates', - 'wc_update_200_line_items', - 'wc_update_200_images', - 'wc_update_200_db_version', - ), - '2.0.9' => array( - 'wc_update_209_brazillian_state', - 'wc_update_209_db_version', - ), - '2.1.0' => array( - 'wc_update_210_remove_pages', - 'wc_update_210_file_paths', - 'wc_update_210_db_version', - ), - '2.2.0' => array( - 'wc_update_220_shipping', - 'wc_update_220_order_status', - 'wc_update_220_variations', - 'wc_update_220_attributes', - 'wc_update_220_db_version', - ), - '2.3.0' => array( - 'wc_update_230_options', - 'wc_update_230_db_version', - ), - '2.4.0' => array( - 'wc_update_240_options', - 'wc_update_240_shipping_methods', - 'wc_update_240_api_keys', - 'wc_update_240_webhooks', - 'wc_update_240_refunds', - 'wc_update_240_db_version', - ), - '2.4.1' => array( - 'wc_update_241_variations', - 'wc_update_241_db_version', - ), - '2.5.0' => array( - 'wc_update_250_currency', - 'wc_update_250_db_version', - ), - '2.6.0' => array( - 'wc_update_260_options', - 'wc_update_260_termmeta', - 'wc_update_260_zones', - 'wc_update_260_zone_methods', - 'wc_update_260_refunds', - 'wc_update_260_db_version', - ), - '3.0.0' => array( - 'wc_update_300_webhooks', - 'wc_update_300_grouped_products', - 'wc_update_300_settings', - 'wc_update_300_product_visibility', - 'wc_update_300_db_version', - ), + /*'2.0.0' => array( + 'geodir_update_200_file_paths', + 'geodir_update_200_permalinks', + )*/ ); /** @var object Background update class */ @@ -92,11 +36,11 @@ public static function init() { //add_action( 'init', array( __CLASS__, 'init_background_updater' ), 5 ); add_action( 'admin_init', array( __CLASS__, 'install_actions' ) ); //add_action( 'in_plugin_update_message-woocommerce/woocommerce.php', array( __CLASS__, 'in_plugin_update_message' ) ); - //add_filter( 'plugin_action_links_' . WC_PLUGIN_BASENAME, array( __CLASS__, 'plugin_action_links' ) ); + //add_filter( 'plugin_action_links_' . GEODIRECTORY_PLUGIN_BASENAME, array( __CLASS__, 'plugin_action_links' ) ); add_filter( 'plugin_row_meta', array( __CLASS__, 'plugin_row_meta' ), 10, 2 ); add_filter( 'wpmu_drop_tables', array( __CLASS__, 'wpmu_drop_tables' ) ); add_filter( 'cron_schedules', array( __CLASS__, 'cron_schedules' ) ); - //add_action( 'woocommerce_plugin_background_installer', array( __CLASS__, 'background_installer' ), 10, 2 ); + //add_action( 'geodir_plugin_background_installer', array( __CLASS__, 'background_installer' ), 10, 2 ); } /** @@ -125,19 +69,19 @@ public static function check_version() { //self::install(); // @todo remove afte * This function is hooked into admin_init to affect admin only. */ public static function install_actions() { - if ( ! empty( $_GET['do_update_woocommerce'] ) ) { + if ( ! empty( $_GET['do_update_geodirectory'] ) ) { self::update(); - WC_Admin_Notices::add_notice( 'update' ); + GeoDir_Admin_Notices::add_notice( 'update' ); } - if ( ! empty( $_GET['force_update_woocommerce'] ) ) { - do_action( 'wp_wc_updater_cron' ); - wp_safe_redirect( admin_url( 'admin.php?page=wc-settings' ) ); + if ( ! empty( $_GET['force_update_geodirectory'] ) ) { + do_action( 'wp_geodir_updater_cron' ); + wp_safe_redirect( admin_url( 'admin.php?page=gd-settings' ) ); exit; } } /** - * Install WC. + * Install GeoDirectory. */ public static function install() { global $wpdb; @@ -203,7 +147,7 @@ public static function install() { self::update_gd_version(); // Flush rules after install - do_action( 'geodirectory_flush_rewrite_rules' ); + do_action( 'geodir_flush_rewrite_rules' ); // Trigger action do_action( 'geodirectory_installed' ); @@ -253,7 +197,7 @@ public static function insert_countries(){ } /** - * Update WC version to current. + * Update GeoDirectory version to current. */ private static function update_gd_version() { delete_option( 'geodirectory_version' ); @@ -283,7 +227,7 @@ private static function update() { foreach ( $update_callbacks as $update_callback ) { $logger->info( sprintf( 'Queuing %s - %s', $version, $update_callback ), - array( 'source' => 'wc_db_updates' ) + array( 'source' => 'geodir_db_updates' ) ); self::$background_updater->push_to_queue( $update_callback ); $update_queued = true; @@ -313,7 +257,7 @@ public static function update_db_version( $version = null ) { public static function cron_schedules( $schedules ) { $schedules['monthly'] = array( 'interval' => 2635200, - 'display' => __( 'Monthly', 'woocommerce' ), + 'display' => __( 'Monthly', 'geodirectory' ), ); return $schedules; } @@ -374,7 +318,7 @@ public static function create_pages() { geodir_create_page( esc_sql( $page['name'] ), $key , $page['title'], $page['content']); } - delete_transient( 'woocommerce_cache_excluded_uris' ); + delete_transient( 'geodir_cache_excluded_uris' ); } /** @@ -411,14 +355,12 @@ private static function create_options() { * Set up the database tables which the plugin needs to function. * * Tables: - * woocommerce_attribute_taxonomies - Table for storing attribute taxonomies - these are user defined - * woocommerce_termmeta - Term meta table - sadly WordPress does not have termmeta so we need our own - * woocommerce_downloadable_product_permissions - Table for storing user and guest download permissions. - * KEY(order_id, product_id, download_id) used for organizing downloads on the My Account page - * woocommerce_order_items - Order line items are stored in a table to make them easily queryable for reports - * woocommerce_order_itemmeta - Order line item meta is stored in a table for storing extra data. - * woocommerce_tax_rates - Tax Rates are stored inside 2 tables making tax queries simple and efficient. - * woocommerce_tax_rate_locations - Each rate can be applied to more than one postcode/city hence the second table. + * geodir_attachments - Listing attachments table. + * geodir_business_hours - Business hours table. + * geodir_countries - Countries table. + * geodir_custom_fields - Custom fields table. + * geodir_custom_sort_fields - Custom fields sorting table. + * geodir_post_review - Listing reviews table. */ private static function create_tables() { global $wpdb; @@ -434,8 +376,6 @@ private static function create_tables() { /** * Get Table schema. * - * https://github.com/woocommerce/woocommerce/wiki/Database-Description/ - * * A note on indexes; Indexes have a maximum size of 767 bytes. Historically, we haven't need to be concerned about that. * As of WordPress 4.2, however, we moved to utf8mb4, which uses 4 bytes per character. This means that an index which * used to have room for floor(767/3) = 255 characters, now only has room for floor(767/4) = 191 characters. @@ -591,10 +531,10 @@ private static function get_schema() { * Show plugin changes. Code adapted from W3 Total Cache. */ public static function in_plugin_update_message( $args ) { - $transient_name = 'wc_upgrade_notice_' . $args['Version']; + $transient_name = 'gd_upgrade_notice_' . $args['Version']; if ( false === ( $upgrade_notice = get_transient( $transient_name ) ) ) { - $response = wp_safe_remote_get( 'https://plugins.svn.wordpress.org/woocommerce/trunk/readme.txt' ); + $response = wp_safe_remote_get( 'https://plugins.svn.wordpress.org/geodirectory/trunk/readme.txt' ); if ( ! is_wp_error( $response ) && ! empty( $response['body'] ) ) { $upgrade_notice = self::parse_update_notice( $response['body'], $args['new_version'] ); @@ -615,7 +555,7 @@ public static function in_plugin_update_message( $args ) { private static function parse_update_notice( $content, $new_version ) { // Output Upgrade Notice. $matches = null; - $regexp = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*' . preg_quote( WC_VERSION ) . '\s*=|$)~Uis'; + $regexp = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*' . preg_quote( GEODIRECTORY_VERSION ) . '\s*=|$)~Uis'; $upgrade_notice = ''; if ( preg_match( $regexp, $content, $matches ) ) { @@ -623,7 +563,7 @@ private static function parse_update_notice( $content, $new_version ) { // Convert the full version strings to minor versions. $notice_version_parts = explode( '.', trim( $matches[1] ) ); - $current_version_parts = explode( '.', WC_VERSION ); + $current_version_parts = explode( '.', GEODIRECTORY_VERSION ); if ( 3 !== sizeof( $notice_version_parts ) ) { return; @@ -635,7 +575,7 @@ private static function parse_update_notice( $content, $new_version ) { // Check the latest stable version and ignore trunk. if ( version_compare( $current_version, $notice_version, '<' ) ) { - $upgrade_notice .= '

'; + $upgrade_notice .= '

'; foreach ( $notices as $index => $line ) { $upgrade_notice .= preg_replace( '~\[([^\]]*)\]\(([^\)]*)\)~', '${1}', $line ); @@ -654,7 +594,7 @@ private static function parse_update_notice( $content, $new_version ) { */ public static function plugin_action_links( $links ) { $action_links = array( - 'settings' => '' . esc_html__( 'Settings', 'woocommerce' ) . '', + 'settings' => '' . esc_html__( 'Settings', 'geodirectory' ) . '', ); return array_merge( $action_links, $links ); @@ -689,19 +629,12 @@ public static function plugin_row_meta( $links, $file ) { public static function wpmu_drop_tables( $tables ) { global $wpdb; - $tables[] = $wpdb->prefix . 'woocommerce_sessions'; - $tables[] = $wpdb->prefix . 'woocommerce_api_keys'; - $tables[] = $wpdb->prefix . 'woocommerce_attribute_taxonomies'; - $tables[] = $wpdb->prefix . 'woocommerce_downloadable_product_permissions'; - $tables[] = $wpdb->prefix . 'woocommerce_termmeta'; - $tables[] = $wpdb->prefix . 'woocommerce_tax_rates'; - $tables[] = $wpdb->prefix . 'woocommerce_tax_rate_locations'; - $tables[] = $wpdb->prefix . 'woocommerce_order_items'; - $tables[] = $wpdb->prefix . 'woocommerce_order_itemmeta'; - $tables[] = $wpdb->prefix . 'woocommerce_payment_tokens'; - $tables[] = $wpdb->prefix . 'woocommerce_shipping_zones'; - $tables[] = $wpdb->prefix . 'woocommerce_shipping_zone_locations'; - $tables[] = $wpdb->prefix . 'woocommerce_shipping_zone_methods'; + $tables[] = $wpdb->prefix . GEODIR_ATTACHMENT_TABLE; + $tables[] = $wpdb->prefix . GEODIR_BUSINESS_HOURS_TABLE; + $tables[] = $wpdb->prefix . GEODIR_COUNTRIES_TABLE; + $tables[] = $wpdb->prefix . GEODIR_CUSTOM_FIELDS_TABLE; + $tables[] = $wpdb->prefix . GEODIR_CUSTOM_SORT_FIELDS_TABLE; + $tables[] = $wpdb->prefix . GEODIR_REVIEW_TABLE; return $tables; } @@ -726,7 +659,7 @@ private static function format_plugin_slug( $key ) { */ public static function background_installer( $plugin_to_install_id, $plugin_to_install ) { // Explicitly clear the event. - wp_clear_scheduled_hook( 'woocommerce_plugin_background_installer', func_get_args() ); + wp_clear_scheduled_hook( 'geodir_plugin_background_installer', func_get_args() ); if ( ! empty( $plugin_to_install['repo-slug'] ) ) { require_once( ABSPATH . 'wp-admin/includes/file.php' ); @@ -811,13 +744,13 @@ public static function background_installer( $plugin_to_install_id, $plugin_to_i $activate = true; } catch ( Exception $e ) { - WC_Admin_Notices::add_custom_notice( + GeoDir_Admin_Notices::add_custom_notice( $plugin_to_install_id . '_install_error', sprintf( - __( '%1$s could not be installed (%2$s). Please install it manually by clicking here.', 'woocommerce' ), + __( '%1$s could not be installed (%2$s). Please install it manually by clicking here.', 'geodirectory' ), $plugin_to_install['name'], $e->getMessage(), - esc_url( admin_url( 'index.php?wc-install-plugin-redirect=' . $plugin_to_install['repo-slug'] ) ) + esc_url( admin_url( 'index.php?gd-install-plugin-redirect=' . $plugin_to_install['repo-slug'] ) ) ) ); } @@ -837,10 +770,10 @@ public static function background_installer( $plugin_to_install_id, $plugin_to_i throw new Exception( $result->get_error_message() ); } } catch ( Exception $e ) { - WC_Admin_Notices::add_custom_notice( + GeoDir_Admin_Notices::add_custom_notice( $plugin_to_install_id . '_install_error', sprintf( - __( '%1$s was installed but could not be activated. Please activate it manually by clicking here.', 'woocommerce' ), + __( '%1$s was installed but could not be activated. Please activate it manually by clicking here.', 'geodirectory' ), $plugin_to_install['name'], admin_url( 'plugins.php' ) ) diff --git a/includes/admin/class-geodir-admin-menus.php b/includes/admin/class-geodir-admin-menus.php index 2ff8f9eb2..17189f9bf 100644 --- a/includes/admin/class-geodir-admin-menus.php +++ b/includes/admin/class-geodir-admin-menus.php @@ -14,7 +14,7 @@ /** - * WC_Admin_Menus Class. + * GeoDir_Admin_Menus Class. */ class GD_Admin_Menus { @@ -106,7 +106,7 @@ public function addons_menu() { * Init the reports page. */ public function reports_page() { - WC_Admin_Reports::output(); + GeoDir_Admin_Reports::output(); } /** diff --git a/includes/admin/class-geodir-admin-notices.php b/includes/admin/class-geodir-admin-notices.php index 9ddd0fb86..37c8b5e29 100644 --- a/includes/admin/class-geodir-admin-notices.php +++ b/includes/admin/class-geodir-admin-notices.php @@ -6,7 +6,7 @@ * @category Admin * @package GeoDirectory/Admin * @version 2.0.0 - * @info Uses WC_Admin_Notices class as a base. + * @info Uses GeoDir_Admin_Notices class as a base. */ if ( ! defined( 'ABSPATH' ) ) { @@ -116,7 +116,7 @@ public static function has_notice( $name ) { */ public static function hide_notices() { if ( isset( $_GET['gd-hide-notice'] ) && isset( $_GET['_gd_notice_nonce'] ) ) { - if ( ! wp_verify_nonce( $_GET['_gd_notice_nonce'], 'geodirectory_hide_notices_nonce' ) ) { + if ( ! wp_verify_nonce( $_GET['_gd_notice_nonce'], 'geodir_hide_notices_nonce' ) ) { wp_die( __( 'Action failed. Please refresh the page and retry.', 'geodirectory' ) ); } diff --git a/includes/admin/class-geodir-admin-post-view.php b/includes/admin/class-geodir-admin-post-view.php index 11679f6fe..a89dc4ba7 100644 --- a/includes/admin/class-geodir-admin-post-view.php +++ b/includes/admin/class-geodir-admin-post-view.php @@ -393,7 +393,7 @@ public static function posts_footer() { $screen = get_current_screen(); $screen_id = $screen ? $screen->id : ''; - if ( ! ( $screen_id && in_array( $screen_id, gd_get_screen_ids() ) ) ) { + if ( ! ( $screen_id && in_array( $screen_id, geodir_get_screen_ids() ) ) ) { return; } diff --git a/includes/admin/class-geodir-admin-settings.php b/includes/admin/class-geodir-admin-settings.php index d9071a656..65a65b29e 100644 --- a/includes/admin/class-geodir-admin-settings.php +++ b/includes/admin/class-geodir-admin-settings.php @@ -71,7 +71,7 @@ public static function get_settings_pages() { // $settings[] = include( 'settings/class-wc-settings-api.php' ); } - self::$settings = apply_filters( 'woocommerce_get_settings_pages', $settings ); + self::$settings = apply_filters( 'geodir_get_settings_pages', $settings ); } return self::$settings; @@ -83,25 +83,25 @@ public static function get_settings_pages() { public static function save() { global $current_tab; - if ( empty( $_REQUEST['_wpnonce'] ) || ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'woocommerce-settings' ) ) { - die( __( 'Action failed. Please refresh the page and retry.', 'woocommerce' ) ); + if ( empty( $_REQUEST['_wpnonce'] ) || ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'geodirectory-settings' ) ) { + die( __( 'Action failed. Please refresh the page and retry.', 'geodirectory' ) ); } // Trigger actions - do_action( 'woocommerce_settings_save_' . $current_tab ); - do_action( 'woocommerce_update_options_' . $current_tab ); - do_action( 'woocommerce_update_options' ); + do_action( 'geodir_settings_save_' . $current_tab ); + do_action( 'geodir_update_options_' . $current_tab ); + do_action( 'geodir_update_options' ); - self::add_message( __( 'Your settings have been saved.', 'woocommerce' ) ); + self::add_message( __( 'Your settings have been saved.', 'geodirectory' ) ); self::check_download_folder_protection(); // Clear any unwanted data and flush rules - delete_transient( 'woocommerce_cache_excluded_uris' ); + delete_transient( 'geodir_cache_excluded_uris' ); //WC()->query->init_query_vars(); ///WC()->query->add_endpoints(); - wp_schedule_single_event( time(), 'woocommerce_flush_rewrite_rules' ); + wp_schedule_single_event( time(), 'geodir_flush_rewrite_rules' ); - do_action( 'woocommerce_settings_saved' ); + do_action( 'geodir_settings_saved' ); } /** @@ -139,19 +139,19 @@ public static function show_messages() { /** * Settings page. * - * Handles the display of the main woocommerce settings page in admin. + * Handles the display of the main geodirectory settings page in admin. */ public static function output() { global $current_section, $current_tab; $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; - do_action( 'woocommerce_settings_start' ); + do_action( 'geodir_settings_start' ); - //wp_enqueue_script( 'woocommerce_settings', WC()->plugin_url() . '/assets/js/admin/settings' . $suffix . '.js', array( 'jquery', 'jquery-ui-datepicker', 'jquery-ui-sortable', 'iris', 'select2' ), WC()->version, true ); + //wp_enqueue_script( 'geodir_settings', GeoDir()->plugin_url() . '/assets/js/admin/settings' . $suffix . '.js', array( 'jquery', 'jquery-ui-datepicker', 'jquery-ui-sortable', 'iris', 'select2' ), GeoDir()->version, true ); - wp_localize_script( 'woocommerce_settings', 'woocommerce_settings_params', array( - 'i18n_nav_warning' => __( 'The changes you made will be lost if you navigate away from this page.', 'woocommerce' ), + wp_localize_script( 'geodir_settings', 'geodir_settings_params', array( + 'i18n_nav_warning' => __( 'The changes you made will be lost if you navigate away from this page.', 'geodirectory' ), ) ); // Include settings pages @@ -167,16 +167,16 @@ public static function output() { } // Add any posted messages - if ( ! empty( $_GET['wc_error'] ) ) { - self::add_error( stripslashes( $_GET['wc_error'] ) ); + if ( ! empty( $_GET['gd_error'] ) ) { + self::add_error( stripslashes( $_GET['gd_error'] ) ); } - if ( ! empty( $_GET['wc_message'] ) ) { - self::add_message( stripslashes( $_GET['wc_message'] ) ); + if ( ! empty( $_GET['gd_message'] ) ) { + self::add_message( stripslashes( $_GET['gd_message'] ) ); } // Get tabs for the settings page - $tabs = apply_filters( 'woocommerce_settings_tabs_array', array() ); + $tabs = apply_filters( 'geodir_settings_tabs_array', array() ); include( dirname( __FILE__ ) . '/views/html-admin-settings.php' ); } @@ -194,7 +194,7 @@ public static function get_option( $option_name, $default = '' ) { /** * Output admin fields. * - * Loops though the woocommerce options array and outputs each field. + * Loops though the geodirectory options array and outputs each field. * * @param array $options Opens array to output */ @@ -262,18 +262,18 @@ public static function output_fields( $options ) { } echo '' . "\n\n"; if ( ! empty( $value['id'] ) ) { - do_action( 'woocommerce_settings_' . sanitize_title( $value['id'] ) ); + do_action( 'geodir_settings_' . sanitize_title( $value['id'] ) ); } break; // Section Ends case 'sectionend': if ( ! empty( $value['id'] ) ) { - do_action( 'woocommerce_settings_' . sanitize_title( $value['id'] ) . '_end' ); + do_action( 'geodir_settings_' . sanitize_title( $value['id'] ) . '_end' ); } echo '
'; if ( ! empty( $value['id'] ) ) { - do_action( 'woocommerce_settings_' . sanitize_title( $value['id'] ) . '_after' ); + do_action( 'geodir_settings_' . sanitize_title( $value['id'] ) . '_after' ); } break; @@ -583,16 +583,16 @@ class="" . __( 'The settings of this image size have been disabled because its values are being overwritten by a filter.', 'woocommerce' ) . "

"; + $disabled_message = "

" . __( 'The settings of this image size have been disabled because its values are being overwritten by a filter.', 'geodirectory' ) . "

"; } ?>"> @@ -601,7 +601,7 @@ class="[width]" id="-width" type="text" size="3" value="" /> × id="-height" type="text" size="3" value="" />px - + "> - + - - $val ) { @@ -687,7 +687,7 @@ class=" -
+
" // Default: run an action default: - do_action( 'woocommerce_admin_field_' . $value['type'], $value ); + do_action( 'geodir_admin_field_' . $value['type'], $value ); break; } } @@ -967,7 +967,7 @@ public static function get_field_description( $value ) { if ( $tooltip_html && in_array( $value['type'], array( 'checkbox' ) ) ) { $tooltip_html = '

' . $tooltip_html . '

'; } elseif ( $tooltip_html ) { - $tooltip_html = gd_help_tip( $tooltip_html ); + $tooltip_html = geodir_help_tip( $tooltip_html ); } return array( @@ -979,7 +979,7 @@ public static function get_field_description( $value ) { /** * Save admin fields. * - * Loops though the woocommerce options array and outputs each field. + * Loops though the geodirectory options array and outputs each field. * * @param array $options Options array to output * @param array $data Optional. Data to use for saving. Defaults to $_POST. @@ -1057,9 +1057,9 @@ public static function save_fields( $options, $data = null ) { * Fire an action when a certain 'type' of field is being saved. * @deprecated 2.4.0 - doesn't allow manipulation of values! */ - if ( has_action( 'woocommerce_update_option_' . sanitize_title( $option['type'] ) ) ) { - wc_deprecated_function( 'The woocommerce_update_option_X action', '2.4.0', 'woocommerce_admin_settings_sanitize_option filter' ); - do_action( 'woocommerce_update_option_' . sanitize_title( $option['type'] ), $option ); + if ( has_action( 'geodir_update_option_' . sanitize_title( $option['type'] ) ) ) { + wc_deprecated_function( 'The geodir_update_option_X action', '2.4.0', 'geodir_admin_settings_sanitize_option filter' ); + do_action( 'geodir_update_option_' . sanitize_title( $option['type'] ), $option ); continue; } @@ -1067,13 +1067,13 @@ public static function save_fields( $options, $data = null ) { * Sanitize the value of an option. * @since 2.4.0 */ - $value = apply_filters( 'woocommerce_admin_settings_sanitize_option', $value, $option, $raw_value ); + $value = apply_filters( 'geodir_admin_settings_sanitize_option', $value, $option, $raw_value ); /** * Sanitize the value of an option by option name. * @since 2.4.0 */ - $value = apply_filters( "woocommerce_admin_settings_sanitize_option_$option_name", $value, $option, $raw_value ); + $value = apply_filters( "geodir_admin_settings_sanitize_option_$option_name", $value, $option, $raw_value ); if ( is_null( $value ) ) { continue; @@ -1110,8 +1110,8 @@ public static function save_fields( $options, $data = null ) { */ public static function check_download_folder_protection() { $upload_dir = wp_upload_dir(); - $downloads_url = $upload_dir['basedir'] . '/woocommerce_uploads'; - $download_method = get_option( 'woocommerce_file_download_method' ); + $downloads_url = $upload_dir['basedir'] . '/geodir_uploads'; + $download_method = get_option( 'geodir_file_download_method' ); if ( 'redirect' == $download_method ) { diff --git a/includes/admin/class-geodir-admin-setup-wizard.php b/includes/admin/class-geodir-admin-setup-wizard.php index 0f24b0369..dd311afcf 100644 --- a/includes/admin/class-geodir-admin-setup-wizard.php +++ b/includes/admin/class-geodir-admin-setup-wizard.php @@ -15,7 +15,7 @@ } /** - * WC_Admin_Setup_Wizard class. + * GeoDir_Admin_Setup_Wizard class. */ class GeoDir_Admin_Setup_Wizard { diff --git a/includes/admin/class-geodir-admin-tracker.php b/includes/admin/class-geodir-admin-tracker.php index 33aa2cb27..ce21da17f 100644 --- a/includes/admin/class-geodir-admin-tracker.php +++ b/includes/admin/class-geodir-admin-tracker.php @@ -4,14 +4,12 @@ * * The GeoDirectory tracker class adds functionality to track GeoDirectory usage based on if the customer opted in. * No personal information is tracked, only general GeoDirectory settings, general listing, order and user counts and admin email for discount code. - * This is a modified version of the WooCommerce WC_Tracker class. * * @class GeoDir_Admin_Tracker * @version 2.0.0 * @package GeoDirectory/Classes * @category Class * @author AyeCode Ltd - * @info Modified from WC_Tracker class. */ if ( ! defined( 'ABSPATH' ) ) { @@ -115,12 +113,12 @@ private static function get_tracking_data() { $data['active_plugins'] = $all_plugins['active_plugins']; $data['inactive_plugins'] = $all_plugins['inactive_plugins']; - // Jetpack & WooCommerce Connect + // Jetpack & GeoDirectory Connect $data['jetpack_version'] = defined( 'JETPACK__VERSION' ) ? JETPACK__VERSION : 'none'; $data['jetpack_connected'] = ( class_exists( 'Jetpack' ) && is_callable( 'Jetpack::is_active' ) && Jetpack::is_active() ) ? 'yes' : 'no'; $data['jetpack_is_staging'] = ( class_exists( 'Jetpack' ) && is_callable( 'Jetpack::is_staging_site' ) && Jetpack::is_staging_site() ) ? 'yes' : 'no'; - $data['connect_installed'] = class_exists( 'WC_Connect_Loader' ) ? 'yes' : 'no'; - $data['connect_active'] = ( class_exists( 'WC_Connect_Loader' ) && wp_next_scheduled( 'wc_connect_fetch_service_schemas' ) ) ? 'yes' : 'no'; + //$data['connect_installed'] = class_exists( 'GeoDir_Connect_Loader' ) ? 'yes' : 'no'; + //$data['connect_active'] = ( class_exists( 'GeoDir_Connect_Loader' ) && wp_next_scheduled( 'geodir_connect_fetch_service_schemas' ) ) ? 'yes' : 'no'; // Store count info $data['users'] = self::get_user_counts(); @@ -133,7 +131,7 @@ private static function get_tracking_data() { // Shipping method info //$data['shipping_methods'] = self::get_active_shipping_methods(); - // Get all WooCommerce options info + // Get all GeoDirectory options info $data['settings'] = self::get_all_geodirectory_options_values(); // Template overrides @@ -152,9 +150,9 @@ private static function get_tracking_data() { public static function get_theme_info() { $theme_data = wp_get_theme(); $theme_child_theme = is_child_theme() ? 'Yes' : 'No'; - $theme_wc_support = ( ! current_theme_supports( 'geodirectory' ) ) ? 'No' : 'Yes'; + $theme_gd_support = ( ! current_theme_supports( 'geodirectory' ) ) ? 'No' : 'Yes'; - return array( 'name' => $theme_data->Name, 'version' => $theme_data->Version, 'child_theme' => $theme_child_theme, 'gd_support' => $theme_wc_support ); + return array( 'name' => $theme_data->Name, 'version' => $theme_data->Version, 'child_theme' => $theme_child_theme, 'gd_support' => $theme_gd_support ); } /** diff --git a/includes/admin/class-geodir-admin.php b/includes/admin/class-geodir-admin.php index c0a6a4ac3..429d77c7e 100644 --- a/includes/admin/class-geodir-admin.php +++ b/includes/admin/class-geodir-admin.php @@ -60,25 +60,25 @@ public function geodirectory_rated(){ public function set_page_labels( $post_states, $post ) { if ( $post->ID == geodir_home_page_id() ) { $post_states['geodir_home_page'] = __( 'GD Home Page', 'geodirectory' ) . - gd_help_tip( __( 'If you wish to use GD as your homepage you should use this page in the settings.', 'geodirectory' ) ); + geodir_help_tip( __( 'If you wish to use GD as your homepage you should use this page in the settings.', 'geodirectory' ) ); } elseif ( $post->ID == geodir_add_listing_page_id() ) { $post_states['geodir_add_listing_page'] = __( 'GD Add listing page', 'geodirectory' ) . - gd_help_tip( __( 'This is where users will add listings via the frontend if enabled.', 'geodirectory' ) ); + geodir_help_tip( __( 'This is where users will add listings via the frontend if enabled.', 'geodirectory' ) ); } elseif ( $post->ID == geodir_location_page_id() ) { $post_states['geodir_location_page'] = __( 'GD Location page', 'geodirectory' ) . - gd_help_tip( __( 'This page can be used as the main directory page and is also used by some addons.', 'geodirectory' ) ); + geodir_help_tip( __( 'This page can be used as the main directory page and is also used by some addons.', 'geodirectory' ) ); } elseif ( $post->ID == geodir_search_page_id() ) { $post_states['geodir_search_page'] = __( 'GD Search page', 'geodirectory' ) . - gd_help_tip( __( 'This is the GD search results page.', 'geodirectory' ) ); + geodir_help_tip( __( 'This is the GD search results page.', 'geodirectory' ) ); } elseif ( $post->ID == geodir_archive_page_id() ) { $post_states['geodir_archive_page'] = __( 'GD Archive template', 'geodirectory' ) . - gd_help_tip( __( 'Used to design the archive pages but should never be linked to directly.', 'geodirectory' ) ); + geodir_help_tip( __( 'Used to design the archive pages but should never be linked to directly.', 'geodirectory' ) ); } elseif ( $post->ID == geodir_details_page_id() ) { $post_states['geodir_details_page'] = __( 'GD Details template', 'geodirectory' ) . - gd_help_tip( __( 'Used to design the details page but should never be linked to directly.', 'geodirectory' ) ); + geodir_help_tip( __( 'Used to design the details page but should never be linked to directly.', 'geodirectory' ) ); } elseif ( $post->ID == geodir_terms_and_conditions_page_id() ) { $post_states['geodir_terms_and_conditions_page'] = __( 'GD T&Cs', 'geodirectory' ) . - gd_help_tip( __( 'This is the page that will be used for your terms and conditions.', 'geodirectory' ) ); + geodir_help_tip( __( 'This is the page that will be used for your terms and conditions.', 'geodirectory' ) ); } return $post_states; @@ -162,15 +162,10 @@ public function conditional_includes() { */ public function admin_redirects() { // Nonced plugin install redirects (whitelisted) - if ( ! empty( $_GET['wc-install-plugin-redirect'] ) ) { - $plugin_slug = geodir_clean( $_GET['wc-install-plugin-redirect'] ); + if ( ! empty( $_GET['gd-install-plugin-redirect'] ) ) { + $plugin_slug = geodir_clean( $_GET['gd-install-plugin-redirect'] ); - if ( current_user_can( 'install_plugins' ) && in_array( $plugin_slug, array( 'woocommerce-gateway-stripe' ) ) ) { - $nonce = wp_create_nonce( 'install-plugin_' . $plugin_slug ); - $url = self_admin_url( 'update.php?action=install-plugin&plugin=' . $plugin_slug . '&_wpnonce=' . $nonce ); - } else { - $url = admin_url( 'plugin-install.php?tab=search&type=term&s=' . $plugin_slug ); - } + $url = admin_url( 'plugin-install.php?tab=search&type=term&s=' . $plugin_slug ); wp_safe_redirect( $url ); exit; @@ -253,17 +248,17 @@ public function preview_emails() { * @return string */ public function admin_footer_text( $footer_text ) { - if ( ! current_user_can( 'manage_options' ) || ! function_exists( 'gd_get_screen_ids' ) ) { + if ( ! current_user_can( 'manage_options' ) || ! function_exists( 'geodir_get_screen_ids' ) ) { return $footer_text; } $current_screen = get_current_screen(); - $gd_pages = gd_get_screen_ids(); + $gd_pages = geodir_get_screen_ids(); // Set only GD pages. $gd_pages = array_diff( $gd_pages, array( 'profile', 'user-edit' ) ); - // Check to make sure we're on a WooCommerce admin page. + // Check to make sure we're on a GeoDirectory admin page. if ( isset( $current_screen->id ) && apply_filters( 'geodirectory_display_admin_footer_text', in_array( $current_screen->id, $gd_pages ) ) ) { // Change the footer text if ( ! get_option( 'geodirectory_admin_footer_text_rated' ) ) { diff --git a/includes/admin/class-geodir-wp-dashboard.php b/includes/admin/class-geodir-wp-dashboard.php index f3627e338..ac87b5b1f 100644 --- a/includes/admin/class-geodir-wp-dashboard.php +++ b/includes/admin/class-geodir-wp-dashboard.php @@ -35,9 +35,9 @@ public function __construct() { */ public function init() { if ( current_user_can( 'manage_options' ) ) { - wp_add_dashboard_widget( 'woocommerce_dashboard_recent_reviews', __( 'WooCommerce recent reviews', 'woocommerce' ), array( $this, 'recent_reviews' ) ); + wp_add_dashboard_widget( 'geodir_dashboard_recent_reviews', __( 'GeoDirectory recent reviews', 'geodirectory' ), array( $this, 'recent_reviews' ) ); } - wp_add_dashboard_widget( 'woocommerce_dashboard_status', __( 'WooCommerce status', 'woocommerce' ), array( $this, 'status_widget' ) ); + wp_add_dashboard_widget( 'geodir_dashboard_status', __( 'GeoDirectory status', 'geodirectory' ), array( $this, 'status_widget' ) ); } /** @@ -54,7 +54,7 @@ private function get_top_seller() { $query['join'] .= "INNER JOIN {$wpdb->prefix}woocommerce_order_itemmeta AS order_item_meta ON order_items.order_item_id = order_item_meta.order_item_id "; $query['join'] .= "INNER JOIN {$wpdb->prefix}woocommerce_order_itemmeta AS order_item_meta_2 ON order_items.order_item_id = order_item_meta_2.order_item_id "; $query['where'] = "WHERE posts.post_type IN ( '" . implode( "','", wc_get_order_types( 'order-count' ) ) . "' ) "; - $query['where'] .= "AND posts.post_status IN ( 'wc-" . implode( "','wc-", apply_filters( 'woocommerce_reports_order_statuses', array( 'completed', 'processing', 'on-hold' ) ) ) . "' ) "; + $query['where'] .= "AND posts.post_status IN ( 'wc-" . implode( "','wc-", apply_filters( 'geodir_reports_order_statuses', array( 'completed', 'processing', 'on-hold' ) ) ) . "' ) "; $query['where'] .= "AND order_item_meta.meta_key = '_qty' "; $query['where'] .= "AND order_item_meta_2.meta_key = '_product_id' "; $query['where'] .= "AND posts.post_date >= '" . date( 'Y-m-01', current_time( 'timestamp' ) ) . "' "; @@ -63,7 +63,7 @@ private function get_top_seller() { $query['orderby'] = "ORDER BY qty DESC"; $query['limits'] = "LIMIT 1"; - return $wpdb->get_row( implode( ' ', apply_filters( 'woocommerce_dashboard_status_widget_top_seller_query', $query ) ) ); + return $wpdb->get_row( implode( ' ', apply_filters( 'geodir_dashboard_status_widget_top_seller_query', $query ) ) ); } /** @@ -90,9 +90,9 @@ public function status_widget() { return ; include_once( dirname( __FILE__ ) . '/reports/class-wc-admin-report.php' ); - $reports = new WC_Admin_Report(); + $reports = new GeoDir_Admin_Report(); - echo '
    '; + echo '
      '; if ( current_user_can( 'view_woocommerce_reports' ) && ( $report_data = $this->get_sales_report_data() ) ) { ?> @@ -102,7 +102,7 @@ public function status_widget() { ' . wc_price( $report_data->net_sales ) . '' ); ?> @@ -119,7 +119,7 @@ public function status_widget() { ' . get_the_title( $top_seller->product_id ) . '', $top_seller->qty ); @@ -129,119 +129,16 @@ public function status_widget() { status_widget_order_rows(); - $this->status_widget_stock_rows(); + $this->status_widget_listing_rows(); - do_action( 'woocommerce_after_dashboard_status_widget', $reports ); + do_action( 'geodir_after_dashboard_status_widget', $reports ); echo '
    '; } /** * Show order data is status widget. */ - private function status_widget_order_rows() { - if ( ! current_user_can( 'edit_shop_orders' ) ) { - return; - } - $on_hold_count = 0; - $processing_count = 0; - - foreach ( wc_get_order_types( 'order-count' ) as $type ) { - $counts = (array) wp_count_posts( $type ); - $on_hold_count += isset( $counts['wc-on-hold'] ) ? $counts['wc-on-hold'] : 0; - $processing_count += isset( $counts['wc-processing'] ) ? $counts['wc-processing'] : 0; - } - ?> -
  • - - %s order awaiting processing', '%s orders awaiting processing', $processing_count, 'woocommerce' ), - $processing_count - ); - ?> - -
  • -
  • - - %s order on-hold', '%s orders on-hold', $on_hold_count, 'woocommerce' ), - $on_hold_count - ); - ?> - -
  • - posts} as posts - INNER JOIN {$wpdb->postmeta} AS postmeta ON posts.ID = postmeta.post_id - INNER JOIN {$wpdb->postmeta} AS postmeta2 ON posts.ID = postmeta2.post_id - WHERE 1=1 - AND posts.post_type IN ( 'product', 'product_variation' ) - AND posts.post_status = 'publish' - AND postmeta2.meta_key = '_manage_stock' AND postmeta2.meta_value = 'yes' - AND postmeta.meta_key = '_stock' AND CAST(postmeta.meta_value AS SIGNED) <= '{$stock}' - AND postmeta.meta_key = '_stock' AND CAST(postmeta.meta_value AS SIGNED) > '{$nostock}' - " ); - $lowinstock_count = absint( $wpdb->get_var( "SELECT COUNT( DISTINCT posts.ID ) {$query_from};" ) ); - set_transient( $transient_name, $lowinstock_count, DAY_IN_SECONDS * 30 ); - } - - $transient_name = 'wc_outofstock_count'; - - if ( false === ( $outofstock_count = get_transient( $transient_name ) ) ) { - $query_from = apply_filters( 'woocommerce_report_out_of_stock_query_from', "FROM {$wpdb->posts} as posts - INNER JOIN {$wpdb->postmeta} AS postmeta ON posts.ID = postmeta.post_id - INNER JOIN {$wpdb->postmeta} AS postmeta2 ON posts.ID = postmeta2.post_id - WHERE 1=1 - AND posts.post_type IN ( 'product', 'product_variation' ) - AND posts.post_status = 'publish' - AND postmeta2.meta_key = '_manage_stock' AND postmeta2.meta_value = 'yes' - AND postmeta.meta_key = '_stock' AND CAST(postmeta.meta_value AS SIGNED) <= '{$nostock}' - " ); - $outofstock_count = absint( $wpdb->get_var( "SELECT COUNT( DISTINCT posts.ID ) {$query_from};" ) ); - set_transient( $transient_name, $outofstock_count, DAY_IN_SECONDS * 30 ); - } - ?> -
  • - - %s product low in stock', '%s products low in stock', $lowinstock_count, 'woocommerce' ), - $lowinstock_count - ); - ?> - -
  • -
  • - - %s product out of stock', '%s products out of stock', $outofstock_count, 'woocommerce' ), - $outofstock_count - ); - ?> - -
  • - comment_ID, 'rating', true ) ); /* translators: %s: rating */ - echo '
    ' . sprintf( __( '%s out of 5', 'woocommerce' ), $rating ) . '
    '; + echo '
    ' . sprintf( __( '%s out of 5', 'geodirectory' ), $rating ) . '
    '; /* translators: %s: review author */ - echo '

    ' . esc_html( apply_filters( 'woocommerce_admin_dashboard_recent_reviews', $comment->post_title, $comment ) ) . ' ' . sprintf( __( 'reviewed by %s', 'woocommerce' ), esc_html( $comment->comment_author ) ) . '

    '; + echo '

    ' . esc_html( apply_filters( 'geodir_admin_dashboard_recent_reviews', $comment->post_title, $comment ) ) . ' ' . sprintf( __( 'reviewed by %s', 'geodirectory' ), esc_html( $comment->comment_author ) ) . '

    '; echo '
    ' . wp_kses_data( $comment->comment_excerpt ) . ' [...]
    '; } echo '
'; } else { - echo '

' . __( 'There are no product reviews yet.', 'woocommerce' ) . '

'; + echo '

' . __( 'There are no product reviews yet.', 'geodirectory' ) . '

'; } } } diff --git a/includes/admin/settings/class-geodir-settings-analytics.php b/includes/admin/settings/class-geodir-settings-analytics.php index 88bf0a9f3..1e54f6b46 100644 --- a/includes/admin/settings/class-geodir-settings-analytics.php +++ b/includes/admin/settings/class-geodir-settings-analytics.php @@ -25,14 +25,14 @@ class GeoDir_Settings_Analytics extends GeoDir_Settings_Page { public function __construct() { $this->id = 'analytics'; - $this->label = __( 'Google Analytics', 'woocommerce' ); + $this->label = __( 'Google Analytics', 'geodirectory' ); - add_filter( 'woocommerce_settings_tabs_array', array( $this, 'add_settings_page' ), 20 ); - add_action( 'woocommerce_settings_' . $this->id, array( $this, 'output' ) ); - add_action( 'woocommerce_sections_' . $this->id, array( $this, 'output_toggle_advanced' ) ); + add_filter( 'geodir_settings_tabs_array', array( $this, 'add_settings_page' ), 20 ); + add_action( 'geodir_settings_' . $this->id, array( $this, 'output' ) ); + add_action( 'geodir_sections_' . $this->id, array( $this, 'output_toggle_advanced' ) ); - add_action( 'woocommerce_settings_save_' . $this->id, array( $this, 'save' ) ); - add_action( 'woocommerce_sections_' . $this->id, array( $this, 'output_sections' ) ); + add_action( 'geodir_settings_save_' . $this->id, array( $this, 'save' ) ); + add_action( 'geodir_sections_' . $this->id, array( $this, 'output_sections' ) ); } /** @@ -43,13 +43,13 @@ public function __construct() { public function get_sections() { $sections = array( - '' => __( 'General', 'woocommerce' ), - 'display' => __( 'Display', 'woocommerce' ), - 'inventory' => __( 'Inventory', 'woocommerce' ), - 'downloadable' => __( 'Downloadable products', 'woocommerce' ), + '' => __( 'General', 'geodirectory' ), + 'display' => __( 'Display', 'geodirectory' ), + 'inventory' => __( 'Inventory', 'geodirectory' ), + 'downloadable' => __( 'Downloadable products', 'geodirectory' ), ); $sections = array(); - return apply_filters( 'woocommerce_get_sections_' . $this->id, $sections ); + return apply_filters( 'geodir_get_sections_' . $this->id, $sections ); } /** @@ -80,7 +80,7 @@ public function save() { */ public function get_settings( $current_section = '' ) { - $settings = apply_filters( 'woocommerce_product_settings', array( + $settings = apply_filters( 'geodir_product_settings', array( array('name' => __('Google Analytics', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'google_analytic_settings'), @@ -155,7 +155,7 @@ public function get_settings( $current_section = '' ) { )); - return apply_filters( 'woocommerce_get_settings_' . $this->id, $settings, $current_section ); + return apply_filters( 'geodir_get_settings_' . $this->id, $settings, $current_section ); } public static function activation_url(){ diff --git a/includes/admin/settings/class-geodir-settings-cpt-cf-extras.php b/includes/admin/settings/class-geodir-settings-cpt-cf-extras.php index d260479e6..27a1dacec 100644 --- a/includes/admin/settings/class-geodir-settings-cpt-cf-extras.php +++ b/includes/admin/settings/class-geodir-settings-cpt-cf-extras.php @@ -23,21 +23,21 @@ class GeoDir_Settings_Cpt_Cf_Extras { /** * The single instance of the class. * - * @var WooCommerce - * @since 2.1 + * @var GeoDirectory + * @since 2.0.0 */ protected static $_instance = null; /** - * Main WooCommerce Instance. + * Main GeoDirectory Instance. * - * Ensures only one instance of WooCommerce is loaded or can be loaded. + * Ensures only one instance of GeoDirectory is loaded or can be loaded. * - * @since 2.1 + * @since 2.0.0 * @static - * @see WC() - * @return WooCommerce - Main instance. + * @see GeoDir() + * @return GeoDirectory - Main instance. */ public static function instance() { if ( is_null( self::$_instance ) ) { @@ -449,8 +449,8 @@ class="gd-help-tip gd-help-tip-float-none gd-help-tip-no-margin dashicons dashic public static function multiselect_input($output,$result_str,$cf,$field_info){ ob_start(); - $extra = maybe_unserialize($field_info->extra_fields); - $multi_display_type = isset($extra['multi_display_type']) ? $extra['multi_display_type'] : $extra ; + $extra_fields = !empty($field_info->extra_fields) ? maybe_unserialize($field_info->extra_fields) : NULL; + $multi_display_type = isset($extra_fields['multi_display_type']) ? $extra_fields['multi_display_type'] : 'select'; ?>