1
1
Fork 0

replace macros

implement new replaceMacros function
This commit is contained in:
Adam Magness 2018-10-31 10:35:50 -04:00
commit 91facd2d0a
91 changed files with 335 additions and 249 deletions

View file

@ -14,6 +14,7 @@ use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\PConfig;
use Friendica\Core\Protocol;
use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\Model\Contact;
@ -758,7 +759,7 @@ function conversation(App $a, array $items, Pager $pager, $mode, $update, $previ
}
}
$o = replace_macros($page_template, [
$o = Renderer::replaceMacros($page_template, [
'$baseurl' => System::baseUrl($ssl_state),
'$return_path' => $a->query_string,
'$live_update' => $live_update_div,
@ -1062,7 +1063,7 @@ function format_like($cnt, array $arr, $type, $id) {
}
$phrase .= EOL ;
$o .= replace_macros(get_markup_template('voting_fakelink.tpl'), [
$o .= Renderer::replaceMacros(get_markup_template('voting_fakelink.tpl'), [
'$phrase' => $phrase,
'$type' => $type,
'$id' => $id
@ -1076,10 +1077,10 @@ function status_editor(App $a, $x, $notes_cid = 0, $popup = false)
{
$o = '';
$geotag = x($x, 'allow_location') ? replace_macros(get_markup_template('jot_geotag.tpl'), []) : '';
$geotag = x($x, 'allow_location') ? Renderer::replaceMacros(get_markup_template('jot_geotag.tpl'), []) : '';
$tpl = get_markup_template('jot-header.tpl');
$a->page['htmlhead'] .= replace_macros($tpl, [
$a->page['htmlhead'] .= Renderer::replaceMacros($tpl, [
'$newpost' => 'true',
'$baseurl' => System::baseUrl(true),
'$geotag' => $geotag,
@ -1117,10 +1118,10 @@ function status_editor(App $a, $x, $notes_cid = 0, $popup = false)
$public_post_link = '&public=1';
}
// $tpl = replace_macros($tpl,array('$jotplugins' => $jotplugins));
// $tpl = Renderer::replaceMacros($tpl,array('$jotplugins' => $jotplugins));
$tpl = get_markup_template("jot.tpl");
$o .= replace_macros($tpl,[
$o .= Renderer::replaceMacros($tpl,[
'$new_post' => L10n::t('New Post'),
'$return_path' => $query_str,
'$action' => 'item',

View file

@ -8,6 +8,7 @@ use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\Model\Contact;
@ -517,7 +518,7 @@ function notification($params)
}
$itemlink = System::baseUrl().'/notify/view/'.$notify_id;
$msg = replace_macros($epreamble, ['$itemlink' => $itemlink]);
$msg = Renderer::replaceMacros($epreamble, ['$itemlink' => $itemlink]);
$msg_cache = format_notification_message($datarray['name_cache'], strip_tags(BBCode::convert($msg)));
$fields = ['msg' => $msg, 'msg_cache' => $msg_cache];
@ -590,7 +591,7 @@ function notification($params)
// load the template for private message notifications
$tpl = get_markup_template('email_notify_html.tpl');
$email_html_body = replace_macros($tpl, [
$email_html_body = Renderer::replaceMacros($tpl, [
'$banner' => $datarray['banner'],
'$product' => $datarray['product'],
'$preamble' => str_replace("\n", "<br>\n", $datarray['preamble']),
@ -611,7 +612,7 @@ function notification($params)
// load the template for private message notifications
$tpl = get_markup_template('email_notify_text.tpl');
$email_text_body = replace_macros($tpl, [
$email_text_body = Renderer::replaceMacros($tpl, [
'$banner' => $datarray['banner'],
'$product' => $datarray['product'],
'$preamble' => $datarray['preamble'],

View file

@ -11,6 +11,7 @@ use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\PConfig;
use Friendica\Core\Protocol;
use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\Model\Item;
@ -390,7 +391,7 @@ function drop_item($id)
}
}
return replace_macros(get_markup_template('confirm.tpl'), [
return Renderer::replaceMacros(get_markup_template('confirm.tpl'), [
'$method' => 'get',
'$message' => L10n::t('Do you really want to delete this item?'),
'$extra_inputs' => $inputs,
@ -481,7 +482,7 @@ function posted_date_widget($url, $uid, $wall)
$cutoff_year = intval(DateTimeFormat::localNow('Y')) - $visible_years;
$cutoff = ((array_key_exists($cutoff_year, $ret))? true : false);
$o = replace_macros(get_markup_template('posted_date_widget.tpl'),[
$o = Renderer::replaceMacros(get_markup_template('posted_date_widget.tpl'),[
'$title' => L10n::t('Archives'),
'$size' => $visible_years,
'$cutoff_year' => $cutoff_year,

View file

@ -267,7 +267,7 @@ function unxmlify($s) {
*/
function scroll_loader() {
$tpl = get_markup_template("scroll_loader.tpl");
return replace_macros($tpl, [
return Renderer::replaceMacros($tpl, [
'wait' => L10n::t('Loading more entries...'),
'end' => L10n::t('The end')
]);
@ -514,7 +514,7 @@ function contact_block() {
}
$tpl = get_markup_template('contact_block.tpl');
$o = replace_macros($tpl, [
$o = Renderer::replaceMacros($tpl, [
'$contacts' => $contacts,
'$nickname' => $a->profile['nickname'],
'$viewcontacts' => L10n::t('View Contacts'),
@ -571,7 +571,7 @@ function micropro($contact, $redirect = false, $class = '', $textmode = false) {
$url = '';
}
return replace_macros(get_markup_template(($textmode)?'micropro_txt.tpl':'micropro_img.tpl'),[
return Renderer::replaceMacros(get_markup_template(($textmode)?'micropro_txt.tpl':'micropro_img.tpl'),[
'$click' => defaults($contact, 'click', ''),
'$class' => $class,
'$url' => $url,
@ -626,7 +626,7 @@ function search($s, $id = 'search-box', $url = 'search', $save = false, $aside =
}
}
return replace_macros(get_markup_template('searchbox.tpl'), $values);
return Renderer::replaceMacros(get_markup_template('searchbox.tpl'), $values);
}
/**
@ -904,14 +904,14 @@ function prepare_body(array &$item, $attach = false, $is_preview = false)
if (strpos($mime, 'video') !== false) {
if (!$vhead) {
$vhead = true;
$a->page['htmlhead'] .= replace_macros(get_markup_template('videos_head.tpl'), [
$a->page['htmlhead'] .= Renderer::replaceMacros(get_markup_template('videos_head.tpl'), [
'$baseurl' => System::baseUrl(),
]);
}
$url_parts = explode('/', $the_url);
$id = end($url_parts);
$as .= replace_macros(get_markup_template('video_top.tpl'), [
$as .= Renderer::replaceMacros(get_markup_template('video_top.tpl'), [
'$video' => [
'id' => $id,
'title' => L10n::t('View Video'),
@ -1007,7 +1007,7 @@ function apply_content_filter($html, array $reasons)
{
if (count($reasons)) {
$tpl = get_markup_template('wall/content_filter.tpl');
$html = replace_macros($tpl, [
$html = Renderer::replaceMacros($tpl, [
'$reasons' => $reasons,
'$rnd' => random_string(8),
'$openclose' => L10n::t('Click to open/close'),