示例#1
0
 public function __construct($words = null)
 {
     if (!$words) {
         $words = (include AbstractApp::getRootDir() . '/app/config/words.php');
     }
     $this->words = $words;
     $this->count = count($words);
 }
示例#2
0
 public function ver()
 {
     if (!$this->ver) {
         $root = AbstractApp::getRootDir();
         $file = $root . '/app/cache/prod/appProdUrlMatcher.php';
         try {
             UtilFilesystem::checkFile($file);
         } catch (\Exception $e) {
             $file = $root . '/vendor/autoload.php';
             try {
                 UtilFilesystem::checkFile($file);
             } catch (\Exception $e) {
                 echo "File '{$file}'' not exists, please run project in production mode once to create it\n";
                 die($e->getMessage());
             }
         }
         $d = new DateTime(date("c", filemtime($file)));
         $this->ver = $d->format('Y-m-d-H-i-s');
     }
     return $this->ver;
 }
示例#3
0
 /**
  * @param type   $pattern
  * @param string $namespacepart - można podać kawałek namespace np: /Console/
  *
  * @return type
  */
 public static function findClasses($fileregexp, $classregexp, $notclassregexp = null)
 {
     $path = realpath(AbstractApp::getRootDir());
     $objects = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path));
     foreach ($objects as $file => $object) {
         /* @var $object SplFileInfo */
         if (!$object->isLink() && $object->isFile() && preg_match($fileregexp, $file)) {
             //                echo "$file - file\n";
             require_once $file;
         }
     }
     $list = array();
     foreach (get_declared_classes() as $namespace) {
         if (preg_match($classregexp, $namespace)) {
             if ($notclassregexp && preg_match($notclassregexp, $namespace)) {
                 continue;
             }
             //                echo "$namespace\n";
             $list[] = $namespace;
         }
     }
     return $list;
 }
示例#4
0
 public static function getConfig()
 {
     return array('class' => Comment::getClassNamespace(), 'web' => AbstractApp::getRootDir() . '/web', 'dirtmp' => '/media/uploads/comments_tmp', 'dir' => '/media/uploads/comments', 'file' => '#^user\\.comments\\.\\d+\\.file#', 'field' => 'path');
 }
示例#5
0
 public function getRootDir($bundlepath = false)
 {
     return AbstractApp::getRootDir($bundlepath);
 }