Ejemplo n.º 1
0
 /**
  * whether this parser can make a given target
  */
 public function can_handle($project, $file)
 {
     if ($file->is_target()) {
         return false;
     }
     return has_extension($file->name(), ".plot");
 }
Ejemplo n.º 2
0
 public function __construct($dir)
 {
     $dir = PROJECTS_PLUGINS_DIR . $dir;
     $dh = opendir($dir);
     if ($dh == false) {
         return;
     }
     while (($file = readdir($dh)) != false) {
         if (!has_extension($file, '.php')) {
             continue;
         }
         include_once $dir . $file;
         $name = explode('.', $file);
         array_pop($name);
         $class = PROJECTS_PLUGINS_PREFIX . implode('_', $name);
         if (!class_exists($class)) {
             continue;
         }
         $plugin = new $class();
         if ($plugin != NULL) {
             $this->plugins[$plugin->name()] = $plugin;
         }
     }
     closedir($dh);
 }
Ejemplo n.º 3
0
 /**
  * whether this rule can make a given target
  */
 public function can_handle($project, $file)
 {
     if (!has_extension($file->name(), '.png')) {
         return false;
     }
     $plot = $this->replace_extension($file->name(), '.png', '.plot');
     return $project->file($plot) != NULL;
 }
Ejemplo n.º 4
0
 /** 
  * The dependent recipe
  */
 protected function recipe($project, $file)
 {
     $deps = $file->dependency();
     $args = implode(" ", $deps);
     $name = $file->name();
     if (has_extension($name, ".a")) {
         return "ar rcs {$name} {$args}";
     }
     return "g++ -static -o {$name} {$args}";
 }
Ejemplo n.º 5
0
 /**
  * whether this rule can make a given target
  */
 public function can_handle($project, $file)
 {
     $name = $file->name();
     if (!has_extension($name, ".o")) {
         return false;
     }
     $cpp = $this->replace_extension($name, ".o", ".cpp");
     if ($project->file($cpp) != NULL) {
         return true;
     }
     $c = $this->replace_extension($name, ".o", ".c");
     if ($project->file($c) != NULL) {
         return true;
     }
     return false;
 }
Ejemplo n.º 6
0
 /**
  * The default recipe
  */
 protected function recipe($project, $file)
 {
     $tex = $this->replace_extension($file->name(), ".pdf", ".tex");
     $base = substr($tex, 0, -4);
     $bibtex = "";
     $pdflatex = "pdflatex -interaction=nonstopmode {$tex}\n";
     $texfile = $project->file($tex);
     if (!$texfile) {
         return '';
     }
     foreach ($texfile->dependency() as $dep) {
         if (has_extension($dep, ".bib")) {
             $bibtex = "bibtex {$base}\n";
             break;
         }
     }
     return "rm -f {$base}.aux" . "\n" . $pdflatex . $bibtex . $pdflatex;
 }
Ejemplo n.º 7
0
 public function rebuild()
 {
     if (!$this->mutex->acquire()) {
         return false;
     }
     @unlink($this->project_file);
     $this->files = array();
     $this->errors = array();
     $this->modified = true;
     $this->save_project(false);
     $this->mutex->release();
     $this->clean();
     global $ID;
     $pages_path = DOKU_DATA . 'pages/' . implode('/', explode(':', $this->ID)) . '/';
     if (($dh = opendir($pages_path)) === false) {
         return true;
     }
     while (($file = readdir($dh)) !== false) {
         if ($file === '.' || $file === '..' || !has_extension($file, '.txt')) {
             continue;
         }
         if (is_dir($path)) {
             continue;
         }
         $file_id = substr($file, 0, -4);
         $this->sync($file_id);
     }
     closedir($dh);
     return true;
 }
Ejemplo n.º 8
0
function require_js()
{
    foreach (func_get_args() as $fichier_js) {
        echo '<script type="text/javascript" src="' . relative_or_external($fichier_js, 'lib/') . has_extension($fichier_js, '.js') . '?' . rand(0, 99999) . '"></script>' . "\n";
    }
}