本文整理汇总了PHP中issetor函数的典型用法代码示例。如果您正苦于以下问题:PHP issetor函数的具体用法?PHP issetor怎么用?PHP issetor使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了issetor函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process
public function process()
{
switch ($this->_attributeParse()) {
case 'base64':
$image = new Ajde_Resource_Image($this->attributes['filename']);
$image->setWidth($this->attributes['width']);
$image->setHeight($this->attributes['height']);
$image->setCrop($this->attributes['crop']);
$controller = Ajde_Controller::fromRoute(new Ajde_Core_Route('_core/component:imageBase64'));
$controller->setImage($image);
$controller->setWidth(issetor($this->attributes['width'], null));
$controller->setHeight(issetor($this->attributes['height'], null));
$controller->setExtraClass(issetor($this->attributes['class'], ''));
return $controller->invoke();
break;
case 'html':
$image = new Ajde_Resource_Image($this->attributes['filename']);
$image->setWidth($this->attributes['width']);
$image->setHeight($this->attributes['height']);
$image->setCrop($this->attributes['crop']);
$controller = Ajde_Controller::fromRoute(new Ajde_Core_Route('_core/component:image'));
$controller->setImage($image);
$controller->setExtraClass(issetor($this->attributes['class'], ''));
return $controller->invoke();
break;
case 'image':
return false;
break;
}
// TODO:
throw new Ajde_Component_Exception('Missing required attributes for component call');
}
示例2: process
public function process()
{
switch ($this->_attributeParse()) {
case 'list':
$options = issetor($this->attributes['options'], array());
$crud = new AjdeCrud($this->attributes['model'], $options);
$crud->setAction('list');
return $crud;
break;
case 'edit':
$options = issetor($this->attributes['options'], array());
$id = issetor($this->attributes['id'], null);
$crud = new AjdeCrud($this->attributes['model'], $options);
$crud->setId($id);
$crud->setAction('edit/layout');
return $crud;
break;
case 'mainfilter':
$controller = Controller::fromRoute(new Route('_core/crud:mainfilter'));
$controller->setCrud($this->attributes['crud']);
$controller->setRefresh(issetor($this->attributes['refresh'], false));
return $controller->invoke();
}
// TODO:
throw new Exception();
}
示例3: process
public function process()
{
switch ($this->_attributeParse()) {
case 'base64':
$image = new AjdeResourceImage($this->attributes['filename']);
$image->setWidth(issetor($this->attributes['width']));
$image->setHeight(issetor($this->attributes['height']));
$image->setCrop(String::toBoolean(issetor($this->attributes['crop'], true)));
$controller = Controller::fromRoute(new Route('_core/component:imageBase64'));
$controller->setImage($image);
$controller->setWidth(issetor($this->attributes['width'], null));
$controller->setHeight(issetor($this->attributes['height'], null));
$controller->setExtraClass(issetor($this->attributes['class'], ''));
return $controller->invoke();
break;
case 'html':
return self::getImageTag($this->attributes['filename'], issetor($this->attributes['width']), issetor($this->attributes['height']), String::toBoolean(issetor($this->attributes['crop'], true)), issetor($this->attributes['class'], ''), issetor($this->attributes['lazy'], false), issetor($this->attributes['absoluteUrl'], false));
break;
case 'image':
return false;
break;
}
// TODO:
throw new Exception('Missing required attributes for component call');
}
示例4: updateRessources
function updateRessources($db, $ressources, $startdate = null, $enddate = null, $GMT = "+1 hour")
{
if ($startdate == null) {
$startdate = date("Y-m-d");
}
if ($enddate == null) {
$enddate = date("Y-m-d", strtotime("+30 days"));
}
$nb = array();
foreach ($ressources as $ressource) {
$ical = new ICal('https://planning.univ-rennes1.fr/jsp/custom/modules/plannings/anonymous_cal.jsp?resources=' . $ressource . '&projectId=1&calType=ical&firstDate=' . $startdate . '&lastDate=' . $enddate);
$events = $ical->events();
$insertNb = 0;
purge_events($db, $ressource);
if ($events) {
foreach ($events as $event) {
$export_d = date("Y/m/d H:i:s", strtotime($GMT, $ical->iCalDateToUnixTimestamp($event['DTSTAMP'])));
$start_d = date("Y-m-d", strtotime($GMT, $ical->iCalDateToUnixTimestamp($event['DTSTART'])));
$start_t = date("H:i:s", strtotime($GMT, $ical->iCalDateToUnixTimestamp($event['DTSTART'])));
$end_d = date("Y-m-d", strtotime($GMT, $ical->iCalDateToUnixTimestamp($event['DTEND'])));
$end_t = date("H:i:s", strtotime($GMT, $ical->iCalDateToUnixTimestamp($event['DTEND'])));
$description = desc2json($event['DESCRIPTION']);
$req = $db->prepare('insert into events (UID,ressource, StartDate, StartTime, EndDate, EndTime, Title, Location, Description,Export) VALUES (?,?,?,?,?,?,?,?,?,?)');
$res = $req->execute(array(issetor($event['UID']), $ressource, $start_d, $start_t, $end_d, $end_t, $event['SUMMARY'], issetor($event['LOCATION']), $description, $export_d));
$insertNb += $res;
}
}
$nb[$ressource] = $insertNb;
}
$req = $db->prepare("UPDATE ressources r inner join events e on r.number = e.ressource set r.last_sync = e.Export");
$req->execute();
return $nb;
}
示例5: invoke
public function invoke($action = null, $format = null)
{
$timerKey = Ajde::app()->addTimer((string) $this->_route);
$action = issetor($action, $this->getAction());
$format = issetor($format, $this->getFormat());
$emptyFunction = $action;
$defaultFunction = $action . "Default";
$formatFunction = $action . ucfirst($format);
if (method_exists($this, $formatFunction)) {
$actionFunction = $formatFunction;
} elseif (method_exists($this, $defaultFunction)) {
$actionFunction = $defaultFunction;
} elseif (method_exists($this, $emptyFunction)) {
$actionFunction = $emptyFunction;
} else {
$exception = new Ajde_Exception(sprintf("Action %s for module %s not found", $this->getAction(), $this->getModule()), 90011);
Ajde::routingError($exception);
}
$return = true;
if (method_exists($this, 'beforeInvoke')) {
$return = $this->beforeInvoke();
if ($return !== true && $return !== false) {
// TODO:
throw new Ajde_Exception(sprintf("beforeInvoke() must return either TRUE or FALSE"));
}
}
if ($return === true) {
$return = $this->{$actionFunction}();
if (method_exists($this, 'afterInvoke')) {
$this->afterInvoke();
}
}
Ajde::app()->endTimer($timerKey);
return $return;
}
示例6: validate
public function validate($options = array())
{
$fieldsArray = $this->_model->getTable()->getFieldProperties();
$fieldOptions = array();
foreach ($fieldsArray as $fieldName => $fieldProperties) {
$fieldOptions[$fieldName] = array_merge($fieldProperties, issetor($options[$fieldName], array()));
}
$valid = true;
$errors = array();
$this->_initValidators($fieldOptions);
foreach ($this->_model->getValidators() as $fieldName => $fieldValidators) {
foreach ($fieldValidators as $fieldValidator) {
/* @var $validator Ajde_Model_ValidatorAbstract */
$value = null;
if ($this->_model->has($fieldName)) {
$value = $this->_model->get($fieldName);
}
$result = $fieldValidator->validate($fieldOptions[$fieldName], $value);
if ($result['valid'] === false) {
if (!isset($errors[$fieldName])) {
$errors[$fieldName] = array();
}
$errors[$fieldName][] = $result['error'];
$valid = false;
}
}
}
$this->_errors = $errors;
return $valid;
}
示例7: _initValidators
private function _initValidators($fieldOptions)
{
foreach ($fieldOptions as $fieldName => $fieldProperties) {
switch (issetor($fieldProperties['type'])) {
case Db::FIELD_TYPE_DATE:
$this->_model->addValidator($fieldName, new Date());
break;
case 'sort':
case Db::FIELD_TYPE_NUMERIC:
$this->_model->addValidator($fieldName, new Numeric());
break;
case Db::FIELD_TYPE_TEXT:
$this->_model->addValidator($fieldName, new Text());
break;
case Db::FIELD_TYPE_ENUM:
$this->_model->addValidator($fieldName, new Enum());
break;
case Db::FIELD_TYPE_SPATIAL:
$this->_model->addValidator($fieldName, new Spatial());
break;
default:
break;
}
if (issetor($fieldProperties['isRequired']) === true && issetor($fieldProperties['default']) == '') {
$this->_model->addValidator($fieldName, new Required());
}
if (issetor($fieldProperties['isUnique']) === true) {
$this->_model->addValidator($fieldName, new Unique());
}
}
}
示例8: execute
/**
* When execute is called record the time it takes and
* then log the query.
*
* @param array $input_parameters
*
* @throws Ajde_Db_Exception
* @throws Ajde_Exception
*
* @return PDO result set
*/
public function execute($input_parameters = null)
{
$log = ['query' => ''];
if (config('app.debug') === true) {
//$cache = Ajde_Db_Cache::getInstance();
if (count($input_parameters)) {
$log = ['query' => vsprintf(str_replace('?', '%s', $this->queryString), $input_parameters)];
} else {
$log = ['query' => '[PS] ' . $this->queryString];
}
// add backtrace
$i = 0;
$source = [];
foreach (array_reverse(debug_backtrace()) as $item) {
try {
$line = issetor($item['line']);
$file = issetor($item['file']);
$source[] = sprintf('%s. <em>%s</em>%s<strong>%s</strong> (%s on line %s)', $i, !empty($item['class']) ? $item['class'] : '<unknown class>', !empty($item['type']) ? $item['type'] : '::', !empty($item['function']) ? $item['function'] : '<unknown function>', $file, $line);
} catch (Exception $e) {
}
$i++;
}
$hash = md5(implode('', $source) . microtime());
$log['query'] = '<a href="javascript:void(0)" onclick="$(\'#' . $hash . '\').slideToggle(\'fast\');" style="color: black;">' . $log['query'] . '</a>';
$log['query'] .= '<div id="' . $hash . '" style="display: none;">' . implode('<br/>', $source) . '</div>';
}
// start timer
$start = microtime(true);
try {
//if (!$cache->has($this->queryString . serialize($input_parameters))) {
$result = parent::execute($input_parameters);
//$cache->set($this->queryString . serialize($input_parameters), $result);
// $log['cache'] = false;
//} else {
// $result = $cache->get($this->queryString . serialize($input_parameters));
// $log['cache'] = true;
//}
} catch (Exception $e) {
if (substr_count(strtolower($e->getMessage()), 'integrity constraint violation')) {
throw new Ajde_Db_IntegrityException($e->getMessage());
} else {
if (config('app.debug') === true) {
if (isset($this->queryString)) {
dump($this->queryString);
}
dump('Go to ' . config('app.rootUrl') . '?install=1 to install DB');
throw new Ajde_Db_Exception($e->getMessage());
} else {
Ajde_Exception_Log::logException($e);
die('DB connection problem. <a href="?install=1">Install database?</a>');
}
}
}
$time = microtime(true) - $start;
$log['time'] = round($time * 1000, 0);
Ajde_Db_PDO::$log[] = $log;
return $result;
}
示例9: getLinkTemplateFilename
public static function getLinkTemplateFilename($type, $format = 'null')
{
if (Ajde::app()->getDocument()->hasLayout()) {
$layout = Ajde::app()->getDocument()->getLayout();
} else {
$layout = new Ajde_Layout(Config::get("layout"));
}
$format = issetor($format, 'html');
return LAYOUT_DIR . $layout->getName() . '/link/' . $type . '.' . $format . '.php';
}
示例10: formUploadHtml
public function formUploadHtml()
{
$options = $this->getOptions();
$optionsId = md5(serialize($options));
$session = new Ajde_Session('AC.Form');
$session->set($optionsId, $options);
$this->setAction('form/upload');
$this->getView()->assign('name', $this->getName());
$this->getView()->assign('optionsId', $optionsId);
$this->getView()->assign('optionsMultiple', issetor($options['multiple'], false));
$this->getView()->assign('inputId', $this->getInputId());
$this->getView()->assign('extraClass', $this->getExtraClass());
return $this->render();
}
示例11: dump
public static function dump($var, $collapse = false)
{
$i = 0;
$line = null;
foreach (debug_backtrace() as $item) {
$source = sprintf("%s. dumped from <em>%s</em>%s<strong>%s</strong> (line %s)", count(self::$dump) + 1, !empty($item['class']) ? $item['class'] : '<unknown class> (in <span style=\'font-size: 0.8em;\'>' . $item['args'][0] . '</span>)', !empty($item['type']) ? $item['type'] : '::', !empty($item['function']) ? $item['function'] : '<unknown function>', $line);
$line = issetor($item['line'], null);
if ($i == 2) {
break;
}
$i++;
}
self::$dump[$source] = array($var, $collapse);
}
示例12: process
public function process()
{
// TODO: check for required attributes
// if (!array_key_exists('library', $this->attributes) || !array_key_exists('version', $this->attributes)) {
// throw new Ajde_Component_Exception();
// }
if (array_key_exists('library', $this->attributes)) {
$this->requireJsLibrary($this->attributes['library'], $this->attributes['version']);
} elseif (array_key_exists('action', $this->attributes)) {
$this->requireResource(Ajde_Resource_Local::TYPE_JAVASCRIPT, $this->attributes['action'], issetor($this->attributes['format'], null), issetor($this->attributes['base'], null), issetor($this->attributes['position'], null), issetor($this->attributes['arguments'], ''));
} elseif (array_key_exists('filename', $this->attributes)) {
$this->requirePublicResource(Ajde_Resource_Local::TYPE_JAVASCRIPT, $this->attributes['filename'], issetor($this->attributes['position'], null), issetor($this->attributes['arguments'], ''));
} elseif (array_key_exists('url', $this->attributes)) {
$this->requireRemoteResource(Ajde_Resource_Local::TYPE_JAVASCRIPT, $this->attributes['url'], issetor($this->attributes['position'], null), issetor($this->attributes['arguments'], ''));
}
}
示例13: process
public function process()
{
switch ($this->_attributeParse()) {
case 'local':
$this->requireResource(Ajde_Resource_Local::TYPE_STYLESHEET, $this->attributes['action'], issetor($this->attributes['format'], null), issetor($this->attributes['base'], null), issetor($this->attributes['position'], null), issetor($this->attributes['arguments'], ''));
break;
case 'public':
$this->requirePublicResource(Ajde_Resource_Local::TYPE_STYLESHEET, $this->attributes['filename'], issetor($this->attributes['position'], null), issetor($this->attributes['arguments'], ''));
break;
case 'font':
$url = Ajde_Resource_GWebFont::getUrl($this->attributes['fontFamily'], issetor($this->attributes['fontWeight'], array(400)), issetor($this->attributes['fontSubset'], array('latin')));
$resource = new Ajde_Resource_Remote(Ajde_Resource::TYPE_STYLESHEET, $url);
$this->getParser()->getDocument()->addResource($resource, Ajde_Document_Format_Html::RESOURCE_POSITION_TOP);
break;
}
}
示例14: dump
public static function dump($var, $expand = true)
{
$i = 0;
$line = null;
foreach (debug_backtrace() as $item) {
try {
$source = sprintf('%s. dumped from <em>%s</em>%s<strong>%s</strong> (line %s)', count(self::$dump) + 1, isset($item['class']) ? is_object($item['class']) ? get_class($item['class']) : $item['class'] : '<unknown class> (in <span style=\'font-size: 0.8em;\'>' . print_r($item['args'][0]) . '</span>)', !empty($item['type']) ? $item['type'] : '::', !empty($item['function']) ? $item['function'] : '<unknown function>', $line);
$line = issetor($item['line'], null);
} catch (Exception $e) {
}
if ($i == 2) {
break;
}
$i++;
}
self::$dump[$source] = [$var, $expand];
}
示例15: getLinkTemplateFilename
public static function getLinkTemplateFilename($type, $format = 'null')
{
if (Ajde::app()->getDocument()->hasLayout()) {
$layout = Ajde::app()->getDocument()->getLayout();
} else {
$layout = new Ajde_Layout(config('layout.frontend'));
}
$format = issetor($format, 'html');
$dirPrefixPatterns = [APP_DIR, CORE_DIR];
foreach ($dirPrefixPatterns as $dirPrefixPattern) {
$prefixedLayout = $dirPrefixPattern . LAYOUT_DIR;
if (self::exist($prefixedLayout . $layout->getName() . '/link/' . $type . '.' . $format . '.php')) {
return $prefixedLayout . $layout->getName() . '/link/' . $type . '.' . $format . '.php';
}
}
return false;
}