2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * Text Plain JSON Transformations plugin for phpMyAdmin
6 * @package PhpMyAdmin-Transformations
9 if (! defined('PHPMYADMIN')) {
13 /* Get the transformations interface */
14 require_once 'libraries/plugins/TransformationsPlugin.class.php';
17 * Handles the json transformation for text plain
19 * @package PhpMyAdmin-Transformations
22 class Text_Plain_Json
extends TransformationsPlugin
24 public function __construct()
26 $response = PMA_Response
::getInstance();
27 $scripts = $response->getHeader()->getScripts();
28 $scripts->addFile('codemirror/mode/javascript/javascript.js');
29 $scripts->addFile('transformations/json.js');
33 * Gets the transformation description of the specific plugin
37 public static function getInfo()
40 'Formats text as JSON with syntax highlighting.'
45 * Does the actual work of each specific transformations plugin.
47 * @param string $buffer text to be transformed
48 * @param array $options transformation options
49 * @param string $meta meta information
53 public function applyTransformation($buffer, $options = array(), $meta = '')
55 return '<code class="json"><pre>' . "\n"
56 . htmlspecialchars($buffer) . "\n"
60 /* ~~~~~~~~~~~~~~~~~~~~ Getters and Setters ~~~~~~~~~~~~~~~~~~~~ */
63 * Gets the plugin`s MIME type
67 public static function getMIMEType()
73 * Gets the plugin`s MIME subtype
77 public static function getMIMESubtype()
83 * Gets the transformation name of the specific plugin
87 public static function getName()