01-12-2017, 03:47 AM
(This post was last modified: 01-12-2017, 04:20 AM by wolfgang1983.)
I have a Parsedown.php file in my libraries folder
application > libraries > Parsedown.php
And I want to extend it
application > libraries > MY_Parsedown.php
I tried require but did not make the new changes. How can I extend a library from with in application library and not system libraries.
How can I extend the parsedown into MY_Parsedown.php
application > libraries > Parsedown.php
PHP Code:
class Parsedown
{
....
}
And I want to extend it
application > libraries > MY_Parsedown.php
I tried require but did not make the new changes. How can I extend a library from with in application library and not system libraries.
How can I extend the parsedown into MY_Parsedown.php
PHP Code:
<?php
require APPPATH . 'libraries/Parsedown.php';
class MY_Parsedown extends Parsedown {
protected function inlineImage($Excerpt)
{
$Inline = parent::inlineImage($Excerpt);
if (!isset($Inline['element']['attributes']['title'])) { return $Inline; }
$size = $Inline['element']['attributes']['title'];
if (preg_match('/^\d+x\d+$/', $size)) {
list($width, $height) = explode('x', $size);
$Inline['element']['attributes']['width'] = $width;
$Inline['element']['attributes']['height'] = $height;
unset ($Inline['element']['attributes']['title']);
}
return $Inline;
}
}
There's only one rule - please don't tell anyone to go and read the manual. Sometimes the manual just SUCKS!