public function index() { $this->load->helper('smiley'); // This is needed only for calling _get_smiley_array(). $smileys = _get_smiley_array(); $this->template->set('smileys', $smileys)->enable_parser_body('smileys')->build('smileys'); }
/** * @brief Wikitest test page. */ function index() { if (!CheckPermissions('office')) { return; } $this->load->helper('wikitext_smiley'); // No POST data? just set wikitext to default string $wikitext = $this->input->post('wikitext'); if ($wikitext === FALSE) { $wikitext = '==This is the yorker wikitext parser==' . "\n"; $wikitext .= '*This is an unordered list' . "\n"; $wikitext .= '*#With an ordered list within' . "\n"; $wikitext .= '*#And another item' . "\n"; $wikitext .= "\n"; $wikitext .= '#This is an ordered list' . "\n"; $wikitext .= '#*With an unordered list within' . "\n"; $wikitext .= '#*And another item' . "\n"; $wikitext .= implode('', array_keys(_get_smiley_array())) . "\n"; } $parsed_wikitext = $wikitext; $parsed_wikitext = wikitext_parse_smileys($parsed_wikitext); $parsed_wikitext = $this->wikiparser->parse($parsed_wikitext . "\n", 'wiki test'); $data = array('parsed_wikitext' => $parsed_wikitext, 'wikitext' => $wikitext); // Set up the public frame $this->main_frame->SetTitle('Wikitext Preview'); $this->main_frame->IncludeJs('javascript/wikitoolbar.js'); $this->main_frame->SetContentSimple('test/wikitext', $data); // Load the public frame view (which will load the content view) $this->main_frame->Load(); }
/** * Parse Smileys * * Takes a string as input and swaps any contained smileys for wikitext * * @access public * @param string the text to be parsed * @param string the URL to the folder containing the smiley images * @return string */ function wikitext_parse_smileys($str = '', $image_url = 'images/smileys/', $smileys = NULL) { if ($image_url == '') { return $str; } if (!is_array($smileys)) { if (FALSE === ($smileys = _get_smiley_array())) { return $str; } } // Add a trailing slash to the file path if needed $image_url = preg_replace("/(.+?)\\/*\$/", "\\1/", $image_url); foreach ($smileys as $key => $val) { $str = str_replace($key, '[[image:' . $image_url . $smileys[$key][0] . '|' . $smileys[$key][3] . "]]", $str); } return $str; }
function comment_smiles_custom($arg = array()) { $image_url = getinfo('uploads_url') . 'smiles/'; $CI =& get_instance(); $CI->load->helper('smiley_helper'); $smileys = _get_smiley_array(); // идея Евгений - http://jenweb.info/page/hide-smileys, http://forum.max-3000.com/viewtopic.php?f=6&t=3192 echo NR . '<div style="width: 19px; height: 19px; float: right; text-align: right; margin-top: -23px; cursor: pointer; background: url(\'' . getinfo('plugins_url') . 'comment_smiles/bg.gif\') no-repeat;" title="' . t('Показать/скрыть смайлики') . '" class="btn-smiles"></div>' . NR; echo '<p style="padding-bottom:5px;" class="comment_smiles">'; //кусок кода из smiley_helper $used = array(); foreach ($smileys as $key => $val) { // Для того, чтобы для смайлов с одинаковыми картинками (например :-) и :)) // показывалась только одна кнопка if (isset($used[$smileys[$key][0]])) { continue; } echo "<a href=\"javascript:void(0);\" onclick=\"addSmile('" . $key . "')\"><img src=\"" . $image_url . $smileys[$key][0] . "\" width=\"" . $smileys[$key][1] . "\" height=\"" . $smileys[$key][2] . "\" title=\"" . $smileys[$key][3] . "\" alt=\"" . $smileys[$key][3] . "\" style=\"border:0;\"></a> "; $used[$smileys[$key][0]] = TRUE; } echo '</p><script>$("p.comment_smiles").hide();</script>'; }
function parse_smileys($str = '', $image_url = '', $smileys = NULL) { if ($image_url == '') { return $str; } if (!is_array($smileys)) { if (FALSE === ($smileys = _get_smiley_array())) { return $str; } } // Add a trailing slash to the file path if needed $image_url = preg_replace("/(.+?)\\/*\$/", "\\1/", $image_url); foreach ($smileys as $key => $val) { $str = str_replace($key, "<img src=\"" . $image_url . $smileys[$key][0] . "\" width=\"" . $smileys[$key][1] . "\" height=\"" . $smileys[$key][2] . "\" alt=\"" . $smileys[$key][3] . "\" style=\"border:0;\" />", $str); } return $str; }
/** * Parse Smileys * * Takes a string as input and swaps any contained smileys for the actual image * * @param string the text to be parsed * @param string the URL to the folder containing the smiley images * @param array * @return string */ function parse_smileys($str = '', $image_url = '', $smileys = NULL) { if ($image_url === '' or !is_array($smileys) && FALSE === ($smileys = _get_smiley_array())) { return $str; } // Add a trailing slash to the file path if needed $image_url = rtrim($image_url, '/') . '/'; foreach ($smileys as $key => $val) { $str = str_replace($key, '<img src="' . $image_url . $smileys[$key][0] . '" alt="' . $smileys[$key][3] . '" style="width: ' . $smileys[$key][1] . '; height: ' . $smileys[$key][2] . '; border: 0;" />', $str); } return $str; }
function editor_markitup($args = array()) { $options = mso_get_option('editor_markitup', 'plugins', array()); // получаем опции if (!isset($options['preview'])) { $options['preview'] = 'aftertext'; } if (!isset($options['previewautorefresh'])) { $options['previewautorefresh'] = 'no'; } if (!isset($options['previewPosition'])) { $options['previewPosition'] = 'after'; } if ($options['preview'] == 'aftertext') { $editor_config['preview'] = 'previewInWindow: "",'; } else { $editor_config['preview'] = 'previewInWindow: "width=960, height=800, resizable=yes, scrollbars=yes",'; } if ($options['previewautorefresh'] == 'no') { $editor_config['previewautorefresh'] = 'previewAutoRefresh: false,'; } else { $editor_config['previewautorefresh'] = 'previewAutoRefresh: true,'; } if ($options['previewPosition'] == 'before') { $editor_config['previewPosition'] = 'previewPosition: "before",'; } else { $editor_config['previewPosition'] = 'previewPosition: "after",'; } $editor_config['url'] = getinfo('plugins_url') . 'editor_markitup/'; $editor_config['dir'] = getinfo('plugins_dir') . 'editor_markitup/'; if (isset($args['content'])) { $editor_config['content'] = $args['content']; } else { $editor_config['content'] = ''; } if (isset($args['do'])) { $editor_config['do'] = $args['do']; } else { $editor_config['do'] = ''; } if (isset($args['posle'])) { $editor_config['posle'] = $args['posle']; } else { $editor_config['posle'] = ''; } if (isset($args['action'])) { $editor_config['action'] = ' action="' . $args['action'] . '"'; } else { $editor_config['action'] = ''; } if (isset($args['height'])) { $editor_config['height'] = (int) $args['height']; } else { $editor_config['height'] = (int) mso_get_option('editor_height', 'general', 400); if ($editor_config['height'] < 100) { $editor_config['height'] = 400; } } # Приведение строк с <br> в первозданный вид $editor_config['content'] = preg_replace('"<br\\s?/?>"i', "\n", $editor_config['content']); $editor_config['content'] = preg_replace('"<br>"i', "\n", $editor_config['content']); // смайлы - код из comment_smiles $image_url = getinfo('uploads_url') . 'smiles/'; $CI =& get_instance(); $CI->load->helper('smiley_helper'); $smileys = _get_smiley_array(); $used = array(); $smiles = ''; foreach ($smileys as $key => $val) { // Для того, чтобы для смайлов с одинаковыми картинками (например :-) и :)) // показывалась только одна кнопка if (isset($used[$smileys[$key][0]])) { continue; } $im = "<img src='" . $image_url . $smileys[$key][0] . "' title='" . $key . "'>"; $smiles .= '{name:"' . addcslashes($im, '"') . '", notitle: "1", replaceWith:"' . $key . '", className:"col1-0" },' . NR; $used[$smileys[$key][0]] = TRUE; } if ($smiles) { $smiles = NR . "{name:'" . t('Смайлы') . "', openWith:':-)', closeWith:'', className:'smiles', dropMenu: [" . $smiles . ']},'; } require $editor_config['dir'] . 'editor-bb.php'; }
function parse_smileys($str = '', $image_url = '', $smileys = null) { if ($image_url == '') { return $str; } if (!is_array($smileys)) { if (false === ($smileys = _get_smiley_array())) { return $str; } } // Add a trailing slash to the file path if needed $image_url = preg_replace("/(.+?)\\/*\$/", '\\1/', $image_url); foreach ($smileys as $key => $val) { $str = str_replace($key, '<img src="' . $image_url . $smileys[$key][0] . '" width="' . $smileys[$key][1] . '" height="' . $smileys[$key][2] . '" alt="' . $smileys[$key][3] . '" style="border:0;" />', $str); } return $str; }
protected function _wikitext_test() { $this->load->helper('form'); $this->load->library('wikiparser'); $this->load->helper('wikitext_smiley'); // No POST data? just set wikitext to default string $wikitext = $this->input->post('wikitext'); if ($wikitext === FALSE) { $wikitext = '==This is the yorker wikitext parser==' . "\n"; $wikitext .= 'The [[admin/tools/wikitext/flush|flusher]] will allow you to flush the wikitext caches across the website.' . "\n"; $wikitext .= '*This is an unordered list' . "\n"; $wikitext .= '*#With an ordered list within' . "\n"; $wikitext .= '*#And another item' . "\n"; $wikitext .= "\n"; $wikitext .= '#This is an ordered list' . "\n"; $wikitext .= '#*With an unordered list within' . "\n"; $wikitext .= '#*And another item' . "\n"; $wikitext .= implode('', array_keys(_get_smiley_array())) . "\n"; } else { if (get_magic_quotes_gpc()) { $wikitext = stripslashes($wikitext); } } $parsed_wikitext = $wikitext; /// @todo wiktiext tester enable/disable different passes + display mid sections $parsed_wikitext = wikitext_parse_smileys($parsed_wikitext); $parsed_wikitext = $this->wikiparser->parse($parsed_wikitext . "\n", 'wiki test'); $data = array('parsed_wikitext' => $parsed_wikitext, 'wikitext' => $wikitext); // Set up the public frame $this->main_frame->SetTitle('Wikitext Preview'); $this->main_frame->SetContentSimple('admin/tools/wikitext', $data); $this->main_frame->load(); }