Permalink
Browse files

oop: transformations - fix classes, add interface and use descriptions

  • Loading branch information...
1 parent 507be98 commit 1ad049d8239853516d7c007e98a2fee09ac9115c @alexukf alexukf committed Jun 19, 2012
Showing with 176 additions and 163 deletions.
  1. +48 −0 libraries/plugins/TransformationsInterface.int.php
  2. +6 −35 libraries/plugins/TransformationsPlugin.class.php
  3. +4 −5 libraries/plugins/transformations/Application_Octetstream_Download.class.php
  4. +4 −4 libraries/plugins/transformations/Application_Octetstream_Hex.class.php
  5. +4 −4 libraries/plugins/transformations/Image_JPEG_Inline.class.php
  6. +4 −4 libraries/plugins/transformations/Image_JPEG_Link.class.php
  7. +4 −4 libraries/plugins/transformations/Image_PNG_Inline.class.php
  8. +4 −4 libraries/plugins/transformations/Text_Plain_Append.class.php
  9. +4 −4 libraries/plugins/transformations/Text_Plain_Dateformat.class.php
  10. +4 −4 libraries/plugins/transformations/Text_Plain_External.class.php
  11. +4 −4 libraries/plugins/transformations/Text_Plain_Formatted.class.php
  12. +4 −4 libraries/plugins/transformations/Text_Plain_Imagelink.class.php
  13. +4 −4 libraries/plugins/transformations/Text_Plain_Link.class.php
  14. +4 −4 libraries/plugins/transformations/Text_Plain_Longtoipv4.class.php
  15. +4 −4 libraries/plugins/transformations/Text_Plain_Sql.class.php
  16. +4 −4 libraries/plugins/transformations/Text_Plain_Substring.class.php
  17. +2 −2 libraries/plugins/transformations/abstract/AppendTransformationsPlugin.class.php
  18. +2 −2 libraries/plugins/transformations/abstract/DateFormatTransformationsPlugin.class.php
  19. +2 −2 libraries/plugins/transformations/abstract/DownloadTransformationsPlugin.class.php
  20. +2 −2 libraries/plugins/transformations/abstract/ExternalTransformationsPlugin.class.php
  21. +2 −2 libraries/plugins/transformations/abstract/FormattedTransformationsPlugin.class.php
  22. +2 −2 ...formations/abstract/{HexTransformationsPlugin.class.php.php → HexTransformationsPlugin.class.php}
  23. +2 −2 libraries/plugins/transformations/abstract/ImageLinkTransformationsPlugin.class.php
  24. +2 −2 ...ions/abstract/{InlineTransformationsPlugin.class.php.php → InlineTransformationsPlugin.class.php}
  25. +2 −2 libraries/plugins/transformations/abstract/LinkTransformationsPlugin.class.php
  26. +2 −2 libraries/plugins/transformations/abstract/LongToIPv4TransformationsPlugin.class.php
  27. +2 −2 libraries/plugins/transformations/abstract/SQLTransformationsPlugin.class.php
  28. +2 −2 libraries/plugins/transformations/abstract/SubstringTransformationsPlugin.class.php
  29. +42 −42 libraries/transformations.lib.php
  30. +0 −5 transformation_overview.php
