コード例 #1
0
/**
 * Display Upgrade Notices
 *
 * @since 1.3.1
 * @return void
*/
function edd_show_upgrade_notices()
{
    if (isset($_GET['page']) && $_GET['page'] == 'edd-upgrades') {
        return;
    }
    // Don't show notices on the upgrades page
    $edd_version = get_option('edd_version');
    if (!$edd_version) {
        // 1.3 is the first version to use this option so we must add it
        $edd_version = '1.3';
    }
    if (!get_option('edd_payment_totals_upgraded') && !get_option('edd_version')) {
        if (wp_count_posts('edd_payment')->publish < 1) {
            return;
        }
        // No payment exist yet
        // The payment history needs updated for version 1.2
        $url = add_query_arg('edd-action', 'upgrade_payments');
        $upgrade_notice = sprintf(__('The Payment History needs to be updated. %s', 'edd'), '<a href="' . wp_nonce_url($url, 'edd_upgrade_payments_nonce') . '">' . __('Click to Upgrade', 'edd') . '</a>');
        add_settings_error('edd-notices', 'edd-payments-upgrade', $upgrade_notice, 'error');
    }
    if (version_compare($edd_version, '1.3.2', '<') && !get_option('edd_logs_upgraded')) {
        printf('<div class="updated"><p>' . esc_html__('The Purchase and File Download History in Easy Digital Downloads needs to be upgraded, click %shere%s to start the upgrade.', 'edd') . '</p></div>', '<a href="' . esc_url(admin_url('options.php?page=edd-upgrades')) . '">', '</a>');
    }
    if (version_compare($edd_version, '1.3.4', '<') || version_compare($edd_version, '1.4', '<')) {
        printf('<div class="updated"><p>' . esc_html__('Easy Digital Downloads needs to upgrade the plugin pages, click %shere%s to start the upgrade.', 'edd') . '</p></div>', '<a href="' . esc_url(admin_url('options.php?page=edd-upgrades')) . '">', '</a>');
    }
    if (version_compare($edd_version, '1.5', '<')) {
        printf('<div class="updated"><p>' . esc_html__('Easy Digital Downloads needs to upgrade the database, click %shere%s to start the upgrade.', 'edd') . '</p></div>', '<a href="' . esc_url(admin_url('options.php?page=edd-upgrades')) . '">', '</a>');
    }
}
コード例 #2
0
/**
 * Admin Messages
 *
 * @since 1.0
 * @return void
 */
function edd_csr_admin_messages()
{
    if (isset($_GET['edd-message']) && 'redirect_added' == $_GET['edd-message'] && current_user_can('manage_shop_settings')) {
        add_settings_error('edd-csr-notices', 'edd-redirect-added', __('Redirect added.', 'edd-csr'), 'updated');
    }
    if (isset($_GET['edd-message']) && 'redirect_add_failed' == $_GET['edd-message'] && current_user_can('manage_shop_settings')) {
        add_settings_error('edd-csr-notices', 'edd-redirect-add-fail', __('There was a problem adding your redirect, please try again.', 'edd-csr'), 'error');
    }
    if (isset($_GET['edd-message']) && 'redirect_updated' == $_GET['edd-message'] && current_user_can('manage_shop_settings')) {
        add_settings_error('edd-csr-notices', 'edd-redirect-updated', __('Redirect updated.', 'edd-csr'), 'updated');
    }
    if (isset($_GET['edd-message']) && 'redirect_update_failed' == $_GET['edd-message'] && current_user_can('manage_shop_settings')) {
        add_settings_error('edd-csr-notices', 'edd-redirect-updated-fail', __('There was a problem updating your redirect, please try again.', 'edd-csr'), 'error');
    }
    if (isset($_GET['edd-action']) && 'deactivate_redirect' == $_GET['edd-action'] && current_user_can('manage_shop_settings')) {
        add_settings_error('edd-csr-notices', 'edd-redirect-deactivated', __('Redirect Deactivated', 'edd-csr'), 'updated');
    }
    if (isset($_GET['edd-action']) && 'activate_redirect' == $_GET['edd-action'] && current_user_can('manage_shop_settings')) {
        add_settings_error('edd-csr-notices', 'edd-redirect-activated', __('Redirect Activated', 'edd-csr'), 'updated');
    }
    if (isset($_GET['edd-action']) && 'delete_redirect' == $_GET['edd-action'] && current_user_can('manage_shop_settings')) {
        add_settings_error('edd-csr-notices', 'edd-redirect-deleted', __('Redirect Deleted', 'edd-csr'), 'updated');
    }
    settings_errors('edd-csr-notices');
}
コード例 #3
0
 private function reset()
 {
     foreach ($this->settings as $setting => $section) {
         $_POST[$setting] = array_merge($_POST[$setting], $this->get_defaults($setting));
     }
     add_settings_error($this->page, 'settings_reset', __('Default settings have been reset.', WP_ULIKE_SLUG), 'updated');
 }
コード例 #4
0
ファイル: Backup.php プロジェクト: guysyml/software
 public function post_restore()
 {
     if (isset($_POST['job_id']) && isset($_POST['backup_uniqid']) && isset($_POST['_wpnonce']) && isset($_POST['method'])) {
         $nonce = filter_input(INPUT_POST, '_wpnonce', FILTER_SANITIZE_STRING);
         if (!wp_verify_nonce($nonce, 'my-wp-backup-restore-backup')) {
             wp_die(esc_html__('Nope! Security check failed!', 'my-wp-backup'));
         }
         $id = absint($_POST['job_id']);
         $uniqid = sanitize_key($_POST['backup_uniqid']);
         $method = filter_input(INPUT_POST, 'method', FILTER_SANITIZE_STRING);
         $backup = self::get($id, $uniqid);
         if (!isset($backup['duration'])) {
             add_settings_error('', '', __('Invalid backup id/uniqid.', 'my-wp-backup'));
             set_transient('settings_errors', get_settings_errors());
             wp_safe_redirect($this->admin->get_page_url('backup', array('settings-updated' => 1)));
         }
         if (!$backup->has_archives()) {
             // No local copy and no remote copy === DEAD END.
             if (empty($backup['destinations'])) {
                 add_settings_error('', '', __('Backup files missing.', 'my-wp-backup'));
                 set_transient('settings_errors', get_settings_errors());
                 wp_safe_redirect($this->admin->get_page_url('backup', array('settings-updated' => 1)));
             }
             if (!isset($backup['destinations'][$method])) {
                 add_settings_error('', '', sprintf(__('No backup files from %s.', 'my-wp-backup'), Job::$destinations[$method]));
                 set_transient('settings_errors', get_settings_errors());
                 wp_safe_redirect($this->admin->get_page_url('backup', array('settings-updated' => 1)));
             }
         }
         wp_schedule_single_event(time(), 'wp_backup_restore_backup', array(array($id, $uniqid, $method)));
         wp_safe_redirect($this->admin->get_page_url('backup', array('uniqid' => $uniqid, 'action' => 'viewprogress', 'id' => $id)));
     }
 }
