Exemple #1
0
 static function load($filename)
 {
     self::$stream = IO_FS::FileStream($filename);
     while ($line = self::get()) {
         $line = trim($line);
         if ($m = Core_Regexps::match_with_results('{^!DUMP\\s+([^\\s]+)(.*)$}', $line)) {
             $module = trim($m[1]);
             $parms = trim($m[2]);
             $dumper = trim(self::$dumpers[$module]);
             if ($dumper == '') {
                 throw new CMS_Dumps_UnknownDumperException("Unknown dumper: {$module}");
             }
             $dumper_class_name = str_replace('.', '_', $dumper);
             if (!class_exists($dumper_class_name)) {
                 Core::load($dumper);
             }
             $class = new ReflectionClass($dumper_class_name);
             $class->setStaticPropertyValue('stream', self::$stream);
             $method = $class->getMethod('load');
             $rc = $method->invokeArgs(null, array($parms));
             if (trim($rc) != '') {
                 return $rc;
             }
         }
     }
     return true;
 }
Exemple #2
0
 /**
  * Конструктор
  *
  * @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;
 }
Exemple #3
0
 /**
  * Конструктор
  *
  * @param string $dsn
  * @param int    $mode
  */
 public function __construct($dsn = 'sphinx://localhost:3312', $mode = SPH_MATCH_EXTENDED)
 {
     if (!($m = Core_Regexps::match_with_results('{^sphinx://([a-zA-Z./]+)(:?:(\\d+))?}', (string) $dsn))) {
         throw new Search_Sphinx_Exception("Bad DSN {$dsn}");
     }
     $this->client = new SphinxClient();
     $this->catch_errors($this->client->SetServer($m[1], (int) Core::if_not($m[3], 3312)) !== false && $this->client->setMatchMode($mode) !== false && $this->client->setArrayResult(true) !== false);
 }
Exemple #4
0
 /**
  * Производит парсинг строки подключения и возвращает соответственный объект
  *
  * @param  $DSN
  *
  * @return Cache_Backend
  */
 public static function connect($dsn, $timeout = Cache::DEFAULT_TIMEOUT)
 {
     if (($m = Core_Regexps::match_with_results('{^([a-zA-Z]+)://}', (string) $dsn)) && isset(self::$backends[$m[1]])) {
         $module = self::$backends[$m[1]];
         // Core::load($module = 'Cache.Backend.'.self::$backends[$m[1]]);
         return Core::make($module, $dsn, $timeout);
     } else {
         throw new Cache_BadDSNException($dsn);
     }
 }
Exemple #5
0
 /**
  * Конструктор
  *
  * @param string $dsn
  * @param int    $timeout
  */
 public function __construct($dsn, $timeout = Cache_Backend_FS::DEFAULT_TIMEOUT)
 {
     $m1 = Core_Regexps::match_with_results("|^{$this->prefix}://(.*)|", $dsn);
     if (!$m1) {
         throw new Cache_BadDSNException($dsn);
     }
     $this->path = rtrim($m1[1], DIRECTORY_SEPARATOR);
     if (!IO_FS::exists($this->path)) {
         IO_FS::mkdir($this->path, null, true);
     }
     $this->timeout = $timeout;
 }
Exemple #6
0
 /**
  * Конструктор
  *
  * @param string $dsn
  * @param int    $timeout
  */
 public function __construct($dsn, $timeout = Cache_Backend_MemCache::DEFAULT_TIMEOUT)
 {
     $m1 = Core_Regexps::match_with_results('{^memcache://([^:]+):?(\\d+)?}', $dsn);
     if (!$m1) {
         throw new Cache_BadDSNException($dsn);
     }
     $this->memcache = new Memcache();
     if (!$this->memcache->connect($m1[1], Core::if_null($m1[2], 11211))) {
         throw new Cache_Exception('Could not connect');
     }
     $this->timeout = $timeout;
 }
Exemple #7
0
 protected function get_var_value($name)
 {
     $site = false;
     if ($m = Core_Regexps::match_with_results('{^(.+)/([^/]+)$}', $name)) {
         $name = trim($m[1]);
         $site = trim($m[2]);
         if ($site == '*') {
             $site = CMS_Admin::site();
         }
     }
     return CMS::vars()->get($name, $site);
 }
Exemple #8
0
 protected function keywords($s)
 {
     $s = " {$s} ";
     foreach ($this->keywords as $keyword) {
         $re = "/([^a-z0-9_])({$keyword})([^a-z0-9_])/i";
         $s = Core_Regexps::replace($re, '\\1__kwstart__\\2__kwend__\\3', $s);
     }
     $s = substr($s, 1, strlen($s) - 2);
     $s = str_replace('__kwstart__', $this->tag_keyword_start, $s);
     $s = str_replace('__kwend__', $this->tag_keyword_end, $s);
     return $s;
 }
Exemple #9
0
 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;
 }
Exemple #10
0
 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;
 }
Exemple #11
0
 /**
  */
 public function generate()
 {
     foreach (new Dev_Source_LibraryDirIterator($this->path_to_library) as $module_name => $module) {
         if (Core_Strings::contains($module_name, '.')) {
             $file_place = $this->path_to_html . "/" . Core_Regexps::replace('{/\\w+$}', '', Core_Strings::replace($module_name, '.', '/'));
             if (!IO_FS::exists($file_place)) {
                 IO_FS::mkdir($file_place, 0775, true);
             }
         }
         try {
             $module_generator = new Dev_Source_Doc_ModuleGenerator($module, $this->path_to_html . "/" . Core_Strings::replace($module_name, '.', '/'));
             $module_generator->write();
             $module_generator->write_diagram();
             $this->add_to_toc($module_generator);
         } catch (Dev_Source_InvalidSourceException $e) {
         }
     }
     $this->write_css();
     $this->write_toc();
     $this->write_index();
 }
Exemple #12
0
 /**
  * @param WebKit_HTTP_Request $request
  *
  * @return WebKit_Controller_Route
  */
 public function route($request)
 {
     if ($this->is_not_match_for($request->urn)) {
         return null;
     }
     if ($route = $this->route_index($request)) {
         return $route;
     }
     $uri = $this->clean_url($request->urn);
     foreach ($this->rules as $rule) {
         if ($match = Core_Regexps::match_with_results($rule[0], $uri)) {
             $route = WebKit_Controller::Route();
             foreach ($rule[1] as $k => $v) {
                 $route[$v] = isset($match[$k + 1]) ? $match[$k + 1] : $rule[2][$v];
             }
             $route->merge($rule[2]);
             break;
         }
     }
     return $route ? $route->merge($this->defaults)->add_controller_prefix($this->options['prefix']) : null;
 }
Exemple #13
0
 public function imagelist($parms)
 {
     $id = (int) $parms['id'];
     $ar = array();
     if (IO_FS::exists("./" . Core::option('files_name') . "/vars/{$id}")) {
         foreach (IO_FS::Dir("./" . Core::option('files_name') . "/vars/{$id}") as $f) {
             $fp = $f->path;
             if ($m = Core_Regexps::match_with_results('{/([^/]+)$}', $fp)) {
                 $fp = $m[1];
             }
             $ar[] = '["' . $fp . '","' . CMS::file_url($f->path) . '"]';
         }
     }
     echo 'var tinyMCEImageList = new Array(' . implode(',', $ar) . ');';
     die;
 }
Exemple #14
0
 /**
  * @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);
 }
Exemple #15
0
 /**
  * Выполняет разбор переменной окружения TAO_PATH
  *
  * @return array
  */
 private static function parse_environment_paths()
 {
     $result = array();
     if (($path_var = getenv(self::PATH_VARIABLE)) !== false) {
         foreach (Core_Strings::split_by(';', $path_var) as $rule) {
             if ($m = Core_Regexps::match_with_results('{^([-A-Za-z0-9*][A-Za-z0-9_.]*):(.+)$}', $rule)) {
                 $result[$m[1]] = $m[2];
             }
         }
     }
     return $result;
 }
