コード例 #1
0
    static function render_value($value, $unused, $preview)
    {
        if ($preview) {
            $filename = basename(self::render_png(modify::unquote($value)));
            return <<<EOT
\t  <a target="_blank" href="preview.php?filename={$filename}"><img class="cursor" src="preview.php?filename={$filename}"></a>
EOT;
        }
        return modify::nl2br($value);
    }
コード例 #2
0
 static function render_value($value, $unused, $unused2, $smarty)
 {
     if (!empty($smarty->field["INSECURE"])) {
         return modify::htmlfield(modify::unquote($value), false);
     }
     if (!empty($smarty->field["NO_CHECKS"])) {
         return modify::unquote($value);
     }
     return modify::htmlfield(modify::unquote($value));
 }
コード例 #3
0
    static function render_value($value, $value_raw, $preview, $unused)
    {
        if ($preview) {
            $id = uniqid();
            $value = modify::htmlfield(modify::unquote($value), true, true);
            $value_raw = modify::nl2br($value_raw);
            return <<<EOT
\t  <div class="wikibody">
\t\t<div id="html_{$id}" style="padding:8px;">{$value}</div>
\t\t<div id="data_{$id}" style="display:none; padding:8px;">{$value_raw}</div>
\t  </div>
\t  <input type="button" value="{t}Source code{/t} / HTML" onclick="showhide('data_{$id}'); showhide('html_{$id}');" style="margin-bottom:1px;">
EOT;
        }
        return modify::nl2br($value_raw);
    }
コード例 #4
0
 static function render_value($value)
 {
     return modify::htmlfield(modify::unquote($value));
 }
コード例 #5
0
 private static function _get_data($file)
 {
     if ($data = sys_cache_get("bookmarks_" . sha1($file))) {
         return $data;
     }
     if ($message = sys_allowedpath(dirname($file))) {
         sys_warning(sprintf("{t}Cannot read the file %s. %s{/t}", $file, $message));
         return array();
     }
     if (!($data = @file_get_contents($file))) {
         sys_warning("{t}The url doesn't exist.{/t} (" . $file . ")");
         return array();
     }
     preg_match_all("!(?:<h3.*?>(.*?)</h3>|<dd>(.*?)\n|<a href=\"(.*?)\".*?(?:add_date=\"(.*?)\".*?>|>)(.*?)</a>)!msi", $data, $matches);
     $category = "";
     $rows = array();
     if (is_array($matches) and count($matches) == 6) {
         for ($i = 0; $i < count($matches[0]); $i++) {
             $url = "";
             $name = "";
             $created = 0;
             $desc = "";
             if (!empty($matches[1][$i])) {
                 $category = modify::unquote($matches[1][$i]);
             }
             if (!empty($matches[2][$i + 1])) {
                 $desc = modify::unquote($matches[2][$i + 1]);
             }
             if (!empty($matches[3][$i])) {
                 $url = $matches[3][$i];
             }
             if (!empty($matches[4][$i])) {
                 $created = $matches[4][$i];
             }
             if (!empty($matches[5][$i])) {
                 $name = modify::unquote($matches[5][$i]);
             }
             if ($name != "" or $url != "") {
                 $rows[] = array("category" => $category, "bookmarkname" => $name, "description" => $desc, "url" => $url, "created" => $created);
             }
         }
     }
     sys_cache_set("bookmarks_" . sha1($file), $rows, BOOKMARKS_CACHE);
     return $rows;
 }