本文整理汇总了PHP中forward_static_call函数的典型用法代码示例。如果您正苦于以下问题:PHP forward_static_call函数的具体用法?PHP forward_static_call怎么用?PHP forward_static_call使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了forward_static_call函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _
/**
* Render extjs text form field
*
* @param \Engine\Crud\Form\Field $field
* @return string
*/
public static function _(Field\PasswordConfirm $field)
{
$fieldCode = [];
if ($field->isHidden()) {
$fieldCode[] = "xtype: 'hiddenfield'";
} else {
$fieldCode[] = "xtype: 'textfield'";
}
$fieldCode[] = "name: '" . $field->getKey() . "'";
$fieldCode[] = "inputType: 'password'";
$fieldCode[] = "allowBlank: " . ($field->isRequire() ? "false" : "true");
$label = $field->getLabel();
if ($label) {
$fieldCode[] = "fieldLabel: '" . $label . "'";
}
$desc = $field->getDesc();
if ($desc) {
$fieldCode[] = "boxLabel: '" . $desc . "'";
}
$width = $field->getWidth();
if ($width) {
$fieldCode[] = "width: " . $width;
}
$confirmKey = $field->getConfirmKey();
$fieldCode[] = "validator: function(value) {\n var password1 = this.previousSibling('[name=" . $confirmKey . "]');\n return (value === password1.getValue()) ? true : 'Passwords do not match.'\n }";
return forward_static_call(['self', '_implode'], $fieldCode);
}
示例2: run
/**
* Run cron task. Attention - this method is too 'fat' to run from any app's
* @return array|null
*/
public function run()
{
// check if cron instances is defined
if (!isset($this->configs['instances']) || !Obj::isArray($this->configs['instances'])) {
return null;
}
// get timestamp
$time = time();
$log = [];
// each every one instance
foreach ($this->configs['instances'] as $callback => $delay) {
if ((int) $this->configs['log'][$callback] + $delay <= $time) {
// prepare cron initializing
list($class, $method) = explode('::', $callback);
if (class_exists($class) && method_exists($class, $method)) {
// make static callback
forward_static_call([$class, $method]);
$log[] = $callback;
}
// update log information
$this->configs['log'][$callback] = $time + $delay;
}
}
// write updated configs
App::$Properties->writeConfig('Cron', $this->configs);
return $log;
}
示例3: _
/**
* Render extjs number form field
*
* @param \Engine\Crud\Form\Field $field
* @return string
*/
public static function _(Field\Numeric $field)
{
$fieldCode = [];
if ($field->isHidden()) {
$fieldCode[] = "xtype: 'hiddenfield'";
} else {
$fieldCode[] = "xtype: 'numberfield'";
}
if ($field->isNotEdit()) {
$fieldCode[] = "readOnly: true";
}
$fieldCode[] = "name: '" . $field->getKey() . "'";
$fieldCode[] = "allowBlank: " . ($field->isRequire() ? "false" : "true");
$label = $field->getLabel();
if ($label) {
$fieldCode[] = "fieldLabel: '" . $label . "'";
}
$desc = $field->getDesc();
if ($desc) {
$fieldCode[] = "boxLabel: '" . $desc . "'";
}
$width = $field->getWidth();
if ($width) {
$fieldCode[] = "width: " . $width;
}
$minValue = $field->getMinValue();
$maxValue = $field->getMaxValue();
if ($minValue !== null && $minValue !== false) {
$fieldCode[] = " minValue: '" . $minValue . "'";
}
if ($maxValue !== null && $maxValue !== false) {
$fieldCode[] = " maxValue: '" . $maxValue . "'";
}
return forward_static_call(['self', '_implode'], $fieldCode);
}
示例4: getValue
public function getValue($param = null)
{
if ($this->_value != null) {
return parent::getValue();
}
if (!$this->getParent()) {
throw new Exception(sprintf("Meta property '%s' missing a parent reference", $this->_id));
}
$property = $this->getParent()->getRecursiveProperty($this->getParameter('property'));
if ($property instanceof CollectionProperty) {
$subParts = explode('.', $this->getParameter('action'));
$collection = $property->getValue();
return $collection->{$subParts[0]}(isset($subParts[1]) ? $subParts[1] : null);
} else {
if ($property instanceof ObjectProperty) {
$subParts = explode('.', $this->getParameter('action'));
$object = $property->getValue(ObjectModel::MODEL);
return $object instanceof BaseObject ? $object->{$subParts[0]}(isset($subParts[1]) ? $subParts[1] : null) : null;
} else {
$class = $this->_parent->getClass();
$action = $this->getParameter('action');
$array = array($this->_parent->getClass(), $this->getParameter('action'));
try {
$val = forward_static_call($array, $this->_parent);
} catch (\Exception $e) {
throw new Exception($e->getMessage());
}
return $val;
}
}
}
示例5: _
/**
* Render extjs mail form field
*
* @param \Engine\Crud\Form\Field $field
* @return string
*/
public static function _(Field $field)
{
$fieldCode = [];
if ($field->isHidden()) {
$fieldCode[] = "xtype: 'hiddenfield'";
} else {
$fieldCode[] = "xtype: 'textfield'";
}
if ($field->isNotEdit()) {
$fieldCode[] = "readOnly: true";
}
$fieldCode[] = "name: '" . $field->getKey() . "'";
$fieldCode[] = "allowBlank: " . ($field->isRequire() ? "false" : "true");
$label = $field->getLabel();
if ($label) {
$fieldCode[] = "fieldLabel: '" . $label . "'";
}
$desc = $field->getDesc();
if ($desc) {
$fieldCode[] = "boxLabel: '" . $desc . "'";
}
$width = $field->getWidth();
if ($width) {
$fieldCode[] = "width: " . $width;
}
$fieldCode[] = "vtype: 'email'";
return forward_static_call(['self', '_implode'], $fieldCode);
}
示例6: _
/**
* Render extjs image file uplaod form field
*
* @param \Engine\Crud\Form\Field $field
* @return string
*/
public static function _(Field\Image $field)
{
$fieldCode = [];
if ($field->isHidden()) {
$fieldCode[] = "xtype: 'hiddenfield'";
} else {
$fieldCode[] = "xtype: 'filefield'";
}
if ($field->isNotEdit()) {
$fieldCode[] = "readOnly: true";
}
$fieldCode[] = "name: '" . $field->getKey() . "'";
$fieldCode[] = "allowBlank: " . ($field->isRequire() ? "false" : "true");
$label = $field->getLabel();
if ($label) {
$fieldCode[] = "fieldLabel: '" . $label . "'";
}
$desc = $field->getDesc();
if ($desc) {
$fieldCode[] = "boxLabel: '" . $desc . "'";
}
$width = $field->getWidth();
if ($width) {
$fieldCode[] = "width: " . $width;
}
$fieldCode[] = "emptyText: 'Select an image'";
$fieldCode[] = "buttonText: ''";
$fieldCode[] = "buttonConfig: {iconCls: 'icon-upload'}";
return forward_static_call(['self', '_implode'], $fieldCode);
}
示例7: _getStore
/**
* Gets, and creates if neccessary, a store object
*
* @return AbstractData
*/
private function _getStore()
{
if ($this->_store === null) {
$this->_store = forward_static_call('PrivateBin\\Data\\' . $this->_conf->getKey('class', 'model') . '::getInstance', $this->_conf->getSection('model_options'));
}
return $this->_store;
}
示例8: _
/**
* Render extjs password form field
*
* @param \Engine\Crud\Form\Field $field
* @return string
*/
public static function _(Field\Password $field)
{
$fieldCode = [];
if ($field->isHidden()) {
$fieldCode[] = "xtype: 'hiddenfield'";
} else {
$fieldCode[] = "xtype: 'textfield'";
}
$fieldCode[] = "name: '" . $field->getKey() . "'";
$fieldCode[] = "inputType: 'password'";
$fieldCode[] = "allowBlank: " . ($field->isRequire() ? "false" : "true");
$label = $field->getLabel();
if ($label) {
$fieldCode[] = "fieldLabel: '" . $label . "'";
}
$desc = $field->getDesc();
if ($desc) {
$fieldCode[] = "boxLabel: '" . $desc . "'";
}
$width = $field->getWidth();
if ($width) {
$fieldCode[] = "width: " . $width;
}
$minLength = $field->getMinLength();
$fieldCode[] = "minLength: " . $minLength;
return forward_static_call(['self', '_implode'], $fieldCode);
}
示例9: findVariable
/**
* @param $slug string
* @return string|null
*/
protected function findVariable($slug)
{
/** @var $modelQuery \yii\db\ActiveQuery */
$modelQuery = forward_static_call([\Yii::createObject(VariableModel::class), 'find']);
$variable = $modelQuery->where(['slug' => $slug])->one();
return $variable ? $variable['content'] : null;
}
示例10: _getStore
/**
* Gets, and creates if neccessary, a store object
*/
private function _getStore()
{
if ($this->_store === null) {
$this->_store = forward_static_call(array($this->_conf->getKey('class', 'model'), 'getInstance'), $this->_conf->getSection('model_options'));
}
return $this->_store;
}
示例11: registerObserver
/**
* Register auth model observers.
*
* @return void
*/
protected function registerObserver()
{
$config = $this->app['config'];
$model = $config->get('laravie/warden::model', $config->get('auth.model'));
$observer = new UserObserver($this->app->make('laravie.warden'), $config->get('laravie/warden', []));
forward_static_call([$model, 'observe'], $observer);
}
示例12: _
/**
* Render extjs number filter field
*
* @param \Engine\Crud\Grid\Filter\Field $field
* @return string
*/
public static function _(Field\Numeric $field)
{
$fieldCode = [];
$fieldCode[] = "xtype: 'numberfield'";
$fieldCode[] = "name: '" . $field->getKey() . "'";
$label = $field->getLabel();
if ($label) {
$fieldCode[] = "fieldLabel: '" . $label . "'";
}
$desc = $field->getDesc();
if ($desc) {
$fieldCode[] = "boxLabel: '" . $desc . "'";
}
$width = $field->getWidth();
if ($width) {
$fieldCode[] = "width: " . $width;
}
$minValue = $field->getMinValue();
$maxValue = $field->getMaxValue();
if ($minValue !== null && $minValue !== false) {
$fieldCode[] = " minValue: '" . $minValue . "'";
}
if ($maxValue !== null && $maxValue !== false) {
$fieldCode[] = " maxValue: '" . $maxValue . "'";
}
return forward_static_call(['self', '_implode'], $fieldCode);
}
示例13: _
/**
* Render extjs combobox filter field
*
* @param \Engine\Crud\Grid\Filter\Field $field
* @return string
*/
public static function _(Field\ArrayToSelect $field)
{
$fieldCode = [];
$fieldCode[] = "xtype: 'combobox'";
$fieldCode[] = "name: '" . $field->getKey() . "'";
$label = $field->getLabel();
if ($label) {
$fieldCode[] = "fieldLabel: '" . $label . "'";
}
$desc = $field->getDesc();
if ($desc) {
$fieldCode[] = "boxLabel: '" . $desc . "'";
}
$width = $field->getWidth();
if ($width) {
$fieldCode[] = "width: " . $width;
}
$fieldCode[] = "typeAhead: true";
$fieldCode[] = "triggerAction: 'all'";
$fieldCode[] = "selectOnTab: true";
$fieldCode[] = "lazyRender: true";
$fieldCode[] = "listClass: 'x-combo-list-small'";
$fieldCode[] = "queryMode: 'local'";
$fieldCode[] = "displayField: 'name'";
$fieldCode[] = "valueField: 'id'";
$fieldCode[] = "valueNotFoundText: 'Nothing found'";
$store = forward_static_call(['static', '_getStore'], $field);
$fieldCode[] = "store: " . $store;
return forward_static_call(['static', '_implode'], $fieldCode);
}
示例14: bootEloquentValidatingTrait
/**
* Eloquent will call this on model boot
*/
public static function bootEloquentValidatingTrait()
{
// Calling Model::saving() and asking it to execute assertIsValid() before model is saved into database
$savingCallable = [static::class, 'saving'];
$validationCallable = [static::class, 'assertIsValid'];
forward_static_call($savingCallable, $validationCallable);
}
示例15: fire
/**
* @param Job $syncJob Laravel queue job
* @param $arguments
* @return bool
* @throws \Unifact\Connector\Exceptions\HandlerException
*/
public function fire(Job $syncJob, $arguments)
{
try {
$job = $this->jobRepo->findById($arguments['job_id']);
$job->setPreviousStatus($arguments['previous_status']);
$handler = forward_static_call([$job->handler, 'make']);
$this->logger->debug("Preparing Job..");
if (!$handler->prepare()) {
$this->logger->error('Handler returned FALSE in prepare() method, see log for details');
// delete Laravel queue job
$syncJob->delete();
return false;
}
$this->logger->debug("Handling Job..");
if ($handler->handle($job) === false) {
$this->logger->error('Handler returned FALSE in handle() method, see log for details');
// delete Laravel queue job
$syncJob->delete();
return false;
}
$this->logger->debug("Completing Job..");
$handler->complete();
$this->logger->info('Finished Job successfully');
} catch (\Exception $e) {
$this->oracle->exception($e);
$this->logger->error('Exception was thrown in JobQueueHandler::fire method.');
$this->jobRepo->update($arguments['job_id'], ['status' => 'error']);
// delete Laravel queue job
$syncJob->delete();
return false;
}
// delete Laravel queue job
$syncJob->delete();
return true;
}