CMSimple_XH 開発者ドキュメント
CoreArrayFileEdit.php
1 <?php
2 
16 namespace XH;
17 
28 abstract class CoreArrayFileEdit extends ArrayFileEdit
29 {
38  public function __construct()
39  {
40  global $pth, $sl, $file, $tx;
41 
42  $this->filename = $pth['file'][$file];
43  $this->caption = utf8_ucfirst($tx['filetype'][$file]);
44  $this->metaLangFile = $pth['folder']['language'] . 'meta' . $sl . '.php';
45  parent::__construct();
46  }
47 
53  protected function asString()
54  {
55  $o = "<?php\n\n";
56  foreach ($this->cfg as $cat => $opts) {
57  foreach ($opts as $name => $opt) {
58  $opt = addcslashes($opt['val'], "\0..\37\"\$\\");
59  $o .= "\$$this->varName['$cat']['$name']=\"$opt\";\n";
60  }
61  }
62  return $o;
63  }
64 
75  protected function selectOptions($fn, $regex)
76  {
77  global $pth;
78 
79  $options = array();
80  if (is_dir($pth['folder'][$fn]) && ($dh = opendir($pth['folder'][$fn]))) {
81  while (($p = readdir($dh)) !== false) {
82  if (preg_match($regex, $p, $m)) {
83  $options[] = $m[1];
84  }
85  }
86  closedir($dh);
87  }
88  natcasesort($options);
89  return $options;
90  }
91 }
utf8_ucfirst($string)
Definition: utf8.php:118
if(!isset($cf['folders']['content'])) if($cf['site']['timezone'] !=='' &&function_exists('date_default_timezone_set')) $sl
Definition: cms.php:331
$file
Definition: cms.php:640
$o
Definition: cms.php:113
$tx
Definition: cms.php:363
$pth
Definition: cms.php:230