Example #1
0
 protected static function _registerShortcodes($path)
 {
     $files = GLOB($path . '*/shortcode.php');
     foreach ($files as $file) {
         include_once __modification($file);
     }
 }
Example #2
0
 public static function tearDownAfterClass()
 {
     $filesToDelete = GLOB(__DIR__ . '/tmp/*.log');
     foreach ($filesToDelete as $filePath) {
         unlink($filePath);
     }
     rmdir(__DIR__ . '/tmp/');
 }
Example #3
0
 public static function loadAllConfigs()
 {
     $files = GLOB(self::getConfigsPath() . '*.yml');
     if (!empty($files)) {
         foreach ($files as $fileName) {
             self::loadConfig(substr($fileName, strrpos($fileName, DIRECTORY_SEPARATOR) + 1, strrpos($fileName, '.yml') - strlen($fileName)));
         }
     }
 }
Example #4
0
File: Slot.php Project: solve/slot
 /**
  * @param $templatePath
  * @param array $variables
  * @param array|ArrayStorage $params
  * @return string
  * @throws \Exception
  */
 public function fetchTemplate($templatePath, $variables = array(), $params = array())
 {
     if (!empty($variables)) {
         $this->_tplVars = $variables;
     }
     if (empty($params['absolute'])) {
         $templateFile = $templatePath;
         $templatePath = $this->getTemplateDir() . $templatePath;
     } else {
         $templateFile = substr($templatePath, strrpos($templatePath, '/') + 1);
     }
     if (is_file($templatePath)) {
         $compilePath = $this->getCompiledPath($templateFile);
         if ($this->_config['forceCompile'] || !is_file($compilePath)) {
             $old_files = GLOB($this->getCompileDir() . str_replace('/', '_', $templateFile) . '.*');
             foreach ($old_files as $file) {
                 if (is_file($file)) {
                     @unlink($file);
                 }
             }
             $content = '<?php $__lv = &$this->_tplVars; ?>';
             $content .= $this->processTemplate($templatePath);
             file_put_contents($compilePath, $content);
         }
     } else {
         throw new \Exception('File not found:' . $templatePath);
     }
     ob_start();
     if (is_file($compilePath)) {
         include $compilePath;
     }
     $output = ob_get_clean();
     return $output;
 }
Example #5
0
 protected function _testFileExpressions($path)
 {
     $files = GLOB($path);
     if (empty($files)) {
         $this->fail('files not found in ' . $path);
     }
     foreach ($files as $file) {
         $source = file($file);
         $expectation = file('expectations/' . substr($file, 10));
         foreach ($source as $index => $expression) {
             $expected = trim($expectation[$index]);
             $compiled = $this->_compiler->compileExpression($expression);
             $this->assertEquals($expected, $compiled, 'working with: ' . $expression);
         }
     }
 }
Example #6
0
 public function getModelValue($storagePath, $aliasInfo)
 {
     $filesToInfo = GLOB($storagePath . '*', GLOB_MARK);
     $value = array();
     foreach ($filesToInfo as $file) {
         if (is_dir($file)) {
             continue;
         }
         $fileInfo = FSService::getFileInfo($file);
         if (!empty($aliasInfo['sizes'])) {
             foreach ($aliasInfo['sizes'] as $sizeAlias => $sizeInfo) {
                 $fileInfo[$sizeAlias] = FSService::getFileInfo($storagePath . $sizeAlias . '/' . $fileInfo['full_name']);
             }
         }
         $value[] = $fileInfo;
     }
     return empty($aliasInfo['multiple']) && count($value) ? $value[0] : $value;
 }
Example #7
0
 public static function copyRecursive($path_from, $path_to, $mask = '{,.}*', $skip = '.svn')
 {
     if (is_file($path_from)) {
         copy($path_from, $path_to);
         return true;
     }
     self::makeWritable($path_to);
     $files = GLOB($path_from . $mask, GLOB_BRACE);
     foreach ($files as $file) {
         $name = substr($file, strrpos($file, '/') + 1);
         if ($name == '.' || $name == '..' || $name == $skip) {
             continue;
         }
         if (is_dir($file)) {
             self::makeWritable($path_to . $name);
             self::copyRecursive($file . '/' . $mask, $path_to . $name . '/');
         } else {
             copy($file, $path_to . $name);
         }
     }
     return true;
 }
 /**
  * Searches xml archive folder for already processed files.
  * @returns array of archived xml filenames.
  */
 protected function get_archived_filenames($basename_only)
 {
     $filelist = GLOB($this->get_xml_inbound_path() . 'archive/*-ORDER.xml');
     if ($basename_only) {
         foreach ($filelist as $k => $v) {
             $filelist[$k] = basename($v);
         }
     }
     return $filelist;
 }
Example #9
0
ENGINE::START();
$USER = USER::VERIFY(0);
?>
<h3 class="block-banner">Avatars</h3>
<?php 
$GOLD = $USER['gold_medals'];
$SILVER = $USER['silver_medals'];
if ($GOLD >= 10) {
    $CAP = 10;
} else {
    $CAP = $GOLD;
}
$I = 0;
while ($I <= $CAP) {
    $IN = 0;
    $FILES = GLOB('../../frame/skins/avatars/' . $I . '/*.{png}', GLOB_BRACE);
    foreach ($FILES as $FILE) {
        if ($SILVER >= $IN || $I < $CAP) {
            echo '
	            <span class="image-wrap" style="margin:5px;float:left;cursor:pointer;" onClick="SetAvatar(' . $USER['user_id'] . ', ' . "'new/" . $FILE . "'" . ')">
				    <span style="background-color:rgba(150, 150, 150, 0.2);"></span>
                    <img src="new/' . $FILE . '" border="0" style="height:128px;" />
		        </span>
            ';
        } else {
            if ($SILVER + 10 >= $IN) {
                echo '
			    <span class="image-wrap" style="margin:5px;float:left;width:128px;height:128px;background-color:rgba(150, 150, 150, 0.2);color:white;font-size: 15px;text-shadow: 2px 2px 1px black;border-radius: 10px;">
				    <center>
				        <h2>Unlock</h2>
                        <img src="../frame/skins/default/images/medal-gold.png" border="0" style="height:20px;" /><label>' . $I . '</label><br/>