/** * Callback to eliminate any non-registered style * * @since 1.17 Moved to GravityView_Admin_No_Conflict class * * @return void */ function no_conflict_styles() { global $wp_styles; if (!gravityview_is_admin_page()) { return; } // Dequeue other jQuery styles even if no-conflict is off. // Terrible-looking tabs help no one. if (!empty($wp_styles->registered)) { foreach ($wp_styles->registered as $key => $style) { if (preg_match('/^(?:wp\\-)?jquery/ism', $key)) { wp_dequeue_style($key); } } } $no_conflict_mode = GravityView_Settings::getSetting('no-conflict-mode'); // If no conflict is off, jQuery will suffice. if (empty($no_conflict_mode)) { return; } $wp_allowed_styles = array('admin-bar', 'colors', 'ie', 'wp-auth-check', 'media-views', 'thickbox', 'dashicons', 'wp-jquery-ui-dialog', 'jquery-ui-sortable', 'gravityview_settings', 'jquery-qtip.js'); $this->remove_conflicts($wp_styles, $wp_allowed_styles, 'styles'); /** * @action `gravityview_remove_conflicts_after` Runs after no-conflict styles are removed. You can re-add styles here. */ do_action('gravityview_remove_conflicts_after'); }
/** * @return GravityView_Settings */ public static function get_instance() { if (empty(self::$instance)) { self::$instance = new self('get_instance'); } return self::$instance; }
/** * Update the license after fetching it * @param object $license_data * @return void */ private function license_call_update_settings($license_data, $data) { // Update option with passed data license $settings = $this->Addon->get_app_settings(); $settings['license_key'] = $license_data->license_key = trim($data['license']); $settings['license_key_status'] = $license_data->license; $settings['license_key_response'] = (array) $license_data; $this->Addon->update_app_settings($settings); }
function settings($settings) { if (!class_exists('EDD_SL_Plugin_Updater')) { include_once plugin_dir_path(__FILE__) . 'EDD_SL_Plugin_Updater.php'; } if (!class_exists('GravityView_Settings')) { return; } $license = GravityView_Settings::getSetting('license'); // Don't update if invalid license. if (empty($license['status']) || strtolower($license['status']) !== 'valid') { return; } new EDD_SL_Plugin_Updater($this->_remote_update_url, $this->_path, array('version' => $this->_version, 'license' => $license['license'], 'item_name' => $this->_title, 'author' => strip_tags($this->_author))); }
public function validate_license_key($value, $field) { // No license? No status. if (empty($value)) { return NULL; } $response = $this->license_call(array('license' => $this->Addon->get_app_setting('license_key'), 'edd_action' => 'check_license', 'field_id' => $field['name'])); $response = is_string($response) ? json_decode($response, true) : $response; switch ($response['license']) { case 'valid': $return = true; break; case 'invalid': $return = false; //$this->Addon->set_field_error( $field, $response['message'] ); break; default: //$this->Addon->set_field_error( $field, $response['message'] ); $return = false; } return $return; }
/** * Chatlio.com customer support widget */ static function enqueue_feedback_widget() { $script_debug = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min'; $response = GravityView_Settings::getSetting('license_key_response'); $response = wp_parse_args($response, array('license' => '', 'message' => '', 'license_key' => '', 'license_limit' => '', 'expires' => '', 'activations_left' => '', 'site_count' => '', 'payment_id' => '', 'customer_name' => '', 'customer_email' => '')); // This is just HTML we don't need. unset($response['message']); switch (intval($response['license_limit'])) { case 1: $package = 'Sol'; break; case 100: $package = 'Galactic'; break; default: case 3: $package = 'Interstellar'; break; } $chat_settings = array('onlineTitle' => __('Ask GravityView Support', 'gravityview'), 'offlineTitle' => __('GravityView Support', 'gravityview'), 'offlineGreeting' => __('If you have any questions, send us an email and we will get respond to you as soon as possible.', 'gravityview'), 'offlineNamePlaceholder' => __('Your Name', 'gravityview'), "autoResponseMessage" => sprintf(__('Question or comment? We are online and ready to answer! If you don\'t hear back from us, you can send your question to %s', 'gravityview'), '<a href="mailto:support@gravityview.co">support@gravityview.co</a>'), "agentLabel" => __('GravityView Support', 'gravityview'), 'css' => plugins_url('assets/css/feedback.css', GRAVITYVIEW_FILE)); wp_enqueue_script('gravityview-feedback-widget', plugins_url('assets/js/feedback' . $script_debug . '.js', GRAVITYVIEW_FILE), array('jquery'), GravityView_Plugin::version, true); wp_localize_script('gravityview-feedback-widget', 'gvFeedback', array('Valid License?' => ucwords($response['license']), 'License Key' => $response['license_key'], 'License Level' => $package, 'Site Admin Email' => get_bloginfo('admin_email'), 'Support Email' => GravityView_Settings::getSetting('support-email'), 'License Limit' => $response['license_limit'], 'Site Count' => $response['site_count'], 'License Expires' => $response['expires'], 'License Activations Left' => $response['activations_left'], 'Payment ID' => $response['payment_id'], 'Payment Name' => $response['customer_name'], 'Payment Email' => $response['customer_email'], 'chat_settings' => json_encode($chat_settings))); }
/** * Check whether to show Support for a user * * If the user doesn't have the `gravityview_support_port` capability, returns false. * If there is no preference set for the user, use the global plugin setting. * * @since 1.15 * * @param int $user Optional. ID of the user to check, defaults to 0 for current user. * * @return bool Whether to show GravityView support */ public static function show_for_user($user = 0) { if (!GVCommon::has_cap('gravityview_support_port')) { return false; } $pref = get_user_option(self::user_pref_name, $user); // Not set; default to plugin setting if (false === $pref) { return GravityView_Settings::getSetting('support_port'); } return !empty($pref); }
/** * Set delete to true * @since 1.15 */ function _set_up_gravityview_settings($delete_on_uninstall) { $defaults = GravityView_Settings::get_instance()->get_app_settings(); if (NULL === $delete_on_uninstall) { unset($defaults['delete-on-uninstall']); } else { $defaults['delete-on-uninstall'] = $delete_on_uninstall; } update_option('gravityformsaddon_gravityview_app_settings', $defaults); if (NULL !== $delete_on_uninstall) { $this->assertEquals($delete_on_uninstall, GravityView_Settings::get_instance()->get_app_setting('delete-on-uninstall')); } }
/** * Get license information from GravityView * * @since 1.8 (Extension version 1.0.7) * @return bool|array False: GravityView_Settings class does not exist. Array: array of GV license data. */ protected function get_license() { if (!class_exists('GravityView_Settings')) { return false; } $license = GravityView_Settings::getSetting('license'); return $license; }
/** * Callback to eliminate any non-registered style * @return void */ function no_conflict_styles() { global $wp_styles; if (!gravityview_is_admin_page()) { return; } // Dequeue other jQuery styles even if no-conflict is off. // Terrible-looking tabs help no one. if (!empty($wp_styles->registered)) { foreach ($wp_styles->registered as $key => $style) { if (preg_match('/^(?:wp\\-)?jquery/ism', $key)) { wp_dequeue_style($key); } } } $no_conflict_mode = GravityView_Settings::getSetting('no-conflict-mode'); // If no conflict is off, jQuery will suffice. if (empty($no_conflict_mode)) { return; } $wp_allowed_styles = array('debug-bar-extender', 'admin-bar', 'debug-bar', 'debug-bar-codemirror', 'debug-bar-console', 'puc-debug-bar-style', 'colors', 'ie', 'wp-auth-check', 'media-views', 'thickbox', 'dashicons', 'wp-jquery-ui-dialog', 'jquery-ui-sortable', 'gform_tooltip', 'gform_font_awesome', 'gravityview_settings', 'wp-seo-metabox', 'wpseo-admin-media', 'metabox-tabs', 'metabox-classic', 'metabox-fresh', 'genesis_admin_css', 'jquery-qtip.js'); $this->remove_conflicts($wp_styles, $wp_allowed_styles, 'styles'); // Allow settings, etc, to hook in after do_action('gravityview_remove_conflicts_after'); }