Exemple #16
0
 /**
  * @param mixed $value
  */
 static function validate_parm($value)
 {
     if (!is_string($value)) {
         return $value;
     }
     while ($m = Core_Regexps::match_with_results('{^var:(.+)$}', trim($value))) {
         $value = CMS_Vars::get($m[1]);
     }
     return $value;
 }
Exemple #17
0
 /**
  * Формирует общий список значений параметров с учетом значений параметров родительских мапперов
  *
  * @param string $expr
  * @param mixed  $parms
  *
  * @return DB_ORM_SQLMapper
  */
 protected function collect_binds($expr, $parms)
 {
     $adapter = $this->connection->adapter;
     if ($adapter->is_castable_parameter($parms)) {
         $parms = $adapter->cast_parameter($parms);
     }
     if ($match = Core_Regexps::match_all('{(?::([a-zA-Z_0-9]+))}', $expr)) {
         foreach ($match[1] as $no => $name) {
             if (Core_Types::is_array($parms) || $parms instanceof ArrayAccess) {
                 $this->binds[$name] = $adapter->cast_parameter(isset($parms[$name]) ? $parms[$name] : $parms[$no]);
             } elseif (is_object($parms)) {
                 $this->binds[$name] = $adapter->cast_parameter($parms->{$name});
             } else {
                 $this->binds[$name] = $adapter->cast_parameter($parms);
             }
         }
     }
     return $this;
 }
Exemple #18
0
 public function process($data)
 {
     foreach ($data as $title => $item) {
         if (is_string($item) && trim($item) == '' && ($m = Core_Regexps::match_with_results('{^\\%(.+)$}', trim($title)))) {
             $_component = trim($m[1]);
             $_parms = false;
             if ($m = Core_Regexps::match_with_results('{^([^\\s]+)\\s+(.+)$}', $_component)) {
                 $_component = $m[1];
                 $_parms = trim($m[2]);
             }
             if (CMS::component_exists($_component)) {
                 $_class = CMS::$component_names[$_component];
                 $_classref = Core_Types::reflection_for($_class);
                 $links = $_classref->hasMethod('navigation_tree') ? $_classref->getMethod('navigation_tree')->invokeArgs(NULL, array($_parms)) : array();
                 foreach ($links as $k => $v) {
                     if (is_string($v)) {
                         $v = array('url' => $v);
                     }
                     $v["from-{$_component}"] = 1;
                     $links[$k] = $v;
                 }
                 $this->process($links);
             }
         } else {
             $this->add($title, $item);
         }
     }
 }
Exemple #19
0
 public function filename()
 {
     if ($m = Core_Regexps::match_with_results('{/([^/]+)$}', $this->name)) {
         return $m[1];
     }
     return $this->name;
 }
