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


PHP xajaxCompressJavascript函数代码示例

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


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

示例1: autoCompressJavascript

 /**
  * This method can be used to create a new xajax.js file out of the
  * xajax_uncompressed.js file (which will only happen if xajax.js doesn't
  * already exist on the filesystem).
  * 
  * @param string an optional argument containing the full server file path
  *               of xajax.js.
  */
 function autoCompressJavascript($sJsFullFilename = NULL)
 {
     $sJsFile = "xajax_js/xajax.js";
     if ($sJsFullFilename) {
         $realJsFile = $sJsFullFilename;
     } else {
         $realPath = realpath(dirname(__FILE__));
         $realJsFile = $realPath . "/" . $sJsFile;
     }
     // Create a compressed file if necessary
     if (!file_exists($realJsFile)) {
         $srcFile = str_replace(".js", "_uncompressed.js", $realJsFile);
         if (!file_exists($srcFile)) {
             trigger_error("The xajax uncompressed Javascript file could not be found in the <b>" . dirname($realJsFile) . "</b> folder. Error ", E_USER_ERROR);
         }
         require dirname(__FILE__) . "/xajaxCompress.php";
         $javaScript = implode('', file($srcFile));
         $compressedScript = xajaxCompressJavascript($javaScript);
         $fH = @fopen($realJsFile, "w");
         if (!$fH) {
             trigger_error("The xajax compressed javascript file could not be written in the <b>" . dirname($realJsFile) . "</b> folder. Error ", E_USER_ERROR);
         } else {
             fwrite($fH, $compressedScript);
             fclose($fH);
         }
     }
 }
开发者ID:jwest00724,项目名称:AccountLab-Plus,代码行数:35,代码来源:xajax.inc.php

示例2: getJavascript

 function getJavascript($sJsURI = "", $sJsFile = NULL, $sJsFullFilename = NULL)
 {
     if ($sJsFile == NULL) {
         $sJsFile = "xajax_js/xajax.js";
     }
     if ($sJsURI != "" && substr($sJsURI, -1) != "/") {
         $sJsURI .= "/";
     }
     $html = "\t<script type=\"text/javascript\">\n";
     $html .= "var xajaxRequestUri=\"" . $this->sRequestURI . "\";\n";
     $html .= "var xajaxDebug=" . ($this->bDebug ? "true" : "false") . ";\n";
     $html .= "var xajaxStatusMessages=" . ($this->bStatusMessages ? "true" : "false") . ";\n";
     $html .= "var xajaxWaitCursor=" . ($this->bWaitCursor ? "true" : "false") . ";\n";
     $html .= "var xajaxDefinedGet=" . XAJAX_GET . ";\n";
     $html .= "var xajaxDefinedPost=" . XAJAX_POST . ";\n";
     foreach ($this->aFunctions as $sFunction => $bExists) {
         $html .= $this->_wrap($sFunction, $this->aFunctionRequestTypes[$sFunction]);
     }
     $html .= "</script>\n";
     // Create a compressed file if necessary
     if ($sJsFullFilename) {
         $realJsFile = $sJsFullFilename;
     } else {
         $realPath = realpath(dirname(__FILE__));
         $realJsFile = $realPath . "/" . $sJsFile;
     }
     $srcFile = str_replace(".js", "_uncompressed.js", $realJsFile);
     if (!file_exists($srcFile)) {
         trigger_error("The xajax uncompressed Javascript file could not be found in the <b>" . dirname($realJsFile) . "</b> folder. Error ", E_USER_ERROR);
     }
     if ($this->bDebug) {
         if (!@copy($srcFile, $realJsFile)) {
             trigger_error("The xajax uncompressed javascript file could not be copied to the <b>" . dirname($realJsFile) . "</b> folder. Error ", E_USER_ERROR);
         }
     } else {
         if (!file_exists($realJsFile)) {
             require dirname($realJsFile) . "/xajaxCompress.php";
             $javaScript = implode('', file($srcFile));
             $compressedScript = xajaxCompressJavascript($javaScript);
             $fH = @fopen($realJsFile, "w");
             if (!$fH) {
                 trigger_error("The xajax compressed javascript file could not be written in the <b>" . dirname($realJsFile) . "</b> folder. Error ", E_USER_ERROR);
             } else {
                 fwrite($fH, $compressedScript);
                 fclose($fH);
             }
         }
     }
     $html .= "\t<script type=\"text/javascript\" src=\"" . $sJsURI . $sJsFile . "\"></script>\n";
     return $html;
 }
开发者ID:bobrock,项目名称:vesuvius,代码行数:51,代码来源:xajax.inc.php


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