public function __construct(ApplicationTool $appTool)
 {
     $this->AppTool = $appTool;
     $cnInfo = $appTool->getProperty('db');
     if (isset($cnInfo['tablePrefix'])) {
         $this->TablePrefix = $cnInfo['tablePrefix'];
         unset($cnInfo['tablePrefix']);
     } else {
         $this->TablePrefix = '';
     }
     $this->cnInfo = $cnInfo;
 }
Exemple #2
0
 public function __construct(ApplicationTool $appTool)
 {
     $this->tablePrefix = $appTool->getProperty('tablePrefix');
     $jsonFile = $appTool->getProperty('directory') . '/meta.json';
     $dataStr = file_get_contents($jsonFile);
     if ($dataStr === false) {
         throw new Error("Cannot open the meta file: {$jsonFile}");
     }
     $this->data = json_decode($dataStr, true);
     if (!isset($this->data)) {
         throw new Error("Invalid JSON data in the meta file: {$jsonFile}");
     }
     Helper::formatArray($this->data, ['fields' => ['fields' => ['default' => []], 'fieldSets' => ['default' => []], 'taxonomies' => ['default' => []], 'roles' => ['default' => []], 'langs' => ['default' => []], 'status' => ['default' => []], 'contributorTypes' => ['default' => []]]]);
 }
 private function cachePathToPath(array $cachePath, $httpMethod)
 {
     $fragments = $cachePath;
     $last = end($fragments);
     if (is_array($last)) {
         $flatParams = $last;
         array_pop($fragments);
     } else {
         $flatParams = null;
     }
     $router = $this->app->getRouter();
     $entry = $router->getMatchingRoute($httpMethod, $fragments);
     if (!isset($entry) || $entry['is404']) {
         throw new Error('Cannot find a route for path: ' . implode('/', $fragments));
     }
     $path = ['fragments' => $fragments, 'trailingSlash' => $entry['trailingSlash'] ? true : false, 'flatParameters' => $flatParams];
     return $router->populatePathKeys($path, $entry);
 }
 /**
  * @return QueryIt
  */
 private function getQI()
 {
     if (!isset($this->qi)) {
         /** @var DataProcessorService $dp */
         $dp = $this->app->getService('DataProcessor');
         $this->qi = $dp->createQueryIt();
     }
     return $this->qi;
 }
Exemple #5
0
function staticFiles(ApplicationTool $tool, array $parameters)
{
    \QPress\Debug::log('command: ' . __FUNCTION__ . ': ' . var_export($parameters, true) . "\n" . print_r($tool->getQuery(), true));
    // TODO
}