{L_SHARE} |


WP Js External Link Info Options

 


Redirect File: (empty for default)
new Browserwindow: checked="checked" />don't force new window







]*\s*href\s*=[^>]*)>#i', 'js_external_link_info_replace', $str);
}

function js_external_link_info_comment($str, $arg = 1) {
if (!isset($str)) return $str;
if (!$arg) return $str;
return preg_replace_callback('#]*\s*href\s*=[^>]*)>#i', 'js_external_link_info_replace', $str);
}

function js_external_link_check_local($href, $blogurl) {
$schemes = array('http','ftp');
$isext = false;
foreach($schemes as $scheme) {
if (stripos($href, $scheme) !== false) { $isext = true; }
/* var $href mit href prefix, zB.: href="http://wordpress.org/extend/plugins/wp-js-external-link-info/" */
}
if ($isext) {
$local = strpos($href, $blogurl);
} else {
$local = true;
}
return $local;
}

function js_external_link_info_replace($matches) {
$blogurl = get_bloginfo('home') . '/';
if (get_option('redirect_file') != "") { $redirect_file = $blogurl . get_option('redirect_file'); }
else { $redirect_file = WP_PLUGIN_URL . '/' . WP_JS_BASEDIR . '/redirect.php'; }
$str = $matches[1];
preg_match_all('/[^=[:space:]]*\s*=\s*"[^"]*"|[^=[:space:]]*\s*=\s*\'[^\']*\'|[^=[:space:]]*\s*=[^[:space:]]*/', $str, $attr);
$href_arr = preg_grep('/^href\s*=/i', $attr[0]);
if (count($href_arr) > 0) {
$href = array_pop($href_arr);
if ($href) {
$local = js_external_link_check_local($href, $blogurl);
if ((get_option('redirect_notblank') != 'true') && ($local === false) && ($href{6} != "#")) {
$blank = 'target="_blank"';
}
} else {
$local = TRUE;
}

if (($local === false) && ($href{6} != "#")) {
$href = str_replace('?','%3F',$href);
$href = str_replace('&','%26',$href);
$href = preg_replace('/^(href\s*=\s*[\'"]?)/i', '\1' . $redirect_file . '?blog=' . WP_JS_BLOGNAME . '&url=', $href);
}
$attr = preg_grep('/^href\s*=/i', $attr[0], PREG_GREP_INVERT);
}
return '';
}

function js_external_link_info_links($link) { // author link changer
$blogurl = get_bloginfo('home').'/';
if (get_option('redirect_file') != "") { $redirect_file = $blogurl . get_option('redirect_file'); }
else { $redirect_file = WP_PLUGIN_URL . '/' . WP_JS_BASEDIR . '/redirect.php'; }
$local = js_external_link_check_local($link, $blogurl);
if ($local === false) {
if ((get_option('redirect_notblank') != 'true') && ($local === false) && ($href{6} != "#")) {
$blank = 'target="_blank"';
}
}
$link = preg_replace("#(.*href\s*=\s*)[\"\']*(.*)[\"\'] (.*)#i", "

0 التعليقات

إرسال تعليق

المواضيع الاكثر قراءة

Subscribe here