Exemple #20
0
 public function add($title, $item)
 {
     if (!Core_Types::is_iterable($item)) {
         $item = array('uri' => $item, 'url' => $item);
     }
     if (isset($item['title'])) {
         $title = $item['title'];
     }
     $title = CMS::lang($title);
     //Events::dispatch('cms.navigation.add', $ev = Events::Event(array('title' => $title, 'data' => $item, 'url' => $item['url'])));
     //$title = $ev['title'];
     //$item = $ev['data'];
     //$item['url'] = $ev['url'];
     $url = $item['url'];
     Events::call('cms.navigation.add', $title, $item, $url);
     $item['url'] = $url;
     $access = isset($item['access']) ? trim($item['access']) : '';
     if ($access != '' && !CMS::check_globals_or($access)) {
         return $this;
     }
     if (isset($item['disabled'])) {
         if (CMS::check_yes($item['disabled'])) {
             return $this;
         }
     }
     $uri = '';
     if (isset($item['uri'])) {
         $uri = $item['uri'];
     }
     if (isset($item['url'])) {
         $uri = $item['url'];
     }
     $id = isset($item['id']) ? $item['id'] : md5($title . $uri);
     if (isset($item['navigation_id'])) {
         $id = trim($item['navigation_id']);
     }
     $selected = false;
     $disabled = false;
     if (isset($item['match'])) {
         if (preg_match($item['match'], CMS_Navigation3::$uri)) {
             $selected = true;
         }
     }
     if (isset($item['flag'])) {
         if (CMS::$navigation->is_flag($item['flag'])) {
             $selected = true;
         }
     }
     if ($uri == CMS_Navigation3::$uri) {
         $selected = true;
     }
     $item['selected'] = $selected;
     $item['disabled'] = $disabled;
     $sub = isset($item['sub']) ? $item['sub'] : null;
     if (is_string($sub)) {
         $sub = trim($sub);
         $_component = $sub;
         $_parms = $uri;
         if ($m = Core_Regexps::match_with_results('{^([^\\s]+)\\s+(.+)$}', $sub)) {
             $_component = trim($m[1]);
             $_parms = trim($m[2]);
         }
         if (CMS::component_exists($_component)) {
             $_class = CMS::$component_names[$_component];
             $_classref = Core_Types::reflection_for($_class);
             $sub = $_classref->hasMethod('navigation_tree') ? $_classref->getMethod('navigation_tree')->invokeArgs(NULL, array($_parms, $item)) : false;
         }
     }
     if (Core_Types::is_iterable($sub)) {
         $set = new CMS_Navigation3_LinkSet();
         $set->level_num = $this->level_num + 1;
         $set->process($sub);
         $this->link($id, $uri, $title, $item, $set);
     } else {
         $this->link($id, $uri, $title, $item);
     }
     return $this;
 }
Exemple #21
0
 public function split($s, $lang = 'default')
 {
     $s = trim($s);
     if ($s == '') {
         return $s;
     }
     if (strpos($s, '%LANG{') === false) {
         return $s;
     }
     if ($m = Core_Regexps::match_with_results('/^(.*?)%LANG\\{([a-z]+)\\}(.*)$/ism', $s)) {
         $langs = array();
         $langs[$lang] = trim($m[1]);
         $next = trim($m[2]);
         $_langs = $this->split($m[3], $next);
         if (is_string($_langs)) {
             $langs[$next] = $_langs;
         } else {
             $langs = array_merge($langs, $_langs);
         }
         return $langs;
     }
     return $s;
 }
Exemple #22
0
 /**
  * @param string $dsn
  */
 public function __construct($dsn, $timeout = Cache::DEFAULT_TIMEOUT)
 {
     if (!Core_Regexps::match('{^dummy://.*}', $dsn)) {
         throw new Cache_BadDSNException($dsn);
     }
 }
Exemple #23
0
 public function quote()
 {
     $args = func_get_args();
     if (count($args) == 1) {
         return $this->connection->quote($args[0]);
     } else {
         $sql = (string) Core_Arrays::shift($args);
         foreach ($args as $arg) {
             $sql = Core_Regexps::replace('{\\?}', $this->connection->quote((string) $arg), $sql, 1);
         }
         return $sql;
     }
 }
Exemple #24
0
 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));
 }
Exemple #25
0
 public function add_item($link, $level, $parent = null)
 {
     $access = isset($link->access) ? trim($link->access) : '';
     if ($access != '' && !CMS::check_globals_or($access)) {
         return $this;
     }
     if (empty($link->url) && empty($link->id) && ($m = Core_Regexps::match_with_results('{^\\%(.+)$}', trim($link->title)))) {
         $_component = trim($m[1]);
         $_parms = false;
         if ($m = Core_Regexps::match_with_results('{^([^\\s]+)\\s+(.+)$}', $_component)) {
             $_component = $m[1];
             $_parms = trim($m[2]);
         }
         if (CMS::component_exists($_component)) {
             $_class = CMS::$component_names[$_component];
             $_classref = Core_Types::reflection_for($_class);
             $links = $_classref->hasMethod('navigation_tree') ? $_classref->getMethod('navigation_tree')->invokeArgs(NULL, array($_parms)) : array();
             foreach ($links as $k => &$v) {
                 $v["from-{$_component}"] = 1;
             }
             return $this->load_data($links, $level, $parent);
         }
         return $this;
     }
     return parent::add_item($link, $level, $parent);
 }
