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


PHP cpac_admin_message函数代码示例

本文整理汇总了PHP中cpac_admin_message函数的典型用法代码示例。如果您正苦于以下问题:PHP cpac_admin_message函数的具体用法?PHP cpac_admin_message怎么用?PHP cpac_admin_message使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: handle_install_request

 /**
  * Handles the installation of the add-on
  *
  * @since 2.2
  */
 public function handle_install_request()
 {
     if (!isset($_GET['_wpnonce']) || !wp_verify_nonce($_GET['_wpnonce'], 'install-cac-addon') || !isset($_GET['plugin'])) {
         return;
     }
     if (!$this->get_addon($_GET['plugin'])) {
         cpac_admin_message('Addon does not exist.', 'error');
         return;
     }
     if (!class_exists('CAC_Addon_Pro')) {
         cpac_admin_message('You need Admin Columns Pro.', 'error');
         return;
     }
     // Hook: trigger possible warning message before running WP installer ( api errors etc. )
     if ($error = apply_filters('cac/addons/install_request/maybe_error', false, $_GET['plugin'])) {
         cpac_admin_message($error, 'error');
         return;
     }
     $install_url = add_query_arg(array('action' => 'install-plugin', 'plugin' => $_GET['plugin'], 'cpac-redirect' => true), wp_nonce_url(network_admin_url('update.php'), 'install-plugin_' . $_GET['plugin']));
     wp_redirect($install_url);
     exit;
 }
开发者ID:catlrlsn,项目名称:CATLR,代码行数:27,代码来源:addons.php

示例2: store

 /**
  * @since 2.0
  */
 function store($columns = '')
 {
     if (!empty($_POST[$this->key])) {
         $columns = array_filter($_POST[$this->key]);
     }
     if (!$columns) {
         cpac_admin_message(__('No columns settings available.', 'cpac'), 'error');
         return false;
     }
     // sanitize user inputs
     foreach ($columns as $name => $options) {
         if ($_column = $this->get_column_by_name($name)) {
             $columns[$name] = $_column->sanitize_storage($options);
         }
         // Santize Label: Need to replace the url for images etc, so we do not have url problem on exports
         // this can not be done by CPAC_Column::sanitize_storage() because 3rd party plugins are not available there
         $columns[$name]['label'] = stripslashes(str_replace(site_url(), '[cpac_site_url]', trim($columns[$name]['label'])));
     }
     // store columns
     $result = update_option("cpac_options_{$this->key}", $columns);
     $result_default = update_option("cpac_options_{$this->key}_default", array_keys($this->get_default_columns()));
     // error
     if (!$result && !$result_default) {
         cpac_admin_message(sprintf(__('You are trying to store the same settings for %s.', 'cpac'), "<strong>{$this->label}</strong>"), 'error');
         return false;
     }
     cpac_admin_message(sprintf(__('Settings for %s updated succesfully.', 'cpac'), "<strong>{$this->label}</strong>"), 'updated');
     // refresh columns otherwise the newly added columns will not be displayed
     $this->set_columns_on_current_screen();
     /**
      * Fires after a new column setup is stored in the database
      * Primarily used when columns are saved through the Admin Columns settings screen
      *
      * @since 2.2.9
      *
      * @param array $columns List of columns ([columnid] => (array) [column properties])
      * @param CPAC_Storage_Model $storage_model_instance Storage model instance
      */
     do_action('cac/storage_model/columns_stored', $columns, $this);
     return true;
 }
开发者ID:hoainam1989,项目名称:smwp,代码行数:44,代码来源:storage_model.php

示例3: restore_all

 /**
  * Restore all column defaults
  *
  * @since 1.0
  */
 private function restore_all()
 {
     global $wpdb;
     $wpdb->query("DELETE FROM {$wpdb->options} WHERE option_name LIKE 'cpac_options_%'");
     cpac_admin_message(__('Default settings succesfully restored.', 'cpac'), 'updated');
 }
开发者ID:Kilbourne,项目名称:restart,代码行数:11,代码来源:settings.php

