function assert_file_exists($path) { if (file_exists($path)) { return true; } logger::getInstance()->doLog(LOG_LEVEL_ASSERT, "file does not exist: " . $path); return false; }
public function isValid() { if (substr($this->getSelector(), 0, 1) == "#" && strpos($this->getSelector(), " ") === false) { if ($this->content != null) { return parent::isValid(); } else { logger::getInstance()->doLog(LOG_LEVEL_ASSERT, "googlemapshook needs an ID as a selector! Selector given: " . $this->getSelector()); return false; } } else { logger::getInstance()->doLog(LOG_LEVEL_ASSERT, "googlemapshook needs an ID as a selector! Selector given: " . $this->getSelector()); return false; } }
public function __construct($node, $name, $placeholder) { $this->label = new label($name); if ($node == "textarea") { $this->input = new textarea($name, $placeholder); } else { if ($node != "input") { logger::getInstance()->doLog(LOG_LEVEL_ERROR, "not supported node" . $node); } if (strtolower($name) == "email") { $this->input = new input("email", $name, $placeholder); } else { $this->input = new input("text", $name, $placeholder); } } }
public function addHeader(array $header) { if ($this->head != null) { logger::getInstance()->doLog(LOG_LEVEL_ASSERT, "added header twice with content " . json_encode($header)); } else { $this->addHead(); } $row = new basenode("th"); foreach ($header as $item) { $rowcontent = new basenode("td"); $rowcontent->setText($item); $row->addChildren($rowcontent); } if ($this->head instanceof basenode) { $this->head->addChildren($row); } }
public function isValid() { if (!file_exists(PROJECTS_DIR . "/contact/configuration.php")) { logger::getInstance()->doLog(LOG_LEVEL_ASSERT, PROJECTS_DIR . "/contact/configuration.php does not exist!"); return false; } $str = 'array('; foreach ($this->fields as $field) { $str .= '"' . $field . '"'; } $str .= ")"; $contr = file_get_contents(__DIR__ . "/contact/mailer.php"); $contr = str_replace("[KEYS]", $str, $contr); $contr = str_replace("[EMAIL_KEY]", $this->emailId, $contr); $contr = str_replace("[NAME_KEY]", $this->nameId, $contr); file_put_contents(PROJECTS_DIR . "/contact/mailer.php", $contr); \famoser\opc\framework\fileshelper\copy_directory_contents(__DIR__ . "/contact/libs", PROJECTS_DIR . "/contact/libs"); logger::getInstance()->doLog(LOG_LEVEL_INFO, "testemail send to " . TEST_EMAIL . ". Please check your inbox"); return true; }
/** * Created by PhpStorm. * User: Florian Moser * Date: 20.12.2015 * Time: 22:01 */ use famoser\opc\framework\interfaces\iProjektHook; use famoser\opc\framework\logging\logger; use function famoser\opc\framework\phphelper\bye_framework; use function famoser\opc\framework\phphelper\hi_framework; define("SOURCE_DIR", __DIR__); define("PROJECTS_DIR", dirname(__DIR__) . "/projects"); define("PLUGINS_DIR", dirname(__DIR__) . "/plugins"); foreach (glob(SOURCE_DIR . "/framework/*.php") as $filename) { include_once $filename; } try { hi_framework(); $proj = init_projekt("helloworld"); if ($proj instanceof iProjektHook) { $proj->execute(); header("Location: " . PROJECT_DEPLOY_URL); } else { echo "Projekt not found"; } bye_framework(); } catch (Exception $ex) { logger::getInstance()->logException($ex); echo logger::getInstance()->retrieveAllLogs(); }
private function preparePlugins() { foreach ($this->plugins as $key => $plugin) { if ($plugin instanceof iPluginHook) { if ($plugin->isUsed()) { if ($plugin->isValid()) { $this->css->addPluginCss($plugin->getCss()); $this->javascript->addPluginJavascript($plugin->getJavascript()); $this->body->addChildren($plugin->getBodyNodes()); $this->head->addChildren($plugin->getHeadNodes()); $this->javascript->addJavascriptElements($plugin->getJavascriptElement()); } else { logger::getInstance()->doLog(LOG_LEVEL_ERROR, "plugin not valid! " . $key); } } else { logger::getInstance()->doLog(LOG_LEVEL_INFO, "plugin deaktivated because not in use: " . $key); } } } }
function file_to_string($filepath) { if (file_exists($filepath)) { ob_start(); include $filepath; $res = ob_get_contents(); ob_end_clean(); return $res; } else { logger::getInstance()->doLog(LOG_LEVEL_ERROR, "File not found: " . $filepath); return ""; } }
use famoser\opc\css\properties\colors; use function famoser\opc\framework\phphelper\bye_framework; use function famoser\opc\framework\phphelper\hi_framework; define("SOURCE_DIR", __DIR__); define("PROJECTS_DIR", dirname(__DIR__) . "/projects"); define("PLUGINS_DIR", dirname(__DIR__) . "/plugins"); foreach (glob(SOURCE_DIR . "/framework/*.php") as $filename) { include_once $filename; } try { hi_framework(); $css = ' position: fixed; top: 0; z-index: 1000; } .text-center { text-align: center; '; echo $css; echo "minified:"; $minifier = new \famoser\opc\libs\minifier\minifierClient(true); echo $minifier->minify_css($css); $node = new simpleproperty(new colors(new color("#222222"), new backgroundcolor("#224444"))); echo $node->getCommonCss(); bye_framework(); } catch (Exception $ex) { \famoser\opc\framework\logging\logger::getInstance()->logException($ex); echo \famoser\opc\framework\logging\logger::getInstance()->retrieveAllLogs(); }