function section_save() { global $txpcfg; $in = psa(array('name', 'title', 'page', 'css', 'is_default', 'on_frontpage', 'in_rss', 'searchable', 'old_name')); extract(doSlash($in)); if (empty($title)) { $title = $name; } //Prevent non url chars on section names include_once $txpcfg['txpath'] . '/lib/classTextile.php'; $textile = new Textile(); $title = $textile->TextileThis($title, 1); $name = dumbDown($textile->TextileThis($name, 1)); $name = preg_replace("/[^[:alnum:]\\-_]/", "", str_replace(" ", "-", $name)); if ($name == 'default') { safe_update("txp_section", "page='{$page}',css='{$css}'", "name='default'"); } else { if ($is_default) { // note this means 'selected by default' not 'default page' safe_update("txp_section", "is_default=0", "name!='{$old_name}'"); } safe_update("txp_section", "name = '{$name}',\n\t\t\t\ttitle = '{$title}',\n\t\t\t\tpage = '{$page}',\n\t\t\t\tcss = '{$css}',\n\t\t\t\tis_default = '{$is_default}',\n\t\t\t\ton_frontpage = '{$on_frontpage}',\n\t\t\t\tin_rss = '{$in_rss}',\n\t\t\t\tsearchable = '{$searchable}'", "name = '{$old_name}'"); safe_update("textpattern", "Section='{$name}'", "Section='{$old_name}'"); } sec_section_list(messenger('section', $name, 'updated')); }
/** * Filter. * * @param string $thing * @param array $options */ public function filter($thing, $options) { parent::filter($thing, $options); if ($this->options['restricted']) { return $this->textile->TextileRestricted($thing, $this->options['lite'], $this->options['noimage'], $this->options['rel']); } else { return $this->textile->TextileThis($thing, $this->options['lite'], '', $this->options['noimage'], '', $this->options['rel']); } }
public function handleOutput(FileInterface $scribbleFile, $output) { // https://github.com/netcarver/textile // Make sure this class is require'd and available $textile = new \Textile('html5'); return $textile->TextileThis($output); }
public function indexAction() { #vynulovani rozpadu stromu $_SESSION['katalog']['pars']['u1'] = 0; $_SESSION['katalog']['rozpad'] = 0; $this->view->strom = stromek(0, $this->_getAllParams()); $pom_txt = zpracujTexty(readData('texty', array('jazyk' => $_SESSION['jazyk'], 'kody' => "'uvod_top'"))); $vysl = readData('index', array()); $this->view->kategorie = array(); foreach ($vysl->k->row as $r) { $this->view->kategorie[(string) $r->idk] = (string) $r->kat; } //definice stylu pro kategorie $css = ''; $index = 1; foreach ($this->view->kategorie as $id => $kat) { $css .= '#rozcestnik li#kat-' . trim($id) . ' a, #rozcestnik li#kat-' . trim($id) . ' a:visited {' . "\n"; $css .= 'background: #162983 url("/grafika/kat_' . trim($id) . '.jpg");' . "\n"; if ($index == $index) { $css .= "height: 41px;\n"; $css .= "padding-top: 37px;\n"; } $css .= "}\n"; $css .= '#rozcestnik li#kat-' . trim($id) . ' a:hover, #rozcestnik li#kat-' . trim($id) . ' a:focus, #rozcestnik li#kat-' . trim($id) . ' a:active {' . "\n"; $css .= 'background: #5da6dc url("/grafika/kat_' . trim($id) . '_ho.jpg");' . "\n"; $css .= "}\n"; if ($index >= 3) { $index = 0; } $index++; } //$this->view->css_defs = array(0 => $css); $textile = new Textile(); $this->view->txt = array('uvod_top' => $textile->TextileThis($pom_txt['uvod_top'])); }
function view_help($message = '') { pagetop(gTxt('edit_plugins'), $message); $filename = gps('filename'); $plugin = array(); if (!empty($filename)) { $content = file($filename); $source_lines = count($content); $format = 'none'; for ($i = 0; $i < $source_lines; $i++) { $content[$i] = rtrim($content[$i]); } $format = 'unknown'; // Check for ZEM plugin... $plugin['help'] = _zem_extract_section($content, 'HELP'); if ('' != $plugin['help']) { $format = 'zem_help'; } else { // check for ied style help section... $plugin['help'] = _ied_extract_section($content, 'HELP'); if ('' != $plugin['help']) { $format = 'ied_help'; } } echo startTable('edit'); switch ($format) { case 'zem_help': echo tr(tda('<p>Plugin is in zem template format.</p>', ' width="600"')); if (!isset($plugin['allow_html_help']) or 0 === $plugin['allow_html_help']) { # Textile... $plugin['css'] = _zem_extract_section($content, 'CSS'); include_once txpath . '/lib/classTextile.php'; if (class_exists('Textile')) { $textile = new Textile(); $plugin['help'] = $plugin['css'] . n . $textile->TextileThis($plugin['help']); echo tr(tda('<p>Extracted and Textile processed help section follows…</p><hr>', ' width="600"')); } else { echo tr(tda('<p>Extracted help section follows, <strong>Textile Processing Failed</strong>…</p><hr>', ' width="600"')); } } else { # (x)html... $plugin['css'] = _zem_extract_section($content, 'CSS'); $plugin['help'] = $plugin['css'] . n . $plugin['help_raw']; } echo tr(tda($plugin['help'], ' width="600"')); break; case 'ied_help': echo tr(tda('<p>Plugin is in ied template format.</p>', ' width="600"')); echo tr(tda('<p>Extracted raw help section follows…</p><hr>', ' width="600"')); echo tr(tda($plugin['help'], ' width="600"')); break; default: echo tr(tda('<p><strong>Unknown plugin file format or empty help section.</strong></p><hr>', ' width="600"')); break; } echo endTable(); } else { echo 'Help not accessible from that file.'; } }
function do_textile($text) { $textile = new Textile(); //$text = $textile->TextileRestricted($text, false, false); $text = $textile->TextileThis($text, false, false); //return $text; return add_links($text); }
/** * Just textile the text and return * * @param string $text Input text * @return string */ function do_textile($text) { Env::useLibrary('textile'); $textile = new Textile(); //$text = $textile->TextileRestricted($text, false, false); $text = $textile->TextileThis($text, false, false); return add_links($text); }
function htmlFormatted($text, $media = false, $model = null, $media_link_attributes = null) { $text = $this->sanitiseText($text, false); if (!preg_match('/{\\[markdown\\]}/', $text)) { $txtl = new Textile(); $text = SmartyPants($txtl->TextileThis($text), 1); $text = $txtl->TextileThis($text); } else { $text = str_replace('{[markdown]}', '', $text); $text = SmartyPants(Markdown($text), 1); } if ($media && count($media)) { $text = $this->_formatTextFragments($text, $media, $model, $media_link_attributes); } else { $text = $this->_stripTextFragments($text); } return $text; }
function execute_textile($data) { static $textile; if (!$textile) { require IXG_PATH_PREFIX . "pipes/engines/textile/textile.php"; $textile = new Textile(); } return $textile->TextileThis($data); }
function smarty_modifier_textile($string, $lite = false, $restricted = false) { if (!isset($string) || $string === '') { return $string; } else { Globe::Load('Textile/library/Vendor/Textile', 'package'); $textile = new Textile(); return $restricted ? $textile->TextileRestricted($string, $lite) : $textile->TextileThis($string, $lite); } }
function section_save() { global $txpcfg, $app_mode; extract(doSlash(psa(array('page', 'css', 'old_name')))); extract(psa(array('name', 'title'))); $prequel = ''; $sequel = ''; if (empty($title)) { $title = $name; } // Prevent non url chars on section names include_once txpath . '/lib/classTextile.php'; $textile = new Textile(); $title = doSlash($textile->TextileThis($title, 1)); $name = doSlash(sanitizeForUrl($name)); if ($old_name && strtolower($name) != strtolower($old_name)) { if (safe_field('name', 'txp_section', "name='{$name}'")) { $message = array(gTxt('section_name_already_exists', array('{name}' => $name)), E_ERROR); if ($app_mode == 'async') { // TODO: Better/themeable popup send_script_response('window.alert("' . escape_js(strip_tags(gTxt('section_name_already_exists', array('{name}' => $name)))) . '")'); } else { sec_section_list($message); return; } } } if ($name == 'default') { safe_update('txp_section', "page = '{$page}', css = '{$css}'", "name = 'default'"); update_lastmod(); } else { extract(array_map('assert_int', psa(array('is_default', 'on_frontpage', 'in_rss', 'searchable')))); // note this means 'selected by default' not 'default page' if ($is_default) { safe_update("txp_section", "is_default = 0", "name != '{$old_name}'"); // switch off $is_default for all sections in async app_mode if ($app_mode == 'async') { $prequel = '$("input[name=\\"is_default\\"][value=\\"1\\"]").attr("checked", false);' . '$("input[name=\\"is_default\\"][value=\\"0\\"]").attr("checked", true);'; } } safe_update('txp_section', "\n\t\t\t\tname = '{$name}',\n\t\t\t\ttitle = '{$title}',\n\t\t\t\tpage = '{$page}',\n\t\t\t\tcss = '{$css}',\n\t\t\t\tis_default = {$is_default},\n\t\t\t\ton_frontpage = {$on_frontpage},\n\t\t\t\tin_rss = {$in_rss},\n\t\t\t\tsearchable = {$searchable}\n\t\t\t", "name = '{$old_name}'"); safe_update('textpattern', "Section = '{$name}'", "Section = '{$old_name}'"); update_lastmod(); } $message = gTxt('section_updated', array('{name}' => $name)); if ($app_mode == 'async') { // Caveat: Use unslashed params for DTO $s = psa(array('name', 'title', 'page', 'css')) + compact('is_default', 'on_frontpage', 'in_rss', 'searchable'); $s = section_detail_partial($s); send_script_response($prequel . '$("#section-form-' . $name . '").replaceWith("' . escape_js($s) . '");' . $sequel); } else { sec_section_list($message); } }
function processPage($page) { $textile = new Textile(); $handle = @fopen($page, "r"); if ($handle == False) { return __("<center><h1>Error:This item is not documented!</h1></center>"); } $contents = fread($handle, filesize($page)); fclose($handle); return "<div class = 'textile'>{$textile->TextileThis($contents)}</div>"; }
function run($string) { if (!function_exists('typogrify')) { include_once EXTENSIONS . '/typogrify/lib/php-typogrify.php'; } if (!class_exists('Textile')) { include_once EXTENSIONS . '/textile/lib/textile.php'; } $textile = new Textile(); return stripslashes(typogrify($textile->TextileThis($string))); }
function compile_plugin($file='') { global $plugin; if (empty($file)) $file = $_SERVER['SCRIPT_FILENAME']; if (!isset($plugin['name'])) { $plugin['name'] = basename($file, '.php'); } # Read the contents of this file, and strip line ends $content = read_file($file); $plugin['help'] = trim(extract_section($content, 'HELP')); $plugin['code'] = extract_section($content, 'CODE'); if (isset($plugin['help_file'])) { $plugin_content = read_file($plugin['help_file']); $plugin['help'] = trim(extract_section($plugin_content, 'HELP')); } // textpattern will textile it, and encode html $plugin['help_raw'] = $plugin['help']; @include('classTextile.php'); if (class_exists('Textile')) { $textile = new Textile(); $plugin['help'] = $textile->TextileThis($plugin['help']); } $plugin['md5'] = md5( $plugin['code'] ); // to produce a copy of the plugin for distribution, load this file in a browser. header('Content-type: text/plain'); $header = <<<EOF # {$plugin['name']} v{$plugin['version']} # {$plugin['description']} # {$plugin['author']} # {$plugin['author_uri']} # ...................................................................... # This is a plugin for Textpattern - http://textpattern.com/ # To install: textpattern > admin > plugins # Paste the following text into the 'Install plugin' box: # ...................................................................... EOF; return $header . "\n\n" . trim(chunk_split(base64_encode(serialize($plugin)), 72)). "\n"; }
public function zobrazAction() { $textile = new Textile(); $pars = $this->_getAllParams(); if (isset($pars['idt']) && trim($this->_getParam('idt')) != '') { $this->view->kod = trim($this->_getParam('idt')); $this->view->txt = zpracujTexty(readData('texty', array('jazyk' => $_SESSION['jazyk'], 'kody' => "'" . trim($this->_getParam('idt')) . "'"))); //print_r($this->view->nacteny); #print_r($this->view->txt); #echo "\n\nPOSLEDNI XML:\n"; #echo ukazXML($_SESSION['vracene_xml']); #die(); if (sizeof($this->view->txt) == 0 || !isset($this->view->txt[$this->view->kod])) { $this->view->txt = array($this->view->kod => $textile->TextileThis('Text s kódem *' . $this->view->kod . '* nebyl nalezen.')); } else { $this->view->txt[$this->view->kod] = $textile->TextileThis($this->view->txt[$this->view->kod]); } } else { $this->view->kod = 'info'; $this->view->txt = array('info' => 'Nebyl specifikován požadovaný text.'); } $this->view->strom = stromek(0, $this->_getAllParams()); }
function import_mt_item($item, $section, $status, $invite) { # Untested import code follows if (empty($item)) { return; } include_once txpath . '/lib/classTextile.php'; $textile = new Textile(); $title = $textile->TextileThis($item['TITLE'], 1); //nice non-english permlinks $url_title = stripSpace(dumbDown($title)); $body = $item['BODY'][0]['content'] . (isset($item['EXTENDED_BODY']) ? "\n<!--more-->\n" . $item['EXTENDED_BODY'][0]['content'] : ''); $body_html = $textile->textileThis($body); $excerpt = @$item['EXCERPT'][0]['content']; $excerpt_html = $textile->textileThis($excerpt); $date = strtotime($item['DATE']); $date = date('Y-m-d H:i:s', $date); if (isset($item['STATUS'])) { $post_status = $item['STATUS'] == 'Draft' ? 1 : 4; } else { $post_status = $status; } $category1 = @$item['PRIMARY CATEGORY']; if ($category1 and !safe_field("name", "txp_category", "name = '{$category1}'")) { safe_insert('txp_category', "name='" . doSlash($category1) . "', type='article', parent='root'"); } $keywords = @$item['KEYWORDS'][0]['content']; $authorid = safe_field('user_id', 'txp_users', "name = '" . doSlash($item['AUTHOR']) . "'"); if (!$authorid) { // $authorid = safe_field('user_id', 'txp_users', 'order by user_id asc limit 1'); //Add new authors safe_insert('txp_users', "name='" . doSlash($item['AUTHOR']) . "'"); } if (!safe_field("ID", "textpattern", "Title = '" . doSlash($title) . "' AND Posted = '" . doSlash($date) . "'")) { safe_insert('textpattern', "Posted='" . doSlash($date) . "'," . "LastMod='" . doSlash($date) . "'," . "AuthorID='" . doSlash($item['AUTHOR']) . "'," . "LastModID='" . doSlash($item['AUTHOR']) . "'," . "Title='" . doSlash($title) . "'," . "Body='" . doSlash($body) . "'," . "Body_html='" . doSlash($body_html) . "'," . "Excerpt='" . doSlash($excerpt) . "'," . "Excerpt_html='" . doSlash($excerpt_html) . "'," . "Category1='" . doSlash($category1) . "'," . "AnnotateInvite='" . doSlash($invite) . "'," . "Status='" . doSlash($post_status) . "'," . "Section='" . doSlash($section) . "'," . "Keywords='" . doSlash($keywords) . "'," . "uid='" . md5(uniqid(rand(), true)) . "'," . "feed_time='" . substr($date, 0, 10) . "'," . "url_title='" . doSlash($url_title) . "'"); $parentid = mysql_insert_id(); if (!empty($item['COMMENT'])) { foreach ($item['COMMENT'] as $comment) { $comment_date = date('Y-m-d H:i:s', strtotime(@$comment['DATE'])); $comment_content = $textile->TextileThis(nl2br(@$comment['content']), 1); if (!safe_field("discussid", "txp_discuss", "posted = '" . doSlash($comment_date) . "' AND message = '" . doSlash($comment_content) . "'")) { safe_insert('txp_discuss', "parentid='" . doSlash($parentid) . "'," . "name='" . doSlash(@$comment['AUTHOR']) . "'," . "email='" . doSlash(@$comment['EMAIL']) . "'," . "web='" . doSlash(@$comment['URL']) . "'," . "ip='" . doSlash(@$comment['IP']) . "'," . "posted='" . doSlash($comment_date) . "'," . "message='" . doSlash($comment_content) . "'," . "visible='1'"); } } } return $title; } return $title . ' already imported'; }
public function process($content, $lite = '', $encode = '', $noimage = '', $strict = '', $rel = '') { // Convert the raw content to wiki content switch ($this->syntax) { case 'markdown': require_once PHPGW_API_INC . '/wiki2html/markdown/markdown.php'; $html = Markdown($content); break; default: require_once PHPGW_API_INC . '/wiki2html/textile/Textile.php'; $textile = new Textile(); $html = $textile->TextileThis($content); } return $html; }
function FM_Textile_format($blogid, $id, $content, $keywords = array(), $useAbsolutePath = true, $bRssMode = false) { global $service; $textile = new Textile(); $path = __TEXTCUBE_ATTACH_DIR__ . "/{$blogid}"; $url = "{$service['path']}/attach/{$blogid}"; if (!function_exists('FM_TTML_bindAttachments')) { // To reduce the amount of loading code! require_once 'ttml.php'; } $view = FM_TTML_bindAttachments($id, $path, $url, $content, $useAbsolutePath, $bRssMode); $view = $textile->TextileThis($view); $view = FM_TTML_bindTags($id, $view); return $view; }
function formatComments($darr) { global $prefs, $txpcfg, $comments_disallow_images, $txpac; extract($prefs); $preview = gps('preview'); $id = gps('id'); $Form = fetch('Form', 'txp_form', 'name', 'comments'); $out = ''; foreach ($darr as $vars) { extract($vars); if ($preview) { include_once $txpcfg['txpath'] . '/lib/classTextile.php'; $time = time(); $discussid = 0; $textile = new Textile(); $im = !empty($comments_disallow_images) ? 1 : ''; $message = trim(nl2br($textile->TextileThis(strip_tags($message), 1, '', $im))); } if ($comments_dateformat == "since") { $comment_time = since($time + $timeoffset); } else { $comment_time = date($comments_dateformat, $time + $timeoffset); } $web = str_replace("http://", "", $web); if ($email && !$web && !$txpac['never_display_email']) { $name = '<a href="' . eE('mailto:' . $email) . '">' . $name . '</a>'; } if ($web) { $name = '<a href="http://' . $web . '" title="' . $web . '">' . $name . '</a>'; } $Section = fetch('Section', 'textpattern', 'ID', $parentid); if ($url_mode == 1) { $dlink = $path_from_root . $Section . '/' . $parentid . '/#c' . $discussid; } else { if ($url_mode == 0) { $dlink = $path_from_root . 'index.php?id=' . $parentid . '#c' . $discussid; } } $vals = array('comment_name' => $name, 'message' => $message, 'comment_time' => $comment_time); $temp = $Form; foreach ($vals as $a => $b) { $temp = str_replace('<txp:' . $a . ' />', $b, $temp); } $temp = preg_replace('/<(txp:comment_permlink)>(.*)<\\/\\1>/U', '<a href="' . $dlink . '">$2</a>', $temp); $out .= n . t . '<li id="c' . $discussid . '" style="margin-top:2em">' . $temp . '</li>'; } return $out; }
public static function get_rendered_text($text) { $style = Kohana::config('filebrowser.text_rendering'); if ($style == "textile") { $textile = new Textile(); //return $textile->TextileThis(text::auto_link_urls($text, '_blank')); return $textile->TextileThis($text); } else { if ($style == "markdown") { //return Markdown(text::auto_link_urls($text, '_blank')); return Markdown($text); } else { return $text; } } }
function import_blogger_item($item, $section, $status, $invite) { # Untested import code follows if (empty($item)) { return; } include_once txpath . '/lib/classTextile.php'; $textile = new Textile(); $title = $textile->TextileThis($item['TITLE'], 1); $url_title = stripSpace(dumbDown($title)); $body = $item['BODY'][0]['content']; $body_html = $textile->textileThis($body, 1); $date = strtotime($item['DATE']); $date = date('Y-m-d H:i:s', $date); if (isset($item['STATUS'])) { $post_status = $item['STATUS'] == 'Draft' ? 1 : 4; } else { $post_status = $status; } //Bogger can use special chars on author names. Strip them and check for realname $authorid = safe_field('user_id', 'txp_users', "RealName = '" . doSlash($item['AUTHOR']) . "'"); if (!$authorid) { // $authorid = safe_field('user_id', 'txp_users', 'order by user_id asc limit 1'); //Add new authors safe_insert('txp_users', "name='" . doSlash(stripSpace(dumbDown($textile->TextileThis($item['AUTHOR'], 1)))) . "', RealName='" . doSlash($item['AUTHOR']) . "'"); } if (!safe_field("ID", "textpattern", "Title = '" . doSlash($title) . "' AND Posted = '" . doSlash($date) . "'")) { safe_insert('textpattern', "Posted='" . doSlash($date) . "'," . "LastMod='" . doSlash($date) . "'," . "AuthorID='" . doSlash($item['AUTHOR']) . "'," . "LastModID='" . doSlash($item['AUTHOR']) . "'," . "Title='" . doSlash($title) . "'," . "Body='" . doSlash($body) . "'," . "Body_html='" . doSlash($body_html) . "'," . "AnnotateInvite='" . doSlash($invite) . "'," . "Status='" . doSlash($post_status) . "'," . "Section='" . doSlash($section) . "'," . "uid='" . md5(uniqid(rand(), true)) . "'," . "feed_time='" . substr($date, 0, 10) . "'," . "url_title='" . doSlash($url_title) . "'"); $parentid = mysql_insert_id(); if (!empty($item['COMMENT'])) { foreach ($item['COMMENT'] as $comment) { $comment_date = date('Y-m-d H:i:s', strtotime(@$comment['DATE'])); $comment_content = $textile->TextileThis(nl2br(@$comment['content']), 1); //Check for Comments authors if (preg_match('/<a href="(.*)">(.*)<\\/a>/', @$comment['AUTHOR'], $match)) { @($comment['URL'] = $match[1]); @($comment['AUTHOR'] = $match[2]); } if (!safe_field("discussid", "txp_discuss", "posted = '" . doSlash($comment_date) . "' AND message = '" . doSlash($comment_content) . "'")) { safe_insert('txp_discuss', "parentid='" . doSlash($parentid) . "'," . "name='" . doSlash(strip_tags(@$comment['AUTHOR'])) . "'," . "web='" . doSlash(@$comment['URL']) . "'," . "posted='" . doSlash($comment_date) . "'," . "message='" . doSlash($comment_content) . "'," . "visible='1'"); } } } return $title; } return $title . ' already imported'; }
function FM_Textile_format($blogid, $id, $content, $keywords = array(), $useAbsolutePath = true, $bRssMode = false) { $context = Model_Context::getInstance(); $textile = new Textile(); $path = __TEXTCUBE_ATTACH_DIR__ . "/{$blogid}"; $url = $context->getProperty("service.path") . "/attach/{$blogid}"; if (!function_exists('FM_TTML_bindAttachments')) { // To reduce the amount of loading code! require_once 'ttml.php'; } $view = FM_TTML_bindAttachments($id, $path, $url, $content, $useAbsolutePath, $bRssMode); $view = FM_TTML_preserve_TTML_type_tags($view); $view = $textile->TextileThis($view); $view = FM_TTML_restore_TTML_type_tags($view); $view = FM_TTML_bindTags($id, $view); return $view; }
/** * Render content via a given $content_type * * @param string $content Content to render * @param mixed $content_type Content type to use (overrides configured content_type) * @return string */ public static function transform($content, $content_type = NULL) { $content_type = Helper::pick($content_type, Config::getContentType()); // render HTML from the given $content_type switch (strtolower($content_type)) { case "markdown": case "md": $content = Markdown($content); break; case "text": case "txt": $content = nl2br(strip_tags($content)); break; case "textile": $textile = new Textile(); $content = $textile->TextileThis($content); } if (Config::get('_enable_smartypants', TRUE) == TRUE) { $content = SmartyPants($content, 2); } return trim($content); }
function section_save() { global $txpcfg; extract(doSlash(psa(array('page', 'css', 'old_name')))); extract(psa(array('name', 'title'))); if (empty($title)) { $title = $name; } // Prevent non url chars on section names include_once txpath . '/lib/classTextile.php'; $textile = new Textile(); $title = doSlash($textile->TextileThis($title, 1)); $name = doSlash(sanitizeForUrl($name)); if ($old_name && strtolower($name) != strtolower($old_name)) { if (safe_field('name', 'txp_section', "name='{$name}'")) { $message = gTxt('section_name_already_exists', array('{name}' => $name)); sec_section_list($message); return; } } if ($name == 'default') { safe_update('txp_section', "page = '{$page}', css = '{$css}'", "name = 'default'"); update_lastmod(); } else { extract(array_map('assert_int', psa(array('is_default', 'on_frontpage', 'in_rss', 'searchable')))); // note this means 'selected by default' not 'default page' if ($is_default) { safe_update("txp_section", "is_default = 0", "name != '{$old_name}'"); } safe_update('txp_section', "\n\t\t\t\tname = '{$name}',\n\t\t\t\ttitle = '{$title}',\n\t\t\t\tpage = '{$page}',\n\t\t\t\tcss = '{$css}',\n\t\t\t\tis_default = {$is_default},\n\t\t\t\ton_frontpage = {$on_frontpage},\n\t\t\t\tin_rss = {$in_rss},\n\t\t\t\tsearchable = {$searchable}\n\t\t\t", "name = '{$old_name}'"); safe_update('textpattern', "Section = '{$name}'", "Section = '{$old_name}'"); update_lastmod(); } $message = gTxt('section_updated', array('{name}' => $name)); sec_section_list($message); }
function textile_main_fields($incoming, $use_textile) { global $txpcfg; include_once txpath . '/lib/classTextile.php'; $textile = new Textile(); $incoming['Title_plain'] = $incoming['Title']; $incoming['url_title'] = preg_replace('|[\\x00-\\x1f#%+/?\\x7f]|', '', $incoming['url_title']); if ($incoming['textile_body'] == LEAVE_TEXT_UNTOUCHED) { $incoming['Body_html'] = trim($incoming['Body']); } elseif ($incoming['textile_body'] == USE_TEXTILE) { $incoming['Body_html'] = $textile->TextileThis($incoming['Body']); $incoming['Title'] = $textile->TextileThis($incoming['Title'], '', 1); } elseif ($incoming['textile_body'] == CONVERT_LINEBREAKS) { $incoming['Body_html'] = nl2br(trim($incoming['Body'])); } if ($incoming['textile_excerpt'] == LEAVE_TEXT_UNTOUCHED) { $incoming['Excerpt_html'] = trim($incoming['Excerpt']); } elseif ($incoming['textile_excerpt'] == USE_TEXTILE) { $incoming['Excerpt_html'] = $textile->TextileThis($incoming['Excerpt']); } elseif ($incoming['textile_excerpt'] == CONVERT_LINEBREAKS) { $incoming['Excerpt_html'] = nl2br(trim($incoming['Excerpt'])); } return $incoming; }
/** * Creates a JSON with a preview text of a textile input. * * @access public * @return json An javascript object that contains `error` and `content` properties */ public function textile_preview() { $error = false; $content = ''; if (!empty($this->data['text'])) { App::import('Vendor', 'Textile'); $Textile = new Textile(); $content = $Textile->TextileThis($this->data['text']); } $this->set('jsonVars', compact('error', 'content')); }
/** * Save Cell Settings */ function save_cell_settings($settings) { $settings = $settings['wygwam']; // ------------------------------------------- // Field Conversion // ------------------------------------------- if (!empty($settings['convert'])) { if (!empty($this->col_id)) { $this->EE->db->select('row_id, col_id_' . $this->col_id . ' data'); $query = $this->EE->db->get_where('matrix_data', 'col_id_' . $this->col_id . ' != ""'); if ($query->num_rows()) { // prepare Typography $this->EE->load->library('typography'); $this->EE->typography->initialize(); // prepare Textile if ($settings['convert'] == 'textile') { if (!class_exists('Textile')) { require_once PATH_THIRD . 'wygwam/lib/textile/textile.php'; } $textile = new Textile(); } foreach ($query->result_array() as $row) { $data = $row['data']; Wygwam_helper::replace_file_tags($data); // Auto <br /> and XHTML switch ($settings['convert']) { case 'auto': $data = $this->EE->typography->auto_typography($data); break; case 'textile': $data = $textile->TextileThis($data); } // Save the new field data Wygwam_helper::replace_file_urls($data); $this->EE->db->query($this->EE->db->update_string('exp_matrix_data', array('col_id_' . $this->col_id => $data), 'row_id = ' . $row['row_id'])); } } } unset($settings['convert']); } return $settings; }
function markupRSS() { require_once './textile/classTextile.php'; $filearray = getPostFilenames(); foreach ($filearray as $file) { //add markup to posts and put them together with the newest post on top $fh = fopen('posts/' . $file, 'r'); $title = fgets($fh); $title = substr($title, 0, -1); $post = fread($fh, filesize('posts/' . $file)); $post = substr($post, 1); //cause the body of the post to be textile-ified $textile = new Textile(); $post = $textile->TextileThis($post); //make the date (more) human-readable $prettydate = substr($file, 4, 2) . '/' . substr($file, 6, 2) . '/' . substr($file, 0, 4) . ' at ' . substr($file, -6, 2) . ':' . substr($file, -4, 2) . ':' . substr($file, -2); $posts = "\n" . '<description>' . "\n" . $post . "\n" . '</div>' . "\n" . '</div>' . "\n" . $posts; $posts = '<item><title>' . "\n" . $prettydate . ' - ' . $title . '</title>' . '<link>http://paulbersch.com/</link>' . $posts; } $posts = '<?xml version="1.0" ?>' . "\n" . "<rss version=\"2.0\">" . "\n" . "<channel>" . "\n" . "<title>Blog Title Goes Here</title>" . "\n" . "<link>http://paulbersch.com</link>" . "\n" . "<description>I describe this feed very well.</description>" . $posts; $posts .= "\n" . '</rss>'; return $posts; }
<?php /* $Id: echo.php 117 2007-03-02 16:16:08Z tuupola $ */ $renderer = isset($_GET['renderer']) ? $_GET['renderer'] : $_POST['renderer']; if ('textile' == $renderer) { require_once './Textile.php'; $t = new Textile(); print $t->TextileThis(stripslashes($_POST['value'])); } else { print $_POST['value']; }
function wikify($text) { global $SCRIPT_URL; // FIXME: Do not apply this in <pre> and <notextile> blocks. // Linkify $text = preg_replace('@([^:"])(https?://([-\\w\\.]+)+(:\\d+)?(/([%-\\w/_\\.]*(\\?\\S+)?)?)?)@', '$1<a href="$2">$2</a>', $text); // WikiLinkify $text = preg_replace('@\\[([\\w-\\.]+)\\]@', '<a href="' . $SCRIPT_URL . '/$1">$1</a>', $text); $text = preg_replace('@\\[([\\w-\\.]+)\\|([\\w-\\.\\s]+)\\]@', '<a href="' . $SCRIPT_URL . '/$1">$2</a>', $text); // Textilify $textile = new Textile(); return $textile->TextileThis($text); }