Jump to content

Search the Community

Showing results for tags 'targetblank'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to ProcessWire
    • News & Announcements
    • Showcase
    • Wishlist & Roadmap
  • Community Support
    • Getting Started
    • Tutorials
    • FAQs
    • General Support
    • API & Templates
    • Modules/Plugins
    • Themes and Profiles
    • Multi-Language Support
    • Security
    • Jobs
  • Off Topic
    • Pub
    • Dev Talk

Product Groups

  • Form Builder
  • ProFields
  • ProCache
  • ProMailer
  • Login Register Pro
  • ProDrafts
  • ListerPro
  • ProDevTools
  • Likes
  • Custom Development

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

Found 1 result

  1. While looking for a way to add target="_blank" to markdown formatted fields I came across these little gems in the TextformatterMarkdownExtra.module (in the wire>modules>textformatter folder, I'm running v3.0.33). Turns out someone (Ryan? Did you add this?) already thought of it: /** * A couple RCD extentions to MarkDown syntax, to be executed after Markdown has already had it's way with the text */ protected function markdownExtensions(&$str) { // add id attribute to a tag, when followed by a #myid if(strpos($str, '>#')) $str = preg_replace('/<([a-z][a-z0-9]*)([^>]*>.*?)(<\/\\1>)#([a-z][-_a-z0-9]*)\b/', '<$1 id="$4"$2$3', $str); // add class attribute to tag when followed by a .myclass if(strpos($str, '>.')) $str = preg_replace('/<([a-z][a-z0-9]*)([^>]*>.*?)(<\/\\1>)\.([a-z][-_a-z0-9]*)\b/', '<$1 class="$4"$2$3', $str); // href links open in new window when followed by a plus sign, i.e. [google](http://google.com)+ if(strpos($str, '</a>+')) $str = preg_replace('/<a ([^>]+>.+?<\/a>)\+/', '<a target="_blank" $1', $str); // strip out comments // if(strpos($text, '/*') !== false) $text = preg_replace('{/\*.*?\*/}s', '', $text); // if(strpos($text, '//') !== false) $text = preg_replace('{^//.*$}m', '', $text); } Adding: $f->addOption(self::flavorRCD, 'RCD extentions'); after line 107 of the file, adds an option field which you can handily check from the module's config screen in the admin. Now, the question I should have asked before doing this is: Does changing that have any detrimental effect on things I don't know about yet? : ) Would be great if someone with actual knowledge on this could chime in before I shoot myself in the foot (There must be a reason why this is not active by default?) Cheers guys! Phil
×
×
  • Create New...