コード例 #5
0
ファイル: pro.php プロジェクト: robjcordes/nexnewwp
 public function vimeography_validate_advanced_settings($input)
 {
     $output['client_id'] = wp_filter_nohtml_kses($input['client_id']);
     $output['client_secret'] = wp_filter_nohtml_kses($input['client_secret']);
     $output['access_token'] = wp_filter_nohtml_kses($input['access_token']);
     $output['access_token_secret'] = wp_filter_nohtml_kses($input['access_token_secret']);
     if ($output['client_id'] == '' || $output['client_secret'] == '' || $output['access_token'] == '' || $output['access_token_secret'] == '') {
         add_settings_error('vimeography_advanced_settings', 'required', __('Whoops! Make sure you fill out all of the Vimeo tokens!'));
         return FALSE;
     }
     require_once VIMEOGRAPHY_PATH . 'lib/vimeo-advanced-api-library.php';
     if (class_exists('phpVimeo')) {
         $vimeo = new phpVimeo($output['client_id'], $output['client_secret'], $output['access_token'], $output['access_token_secret']);
     }
     // Do an authenticated call
     try {
         $data = $vimeo->call('vimeo.oauth.checkAccessToken');
         if (!$data) {
             add_settings_error('vimeography_advanced_settings', 'invalid', __('Woah! Looks like the Vimeo API is having some issues right now. Try this again in a little bit.'));
             return FALSE;
         }
         $string = __('Success! Your Vimeo tokens for ') . $data->oauth->user->username . __(' have been added and saved.');
         // not actually an error, function name is misleading
         add_settings_error('vimeography_advanced_settings', 'valid', $string, 'updated');
         $output['active'] = TRUE;
         return $output;
     } catch (VimeoAPIException $e) {
         //add_settings_error( 'vimeography_advanced_settings', $e->getCode(), "Encountered an API error -- ".$e->getMessage());
         add_settings_error('vimeography_advanced_settings', $e->getCode(), "Uh oh! Your Vimeo tokens didn't validate. Try again, and double check that all of your tokens are in the correct fields!");
         return FALSE;
     }
 }
コード例 #6
0
ファイル: import-demo.php プロジェクト: brandmobility/kikbak
function wf_theme_import_demo_xml()
{
    $error = false;
    if (!defined('WP_LOAD_IMPORTERS')) {
        define('WP_LOAD_IMPORTERS', true);
    }
    require_once ABSPATH . 'wp-admin/includes/import.php';
    if (!class_exists('WP_Import')) {
        $class_wp_import = get_template_directory() . '/admin/wordpress-importer/wordpress-importer.php';
        if (file_exists($class_wp_import)) {
            require_once $class_wp_import;
        } else {
            $error = true;
        }
    }
    if ($error) {
        add_settings_error('wf-theme-import-demo', 'wf-theme-import-demo', __('Demo data import failed! Try importing manually trough Tools - Import.', WF_THEME_TEXTDOMAIN), 'error');
        return false;
    } else {
        if (!is_file(get_template_directory() . '/admin/demo-data.xml')) {
            add_settings_error('wf-theme-import-demo', 'wf-theme-import-demo', __('Demo data XML file is missing.', WF_THEME_TEXTDOMAIN), 'error');
            return false;
        } else {
            ob_start();
            $wp_import = new wp_import();
            $wp_import->fetch_attachments = true;
            $wp_import->import(get_template_directory() . '/admin/demo-data.xml');
            ob_end_clean();
        }
    }
    return true;
}
コード例 #7
0
 function sanitize_database_settings($input)
 {
     // URL database limit option
     if (isset($input[HA_Common::URL_DB_LIMIT_OPTION])) {
         if (is_numeric($input[HA_Common::URL_DB_LIMIT_OPTION])) {
             $url_db_limit = intval($input[HA_Common::URL_DB_LIMIT_OPTION]);
             if ($url_db_limit <= 0) {
                 add_settings_error(HA_Common::DATABASE_SETTINGS_KEY, 'url_db_limit_range_error', 'URL database limit must be numeric greater than 0 or empty.', 'error');
             }
         } else {
             if (strlen(trim($input[HA_Common::URL_DB_LIMIT_OPTION])) != 0) {
                 add_settings_error(HA_Common::DATABASE_SETTINGS_KEY, 'url_db_limit_trim_error', 'URL database limit must be numeric greater than 0 or empty.', 'error');
             }
         }
     }
     // check if clear database flag is set
     if (isset($_POST['clear-database-flag']) && $_POST['clear-database-flag'] === "true") {
         global $ha_admin_controller;
         $response = $ha_admin_controller->get_data_services()->custom_query('clear_database', array());
         if ($response['status'] == 'error') {
             add_settings_error(HA_Common::DATABASE_SETTINGS_KEY, 'clear-database-success', $response['message'], 'error');
         } else {
             add_settings_error(HA_Common::DATABASE_SETTINGS_KEY, 'clear-database-success', $response['message'], 'updated');
         }
     }
     return $input;
 }
