/**
  * load the disabled modules, which where not cached
  */
 public function getDisabledFolders() {
     $filepath = sfConfig::get('sf_app_dir') . '/config/template.yml';
     $array = sfYAML::Load($filepath);
     $a = 0;
     foreach($array['disabled'] as $module) {
         $this->disabled[$a++] = $module;
     }
 }
 /**
  * function load
  *
  * @access public
  * @param string $resource
  * @return array
  */
 public function load($resource)
 {
     $keys = $this->name2keys($resource);
     //Find in global variable
     if (count($this->getNode($keys[0], $this->global)) > 0) {
         return $this->find($keys, $this->global);
     } else {
         if (file_exists(PATH_FIXTURES . $keys[0] . '.yml')) {
             $local = sfYAML::Load(PATH_FIXTURES . $keys[0] . '.yml');
             unset($keys[0]);
             $keys = array_values($keys);
             return $this->find($keys, $local);
         } else {
             return null;
         }
     }
     return null;
 }
 /**
  * function load
  *
  * @access public
  * @param string $inputTestCasesIndex
  * @param array $fields
  * @return array
  */
 function load($inputTestCasesIndex = 'TestCases', $fields = array())
 {
     $testCases = array();
     $input = sfYAML::Load($this->testCaseFile);
     foreach ($input[$inputTestCasesIndex] as $preTestCase) {
         $testFunctionInputs = array();
         foreach ($preTestCase['Input'] as $inputArgument => $value) {
             if (substr($inputArgument, -2, 2) === '[]') {
                 //DOMAIN
                 $inputArgument = substr($inputArgument, 0, strlen($inputArgument) - 2);
                 if (!isset($testFunctionInputs[$inputArgument])) {
                     $testFunctionInputs[$inputArgument] = array();
                 }
                 //var_dump($this->testDomain->global,$this->testDomain->get( $value ), $value );
                 ymlDomain::arrayAppend($testFunctionInputs[$inputArgument], $this->testDomain->get($value));
             } else {
                 //SPECIFIC VALUE
                 if (!isset($testFunctionInputs[$inputArgument])) {
                     $testFunctionInputs[$inputArgument] = array();
                 }
                 ymlDomain::arrayAppend($testFunctionInputs[$inputArgument], array($value));
             }
         }
         /* Start Block: "Explode" all the posible test cases defined in the yml
          * using domains and single values
          */
         //Initialize $index key values for the first test case (5.2 array_fill_keys(array_keys($testFunctionInputs),0))
         $index = array_combine(array_keys($testFunctionInputs), array_fill(0, count($testFunctionInputs), 0));
         //array_product()
         $prod = 1;
         foreach ($testFunctionInputs as $values) {
             $prod *= count($values);
         }
         $lastCase = $prod == 0;
         while (!$lastCase) {
             //foreach($index as $v) echo($v);echo("\n");
             /* Put in $aux one test case */
             $aux = array();
             foreach ($testFunctionInputs as $key => $values) {
                 $aux[$key] = $values[$index[$key]];
             }
             /* CREATE TEST CASE: Put $aux test case in $testCases array */
             $i = count($testCases);
             $testCases[$i] = $preTestCase;
             $testCases[$i]['Input'] = $aux;
             /* Increse the $index key values to the next test case */
             $lastCase = true;
             foreach ($testFunctionInputs as $key => $values) {
                 $index[$key]++;
                 if ($index[$key] >= count($values)) {
                     $index[$key] = 0;
                 } else {
                     $lastCase = false;
                     break;
                 }
             }
         }
         /*End Block */
     }
     /* Start Block: Replace @@ tags variables */
     foreach ($testCases as $key => $testCase) {
         $testCases[$key] = testTools::replaceVariables($testCases[$key]);
         $testCases[$key]['Input'] = testTools::replaceVariables($testCases[$key]['Input'], $fields);
         if (isset($testCase['Output'])) {
             if (isset($testCase['Output']['Value'])) {
                 /*$testCases[$key]['Output']['Value'] =
                   unserialize($testCases[$key]['Output']['Value']);*/
             }
         }
     }
     /* End Block */
     $this->testCases = $testCases;
     return $testCases;
 }
 protected function parsear_yml($archivo)
 {
     $contenido = sfYAML::load($archivo);
     //Esta mas actualizado que el de PHP, que ademas requiere PECL
     //$contenido = yaml_parse_file($archivo);
     return $contenido;
 }
Exemple #5
0
 protected function getOldEntries($feed)
 {
     $file = R2T_TEMP_DIR . "/{$feed}";
     $oldentries = array();
     if (file_exists($file)) {
         $oldentries = sfYAML::Load($file);
     }
     return $oldentries;
 }
 /**
  *
  * @return String version of CuteFlow
  */
 public static function getVersion() {
     $filepath = sfConfig::get('sf_app_dir') . '/config/version.yml';
     $array = sfYAML::Load($filepath);
     return $array['version'];
 }
 /**
  * Convert an array to a YAML list
  *
  * @param array The input array
  * @return string
  */
 public static function array_to_yml($array)
 {
     return sfYAML::dump($array, 99);
 }
Exemple #8
0
 function menu_sucursal()
 {
     $m = sfYAML::Load('_config/menu.yml');
     $this->menu_data = $m['menu_vertical'];
 }
<?php
    // loading mask -.-
    echo '<div id="loading"><div id="loading-message" style="border:solid;"><table><tr><td><img src="/images/icons/loading.gif" /></td><td>' . __('Loading CuteFlow. Please wait...','','layout') . '</td></tr></table></div></div>';
    $filepath = sfConfig::get('sf_app_dir') . '/config/template.yml';
    $cacheEnabled = sfYAML::Load($filepath);
    if($cacheEnabled['enableJavaScriptCache']['isEnabled'] == 1) { // caching is enabled
        $ccCache = new TemplateCaching();
        $ccCache->checkCacheDir();
        $ccCache->setFiles();
        $lastModified = $ccCache->getLastModifiedFile();
        $cacheCreated = $ccCache->getCurrentCacheStamp();

        if($lastModified > $cacheCreated OR $cacheCreated == '') {
            if($cacheCreated == '') {
                $cacheCreated = $lastModified;
            }
            $ccCache->createCache($lastModified, $cacheCreated);
        }
        $dir = array_diff(scandir(sfConfig::get('sf_cache_dir') . '/javaScriptCache'), Array());
        
        echo ' <script type="text/javascript" src="/djs/cache/'.substr($dir[count($dir)-1],0,-11).'.js"></script>' . "\n";
    }
    else { // caching is off
        echo '<script type="text/javascript" src="/djs/namespace/main.js"></script>';
        $files = new JavaScriptLoader();
        $jsFiles = $files->getAllFiles();
        foreach($jsFiles['djs'] as $singeFile) {
            echo '<script type="text/javascript" src="'.substr($singeFile,0,-11).'.js"></script>' . "\n";
        }
    }