示例4: init

 /**
  * @since 2.0
  */
 public function init()
 {
     // @dev_only delete_option( 'cpac_version' ); set_transient( 'cpac_show_welcome', 'display' );
     $version = get_option('cpac_version', false);
     // Maybe version pre 2.0.0 was used
     if (!$version && get_option('cpac_options')) {
         $version = '1.0.0';
     }
     // @dev_only if ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) echo "--------- CPAC DEBUG: START ---------<br/>\n" . $version . "<br/>\n" . CPAC_VERSION . "<br/>\n" . CPAC_UPGRADE_VERSION . "<br/>\n" . get_transient( 'cpac_show_welcome' ) . "<br/>\n" . "--------- CPAC DEBUG: END ---------<br/>\n";
     // Maybe upgrade?
     if ($version) {
         // run every upgrade
         if ($version < CPAC_VERSION) {
             // nothing yet
         }
         // run only when updating from v1 to v2
         if ($version < '2.0.0') {
             // show welcome screen
             set_transient('cpac_show_welcome', 'display');
         }
         // run only when database upgrade is needed
         if ($version < CPAC_UPGRADE_VERSION) {
             // display upgrade message on every page except upgrade page itself
             if (!(isset($_REQUEST['page']) && 'cpac-upgrade' === $_REQUEST['page'])) {
                 $message = __('Admin Columns', 'codepress-admin-columns') . ' v' . CPAC_VERSION . ' ' . __('requires a database upgrade', 'codepress-admin-columns') . ' (<a class="thickbox" href="' . admin_url() . 'plugin-install.php?tab=plugin-information&plugin=codepress-admin-columns&section=changelog&TB_iframe=true&width=640&height=559">' . __('why?', 'codepress-admin-columns') . '</a>). ' . __("Please", 'codepress-admin-columns') . ' <a href="http://codex.wordpress.org/Backing_Up_Your_Database">' . __("backup your database", 'codepress-admin-columns') . '</a>, ' . __("then click", 'codepress-admin-columns') . ' <a href="' . admin_url() . 'options-general.php?page=cpac-upgrade" class="button">' . __("Upgrade Database", 'codepress-admin-columns') . '</a>';
                 cpac_admin_message($message, 'updated');
             }
         } elseif ($version < CPAC_VERSION) {
             update_option('cpac_version', CPAC_VERSION);
         }
     } else {
         update_option('cpac_version', CPAC_VERSION);
     }
 }
开发者ID:OneTimeUser,项目名称:retailwire,代码行数:37,代码来源:upgrade.php

示例5: handle_reset

 /**
  * Handle reset request
  *
  * @since 1.0
  */
 public function handle_reset()
 {
     global $pagenow;
     // On Admin settings page
     if (isset($_GET['cpac_action']) && 'restore_sorting_type' == $_GET['cpac_action'] && !empty($_GET['cpac_key']) && 'options-general.php' == $pagenow && !empty($_GET['page']) && 'codepress-admin-columns' == $_GET['page']) {
         // security check
         if (wp_verify_nonce($_GET['_cpac_nonce'], 'restore-sorting')) {
             $result = $this->do_reset($_GET['cpac_key']);
             if ($result) {
                 cpac_admin_message("<strong>{$this->storage_model->label}</strong> " . __('sorting preference succesfully reset.', 'cpac'), 'updated');
             }
         }
     }
     // On Columns page
     if ($this->storage_model->page . '.php' == $pagenow && !empty($_REQUEST['reset-sorting']) && $_REQUEST['reset-sorting'] == $this->storage_model->key) {
         // do a reset
         $this->do_reset($_REQUEST['reset-sorting']);
         // redirect back to admin
         $admin_url = trailingslashit(admin_url()) . $this->storage_model->page . '.php';
         // for posts we need to add the type to the admin url
         if ('post' == $this->storage_model->type) {
             $admin_url = $admin_url . '?post_type=' . $this->storage_model->key;
         }
         wp_safe_redirect($admin_url);
         exit;
     }
 }
