本文整理匯總了PHP中GFCommon::get_version_info方法的典型用法代碼示例。如果您正苦於以下問題:PHP GFCommon::get_version_info方法的具體用法?PHP GFCommon::get_version_info怎麽用?PHP GFCommon::get_version_info使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類GFCommon
的用法示例。
在下文中一共展示了GFCommon::get_version_info方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: premium_update
public function premium_update($premium_update)
{
if (!function_exists('get_plugin_data')) {
include_once ABSPATH . 'wp-admin/includes/plugin.php';
}
$update = GFCommon::get_version_info();
if ($update["is_valid_key"] == true && version_compare($this->_version, $update["version"], '<')) {
$plugin_data = get_plugin_data($this->_full_path);
$plugin_data['slug'] = $this->_path;
$plugin_data['type'] = 'plugin';
$plugin_data['url'] = isset($update["url"]) ? $update["url"] : false;
// OR provide your own callback function for managing the update
array_push($premium_update, $plugin_data);
}
return $premium_update;
}
示例2: ddw_gftb_update_available
/**
* Gravity Forms version compare for update check.
*
* @since 1.3.0
*
* @uses GFCommon::get_version_info()
*
* @return version string
*/
function ddw_gftb_update_available()
{
/** Check if Gravity Forms is active - class 'GFCommon' available */
if (class_exists('GFCommon')) {
$version_info = GFCommon::get_version_info();
return version_compare(GFCommon::$version, $version_info["version"], '<');
}
// end if class check
}
示例3: dashboard_update_message
public static function dashboard_update_message()
{
$version_info = GFCommon::get_version_info();
//don't display a message if use has dismissed the message for this version
$ary_dismissed = get_option("gf_dismissed_upgrades");
$is_dismissed = !empty($ary_dismissed) && in_array($version_info["version"], $ary_dismissed);
if ($is_dismissed) {
return;
}
if (version_compare(GFCommon::$version, $version_info["version"], '<')) {
$auto_upgrade = "";
/*if($version_info["is_valid_key"]){
$plugin_file = "gravityforms/gravityforms.php";
$upgrade_url = wp_nonce_url('update.php?action=upgrade-plugin&plugin=' . urlencode($plugin_file), 'upgrade-plugin_' . $plugin_file);
$auto_upgrade = sprintf(__(" or %sUpgrade Automatically%s", "gravityforms"), "<a href='{$upgrade_url}'>", "</a>");
}*/
$message = sprintf(__("There is an update available for Gravity Forms. %sView Details%s %s", "gravityforms"), "<a href='admin.php?page=gf_update'>", "</a>", $auto_upgrade);
?>
<div class='updated' style='padding:15px; position:relative;' id='gf_dashboard_message'><?php
echo $message;
?>
<a href="javascript:void(0);" onclick="AlienDismissUpgrade();" style='float:right;'><?php
_e("Dismiss", "gravityforms");
?>
</a>
</div>
<script type="text/javascript">
function AlienDismissUpgrade(){
jQuery("#gf_dashboard_message").slideUp();
jQuery.post(ajaxurl, {action:"rg_dismiss_upgrade", version:"<?php
echo $version_info["version"];
?>
", cookie: encodeURIComponent(document.cookie)});
}
</script>
<?php
}
}
示例4: has_update
public static function has_update($use_cache = true)
{
$version_info = GFCommon::get_version_info($use_cache);
return version_compare(GFCommon::$version, $version_info["version"], '<');
}
示例5: gravityforms_settings_page
public static function gravityforms_settings_page()
{
global $wpdb;
if (!GFCommon::ensure_wp_version()) {
return;
}
if (isset($_GET['setup'])) {
//forcing setup
RGForms::setup(true);
}
require_once 'currency.php';
if (isset($_POST['submit'])) {
check_admin_referer('gforms_update_settings', 'gforms_update_settings');
if (!GFCommon::current_user_can_any('gravityforms_edit_settings')) {
die(esc_html__("You don't have adequate permission to edit settings.", 'gravityforms'));
}
RGFormsModel::save_key(sanitize_text_field($_POST['gforms_key']));
update_option('rg_gforms_disable_css', (bool) rgpost('gforms_disable_css'));
update_option('rg_gforms_enable_html5', (bool) rgpost('gforms_enable_html5'));
update_option('gform_enable_noconflict', (bool) rgpost('gform_enable_noconflict'));
update_option('gform_enable_background_updates', (bool) rgpost('gform_enable_background_updates'));
update_option('rg_gforms_enable_akismet', self::get_posted_akismet_setting());
// do not cast to bool, option is enabled by default; need a "1" or a "0"
update_option('rg_gforms_captcha_public_key', sanitize_text_field(rgpost('gforms_captcha_public_key')));
update_option('rg_gforms_captcha_private_key', sanitize_text_field(rgpost('gforms_captcha_private_key')));
if (!rgempty('gforms_currency') && in_array(rgpost('gforms_currency'), array_keys(RGCurrency::get_currencies()))) {
update_option('rg_gforms_currency', rgpost('gforms_currency'));
}
//Updating message because key could have been changed
GFCommon::cache_remote_message();
//Re-caching version info
$version_info = GFCommon::get_version_info(false);
?>
<div class="updated fade" style="padding:6px;">
<?php
esc_html_e('Settings Updated', 'gravityforms');
?>
.
</div>
<?php
}
if (!isset($version_info)) {
$version_info = GFCommon::get_version_info();
}
self::page_header(__('General Settings', 'gravityforms'), '');
?>
<form method="post">
<?php
wp_nonce_field('gforms_update_settings', 'gforms_update_settings');
?>
<h3><span><i class="fa fa-cogs"></i> <?php
esc_html_e('General Settings', 'gravityforms');
?>
</span></h3>
<table class="form-table">
<tr valign="top">
<th scope="row">
<label for="gforms_key"><?php
esc_html_e('Support License Key', 'gravityforms');
?>
</label> <?php
gform_tooltip('settings_license_key');
?>
</th>
<td>
<?php
$key = GFCommon::get_key();
$key_field = '<input type="password" name="gforms_key" id="gforms_key" style="width:350px;" value="' . $key . '" />';
if (!rgempty('is_error', $version_info)) {
$key_field .= " <img src='" . GFCommon::get_base_url() . "/images/exclamation.png' class='gf_keystatus_error gf_tooltip' alt='There was an error validating your key' title='<h6>" . esc_attr__('Validation Error', 'gravityforms') . '</h6>' . esc_attr__('There was an error while validating your license key. Gravity Forms will continue to work, but automatic upgrades will not be available. Please contact support to resolve this issue.', 'gravityforms') . "'/>";
} else {
if (rgar($version_info, 'is_valid_key')) {
$key_field .= " <i class='fa fa-check gf_keystatus_valid'></i> <span class='gf_keystatus_valid_text'>" . esc_html__('Valid Key : Your license key has been successfully validated.', 'gravityforms') . '</span>';
} else {
if (!empty($key)) {
$key_field .= " <i class='fa fa-times gf_keystatus_invalid'></i> <span class='gf_keystatus_invalid_text'>" . esc_html__('Invalid or Expired Key : Please make sure you have entered the correct value and that your key is not expired.', 'gravityforms') . '</span>';
}
}
}
echo apply_filters('gform_settings_key_field', $key_field);
?>
<br />
<span class="gf_settings_description"><?php
esc_html_e('The license key is used for access to automatic upgrades and support.', 'gravityforms');
?>
</span>
</td>
</tr>
<tr valign="top">
<th scope="row">
<label for="gforms_disable_css"><?php
esc_html_e('Output CSS', 'gravityforms');
?>
</label> <?php
gform_tooltip('settings_output_css');
?>
</th>
<td>
<input type="radio" name="gforms_disable_css" value="0" id="gforms_css_output_enabled" <?php
echo get_option('rg_gforms_disable_css') == 1 ? '' : "checked='checked'";
//.........這裏部分代碼省略.........
示例6: has_update
public static function has_update($use_cache = true)
{
$version_info = GFCommon::get_version_info($use_cache);
$version = rgar($version_info, 'version');
return empty($version) ? false : version_compare(GFCommon::$version, $version, '<');
}
示例7: gravityforms_settings_page
public static function gravityforms_settings_page()
{
global $wpdb;
if (!GFCommon::ensure_wp_version()) {
return;
}
if (isset($_GET["setup"])) {
//forcing setup
RGForms::setup(true);
}
if (isset($_POST["submit"])) {
check_admin_referer('gforms_update_settings', 'gforms_update_settings');
if (!GFCommon::current_user_can_any("gravityforms_edit_settings")) {
die(__("You don't have adequate permission to edit settings.", "gravityforms"));
}
RGFormsModel::save_key($_POST["gforms_key"]);
update_option("rg_gforms_disable_css", $_POST["gforms_disable_css"]);
update_option("rg_gforms_enable_html5", $_POST["gforms_enable_html5"]);
update_option("rg_gforms_captcha_public_key", $_POST["gforms_captcha_public_key"]);
update_option("rg_gforms_captcha_private_key", $_POST["gforms_captcha_private_key"]);
if (!rgempty("gforms_currency")) {
update_option("rg_gforms_currency", rgpost("gforms_currency"));
}
//Updating message because key could have been changed
GFCommon::cache_remote_message();
//Re-caching version info
$version_info = GFCommon::get_version_info(false);
?>
<div class="updated fade" style="padding:6px;">
<?php
_e("Settings Updated", "gravityforms");
?>
.
</div>
<?php
} else {
if (isset($_POST["uninstall"])) {
if (!GFCommon::current_user_can_any("gravityforms_uninstall") || function_exists("is_multisite") && is_multisite() && !is_super_admin()) {
die(__("You don't have adequate permission to uninstall Gravity Forms.", "gravityforms"));
}
//droping all tables
RGFormsModel::drop_tables();
//removing options
delete_option("rg_form_version");
delete_option("rg_gforms_key");
delete_option("rg_gforms_disable_css");
delete_option("rg_gforms_enable_html5");
delete_option("rg_gforms_captcha_public_key");
delete_option("rg_gforms_captcha_private_key");
delete_option("rg_gforms_message");
delete_option("gf_dismissed_upgrades");
delete_option("rg_gforms_currency");
//removing gravity forms upload folder
GFCommon::delete_directory(RGFormsModel::get_upload_root());
//Deactivating plugin
$plugin = "gravityforms/gravityforms.php";
deactivate_plugins($plugin);
update_option('recently_activated', array($plugin => time()) + (array) get_option('recently_activated'));
?>
<div class="updated fade" style="padding:20px;"><?php
echo sprintf(__("Gravity Forms have been successfully uninstalled. It can be re-activated from the %splugins page%s.", "gravityforms"), "<a href='plugins.php'>", "</a>");
?>
</div>
<?php
return;
}
}
if (!isset($version_info)) {
$version_info = GFCommon::get_version_info();
}
?>
<form method="post">
<?php
wp_nonce_field('gforms_update_settings', 'gforms_update_settings');
?>
<h3><?php
_e("General Settings", "gravityforms");
?>
</h3>
<table class="form-table">
<tr valign="top">
<th scope="row"><label for="gforms_key"><?php
_e("Support License Key", "gravityforms");
?>
</label> <?php
gform_tooltip("settings_license_key");
?>
</th>
<td>
<?php
$key = GFCommon::get_key();
$key_field = '<input type="password" name="gforms_key" id="gforms_key" style="width:350px;" value="' . $key . '" />';
if ($version_info["is_valid_key"]) {
$key_field .= " <img src='" . GFCommon::get_base_url() . "/images/tick.png' class='gf_keystatus_valid' alt='valid key' title='valid key'/>";
} else {
if (!empty($key)) {
$key_field .= " <img src='" . GFCommon::get_base_url() . "/images/cross.png' class='gf_keystatus_invalid' alt='invalid key' title='invalid key'/>";
}
}
echo apply_filters('gform_settings_key_field', $key_field);
//.........這裏部分代碼省略.........
示例8: drop_cache
public static function drop_cache()
{
if (rgget("page") == "gf_drop_cache") {
GFCommon::cache_remote_message();
GFCommon::get_version_info(false);
}
}
示例9: get_version_info
private function get_version_info($offering, $use_cache=true){
$version_info = GFCommon::get_version_info($use_cache);
$is_valid_key = $version_info["is_valid_key"] && rgars($version_info, "offerings/{$offering}/is_available");
$info = array("is_valid_key" => $is_valid_key, "version" => rgars($version_info, "offerings/{$offering}/version"), "url" => rgars($version_info, "offerings/{$offering}/url"));
return $info;
}
示例10: install
function install()
{
if ($this->license_key) {
$key = trim($this->license_key);
update_option('rg_gforms_key', md5($key));
$version_info = GFCommon::get_version_info(false);
}
}
示例11: get_version_info
private function get_version_info($offering, $use_cache = true)
{
$version_info = GFCommon::get_version_info($use_cache);
$is_valid_key = rgar($version_info, 'is_valid_key') && rgars($version_info, "offerings/{$offering}/is_available");
$info = array('is_valid_key' => $is_valid_key, 'version' => rgars($version_info, "offerings/{$offering}/version"), 'url' => rgars($version_info, "offerings/{$offering}/url"));
return $info;
}
示例12: mass_import_handler
function mass_import_handler()
{
global $wpdb;
$frmarr = get_me_all_forms();
//add_action('admin_print_scripts', 'the_admin_scripts');
//add_action('admin_print_styles', 'the_admin_styles');
?>
<div style="padding: 5px 0 20px 0;"><img style="float:left;padding-right: 20px;" src="http://aryanduntley.com/wp-content/plugins/gravityforms/images/gravity-edit-icon-32.png"><h1>Import CSV</h1>
<?php
$version_info = GFCommon::get_version_info(false);
if (version_compare("1.9", $version_info['version'], '<')) {
?>
<h2>This plugin does not support your version of Gravity Forms.</h2><p>Since I no longer support this plugin and will not make changes to compensate for the code changes in Gravity Forms 1.9+, for those of you wishing to continue using Gravity Forms and need similar functionality, you can visit <a href="https://gravityview.co/extensions/gravity-forms-entry-importer/?ref=141" target="_blank">GravityView.Co</a>. They have developed a 1.9+ importer for gravity forms, along with many other gravity forms addons.</p>
<?php
}
?>
<h2>choose which form you wish to import into:</h2></div>
<div style="clear:both;padding-bottom:20px"><form style="float: left; padding-left: 20px;" action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank"><input type="hidden" name="cmd" value="_s-xclick" /><input type="hidden" name="cpp_header_image" value="http://aryanduntley.com/donatemy.png" /><input type="hidden" name="page_style" value="paypal" /><input type="hidden" name="cpp_logo_image" value="http://aryanduntley.com/donatemy.png" /><input type="hidden" name="cpp_payflow_color" value="#FAFAFA" /><input type="hidden" name="cn" value="Feel free to add any notes or comments about the plugin! Please name the plugin you are donating to so I can keep track of which are most valuable to users." /><input type="hidden" name="cpp_headerback_color" value="#F0F0F0" /><input type="hidden" name="hosted_button_id" value="ZXSGVRM9DWEUY" /><input type="image" name="submit" src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" alt="PayPal - The safer, easier way to pay online!" /><img src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" alt="" width="1" height="1" border="0" /></form></div>
<p>
<label style="float:left;padding-top:3px;">Select which form you would like to import into</label>
<select id="myList" style="float:left; margin-left: 20px">
<option value = "" disabled="true" selected="true"> Select One...</option>
<?php
for ($r = 0; $r < sizeof($frmarr); $r++) {
echo '<option value=' . $frmarr[$r]['id'] . '>' . $frmarr[$r]['title'] . '</option>';
}
?>
</select>
</p>
<div style="clear:both"></div>
<div class="showstuff"></div>
<div style="clear:both"></div>
<div id="up_load_er"></div>
<?php
if (isset($_POST['mode'])) {
if ($_POST['mode'] == "submit") {
require 'parsecsv.lib.php';
if (isset($_POST['formnum'])) {
//$arr_rows = file($_FILES['csv_file']['tmp_name']);//You can use file_get_contents() to return the contents of a file as a string.
$entry_tracking_table = $wpdb->prefix . "rg_lead";
//This first in order to track lead_id for rest.
$entry_standard_stuff = $wpdb->prefix . "rg_lead_meta";
$actual_entry_data = $wpdb->prefix . "rg_lead_detail";
//$lastnum = $wpdb->get_col( $wpdb->prepare("SELECT * FROM $entry_tracking_table",0) );
//CHange here provided by @eselk from wordpress.org on this plugin's support page
$lastnum = $wpdb->get_col($wpdb->prepare("SELECT * FROM {$entry_tracking_table} order by id desc limit 1", 0));
//print ($lastnum[sizeof($lastnum)-1]);
$formnum = $_POST['formnum'];
//echo ("<div class='updated'>All users appear to be have been imported successfully.<br/>".$formnum."</div>");
$ararr = apply_filters('massimport_getfields', $formnum);
//require('../../../wp-load.php');
$csv = new parseCSV();
$csv->last_form_id = max($lastnum);
//$lastnum[sizeof($lastnum)-1];
$csv->form_using = $formnum;
$csv->actHeaders = $ararr;
//$retarn = $csv->auto($_FILES['csv_file']['tmp_name'], true, null, ',', '"');
$retarn = $csv->parse_file($_FILES['csv_file']['tmp_name']);
//stuff here;
echo '<div class="updated" style="padding-bottom:10px;">' . $retarn . '</div>';
} else {
echo '<div class="updated" style="color: red;">It seems the file was not uploaded correctly.</div>';
}
}
}
}
示例13: update_page
public static function update_page()
{
if (!GFCommon::current_user_can_any("gravityforms_view_updates")) {
wp_die(__("You don't have permissions to view this page", "gravityforms"));
}
if (!GFCommon::ensure_wp_version()) {
return;
}
GFCommon::cache_remote_message();
echo GFCommon::get_remote_message();
?>
<link rel="stylesheet" href="<?php
echo GFCommon::get_base_url() . "/css/admin.css";
?>
" />
<div class="wrap">
<div class="icon32" id="gravity-update-icon"><br></div>
<h2><?php
echo _e("Gravity Forms Updates", "gravityforms");
?>
</h2>
<?php
$version_info = GFCommon::get_version_info(false);
if (version_compare(GFCommon::$version, $version_info["version"], '<')) {
$plugin_file = "gravityforms/gravityforms.php";
$upgrade_url = wp_nonce_url('update.php?action=upgrade-plugin&plugin=' . urlencode($plugin_file), 'upgrade-plugin_' . $plugin_file);
$message = __("There is a new version of Gravity Forms available.", "gravityforms");
if ($version_info["is_valid_key"]) {
?>
<div class="gf_update_outdated alert_yellow">
<?php
echo $message . " " . sprintf(__("<p>You can update to the latest version automatically or download the update and install it manually. %sUpdate Automatically%s %sDownload Update%s", "gravityforms"), "</p><a class='button-primary' href='{$upgrade_url}'>", "</a>", " <a class='button' href='{$version_info["url"]}'>", "</a>");
?>
</div>
<?php
} else {
?>
<div class="gf_update_expired alert_red">
<?php
echo $message . " " . __('<a href="admin.php?page=gf_settings">Register</a> your copy of Gravity Forms to receive access to automatic updates and support. Need a license key? <a href="http://www.gravityforms.com">Purchase one now</a>.', 'gravityforms');
?>
</div>
<?php
}
echo "<br/><br/>";
$changelog = RGForms::get_changelog();
echo $changelog;
} else {
?>
<div class="gf_update_current alert_green">
<?php
_e("Your version of Gravity Forms is up to date.", "gravityforms");
?>
</div>
<?php
}
?>
<div id='gform_upgrade_license' style="display:none;"></div>
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery.post(ajaxurl,{
action:"gf_upgrade_license",
gf_upgrade_license: "<?php
echo wp_create_nonce("gf_upgrade_license");
?>
",
cookie: encodeURIComponent(document.cookie)},
function(data){
if(data.trim().length > 0)
jQuery("#gform_upgrade_license").replaceWith(data);
}
);
});
</script>
</div>
<?php
}
示例14: check_update
public static function check_update()
{
//only check updates on the admin side
if (!IS_ADMIN) {
return;
}
$plugin_name = "gravityforms/gravityforms.php";
$option = function_exists('get_transient') ? get_transient("update_plugins") : get_option("update_plugins");
$gravity_option = $option->response[$plugin_name];
if (empty($gravity_option)) {
$option->response[$plugin_name] = new stdClass();
}
//Getting version number
$version_info = GFCommon::get_version_info();
if ($response == -1) {
return;
}
//Empty response means that the key is invalid. Do not queue for upgrade
if (!$version_info["is_valid_key"] || version_compare(GFCommon::$version, $version_info["version"], '>=')) {
unset($option->response[$plugin_name]);
} else {
$option->response[$plugin_name]->url = "http://www.gravityforms.com";
$option->response[$plugin_name]->slug = "gravityforms";
$option->response[$plugin_name]->package = str_replace("{KEY}", GFCommon::get_key(), $version_info["url"]);
$option->response[$plugin_name]->new_version = $version_info["version"];
$option->response[$plugin_name]->id = "0";
}
//Setting transient data (WP 2.8)
if (function_exists('set_transient') && !self::$_has_set_transient) {
self::$_has_set_transient = true;
set_transient("update_plugins", $option);
}
//Setting option (WP 2.7)
if (!self::$_has_set_option) {
self::$_has_set_option = true;
update_option("update_plugins", $option);
}
}
示例15: plugin_row
public static function plugin_row($plugin_name)
{
$key = GFCommon::get_key();
$version_info = GFCommon::get_version_info();
if (!$version_info["is_valid_key"]) {
$plugin_name = "gravityforms/gravityforms.php";
$new_version = version_compare(GFCommon::$version, $version_info["version"], '<') ? __('There is a new version of Gravity Forms available.', 'gravityforms') . ' <a class="thickbox" title="Gravity Forms" href="plugin-install.php?tab=plugin-information&plugin=gravityforms&TB_iframe=true&width=640&height=808">' . sprintf(__('View version %s Details', 'gravityforms'), $version_info["version"]) . '</a>. ' : '';
echo '</tr><tr class="plugin-update-tr"><td colspan="5" class="plugin-update"><div class="update-message">' . $new_version . __('<a href="admin.php?page=gf_settings">Register</a> your copy of Gravity Forms to receive access to automatic upgrades and support. Need a license key? <a href="http://www.gravityforms.com">Purchase one now</a>.', 'gravityforms') . '</div></td>';
}
}