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


PHP Util_Ui类代码示例

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


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

示例1: create_required_files

 /**
  * Checks if addins in wp-content is available and correct version.
  *
  * @param unknown $config
  * @param Util_Environment_Exceptions $exs
  */
 private function create_required_files($config, $exs)
 {
     $src = W3TC_INSTALL_FILE_ADVANCED_CACHE;
     $dst = W3TC_ADDIN_FILE_ADVANCED_CACHE;
     if ($this->advanced_cache_installed()) {
         if ($this->is_advanced_cache_add_in()) {
             $script_data = @file_get_contents($dst);
             if ($script_data == @file_get_contents($src)) {
                 return;
             }
         } else {
             if (get_transient('w3tc_remove_add_in_pgcache') == 'yes') {
                 // user already manually asked to remove another plugin's add in,
                 // we should try to apply ours
                 // (in case of missing permissions deletion could fail)
             } else {
                 if (!$this->advanced_cache_check_old_add_in()) {
                     $remove_url = Util_Ui::admin_url('admin.php?page=w3tc_dashboard&w3tc_default_remove_add_in=pgcache');
                     $exs->push(new Util_WpFile_FilesystemOperationException(sprintf(__('The Page Cache add-in file advanced-cache.php is not a W3 Total Cache drop-in.
                 It should be removed. %s', 'w3-total-cache'), Util_Ui::button_link(__('Yes, remove it for me', 'w3-total-cache'), wp_nonce_url($remove_url, 'w3tc')))));
                     return;
                 }
             }
         }
     }
     try {
         Util_WpFile::copy_file($src, $dst);
     } catch (Util_WpFile_FilesystemOperationException $ex) {
         $exs->push($ex);
     }
 }
开发者ID:developmentDM2,项目名称:Whohaha,代码行数:37,代码来源:Generic_Environment.php

示例2: notifications

 /**
  *
  *
  * @param Config  $config
  * @return string
  */
 function notifications($config)
 {
     $config_state = Dispatcher::config_state();
     if (!$config_state->get_boolean('newrelic.hide_note_pageload_slow')) {
         $pl = get_option('w3tc_nr_frontend_response_time');
         if ($pl !== false && $pl > 0.3) {
             $nr_recommends = array();
             if (!$config->get_boolean('pgcache.enabled')) {
                 $nr_recommends[] = __('Page Cache', 'w3-total-cache');
             }
             if (!$config->get_boolean('minify.enabled')) {
                 $nr_recommends[] = __('Minify', 'w3-total-cache');
             }
             if (!$config->get_boolean('cdn.enabled')) {
                 $nr_recommends[] = __('CDN', 'w3-total-cache');
             }
             if (!$config->get_boolean('browsercache.enabled')) {
                 $nr_recommends[] = __('Browser Cache and use compression', 'w3-total-cache');
             }
             if ($nr_recommends) {
                 $message = sprintf(__('Application monitoring has detected that your page load time is higher than 300ms. It is recommended that you enable the following features: %s %s', 'w3-total-cache'), implode(', ', $nr_recommends), Util_Ui::button_link('Hide this message', Util_Ui::url(array('w3tc_default_config_state' => 'y', 'key' => 'newrelic.hide_note_pageload_slow', 'value' => 'true'))));
                 return array('newrelic_recommends' => $message);
             }
         }
     }
     return array();
 }
开发者ID:developmentDM2,项目名称:Whohaha,代码行数:33,代码来源:Extension_NewRelic_AdminNotes.php

示例3: cloudflare_button_save

 private static function cloudflare_button_save($id = '')
 {
     $b1_id = 'w3tc_cloudflare_save_' . $id;
     echo '<p class="submit">';
     echo Util_Ui::nonce_field('w3tc');
     echo '<input type="submit" id="' . $b1_id . '" name="w3tc_cloudflare_save_settings" ' . ' class="w3tc-button-save button-primary" ' . ' value="' . __('Save CloudFlare settings', 'w3-total-cache') . '" />';
     echo '</p>';
 }
开发者ID:developmentDM2,项目名称:Whohaha,代码行数:8,代码来源:Extension_CloudFlare_Page.php

示例4: w3tc_notes_wordpress_seo

 public static function w3tc_notes_wordpress_seo($notes)
 {
     if (!self::show_notice()) {
         return $notes;
     }
     $extension_id = 'wordpress-seo';
     $notes[$extension_id] = sprintf(__('It appears that activating the <a href="%s">Yoast SEO</a> extension for W3 Total Cache will be helpful for your site. <a class="button" href="%s">Click here</a> to try it. %s', 'w3-total-cache'), Util_Ui::admin_url('admin.php?page=w3tc_extensions#' . $extension_id), Util_Ui::url(array('w3tc_extensions_activate' => $extension_id)), Util_Ui::button_link(__('Hide this message', 'w3-total-cache'), Util_Ui::url(array('w3tc_default_config_state' => 'y', 'key' => 'wordpress_seo.hide_note_suggest_activation', 'value' => 'true'))));
     return $notes;
 }
开发者ID:eduardodomingos,项目名称:eduardodomingos.com,代码行数:9,代码来源:Extension_WordPressSeo_Plugin_Admin.php

示例5: admin_notices

 function admin_notices()
 {
     $plugins = get_plugins();
     if (array_key_exists('cloudflare/cloudflare.php', $plugins) && $this->_config->get_boolean('notes.cloudflare_plugin')) {
         echo sprintf('<div class="error"><p>%s %s</p></div>', __('CloudFlare plugin detected. We recommend removing the
         plugin as it offers no additional capabilities when W3 Total Cache is installed. This message will disappear
         when CloudFlare is removed.', 'w3-total-cache'), Util_Ui::button_hide_note('Hide this message', 'cloudflare_plugin'));
     }
 }
开发者ID:developmentDM2,项目名称:Whohaha,代码行数:9,代码来源:Extension_CloudFlare_Plugin_Admin.php

示例6: post_submitbox_start

 /**
  * Display Purge from cache on Page/Post post.php.
  */
 function post_submitbox_start()
 {
     if (current_user_can('manage_options')) {
         global $post;
         if (!is_null($post)) {
             $url = Util_Ui::url(array('page' => 'w3tc_dashboard', 'w3tc_flush_post' => 'y', 'post_id' => $post->ID));
             echo sprintf('<div><a href="%s">%s</a></div>', $url, __('Purge from cache', 'w3-total-cache'));
         }
     }
 }
开发者ID:developmentDM2,项目名称:Whohaha,代码行数:13,代码来源:Generic_Plugin_AdminRowActions.php

示例7: w3tc_notes_wpml

 public static function w3tc_notes_wpml($notes)
 {
     if (!self::show_notice()) {
         return $notes;
     }
     $extension_id = 'wpml';
     $config = Dispatcher::config();
     if (!Util_Environment::is_w3tc_pro($config)) {
         $activate_text = 'Available after <a href="#" class="button-buy-plugin">upgrade</a>. ';
     } else {
         $activate_text = sprintf('<a class="button" href="%s">Click here</a> to try it. ', Util_Ui::url(array('w3tc_extensions_activate' => $extension_id)));
     }
     $notes[$extension_id] = sprintf(__('Activating the <a href="%s">WPML</a> extension for W3 Total Cache may be helpful for your site. %s%s', 'w3-total-cache'), Util_Ui::admin_url('admin.php?page=w3tc_extensions#' . $extension_id), $activate_text, Util_Ui::button_link(__('Hide this message', 'w3-total-cache'), Util_Ui::url(array('w3tc_default_config_state' => 'y', 'key' => 'wpml.hide_note_suggest_activation', 'value' => 'true'))));
     return $notes;
 }
开发者ID:developmentDM2,项目名称:Whohaha,代码行数:15,代码来源:Extension_Wpml_Plugin_Admin.php

示例8: admin_print_scripts_w3tc_support

 /**
  * called from Generic_Plugin_Admin on action
  */
 public static function admin_print_scripts_w3tc_support()
 {
     $url = get_home_url();
     if (substr($url, 0, 7) == 'http://') {
         $url = substr($url, 7);
     } elseif (substr($url, 0, 8) == 'https://') {
         $url = substr($url, 8);
     }
     // aw3tc-options script is already queued so attach to it
     // just to make vars printed (while it's not related by semantics)
     wp_localize_script('w3tc-options', 'w3tc_support_postprocess', urlencode(urlencode(Util_Ui::admin_url(wp_nonce_url('admin.php', 'w3tc') . '&page=w3tc_support&done'))));
     wp_localize_script('w3tc-options', 'w3tc_support_home_url', $url);
     wp_localize_script('w3tc-options', 'w3tc_support_email', get_bloginfo('admin_email'));
     $u = wp_get_current_user();
     wp_localize_script('w3tc-options', 'w3tc_support_first_name', $u->first_name);
     wp_localize_script('w3tc-options', 'w3tc_support_last_name', $u->last_name);
 }
开发者ID:eduardodomingos,项目名称:eduardodomingos.com,代码行数:20,代码来源:Support_Page.php

示例9: view

 /**
  * CDN tab
  *
  * @return void
  */
 function view()
 {
     $config = Dispatcher::config();
     $cdn_engine = $config->get_string('cdn.engine');
     if (Cdn_Util::is_engine_fsd($cdn_engine)) {
         do_action('w3tc_settings_cdn');
         return;
     }
     $cdn_enabled = $config->get_boolean('cdn.enabled');
     $cdn_mirror = Cdn_Util::is_engine_mirror($cdn_engine);
     $cdn_mirror_purge_all = Cdn_Util::can_purge_all($cdn_engine);
     $cdn_common = Dispatcher::component('Cdn_Core');
     $cdn = $cdn_common->get_cdn();
     $cdn_supports_header = $cdn->headers_support() == W3TC_CDN_HEADER_MIRRORING;
     $minify_enabled = $config->get_boolean('minify.enabled') && Util_Rule::can_check_rules() && $config->get_boolean('minify.rewrite') && (!$config->get_boolean('minify.auto') || Cdn_Util::is_engine_mirror($config->get_string('cdn.engine')));
     $cookie_domain = $this->get_cookie_domain();
     $set_cookie_domain = $this->is_cookie_domain_enabled();
     // Required for Update Media Query String button
     $browsercache_enabled = $config->get_boolean('browsercache.enabled');
     $browsercache_update_media_qs = $config->get_boolean('browsercache.cssjs.replace') || $config->get_boolean('browsercache.other.replace');
     if (in_array($cdn_engine, array('netdna', 'maxcdn'))) {
         $pull_zones = array();
         $authorization_key = $config->get_string("cdn.{$cdn_engine}.authorization_key");
         $zone_id = $config->get_integer("cdn.{$cdn_engine}.zone_id");
         $alias = $consumerkey = $consumersecret = '';
         if ($authorization_key) {
             $keys = explode('+', $authorization_key);
             if (sizeof($keys) == 3) {
                 list($alias, $consumerkey, $consumersecret) = $keys;
             }
         }
         $authorized = $authorization_key != '' && $alias && $consumerkey && $consumersecret;
         $have_zone = $zone_id != 0;
         if ($authorized) {
             require_once W3TC_LIB_NETDNA_DIR . '/NetDNA.php';
             try {
                 $api = new \NetDNA($alias, $consumerkey, $consumersecret);
                 $pull_zones = $api->get_zones_by_url(get_home_url());
             } catch (\Exception $ex) {
                 Util_Ui::error_box('<p>There is an error with your CDN settings: ' . $ex->getMessage() . '</p>');
             }
         }
     }
     include W3TC_INC_DIR . '/options/cdn.php';
 }
开发者ID:developmentDM2,项目名称:Whohaha,代码行数:50,代码来源:Cdn_Page.php

示例10: verify

 /**
  * Check that activated plugins are not incompatible with the plugin
  */
 function verify()
 {
     if (is_network_admin()) {
         $active_plugins = (array) get_site_option('active_sitewide_plugins', array());
         $active_plugins = array_keys($active_plugins);
     } else {
         $active_plugins = (array) get_option('active_plugins');
     }
     $incomp_plugins = $this->_get_incompatible_plugins();
     $message = '';
     $matches = array_intersect($active_plugins, $incomp_plugins);
     if ($matches) {
         $message = $this->_custom_message($matches);
     }
     if ($message) {
         Util_Ui::error_box($message);
     } else {
         set_transient('w3tc.verify_plugins', true, 7 * 24 * 3600);
     }
 }
开发者ID:developmentDM2,项目名称:Whohaha,代码行数:23,代码来源:Generic_Plugin_AdminCompatibility.php

示例11: admin_notices

 function admin_notices()
 {
     $api_key = $this->_config->get_string(array('newrelic', 'api_key'));
     if (empty($api_key)) {
         return;
     }
     $nerser = Dispatcher::component('Extension_NewRelic_Service');
     $verify_running_result = $nerser->verify_running();
     $not_running = is_array($verify_running_result);
     if ($not_running) {
         $message = '<p>' . __('New Relic is not running correctly. ', 'w3-total-cache') . '<a href="#" class="w3tc_link_more {for_class: \'w3tc_nr_admin_notice\'}">' . 'more</a> ' . '<div class="w3tc_none w3tc_nr_admin_notice">' . __('The plugin has detected the following issues:. ', 'w3-total-cache');
         $message .= "<ul class=\"w3-bullet-list\">\n";
         foreach ($verify_running_result as $cause) {
             $message .= "<li>{$cause}</li>";
         }
         $message .= "</ul>\n";
         $message .= '<p>' . sprintf(__('Please review the <a href="%s">settings</a>.', 'w3-total-cache'), network_admin_url('admin.php?page=w3tc_general#monitoring')) . "</p>";
         $message .= "</div></p>\n";
         Util_Ui::error_box($message);
     }
 }
开发者ID:eduardodomingos,项目名称:eduardodomingos.com,代码行数:21,代码来源:Extension_NewRelic_Plugin_Admin.php

示例12: admin_print_scripts_w3tc_support

 /**
  * called from Generic_Plugin_Admin on action
  */
 public static function admin_print_scripts_w3tc_support()
 {
     $url = get_home_url();
     if (substr($url, 0, 7) == 'http://') {
         $url = substr($url, 7);
     } elseif (substr($url, 0, 8) == 'https://') {
         $url = substr($url, 8);
     }
     // aw3tc-options script is already queued so attach to it
     // just to make vars printed (while it's not related by semantics)
     wp_localize_script('w3tc-options', 'w3tc_support_postprocess', urlencode(urlencode(Util_Ui::admin_url(wp_nonce_url('admin.php', 'w3tc') . '&page=w3tc_support&done'))));
     wp_localize_script('w3tc-options', 'w3tc_support_home_url', $url);
     wp_localize_script('w3tc-options', 'w3tc_support_email', get_bloginfo('admin_email'));
     $u = wp_get_current_user();
     wp_localize_script('w3tc-options', 'w3tc_support_first_name', $u->first_name);
     wp_localize_script('w3tc-options', 'w3tc_support_last_name', $u->last_name);
     // values from widget
     $w3tc_support_form_hash = 'm5pom8z0qy59rm';
     $w3tc_support_field_name = '';
     $w3tc_support_field_value = '';
     if (isset($_GET['service_item'])) {
         $pos = (int) $_GET['service_item'];
         $v = get_site_option('w3tc_generic_widgetservices');
         try {
             $v = json_decode($v, true);
             if (isset($v['items']) && isset($v['items'][$pos])) {
                 $i = $v['items'][$pos];
                 $w3tc_support_form_hash = $i['form_hash'];
                 $w3tc_support_field_name = $i['parameter_name'];
                 $w3tc_support_field_value = $i['parameter_value'];
             }
         } catch (\Exception $e) {
         }
     }
     wp_localize_script('w3tc-options', 'w3tc_support_form_hash', $w3tc_support_form_hash);
     wp_localize_script('w3tc-options', 'w3tc_support_field_name', $w3tc_support_field_name);
     wp_localize_script('w3tc-options', 'w3tc_support_field_value', $w3tc_support_field_value);
 }
开发者ID:developmentDM2,项目名称:Whohaha,代码行数:41,代码来源:Support_Page.php

示例13: w3tc_ajax_cdn_highwinds_widgetdata

 public static function w3tc_ajax_cdn_highwinds_widgetdata()
 {
     try {
         $core = Dispatcher::component('Cdn_Core');
         $cdn = $core->get_cdn();
         $analytics = $cdn->service_analytics_transfer();
         $sum_mbytes = 0;
         $sum_mbps = 0;
         $sum_rps = 0;
         $graph = array(array('Date', 'Requests'));
         $count = count($analytics);
         foreach ($analytics as $item) {
             $sum_mbytes += $item['xferUsedTotalMB'];
             $sum_mbps += $item['xferRateMeanMbps'];
             $sum_rps += $item['rpsMean'];
             $graph[] = array(gmdate('d M', $item['usageTime'] / 1000), $item['requestsCountTotal']);
         }
         $response = array('transferred_size' => Util_Ui::format_mbytes($sum_mbytes / $count), 'average_mbps' => sprintf('%.2f', $sum_mbps / $count), 'average_rps' => sprintf('%.2f', $sum_rps / $count), 'graph' => $graph);
         echo json_encode($response);
     } catch (\Exception $e) {
         echo json_encode(array('error' => $e->getMessage()));
     }
 }
开发者ID:developmentDM2,项目名称:Whohaha,代码行数:23,代码来源:Cdn_Highwinds_Widget.php

示例14: checkbox_debug

 /**
  * Prints checkbox for debug option
  *
  * @param string  $option_id
  */
 protected function checkbox_debug($option_id)
 {
     if (is_array($option_id)) {
         $section = $option_id[0];
         $section_enabled = $this->_config->is_extension_active_frontend($section);
     } else {
         $section = substr($option_id, 0, strrpos($option_id, '.'));
         $section_enabled = $this->_config->get_boolean($section . '.enabled');
     }
     $disabled = $this->_config->is_sealed($option_id) || !$section_enabled;
     $name = Util_Ui::config_key_to_http_name($option_id);
     if (!$disabled) {
         echo '<input type="hidden" name="' . $name . '" value="0" />';
     }
     echo '<label>';
     echo '<input class="enabled" type="checkbox" name="' . $name . '" value="1" ';
     checked($this->_config->get_boolean($option_id), true);
     if ($disabled) {
         echo 'disabled="disabled" ';
     }
     echo ' />';
 }
开发者ID:developmentDM2,项目名称:Whohaha,代码行数:27,代码来源:Base_Page_Settings.php

示例15: create_addin

 /**
  * Creates add-in
  *
  * @throws Util_WpFile_FilesystemOperationException
  */
 private function create_addin()
 {
     $src = W3TC_INSTALL_FILE_DB;
     $dst = W3TC_ADDIN_FILE_DB;
     if ($this->db_installed()) {
         if ($this->is_dbcache_add_in()) {
             $script_data = @file_get_contents($dst);
             if ($script_data == @file_get_contents($src)) {
                 return;
             }
         } else {
             if (get_transient('w3tc_remove_add_in_dbcache') == 'yes') {
                 // user already manually asked to remove another plugin's add in,
                 // we should try to apply ours
                 // (in case of missing permissions deletion could fail)
             } else {
                 if (!$this->db_check_old_add_in()) {
                     if (isset($_GET['page'])) {
                         $url = 'admin.php?page=' . $_GET['page'] . '&amp;';
                     } else {
                         $url = basename(Util_Environment::remove_query($_SERVER['REQUEST_URI'])) . '?page=w3tc_dashboard&amp;';
                     }
                     $remove_url = Util_Ui::admin_url($url . 'w3tc_default_remove_add_in=dbcache');
                     throw new Util_WpFile_FilesystemOperationException(sprintf(__('The Database add-in file db.php is not a W3 Total Cache drop-in.
                 Remove it or disable Database Caching. %s', 'w3-total-cache'), Util_Ui::button_link(__('Remove it for me', 'w3-total-cache'), wp_nonce_url($remove_url, 'w3tc'))));
                 }
             }
         }
     }
     Util_WpFile::copy_file($src, $dst);
 }
开发者ID:developmentDM2,项目名称:Whohaha,代码行数:36,代码来源:DbCache_Environment.php


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