$nextline = '$btn-primary-color'; $workingvariables = str_replace_one($nextline, "{$newrule}\n\n{$nextline}", $workingvariables); // Add a input-border rule matching input-border-color. $newrule = '$input-border-color: $input-border;'; $nextline = '$input-border-radius:'; $workingvariables = str_replace_one($nextline, "{$newrule}\n\n{$nextline}", $workingvariables); // Replace all 'input-height-base:' with 'input-height:'. $workingvariables = str_replace('input-height-base:', 'input-height:', $workingvariables); // Replace all '-default-' with '-light-'. $workingvariables = str_replace('navbar-default-', 'navbar-light-', $workingvariables); // Replace all '-inverse-' with '-dark-'. $workingvariables = str_replace('navbar-inverse-', 'navbar-dark-', $workingvariables); // Add a pagination-border-color rule matching pagination-border. $newrule = '$pagination-border-color: $pagination-border;'; $nextline = '$pagination-hover-color'; $workingvariables = str_replace_one($nextline, "{$newrule}\n\n{$nextline}", $workingvariables); // Replace all 'label-' with 'tag-'. $workingvariables = str_replace('label-', 'tag-', $workingvariables); // Replace all 'panel-' with 'card-'. $workingvariables = str_replace('panel-', 'card-', $workingvariables); fwrite($out, $workingvariables); fwrite($out, ' @import "moodle"; '); // Now replacements on the bootswatch. $workingbootswatch = $sourcebootswatch; $mixins = <<<EOD @mixin placeholder(\$text) { placeholder: \$text; }
function print_comments_content($display = true) { global $links_text, $link_number, $max_link_number, $matched_links; if (!isset($matched_links)) { $matched_links = array(); } $content = get_comment_text(); $content = apply_filters('comment_text', $content); if (!print_can('images')) { $content = remove_image($content); } if (!print_can('videos')) { $content = remove_video($content); } if (print_can('links')) { preg_match_all('/<a(.+?)href=[\\"\'](.+?)[\\"\'](.*?)>(.+?)<\\/a>/', $content, $matches); for ($i = 0; $i < count($matches[0]); $i++) { $link_match = $matches[0][$i]; $link_url = $matches[2][$i]; if (stristr($link_url, 'https://')) { $link_url = strtolower(substr($link_url, 0, 8)) != 'https://' ? get_option('home') . $link_url : $link_url; } else { if (stristr($link_url, 'mailto:')) { $link_url = strtolower(substr($link_url, 0, 7)) != 'mailto:' ? get_option('home') . $link_url : $link_url; } else { if ($link_url[0] == '#') { $link_url = $link_url; } else { $link_url = strtolower(substr($link_url, 0, 7)) != 'http://' ? get_option('home') . $link_url : $link_url; } } } $new_link = true; $link_url_hash = md5($link_url); if (!isset($matched_links[$link_url_hash])) { $link_number = ++$max_link_number; $matched_links[$link_url_hash] = $link_number; } else { $new_link = false; $link_number = $matched_links[$link_url_hash]; } $content = str_replace_one($link_match, "<a href=\"{$link_url}\" rel=\"external\">" . $link_text . '</a> <sup>[' . number_format_i18n($link_number) . ']</sup>', $content); if ($new_link) { if (preg_match('/<img(.+?)src=[\\"\'](.+?)[\\"\'](.*?)>/', $link_text)) { $links_text .= '<p style="margin: 2px 0;">[' . number_format_i18n($link_number) . '] ' . __('Image', 'wp-print') . ': <b><span dir="ltr">' . $link_url . '</span></b></p>'; } else { $links_text .= '<p style="margin: 2px 0;">[' . number_format_i18n($link_number) . '] ' . $link_text . ': <b><span dir="ltr">' . $link_url . '</span></b></p>'; } } } } if ($display) { echo $content; } else { return $content; } }
function print_comments_content($display = true) { global $links_text, $link_number; $content = get_comment_text(); $content = apply_filters('comment_text', $content); if (!print_can('images')) { $content = remove_image($content); } if (print_can('links')) { preg_match_all('/<a(.+?)href=\\"(.+?)\\"(.*?)>(.+?)<\\/a>/', $content, $matches); for ($i = 0; $i < count($matches[0]); $i++) { $link_match = $matches[0][$i]; $link_number++; $link_url = $matches[2][$i]; if (stristr($link_url, 'https://')) { $link_url = strtolower(substr($link_url, 0, 8)) != 'https://' ? get_option('home') . $link_url : $link_url; } else { if (stristr($link_url, 'mailto:')) { $link_url = strtolower(substr($link_url, 0, 7)) != 'mailto:' ? get_option('home') . $link_url : $link_url; } else { if ($link_url[0] == '#') { $link_url = $link_url; } else { $link_url = strtolower(substr($link_url, 0, 7)) != 'http://' ? get_option('home') . $link_url : $link_url; } } } $link_text = $matches[4][$i]; $content = str_replace_one($link_match, '[' . $link_number . "] <a href=\"{$link_url}\" rel=\"external\">" . $link_text . '</a>', $content); if (strlen($link_url) > 100) { $link_url = chunk_split($link_url, 100, "<br />\n"); } if (preg_match('/<img(.+?)src=\\"(.+?)\\"(.*?)>/', $link_text)) { $links_text .= '<br />[' . $link_number . '] ' . __('Image', 'wp-print') . ': <b>' . $link_url . '</b>'; } else { $links_text .= '<br />[' . $link_number . '] ' . $link_text . ': <b>' . $link_url . '</b>'; } } } if ($display) { echo $content; } else { return $content; } }