コード例 #8
0
ファイル: mime-types.php プロジェクト: RA2WP/RA2WP
 function wpuxss_eml_mimes_validate($input)
 {
     if (!$input) {
         $input = array();
     }
     if (isset($_POST['eml-restore-mime-types-settings'])) {
         $wpuxss_eml_mimes_backup = get_option('wpuxss_eml_mimes_backup');
         $input = $wpuxss_eml_mimes_backup;
         add_settings_error('wpuxss_eml_mimes', 'eml_mime_types_restored', __('MIME type settings restored.', 'eml'), 'updated');
     } elseif (!isset($_POST['eml-settings-import']) && !isset($_POST['eml-settings-restore'])) {
         add_settings_error('wpuxss_eml_mimes', 'eml_mime_types_saved', __('MIME type settings saved.', 'eml'), 'updated');
     }
     foreach ($input as $type => $mime) {
         $sanitized_type = wpuxss_eml_sanitize_extension($type);
         if ($sanitized_type !== $type) {
             $input[$sanitized_type] = $input[$type];
             unset($input[$type]);
             $type = $sanitized_type;
         }
         $input[$type]['filter'] = isset($mime['filter']) && !!$mime['filter'] ? 1 : 0;
         $input[$type]['upload'] = isset($mime['upload']) && !!$mime['upload'] ? 1 : 0;
         $input[$type]['mime'] = sanitize_mime_type($mime['mime']);
         $input[$type]['singular'] = sanitize_text_field($mime['singular']);
         $input[$type]['plural'] = sanitize_text_field($mime['plural']);
     }
     return $input;
 }
コード例 #9
0
function dpovi_options_page()
{
    if (isset($_GET['settings-updated'])) {
        add_settings_error('results', 'results', '<p>Found a lot of video IDs. Copy them below.</p>', 'updated');
    }
    ?>
    <div>
    <h2>Denver Post Video ID discoverer</h2>
    <?php 
    settings_errors();
    ?>
    <form action="options.php" method="POST">
    <?php 
    settings_fields('dpovi_options');
    ?>
    <?php 
    do_settings_sections('dpovi');
    ?>
     
    <input name="Submit" type="submit" value="<?php 
    esc_attr_e('Discover Video IDs');
    ?>
" />
    </form></div>
<?php 
}
 /**
  * Sanitize each setting field as needed
  *
  * @param array $input Contains all settings fields as array keys
  */
 public function dc_dc_woodle_general_settings_sanitize($input)
 {
     global $DC_Woodle;
     $new_input = array();
     $hasError = false;
     if (isset($input['access_url'])) {
         $new_input['access_url'] = rtrim($input['access_url'], '/');
     } else {
         add_settings_error("dc_{$this->tab}_settings_name", esc_attr("dc_{$this->tab}_settings_admin_error"), __('Moodle access URL should not be empty.', $DC_Woodle->text_domain), 'error');
         $hasError = true;
     }
     if (isset($input['ws_token'])) {
         $new_input['ws_token'] = sanitize_text_field($input['ws_token']);
     } else {
         add_settings_error("dc_{$this->tab}_settings_name", esc_attr("dc_{$this->tab}_settings_admin_error"), __('Moodle webservice token should not be empty.', $DC_Woodle->text_domain), 'error');
         $hasError = true;
     }
     if (isset($input['create_wc_product'])) {
         $new_input['create_wc_product'] = $input['create_wc_product'];
     }
     if (isset($input['update_user_info'])) {
         $new_input['update_user_info'] = $input['update_user_info'];
     }
     if (isset($input['moodle_role_id'])) {
         $new_input['moodle_role_id'] = !empty($input['moodle_role_id']) ? intval($input['moodle_role_id']) : '';
     }
     if (!$hasError) {
         add_settings_error("dc_{$this->tab}_settings_name", esc_attr("dc_{$this->tab}_settings_admin_updated"), __('General settings updated', $DC_Woodle->text_domain), 'updated');
     }
     return $new_input;
 }
コード例 #11
0
	/**
	* Show an error message to administrators
	*
	* @param string $message
	*/
	private function show_error( $message ) {
		if( ! is_admin() || ! current_user_can( 'manage_options' ) ) {
			return false;
		}

		add_settings_error( 'mc4wp-api', 'mc4wp-api-error', $message, 'error' );
	}
コード例 #12
0
function lockr_options_validate($input)
{
    $options = get_option('lockr_options');
    $options['account_email'] = trim($input['account_email']);
    $options['account_password'] = trim($input['account_password']);
    $name = get_bloginfo('name', 'display');
    if (!filter_var($options['account_email'], FILTER_VALIDATE_EMAIL)) {
        add_settings_error('lockr_options', 'lockr-email', $options['account_email'] . ' is not a proper email address. Please try again.', 'error');
        $options['account_email'] = '';
    } else {
        try {
            \Lockr\Lockr::site()->register($options['account_email'], null, $name);
        } catch (ClientException $e) {
            try {
                \Lockr\Lockr::site()->register($options['account_email'], $options['account_password'], $name);
            } catch (ClientException $e) {
                add_settings_error('lockr_options', 'lockr-email', 'Login credentials incorrect, please try again.', 'error');
            } catch (ServerException $e) {
                add_settings_error('lockr_options', 'lockr-email', 'An unknown error has occurred, please try again later.', 'error');
            }
        } catch (ServerException $e) {
            add_settings_error('lockr_options', 'lockr-email', 'An unknown error has occurred, please try again later.', 'error');
        }
    }
    $options['account_password'] = '';
    return $options;
}
コード例 #13
0
 public function error_message()
 {
     foreach ($this->e->get_error_messages() as $message) {
         add_settings_error('dana-don-boom-boom-doo-requirement', 'plugin_requirement', $message, 'error');
     }
     add_action('admin_notices', [$this, 'show_error']);
 }
