public function Render($template) { // to enable html minification flip the HTML_MINIFY flag in the ApplicationConfig.class.php if (ApplicationConfig::$HTML_MINIFY) { self::$template_engine->load_filter('output', 'html_minify'); } self::$template_engine->assign('developer_mode', ApplicationConfig::IsDeveloperMode()); $this->GetTemplateEngine()->display($template); }
public function previewAction() { $p = $this->request->getPost(); $prefix = $p['prefix']; $tableName = $p['table_name']; if ($prefix) { $tableName = "{$prefix}_{$tableName}"; } $modelName = Strings::tableNameToModelName($tableName); $path = ApplicationConfig::getConfig('product')['path'] . '\\www'; $this->createModelConfigFile($path, $modelName, $p); $configPath = ApplicationConfig::getConfigPath('config.json'); $cmdLine = "--prefix={$prefix} --table={$tableName} --config=\"{$configPath}\""; $c = Python3::run("build_mvc.py", $cmdLine); $targetHost = ApplicationConfig::getConfig('product')['host']; $testListUrl = "{$targetHost}/{$modelName}"; parent::result(array('model' => $modelName, 'files' => json_decode($c), 'cmd_line' => $cmdLine, 'test_list_url' => $testListUrl, 'build' => $c)); }
/** * @param $pythonFile * @param $params * @return string */ public static function run($pythonFile, $params = false) { $builder = ApplicationConfig::getConfig('builder'); $builderPath = $builder['scripts-path']; return exec("python {$builderPath}\\{$pythonFile} {$params}"); }
private static function getFileUploadPath() { $path = ApplicationConfig::getConfig('product')['path'] . '\\www\\model\\file-upload\\'; return $path; }
#include_once('Bootstrap.php'); use Core\Routing\RoutingEngine; use Core\ResultExecution\ViewEngine; use Core\Controllers\ControllerFactory; use Core\Container; use Core\RequestPipeline; use Core\ApplicationManager; define('DS', DIRECTORY_SEPARATOR); define('ROOT_PATH', basename(dirname(dirname(__FILE__))) . DS); define('ROOT', dirname(dirname(__FILE__)) . DS); define('ROOT_URL', 'http://' . $_SERVER['HTTP_HOST'] . DS); define('APP_ROOT_URL', ROOT_URL . ROOT_PATH); spl_autoload_register(function ($class) { $classPath = str_replace("\\", "/", $class); require_once dirname(__DIR__) . DS . $classPath . '.php'; }); session_start(); $appManager = ApplicationManager::getInstance(); $appManager->setControllerFactory(new ControllerFactory()); $appManager->setViewEngine(new ViewEngine()); $appManager->setContainer(new Container()); $appManager->setRoutingEngine(new RoutingEngine()); ApplicationConfig::initializeComponents($appManager); ApplicationConfig::registerAreas($appManager); ApplicationConfig::bootstrap(); $routingEngine = $appManager->getRoutingEngine(); $routingEngine->registerAnnotationRoutes(); ApplicationConfig::routeConfig($appManager->getRoutingEngine()); ApplicationConfig::registerBindings($appManager->getContainer()); RequestPipeline::execute(); die;
$filter->init(); $compiler->setOptions(array("compiledPath" => "./view/compiled-files/", "compiledExtension" => ".php", "compileAlways" => true)); return $volt; }); // Registering the view component $di->set('view', function () { $view = new View(); $view->setViewsDir(__DIR__ . '/view'); $view->registerEngines(array(".phtml" => 'voltService')); return $view; }); $di['tag'] = function () { return new AbTag(); }; $di->set('db', function () { $config = ApplicationConfig::getMySQLConnection(); $config['options'] = array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'); return new Phalcon\Db\Adapter\Pdo\Mysql($config); }); $di->set('redis', function () { require_once "redisproxy.php"; $redis = new RedisProxy(); return $redis; }); $di->setShared('session', function () { $session = new Session(); $session->start(); return $session; }); $di->set('modelsManager', function () { return new Phalcon\Mvc\Model\Manager();
public function tableNames() { $a = $this->db->fetchAll("SHOW tables"); $mysql = ApplicationConfig::getMySQLConnection(); $dbName = $mysql['dbname']; $key = "Tables_in_{$dbName}"; $tableNames = array(); foreach ($a as $table) { array_push($tableNames, $table[$key]); } return $tableNames; }
public static function getInstance() { self::$_instance = !empty(self::$_instance) ?: new Config(); return self::$_instance; }
public function __construct($di) { parent::__construct($di); $this->config = ApplicationConfig::getConfig(); self::$app = $this; }
public static function getEnumPath() { $productPath = ApplicationConfig::getConfig('product')['path']; $classNamePath = $productPath . '/www/defines'; return $classNamePath; }
/** * @param $search * @param bool|false $order * @return mixed */ public static function search($search, $order = false) { $clz = get_called_class(); $query = new AbBaseQuery($clz); $count = $query->count(); $binds = array(); $page = 1; $pageSize = ApplicationConfig::getDefaultPageSize(); $pageCount = $count / $pageSize + ($count % $pageSize != 0); $pageCount = $pageCount ?: 1; foreach ($search as $key => $value) { if ($key == '_url') { continue; } else { if ($key == '__pager_current') { $page = $value ? intval($value) : 1; continue; } else { if ($key == '__pager_size') { $pageSize = $value ? intval($value) : $pageSize; continue; } } } $params = array(); if (is_array($value)) { if (array_key_exists('from', $value)) { $params['range'] = '>='; $from = $value['from']; if (!empty($from)) { $binds = array_merge($binds, self::addCondition($query, $key, $from, $params)); } } if (array_key_exists('to', $value) && !empty($value['to'])) { $params['range'] = '<='; $to = $value['to']; if (!empty($to)) { $binds = array_merge($binds, self::addCondition($query, $key, $from, $params)); } } } else { if ($clz::isLikeField($key)) { $params['like'] = true; } if (!empty($value) || $value === '0') { $binds = array_merge($binds, self::addCondition($query, $key, $value, $params)); } } } if (method_exists($clz, 'beforeSearch')) { $clz::onSearch($query); } $params = array('binds' => $binds); if ($order) { $params['order'] = $order; } if (!empty($joins) && is_array($joins)) { foreach ($joins as $modelName => $fieldPair) { $query->addJoin($modelName, $fieldPair); } } $params['limit'] = array($pageSize, ($page - 1) * $pageSize); // Get results $items = $query->execute($params); return array('count' => $count, 'page_count' => $pageCount, 'items' => $items); }
public static function init(array $values) { self::$values = $values; }