<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
> I'm going to look into getting PMA_mimeDefaultFunction() function inside<br>
> PMA_DisplayResults class. (currently it is under core.lib.php)<br>
> I think it is possible to use this function inside that class, and call<br>
> directly ($this->_mimeDefaultFunction()) instead of using additional string<br>
> to store method name. (current way)<br>
><br>
> Then the default function for the mime transformation is inside a class.<br>
> But the other existing transformations functions are still global functions.<br>
> If that is not good (feels not good), those also should convert to classes.<br>
<br>
</div>I've seen that the PMA_mimeDefaultFunction is only currently used in<br>
DisplayResults.class.php, so I think it's a good idea to move it there.<br>
<div class="im"><br>
> And if other transformations converted to classes, in which way I can create<br>
> objects of those classes.<br>
> Should I need to use string to store the class name and then use it as<br>
> belows.<br>
><br>
> $class_name = 'TestClass';<br>
> $ob = new $class_name($params);<br>
><br>
> It is very helpful for me if you can share your suggestions.<br>
<br>
</div>As general info, to use a transformation plugin, you have to include it and<br>
then instantiate it. For example, if you want to use Text_Plain_Sql:<br>
include_once 'libraries/plugins/transformations/Text_Plain_Sql.class.php';<br>
$plugin_manager = null; // Still working on this, so you can use null for now<br>
$sql_transf = new Text_Plain_Sql($plugin_manager);<br>
Then, you can use the actual transformation by calling:<br>
$sql_transf->applyTransformation();<br>
<br>
In DisplayResults.class.php, inside _getTableBody(), there is an init:<br>
[2158] $default_function = 'PMA_mimeDefaultFunction'; // default_function<br>
Then, this variable is passed as an argument to several functions along<br>
the way:<br>
_getDataCellForNumericColumns,<br>
_getDataCellForBlobColumns,<br>
_getDataCellForGeometryColumns,<br>
_getDataCellForNonNumericAndNonBlobColumns,<br>
_getRowData,<br>
_addClass<br>
_handleNonPrintableContents<br>
<br>
Some of the functions only pass it further, while others use actually use it.<br>
I replaced the use of the PMA_transformation_[FILENAME]() with the<br>
use of $transformation_plugin->applyTransformation() and kept the same<br>
arguments.<br>
So I had to pass an instance of the transformation class as an argument<br>
($transformation_plugin), but my problem was that in some cases I had to use<br>
the applyTransformations method, while in others, I had to use the default<br>
function ( PMA_mimeDefaultFunction() ). Therefore, where needed, I set the<br>
argument $transformation_plugin = $default_function, and, in the above<br>
mentioned methods I checked and used accordingly, something similar to:<br>
$result = ($transformation_plugin != $default_function<br>
? $transformation_plugin->applyTransformation(<br>
$data,<br>
$transform_options,<br>
$meta<br>
)<br>
: $default_function($data)<br>
)<br>
<br>
Hope that helps. I will write some wikis for all of the plugins, but I thought<br>
I should first finish the whole system (the plugin managers).<br></blockquote></div><br>Hi Alex,<br><br>Thanks for sharing your ideas on this.<br>These days I'm getting many conflicts due to modifying common.lib.php file.<br>
Same thing happens again after merging master.<br><br>Is there any possibility that you need to use default mime function outside the PMA_DisplayResults class ?<br><br>Regards !<br>-- <br>____________________________________<br>
<br>Chanaka Indrajith<br>Bsc.Computer Engineering Undergraduate<br>Faculty of Engineering<br>University of Peradeniya<br>Sri Lanka<br>____________________________________<br><br>