diff --git a/includes/Data/Brands.php b/includes/Data/Brands.php index f53d84b3..4bf04be5 100644 --- a/includes/Data/Brands.php +++ b/includes/Data/Brands.php @@ -6,6 +6,12 @@ * Contains Brand information. */ final class Brands { + /** + * Retrieve and sanitize the brand name from the container. + * + * @param Container $container The container object that holds the plugin instance. + * @return string The sanitized brand name + * */ private static function get_brand_name( Container $container ) { $brand_raw_value = $container->plugin()->brand; return \sanitize_title( str_replace( '_', '-', $brand_raw_value ) ); @@ -13,6 +19,7 @@ private static function get_brand_name( Container $container ) { /** * Brand specific data * + * @param Container $container The container object * @return array */ public static function get_config( Container $container ) { @@ -20,78 +27,78 @@ public static function get_config( Container $container ) { switch ( $brand ) { case 'crazy-domains': return array( - 'brand' => 'crazy-domains', - 'name' => 'CrazyDomains', - 'url' => 'https://crazydomains.com', - 'hireExpertsInfo' => 'admin.php?page=crazy-domains#/marketplace/services/blue-sky', - 'support' => 'https://www.crazydomains.in/contact', - 'adminPage' => 'admin.php?page=crazy-domains', - 'setup' => array( + 'brand' => 'crazy-domains', + 'name' => 'CrazyDomains', + 'url' => 'https://crazydomains.com', + 'hireExpertsInfo' => 'admin.php?page=crazy-domains#/marketplace/services/blue-sky', + 'support' => 'https://www.crazydomains.in/contact', + 'adminPage' => 'admin.php?page=crazy-domains', + 'setup' => array( 'payment' => array( 'Paypal' ), 'shipping' => array( 'Shippo' ), ), - 'defaultContact' => array( + 'defaultContact' => array( 'woocommerce_default_country' => 'AU:NSW', 'woocommerce_currency' => 'AUD', ), - 'wondercartBuyNow' => '' + 'wondercartBuyNow' => '', ); case 'bluehost-india': return array( - 'brand' => 'bluehost-india', - 'name' => 'Bluehost', - 'url' => 'https://bluehost.in', - 'hireExpertsInfo' => 'https://www.bluehost.in/solutions/full-service', - 'support' => 'https://helpchat.bluehost.in', - 'adminPage' => 'admin.php?page=bluehost', - 'setup' => array( - 'payment' => array('Paypal', 'Razorpay', 'Stripe'), + 'brand' => 'bluehost-india', + 'name' => 'Bluehost', + 'url' => 'https://bluehost.in', + 'hireExpertsInfo' => 'https://www.bluehost.in/solutions/full-service', + 'support' => 'https://helpchat.bluehost.in', + 'adminPage' => 'admin.php?page=bluehost', + 'setup' => array( + 'payment' => array( 'Paypal', 'Razorpay', 'Stripe' ), 'shipping' => array(), ), - 'defaultContact' => array( + 'defaultContact' => array( 'woocommerce_default_country' => 'IN:AP', 'woocommerce_currency' => 'INR', ), - 'wondercartBuyNow' => '' + 'wondercartBuyNow' => '', ); case 'hostgator': case 'hostgator-latam': return array( - 'brand' => 'hostgator', - 'name' => 'hostgator', - 'url' => 'https://hostgator.com', - 'hireExpertsInfo' => 'admin.php?page=hostgator#/marketplace/services/blue-sky', - 'support' => 'https://www.hostgator.com/contact', - 'adminPage' => 'admin.php?page=hostgator', - 'setup' => array( + 'brand' => 'hostgator', + 'name' => 'hostgator', + 'url' => 'https://hostgator.com', + 'hireExpertsInfo' => 'admin.php?page=hostgator#/marketplace/services/blue-sky', + 'support' => 'https://www.hostgator.com/contact', + 'adminPage' => 'admin.php?page=hostgator', + 'setup' => array( 'payment' => array( 'Paypal', 'Razorpay', 'Stripe' ), 'shipping' => array(), ), - 'defaultContact' => array( + 'defaultContact' => array( 'woocommerce_default_country' => 'BR:AL', 'woocommerce_currency' => 'BRL', ), - 'wondercartBuyNow' => '' + 'wondercartBuyNow' => '', ); case 'bluehost': default: return array( - 'brand' => 'bluehost', - 'name' => 'Bluehost', - 'url' => 'https://bluehost.com', - 'hireExpertsInfo' => 'admin.php?page=bluehost#/marketplace/services/blue-sky', - 'support' => 'https://www.bluehost.com/contact', - 'adminPage' => 'admin.php?page=bluehost', - 'setup' => array( - 'payment' => array('Paypal', 'Razorpay', 'Stripe'), - 'shipping' => array('Shippo'), + 'brand' => 'bluehost', + 'name' => 'Bluehost', + 'url' => 'https://bluehost.com', + 'hireExpertsInfo' => 'admin.php?page=bluehost#/marketplace/services/blue-sky', + 'support' => 'https://www.bluehost.com/contact', + 'adminPage' => 'admin.php?page=bluehost', + 'setup' => array( + 'payment' => array( 'Paypal', 'Razorpay', 'Stripe' ), + 'shipping' => array( 'Shippo' ), ), - 'defaultContact' => array( + 'defaultContact' => array( 'woocommerce_default_country' => 'US:AZ', 'woocommerce_currency' => 'USD', ), - 'wondercartBuyNow' => 'https://my.bluehost.com/hosting/app?utm_source=wp-marketplace&utm_medium=brand-plugin&utm_campaign=wordpress-ad&utm_content=buynow#/marketplace/product' + 'wondercartBuyNow' => 'https://my.bluehost.com/hosting/app?utm_source=wp-marketplace&utm_medium=brand-plugin&utm_campaign=wordpress-ad&utm_content=buynow#/marketplace/product', ); } } diff --git a/includes/Data/Plugins.php b/includes/Data/Plugins.php index c2802b61..9346c406 100644 --- a/includes/Data/Plugins.php +++ b/includes/Data/Plugins.php @@ -4,111 +4,122 @@ /** * List of Plugin Slugs/Files */ -final class Plugins -{ +final class Plugins { + /** + * An associative array of free plugins with their corresponding admin page URLs and file paths. + * + * @var array> $free_plugins + */ public static $free_plugins = array( - 'jetpack' => array( - 'url' => 'admin.php?page=jetpack#/dashboard', + 'jetpack' => array( + 'url' => 'admin.php?page=jetpack#/dashboard', 'file' => 'jetpack/jetpack.php', ), - 'jetpack-boost' => array( - 'url' => 'admin.php?page=jetpack-boost', + 'jetpack-boost' => array( + 'url' => 'admin.php?page=jetpack-boost', 'file' => 'jetpack-boost/jetpack-boost.php', ), - 'wordpress-seo' => array( - 'url' => 'admin.php?page=wpseo_dashboard', + 'wordpress-seo' => array( + 'url' => 'admin.php?page=wpseo_dashboard', 'file' => 'wordpress-seo/wp-seo.php', ), - 'wpforms-lite' => array( - 'url' => 'admin.php?page=wpforms-overview', + 'wpforms-lite' => array( + 'url' => 'admin.php?page=wpforms-overview', 'file' => 'wpforms-lite/wpforms.php', ), - 'google-analytics-for-wordpress' => array( - 'url' => 'admin.php?page=monsterinsights_reports', + 'google-analytics-for-wordpress' => array( + 'url' => 'admin.php?page=monsterinsights_reports', 'file' => 'google-analytics-for-wordpress/googleanalytics.php', ), - 'optinmonster' => array( - 'url' => 'admin.php?page=optin-monster-dashboard', + 'optinmonster' => array( + 'url' => 'admin.php?page=optin-monster-dashboard', 'file' => 'optinmonster/optin-monster-wp-api.php', ), 'creative-mail-by-constant-contact' => array( - 'url' => 'admin.php?page=creativemail', + 'url' => 'admin.php?page=creativemail', 'file' => 'creative-mail-by-constant-contact/creative-mail-plugin.php', ), ); - + /** + * An associative array of supported plugins with their corresponding file paths and admin page URLs. + * + * @var array> $supported_plugins + */ public static $supported_plugins = array( - 'woocommerce' => array( + 'woocommerce' => array( 'file' => 'woocommerce/woocommerce.php', - 'url' => 'admin.php?page=wc-settings', + 'url' => 'admin.php?page=wc-settings', ), 'nfd_slug_yith_woocommerce_customize_myaccount_page' => array( 'file_extended' => 'yith-woocommerce-customize-myaccount-page-extended/init.php', - 'file_premium' => 'yith-woocommerce-customize-myaccount-page-premium/init.php', - 'file' => 'yith-woocommerce-customize-myaccount-page/init.php', - 'url' => 'admin.php?page=yith_wcmap_panel', + 'file_premium' => 'yith-woocommerce-customize-myaccount-page-premium/init.php', + 'file' => 'yith-woocommerce-customize-myaccount-page/init.php', + 'url' => 'admin.php?page=yith_wcmap_panel', ), - 'nfd_slug_yith_woocommerce_gift_cards' => array( + 'nfd_slug_yith_woocommerce_gift_cards' => array( 'file_extended' => 'yith-woocommerce-gift-cards-extended/init.php', - 'file_premium' => 'yith-woocommerce-gift-cards-premium/init.php', - 'file' => 'yith-woocommerce-gift-cards/init.php', - 'url' => 'admin.php?page=yith_woocommerce_gift_cards_panel', + 'file_premium' => 'yith-woocommerce-gift-cards-premium/init.php', + 'file' => 'yith-woocommerce-gift-cards/init.php', + 'url' => 'admin.php?page=yith_woocommerce_gift_cards_panel', ), - 'nfd_slug_yith_woocommerce_wishlist' => array( + 'nfd_slug_yith_woocommerce_wishlist' => array( 'file_extended' => 'yith-woocommerce-wishlist-extended/init.php', - 'file_premium' => 'yith-woocommerce-wishlist-premium/init.php', - 'file' => 'yith-woocommerce-wishlist/init.php', - 'url' => 'admin.php?page=yith_wcwl_panel', + 'file_premium' => 'yith-woocommerce-wishlist-premium/init.php', + 'file' => 'yith-woocommerce-wishlist/init.php', + 'url' => 'admin.php?page=yith_wcwl_panel', ), - 'nfd_slug_yith_woocommerce_ajax_product_filter' => array( + 'nfd_slug_yith_woocommerce_ajax_product_filter' => array( 'file_extended' => 'yith-woocommerce-ajax-product-filter-extended/init.php', - 'file_premium' => 'yith-woocommerce-ajax-product-filter-premium/init.php', - 'file' => 'yith-woocommerce-ajax-product-filter/init.php', - 'url' => 'admin.php?page=yith_wcan_panel', + 'file_premium' => 'yith-woocommerce-ajax-product-filter-premium/init.php', + 'file' => 'yith-woocommerce-ajax-product-filter/init.php', + 'url' => 'admin.php?page=yith_wcan_panel', ), - 'nfd_slug_yith_woocommerce_booking' => array( + 'nfd_slug_yith_woocommerce_booking' => array( 'file_extended' => 'yith-woocommerce-booking-extended/init.php', - 'file_premium' => 'yith-woocommerce-booking-premium/init.php', - 'file' => 'yith-woocommerce-booking/init.php', - 'url' => 'admin.php?page=yith_wcbk_panel', + 'file_premium' => 'yith-woocommerce-booking-premium/init.php', + 'file' => 'yith-woocommerce-booking/init.php', + 'url' => 'admin.php?page=yith_wcbk_panel', ), - 'yith-woocommerce-ajax-search' => array( + 'yith-woocommerce-ajax-search' => array( 'file_extended' => 'yith-woocommerce-ajax-search-extended/init.php', - 'file_premium' => 'yith-woocommerce-ajax-search-premium/init.php', - 'file' => 'yith-woocommerce-ajax-search/init.php', - 'url' => 'admin.php?page=yith_wcas_panel', + 'file_premium' => 'yith-woocommerce-ajax-search-premium/init.php', + 'file' => 'yith-woocommerce-ajax-search/init.php', + 'url' => 'admin.php?page=yith_wcas_panel', ), 'nfd_slug_yith_shippo_shippings_for_woocommerce' => array( 'file' => 'yith-shippo-shippings-for-woocommerce-extended/init.php', - 'url' => 'admin.php?page=yith_shippo_shipping_for_woocommerce', + 'url' => 'admin.php?page=yith_shippo_shipping_for_woocommerce', ), - 'nfd_slug_yith_paypal_payments_for_woocommerce' => array( + 'nfd_slug_yith_paypal_payments_for_woocommerce' => array( 'file' => 'yith-paypal-payments-for-woocommerce-extended/init.php', - 'url' => 'admin.php?page=yith_paypal_payments', + 'url' => 'admin.php?page=yith_paypal_payments', ), - 'nfd_slug_ecomdash_wordpress_plugin' => array( + 'nfd_slug_ecomdash_wordpress_plugin' => array( 'file' => 'ecomdash-wordpress-plugin/ecomdash-plugin.php', - 'url' => 'admin.php?page=newfold-ecomdash', + 'url' => 'admin.php?page=newfold-ecomdash', ), - 'nfd_slug_woo_razorpay' => array( + 'nfd_slug_woo_razorpay' => array( 'file' => 'woo-razorpay/woo-razorpay.php', - 'url' => 'admin.php?page=wc-settings&tab=checkout§ion=razorpay', + 'url' => 'admin.php?page=wc-settings&tab=checkout§ion=razorpay', ), - 'nfd_slug_wonder_cart' => array( + 'nfd_slug_wonder_cart' => array( 'file' => 'wonder-cart/init.php', - 'url' => 'admin.php?page=wonder-cart', + 'url' => 'admin.php?page=wonder-cart', + ), + 'nfd_slug_yith_stripe_payments_for_woocommerce' => array( + 'file' => 'yith-stripe-payments-for-woocommerce-extended/init.php', + 'url' => 'admin.php?page=yith_stripe_payments_panel', ), - 'nfd_slug_yith_stripe_payments_for_woocommerce' => array( - 'file' => 'yith-stripe-payments-for-woocommerce-extended/init.php', - 'url' => 'admin.php?page=yith_stripe_payments_panel', - ) ); - public static function supported_plugins() - { - return array_merge(Plugins::$supported_plugins, Plugins::$free_plugins); + /** + * Get a merged array of supported and free plugins. + * + * @return array> A combined array of supported and free plugins. + */ + public static function supported_plugins() { + return array_merge( self::$supported_plugins, self::$free_plugins ); } - -} \ No newline at end of file +} diff --git a/includes/ECommerce.php b/includes/ECommerce.php index ada2a494..97882c62 100644 --- a/includes/ECommerce.php +++ b/includes/ECommerce.php @@ -106,8 +106,8 @@ public function __construct( Container $container ) { add_filter( 'manage_edit-page_sortable_columns', array( $this, 'sortable_columns' ) ); add_action( 'wp_login', array( $this, 'show_store_setup' ) ); add_action( 'auth_cookie_expired', array( $this, 'show_store_setup' ) ); - add_action('admin_head', array( $this, 'hide_wp_pointer_with_css' ) ); - add_action('admin_enqueue_scripts', array( $this, 'set_wpnav_collapse_setting')); + add_action( 'admin_head', array( $this, 'hide_wp_pointer_with_css' ) ); + add_action( 'admin_enqueue_scripts', array( $this, 'set_wpnav_collapse_setting' ) ); add_action('admin_footer', array( $this, 'remove_woocommerce_ssl_notice' ), 20); if ( ( $container->plugin()->id === 'bluehost' && ( $canAccessGlobalCTB || $hasYithExtended ) ) || ( $container->plugin()->id === 'hostgator' && $hasYithExtended ) ) { @@ -198,7 +198,7 @@ public static function add_filters( $tags, $function_to_add, $priority = 10, $ac } /** - * Set the wpnav_collapse setting + * Set the wpnav_collapse setting */ public function set_wpnav_collapse_setting() { @@ -461,7 +461,7 @@ public function custom_product_general_options() { wp_enqueue_style( 'Create_a_Promotion', NFD_ECOMMERCE_PLUGIN_URL . 'vendor/newfold-labs/wp-module-ecommerce/includes/Promotions.css', array(), '1.0', 'all' ); echo ''; } @@ -627,7 +627,7 @@ public function remove_woocommerce_ssl_notice() { * @param array $columns Array of column names for posts/pages */ public function custom_status_column( $columns ) { - if ( 'product' != get_post_type() && 1 == get_option( 'onboarding_experience_level' ) ) { + if ( 'product' !== get_post_type() && 1 == get_option( 'onboarding_experience_level' ) ) { // Add 'Status' column after 'Title' $columns['status'] = __( 'Status', 'wp-module-ecommerce' ); } @@ -659,14 +659,14 @@ public function custom_status_column_content( $column_name, $post_id ) { $label_text = __( 'Published - Private', 'wp-module-ecommerce' ); } else { $background_color = '#E8ECF0'; - $label_text = __( $post_status, 'wp-module-ecommerce' ); + $label_text = $post_status; } // Check if coming soon option is enabled $coming_soon = get_option( 'nfd_coming_soon' ); if ( $coming_soon ) { $background_color = '#E8ECF0'; } - echo '' . $label_text . '
' . __( 'Last Modified', 'wp-module-ecommerce' ) . ' : ' . mysql2date( 'Y/m/d \a\t g:i a', $post_date ); + echo '' . esc_html( $label_text ) . '
' . esc_html( __( 'Last Modified', 'wp-module-ecommerce' ) ) . ' : ' . esc_html( mysql2date( 'Y/m/d \a\t g:i a', $post_date ) ); } } @@ -680,8 +680,8 @@ public function sortable_columns( $columns ) { return $columns; } - /* - * On login, it checks whether to show the migration steps, post migration to user + /** + * On login, it checks whether to show the migration steps, post migration to user */ public function show_store_setup() { $site_url = get_option( 'siteurl', false ); @@ -716,7 +716,6 @@ function check_url_match( $brand_name, $site_url ) { * * @return void */ - public function hide_wp_pointer_with_css() { echo '