Пример #1
0
">Chunks</a>
						<?php 
        }
        ?>
					</div>	
					
					<!-- display record -->
					<div id="text_<?php 
        h($index);
        ?>
" style="max-height:150px;overflow-y:hidden;width:99%" ondblclick="expandText('<?php 
        h($index);
        ?>
');" class="record_row" record_id="<?php 
        if (isset($row["_id"])) {
            h(rock_id_string($row["_id"]));
        }
        ?>
" record_index="<?php 
        h($index);
        ?>
">
						
						<?php 
        h($row["data"]);
        ?>
					</div>
					
					<!-- switch to text so we can copy it easieer -->
					<div id="field_<?php 
        h($index);
Пример #2
0
    /**
     * Export var as string then highlight it.
     *
     * @param mixed $var variable to be exported
     * @param string $format data format, array|json
     * @param boolean $label if add label to field
     * @return string
     */
    protected function _highlight($var, $format = "array", $label = false)
    {
        import("classes.VarExportor");
        $exportor = new VarExportor($this->_mongo->selectDB("admin"), $var);
        $varString = $exportor->export($format, $label);
        $string = null;
        if ($format == "array") {
            $string = highlight_string("<?php " . $varString, true);
            $string = preg_replace("/" . preg_quote('<span style="color: #0000BB">&lt;?php&nbsp;</span>', "/") . "/", '', $string, 1);
        } else {
            $string = json_format_html($varString);
        }
        if ($label) {
            $id = addslashes(isset($var["_id"]) ? rock_id_string($var["_id"]) : "");
            $string = preg_replace_callback("/(['\"])rockfield\\.(.+)\\.rockfield(['\"])/U", create_function('$match', '	$fields = explode(".rockfield.", $match[2]);
					return "<span class=\\"field\\" field=\\"" . implode(".", $fields) . "\\">" . $match[1] . array_pop($fields) . $match[3] . "</span>";'), $string);
            $string = preg_replace_callback("/__rockmore\\.(.+)\\.rockmore__/U", create_function('$match', '
			$field = str_replace("rockfield.", "", $match[1]);
			return "<a href=\\"#\\" onclick=\\"fieldOpMore(\'" . $field . "\',\'' . $id . '\');return false;\\" title=\\"More text\\">[...]</a>";'), $string);
        }
        return $string;
    }
Пример #3
0
    /**
     * Export var as string then highlight it.
     *
     * @param mixed $var variable to be exported
     * @param string $format data format, array|json
     * @param boolean $label if add label to field
     * @return string
     */
    protected function _highlight($var, $format = "array", $label = false)
    {
        import("classes.VarExportor");
        $exportor = new VarExportor($this->_mongo->selectDB("admin"), $var);
        $varString = null;
        $highlight = true;
        $mixed = false;
        switch ($this->_server->docsRender()) {
            case "default":
                $varString = $exportor->export($format, $label);
                break;
            case "plain":
                $varString = $exportor->export($format, false);
                $label = false;
                $highlight = false;
                break;
            case "mixed":
                $varString = $exportor->export($format, false);
                if (strlen($varString) > $this->_server->docsRenderLimit()) {
                    $highlight = false;
                } else {
                    $highlight = true;
                }
                $label = false;
                $mixed = true;
                break;
            default:
                $varString = $exportor->export($format, $label);
                break;
        }
        $string = null;
        if ($highlight) {
            if ($format == "array") {
                $string = highlight_string("<?php " . $varString, true);
                $string = preg_replace("/" . preg_quote('<span style="color: #0000BB">&lt;?php&nbsp;</span>', "/") . "/", '', $string, 1);
            } else {
                $string = json_format_html($varString);
            }
        } else {
            $string = "<div><xmp style='width:600px;overflow:auto'>" . $varString . "</xmp></div>";
        }
        if ($label) {
            $id = addslashes(isset($var["_id"]) ? rock_id_string($var["_id"]) : "");
            $string = preg_replace_callback("/(['\"])rockfield\\.(.+)\\.rockfield(['\"])/U", create_function('$match', '	$fields = explode(".rockfield.", $match[2]);
					return "<span class=\\"field\\" field=\\"" . implode(".", $fields) . "\\">" . $match[1] . array_pop($fields) . $match[3] . "</span>";'), $string);
            $string = preg_replace_callback("/__rockmore\\.(.+)\\.rockmore__/U", create_function('$match', '
			$field = str_replace("rockfield.", "", $match[1]);
			return "<a href=\\"#\\" onclick=\\"fieldOpMore(\'" . $field . "\',\'' . $id . '\');return false;\\" title=\\"More text\\">[...]</a>";'), $string);
        }
        return $string;
    }