コード例 #14
0
function iqblockcountry_check_geoapikey($input)
{
    // Check first if API key is empty....
    if (!empty($input)) {
        $url = GEOIPAPICHECKURL;
        $result = wp_remote_post($url, array('body' => array('api-key' => $input)));
        $message = "";
        $type = "updated";
        if (200 == $result['response']['code']) {
            $body = $result['body'];
            $xml = new SimpleXmlElement($body);
            if ($xml->check != "Ok") {
                $message = __('The GeoIP API key is incorrect. Please update the key.', 'iqblockcountry');
                $type = "error";
                $input = FALSE;
            } else {
                $message = __('Setting saved.', 'iqblockcountry');
                $type = "updated";
            }
        } else {
            $input = FALSE;
        }
        add_settings_error('iqblockcountry_geoipapi_error', esc_attr('settings_updated'), $message, $type);
        return $input;
    }
    return "";
}
コード例 #15
0
 function iul_validate_behavior_fields($input)
 {
     $new_input = array();
     if (isset($input['clear_setting'])) {
         $iul_clear_settings = $input['clear_setting'];
         unset($input['clear_setting']);
     }
     foreach ($input as $actions) {
         if (!empty($actions['idle_action']) && !empty($actions['idle_page']) || ($actions['idle_action'] == 1 || $actions['idle_action'] == 2)) {
             if (!empty($actions['user_role'])) {
                 if ($actions['idle_timer'] != 0 && $actions['idle_timer'] < 10) {
                     add_settings_error('', esc_attr('iul_error'), __('Idle time must be atleast 10 second', 'iul'), 'error');
                     $actions['idle_timer'] = '';
                 }
                 $new_input[$actions['user_role']] = array('idle_action' => $actions['idle_action'], 'idle_page' => $actions['idle_page'], 'idle_timer' => $actions['idle_timer']);
             }
         }
     }
     if (!empty($iul_clear_settings)) {
         foreach ($iul_clear_settings as $index) {
             unset($new_input[$index]);
         }
     }
     return $new_input;
 }
コード例 #16
0
 function settings_validate($input)
 {
     $new_input = array();
     if (isset($input["cce-data_url"])) {
         if (!filter_var($input["cce-data_url"], FILTER_VALIDATE_URL)) {
             //check if valid URL
             //invalid so add settings error
             add_settings_error("cce-data_url", "cce-data_url-error", __(esc_attr("The CampusCE data URL must be a valid URL.")), "error");
         } else {
             $new_input["cce-data_url"] = sanitize_option("siteurl", $input["cce-data_url"]);
         }
     }
     if (isset($input["cce-user_key"])) {
         $new_input["cce-user_key"] = sanitize_text_field($input["cce-user_key"]);
     }
     if (isset($input["cce-post_type"])) {
         $new_input["cce-post_type"] = sanitize_text_field($input["cce-post_type"]);
     }
     if (isset($input["cce-taxonomy"])) {
         $new_input["cce-taxonomy"] = sanitize_text_field($input["cce-taxonomy"]);
     }
     if (isset($input["cce-field-id"])) {
         $new_input["cce-field-id"] = sanitize_text_field($input["cce-field-id"]);
     }
     return $new_input;
 }
コード例 #17
0
function dpoo_options_page()
{
    if (isset($_GET['settings-updated'])) {
        $options = get_option('dpoo_options');
        add_settings_error('results', 'results', '<p>IDs updated. Full report:</p>' . "\n" . "\n" . $options['dpoo_results'], 'updated');
    }
    ?>
    <div>
    <h2>Denver Post Ooyala/Inform video ID replacer</h2>
    <?php 
    settings_errors();
    ?>
    <form action="options.php" method="POST">
    <?php 
    settings_fields('dpoo_options');
    ?>
    <?php 
    do_settings_sections('dpoo');
    ?>
     
    <input name="Submit" type="submit" value="<?php 
    esc_attr_e('Replace Oyala IDs');
    ?>
" />
    </form></div>
<?php 
}
コード例 #18
0
function edd_ppe_admin_messages()
{
    if (isset($_GET['edd-message']) && 'receipt_added' == $_GET['edd-message'] && current_user_can('manage_shop_settings')) {
        add_settings_error('edd-ppe-notices', 'edd-receipt-added', __('Email added.', 'edd-ppe'), 'updated');
    }
    if (isset($_GET['edd-message']) && 'receipt_add_failed' == $_GET['edd-message'] && current_user_can('manage_shop_settings')) {
        add_settings_error('edd-ppe-notices', 'edd-receipt-add-fail', __('There was a problem adding your email, please try again.', 'edd-ppe'), 'error');
    }
    if (isset($_GET['edd-message']) && 'receipt_updated' == $_GET['edd-message'] && current_user_can('manage_shop_settings')) {
        add_settings_error('edd-ppe-notices', 'edd-receipt-updated', __('Email updated.', 'edd-ppe'), 'updated');
    }
    if (isset($_GET['edd-message']) && 'receipt_update_failed' == $_GET['edd-message'] && current_user_can('manage_shop_settings')) {
        add_settings_error('edd-ppe-notices', 'edd-receipt-updated-fail', __('There was a problem updating your email, please try again.', 'edd-ppe'), 'error');
    }
    if (isset($_GET['edd-action']) && 'send_test_email' == $_GET['edd-action'] && current_user_can('manage_shop_settings')) {
        add_settings_error('edd-ppe-notices', 'edd-test-email-sent', __('Test Email Sent.', 'edd-ppe'), 'updated');
    }
    if (isset($_GET['edd-action']) && 'delete_receipt' == $_GET['edd-action'] && current_user_can('manage_shop_settings')) {
        add_settings_error('edd-ppe-notices', 'edd-receipt-deleted', __('Email deleted.', 'edd-ppe'), 'updated');
    }
    if (isset($_GET['edd-action']) && 'activate_receipt' == $_GET['edd-action'] && current_user_can('manage_shop_settings')) {
        add_settings_error('edd-ppe-notices', 'edd-receipt-activated', __('Email activated.', 'edd-ppe'), 'updated');
    }
    if (isset($_GET['edd-action']) && 'deactivate_receipt' == $_GET['edd-action'] && current_user_can('manage_shop_settings')) {
        add_settings_error('edd-ppe-notices', 'edd-receipt-deactivated', __('Email deactivated.', 'edd-ppe'), 'updated');
    }
    settings_errors('edd-ppe-notices');
}
コード例 #19
0
 public function validate_options($input)
 {
     //check if bg_color is hex value
     if (!preg_match('/#([a-f]|[A-F]|[0-9]){3}(([a-f]|[A-F]|[0-9]){3})?\\b/', $input['bg_color'])) {
         //if not: display error...
         add_settings_error($this->plugin_name . '_bg_color', 'hexerror', __('Please enter a valid hex value', 'sh-style-wpmp'), 'error');
         //...and revert to stored value
         $options = get_option($this->plugin_name . '_options');
         $bg_color = $options['bg_color'];
         $input['bg_color'] = $bg_color;
     }
     //TODO: regex for rgba
     //check timerail_color
     /*if (false)//! preg_match(			'/rgba(([0-9]{1}%,|[1-9]{1}[0-9]{1}%,|100%,){2}([0-9]{1}%|[1-9]{1}[0-9]{1}%|100%){1}\))/',
     		//	$input[ 'timerail_color' ]
     		//)
     		) {
     			//if not: display error...
     			add_settings_error(
     				$this->plugin_name . '_timerail_color',
     				'rgbaerror',
     				__( 'Please enter a valid rgba value', 'sh-style-wpmp' ),
     				'error'
     			);
     			//...and revert to stored value
     			$options                    = get_option( $this->plugin_name . '_options' );
     			$bg_color                   = $options[ 'timerail_color' ];
     			$input [ 'timerail_color' ] = $bg_color;*/
     return $input;
 }
