public static function search($schema = NULL, $orderBy = NULL) { if (!$schema) { $schema = new StdClass(); } if (!$orderBy) { $orderBy = array('integer/id' => 'ASC'); } $sql = JsonStore::queryFromSchema('Idea', $schema, $orderBy); json_debug($sql); $results = self::mysqlQuery($sql); foreach ($results as $idx => $result) { $results[$idx] = new Idea($result); } return $results; }
/** * Parse form template using vars/values we set * also if aErrors not empty, merge it with aVars * * @param bool $useSubmittedVars if set to false then * will not update $this->aVars to the values of submitted * values and will reuse the vars that were set initially. * This is useful when form was submitted but then some error * occurred in a script that was parsing the form. * In that case * we often need to setFormError and then use values in form * than were there initially, no using any of the submitted values. * * @return string html parsed form template */ public function getForm($useSubmittedVars = true) { d('$this->aVars: ' . \json_debug($this->aVars)); if ($useSubmittedVars) { $this->prepareVars(); } $this->addErrors(); $tpl = $this->template; /** * Observer can * do setVar() on a passed form object * and add another element to aVars just before * form is rendered * */ $this->Registry->Dispatcher->post($this, 'onBeforeFormRender'); return $tpl::parse($this->aVars); }
$logPrefix = $headers[$logHeader]; } } } define('LOG_FILE_PATH', $Ini->getLogFilePath($logPrefix)); /** * Empty the log file if * necessary */ /** * LOG_PER_SCRIPT * will return string '1' for true * or empty string for false */ if (true === LAMPCMS_DEBUG && '' !== LOG_FILE_PATH && true === (bool) $Ini->LOG_PER_SCRIPT && !\Lampcms\Request::isAjax()) { file_put_contents(LOG_FILE_PATH, PHP_SAPI . ' ' . json_debug($_SERVER), LOCK_EX); } /** * Shortcuts to log debug and log error * MUST BE CALLED after DEBUG MODE and LOG_FILE_PATH * has been defined * * When script in run in non debug mode (production for example) * all calls to d('some debug message') are simple discarded * * Variable number of parameters can be given * They will be converted to strings and result concatenated as one message * to be logged * If running NOT in debug mode then evaluation of passed objects * will be avoided and function returns immediately without any overhead */
function json_handle_error($errorNumber, $errorString, $errorFile, $errorLine) { if ($errorNumber & E_NOTICE) { if (DEBUG) { json_debug("Notice {$errorNumber}: {$errorString} in {$errorFile}:{$errorLine}"); } } elseif ($errorNumber & E_STRICT) { if (DEBUG) { json_debug("Strict warning {$errorNumber}: {$errorString} in {$errorFile}:{$errorLine}"); } } elseif ($errorNumber & E_WARNING) { if (DEBUG) { json_debug("Warning {$errorNumber}: {$errorString} in {$errorFile}:{$errorLine}"); } } else { json_error("Error {$errorNumber}: {$errorString}", 500, array("file" => $errorFile, "line" => $errorLine)); } }