this seems to cut load times in half
This commit is contained in:
parent
6d73e5c0a6
commit
d8c667288e
@ -105,6 +105,7 @@ function bb_replace_images($body, $images) {
|
|||||||
|
|
||||||
function bbcode($Text,$preserve_nl = false, $tryoembed = true) {
|
function bbcode($Text,$preserve_nl = false, $tryoembed = true) {
|
||||||
|
|
||||||
|
|
||||||
$a = get_app();
|
$a = get_app();
|
||||||
|
|
||||||
// Extract the private images which use data url's since preg has issues with
|
// Extract the private images which use data url's since preg has issues with
|
||||||
|
@ -300,17 +300,21 @@ function localize_item(&$item){
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$matches = null;
|
$matches = null;
|
||||||
if(preg_match_all('/@\[url=(.*?)\]/is',$item['body'],$matches,PREG_SET_ORDER)) {
|
if(strpos($item['body'],'[url') !== false) {
|
||||||
foreach($matches as $mtch) {
|
if(preg_match_all('/@\[url=(.*?)\]/is',$item['body'],$matches,PREG_SET_ORDER)) {
|
||||||
if(! strpos($mtch[1],'zid='))
|
foreach($matches as $mtch) {
|
||||||
$item['body'] = str_replace($mtch[0],'@[url=' . zid($mtch[1]). ']',$item['body']);
|
if(! strpos($mtch[1],'zid='))
|
||||||
|
$item['body'] = str_replace($mtch[0],'@[url=' . zid($mtch[1]). ']',$item['body']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// add zid's to public images
|
if(strpos($item['body'],'[img') !== false) {
|
||||||
if(preg_match_all('/\[url=(.*?)\/photos\/(.*?)\/image\/(.*?)\]\[img(.*?)\]h(.*?)\[\/img\]\[\/url\]/is',$item['body'],$matches,PREG_SET_ORDER)) {
|
// add zid's to public images
|
||||||
foreach($matches as $mtch) {
|
if(preg_match_all('/\[url=(.*?)\/photos\/(.*?)\/image\/(.*?)\]\[img(.*?)\]h(.*?)\[\/img\]\[\/url\]/is',$item['body'],$matches,PREG_SET_ORDER)) {
|
||||||
|
foreach($matches as $mtch) {
|
||||||
$item['body'] = str_replace($mtch[0],'[url=' . zid( $mtch[1] . '/photos/' . $mtch[2] . '/image/' . $mtch[3]) . '][img' . $mtch[4] . ']h' . $mtch[5] . '[/img][/url]',$item['body']);
|
$item['body'] = str_replace($mtch[0],'[url=' . zid( $mtch[1] . '/photos/' . $mtch[2] . '/image/' . $mtch[3]) . '][img' . $mtch[4] . ']h' . $mtch[5] . '[/img][/url]',$item['body']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -378,6 +382,9 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional') {
|
|||||||
$previewing = (($preview) ? ' preview ' : '');
|
$previewing = (($preview) ? ' preview ' : '');
|
||||||
|
|
||||||
if($mode === 'network') {
|
if($mode === 'network') {
|
||||||
|
|
||||||
|
$t1 = dba_timer();
|
||||||
|
|
||||||
$profile_owner = local_user();
|
$profile_owner = local_user();
|
||||||
$page_writeable = true;
|
$page_writeable = true;
|
||||||
|
|
||||||
@ -661,32 +668,32 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional') {
|
|||||||
if(feature_enabled($profile_owner,'dislike'))
|
if(feature_enabled($profile_owner,'dislike'))
|
||||||
like_puller($a,$item,$dlike,'dislike');
|
like_puller($a,$item,$dlike,'dislike');
|
||||||
|
|
||||||
// Only add what is visible
|
|
||||||
if($item['network'] === NETWORK_MAIL && local_user() != $item['uid']) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if(! visible_activity($item)) {
|
if(! visible_activity($item)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$item['pagedrop'] = $page_dropping;
|
$item['pagedrop'] = $page_dropping;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if($item['id'] == $item['parent']) {
|
if($item['id'] == $item['parent']) {
|
||||||
|
// $tx1 = dba_timer();
|
||||||
$item_object = new Item($item);
|
$item_object = new Item($item);
|
||||||
$conv->add_thread($item_object);
|
$conv->add_thread($item_object);
|
||||||
|
// $tx2 = dba_timer();
|
||||||
|
// if($mode === 'network')
|
||||||
|
// profiler($tx1,$tx2,'add thread ' . $item['id']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$t2 = dba_timer();
|
||||||
$threads = $conv->get_template_data($alike, $dlike);
|
$threads = $conv->get_template_data($alike, $dlike);
|
||||||
if(!$threads) {
|
if(!$threads) {
|
||||||
logger('[ERROR] conversation : Failed to get template data.', LOGGER_DEBUG);
|
logger('[ERROR] conversation : Failed to get template data.', LOGGER_DEBUG);
|
||||||
$threads = array();
|
$threads = array();
|
||||||
}
|
}
|
||||||
|
$t3 = dba_timer();
|
||||||
|
if($mode === 'network') {
|
||||||
|
profiler($t1,$t2,'Conversation prepare');
|
||||||
|
profiler($t2,$t3,'Conversation get_template');
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -722,6 +729,11 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional') {
|
|||||||
'$dropping' => ($page_dropping?t('Delete Selected Items'):False),
|
'$dropping' => ($page_dropping?t('Delete Selected Items'):False),
|
||||||
));
|
));
|
||||||
|
|
||||||
|
if($mode === 'network') {
|
||||||
|
$t4 = dba_timer();
|
||||||
|
profiler($t3,$t4,'conversation template');
|
||||||
|
}
|
||||||
|
|
||||||
if($page_mode === 'preview')
|
if($page_mode === 'preview')
|
||||||
logger('preview: ' . $o);
|
logger('preview: ' . $o);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user