plugin = $plugin; $this->name = $plugin_name; $this->plugin_text_domain = $text_domain; if ($this->isPluginPage() || !$this->isDevelopmentSite()) { add_action('admin_print_scripts', array($this, 'js'), 20); add_action('admin_print_scripts', array($this, 'css')); add_action('admin_footer', array($this, 'modal')); } return NULL; } /** * Print the required js */ function js() { $display_name = ''; if (is_user_logged_in()) { if (function_exists('wp_get_current_user')) { $user = wp_get_current_user(); } elseif (function_exists('get_currentuserinfo')) { $user = get_currentuserinfo(); } if (!empty($user)) { $display_name = isset($user->display_name) ? $user->display_name : ''; } } ?> array( 'title' => esc_html__('Upgrading to PRO.', $this->plugin_text_domain), 'reason' => 'Upgrading to PRO.' ), 2 => array( 'title' => esc_html__('I am switching to a different discount plugin.', $this->plugin_text_domain), 'reason' => 'I am switching to a different discount plugin.' ), 3 => array( 'title' => esc_html__('I could not get my discount rule to work.', $this->plugin_text_domain), 'reason' => 'I could not get my discount rule to work.' ), 4 => array( 'title' => esc_html__('It does not meet my discount requirements.', $this->plugin_text_domain), 'reason' => 'It does not meet my discount requirements.' ), 5 => array( 'title' => esc_html__('Plugin is complex.', $this->plugin_text_domain), 'reason' => 'Plugin is complex.' ), 6 => array( 'title' => esc_html__('I\'m trying to troubleshoot the plugin.', $this->plugin_text_domain), 'reason' => 'I\'m trying to troubleshoot the plugin.' ), 7 => array( 'title' => esc_html__('I was instructed to deactivate by Flycart Support.', $this->plugin_text_domain), 'reason' => 'I was instructed to deactivate by Flycart Support.' ), 8 => array( 'title' => esc_html__('I no longer use this plugin.', $this->plugin_text_domain), 'reason' => 'I no longer use this plugin.' ), 9 => array( 'title' => esc_html__('It\'s a temporary deactivation.', $this->plugin_text_domain), 'reason' => 'It\'s a temporary deactivation.' ), 10 => array( 'title' => esc_html__('Other', $this->plugin_text_domain), 'reason' => 'Other', 'details' => esc_html__('Please share the reason', $this->plugin_text_domain), ), ); ?>
plugin_text_domain); ?> plugin_text_domain), esc_html__('Discount Rules for WooCommerce', $this->plugin_text_domain) ); ?>
$option) : ?>
id) && in_array($screen->id, array('plugins', 'plugins-network'), true)); } /** * Checks if current site is a development one. * @return bool */ public function isDevelopmentSite() { // If it is an AM dev site, return false, so we can see them on our dev sites. if (defined('AWESOMEMOTIVE_DEV_MODE') && AWESOMEMOTIVE_DEV_MODE) { return false; } $url = network_site_url('/'); $is_local_url = false; // Trim it up $url = strtolower(trim($url)); // Need to get the host...so let's add the scheme so we can use parse_url if (false === strpos($url, 'http://') && false === strpos($url, 'https://')) { $url = 'http://' . $url; } $url_parts = parse_url($url); $host = !empty($url_parts['host']) ? $url_parts['host'] : false; if (!empty($url) && !empty($host)) { if (false !== ip2long($host)) { if (!filter_var($host, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) { $is_local_url = true; } } else if ('localhost' === $host) { $is_local_url = true; } $tlds_to_check = array('.dev', '.local', ':8888'); foreach ($tlds_to_check as $tld) { if (false !== strpos($host, $tld)) { $is_local_url = true; continue; } } if (substr_count($host, '.') > 1) { $subdomains_to_check = array('dev.', '*.staging.', 'beta.', 'test.'); foreach ($subdomains_to_check as $subdomain) { $subdomain = str_replace('.', '(.)', $subdomain); $subdomain = str_replace(array('*', '(.)'), '(.*)', $subdomain); if (preg_match('/^(' . $subdomain . ')/', $host)) { $is_local_url = true; continue; } } } } return $is_local_url; } }