Exemple #26
0
 public function url($url)
 {
     return $url ? parent::url(Core_Regexps::match('{ftps?://}', $url) ? $url : "ftp://{$url}") : $this;
 }
Exemple #27
0
 protected function get_file_format($file)
 {
     $ext = $this->get_file_format_exif($file);
     if ($ext) {
         return $ext;
     }
     if ($m = Core_Regexps::match_with_results('{\\.(jpg|gif|png|jpeg|bmp)$}i', $file)) {
         $ext = strtolower($m[1]);
         if ($ext == 'jpeg') {
             $ext = 'jpg';
         }
     }
     return $ext;
 }
Exemple #28
0
 public function after_all_uploads($name, $parms, $filename, $uploaded, $old = '')
 {
     $from = isset($parms['thumb_from']) ? trim($parms['thumb_from']) : '';
     if ($from != '') {
         if (isset($parms['not_recreate_thumb']) && $parms['not_recreate_thumb'] && $old != '') {
             return;
         }
         if (!isset($uploaded[$name]) && isset($uploaded[$from])) {
             $src = $uploaded[$from];
             $ext = false;
             if ($m = Core_Regexps::match_with_results('{\\.(jpg|gif|png|jpeg|bmp)$}i', $src)) {
                 $ext = strtolower($m[1]);
                 if ($ext == 'jpeg') {
                     $ext = 'jpg';
                 }
             }
             if ($ext) {
                 $filename = str_replace('$$$', $ext, $filename);
                 copy($src, $filename);
                 $this->resize_image($filename, $parms);
                 return $filename;
             }
         }
     }
 }
Exemple #29
0
 /**
  * Возвращает основу слова
  *
  * @param string $word
  *
  * @return string
  */
 public function stem_word($word)
 {
     $word = strtr(mb_strtolower($word), array('ё' => 'е'));
     if ($this->use_cache && isset($this->cache[$word])) {
         return $this->cache[$word];
     }
     list($str, $start, $rv) = Core_Regexps::match_with_results(self::RVRE, $word);
     if (!$rv) {
         return $word;
     }
     // step 1
     if (!Core_Regexps::replace_ref(self::PERFECTIVEGROUND, '', $rv)) {
         $rv = preg_replace(self::REFLEXIVE, '', $rv);
         if (Core_Regexps::replace_ref(self::ADJECTIVE, '', $rv)) {
             $rv = preg_replace(self::PARTICIPLE, '', $rv);
         } else {
             if (!Core_Regexps::replace_ref(self::VERB, '', $rv)) {
                 $rv = preg_replace(self::NOUN, '', $rv);
             }
         }
     }
     // step 2
     $rv = preg_replace('{и$}', '', $rv);
     // step 3
     if (preg_match(self::DERIVATIONAL, $rv)) {
         $rv = preg_replace('{ость?$}', '', $rv);
     }
     // step 4
     if (!Core_Regexps::replace_ref('{ь$}', '', $rv)) {
         $rv = preg_replace(array('{ейше?}', '{нн$}'), array('', 'н'), $rv);
     }
     return $this->use_cache ? $this->cache[$word] = $start . $rv : $start . $rv;
 }
Exemple #30
0
 /**
  */
 protected function parse_dl()
 {
     while (!$this->eof()) {
         $line = $this->get();
         if ($m = Core_Regexps::match_with_results('{^;(.+?):(.+)$}', $line)) {
             $this->html .= self::$tag_dt_start;
             $this->html .= trim($m[1]);
             $this->html .= self::$tag_dt_end;
             $this->html .= self::$tag_dd_start;
             $this->html .= trim($m[2]);
             $this->html .= self::$tag_dd_end;
         } else {
             $this->unget();
             return;
         }
     }
 }