• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP w3_normalize_file_minify函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: w3_normalize_file_minify2

/**
 * Normalizes file name for minify
 *
 * Relative to document root!
 *
 * @param string $file
 * @return string
 */
function w3_normalize_file_minify2($file)
{
    $file = w3_remove_query($file);
    $file = w3_normalize_file_minify($file);
    $file = w3_translate_file($file);
    return $file;
}
开发者ID:nuevomediagroup,项目名称:nmg-code,代码行数:15,代码来源:define.php


示例2: import_library

 /**
  * Imports library
  *
  * @param integer $limit
  * @param integer $offset
  * @param integer $count
  * @param integer $total
  * @param array $results
  * @return boolean
  */
 function import_library($limit, $offset, &$count, &$total, &$results)
 {
     global $wpdb;
     $count = 0;
     $total = 0;
     $results = array();
     $upload_info = w3_upload_info();
     $uploads_use_yearmonth_folders = get_option('uploads_use_yearmonth_folders');
     $document_root = w3_get_document_root();
     @set_time_limit($this->_config->get_integer('timelimit.cdn_import'));
     if ($upload_info) {
         /**
          * Search for posts with links or images
          */
         $sql = sprintf('SELECT
     		ID,
     		post_content,
     		post_date
         FROM
             %sposts
         WHERE
             post_status = "publish"
             AND (post_type = "post" OR post_type = "page")
             AND (post_content LIKE "%%src=%%"
             	OR post_content LIKE "%%href=%%")
    		', $wpdb->prefix);
         if ($limit) {
             $sql .= sprintf(' LIMIT %d', $limit);
             if ($offset) {
                 $sql .= sprintf(' OFFSET %d', $offset);
             }
         }
         $posts = $wpdb->get_results($sql);
         if ($posts) {
             $count = count($posts);
             $total = $this->get_import_posts_count();
             $regexp = '~(' . $this->get_regexp_by_mask($this->_config->get_string('cdn.import.files')) . ')$~';
             $import_external = $this->_config->get_boolean('cdn.import.external');
             foreach ($posts as $post) {
                 $matches = null;
                 $replaced = array();
                 $attachments = array();
                 $post_content = $post->post_content;
                 /**
                  * Search for all link and image sources
                  */
                 if (preg_match_all('~(href|src)=[\'"]?([^\'"<>\\s]+)[\'"]?~', $post_content, $matches, PREG_SET_ORDER)) {
                     foreach ($matches as $match) {
                         list($search, $attribute, $origin) = $match;
                         /**
                          * Check if $search is already replaced
                          */
                         if (isset($replaced[$search])) {
                             continue;
                         }
                         $error = '';
                         $result = false;
                         $src = w3_normalize_file_minify($origin);
                         $dst = '';
                         /**
                          * Check if file exists in the library
                          */
                         if (stristr($origin, $upload_info['baseurl']) === false) {
                             /**
                              * Check file extension
                              */
                             $check_src = $src;
                             if (w3_is_url($check_src)) {
                                 $qpos = strpos($check_src, '?');
                                 if ($qpos !== false) {
                                     $check_src = substr($check_src, 0, $qpos);
                                 }
                             }
                             if (preg_match($regexp, $check_src)) {
                                 /**
                                  * Check for already uploaded attachment
                                  */
                                 if (isset($attachments[$src])) {
                                     list($dst, $dst_url) = $attachments[$src];
                                     $result = true;
                                 } else {
                                     if ($uploads_use_yearmonth_folders) {
                                         $upload_subdir = date('Y/m', strtotime($post->post_date));
                                         $upload_dir = sprintf('%s/%s', $upload_info['basedir'], $upload_subdir);
                                         $upload_url = sprintf('%s/%s', $upload_info['baseurl'], $upload_subdir);
                                     } else {
                                         $upload_subdir = '';
                                         $upload_dir = $upload_info['basedir'];
                                         $upload_url = $upload_info['baseurl'];
                                     }
//.........这里部分代码省略.........
开发者ID:marqui678,项目名称:finalchance.Panopta,代码行数:101,代码来源:CdnAdmin.php


示例3: action_save_options


//.........这里部分代码省略.........
                     }
                     if ($config->get_string('newrelic.api_key') && $config->get_string('newrelic.account_id')) {
                         w3_require_once(W3TC_LIB_W3_DIR . '/NewRelicService.php');
                         $nerser = new W3_NewRelicService($config->get_string('newrelic.api_key'), $config->get_string('newrelic.account_id'));
                         $application_id = $nerser->get_application_id($application_name);
                         if ($application_id) {
                             $config->set('newrelic.application_id', $application_id);
                         }
                     }
                 }
             }
         }
         if ($config->get_boolean('minify.enabled') && !$this->_config->get_boolean('minify.enabled') || $config->get_boolean('minify.enabled') && $config->get_boolean('browsercache.enabled') && !$this->_config->get_boolean('browsercache.enabled') || $config->get_boolean('minify.enabled') && $config->get_boolean('minify.auto') && !$this->_config->get_boolean('minify.auto') || $config->get_boolean('minify.enabled') && $config->get_string('minify.engine') != $this->_config->get_string('minify.engine')) {
             delete_transient('w3tc_minify_tested_filename_length');
         }
         if (!w3_is_pro($this->_config)) {
             delete_transient('w3tc_license_status');
         }
     }
     /**
      * Minify tab
      */
     if ($this->_page == 'w3tc_minify' && !$this->_config->get_boolean('minify.auto')) {
         $js_groups = array();
         $css_groups = array();
         $js_files = W3_Request::get_array('js_files');
         $css_files = W3_Request::get_array('css_files');
         foreach ($js_files as $theme => $templates) {
             foreach ($templates as $template => $locations) {
                 foreach ((array) $locations as $location => $types) {
                     foreach ((array) $types as $files) {
                         foreach ((array) $files as $file) {
                             if (!empty($file)) {
                                 $js_groups[$theme][$template][$location]['files'][] = w3_normalize_file_minify($file);
                             }
                         }
                     }
                 }
             }
         }
         foreach ($css_files as $theme => $templates) {
             foreach ($templates as $template => $locations) {
                 foreach ((array) $locations as $location => $files) {
                     foreach ((array) $files as $file) {
                         if (!empty($file)) {
                             $css_groups[$theme][$template][$location]['files'][] = w3_normalize_file_minify($file);
                         }
                     }
                 }
             }
         }
         $config->set('minify.js.groups', $js_groups);
         $config->set('minify.css.groups', $css_groups);
         $js_theme = W3_Request::get_string('js_theme');
         $css_theme = W3_Request::get_string('css_theme');
         $params = array_merge($params, array('js_theme' => $js_theme, 'css_theme' => $css_theme));
     }
     if ($this->_page == 'w3tc_minify') {
         if ($config->get_integer('minify.auto.filename_length') > 246) {
             $config->set('minify.auto.filename_length', 246);
         }
         delete_transient('w3tc_minify_tested_filename_length');
     }
     /**
      * Browser Cache tab
      */
开发者ID:yszar,项目名称:linuxwp,代码行数:67,代码来源:DefaultActionsAdmin.php


示例4: get_files_minify

 /**
  * Exports min files to CDN
  *
  * @return array
  */
 function get_files_minify()
 {
     $files = array();
     if (W3TC_PHP5 && $this->_config->get_boolean('minify.rewrite') && (!$this->_config->get_boolean('minify.auto') || w3_is_cdn_mirror($this->_config->get_string('cdn.engine')))) {
         require_once W3TC_INC_DIR . '/functions/http.php';
         $minify =& w3_instance('W3_Plugin_Minify');
         $document_root = w3_get_document_root();
         $site_root = w3_get_site_root();
         $minify_root = w3_path(W3TC_CACHE_FILE_MINIFY_DIR);
         $minify_path = ltrim(str_replace($site_root, rtrim(w3_get_site_path(), '/'), $minify_root), '/');
         $urls = $minify->get_urls();
         if ($this->_config->get_string('minify.engine') == 'file') {
             foreach ($urls as $url) {
                 w3_http_get($url);
             }
             $files = $this->search_files($minify_root, $minify_path, '*.css;*.js');
         } else {
             foreach ($urls as $url) {
                 $file = w3_normalize_file_minify($url);
                 $file = w3_translate_file($file);
                 if (!w3_is_url($file)) {
                     $file = $document_root . '/' . $file;
                     $file = ltrim(str_replace($minify_root, '', $file), '/');
                     $dir = dirname($file);
                     if ($dir) {
                         w3_mkdir($dir, 0777, $minify_root);
                     }
                     if (w3_download($url, $minify_root . '/' . $file) !== false) {
                         $files[] = $minify_path . '/' . $file;
                     }
                 }
             }
         }
     }
     return $files;
 }
开发者ID:pyropictures,项目名称:wordpress-plugins,代码行数:41,代码来源:Cdn.php


示例5: options_save

 /**
  * Options save action
  *
  * @return void
  */
 function options_save()
 {
     require_once W3TC_LIB_W3_DIR . '/Request.php';
     /**
      * Redirect params
      */
     $params = array();
     /**
      * Read config
      * We should use new instance of WP_Config object here
      */
     $config =& new W3_Config();
     $config->read_request();
     /**
      * General tab
      */
     if ($this->_page == 'w3tc_general') {
         $file_locking = W3_Request::get_boolean('file_locking');
         $config->set('dbcache.file.locking', $file_locking);
         $config->set('objectcache.file.locking', $file_locking);
         $config->set('pgcache.file.locking', $file_locking);
         $config->set('minify.file.locking', $file_locking);
         /**
          * Check permalinks for page cache
          */
         if ($config->get_boolean('pgcache.enabled') && $config->get_string('pgcache.engine') == 'file_generic' && !get_option('permalink_structure')) {
             $this->redirect(array('w3tc_error' => 'fancy_permalinks_disabled_pgcache'));
         }
     }
     /**
      * Minify tab
      */
     if ($this->_page == 'w3tc_minify' && !$this->_config->get_boolean('minify.auto')) {
         $js_groups = array();
         $css_groups = array();
         $js_files = W3_Request::get_array('js_files');
         $css_files = W3_Request::get_array('css_files');
         foreach ($js_files as $theme => $templates) {
             foreach ($templates as $template => $locations) {
                 foreach ((array) $locations as $location => $files) {
                     switch ($location) {
                         case 'include':
                             $js_groups[$theme][$template][$location]['blocking'] = true;
                             break;
                         case 'include-nb':
                             $js_groups[$theme][$template][$location]['blocking'] = false;
                             break;
                         case 'include-body':
                             $js_groups[$theme][$template][$location]['blocking'] = true;
                             break;
                         case 'include-body-nb':
                             $js_groups[$theme][$template][$location]['blocking'] = false;
                             break;
                         case 'include-footer':
                             $js_groups[$theme][$template][$location]['blocking'] = true;
                             break;
                         case 'include-footer-nb':
                             $js_groups[$theme][$template][$location]['blocking'] = false;
                             break;
                     }
                     foreach ((array) $files as $file) {
                         if (!empty($file)) {
                             $js_groups[$theme][$template][$location]['files'][] = w3_normalize_file_minify($file);
                         }
                     }
                 }
             }
         }
         foreach ($css_files as $theme => $templates) {
             foreach ($templates as $template => $locations) {
                 foreach ((array) $locations as $location => $files) {
                     foreach ((array) $files as $file) {
                         if (!empty($file)) {
                             $css_groups[$theme][$template][$location]['files'][] = w3_normalize_file_minify($file);
                         }
                     }
                 }
             }
         }
         $config->set('minify.js.groups', $js_groups);
         $config->set('minify.css.groups', $css_groups);
         $js_theme = W3_Request::get_string('js_theme');
         $css_theme = W3_Request::get_string('css_theme');
         $params = array_merge($params, array('js_theme' => $js_theme, 'css_theme' => $css_theme));
     }
     /**
      * Browser Cache tab
      */
     if ($this->_page == 'w3tc_browsercache') {
         if ($config->get_boolean('browsercache.enabled') && $config->get_boolean('browsercache.no404wp') && !get_option('permalink_structure')) {
             $this->redirect(array('w3tc_error' => 'fancy_permalinks_disabled_browsercache'));
         }
     }
     /**
      * Mobile tab
//.........这里部分代码省略.........
开发者ID:niko-lgdcom,项目名称:archives,代码行数:101,代码来源:TotalCache.php


示例6: action_save_options


//.........这里部分代码省略.........
                 if ($method == 'manual' && $config->get_string('newrelic.appname')) {
                     if ($newrelic_prefix != '' && strpos($config->get_string('newrelic.appname'), $newrelic_prefix) === false) {
                         $application_name = $newrelic_prefix . $config->get_string('newrelic.appname');
                         $config->set('newrelic.appname', $application_name);
                     } else {
                         $application_name = $config->get_string('newrelic.appname');
                     }
                     if ($config->get_string('newrelic.api_key') && $config->get_string('newrelic.account_id')) {
                         w3_require_once(W3TC_LIB_W3_DIR . '/NewRelicService.php');
                         $nerser = new W3_NewRelicService($config->get_string('newrelic.api_key'), $config->get_string('newrelic.account_id'));
                         $application_id = $nerser->get_application_id($application_name);
                         if ($application_id) {
                             $config->set('newrelic.application_id', $application_id);
                         }
                     }
                 }
             }
         }
     }
     /**
      * Minify tab
      */
     if ($this->_page == 'w3tc_minify' && !$this->_config->get_boolean('minify.auto')) {
         $js_groups = array();
         $css_groups = array();
         $js_files = W3_Request::get_array('js_files');
         $css_files = W3_Request::get_array('css_files');
         foreach ($js_files as $theme => $templates) {
             foreach ($templates as $template => $locations) {
                 foreach ((array) $locations as $location => $types) {
                     foreach ((array) $types as $type => $files) {
                         foreach ((array) $files as $file) {
                             if (!empty($file)) {
                                 $js_groups[$theme][$template][$location]['files'][] = w3_normalize_file_minify($file);
                             }
                         }
                     }
                 }
             }
         }
         foreach ($css_files as $theme => $templates) {
             foreach ($templates as $template => $locations) {
                 foreach ((array) $locations as $location => $files) {
                     foreach ((array) $files as $file) {
                         if (!empty($file)) {
                             $css_groups[$theme][$template][$location]['files'][] = w3_normalize_file_minify($file);
                         }
                     }
                 }
             }
         }
         $config->set('minify.js.groups', $js_groups);
         $config->set('minify.css.groups', $css_groups);
         $js_theme = W3_Request::get_string('js_theme');
         $css_theme = W3_Request::get_string('css_theme');
         $params = array_merge($params, array('js_theme' => $js_theme, 'css_theme' => $css_theme));
     }
     if ($this->_page == 'w3tc_minify') {
         if ($config->get_integer('minify.auto.filename_length') > 246) {
             $config->set('minify.auto.filename_length', 246);
         }
     }
     delete_transient('w3tc_minify_tested_filename_length');
     /**
      * Browser Cache tab
      */
开发者ID:Creative-Srijon,项目名称:top10bestwp,代码行数:67,代码来源:TotalCacheAdmin.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP w3_path函数代码示例发布时间:2022-05-23
下一篇:
PHP w3_mkdir_from函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap