|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- <?php
-
- class freaParsedown extends ParsedownExtra {
-
- function get_BlockTypes() {
-
- return $this->BlockTypes;
-
- }
-
- function deactivate_ol() {
- $ol_triggers= array(
- "0",
- "1",
- "2",
- "3",
- "4",
- "5",
- "6",
- "7",
- "8",
- "9"
- );
-
- foreach ($ol_triggers as $key) {
- unset($this->BlockTypes[$key]);
- }
- }
-
-
- function add_language_to_link_target($href) {
- $f3 = \Base::instance();
- $data = [];
- $base = substr($href,0,strpos($href,'?') ? : strlen($href));
- parse_str(parse_url($href,PHP_URL_QUERY),$data);
- $fragment = parse_url($href,PHP_URL_FRAGMENT);
-
- if ($f3->get('LANG') != $f3->get('default_lang')) {
- if (!array_key_exists('lang',$data)) {
- $data['lang'] = $f3->get('LANG');
- }
- }
-
- $new = $base;
- if (count($data) > 0) {
- $new .= "?" . http_build_query($data);
- }
- if ($fragment) {
- $new .= "#" . $fragment;
- }
-
- return $new;
- }
-
-
- protected function inlineEmailTag($Excerpt)
- {
- $Link = parent::inlineEmailTag($Excerpt);
-
- if (isset($Link)) {
- $Link['element']['attributes'] += ['data-link-text' => $Link['element']['text']];
- }
- return $Link;
- }
-
-
- protected function inlineLink($Excerpt)
- {
- $Link = parent::inlineLink($Excerpt);
-
- if (isset($Link)) {
- $Link['element']['attributes'] += ['data-link-text' => $Link['element']['text']];
- $url=&$Link['element']['attributes']['href'];
- if (strpos($url,':') === FALSE) {
- $url = $this->add_language_to_link_target($url);
- }
- $Link['extent'] = $Link['extent'];
- }
- return $Link;
- }
-
-
-
- protected function inlineUrl($Excerpt)
- {
- $Link = parent::inlineUrl($Excerpt);
-
- if (isset($Link)) {
- $Link['element']['attributes'] += ['data-link-text' => $Link['element']['text']];
- }
- return $Link;
- }
-
- protected function inlineUrlTag($Excerpt)
- {
- $Link = parent::inlineUrlTag($Excerpt);
-
- if (isset($Link)) {
- $Link['element']['attributes'] += ['data-link-text' => $Link['element']['text']];
- }
- return $Link;
- }
- }
|