开发者ID:bruno-barros,项目名称:w.eloquent.light,代码行数:32,代码来源:model.php

示例6: handle_request

 /**
  * Handle requests for license activation and deactivation
  *
  * @since 1.0
  */
 public function handle_request()
 {
     // Activation
     if (isset($_POST['_wpnonce_addon_activate']) && wp_verify_nonce($_POST['_wpnonce_addon_activate'], $this->option_key)) {
         $licence_key = isset($_POST[$this->option_key]) ? sanitize_text_field($_POST[$this->option_key]) : '';
         if (empty($licence_key)) {
             cpac_admin_message(__('Empty licence.', 'cpac'), 'error');
             return;
         }
         $response = $this->activate_licence($licence_key);
         if (is_wp_error($response)) {
             cpac_admin_message(__('Wrong response from API.', 'cpac') . ' ' . $response->get_error_message(), 'error');
         } elseif (isset($response->activated)) {
             cpac_admin_message($response->message, 'updated');
         } else {
             cpac_admin_message(__('Wrong response from API.', 'cpac'), 'error');
         }
     }
     // Deactivation
     if (isset($_POST['_wpnonce_addon_deactivate']) && wp_verify_nonce($_POST['_wpnonce_addon_deactivate'], $this->option_key)) {
         $response = $this->deactivate_licence();
         if (is_wp_error($response)) {
             cpac_admin_message(__('Wrong response from API.', 'cpac') . ' ' . $response->get_error_message(), 'error');
         } elseif (isset($response->deactivated)) {
             cpac_admin_message($response->message, 'updated');
         } else {
             cpac_admin_message(__('Wrong response from API.', 'cpac'), 'error');
         }
     }
     // Toggle SSL
     if (isset($_POST['_wpnonce_addon_toggle_ssl']) && wp_verify_nonce($_POST['_wpnonce_addon_toggle_ssl'], $this->option_key)) {
         // disable ssl
         if ('0' == $_POST['ssl']) {
             $this->disable_ssl();
         } else {
             $this->enable_ssl();
         }
     }
 }
开发者ID:bruno-barros,项目名称:w.eloquent.light,代码行数:44,代码来源:licence-manager-settings.php

示例7: handle_file_import

 /**
  * @uses wp_import_handle_upload()
  * @since 2.0.0
  */
 function handle_file_import()
 {
     if (!isset($_REQUEST['_cpac_nonce']) || !wp_verify_nonce($_REQUEST['_cpac_nonce'], 'file-import') || empty($_FILES['import'])) {
         return false;
     }
     // handles upload
     $file = wp_import_handle_upload();
     // any errors?
     $error = false;
     if (isset($file['error'])) {
         $error = __('Sorry, there has been an error.', 'cpac') . '<br />' . esc_html($file['error']);
     } else {
         if (!file_exists($file['file'])) {
             $error = __('Sorry, there has been an error.', 'cpac') . '<br />' . sprintf(__('The export file could not be found at <code>%s</code>. It is likely that this was caused by a permissions problem.', 'cpac'), esc_html($file['file']));
         }
     }
     if ($error) {
         cpac_admin_message($error, 'error');
         return false;
     }
     // read file contents and start the import
     $content = file_get_contents($file['file']);
     // cleanup
     wp_delete_attachment($file['id']);
     // decode file contents
     $columns = $this->get_decoded_settings($content);
     if (empty($columns)) {
         cpac_admin_message(__('Import failed. File does not contain Admin Column settings.', 'cpac'), 'error');
         return false;
     }
     // store settings
     foreach ($columns as $type => $settings) {
         $storage_model = $this->cpac->get_storage_model($type);
         if (!$storage_model) {
             cpac_admin_message(sprintf(__('Screen %s does not exist.', 'cpac'), "<strong>{$type}</strong>"), 'error');
             continue;
         }
         $storage_model->store($settings);
     }
 }
开发者ID:bruno-barros,项目名称:w.eloquent.light,代码行数:44,代码来源:export_import.php


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