Exemplo n.º 1
0
 /**
  * Formats custom URL
  *
  * @param array $files
  * @param string $type
  * @return string
  */
 function format_url_custom($files, $type)
 {
     $w3_minify =& w3_instance('W3_Minify');
     $url = false;
     $w3_minify->set_custom_files($files, $type);
     $hash = $w3_minify->get_custom_files_hash($files);
     $id = $w3_minify->get_id_custom($hash, $type);
     if ($id) {
         $site_url_ssl = w3_get_site_url_ssl();
         if ($this->_config->get_boolean('minify.rewrite')) {
             $url = sprintf('%s/%s/%s.%s.%s', $site_url_ssl, W3TC_CONTENT_MINIFY_DIR_NAME, $hash, $id, $type);
         } else {
             $url = sprintf('%s/%s/index.php?file=%s.%s.%s', $site_url_ssl, W3TC_CONTENT_MINIFY_DIR_NAME, $hash, $id, $type);
         }
     }
     return $url;
 }
 /**
  * Formats custom URL
  *
  * @param string|array $files
  * @return string
  */
 function format_custom_url($files)
 {
     if (!is_array($files)) {
         $files = array((string) $files);
     }
     $base = false;
     foreach ($files as &$file) {
         $current_base = dirname($file);
         if ($base && $base != $current_base) {
             $base = false;
             break;
         } else {
             $file = basename($file);
             $base = $current_base;
         }
     }
     $site_url_ssl = w3_get_site_url_ssl();
     $url = sprintf('%s/%s/minify.php?f=%s', $site_url_ssl, W3TC_CONTENT_DIR_NAME, implode(',', $files));
     if ($base) {
         $url .= sprintf('&b=%s', $base);
     }
     return $url;
 }