move all the zid related stuff to one file
This commit is contained in:
@@ -837,14 +837,6 @@ function tag_sort_length($a,$b) {
|
||||
|
||||
|
||||
|
||||
function strip_zids($s) {
|
||||
return preg_replace('/[\?&]zid=(.*?)(&|$)/ism','$2',$s);
|
||||
}
|
||||
|
||||
function strip_zats($s) {
|
||||
return preg_replace('/[\?&]zat=(.*?)(&|$)/ism','$2',$s);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Quick and dirty quoted_printable encoding.
|
||||
*
|
||||
@@ -1700,73 +1692,6 @@ function create_export_photo_body(&$item) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* zidify_callback() and zidify_links() work together to turn any HTML a tags with class="zrl" into zid links
|
||||
* These will typically be generated by a bbcode '[zrl]' tag. This is done inside prepare_text() rather than bbcode()
|
||||
* because the latter is used for general purpose conversions and the former is used only when preparing text for
|
||||
* immediate display.
|
||||
*
|
||||
* Issues: Currently the order of HTML parameters in the text is somewhat rigid and inflexible.
|
||||
* We assume it looks like \<a class="zrl" href="xxxxxxxxxx"\> and will not work if zrl and href appear in a different order.
|
||||
*
|
||||
* @param array $match
|
||||
* @return string
|
||||
*/
|
||||
function zidify_callback($match) {
|
||||
$is_zid = ((feature_enabled(local_channel(),'sendzid')) || (strpos($match[1],'zrl')) ? true : false);
|
||||
$replace = '<a' . $match[1] . ' href="' . (($is_zid) ? zid($match[2]) : $match[2]) . '"';
|
||||
$x = str_replace($match[0],$replace,$match[0]);
|
||||
|
||||
return $x;
|
||||
}
|
||||
|
||||
function zidify_img_callback($match) {
|
||||
$is_zid = ((feature_enabled(local_channel(),'sendzid')) || (strpos($match[1],'zrl')) ? true : false);
|
||||
$replace = '<img' . $match[1] . ' src="' . (($is_zid) ? zid($match[2]) : $match[2]) . '"';
|
||||
|
||||
$x = str_replace($match[0],$replace,$match[0]);
|
||||
|
||||
return $x;
|
||||
}
|
||||
|
||||
|
||||
function zidify_links($s) {
|
||||
$s = preg_replace_callback('/\<a(.*?)href\=\"(.*?)\"/ism','zidify_callback',$s);
|
||||
$s = preg_replace_callback('/\<img(.*?)src\=\"(.*?)\"/ism','zidify_img_callback',$s);
|
||||
|
||||
return $s;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function zidify_text_callback($match) {
|
||||
$is_zid = is_matrix_url($match[2]);
|
||||
$replace = '<a' . $match[1] . ' href="' . (($is_zid) ? zid($match[2]) : $match[2]) . '"';
|
||||
$x = str_replace($match[0],$replace,$match[0]);
|
||||
|
||||
return $x;
|
||||
}
|
||||
|
||||
function zidify_text_img_callback($match) {
|
||||
$is_zid = is_matrix_url($match[2]);
|
||||
$replace = '<img' . $match[1] . ' src="' . (($is_zid) ? zid($match[2]) : $match[2]) . '"';
|
||||
|
||||
$x = str_replace($match[0],$replace,$match[0]);
|
||||
|
||||
return $x;
|
||||
}
|
||||
|
||||
function zidify_text($s) {
|
||||
|
||||
$s = preg_replace_callback('/\<a(.*?)href\=\"(.*?)\"/ism','zidify_text_callback',$s);
|
||||
$s = preg_replace_callback('/\<img(.*?)src\=\"(.*?)\"/ism','zidify_text_img_callback',$s);
|
||||
|
||||
return $s;
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return atom link elements for all of our hubs.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user