コード例 #20
0
 function shoestrap_css_not_writeable($array)
 {
     global $current_screen, $wp_filesystem;
     $css_folder = get_template_directory() . '/assets/css/';
     $app_css_path = get_template_directory() . '/assets/css/app.css';
     $ac_css_path = get_template_directory() . '/assets/css/alleycat.css';
     // ! The compile should already have been attempted at this point as the hook is earlier !
     // If the files are writable the files will exist
     // The CSS folder is not writable and the files don't exist, user needs folder write permissions
     if (!is_writable($css_folder) && !file_exists($app_css_path) && !file_exists($ac_css_path)) {
         $content = __('The following folder does not have write permission.  Please update the write permissions for this folder, it is required for the Theme Options.', 'shoestrap');
         $content .= '<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . $css_folder;
         add_settings_error('shoestrap', 'create_file', $content, 'error');
         settings_errors();
     } else {
         if (!is_writable($app_css_path) || !is_writable($ac_css_path)) {
             // Check if the CSS files are writeable.  Seems like an unlikely scenario, but you never know.
             $content = __('The following files do not have write permissions.  Please update the write permissions for these files, they are required for the Theme Options.', 'shoestrap');
             if (!is_writable($app_css_path)) {
                 $content .= '<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/wp-content/themes/bloc/assets/css/app.css';
             }
             if (!is_writable($ac_css_path)) {
                 $content .= '<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/wp-content/themes/bloc/assets/css/alleycat.css';
             }
             add_settings_error('shoestrap', 'create_file', $content, 'error');
             settings_errors();
         }
     }
 }
コード例 #21
0
 public static function add_settings_error($code, $msg, $type = My_Plugin_Notice_Type::Error)
 {
     //Append inline to the type to ensure the settings errors don't get moved under h2
     add_action('admin_notices', function () use($code, $msg, $type) {
         add_settings_error(My_Plugin_Admin_Notice::$option_group_page_name, $code, $msg, $type . " inline");
     });
 }
コード例 #22
0
ファイル: developer.php プロジェクト: nicoladj77/developer
 public function admin_init()
 {
     $this->recommended_plugins = array('debug-bar' => array('project_type' => 'all', 'name' => esc_html__('Debug Bar', 'a8c-developer'), 'active' => class_exists('Debug_Bar')), 'debug-bar-cron' => array('project_type' => 'all', 'name' => esc_html__('Debug Bar Cron', 'a8c-developer'), 'active' => function_exists('zt_add_debug_bar_cron_panel')), 'rewrite-rules-inspector' => array('project_type' => 'all', 'name' => esc_html__('Rewrite Rules Inspector', 'a8c-developer'), 'active' => class_exists('Rewrite_Rules_Inspector')), 'log-deprecated-notices' => array('project_type' => 'all', 'name' => esc_html__('Log Deprecated Notices', 'a8c-developer'), 'active' => class_exists('Deprecated_Log')), 'vip-scanner' => array('project_type' => 'all', 'name' => esc_html__('VIP Scanner', 'a8c-developer'), 'active' => class_exists('VIP_Scanner')), 'grunion-contact-form' => array('project_type' => 'wpcom-vip', 'name' => esc_html__('Grunion Contact Form', 'a8c-developer'), 'active' => defined('GRUNION_PLUGIN_DIR')), 'polldaddy' => array('project_type' => 'wpcom-vip', 'name' => esc_html__('Polldaddy Polls & Ratings', 'a8c-developer'), 'active' => class_exists('WP_Polldaddy')), 'monster-widget' => array('project_type' => 'all', 'name' => esc_html__('Monster Widget', 'a8c-developer'), 'active' => class_exists('Monster_Widget')), 'wordpress-beta-tester' => array('project_type' => 'all', 'name' => esc_html__('Beta Tester', 'a8c-developer'), 'active' => class_exists('wp_beta_tester'), 'filename' => 'wp-beta-tester.php'));
     $this->recommended_constants = array('WP_DEBUG' => __('Enables <a href="http://codex.wordpress.org/Debugging_in_WordPress" target="_blank">debug mode</a> which helps identify and resolve issues', 'a8c-developer'), 'SAVEQUERIES' => esc_html__('Logs database queries to an array so you can review them. The Debug Bar plugin will list out database queries if you set this constant.', 'a8c-developer'));
     register_setting(self::OPTION, self::OPTION, array($this, 'settings_validate'));
     wp_register_script('a8c-developer', plugins_url('developer.js', __FILE__), array('jquery'), self::VERSION);
     $strings = array('settings_slug' => self::PAGE_SLUG, 'go_to_step_2' => current_user_can('install_plugins') && current_user_can('activate_plugins') && 'direct' == get_filesystem_method() ? 'yes' : 'no', 'lightbox_title' => __('Developer: Plugin Setup', 'a8c-developer'), 'saving' => __('Saving...', 'a8c-developer'), 'installing' => '<img src="images/loading.gif" alt="" /> ' . esc_html__('Installing...', 'a8c-developer'), 'installed' => __('Installed', 'a8c-developer'), 'activating' => '<img src="images/loading.gif" alt="" /> ' . esc_html__('Activating...', 'a8c-developer'), 'activated' => __('Activated', 'a8c-developer'), 'error' => __('Error!', 'a8c-developer'), 'ACTIVE' => __('ACTIVE', 'a8c-developer'), 'INSTALLED' => __('INSTALLED', 'a8c-developer'), 'ERROR' => __('ERROR!', 'a8c-developer'));
     wp_localize_script('a8c-developer', 'a8c_developer_i18n', $strings);
     wp_register_style('a8c-developer', plugins_url('developer.css', __FILE__), array(), self::VERSION);
     // Handle the submission of the lightbox form if step 2 won't be shown
     if (!empty($_POST['a8c_developer_action'])) {
         if ('lightbox_step_1' == $_POST['a8c_developer_action'] && !empty($_POST['a8c_developer_project_type']) && check_admin_referer('a8c_developer_action_lightbox_step_1')) {
             $this->save_project_type($_POST['a8c_developer_project_type']);
             add_settings_error('general', 'settings_updated', __('Settings saved.'), 'updated');
         }
     }
     if (!get_option(self::OPTION)) {
         if (!empty($_GET['a8cdev_errorsaving'])) {
             add_settings_error(self::PAGE_SLUG, self::PAGE_SLUG . '_error_saving', __('Error saving settings. Please try again.', 'a8c-developer'));
         } elseif (current_user_can('manage_options')) {
             add_action('admin_enqueue_scripts', array($this, 'load_lightbox_scripts_and_styles'));
             add_action('admin_footer', array($this, 'output_setup_box_html'));
         }
     }
 }
