public function setQuery($query) { $this->original_query = $query; $this->query = array(); $stopwords = string_get_stopwords(cmsCore::getLanguageName()); $words = explode(' ', $query); foreach ($words as $word) { $word = strip_tags(mb_strtolower(trim(urldecode($word)))); if (mb_strlen($word) < 3 || is_numeric($word)) { continue; } if ($stopwords && in_array($word, $stopwords)) { continue; } if (mb_strlen($word) == 3) { $this->query[] = $this->db->escape($word); continue; } if (mb_strlen($word) >= 12) { $word = mb_substr($word, 0, mb_strlen($word) - 4); } else { if (mb_strlen($word) >= 10) { $word = mb_substr($word, 0, mb_strlen($word) - 3); } else { if (mb_strlen($word) >= 6) { $word = mb_substr($word, 0, mb_strlen($word) - 2); } else { $word = mb_substr($word, 0, mb_strlen($word) - 1); } } } $this->query[] = $this->db->escape($word) . '*'; } if (empty($this->query)) { return false; } return true; }
<?php $this->addJSFromContext('templates/default/js/jquery-ui.js'); $this->addJSFromContext('templates/default/js/i18n/jquery-ui/' . cmsCore::getLanguageName() . '.js'); $this->addCSSFromContext('templates/default/css/jquery-ui.css'); ?> <?php if ($field->title) { ?> <label for="<?php echo $field->id; ?> "><?php echo $field->title; ?> </label><?php } ?> <?php echo html_datepicker($field->data['fname_date'], $field->data['date'], array('id' => $field->id), array('minDate' => date(cmsConfig::get('date_format'), 86400))); ?> <?php if ($field->data['show_time']) { ?> <?php echo html_select_range($field->data['fname_hours'], 0, 23, 1, true, $field->data['hours']); ?> :
public function displayEditor($field_id, $content = '') { $lang = cmsCore::getLanguageName(); $user = cmsUser::getInstance(); $template = cmsTemplate::getInstance(); $template->addCSSFromContext('wysiwyg/redactor/css/redactor.css'); $template->addJSFromContext('wysiwyg/redactor/js/redactor.js'); $template->addJSFromContext('wysiwyg/redactor/js/video.js'); $template->addJSFromContext('wysiwyg/redactor/js/fullscreen.js'); $template->addJSFromContext('wysiwyg/redactor/js/fontsize.js'); //$template->addJSFromContext('wysiwyg/redactor/js/fontfamily.js'); $template->addJSFromContext('wysiwyg/redactor/js/fontcolor.js'); $template->addJSFromContext('wysiwyg/redactor/js/table.js'); $template->addJSFromContext("wysiwyg/redactor/langs/{$lang}.js"); $dom_id = str_replace(array('[', ']'), array('_', ''), $field_id); echo html_textarea($field_id, $content, array('id' => $dom_id)); ?> <script type="text/javascript"> $(function(){ $('#<?php echo $dom_id; ?> ').redactor({ lang: '<?php echo $lang; ?> ', plugins: ['video', 'fontsize', 'fontcolor', 'fullscreen', 'table'], imageUpload: '<?php echo href_to('redactor/upload'); ?> ', minHeight: 190, replaceDivs: false, removeComments: true, convertLinks: false, pastePlainText: true, <?php if (!$user->is_admin) { ?> buttonsHide: ['html'] <?php } ?> }); <?php if (!cmsCore::getInstance()->request->isAjax()) { ?> $(window).on('resize', function (){ $('#<?php echo $dom_id; ?> ').width($('#f_<?php echo $dom_id; ?> ').width()); }).triggerHandler('resize'); <?php } ?> }); </script> <?php }
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> <channel> <title><?php html($feed_title); ?> </title> <link><?php html($config->host); ?> </link> <description><?php html($feed['description']); ?> </description> <language><?php html(cmsCore::getLanguageName()); ?> </language> <pubDate><?php html(date('r')); ?> </pubDate> <?php if (!empty($feed['image'])) { ?> <image> <url><?php echo $config->upload_host_abs . '/' . $feed['image']['normal']; ?> </url> <title><?php
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <?php $this->addMainCSS('templates/default/css/theme-modal.css'); ?> <?php $this->addMainCSS('templates/default/css/jquery-ui.css'); ?> <?php $this->addMainJS('templates/default/js/jquery.js'); ?> <?php $this->addMainJS('templates/default/js/jquery-ui.js'); ?> <?php $this->addMainJS('templates/default/js/i18n/jquery-ui/' . cmsCore::getLanguageName() . '.js'); ?> <?php $this->addMainJS('templates/default/js/jquery-modal.js'); ?> <?php $this->addMainJS('templates/default/js/core.js'); ?> <?php $this->addMainJS('templates/default/js/modal.js'); ?> <?php $this->head(false); ?> </head> <body>
/** * Возвращает строку с перечислением самых часто используемых * слов из исходного текста * * @param string $text * @param int $min_length Минимальная длина каждого слова * @param int $limit Количество слов в результирующей строке * @return string */ function string_get_meta_keywords($text, $min_length = 5, $limit = 10) { $stat = array(); $text = str_replace(array("\n", '<br>', '<br/>'), ' ', $text); $text = strip_tags($text); $text = mb_strtolower($text); $stopwords = string_get_stopwords(cmsCore::getLanguageName()); $words = explode(' ', $text); foreach ($words as $word) { $word = trim($word); $word = str_replace(array('(', ')', '+', '-', '.', '!', ':', '{', '}', '|', '"', ',', "'"), '', $word); $word = preg_replace("/\\.,\\(\\)\\{\\}/i", '', $word); if ($stopwords && in_array($word, $stopwords)) { continue; } if (mb_strlen($word) >= $min_length) { $stat[$word] = isset($stat[$word]) ? $stat[$word] + 1 : 1; } } asort($stat); $stat = array_reverse($stat, true); $stat = array_slice($stat, 0, $limit, true); return implode(', ', array_keys($stat)); }
public function displayEditor($field_id, $content = '') { $lang = cmsCore::getLanguageName(); if ($lang == 'en') { $lang = 'en-US'; } $template = cmsTemplate::getInstance(); $user = cmsUser::getInstance(); $template->addJSFromContext("wysiwyg/live/scripts/language/{$lang}/editor_lang.js"); $template->addJSFromContext('wysiwyg/live/scripts/innovaeditor.js'); $dom_id = str_replace(array('[', ']'), array('_', ''), $field_id); echo html_textarea($field_id, $content, array('id' => $dom_id)); ?> <div id="innovaajax<?php echo $dom_id; ?> "></div> <script type="text/javascript"> <?php if ($user->is_admin) { ?> groups = [ ["group1", "", ["Paragraph", "FontName", "FontSize", "Superscript", "ForeColor", "BackColor", "BRK", "Bold", "Italic", "Underline", "Strikethrough", "TextDialog", "RemoveFormat"]], ["group2", "", ["JustifyLeft", "JustifyCenter", "JustifyRight", "Line", "BRK", "Bullets", "Numbering", "Indent", "Outdent"]], ["group3", "", ["Table","TableDialog", "Emoticons", "BRK", "LinkDialog", "ImageDialog", "YoutubeDialog"]], ["group4", "", ["SearchDialog", "SourceDialog", "CharsDialog", "BRK", "Undo", "Redo", "FullScreen"]] ]; <?php } else { ?> groups = [ ["group1", "", ["Paragraph", "FontName", "FontSize", "Superscript", "ForeColor", "BackColor", "BRK", "Bold", "Italic", "Underline", "Strikethrough", "TextDialog", "RemoveFormat"]], ["group2", "", ["JustifyLeft", "JustifyCenter", "JustifyRight", "Line", "BRK", "Bullets", "Numbering", "Indent", "Outdent"]], ["group3", "", ["Table","TableDialog", "Emoticons", "BRK", "LinkDialog", "ImageDialog", "YoutubeDialog"]], ["group4", "", ["SearchDialog", "CharsDialog", "BRK", "Undo", "Redo", "FullScreen"]] ]; <?php } ?> window["le_<?php echo $dom_id; ?> "] = new InnovaEditor("le_<?php echo $dom_id; ?> "); window["le_<?php echo $dom_id; ?> "].width = '100%'; window["le_<?php echo $dom_id; ?> "].height = 290; window["le_<?php echo $dom_id; ?> "].css = '<?php echo cmsConfig::get('root') . 'wysiwyg/live/styles/simple.css'; ?> '; window["le_<?php echo $dom_id; ?> "].enableTableAutoformat = true; window["le_<?php echo $dom_id; ?> "].fileBrowser = '/live_editor/upload'; window["le_<?php echo $dom_id; ?> "].groups = groups; window["le_<?php echo $dom_id; ?> "].btnSave=false; window["le_<?php echo $dom_id; ?> "].REPLACE('<?php echo $dom_id; ?> ', 'innovaajax<?php echo $dom_id; ?> '); </script> <?php }