public function getFields() { return $this->rememberCache('fields', function () { $result = []; $all = $this->orderBy('order_index', 'ASC')->get(); foreach ($all as $v) { $result[$v['field_class']][$v['name']] = array_keyfilter($v->toArray(), 'id,name,title,extra'); } return $result; }); }
/** * Smarty URL modifier plugin * * Type: modifier<br> * Name: plugins<br> * Purpose: get the absolute URL * @link http://smarty.php.net/manual/en/language.modifier.url.php * url (Smarty online manual) * @author Monte Ohrt <monte at ohrt dot com> * @param string * @param mixed * @return string */ function smarty_function_pluginclude($params, $template) { $dbt = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 10); for ($i = 1; $i < count($dbt); $i++) { if ($dbt[$i]['function'] == __FUNCTION__) { trigger_error("pluginclude: cannot use under pluginclude (recursive)", E_USER_NOTICE); return; } } $file = ''; $plugins = NULL; foreach ($params as $_key => $_val) { switch ($_key) { case 'file': case 'plugins': ${$_key} = $_val; break; } } if (empty($file)) { trigger_error("pluginclude: missing 'file' parameter", E_USER_NOTICE); return; } $_c = config('plugins'); !empty($plugins) && ($_c = array_keyfilter($_c, $plugins)); $names = []; array_walk($_c, function ($v, $k) use(&$names, $file) { if (array_key_exists($file, $v['injectViews'])) { $names[$k] = $v['injectViews'][$file]; } elseif (in_array($file, $v['injectViews'])) { $names[$k] = count($names); } }); asort($names); foreach ($names as $name => $order) { $template->smarty->ext->_subtemplate->render($template, (string) '[' . $name . ']' . $file, $template->cache_id, $template->compile_id, 0, $template->cache_lifetime, array(), 0, true); } }
/** * [filterValidatorData description] * @param Validator $validator [description] * @param [type] $keys [description] * @return [type] [description] */ private function filterValidatorData(Validator $validator, $keys) { $data = $validator->getData(); return $keys == '*' ? $data : array_keyfilter($data, $keys); }
protected function _make_output($type, $message_name = NULL, $url = FALSE, array $data = [], $export_data = FALSE) { $msg = $message_name; if (!is_array($message_name)) { $msg = Lang::has($message_name) ? trans($message_name) : (Lang::has('core::common.' . $message_name) ? trans('core::common.' . $message_name) : []); is_string($msg) && ($msg = ['content' => $msg]); $default = trans('core::common.default.' . $type); $msg = _extends($msg, $default); //填充 } $default = trans('core::common.default.' . $type); $msg = _extends($msg, $default); if (!empty($data)) { foreach ($msg as &$value) { $value = __($value, $data); } //转化成有意义的文字 } $msg = array_keyfilter($msg, 'title,content'); $result = array('result' => $type, 'time' => time(), 'duration' => microtime(TRUE) - LARAVEL_START, 'uid' => $this->user['id'], 'message' => $msg, 'url' => is_string($url) ? url($url) : $url, 'data' => $export_data ? $data : []); return $this->output($result); }