• sleeksorrow

    (@sleeksorrow)


    Hi there!

    I find it great that URLs in description and such are being trimmed. But I found that https urls don’t get trimmed, only http.

    So my proposal is to extend this feature to https, too.

    Here is my patch proposal as unified diff:

    --- functions.php.orig  2016-11-23 21:11:38.045831470 +0100
    +++ functions.php       2016-11-23 21:10:53.656502325 +0100
    @@ -320,8 +320,8 @@
     
                            $urlname = substr($link, $begin, $length);
     
    -                       $trimmed = (strlen($urlname) > 50 && preg_match('#^(https://|ftp://|www\.)#is', $urlname)) ? substr_replace($urlname, '.....', 30, -5) : $urlname;
    -                       $trimmed = str_replace('https://','',$trimmed);
    +                       $trimmed = (strlen($urlname) > 50 && preg_match('#^(https://|https://|ftp://|www\.)#is', $urlname)) ? substr_replace($urlname, '.....', 30, -5) : $urlname;
    +                       $trimmed = str_replace(array('https://','https://'),'',$trimmed);
     
                            $ret     = str_replace('>' . $urlname . '<', '>' . $trimmed . '<', $ret);
                    }
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author anmari

    (@anmari)

    hi just letting you know I have made a note of this. Thanks – I’m just flat out recently and will be traveling a bit.

    Thread Starter sleeksorrow

    (@sleeksorrow)

    Hope you’re fine again, just a little bump here ??

    Loosely related: Is there a possibility to activate/deactivate URL trimming in Shortcodes? The code does not look as if it is configurable. So this would be a wish from me ??

    • This reply was modified 7 years, 7 months ago by sleeksorrow.
    • This reply was modified 7 years, 7 months ago by sleeksorrow.
    Thread Starter sleeksorrow

    (@sleeksorrow)

    Saw you included the patch for the https URLs. Thank you! ??

    Let me know if I should open a new ticket for the “trim shortcode option” wish.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Proposal: Also trim https urls [patch]’ is closed to new replies.