コード例 #23
0
ファイル: class-admin.php プロジェクト: phupx/genco
 /**
  * Init function for the settings of GA
  */
 public function init_settings()
 {
     $this->options = get_option('yst_ga');
     if (false == $this->options) {
         add_option('yst_ga', $this->default_ga_values());
         $this->options = get_option('yst_ga');
     }
     global $Yoast_GA_Options;
     if (is_null($Yoast_GA_Options->get_tracking_code())) {
         add_action('admin_notices', array($this, 'config_warning'));
     }
     if ($_SERVER['REQUEST_METHOD'] == 'POST') {
         if (!function_exists('wp_verify_nonce')) {
             require_once ABSPATH . 'wp-includes/pluggable.php';
         }
         if (isset($_POST['ga-form-settings']) && wp_verify_nonce($_POST['yoast_ga_nonce'], 'save_settings')) {
             if (!isset($_POST['ignore_users'])) {
                 $_POST['ignore_users'] = array();
             }
             // Post submitted and verified with our nonce
             $this->save_settings($_POST);
             add_settings_error('yoast_google_analytics', 'yoast_google_analytics', __('Settings saved!', 'google-analytics-for-wordpress'), 'updated');
         }
     }
     $this->connect_with_google_analytics();
 }
コード例 #24
0
ファイル: developer.php プロジェクト: 9pmStudios/developer
 public function admin_init()
 {
     if (!empty($_GET['developer_plugin_reset']) && current_user_can('manage_options')) {
         delete_option(self::OPTION);
     }
     $this->recommended_plugins = array('debug-bar' => array('project_type' => 'all', 'name' => esc_html__('Debug Bar', 'a8c-developer'), 'active' => class_exists('Debug_Bar')), 'debug-bar-console' => array('project_type' => 'all', 'name' => esc_html__('Debug Bar Console', 'a8c-developer'), 'active' => function_exists('debug_bar_console_panel')), 'debug-bar-cron' => array('project_type' => 'all', 'name' => esc_html__('Debug Bar Cron', 'a8c-developer'), 'active' => function_exists('zt_add_debug_bar_cron_panel')), 'debug-bar-extender' => array('project_type' => 'all', 'name' => esc_html__('Debug Bar Extender', 'a8c-developer'), 'active' => class_exists('Debug_Bar_Extender')), 'rewrite-rules-inspector' => array('project_type' => 'all', 'name' => esc_html__('Rewrite Rules Inspector', 'a8c-developer'), 'active' => class_exists('Rewrite_Rules_Inspector')), 'log-deprecated-notices' => array('project_type' => 'all', 'name' => esc_html__('Log Deprecated Notices', 'a8c-developer'), 'active' => class_exists('Deprecated_Log')), 'log-viewer' => array('project_type' => 'all', 'name' => esc_html__('Log Viewer', 'a8c-developer'), 'active' => class_exists('ciLogViewer')), 'vip-scanner' => array('project_type' => 'wpcom-vip', 'name' => esc_html__('VIP Scanner', 'a8c-developer'), 'active' => class_exists('VIP_Scanner')), 'jetpack' => array('project_type' => 'wpcom-vip', 'name' => esc_html__('Jetpack', 'a8c-developer'), 'active' => class_exists('Jetpack')), 'polldaddy' => array('project_type' => 'wpcom-vip', 'name' => esc_html__('Polldaddy Polls & Ratings', 'a8c-developer'), 'active' => class_exists('WP_Polldaddy')), 'monster-widget' => array('project_type' => 'all', 'name' => esc_html__('Monster Widget', 'a8c-developer'), 'active' => class_exists('Monster_Widget')), 'user-switching' => array('project_type' => 'all', 'name' => esc_html__('User Switching', 'a8c-developer'), 'active' => class_exists('user_switching')), 'piglatin' => array('project_type' => array('wporg-theme', 'wporg'), 'name' => esc_html__('Pig Latin', 'a8c-developer'), 'active' => class_exists('PigLatin')), 'rtl-tester' => array('project_type' => 'wporg-theme', 'name' => esc_html__('RTL Tester', 'a8c-developer'), 'active' => class_exists('RTLTester')), 'regenerate-thumbnails' => array('project_type' => 'wporg-theme', 'name' => esc_html__('Regenerate Thumbnails', 'a8c-developer'), 'active' => class_exists('RegenerateThumbnails')), 'simply-show-ids' => array('project_type' => 'wporg-theme', 'name' => esc_html__('Simply Show IDs', 'a8c-developer'), 'active' => function_exists('ssid_add')), 'theme-test-drive' => array('project_type' => 'wporg-theme', 'name' => esc_html__('Theme Test Drive', 'a8c-developer'), 'active' => function_exists('TTD_filters'), 'filename' => 'themedrive.php'), 'theme-check' => array('project_type' => 'wporg-theme', 'name' => esc_html__('Theme Check', 'a8c-developer'), 'active' => function_exists('tc_add_headers')));
     if (!self::is_dev_version()) {
         $this->recommended_plugins['wordpress-beta-tester'] = array('project_type' => 'all', 'name' => esc_html__('Beta Tester', 'a8c-developer'), 'active' => class_exists('wp_beta_tester'), 'filename' => 'wp-beta-tester.php');
     }
     $this->recommended_constants = array('WP_DEBUG' => array('project_type' => 'all', 'description' => __('Enables <a href="http://codex.wordpress.org/Debugging_in_WordPress" target="_blank">debug mode</a> which helps identify and resolve issues', 'a8c-developer')), 'SAVEQUERIES' => array('project_type' => 'all', 'description' => esc_html__('Logs database queries to an array so you can review them. The Debug Bar plugin will list out database queries if you set this constant.', 'a8c-developer')), 'JETPACK_DEV_DEBUG' => array('project_type' => 'wpcom-vip', 'description' => __('Enables <a href="http://jetpack.me/2013/03/28/jetpack-dev-mode-release/">Development Mode</a> in Jetpack for testing features without a connection to WordPress.com.', 'a8c-developer')));
     register_setting(self::OPTION, self::OPTION, array($this, 'settings_validate'));
     wp_register_script('a8c-developer', plugins_url('developer.js', __FILE__), array('jquery'), self::VERSION);
     $strings = array('settings_slug' => self::PAGE_SLUG, 'go_to_step_2' => current_user_can('install_plugins') && current_user_can('activate_plugins') && 'direct' == get_filesystem_method() ? 'yes' : 'no', 'lightbox_title' => __('Developer: Plugin Setup', 'a8c-developer'), 'saving' => __('Saving...', 'a8c-developer'), 'installing' => '<img src="images/loading.gif" alt="" /> ' . esc_html__('Installing...', 'a8c-developer'), 'installed' => __('Installed', 'a8c-developer'), 'activating' => '<img src="images/loading.gif" alt="" /> ' . esc_html__('Activating...', 'a8c-developer'), 'activated' => __('Activated', 'a8c-developer'), 'error' => __('Error!', 'a8c-developer'), 'ACTIVE' => __('ACTIVE', 'a8c-developer'), 'INSTALLED' => __('INSTALLED', 'a8c-developer'), 'ERROR' => __('ERROR!', 'a8c-developer'));
     wp_localize_script('a8c-developer', 'a8c_developer_i18n', $strings);
     wp_register_style('a8c-developer', plugins_url('developer.css', __FILE__), array(), self::VERSION);
     // Handle the submission of the lightbox form if step 2 won't be shown
     if (!empty($_POST['action']) && 'a8c_developer_lightbox_step_1' == $_POST['action'] && !empty($_POST['a8c_developer_project_type']) && check_admin_referer('a8c_developer_lightbox_step_1')) {
         $this->save_project_type($_POST['a8c_developer_project_type']);
         add_settings_error('general', 'settings_updated', __('Settings saved.'), 'updated');
     }
     if (!get_option(self::OPTION)) {
         if (!empty($_GET['a8cdev_errorsaving'])) {
             add_settings_error(self::PAGE_SLUG, self::PAGE_SLUG . '_error_saving', __('Error saving settings. Please try again.', 'a8c-developer'));
         } elseif (!is_network_admin() && current_user_can('manage_options')) {
             add_action('admin_enqueue_scripts', array($this, 'load_lightbox_scripts_and_styles'));
             add_action('admin_footer', array($this, 'output_setup_box_html'));
         }
     }
 }
 /**
  * Add settings for the RSS feed
  * + also regenerates the secret if requested
  */
 public function add_settings()
 {
     //we register a setting to keep track of the RSS feed status (enabled/disabled)
     register_setting('simple_history_settings_group', 'simple_history_enable_rss_feed', array($this, 'update_rss_status'));
     /**
      * Start new section for RSS feed
      */
     $settings_section_rss_id = "simple_history_settings_section_rss";
     add_settings_section($settings_section_rss_id, _x("RSS feed", "rss settings headline", "simple-history"), array($this, "settings_section_output"), SimpleHistory::SETTINGS_MENU_SLUG);
     // Enable/Disabled RSS feed
     add_settings_field("simple_history_enable_rss_feed", __("Enable", "simple-history"), array($this, "settings_field_rss_enable"), SimpleHistory::SETTINGS_MENU_SLUG, $settings_section_rss_id);
     //if RSS is activated we display other fields
     if ($this->is_rss_enabled()) {
         // RSS address
         add_settings_field("simple_history_rss_feed", __("Address", "simple-history"), array($this, "settings_field_rss"), SimpleHistory::SETTINGS_MENU_SLUG, $settings_section_rss_id);
         // Regnerate address
         add_settings_field("simple_history_rss_feed_regenerate_secret", __("Regenerate", "simple-history"), array($this, "settings_field_rss_regenerate"), SimpleHistory::SETTINGS_MENU_SLUG, $settings_section_rss_id);
     }
     // Create new RSS secret
     $create_new_secret = false;
     $create_secret_nonce_name = "simple_history_rss_secret_regenerate_nonce";
     if (isset($_GET[$create_secret_nonce_name]) && wp_verify_nonce($_GET[$create_secret_nonce_name], 'simple_history_rss_update_secret')) {
         $create_new_secret = true;
         $this->update_rss_secret();
         // Add updated-message and store in transient and then redirect
         // This is the way options.php does it.
         $msg = __("Created new secret RSS address", 'simple-history');
         add_settings_error("simple_history_rss_feed_regenerate_secret", "simple_history_rss_feed_regenerate_secret", $msg, "updated");
         set_transient('settings_errors', get_settings_errors(), 30);
         $goback = esc_url_raw(add_query_arg('settings-updated', 'true', wp_get_referer()));
         wp_redirect($goback);
         exit;
     }
 }
