UPDATE 4.4.0.0
[phpmyadmin.git] / libraries / plugins / transformations / output / Text_Plain_Json.class.php
blob52c0214a37c1d55fdde311ce3d37aedb72220da1
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Text Plain JSON Transformations plugin for phpMyAdmin
6 * @package PhpMyAdmin-Transformations
7 * @subpackage SQL
8 */
9 if (! defined('PHPMYADMIN')) {
10 exit;
13 /* Get the transformations interface */
14 require_once 'libraries/plugins/TransformationsPlugin.class.php';
16 /**
17 * Handles the json transformation for text plain
19 * @package PhpMyAdmin-Transformations
20 * @subpackage JSON
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');
32 /**
33 * Gets the transformation description of the specific plugin
35 * @return string
37 public static function getInfo()
39 return __(
40 'Formats text as JSON with syntax highlighting.'
44 /**
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
51 * @return string
53 public function applyTransformation($buffer, $options = array(), $meta = '')
55 return '<code class="json"><pre>' . "\n"
56 . htmlspecialchars($buffer) . "\n"
57 . '</pre></code>';
60 /* ~~~~~~~~~~~~~~~~~~~~ Getters and Setters ~~~~~~~~~~~~~~~~~~~~ */
62 /**
63 * Gets the plugin`s MIME type
65 * @return string
67 public static function getMIMEType()
69 return "Text";
72 /**
73 * Gets the plugin`s MIME subtype
75 * @return string
77 public static function getMIMESubtype()
79 return "Plain";
82 /**
83 * Gets the transformation name of the specific plugin
85 * @return string
87 public static function getName()
89 return "JSON";