@@ -0,0 +1,48 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Abstract class for the transformations plugins
+ *
+ * @package PhpMyAdmin
+ */
+if (! defined('PHPMYADMIN')) {
+ exit;
+}
+
+/**
+ * Provides a common interface that will have to implemented by all of the
+ * transformations plugins.
+ *
+ * @package PhpMyAdmin
+ */
+interface TransformationsInterface {
+ /**
+ * Gets the transformation description
+ *
+ * @return string
+ */
+ public static function getInfo();
+
+ /**
+ * Gets the specific MIME type
+ *
+ * @return string
+ */
+ public static function getMIMEType();
+
+ /**
+ * Gets the specific MIME subtype
+ *
+ * @return string
+ */
+ public static function getMIMESubtype();
+
+ /**
+ * Gets the transformation name of the specific plugin
+ *
+ * @return string
+ */
+ public static function getName();
+}
+
+?>
@@ -9,16 +9,19 @@
exit;
}
-/* This class extends the PluginObserver class */
+/* It extends the PluginObserver abstract class */
require_once "PluginObserver.class.php";
+/* It also implements the transformations interface */
+require_once "TransformationsInterface.int.php";
/**
- * Provides a common interface that will have to implemented by all of the
- * transformations plugins.
+ * Extends PluginObserver and provides a common interface that will have to
+ * be implemented by all of the transformations plugins.
*
* @package PhpMyAdmin
*/
abstract class TransformationsPlugin extends PluginObserver
+ implements TransformationsInterface
{
/**
* Does the actual work of each specific transformations plugin.
@@ -30,37 +33,5 @@
* @return void
*/
abstract public function applyTransformation($buffer, $options, $meta);
-
-
- /* ~~~~~~~~~~~~~~~~~~~~ Getters and Setters ~~~~~~~~~~~~~~~~~~~~ */
-
-
- /**
- * Gets the transformation description
- *
- * @return string
- */
- abstract public function getInfo();
-
- /**
- * Gets the specific MIME type
- *
- * @return string
- */
- abstract public function getMIMEType();
-
- /**
- * Gets the specific MIME subtype
- *
- * @return string
- */
- abstract public function getMIMESubtype();
-
- /**
- * Gets the transformation name of the specific plugin
- *
- * @return string
- */
- abstract public function getName();
}
?>
@@ -9,9 +9,8 @@
if (! defined('PHPMYADMIN')) {
exit;
}
-
/* Get the download transformations interface */
-require_once "libraries/plugins/abstract/DownloadTransformationsPlugin.class.php";
+require_once "abstract/DownloadTransformationsPlugin.class.php";
/**
* Handles the download transformation for application octetstream
@@ -25,7 +24,7 @@ class Application_Octetstream_Download extends DownloadTransformationsPlugin
*
* @return string
*/
- public function getInfo()
+ public static function getInfo()
{
return __(
'Displays a link to download the binary data of the column. You can'
@@ -41,7 +40,7 @@ public function getInfo()
*
* @return string
*/
- public function getMIMEType()
+ public static function getMIMEType()
{
return "Application";
}
@@ -51,7 +50,7 @@ public function getMIMEType()
*
* @return string
*/
- public function getMIMESubtype()
+ public static function getMIMESubtype()
{
return "OctetStream";
}
@@ -11,7 +11,7 @@
}
/* Get the hex transformations interface */
-require_once "libraries/plugins/abstract/HexTransformationsPlugin.class.php";
+require_once "abstract/HexTransformationsPlugin.class.php";
/**
* Handles the hex transformation for application octetstream
@@ -25,7 +25,7 @@ class Application_Octetstream_Hex extends HexTransformationsPlugin
*
* @return string
*/
- public function getInfo()
+ public static function getInfo()
{
return __(
'Displays hexadecimal representation of data. Optional first'
@@ -39,7 +39,7 @@ public function getInfo()
*
* @return string
*/
- public function getMIMEType()
+ public static function getMIMEType()
{
return "Application";
}
@@ -49,7 +49,7 @@ public function getMIMEType()
*
* @return string
*/
- public function getMIMESubtype()
+ public static function getMIMESubtype()
{
return "OctetStream";
}
@@ -11,7 +11,7 @@
}
/* Get the inline transformations interface */
-require_once "libraries/plugins/abstract/InlineTransformationsPlugin.class.php";
+require_once "abstract/InlineTransformationsPlugin.class.php";
/**
* Handles the inline transformation for image jpeg
@@ -25,7 +25,7 @@ class Image_JPEG_Inline extends InlineTransformationsPlugin
*
* @return string
*/
- public function getInfo()
+ public static function getInfo()
{
return __(
'Displays a clickable thumbnail. The options are the maximum width'
@@ -38,7 +38,7 @@ public function getInfo()
*
* @return string
*/
- public function getMIMEType()
+ public static function getMIMEType()
{
return "Image";
}
@@ -48,7 +48,7 @@ public function getMIMEType()
*
* @return string
*/
- public function getMIMESubtype()
+ public static function getMIMESubtype()
{
return "JPEG";
}
@@ -11,7 +11,7 @@
}
/* Get the link transformations interface */
-require_once "libraries/plugins/abstract/LinkTransformationsPlugin.class.php";
+require_once "abstract/LinkTransformationsPlugin.class.php";
/**
* Handles the link transformation for image jpeg
@@ -25,7 +25,7 @@ class Image_JPEG_Link extends LinkTransformationsPlugin
*
* @return string
*/
- public function getInfo()
+ public static function getInfo()
{
return __(
'Displays a link to download this image.'
@@ -37,7 +37,7 @@ public function getInfo()
*
* @return string
*/
- public function getMIMEType()
+ public static function getMIMEType()
{
return "Image";
}
@@ -47,7 +47,7 @@ public function getMIMEType()
*
* @return string
*/
- public function getMIMESubtype()
+ public static function getMIMESubtype()
{
return "JPEG";
}
@@ -11,7 +11,7 @@
}
/* Get the inline transformations interface */
-require_once "libraries/plugins/abstract/InlineTransformationsPlugin.class.php";
+require_once "abstract/InlineTransformationsPlugin.class.php";
/**
* Handles the inline transformation for image png
@@ -25,7 +25,7 @@ class Image_PNG_Inline extends InlineTransformationsPlugin
*
* @return string
*/
- public function getInfo()
+ public static function getInfo()
{
return __(
'Displays a clickable thumbnail. The options are the maximum width'
@@ -38,7 +38,7 @@ public function getInfo()
*
* @return string
*/
- public function getMIMEType()
+ public static function getMIMEType()
{
return "Image";
}
@@ -48,7 +48,7 @@ public function getMIMEType()
*
* @return string
*/
- public function getMIMESubtype()
+ public static function getMIMESubtype()
{
return "PNG";
}
@@ -11,7 +11,7 @@
}
/* Get the append transformations interface */
-require_once "libraries/plugins/abstract/AppendTransformationsPlugin.class.php";
+require_once "abstract/AppendTransformationsPlugin.class.php";
/**
* Handles the append transformation for text plain.
@@ -26,7 +26,7 @@ class Text_Plain_Append extends AppendTransformationsPlugin
*
* @return string
*/
- public function getInfo()
+ public static function getInfo()
{
return __(
'Appends text to a string. The only option is the text to be appended'
@@ -39,7 +39,7 @@ public function getInfo()
*
* @return string
*/
- public function getMIMEType()
+ public static function getMIMEType()
{
return "Text";
}
@@ -49,7 +49,7 @@ public function getMIMEType()
*
* @return string
*/
- public function getMIMESubtype()
+ public static function getMIMESubtype()
{
return "Plain";
}
@@ -11,7 +11,7 @@
}
/* Get the date format transformations interface */
-require_once "libraries/plugins/abstract/DateFormatTransformationsPlugin.class.php";
+require_once "abstract/DateFormatTransformationsPlugin.class.php";
/**
* Handles the date format transformation for text plain
@@ -25,7 +25,7 @@ class Text_Plain_Dateformat extends DateFormatTransformationsPlugin
*
* @return string
*/
- public function getInfo()
+ public static function getInfo()
{
return __(
'Displays a TIME, TIMESTAMP, DATETIME or numeric unix timestamp'
@@ -45,7 +45,7 @@ public function getInfo()
*
* @return string
*/
- public function getMIMEType()
+ public static function getMIMEType()
{
return "Text";
}
@@ -55,7 +55,7 @@ public function getMIMEType()
*
* @return string
*/
- public function getMIMESubtype()
+ public static function getMIMESubtype()
{
return "Plain";
}
Oops, something went wrong.

0 comments on commit 1ad049d

Please sign in to comment.