XOOPS  2.6.0
resource.admin.php
Go to the documentation of this file.
1 <?php
2 /*
3  You may not change or alter any portion of this comment or credits
4  of supporting developers from this source code or any supporting source code
5  which is considered copyrighted (c) material of the original comment or credit authors.
6 
7  This program is distributed in the hope that it will be useful,
8  but WITHOUT ANY WARRANTY; without even the implied warranty of
9  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10  */
11 
20 class Smarty_Resource_Admin extends Smarty_Resource_Custom
21 {
31  protected function fetch($name, &$source, &$mtime)
32  {
33  $tpl = $this->adminTplInfo($name);
34  $stat = stat($tpl);
35 
36  // Did we fail to get stat information?
37  if ($stat) {
38  $mtime = $stat['mtime'];
39  $filesize = $stat['size'];
40  $fp = fopen($tpl, 'r');
41  $source = ($filesize > 0) ? fread($fp, $filesize) : '';
42  fclose($fp);
43 
44  } else {
45  $source = null;
46  $mtime = null;
47  }
48  }
49 
57  private function adminTplInfo($tpl_name)
58  {
59  static $cache = array();
61  $tpl_info = $xoops->getTplInfo('admin:'.$tpl_name);
62  $tpl_name = $tpl_info['tpl_name'];
63  $dirname = $tpl_info['module'];
64  $file = $tpl_info['file'];
65 
66  $theme_set = $xoops->getConfig('theme_set') ? $xoops->getConfig('theme_set') : 'default';
67  if (!file_exists($file_path = $xoops->path("themes/{$theme_set}/modules/{$dirname}/admin/{$file}"))) {
68  $file_path = $xoops->path("modules/{$dirname}/templates/admin/{$file}");
69  }
70  return $cache[$tpl_name] = $file_path;
71  }
72 }
$tpl
Definition: backend.php:39
static getInstance()
Definition: Xoops.php:160
if(!isset($xoops->paths[$path_type])) if($path_type== 'var') $file
Definition: browse.php:55
$xoops
Definition: admin.php:25
fetch($name, &$source, &$mtime)
$dirname
Definition: backend.php:38
if($file===false||$dir===false||!strstr($file, $dir)) if(empty($file)||strpos($file, '.php')!==false) $mtime
Definition: browse.php:71