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


PHP I2CE::rewrittenURLs方法代码示例

本文整理汇总了PHP中I2CE::rewrittenURLs方法的典型用法代码示例。如果您正苦于以下问题:PHP I2CE::rewrittenURLs方法的具体用法?PHP I2CE::rewrittenURLs怎么用?PHP I2CE::rewrittenURLs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在I2CE的用法示例。


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

示例1: rewrittenURLs

 /**
  * returns true if the url's have been written. false if not
  */
 public static function rewrittenURLs()
 {
     return I2CE::rewrittenURLs();
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:7,代码来源:I2CE_Page.php

示例2: addHeaderLink

 /**
  * Add a script or css to the header as a link 
  * 
  * @param string $file
  * @param mixed $attr   --   an array of attribute/value pairs.   Defaults to the empty array.  can also be a string
  *   in which case it is the id that you want to give the import node.
  * @param boolean $use_filedump -- default to true meaning that we should use the filedump utility 
  *       when looking for the script/css
  * @returm DOMNode -- the node just created or appended to
  *  You might use this by calling
  *  addHeaderLink("printer.css",'',array('media'=>'print'));
  * Note: Uses the file's extension to determine the proper behavior.  Valid ones are 'js', 'css', and 'vb'
  */
 public function addHeaderLink($file, $attr = array(), $use_filedump = true)
 {
     if (array_key_exists($file, $this->files_loaded) && $this->files_loaded[$file]) {
         // Check to make sure this  file hasn't already been loaded and ignore it if so.
         return;
     }
     // we have not loaded the file so start loading it
     $this->files_loaded[$file] = true;
     $ext = strtolower(substr(strrchr($file, "."), 1));
     if ($use_filedump) {
         if (I2CE::rewrittenURLs()) {
             $file_src = 'file/' . $file;
         } else {
             $file_src = 'index.php/file/' . $file;
         }
     }
     if (is_scalar($attr)) {
         $attr = array('id' => $attr);
     }
     if (!is_array($attr)) {
         $attr = array();
     }
     switch ($ext) {
         case 'js':
             $node = null;
             $existed = false;
             foreach ($this->query('//script[@type="text/javascript"]') as $js_node) {
                 if (!($src = $js_node->getAttribute('src'))) {
                     continue;
                 }
                 if (substr($src, 0, 15) == 'index.php/file/') {
                     $src = substr($src, 15);
                 } else {
                     if (substr($src, 0, 5) == 'file/') {
                         $src = substr($src, 5);
                     }
                 }
                 if ($src == $file) {
                     $existed = true;
                     return $js_node;
                 }
             }
             if (array_key_exists('id', $attr)) {
                 $node = $this->getElementById($attr['id']);
                 if ($node instanceof DOMElement) {
                     $existed = true;
                 } else {
                     $node = $this->doc->createElement('script', '');
                     $node->setAttribute('id', $attr['id']);
                 }
                 unset($attr['id']);
             } else {
                 $node = $this->doc->createElement('script', '');
             }
             if ($existed) {
                 $old_file = $node->getAttribute('src');
                 if ($old_file) {
                     $node->removeAttribute('src');
                     $node->appendChild($this->doc->createTextNode('document.write(\'<script type="text/javascript" src="' . $old_file . '"></script>\');'));
                 }
                 $node->appendChild($this->doc->createTextNode('document.write(\'<script type="text/javascript" src="' . $file_src . '"></script>\');'));
             } else {
                 $node->setAttribute('src', $file_src);
                 $node->setAttribute('type', 'text/javascript');
             }
             break;
         case 'vb':
             $node = $this->doc->createElement('script', '');
             $node->setAttribute('src', $file_src);
             $node->setAttribute('type', 'text/vbscript');
             break;
         case 'css':
             if (array_key_exists('ie6', $attr) && $attr['ie6']) {
                 $node = $this->doc->createComment('[if lt IE 7]>');
                 $link = $this->doc->createElement('link', '');
                 $link->setAttribute('rel', 'stylesheet');
                 $link->setAttribute('media', 'screen');
                 $link->setAttribute('href', $file_src . "?newman");
                 $link->setAttribute('type', 'text/css');
                 foreach ($attr as $a => $v) {
                     $link->setAttribute($a, $v);
                 }
                 $node->appendData($this->doc->saveXML($link));
                 $node->appendData("<![endif]");
                 $attr = array();
             } else {
                 $node = $this->doc->createElement('link', '');
//.........这里部分代码省略.........
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:101,代码来源:I2CE_Template.php


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