Welcome Guest, Not a member yet? Register   Sign In
Libraries Extending Question
#1

(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


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!
Reply


Messages In This Thread
Libraries Extending Question - by wolfgang1983 - 01-12-2017, 03:47 AM
RE: Libraries Extending Question - by ciadmin - 01-12-2017, 08:25 AM
RE: Libraries Extending Question - by skunkbad - 01-12-2017, 02:12 PM
RE: Libraries Extending Question - by ciadmin - 01-12-2017, 02:21 PM
RE: Libraries Extending Question - by skunkbad - 01-12-2017, 03:56 PM
RE: Libraries Extending Question - by skunkbad - 01-12-2017, 03:55 PM



Theme © iAndrew 2016 - Forum software by © MyBB