TextileRestricted() публичный Метод

# Fake restricted version: restrictions are not supported for now.
public TextileRestricted ( $text, $lite = '', $noimage = '' )
Пример #1
0
 /**
  * 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']);
     }
 }
Пример #2
0
/**
 * 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);
    return add_links($text);
}
Пример #3
0
function do_textile($text)
{
    $textile = new Textile();
    $text = $textile->TextileRestricted($text, false, false);
    //return $text;
    return add_links($text);
}
Пример #4
0
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);
    }
}
Пример #5
0
function getComments($num)
{
    $comments = glob("data/{$num}/comment*");
    natsort($comments);
    $comments = array_values($comments);
    $body = "<p> <strong>Comments:</strong> </p>";
    $textile = new Textile();
    foreach ($comments as $com) {
        $comarr = file($com);
        preg_match('/^.*[^0-9](\\d+)$/', $com, $matches);
        $text = join("\n", array_slice($comarr, 1));
        $body .= " <p class='comment'>#{$matches['1']} From: {$comarr['0']} <br />\n\t\t" . $textile->TextileRestricted($text) . "</p>\n\t\t<hr />";
    }
    return $body;
}
Пример #6
0
function uds_billboard_description($atts, $content = null)
{
    global $uds_description_mode, $uds_billboard_text_evaluation;
    extract(shortcode_atts(array('top' => '20px', 'left' => '20px', 'width' => '200px', 'height' => '80%', 'skin' => ''), $atts));
    if (isset($uds_description_mode) && $uds_description_mode == 'editor') {
        $out = "<div class='editable-box' data-skin='{$skin}' style='top:{$top};left:{$left};width:{$width};height:{$height};'><textarea>{$content}</textarea></div>";
    } else {
        if ($uds_billboard_text_evaluation == 'textile') {
            $textile = new Textile();
            $content = $textile->TextileRestricted($content, '');
        }
        if (!empty($skin)) {
            $skin = 'uds-' . $skin;
        }
        $out = "<div class='uds-bb-description {$skin}' style='top:{$top};left:{$left};width:{$width};height:{$height};'><div class='uds-bb-description-inside'>{$content}</div></div>";
    }
    return $out;
}
Пример #7
0
function markup_comment($msg)
{
    global $prefs;
    $disallow_images = !empty($prefs['comments_disallow_images']);
    $lite = empty($prefs['comments_use_fat_textile']);
    $rel = !empty($prefs['comment_nofollow']) ? 'nofollow' : '';
    include_once txpath . '/lib/classTextile.php';
    $textile = new Textile();
    return $textile->TextileRestricted($msg, $lite, $disallow_images, $rel);
}
Пример #8
0
function plugin_install()
{
    $plugin = ps('plugin64');
    if (strpos($plugin, '$plugin=\'') !== false) {
        @ini_set('pcre.backtrack_limit', '1000000');
        $plugin = preg_replace('@.*\\$plugin=\'([\\w=+/]+)\'.*@s', '$1', $plugin);
    }
    $plugin = preg_replace('/^#.*$/m', '', $plugin);
    if (trim($plugin)) {
        $plugin = base64_decode($plugin);
        if (strncmp($plugin, "‹", 2) === 0) {
            $plugin = gzinflate(substr($plugin, 10));
        }
        if ($plugin = unserialize($plugin)) {
            if (is_array($plugin)) {
                extract($plugin);
                $type = empty($type) ? 0 : min(max(intval($type), 0), 3);
                $order = empty($order) ? 5 : min(max(intval($order), 1), 9);
                $flags = empty($flags) ? 0 : intval($flags);
                $exists = fetch('name', 'txp_plugin', 'name', $name);
                if (isset($help_raw) && empty($plugin['allow_html_help'])) {
                    // default: help is in Textile format
                    include_once txpath . '/lib/classTextile.php';
                    $textile = new Textile();
                    $help = $textile->TextileRestricted($help_raw, 0, 0);
                }
                if ($exists) {
                    $rs = safe_update("txp_plugin", "status      = 0,\n\t\t\t\t\t\t\ttype         = {$type},\n\t\t\t\t\t\t\tauthor       = '" . doSlash($author) . "',\n\t\t\t\t\t\t\tauthor_uri   = '" . doSlash($author_uri) . "',\n\t\t\t\t\t\t\tversion      = '" . doSlash($version) . "',\n\t\t\t\t\t\t\tdescription  = '" . doSlash($description) . "',\n\t\t\t\t\t\t\thelp         = '" . doSlash($help) . "',\n\t\t\t\t\t\t\tcode         = '" . doSlash($code) . "',\n\t\t\t\t\t\t\tcode_restore = '" . doSlash($code) . "',\n\t\t\t\t\t\t\tcode_md5     = '" . doSlash($md5) . "',\n\t\t\t\t\t\t\tflags     \t = {$flags}", "name        = '" . doSlash($name) . "'");
                } else {
                    $rs = safe_insert("txp_plugin", "name         = '" . doSlash($name) . "',\n\t\t\t\t\t\t\tstatus       = 0,\n\t\t\t\t\t\t\ttype         = {$type},\n\t\t\t\t\t\t\tauthor       = '" . doSlash($author) . "',\n\t\t\t\t\t\t\tauthor_uri   = '" . doSlash($author_uri) . "',\n\t\t\t\t\t\t\tversion      = '" . doSlash($version) . "',\n\t\t\t\t\t\t\tdescription  = '" . doSlash($description) . "',\n\t\t\t\t\t\t\thelp         = '" . doSlash($help) . "',\n\t\t\t\t\t\t\tcode         = '" . doSlash($code) . "',\n\t\t\t\t\t\t\tcode_restore = '" . doSlash($code) . "',\n\t\t\t\t\t\t\tcode_md5     = '" . doSlash($md5) . "',\n\t\t\t\t\t\t\tload_order   = '" . $order . "',\n\t\t\t\t\t\t\tflags   \t = {$flags}");
                }
                if ($rs and $code) {
                    if (!empty($textpack)) {
                        install_textpack($textpack, false);
                        // TODO: How do we get rid of stale Textpacks once a plugin is uninstalled?
                    }
                    if ($flags & PLUGIN_LIFECYCLE_NOTIFY) {
                        load_plugin($name, true);
                        $message = callback_event("plugin_lifecycle.{$name}", 'installed');
                    }
                    if (empty($message)) {
                        $message = gTxt('plugin_installed', array('{name}' => $name));
                    }
                    plugin_list($message);
                    return;
                } else {
                    $message = array(gTxt('plugin_install_failed', array('{name}' => $name)), E_ERROR);
                    plugin_list($message);
                    return;
                }
            }
        }
    }
    plugin_list(array(gTxt('bad_plugin_code'), E_ERROR));
}
Пример #9
0
function plugin_install()
{
    $plugin = ps('plugin64');
    $plugin = preg_replace('@.*\\$plugin=\'([\\w=+/]+)\'.*@s', '$1', $plugin);
    $plugin = preg_replace('/^#.*$/m', '', $plugin);
    if (trim($plugin)) {
        $plugin = base64_decode($plugin);
        if (strncmp($plugin, "‹", 2) === 0) {
            $plugin = gzinflate(substr($plugin, 10));
        }
        if ($plugin = unserialize($plugin)) {
            if (is_array($plugin)) {
                extract($plugin);
                $type = empty($type) ? 0 : min(max(intval($type), 0), 3);
                $order = empty($order) ? 5 : min(max(intval($order), 1), 9);
                $exists = fetch('name', 'txp_plugin', 'name', $name);
                if (isset($help_raw) && empty($plugin['allow_html_help'])) {
                    // default: help is in Textile format
                    include_once txpath . '/lib/classTextile.php';
                    $textile = new Textile();
                    $help = $textile->TextileRestricted($help_raw, 0, 0);
                }
                if ($exists) {
                    $rs = safe_update("txp_plugin", "status      = 0,\n\t\t\t\t\t\t\ttype         = {$type},\n\t\t\t\t\t\t\tauthor       = '" . doSlash($author) . "',\n\t\t\t\t\t\t\tauthor_uri   = '" . doSlash($author_uri) . "',\n\t\t\t\t\t\t\tversion      = '" . doSlash($version) . "',\n\t\t\t\t\t\t\tdescription  = '" . doSlash($description) . "',\n\t\t\t\t\t\t\thelp         = '" . doSlash($help) . "',\n\t\t\t\t\t\t\tcode         = '" . doSlash($code) . "',\n\t\t\t\t\t\t\tcode_restore = '" . doSlash($code) . "',\n\t\t\t\t\t\t\tcode_md5     = '" . doSlash($md5) . "'", "name        = '" . doSlash($name) . "'");
                } else {
                    $rs = safe_insert("txp_plugin", "name         = '" . doSlash($name) . "',\n\t\t\t\t\t\t\tstatus       = 0,\n\t\t\t\t\t\t\ttype         = {$type},\n\t\t\t\t\t\t\tauthor       = '" . doSlash($author) . "',\n\t\t\t\t\t\t\tauthor_uri   = '" . doSlash($author_uri) . "',\n\t\t\t\t\t\t\tversion      = '" . doSlash($version) . "',\n\t\t\t\t\t\t\tdescription  = '" . doSlash($description) . "',\n\t\t\t\t\t\t\thelp         = '" . doSlash($help) . "',\n\t\t\t\t\t\t\tcode         = '" . doSlash($code) . "',\n\t\t\t\t\t\t\tcode_restore = '" . doSlash($code) . "',\n\t\t\t\t\t\t\tcode_md5     = '" . doSlash($md5) . "',\n\t\t\t\t\t\t\tload_order   = '" . $order . "'");
                }
                if ($rs and $code) {
                    $message = gTxt('plugin_installed', array('{name}' => htmlspecialchars($name)));
                    plugin_list($message);
                } else {
                    $message = gTxt('plugin_install_failed', array('{name}' => htmlspecialchars($name)));
                    plugin_list($message);
                }
            }
        } else {
            plugin_list(gTxt('bad_plugin_code'));
        }
    }
}
Пример #10
0
 private static function action_summary(&$pattern, $blob_location)
 {
     global $txpcfg;
     include_once $txpcfg['txpath'] . DS . 'lib' . DS . 'classTextile.php';
     $txt = new Textile();
     echo $txt->TextileRestricted($pattern['info']['help.textile'], 0, 0);
     # TODO genarate a log report of all the items added and their initial values...
     echo '<h2>' . self::t('h2.summary') . '</h2>' . '<p>' . self::t('summary', array('{pattern}' => $pattern['info']['name'])) . '</p>';
 }
Пример #11
0
 function format($string)
 {
     $textile = new Textile();
     return $textile->TextileRestricted($string);
 }
Пример #12
0
 /**
  * getHelpText()
  *
  * Get the custom help text entered for/by a certain NREN
  *
  * @param Person $person the current person (for tag-replacement)
  * @return String $help_text the parsed, replaced and textile-replaced text
  */
 public function getHelpText($person)
 {
     $query = "SELECT help FROM nrens WHERE nren_id = ? AND help IS NOT NULL";
     $res = array();
     try {
         $res = MDB2Wrapper::execute($query, array('text'), array($this->getID()));
     } catch (DBStatementException $dbse) {
         Logger::log_event(LOG_INFO, "[norm] Could not retrieve the help " . "text of NREN {$nren} due to an error with the " . "statement. Server said " . $dbse->getMessage());
         return "";
     } catch (DBQueryException $dbqe) {
         Logger::log_event(LOG_INFO, "[norm] Could not retrieve the help " . "text of NREN {$nren} due to an error in the " . "query. Server said " . $dbqe->getMessage());
         return "";
     }
     if (count($res) > 0) {
         $help_text = $res[0]['help'];
         $help_text = Input::br2nl($help_text);
         $help_text = stripslashes($help_text);
         $textile = new Textile();
         $help_text = $textile->TextileRestricted($help_text, 0);
         return $this->replaceTags($help_text, $person);
     }
     return null;
 }
Пример #13
0
function markup_comment($msg)
{
    global $prefs, $txpcfg;
    include_once txpath . '/lib/classTextile.php';
    $textile = new Textile();
    extract($prefs);
    $im = !empty($comments_disallow_images) ? 1 : '';
    $msg = $textile->TextileRestricted($msg, 1, $im);
    return $msg;
}