当前位置: 首页>>代码示例>>PHP>>正文


PHP RGFormsModel::save_key方法代码示例

本文整理汇总了PHP中RGFormsModel::save_key方法的典型用法代码示例。如果您正苦于以下问题:PHP RGFormsModel::save_key方法的具体用法?PHP RGFormsModel::save_key怎么用?PHP RGFormsModel::save_key使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RGFormsModel的用法示例。


在下文中一共展示了RGFormsModel::save_key方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: maybe_populate_keys

 private static function maybe_populate_keys()
 {
     global $gf_license_key;
     $license_key = defined('GF_LICENSE_KEY') && empty($gf_license_key) ? GF_LICENSE_KEY : $gf_license_key;
     if (!empty($license_key)) {
         RGFormsModel::save_key($license_key);
         GFCommon::cache_remote_message();
         GFCommon::get_version_info(false);
     }
     //auto-setting recaptcha keys based on value configured via the constant or global variable
     global $gf_recaptcha_public_key, $gf_recaptcha_private_key;
     $private_key = defined('GF_RECAPTCHA_PRIVATE_KEY') && empty($gf_recaptcha_private_key) ? GF_RECAPTCHA_PRIVATE_KEY : $gf_recaptcha_private_key;
     if (!empty($private_key)) {
         update_option('rg_gforms_captcha_private_key', $private_key);
     }
     $public_key = defined('GF_RECAPTCHA_PUBLIC_KEY') && empty($gf_recaptcha_public_key) ? GF_RECAPTCHA_PUBLIC_KEY : $gf_recaptcha_public_key;
     if (!empty($public_key)) {
         update_option('rg_gforms_captcha_public_key', $public_key);
     }
 }
开发者ID:kidaak,项目名称:gravityforms,代码行数:20,代码来源:gravityforms.php

示例2: 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 .= "&nbsp;<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 .= "&nbsp;<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);
//.........这里部分代码省略.........
开发者ID:Blueprint-Marketing,项目名称:interoccupy.net,代码行数:101,代码来源:settings.php

示例3: 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 .= "&nbsp;<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 .= "&nbsp;<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 .= "&nbsp;<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'";
//.........这里部分代码省略.........
开发者ID:jordanmaslyn,项目名称:vvv-starter,代码行数:101,代码来源:settings.php

示例4: 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", rgpost("gforms_disable_css"));
            update_option("rg_gforms_enable_html5", rgpost("gforms_enable_html5"));
            update_option("gform_enable_noconflict", rgpost("gform_enable_noconflict"));
            update_option("rg_gforms_enable_akismet", rgpost("gforms_enable_akismet"));
            update_option("rg_gforms_captcha_public_key", rgpost("gforms_captcha_public_key"));
            update_option("rg_gforms_captcha_private_key", rgpost("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 
        }
        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><?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 .= "&nbsp;<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 .= "&nbsp;<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);
        ?>
                        <br />
                        <?php 
        _e("The license key is used for access to automatic upgrades and support.", "gravityforms");
        ?>
                    </td>
                </tr>
               <tr valign="top">
                    <th scope="row"><label for="gforms_disable_css"><?php 
        _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'";
        ?>
 /> <?php 
        _e("Yes", "gravityforms");
        ?>
&nbsp;&nbsp;
                        <input type="radio" name="gforms_disable_css" value="1" id="gforms_css_output_disabled" <?php 
        echo get_option('rg_gforms_disable_css') == 1 ? "checked='checked'" : "";
        ?>
 /> <?php 
        _e("No", "gravityforms");
//.........这里部分代码省略.........
开发者ID:nikibrown,项目名称:2014-Nerd-presentation,代码行数:101,代码来源:settings.php


注:本文中的RGFormsModel::save_key方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。