コード例 #26
0
/**
 * Admin Messages
 *
 * @since 1.0
 * @global $wpum_options Array of all the WPUM Options
 * @return void
 */
function wpum_admin_messages()
{
    global $wpum_options;
    $screen = get_current_screen();
    if (isset($_GET['settings-updated']) && $_GET['settings-updated'] == true && !wpum_get_option('custom_passwords') && wpum_get_option('password_strength')) {
        add_settings_error('wpum-notices', 'custom-passwords-disabled', __('You have enabled the "Minimum Password Strength" option, the "Users custom passwords" is currently disabled and must be enabled for custom passwords to work.', 'wpum'), 'error');
    }
    if (isset($_GET['settings-updated']) && $_GET['settings-updated'] == true && !wpum_get_option('custom_passwords') && wpum_get_option('login_after_registration')) {
        add_settings_error('wpum-notices', 'custom-passwords-disabled', __('Error: the option "Login after registration" can only work when the option "Users custom passwords" is enabled too.', 'wpum'), 'error');
    }
    if (isset($_GET['emails-updated']) && $_GET['emails-updated'] == true) {
        add_settings_error('wpum-notices', 'emails-updated', __('Email successfully updated.', 'wpum'), 'updated');
    }
    // Display Errors in plugin settings page
    if ($screen->base == 'users_page_wpum-settings') {
        // Display error if no core page is setup
        if (!wpum_get_option('login_page') || !wpum_get_option('password_recovery_page') || !wpum_get_option('registration_page') || !wpum_get_option('account_page') || !wpum_get_option('profile_page')) {
            add_settings_error('wpum-notices', 'page-missing', __('One or more WPUM pages are not configured.', 'wpum') . ' ' . sprintf(__('<a href="%s" class="button-primary">Click here to setup your pages</a>', 'wpum'), admin_url('users.php?page=wpum-settings&tab=general&wpum_action=install_pages')), 'error');
        }
        // Display error if wrong permalinks
        if (get_option('permalink_structure') == '') {
            add_settings_error('wpum-notices', 'permalink-wrong', sprintf(__('You must <a href="%s">change your permalinks</a> to anything else other than "default" for profiles to work.', 'wpum'), admin_url('options-permalink.php')), 'error');
        }
        if (isset($_GET['setup_done']) && $_GET['setup_done'] == 'true') {
            add_settings_error('wpum-notices', 'pages-updated', __('Pages setup completed.', 'wpum'), 'updated');
        }
        if (isset($_GET['message']) && $_GET['message'] == 'fields_fixed') {
            add_settings_error('wpum-notices', 'fields_fixed', __('Fields successfully fixed.', 'wpum'), 'updated');
        }
    }
    // Verify if upload folder is writable
    if (isset($_GET['wpum_action']) && $_GET['wpum_action'] == 'check_folder_permission') {
        $upload_dir = wp_upload_dir();
        if (!wp_is_writable($upload_dir['path'])) {
            add_settings_error('wpum-notices', 'permission-error', sprintf(__('Your uploads folder in "%s" is not writable. <br/>Avatar uploads will not work, please adjust folder permission.<br/><br/> <a href="%s" class="button" target="_blank">Read More</a>', 'wpum'), $upload_dir['basedir'], 'http://www.wpbeginner.com/wp-tutorials/how-to-fix-image-upload-issue-in-wordpress/'), 'error');
        } else {
            add_settings_error('wpum-notices', 'permission-success', sprintf(__('No issues detected.', 'wpum'), admin_url('users.php?page=wpum-settings&tab=profile')), 'updated notice is-dismissible');
        }
    }
    // messages for the groups and fields pages
    if ($screen->base == 'users_page_wpum-profile-fields') {
        if (isset($_GET['message']) && $_GET['message'] == 'group_success') {
            add_settings_error('wpum-notices', 'group-updated', __('Field group successfully updated.', 'wpum'), 'updated');
        }
        if (isset($_GET['message']) && $_GET['message'] == 'group_delete_success') {
            add_settings_error('wpum-notices', 'group-deleted', __('Field group successfully deleted.', 'wpum'), 'updated');
        }
        if (isset($_GET['message']) && $_GET['message'] == 'field_saved') {
            add_settings_error('wpum-notices', 'field-saved', __('Field successfully updated.', 'wpum'), 'updated');
        }
    }
    // messages for tools page
    if ($screen->base == 'users_page_wpum-tools') {
        if (isset($_GET['message']) && $_GET['message'] == 'settings_imported') {
            add_settings_error('wpum-notices', 'settings-imported', __('Settings successfully imported.', 'wpum'), 'updated');
        }
    }
    settings_errors('wpum-notices');
}
コード例 #27
0
 /**
  * Activates the module
  *
  * Callback for "tml_activate_user-moderation/user-moderation.php" hook in method Theme_My_Login_Admin::activate_module()
  *
  * @see Theme_My_Login_Admin::activate_module()
  * @since 6.0
  * @access public
  *
  * @param object $theme_my_login Reference to global $theme_my_login object
  */
 public function activate()
 {
     if (is_multisite()) {
         add_settings_error($this->options_key, 'invalid_module', __('User Moderation is not currently compatible with multisite.', 'theme-my-login'));
         return;
     }
     add_role('pending', 'Pending', array());
 }
コード例 #28
0
 public function settings_notices($object_id, $updated)
 {
     if ($object_id !== $this->key || empty($updated)) {
         return;
     }
     add_settings_error($this->key . '-notices', '', __('Settings updated.', 'textdomain'), 'updated');
     settings_errors($this->key . '-notices');
 }
 /**
  * 옵션 값을 검증.
  *
  * @param array $options
  *
  * @return bool
  */
 private static function validate_option_values(array &$options)
 {
     if ($options['password_min_length'] < self::PASSWORD_MIN_LENGTH) {
         add_settings_error('dabory-members', 'password_min_length', sprintf(__('비밀번호는 최소 길이는 %d자 입니다.', 'wskl'), self::PASSWORD_MIN_LENGTH));
         return FALSE;
     }
     return TRUE;
 }
コード例 #30
0
/**
 * Validate the Hooks
 * 
 * @since rtPanel Hooks Editor 1.0
 */
function rtp_hooks_validate($input)
{
    if (isset($_POST['rtp_reset'])) {
        $input = default_values();
        add_settings_error('rtp_hooks', 'reset_rtp_hooks', __('All rtPanel Hooks have been restored to default.', 'rtPanel'), 'updated');
    }
    return $input;
}