private static function get_key() { if (self::is_gravityforms_supported()) { return GFCommon::get_key(); } else { return ""; } }
public static function get_addon_info($api, $action, $args) { if ($action == 'plugin_information' && empty($api) && (!rgempty('rg', $_GET) || $args->slug == 'gravityforms')) { $key = GFCommon::get_key(); $raw_response = GFCommon::post_to_manager('api.php', "op=get_plugin&slug={$args->slug}&key={$key}", array()); if (is_wp_error($raw_response) || $raw_response['response']['code'] != 200) { return false; } $plugin = unserialize($raw_response['body']); $api = new stdClass(); $api->name = $plugin['title']; $api->version = $plugin['version']; $api->download_link = $plugin['download_url']; $api->tested = '10.0'; } return $api; }
public static function addons_page() { wp_print_scripts("thickbox"); wp_print_styles(array("thickbox")); $plugins = get_plugins(); $installed_plugins = array(); foreach ($plugins as $key => $plugin) { $is_active = is_plugin_active($key); $installed_plugin = array("plugin" => $key, "name" => $plugin["Name"], "is_active" => $is_active); $installed_plugin["activation_url"] = $is_active ? "" : wp_nonce_url("plugins.php?action=activate&plugin={$key}", "activate-plugin_{$key}"); $installed_plugin["deactivation_url"] = !$is_active ? "" : wp_nonce_url("plugins.php?action=deactivate&plugin={$key}", "deactivate-plugin_{$key}"); $installed_plugins[] = $installed_plugin; } $nonces = self::get_addon_nonces(); $body = array("plugins" => urlencode(serialize($installed_plugins)), "nonces" => urlencode(serialize($nonces)), "key" => GFCommon::get_key()); $options = array('body' => $body, 'headers' => array('Referer' => get_bloginfo("url"))); $request_url = GRAVITY_MANAGER_URL . "/api.php?op=plugin_browser&{$_SERVER["QUERY_STRING"]}"; $raw_response = wp_remote_post($request_url, $options); if (is_wp_error($raw_response) || $raw_response['response']['code'] != 200) { echo "<div class='error' style='margin-top:50px; padding:20px;'>" . __("Add-On brower is currently unavailable. Please try again later.", "gravityforms") . "</div>"; } else { echo GFCommon::get_remote_message(); echo $raw_response["body"]; } }
public static function addons_page() { wp_print_styles(array('thickbox')); $plugins = get_plugins(); $installed_plugins = array(); foreach ($plugins as $key => $plugin) { $is_active = is_plugin_active($key); $installed_plugin = array('plugin' => $key, 'name' => $plugin['Name'], 'is_active' => $is_active); $installed_plugin['activation_url'] = $is_active ? '' : wp_nonce_url("plugins.php?action=activate&plugin={$key}", "activate-plugin_{$key}"); $installed_plugin['deactivation_url'] = !$is_active ? '' : wp_nonce_url("plugins.php?action=deactivate&plugin={$key}", "deactivate-plugin_{$key}"); $installed_plugins[] = $installed_plugin; } $nonces = self::get_addon_nonces(); $body = array('plugins' => urlencode(serialize($installed_plugins)), 'nonces' => urlencode(serialize($nonces)), 'key' => GFCommon::get_key()); $options = array('body' => $body, 'headers' => array('Referer' => get_bloginfo('url')), 'timeout' => 15); $raw_response = GFCommon::post_to_manager('api.php', "op=plugin_browser&{$_SERVER['QUERY_STRING']}", $options); if (is_wp_error($raw_response) || $raw_response['response']['code'] != 200) { echo "<div class='error' style='margin-top:50px; padding:20px;'>" . __('Add-On browser is currently unavailable. Please try again later.', 'gravityforms') . '</div>'; } else { echo GFCommon::get_remote_message(); echo $raw_response['body']; } }
public function ensure_site_registered() { if (!$this->is_site_registered()) { $license_key_md5 = GFCommon::get_key(); if (empty($license_key_md5)) { return false; } $result = $this->add_site($license_key_md5, true); if (!$result || is_wp_error($result)) { return false; } } return array('site_key' => $this->get_site_key(), 'site_secret' => $this->get_site_secret()); }
public static function cache_remote_message() { //Getting version number $key = GFCommon::get_key(); $body = "key={$key}"; $options = array('method' => 'POST', 'timeout' => 3, 'body' => $body); $options['headers'] = array('Content-Type' => 'application/x-www-form-urlencoded; charset=' . get_option('blog_charset'), 'Content-Length' => strlen($body), 'User-Agent' => 'WordPress/' . get_bloginfo("version"), 'Referer' => get_bloginfo("url")); $request_url = GRAVITY_MANAGER_URL . "/message.php?" . GFCommon::get_remote_request_params(); $raw_response = wp_remote_request($request_url, $options); if (is_wp_error($raw_response) || 200 != $raw_response['response']['code']) { $message = ""; } else { $message = $raw_response['body']; } //validating that message is a valid Gravity Form message. If message is invalid, don't display anything if (substr($message, 0, 10) != "<!--GFM-->") { $message = ""; } update_option("rg_gforms_message", $message); }
public static function upgrade_license() { $key = GFCommon::get_key(); $body = "key={$key}"; $options = array('method' => 'POST', 'timeout' => 3, 'body' => $body); $options['headers'] = array('Content-Type' => 'application/x-www-form-urlencoded; charset=' . get_option('blog_charset'), 'Content-Length' => strlen($body), 'User-Agent' => 'WordPress/' . get_bloginfo('version'), 'Referer' => get_bloginfo('url')); $raw_response = GFCommon::post_to_manager('api.php', 'op=upgrade_message&key=' . GFCommon::get_key(), $options); if (is_wp_error($raw_response) || 200 != $raw_response['response']['code']) { $message = ''; } else { $message = $raw_response['body']; } //validating that message is a valid Gravity Form message. If message is invalid, don't display anything if (substr($message, 0, 10) != '<!--GFM-->') { $message = ''; } echo $message; exit; }
public static function upgrade_license() { check_ajax_referer('gf_upgrade_license', 'gf_upgrade_license'); $key = GFCommon::get_key(); $body = "key={$key}"; $options = array('method' => 'POST', 'timeout' => 3, 'body' => $body); $options['headers'] = array('Content-Type' => 'application/x-www-form-urlencoded; charset=' . get_option('blog_charset'), 'Content-Length' => strlen($body), 'User-Agent' => 'WordPress/' . get_bloginfo("version"), 'Referer' => get_bloginfo("url")); $request_url = GRAVITY_MANAGER_URL . "/api.php?op=upgrade_message&key=" . GFCommon::get_key(); $raw_response = wp_remote_request($request_url, $options); if (is_wp_error($raw_response) || 200 != $raw_response['response']['code']) { $message = ""; } else { $message = $raw_response['body']; } //validating that message is a valid Gravity Form message. If message is invalid, don't display anything if (substr($message, 0, 10) != "<!--GFM-->") { $message = ""; } echo $message; exit; }
private function get_key() { if ($this->_is_gravityforms_supported) { return GFCommon::get_key(); } else { return ""; } }
private function get_key() { if (GFAddOn::is_gravityforms_supported($this->_min_gravityforms_version)) { return GFCommon::get_key(); } else { return ""; } }
public static function display_changelog() { if ($_REQUEST["plugin"] != "gravityforms") { return; } $key = GFCommon::get_key(); $body = "key={$key}"; $options = array('method' => 'POST', 'timeout' => 3, 'body' => $body); $options['headers'] = array('Content-Type' => 'application/x-www-form-urlencoded; charset=' . get_option('blog_charset'), 'Content-Length' => strlen($body), 'User-Agent' => 'WordPress/' . get_bloginfo("version"), 'Referer' => get_bloginfo("url")); $raw_response = wp_remote_request(GRAVITY_MANAGER_URL . "/changelog.php?" . GFCommon::get_remote_request_params(), $options); if (is_wp_error($raw_response) || 200 != $raw_response['response']['code']) { $page_text = __("Oops!! Something went wrong.<br/>Please try again or <a href='http://www.gravityforms.com'>contact us</a>.", 'gravityforms'); } else { $page_text = $raw_response['body']; if (substr($page_text, 0, 10) != "<!--GFM-->") { $page_text = ""; } } echo stripslashes($page_text); exit; }