Exemplo n.º 1
0
/**
 * function for checking if your are denying people 
 * from e.g. admin areas of your module. 
 */
function dev_test_access($options = null)
{
    $files = file::getFileListRecursive(conf::pathModules(), "*module.php");
    foreach ($files as $val) {
        $class_path = "modules" . str_replace(conf::pathModules(), '', $val);
        $class_path = str_replace('.php', '', $class_path);
        $class = str_replace('/', "\\", $class_path);
        $ary = get_class_methods($class);
        if (!is_array($ary)) {
            continue;
        }
        $call_paths = dev_get_actions($ary, $class_path);
        foreach ($call_paths as $path) {
            $url = conf::getSchemeWithServerName() . "{$path}";
            $curl = new mycurl($url);
            $curl->createCurl();
            echo $curl->getHttpStatus();
            common::echoMessage(" Status code recieved on: {$url}");
        }
    }
}
Exemplo n.º 2
0
 /**
  * Updates a PHP string with extracted translation
  * Updating means that any changes to the values of 
  * e.g. $LANG['My sentence'] will not be changed
  * @param string $dir
  * @return string $translation_str
  */
 public function updateLangStrForPath($dir)
 {
     $file_list = file::getFileListRecursive($dir);
     asort($file_list);
     // compose a php file
     $translation_str = "<?php\n\n";
     $translation_str .= "\$" . $this->translateAryName . " = array();\n";
     // if lang file does not exists
     $lang_file = $this->getLanguageFileFromDir($dir);
     if (!file_exists($lang_file)) {
         return $this->createLangStrForPath($dir);
     }
     include $lang_file;
     $original_ary = ${$this->translateAryName};
     if (empty($original_ary)) {
         return $this->createLangStrForPath($dir);
     }
     foreach ($file_list as $file) {
         if (!$this->isText($file)) {
             continue;
         }
         $file_str = file_get_contents($file);
         $strings = $this->search($file_str);
         // no strings we continue
         if (empty($strings)) {
             continue;
         }
         $translation_str .= "\n// Translation of file {$file}\n\n";
         // and we add all strings
         foreach ($strings as $trans) {
             if (!isset($original_ary[$trans])) {
                 // new value
                 $translation_str .= $this->setCorrectQuotes($trans);
             } else {
                 // keep old value
                 $old_value = $original_ary[$trans];
                 $translation_str .= $this->setCorrectQuotes($trans, $old_value);
             }
         }
     }
     return $translation_str;
 }