Current Path : /data/web/virtuals/51568/virtual/www/subdom/jidelna/php/ |
Current File : /data/web/virtuals/51568/virtual/www/subdom/jidelna/php/funkce.php |
<?php spl_autoload_register(function ($class_name) { if (file_exists('php/'.$class_name . '.php')) { include ('php/'.$class_name . '.php'); } else { include ($class_name . '.php'); } }); function includeJS($class_name){ $jsFile = 'php/'.$class_name . '.js'; $jsFileMin = 'php/'.$class_name . '.min.js'; if (file_exists($jsFile)) { $jsFileAge = filemtime($jsFile); } else { $jsFileAge = false;} if (file_exists($jsFileMin)) { $jsFileAgeMin = filemtime($jsFileMin); } else { $jsFileAgeMin = false;} if ($jsFileAge && $jsFileAgeMin) { if ($jsFileAgeMin >= $jsFileAge){ $js = file_get_contents($jsFileMin); } else { $js = file_get_contents($jsFile); } } elseif ($jsFileAgeMin) { $js = file_get_contents($jsFileMin); } elseif ($jsFileAge) { $js = file_get_contents($jsFile); } else { $js = false; } if ($js){ $js = <<<JS <script> {$js} </script> JS; echo $js; } } ?>