Removed useless "function_exists" checks
This commit is contained in:
		
					parent
					
						
							
								8b4c4572d3
							
						
					
				
			
			
				commit
				
					
						88ef61df95
					
				
			
		
					 6 changed files with 13 additions and 107 deletions
				
			
		| 
						 | 
				
			
			@ -376,7 +376,6 @@ function bb_tag_preg_replace($pattern, $replace, $name, $s) {
 | 
			
		|||
	return $string;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
if (! function_exists('bb_extract_images')) {
 | 
			
		||||
function bb_extract_images($body) {
 | 
			
		||||
 | 
			
		||||
	$saved_image = array();
 | 
			
		||||
| 
						 | 
				
			
			@ -418,9 +417,8 @@ function bb_extract_images($body) {
 | 
			
		|||
	$new_body = $new_body . $orig_body;
 | 
			
		||||
 | 
			
		||||
	return array('body' => $new_body, 'images' => $saved_image);
 | 
			
		||||
}}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
if (! function_exists('bb_replace_images')) {
 | 
			
		||||
function bb_replace_images($body, $images) {
 | 
			
		||||
 | 
			
		||||
	$newbody = $body;
 | 
			
		||||
| 
						 | 
				
			
			@ -435,7 +433,7 @@ function bb_replace_images($body, $images) {
 | 
			
		|||
	}
 | 
			
		||||
 | 
			
		||||
	return $newbody;
 | 
			
		||||
}}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function bb_ShareAttributes($share, $simplehtml) {
 | 
			
		||||
	$attributes = $share[2];
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -15,12 +15,6 @@ use Friendica\Object\Post;
 | 
			
		|||
require_once "include/bbcode.php";
 | 
			
		||||
require_once "include/acl_selectors.php";
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Note: the code in 'item_extract_images' and 'item_redir_and_replace_images'
 | 
			
		||||
 * is identical to the code in mod/message.php for 'item_extract_images' and
 | 
			
		||||
 * 'item_redir_and_replace_images'
 | 
			
		||||
 */
 | 
			
		||||
if (! function_exists('item_extract_images')) {
 | 
			
		||||
function item_extract_images($body) {
 | 
			
		||||
 | 
			
		||||
	$saved_image = array();
 | 
			
		||||
| 
						 | 
				
			
			@ -62,9 +56,8 @@ function item_extract_images($body) {
 | 
			
		|||
	$new_body = $new_body . $orig_body;
 | 
			
		||||
 | 
			
		||||
	return array('body' => $new_body, 'images' => $saved_image);
 | 
			
		||||
}}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
if (! function_exists('item_redir_and_replace_images')) {
 | 
			
		||||
function item_redir_and_replace_images($body, $images, $cid) {
 | 
			
		||||
 | 
			
		||||
	$origbody = $body;
 | 
			
		||||
| 
						 | 
				
			
			@ -104,7 +97,7 @@ function item_redir_and_replace_images($body, $images, $cid) {
 | 
			
		|||
		$cnt++;
 | 
			
		||||
	}
 | 
			
		||||
	return $newbody;
 | 
			
		||||
}}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Render actions localized
 | 
			
		||||
| 
						 | 
				
			
			@ -486,7 +479,6 @@ function item_condition() {
 | 
			
		|||
	return "`item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated`";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
if (!function_exists('conversation')) {
 | 
			
		||||
/**
 | 
			
		||||
 * "Render" a conversation or list of items for HTML display.
 | 
			
		||||
 * There are two major forms of display:
 | 
			
		||||
| 
						 | 
				
			
			@ -906,7 +898,7 @@ function conversation(App $a, $items, $mode, $update, $preview = false) {
 | 
			
		|||
	));
 | 
			
		||||
 | 
			
		||||
	return $o;
 | 
			
		||||
}}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function best_link_url($item, &$sparkle, $url = '') {
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1036,7 +1028,6 @@ function item_photo_menu($item) {
 | 
			
		|||
	return $o;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
if (! function_exists('builtin_activity_puller')) {
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Checks item to see if it is one of the builtin activities (like/dislike, event attendance, consensus items, etc.)
 | 
			
		||||
 * Increments the count of each matching activity and adds a link to the author as needed.
 | 
			
		||||
| 
						 | 
				
			
			@ -1112,9 +1103,8 @@ function builtin_activity_puller($item, &$conv_responses) {
 | 
			
		|||
			return;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
if (! function_exists('format_like')) {
 | 
			
		||||
/**
 | 
			
		||||
 * Format the vote text for a profile item
 | 
			
		||||
 * @param int $cnt = number of people who vote the item
 | 
			
		||||
| 
						 | 
				
			
			@ -1205,7 +1195,7 @@ function format_like($cnt, array $arr, $type, $id) {
 | 
			
		|||
	$o .= $expanded;
 | 
			
		||||
 | 
			
		||||
	return $o;
 | 
			
		||||
}}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function status_editor(App $a, $x, $notes_cid = 0, $popup = false) {
 | 
			
		||||
	$o = '';
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -42,7 +42,6 @@ function construct_verb($item) {
 | 
			
		|||
 *		The purpose of this function is to apply system message length limits to
 | 
			
		||||
 *		imported messages without including any embedded photos in the length
 | 
			
		||||
 */
 | 
			
		||||
if (! function_exists('limit_body_size')) {
 | 
			
		||||
function limit_body_size($body) {
 | 
			
		||||
 | 
			
		||||
//	logger('limit_body_size: start', LOGGER_DEBUG);
 | 
			
		||||
| 
						 | 
				
			
			@ -125,7 +124,7 @@ function limit_body_size($body) {
 | 
			
		|||
	} else {
 | 
			
		||||
		return $body;
 | 
			
		||||
	}
 | 
			
		||||
}}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function title_is_body($title, $body) {
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -14,7 +14,6 @@ use Friendica\Core\Config;
 | 
			
		|||
 | 
			
		||||
require_once "include/dba.php";
 | 
			
		||||
 | 
			
		||||
if (! function_exists('get_browser_language')) {
 | 
			
		||||
/**
 | 
			
		||||
 * @brief get the prefered language from the HTTP_ACCEPT_LANGUAGE header
 | 
			
		||||
 */
 | 
			
		||||
| 
						 | 
				
			
			@ -55,7 +54,7 @@ function get_browser_language() {
 | 
			
		|||
 | 
			
		||||
	// in case none matches, get the system wide configured language, or fall back to English
 | 
			
		||||
	return Config::get('system', 'language', 'en');
 | 
			
		||||
}}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
function push_lang($language) {
 | 
			
		||||
| 
						 | 
				
			
			@ -93,7 +92,6 @@ function pop_lang() {
 | 
			
		|||
 | 
			
		||||
// l
 | 
			
		||||
 | 
			
		||||
if (! function_exists('load_translation_table')) {
 | 
			
		||||
/**
 | 
			
		||||
 * load string translation table for alternate language
 | 
			
		||||
 *
 | 
			
		||||
| 
						 | 
				
			
			@ -118,7 +116,7 @@ function load_translation_table($lang) {
 | 
			
		|||
		include("view/lang/$lang/strings.php");
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Return the localized version of the provided string with optional string interpolation
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -8,6 +8,7 @@ use Friendica\Model\Contact;
 | 
			
		|||
 | 
			
		||||
require_once 'include/acl_selectors.php';
 | 
			
		||||
require_once 'include/message.php';
 | 
			
		||||
require_once 'include/conversation.php';
 | 
			
		||||
 | 
			
		||||
function message_init(App $a) {
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -88,83 +89,6 @@ function message_post(App $a) {
 | 
			
		|||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Note: the code in 'item_extract_images' and 'item_redir_and_replace_images'
 | 
			
		||||
// is identical to the code in include/conversation.php
 | 
			
		||||
if (! function_exists('item_extract_images')) {
 | 
			
		||||
function item_extract_images($body) {
 | 
			
		||||
 | 
			
		||||
	$saved_image = array();
 | 
			
		||||
	$orig_body = $body;
 | 
			
		||||
	$new_body = '';
 | 
			
		||||
 | 
			
		||||
	$cnt = 0;
 | 
			
		||||
	$img_start = strpos($orig_body, '[img');
 | 
			
		||||
	$img_st_close = ($img_start !== false ? strpos(substr($orig_body, $img_start), ']') : false);
 | 
			
		||||
	$img_end = ($img_start !== false ? strpos(substr($orig_body, $img_start), '[/img]') : false);
 | 
			
		||||
	while(($img_st_close !== false) && ($img_end !== false)) {
 | 
			
		||||
 | 
			
		||||
		$img_st_close++; // make it point to AFTER the closing bracket
 | 
			
		||||
		$img_end += $img_start;
 | 
			
		||||
 | 
			
		||||
		if (! strcmp(substr($orig_body, $img_start + $img_st_close, 5), 'data:')) {
 | 
			
		||||
			// This is an embedded image
 | 
			
		||||
 | 
			
		||||
			$saved_image[$cnt] = substr($orig_body, $img_start + $img_st_close, $img_end - ($img_start + $img_st_close));
 | 
			
		||||
			$new_body = $new_body . substr($orig_body, 0, $img_start) . '[!#saved_image' . $cnt . '#!]';
 | 
			
		||||
 | 
			
		||||
			$cnt++;
 | 
			
		||||
		} else
 | 
			
		||||
			$new_body = $new_body . substr($orig_body, 0, $img_end + strlen('[/img]'));
 | 
			
		||||
 | 
			
		||||
		$orig_body = substr($orig_body, $img_end + strlen('[/img]'));
 | 
			
		||||
 | 
			
		||||
		if ($orig_body === false) // in case the body ends on a closing image tag
 | 
			
		||||
			$orig_body = '';
 | 
			
		||||
 | 
			
		||||
		$img_start = strpos($orig_body, '[img');
 | 
			
		||||
		$img_st_close = ($img_start !== false ? strpos(substr($orig_body, $img_start), ']') : false);
 | 
			
		||||
		$img_end = ($img_start !== false ? strpos(substr($orig_body, $img_start), '[/img]') : false);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	$new_body = $new_body . $orig_body;
 | 
			
		||||
 | 
			
		||||
	return array('body' => $new_body, 'images' => $saved_image);
 | 
			
		||||
}}
 | 
			
		||||
 | 
			
		||||
if (! function_exists('item_redir_and_replace_images')) {
 | 
			
		||||
function item_redir_and_replace_images($body, $images, $cid) {
 | 
			
		||||
 | 
			
		||||
	$origbody = $body;
 | 
			
		||||
	$newbody = '';
 | 
			
		||||
 | 
			
		||||
	for($i = 0; $i < count($images); $i++) {
 | 
			
		||||
		$search = '/\[url\=(.*?)\]\[!#saved_image' . $i . '#!\]\[\/url\]' . '/is';
 | 
			
		||||
		$replace = '[url=' . System::baseUrl() . '/redir/' . $cid
 | 
			
		||||
		           . '?f=1&url=' . '$1' . '][!#saved_image' . $i . '#!][/url]' ;
 | 
			
		||||
 | 
			
		||||
		$img_end = strpos($origbody, '[!#saved_image' . $i . '#!][/url]') + strlen('[!#saved_image' . $i . '#!][/url]');
 | 
			
		||||
		$process_part = substr($origbody, 0, $img_end);
 | 
			
		||||
		$origbody = substr($origbody, $img_end);
 | 
			
		||||
 | 
			
		||||
		$process_part = preg_replace($search, $replace, $process_part);
 | 
			
		||||
		$newbody = $newbody . $process_part;
 | 
			
		||||
	}
 | 
			
		||||
	$newbody = $newbody . $origbody;
 | 
			
		||||
 | 
			
		||||
	$cnt = 0;
 | 
			
		||||
	foreach ($images as $image) {
 | 
			
		||||
		// We're depending on the property of 'foreach' (specified on the PHP website) that
 | 
			
		||||
		// it loops over the array starting from the first element and going sequentially
 | 
			
		||||
		// to the last element
 | 
			
		||||
		$newbody = str_replace('[!#saved_image' . $cnt . '#!]', '[img]' . $image . '[/img]', $newbody);
 | 
			
		||||
		$cnt++;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return $newbody;
 | 
			
		||||
}}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
function message_content(App $a) {
 | 
			
		||||
 | 
			
		||||
	$o = '';
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -178,7 +178,6 @@ function profile_photo_post(App $a) {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
if(! function_exists('profile_photo_content')) {
 | 
			
		||||
function profile_photo_content(App $a) {
 | 
			
		||||
 | 
			
		||||
	if (! local_user()) {
 | 
			
		||||
| 
						 | 
				
			
			@ -285,10 +284,9 @@ function profile_photo_content(App $a) {
 | 
			
		|||
	}
 | 
			
		||||
 | 
			
		||||
	return; // NOTREACHED
 | 
			
		||||
}}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
if(! function_exists('profile_photo_crop_ui_head')) {
 | 
			
		||||
function profile_photo_crop_ui_head(App $a, Image $Image) {
 | 
			
		||||
	$max_length = Config::get('system','max_image_length');
 | 
			
		||||
	if (! $max_length) {
 | 
			
		||||
| 
						 | 
				
			
			@ -337,5 +335,4 @@ function profile_photo_crop_ui_head(App $a, Image $Image) {
 | 
			
		|||
	$a->page['htmlhead'] .= replace_macros(get_markup_template("crophead.tpl"), array());
 | 
			
		||||
	$a->page['end'] .= replace_macros(get_markup_template("cropend.tpl"), array());
 | 
			
		||||
	return;
 | 
			
		||||
}}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue