/** * Конструктор * * @param string $dsn * @param int $timeout */ public function __construct($dsn, $timeout = Cache_Backend_APCU::DEFAULT_TIMEOUT) { if (!Core_Regexps::match('{^apcu://.*}', $dsn)) { throw new Cache_BadDSNException($dsn); } $this->timeout = $timeout; }
protected function auth_realm() { $realm = false; if (Core_Regexps::match('{^/admin/}', $_SERVER['REQUEST_URI'])) { $realm = 'admin'; } /** * @event cms.fspages.realm * @arg $realm имя области * Отдельные статические страницы (CMS.FSPages) могут исполняться в рамках обособленной (чаще всего - закрытой паролем) области. * По умолчанию страницы, чьи адреса начинаются с '''/admin/''' исполняются в области '''admin''', остальные - без указания области (в области по умолчанию). * Однако, это можно исправить в обработчике данного события. Проверьте REQUEST_URI и установите нужный realm. */ Events::call('cms.fspages.realm', $realm); return $realm; }
public function route($request) { $uri = trim(strtolower($this->clean_url($request->uri))); if (CMS_FSPages::$with_htm_extension) { $uri = preg_replace('{\\.htm$}', '/', $uri); } $path = ''; if ($uri == '/') { $path = '/'; } elseif ($m = Core_Regexps::match_with_results('{^/(.+)/$}', $uri)) { foreach (explode('/', $m[1]) as $chunk) { if (Core_Regexps::match('{[a-z0-9_-]+}', $chunk)) { $path .= "/{$chunk}"; } } } if ($path != '') { $dirs = array(CMS::$taopath . '/views/pages', CMS::app_path('views/pages')); /** * @event cms.fspages.dirs * @arg $dirs Список каталогов * Событие генерируется механизмом статических страниц (CMS.FSPages) для уточнения списка каталогов, в которых ищутся шаблоны. При необходимости в список можно добавить свой каталог. */ Events::call('cms.fspages.dirs', $dirs); if (count($dirs) > 0) { for ($i = count($dirs) - 1; $i >= 0; $i--) { $dir = $dirs[$i]; $page = false; $page_path = "{$dir}{$path}/index.phtml"; if (IO_FS::exists($page_path)) { $page = $page_path; } else { $page_path = "{$dir}/{$path}.phtml"; if (IO_FS::exists($page_path)) { $page = $page_path; } } if ($page) { return array('controller' => 'CMS.Controller.FSPages', 'action' => 'index', $page); } } } } return false; }
/** * @param WebKit_Environment $env * @param WebKit_HTTP_Response $response * * @return Iterator */ public function process_app(WS_Environment $env, $response) { $uri = $env->request->urn; $original_uri = $uri; CMS::$original_uri = $uri; CMS::$site = CMS::$defsite; if (isset(CMS::$sites[CMS::$defsite]['page_main'])) { CMS::$page_main = CMS::$sites[CMS::$defsite]['page_main']; } $_defdata = false; if (isset(CMS::$sites[CMS::$defsite])) { $_defdata = CMS::$sites[CMS::$defsite]; } if (isset(CMS::$sites)) { foreach (CMS::$sites as $site => $data) { $_host = isset($data['host']) ? trim($data['host']) : ''; $_prefix = isset($data['prefix']) ? trim($data['prefix']) : ''; if ($_host != '' || $_prefix != '') { $_bhost = false; $_bprefix = false; $_uri = $uri; if ($_prefix != '') { if ($m = Core_Regexps::match_with_results('{^/' . $_prefix . '/(.*)$}', $uri)) { $_uri = '/' . $m[1]; $_bprefix = true; } else { continue; } } if ($_host != '') { if ($env->request->host == $_host) { $_bhost = true; } else { if ($_host[0] == '{') { if (Core_Regexps::match($_host, $env->request->host)) { $_bhost = true; } else { continue; } } else { continue; } } } if ($_bprefix || $_bhost) { CMS::$site = $site; if ($_bprefix) { CMS::$site_prefix = '/' . $_prefix; } $uri = $_uri; $env->request->uri($uri); $_defdata = $data; break; } } } } if ($_defdata) { if (isset($_defdata['page_main'])) { CMS::$page_main = $_defdata['page_main']; } if (isset($_defdata['page_404'])) { CMS::$page_404 = $_defdata['page_404']; } if (isset($_defdata['layout'])) { CMS::$force_layout = $_defdata['layout']; } } if (CMS::$db) { $head = CMS::vars()->get('head'); if (isset($head['meta.title'])) { $env->meta->title($head['meta.title']); } if (isset($head['meta.description'])) { $env->meta->description($head['meta.description']); } if (isset($head['meta.keywords'])) { $env->meta->keywords($head['meta.keywords']); } } $curi = $uri; if ($m = Core_Regexps::match_with_results('/^([^\\?]+)\\?/', $curi)) { $curi = $m[1]; } $use_layout = false; // Просмотр всех мапперов зарегистрированных в системе foreach (CMS::mappers() as $name => $mapper) { // Если срабатывает маппер if ($route = $mapper->route($env->request)) { CMS::$current_mapper = $mapper; CMS::$current_component_name = $name; CMS::$current_route = $route; try { Core::load('Component.' . $name); } catch (Core_ModuleNotFoundException $e) { // hush } if ($route instanceof Net_HTTP_Response) { return $route; } // Имя подключаемого модуля $controller_module_name = 'Component.' . $name . '.Controller'; // Имя контроллера по умолчанию $controller_name = Core_Strings::replace($controller_module_name, '.', '_'); // Имя действитя по умолчанию $action_name = 'index'; $do_load_controllers = true; if ($route === true) { $route = array('controller' => $controller_name, 'action' => 'index'); } if (is_array($route)) { $_route = WebKit_Controller::Route(); $_route->merge($route); $route = $_route; } if (!isset($route['action'])) { $route['action'] = 'index'; } // Если маппер вернул нестандартное имя контроллера if (isset($route['controller'])) { $controller_name = $route['controller']; } // Если маппер вернул нестандартное имя действия if (isset($route['action'])) { $action_name = $route['action']; } // Если маппер не велел загружать модуль с конроллером (загрузит сам) if (isset($route['no_load'])) { $do_load_controllers = false; } // Загружаем модуль с контроллером if ($do_load_controllers) { if (strpos($controller_name, '.') === false && strpos($controller_name, '_') === false) { $controller_name = 'Component.' . $name . '.' . $controller_name; } if (strpos($controller_name, '.') !== false) { $controller_module_name = $controller_name; } Core::autoload($controller_module_name); } // Получаем экземпляр контроллера CMS::$current_controller_name = $controller_name; //$controller = Core_Types::reflection_for($controller_name)->newInstance($env, $response); $controller = Core::make($controller_name, $env, $response); if ($use_layout) { if (!property_exists($controller, 'layout')) { $controller->use_layout($use_layout); } else { if (!$controller->layout) { $controller->use_layout($use_layout); } } } if (!CMS::$print_version && is_string(CMS::$force_layout)) { $controller->use_layout(CMS::$force_layout); } CMS::$current_controller = $controller; CMS::$current_route = $route; // Запускаем контроллер с переданными аргументами $rc = $controller->dispatch($route); return $rc; } } if (md5($uri) == 'b0b94791138ef54aeb161e403329f827') { die('cms'); } return Net_HTTP::not_found(); }
/** * @param string $title * @param string $uri * @param string|false $icon * @param array|false $submenu */ static function menu_process($title, $item, $p1 = false, $p2 = false) { $sub = false; $icon = 'default'; if (is_array($p1)) { $sub = $p1; } if (is_array($p2)) { $sub = $p2; } if (is_string($p1)) { $icon = $p1; } if (is_string($p2)) { $icon = $p2; } self::$admin_menu[$title] = $item; if (!Core_Regexps::match('{\\.([a-z]+)$}', $icon)) { $icon .= '.gif'; } if (IO_FS::exists("./image/admin/components/{$icon}")) { $icon = "/image/admin/components/{$icon}"; } else { if (IO_FS::exists(CMS::stdfile("images/components/{$icon}"))) { $icon = CMS::stdfile_url("images/components/{$icon}"); } else { $icon = CMS::stdfile_url('images/components/default.gif'); } } self::$menu[] = array('t' => $title, 'u' => $item, 's' => $sub, 'i' => $icon); }
/** */ protected function parse_one() { $line = $this->get(); $tline = rtrim($line); $line = $this->parse_simple_line($line); if (Core_Regexps::match('{^!!!insertion\\d+!!!$}', trim($line))) { $this->close_block(); $line = trim($line); $this->html .= "\n{$line}\n"; } else { if (trim($line) == '') { $this->close_block(); } else { if ($m = Core_Regexps::match_with_results('{^<source\\s+lang="(.+)">}i', $tline)) { $this->close_block(); $lang = strtolower(trim($m[1])); $highlighter = false; if (isset($this->highlights[$lang])) { $module = $this->highlights[$lang]; Core::load($module); $class = str_replace('.', '_', $module); $highlighter = new $class(); } $this->parse_source($highlighter); } else { if ($m = Core_Regexps::match_with_results('{^<source>}i', $tline)) { $this->close_block(); $this->parse_source(false); } else { if (strtolower($tline) == '</source>') { } else { if ($m = Core_Regexps::match_with_results('{^\\{\\|}', $tline)) { $this->close_block(); $this->unget(); $this->html .= self::parse_table(); } else { if ($m = Core_Regexps::match_with_results('{^;(.+):(.+)}', $tline)) { $this->close_block(); $this->unget(); $this->html .= self::$tag_dl_start; $this->parse_dl(); $this->html .= self::$tag_dl_end; } else { if ($m = Core_Regexps::match_with_results('{^======(.+)======$}', $tline)) { $this->close_block(); $this->html .= sprintf(self::$template_h5, trim($m[1])); } else { if ($m = Core_Regexps::match_with_results('{^====(.+)====$}', $tline)) { $this->close_block(); $this->html .= sprintf(self::$template_h4, trim($m[1])); } else { if ($m = Core_Regexps::match_with_results('{^===(.+)===$}', $tline)) { $this->close_block(); $this->html .= sprintf(self::$template_h3, trim($m[1])); } else { if ($m = Core_Regexps::match_with_results('{^==(.+)==$}', $tline)) { $this->close_block(); $this->html .= sprintf(self::$template_h2, trim($m[1])); } else { if ($m = Core_Regexps::match_with_results('{^=(.+)=$}', $tline)) { $this->close_block(); $this->html .= sprintf(self::$template_h1, trim($m[1])); } else { if ($tline == '----') { $this->close_block(); $this->html .= "\n<hr />\n"; } else { if (strlen($line) > 0 && $line[0] == '*') { $this->close_block(); $this->html .= "\n<ul>"; $this->unget(); $this->parse_list('*'); $this->html .= "\n</ul>"; } else { if (strlen($line) > 0 && $line[0] == '#') { $this->close_block(); $this->html .= "\n<ol>"; $this->unget(); $this->parse_list('#'); $this->html .= "\n</ol>"; } else { if ($line[0] == ' ' || $line[0] == "\t") { $this->close_block(); $this->html .= self::$tag_pre_start; $this->unget(); $this->parse_pre(); $this->html .= self::$tag_pre_end; } else { //$this->open_block('p'); $this->html .= "<p>{$line}</p>"; } } } } } } } } } } } } } } } } }
protected function hash_dir($path, $prefix = '', $item = false) { $out = array(); foreach (IO_FS::Dir($path) as $file) { $fp = $prefix == '' ? $file->name : "{$prefix}/{$file->name}"; if ($fp == 'www') { $fp = CMS::www(); } if (is_dir($file->path)) { $files = $this->hash_dir($file->path, $fp, $item); foreach ($files as $key => $value) { $out[$key] = $value; } } else { if ($item && Core_Regexps::match('{\\.(php|phtml)$}', $file)) { $version = trim($item['version']); if ($version != '') { $content = file_get_contents($file->path); $content = str_replace('%%{version}', $version, $content); file_put_contents($file->path, $content); } } $out[$fp] = array('path' => $file->path, 'hash' => md5_file($file->path)); } } return $out; }
static function NAVIGATION($parms) { $parms = trim($parms); if ($parms == '') { return CMS::$navigation->draw(); } if (Core_Regexps::match('/^[0-9a-z_]+$/i', $parms)) { return CMS::$navigation->linkset_by_id($parms)->draw(); } if ($m = Core_Regexps::match_with_results('/^([^:]+):([^:]+)$/', $parms)) { return CMS::$navigation->linkset_by_id($m[2])->draw($m[1]); } if ($m = Core_Regexps::match_with_results('/^([^:]+):([^:]+):([^:]+)$/', $parms)) { return CMS::$navigation[$m[2]]->linkset_by_id($m[3])->draw($m[1]); } return "%NAVIGATION{{$parms}}"; }
/** * @param string $name * @param array $args * * @return mixed */ public function __call($name, $args) { if (!Core_Regexps::match('{_url$}', $name)) { throw new Core_MissingMethodException($name); } $name = Core_Strings::replace($name, 'single_', 'single-'); $url = ''; $args = Core_Arrays::reverse($args); $parms = Core_Types::is_array($args[0]) ? Core_Arrays::shift($args) : array(); $parts = Core_Arrays::reverse(Core_Strings::split_by('_', Core_Regexps::replace('{_url$}', '', $name))); $last_idx = count($parts) - 1; $target = false; foreach ($parts as $idx => $part) { $part = Core_Strings::replace($part, '-', '_'); if ($target) { if (isset($this->single_names[$part])) { $url = '/' . $this->single_names[$part] . '/' . (Core_Types::is_object($arg = Core_Arrays::shift($args)) ? $arg->id : (string) $arg) . $url; } elseif ($idx == $last_idx && (isset($this->resources[$target]) && isset($this->resources[$target]['collection']) && isset($this->resources[$target]['collection'][$part])) || isset($this->single_names[$target]) && isset($this->resources[$this->single_names[$target]]['instance']) && isset($this->resources[$this->single_names[$target]]['instance'][$part])) { $url .= "/{$part}"; } else { throw new Core_MissingMethodException($name); } } else { if (isset($this->resources[$part])) { $url = "/{$part}{$url}"; $target = $part; } elseif (isset($this->single_names[$part])) { $id = Core_Arrays::shift($args); $url = '/' . $this->single_names[$part] . '/' . (Core_Types::is_object($id) ? $id->id : (string) $id) . $url; $target = $part; } else { throw new Core_MissingMethodException($name); } } } return $this->add_keyword_parameters($this->add_path($url) . (isset($args[0]) ? '.' . $args[0] : ".{$this->default_format}"), $parms); }
/** * Проверяет, соответствует ли заданный путь условиям поиска * * @param string $path * * @return boolean */ public function allows($path = '.') { if (IO_FS::is_dir($path) && $this->recursive) { return true; } return Core_Regexps::match($this->regexp, (string) $path); }
protected function branch($dir_path, $prefix = '') { $vars = array(); $dirs = array(); foreach (IO_FS::Dir($dir_path) as $entry) { $filename = $entry->name; if (Core_Regexps::match('{^[a-z0-9_-]+$}i', $filename)) { $path = $entry->path; $name = $prefix . $filename; if (is_dir($path)) { if (IO_FS::exists("{$path}/.info")) { $info = $this->load_info("{$path}/.info"); if ($info) { $var = CMS::vars()->entity('dir', $info); $var->vars = $this->branch($path, "{$name}."); $dirs[$name] = $var; } } } else { $var = $this->load($name); if ($var) { $vars[$name] = $var; } } } } ksort($vars); ksort($dirs); $out = array(); $out += $vars; $out += $dirs; return $out; }
protected function process_form($item) { $errors = parent::process_form($item); if (isset($this->form['_name']) && sizeof($errors) == 0) { $name = trim($this->form['_name']); if (Core_Regexps::match('{^[a-z0-9_-]+$}i', $name)) { return array(); } if (Core_Regexps::match('{^[a-z0-9_-]+\\.[a-z0-9_-]+$}i', $name)) { return array(); } return array('_name' => CMS::lang('%LANG{en}Invalid name!%LANG{ru}Некорректный мнемокод!')); } return $errors; }
/** * @param string $url * * @return boolean */ public function is_match_for($url) { return $this->options['path'] == '' ? true : Core_Regexps::match('{^' . $this->options['path'] . '}', $url); }
/** * Пролистывает сообщение до следующей границы * * @param string $boundary * * @return string */ protected function skip_to_boundary(Mail_Message_Part $part) { $text = ''; while (($line = $this->input->read_line()) && !Core_Regexps::match("{^--" . $part->head['Content-Type']['boundary'] . "(?:--)?\n\r?\$}", $line)) { $text .= $line; } return $text; }
/** * @dataProvider provider_match_false */ public function test_match_false($regexp, $string) { $this->assertFalse(Core_Regexps::match($regexp, $string)); }
/** * @param string $regexp * @param string $string * @param string $message * * @return Dev_Unit_TestCase */ protected function assert_match($regexp, $string, $message = null) { if (!Core_Regexps::match($regexp, $string)) { throw new Dev_Unit_FailureException($message ? $message : sprintf("failed: %s doesn't match with %s", (string) $string, (string) $regexp)); } return $this; }
/** * @param WebKit_HTTP_Request $request * * @return WebKit_Controller_Route */ public function route($request) { $this->request = $request; $uri = $this->clean_url($request->urn); $controllers = $this->controllers(); if (Core_Types::is_iterable($controllers)) { foreach ($controllers as $name => $info) { if (isset($info['module'])) { $name = $info['module']; } $path = trim($this->admin_path_replace($info['path'])); if ($path != '' && $path[0] == '{') { $regexp = $path; } else { $regexp = '{^(' . $path . ')(.*)$}'; } $matched = false; if ($m = Core_Regexps::match_with_results($regexp, $uri)) { $this->path_prefix = $m[1]; $path = $m[2]; $matched = true; } if (isset($info['host'])) { $host = strtolower(trim($info['host'])); if ($host != '') { if ($host[0] == '{') { if (!Core_Regexps::match($host, strtolower($request->host))) { $matched = false; } } else { if (strtolower($request->host) != $host) { $matched = false; } } } } if (isset($info['site']) && $info['site'] != CMS::site()) { $matched = false; } if ($matched) { $this->active_controller = $name; if (isset($info['table-admin']) && $info['table-admin']) { $rules = array_merge(!empty($info['rules']) ? $info['rules'] : array(), array('{^$}' => array('default', 1, 'func' => 'default', 'parms' => 1), '{^list\\.json$}' => array('list_json', 'func' => 'list_json', 'parms' => 1), '{^([^/]+)/(.*)}' => array('{1}', '{2}', 'func' => '{1}', 'parms' => '{2}'))); } else { $rules = $info['rules']; } if (is_array($rules)) { foreach ($rules as $rule => $parms) { $match = false; if (trim($rule) != '') { $match = $mr = Core_Regexps::match_with_results(trim($rule), $path); } if ($rule == '' && $path == '' || $match) { foreach ($parms as $key => $value) { if ($mm = Core_Regexps::match_with_results('/^\\{(\\d+)\\}$/', $value)) { $parms[$key] = isset($mr[$mm[1]]) ? $mr[$mm[1]] : null; } } $parms['controller'] = $name; return $parms; } } } else { return array('controller' => $name, 'path' => $path); } } } } return false; }
/** * Проверка значения. * * Производит проверку значения атрибута content_type на то, что оно * начинается со значения content_type, переданного в конструкторе. * * @param IO_FS_File $value * * @return boolean */ protected function do_test($value) { return $value instanceof IO_FS_File && Core_Regexps::match("!^{$this->content_type}!", $value->content_type); }
protected function is_valid($s) { return Core_Regexps::match('{\\.(' . implode('|', $this->valid_extensions()) . ')$}i', $s); }
public function validate_email($email) { return Core_Regexps::match('{' . $this->email_regexp() . '}', $email); }
/** * Считывает строку из входного потока * * @return string */ protected function read_line() { if ($this->stream->eof()) { $this->is_last_part = true; return null; } $line = $this->stream->read_line(); if ($this->is_boundary($line)) { if (Core_Regexps::match("{{$this->boundary}--\n\r?}", $line)) { $this->is_last_part = true; } return null; } return $line; }
protected function prepare_fields($table) { $this->fields = array(); $this->fields_data = array(); $this->key_field = false; foreach ($this->query("SHOW FIELDS FROM {$table}")->fetch_all() as $row) { $name = $row['Field']; $type = $row['Type']; $otype = $type; if (!$this->key_field) { $this->key_field = $name; } if (Core_Regexps::match('{int}i', $type)) { $type = 'int'; } elseif (Core_Regexps::match('{date}i', $type)) { $type = 'date'; } elseif (Core_Regexps::match('{text}i', $type)) { $type = 'text'; } else { $type = 'string'; } $this->fields[$name] = array('original' => $otype, 'simple' => $type); $in_list = true; $in_form = true; $ftype = false; $style = false; $caption = strtoupper($name); $sqltype = preg_replace('{\\s+.*$}', '', $otype); $init_value = false; if ($type == 'string') { $style = 'width:100%'; $init_value = "''"; } if ($type == 'text') { $style = 'width:100%;height:200px'; $ftype = 'textarea'; $in_list = false; $init_value = "''"; } if ($type == 'int') { $init_value = '0'; } if ($type == 'int' && $name == 'isactive') { $ftype = 'checkbox'; } if ($type == 'int' && Core_Regexps::match('{date}i', $name)) { $ftype = 'datestr'; $init_value = "time()"; } if ($type == 'date') { $ftype = 'sqldatestr'; $init_value = "date('Y-m-d H:i:s')"; } if ($name == $this->key_field) { $in_form = false; $sqltype = 'serial'; } $data = array(); if ($ftype) { $data['type'] = $ftype; } $data['sqltype'] = $sqltype; $data['caption'] = $caption; if ($init_value !== false) { $data['init_value'] = $init_value; } $data['in_list'] = $in_list; $data['in_form'] = $in_form; if ($in_form) { $data['tab'] = 'default'; $data['style'] = $style; $data['weight_in_list'] = 0; $data['weight_in_form'] = 0; } $this->fields_data[$name] = $data; unset($data['in_list']); unset($data['in_form']); unset($data['weight_in_list']); unset($data['weight_in_form']); unset($data['init_value']); unset($data['sqltype']); if (!$this->admin_tabs) { unset($data['tab']); } if ($in_form) { $this->fields_form[$name] = $data; } unset($data['style']); unset($data['tab']); if ($in_list) { $this->fields_list[$name] = $data; } } //print $this->draw_array($this->fields_list,' '); //var_dump($this->fields_form); //var_dump(CMS_Fields::fields_to_schema($this->fields_data)); }
/** * @param array $matches * * @return string */ static function abs_refs_cb($m) { $s = $m[1]; $ref = trim($m[2]); if (!Core_Regexps::match('{^http://}', $ref)) { $ref = ltrim($ref, '.'); $ref = ltrim($ref, '/'); $ref = "http://" . CMS::host() . '/' . $ref; } return "<a{$s}" . "href=\"{$ref}\""; }
public function url($url) { return $url ? parent::url(Core_Regexps::match('{ftps?://}', $url) ? $url : "ftp://{$url}") : $this; }
/** * @param $types */ protected function match_types($types) { return Core_Regexps::match("!(^{$this->type})|({$this->type}\$)|([,]{$this->type}[,])!i", $types); }
/** * @param string $dsn */ public function __construct($dsn, $timeout = Cache::DEFAULT_TIMEOUT) { if (!Core_Regexps::match('{^dummy://.*}', $dsn)) { throw new Cache_BadDSNException($dsn); } }
protected function action_list() { $fform = $this->create_filters_form(); $this->on_before_list(); $rows = $this->get_rows(); $form = false; if ($this->access_massupdate()) { $form = $this->massupdate_form($rows); if ($form) { if ($this->env->request->method_code == Net_HTTP::POST) { if ($form->process($this->env->request)) { foreach (explode(',', $form['ids']) as $id) { $id = trim($id); if ($id != '') { $item = $this->load($id); if ($this->access_edit($item)) { foreach ($this->massupdate_fields as $field => $data) { $name = "{$field}{$id}"; $type = CMS_Fields::type($data); $obj = new ArrayObject(); $type->assign_to_object($form, $obj, $name, $data); $item->{$field} = $obj[$name]; } $this->update($item); } } } Events::call('admin.change'); } return $this->redirect_to($this->action_url('list', $this->page)); } } } $page_navigator = false; if ($this->numpages > 1) { $page_navigator = CMS::page_navigator($this->page, $this->numpages, array($this, 'list_url')); } $filters_buttons = array(); foreach ($this->filters_buttons() as $caption => $url) { $url = trim($url); if ($caption[0] != '*') { if ($m = Core_Regexps::match_with_results('{^(\\w+)=(.+)$}', $url)) { $name = trim($m[1]); $value = trim($m[2]); if (isset($_GET[$name]) && $_GET[$name] == $value) { $caption = "*{$caption}"; } } if ($m = Core_Regexps::match_with_results('{\\{(.+)\\}}', $url)) { $cond = trim($m[1]); if ($cond != '' && $cond[0] == '!') { $cond = substr($cond, 1); if (!isset($_GET[$cond])) { $caption = "*{$caption}"; } } } } $url = preg_replace('{\\{.+\\}}', '', $url); if ($url == '' || $url[0] != '/' && !Core_Regexps::match('{^http:}', $url)) { $url = $this->action_url('list', 1, $url); } $filters_buttons[$caption] = $url; } $filters_form_fields = $this->prepare_filter_forms(); if ($this->add_in_list && $this->access_add()) { $this->create_form($this->action_url('add', $this->page), 'add'); $item = $this->new_object(); $this->item_to_form($item); } return $this->render_list(array('title' => $this->title_list(), 'form' => $this->add_in_list ? $this->form : null, 'form_fields' => $this->add_in_list ? $this->filtered_form_fields : null, 'submit_text' => $this->submit_add(), 'count' => $this->count, 'rows' => $rows, 'list_fields' => $this->list_fields(), 'list_style' => $this->list_style(), 'message_norows' => $this->message_norows(), 'can_add' => $this->access_add(), 'add_url' => $this->action_url('add', $this->page), 'add_button_caption' => $this->button_add(), 'massupdate_form' => $form, 'massupdate_fields' => $this->massupdate_fields, 'massupdate_submit_text' => $this->submit_massupdate(), 'page_navigator' => $page_navigator, 'filters_buttons' => $filters_buttons, 'filters_form' => $fform, 'filters_form_fields' => $filters_form_fields, 'sort' => $this->sort, 'sort_direction' => $this->sort_direction)); }