public static function deployVendors()
 {
     $webRscPath = realpath(_::getConfig("WEB_RSC_PATH"));
     if (file_exists(POKELIO_ROOT_PATH . '/Vendors')) {
         Pokelio_File::makedir($webRscPath . '/Vendors');
         Pokelio_File::copyDir(POKELIO_ROOT_PATH . '/Vendors', $webRscPath . '/Vendors');
     }
 }
Example #2
0
 public static function serveFile($filename)
 {
     $extension = Pokelio_File::getFileExtension($filename);
     $mimeType = self::getMimeType($extension);
     if ($mimeType != false) {
         ob_clean();
         header("Content-Type: " . $mimeType);
         $bytes = readfile($filename);
         exit;
     } else {
         trigger_error("Extension " . $extension . " not found.");
     }
 }
Example #3
0
 private static function processView($viewFile, $procViewFile)
 {
     $viewContent = file_get_contents($viewFile);
     //$pattern = "/{{(.*)}}/"; Error, no procesa varios en una linea
     //$pattern = "/{{(.*?)}}/";
     $pattern = "@<m>(.*?)</m>@";
     preg_match_all($pattern, $viewContent, $matches);
     foreach ($matches[1] as $match) {
         $target = self::parse($match);
         //$viewContent=str_replace("{{".$match."}}",$target,$viewContent);
         $viewContent = str_replace("<m>" . $match . "</m>", $target, $viewContent);
     }
     //Save the processed view with replaced MicroSyntax elements
     Pokelio_File::writeFile($procViewFile, $viewContent);
 }
Example #4
0
 public static function rmDir($dir)
 {
     $entries = scandir($dir);
     foreach ($entries as $entry) {
         if (substr($entry, 0, 1) != '.') {
             $pathEntry = $dir . '/' . $entry;
             if (is_file($pathEntry)) {
                 unlink($pathEntry);
             }
             if (is_dir($pathEntry)) {
                 Pokelio_File::rmDir($pathEntry);
                 rmdir($pathEntry);
             }
         }
     }
 }
Example #5
0
 private static function generateEntityClass($module, $table, $columns, $maxNameLength)
 {
     $entityCode = "";
     $entityCode = "<?php \n";
     $entityCode .= "/** \n";
     $entityCode .= " *  " . $module . "_" . $table . "Entity\n";
     $entityCode .= " *  A class containing mappings of {$table} table.\n";
     $entityCode .= " *  \n";
     $entityCode .= " *  Code generated by Pokelio Codegen Module on " . date('r') . "\n";
     $entityCode .= " *  \n";
     $entityCode .= " */ \n";
     $entityCode .= "class " . $module . "_" . $table . "Entity { \n";
     foreach ($columns as $column) {
         $entityCode .= "    /** \n";
         $phpType = self::getPhpType($column['DATA_TYPE']);
         $entityCode .= "     * @var " . str_pad($phpType, 8) . " " . $column['COLUMN_COMMENT'] . "<br />" . "\n";
         $entityCode .= "     * <b>Column Type:</b> " . $column['COLUMN_TYPE'] . "<br />" . "\n";
         $entityCode .= "     * <b>Nullable:</b> " . $column['IS_NULLABLE'] . "<br />" . "\n";
         $entityCode .= "     * <b>Column Key:</b> " . $column['COLUMN_KEY'] . "<br />" . "\n";
         $entityCode .= "     * <b>Extra info:</b> " . $column['EXTRA'] . "<br />" . "\n";
         $entityCode .= "     */ \n";
         $entityCode .= "    public \$" . $column['COLUMN_NAME'] . "; \n";
     }
     $entityCode .= "} \n";
     Pokelio_File::writeFile(APP_MODULES_PATH . '/' . $module . '/Model/' . $table . 'Entity.php', $entityCode);
 }