simplify by making Smarty include directives behave like Friendica native ones
This commit is contained in:
parent
6603758a5e
commit
11c06e21b7
73 changed files with 376 additions and 587 deletions
|
@ -455,16 +455,7 @@ function admin_page_site(&$a) {
|
|||
);
|
||||
|
||||
$t = get_markup_template("admin_site.tpl");
|
||||
|
||||
$includes = array(
|
||||
'$field_checkbox' => 'field_checkbox.tpl',
|
||||
'$field_input' => 'field_input.tpl',
|
||||
'$field_select' => 'field_select.tpl',
|
||||
'$field_textarea' => 'field_textarea.tpl',
|
||||
);
|
||||
$includes = set_template_includes($a->theme['template_engine'], $includes);
|
||||
|
||||
return replace_macros($t, $includes + array(
|
||||
return replace_macros($t, array(
|
||||
'$title' => t('Administration'),
|
||||
'$page' => t('Site'),
|
||||
'$submit' => t('Submit'),
|
||||
|
@ -1144,14 +1135,7 @@ readable.");
|
|||
}
|
||||
}
|
||||
|
||||
$includes = array(
|
||||
'$field_checkbox' => 'field_checkbox.tpl',
|
||||
'$field_input' => 'field_input.tpl',
|
||||
'$field_select' => 'field_select.tpl',
|
||||
);
|
||||
$includes = set_template_includes($a->theme['template_engine'], $includes);
|
||||
|
||||
return replace_macros($t, $includes + array(
|
||||
return replace_macros($t, array(
|
||||
'$title' => t('Administration'),
|
||||
'$page' => t('Logs'),
|
||||
'$submit' => t('Submit'),
|
||||
|
@ -1210,14 +1194,7 @@ function admin_page_remoteupdate(&$a) {
|
|||
}
|
||||
|
||||
$tpl = get_markup_template("admin_remoteupdate.tpl");
|
||||
|
||||
$includes = array(
|
||||
'$field_input' => 'field_input.tpl',
|
||||
'$field_password' => 'field_password.tpl',
|
||||
);
|
||||
$includes = set_template_includes($a->theme['template_engine'], $includes);
|
||||
|
||||
return replace_macros($tpl, $includes + array(
|
||||
return replace_macros($tpl, array(
|
||||
'$baseurl' => $a->get_baseurl(true),
|
||||
'$submit' => t("Update now"),
|
||||
'$close' => t("Close"),
|
||||
|
|
|
@ -346,12 +346,7 @@ function contacts_content(&$a) {
|
|||
|
||||
$lost_contact = (($contact['archive'] && $contact['term-date'] != '0000-00-00 00:00:00' && $contact['term-date'] < datetime_convert('','','now')) ? t('Communications lost with this contact!') : '');
|
||||
|
||||
$includes = array(
|
||||
'$field_checkbox' => 'field_checkbox.tpl',
|
||||
);
|
||||
$includes = set_template_includes($a->theme['template_engine'], $includes);
|
||||
|
||||
$o .= replace_macros($tpl,$includes + array(
|
||||
$o .= replace_macros($tpl, array(
|
||||
'$header' => t('Contact Editor'),
|
||||
'$tab_str' => $tab_str,
|
||||
'$submit' => t('Submit'),
|
||||
|
@ -576,13 +571,7 @@ function contacts_content(&$a) {
|
|||
}
|
||||
|
||||
$tpl = get_markup_template("contacts-template.tpl");
|
||||
|
||||
$includes = array(
|
||||
'$contact_template' => 'contact_template.tpl',
|
||||
);
|
||||
$includes = set_template_includes($a->theme['template_engine'], $includes);
|
||||
|
||||
$o .= replace_macros($tpl,$includes + array(
|
||||
$o .= replace_macros($tpl, array(
|
||||
'$header' => t('Contacts') . (($nets) ? ' - ' . network_to_name($nets) : ''),
|
||||
'$tabs' => $t,
|
||||
'$total' => $total,
|
||||
|
|
|
@ -24,14 +24,9 @@ function filer_content(&$a) {
|
|||
$filetags = get_pconfig(local_user(),'system','filetags');
|
||||
$filetags = file_tag_file_to_list($filetags,'file');
|
||||
$filetags = explode(",", $filetags);
|
||||
|
||||
$tpl = get_markup_template("filer_dialog.tpl");
|
||||
|
||||
$includes = array(
|
||||
'$field_combobox' => 'field_combobox.tpl',
|
||||
);
|
||||
$includes = set_template_includes($a->theme['template_engine'], $includes);
|
||||
|
||||
$o = replace_macros($tpl,$includes + array(
|
||||
$o = replace_macros($tpl, array(
|
||||
'$field' => array('term', t("Save to Folder:"), '', '', $filetags, t('- select -')),
|
||||
'$submit' => t('Save'),
|
||||
));
|
||||
|
|
|
@ -83,13 +83,7 @@ function group_content(&$a) {
|
|||
|
||||
$tpl = get_markup_template('group_edit.tpl');
|
||||
|
||||
$includes = array(
|
||||
'$field_input' => 'field_input.tpl',
|
||||
'$groupeditortpl' => 'groupeditor.tpl',
|
||||
);
|
||||
$includes = set_template_includes($a->theme['template_engine'], $includes);
|
||||
|
||||
$context = $includes + array(
|
||||
$context = array(
|
||||
'$submit' => t('Submit'),
|
||||
);
|
||||
|
||||
|
|
|
@ -177,6 +177,8 @@ function install_content(&$a) {
|
|||
|
||||
check_htconfig($checks);
|
||||
|
||||
check_smarty3($checks);
|
||||
|
||||
check_keys($checks);
|
||||
|
||||
if(x($_POST,'phpath'))
|
||||
|
@ -220,14 +222,7 @@ function install_content(&$a) {
|
|||
|
||||
|
||||
$tpl = get_markup_template('install_db.tpl');
|
||||
|
||||
$includes = array(
|
||||
'$field_input' => 'field_input.tpl',
|
||||
'$field_password' => 'field_password.tpl',
|
||||
);
|
||||
$includes = set_template_includes($a->theme['template_engine'], $includes);
|
||||
|
||||
$o .= replace_macros($tpl,$includes + array(
|
||||
$o .= replace_macros($tpl, array(
|
||||
'$title' => $install_title,
|
||||
'$pass' => t('Database connection'),
|
||||
'$info_01' => t('In order to install Friendica we need to know how to connect to your database.'),
|
||||
|
@ -267,13 +262,7 @@ function install_content(&$a) {
|
|||
$timezone = ((x($_POST,'timezone')) ? ($_POST['timezone']) : 'America/Los_Angeles');
|
||||
|
||||
$tpl = get_markup_template('install_settings.tpl');
|
||||
|
||||
$includes = array(
|
||||
'$field_input' => 'field_input.tpl',
|
||||
);
|
||||
$includes = set_template_includes($a->theme['template_engine'], $includes);
|
||||
|
||||
$o .= replace_macros($tpl, $includes + array(
|
||||
$o .= replace_macros($tpl, array(
|
||||
'$title' => $install_title,
|
||||
'$pass' => t('Site settings'),
|
||||
|
||||
|
@ -441,6 +430,22 @@ function check_htconfig(&$checks) {
|
|||
|
||||
}
|
||||
|
||||
function check_smarty3(&$checks) {
|
||||
$status = true;
|
||||
$help = "";
|
||||
if( !is_writable('view/smarty3') ) {
|
||||
|
||||
$status=false;
|
||||
$help = t('Friendica uses the Smarty3 template engine to render its web views. Smarty3 compiles templates to PHP to speed up rendering.') .EOL;
|
||||
$help .= t('In order to store these compiled templates, the web server needs to have write access to the directory view/smarty3/ under the Friendica top level folder.').EOL;
|
||||
$help .= t('Please ensure that the user that your web server runs as (e.g. www-data) has write access to this folder.').EOL;
|
||||
$help .= t('Note: as a security measure, you should give the web server write access to view/smarty3/ only--not the template files (.tpl) that it contains.').EOL;
|
||||
}
|
||||
|
||||
check_add($checks, t('view/smarty3 is writable'), $status, true, $help);
|
||||
|
||||
}
|
||||
|
||||
function check_htaccess(&$checks) {
|
||||
$a = get_app();
|
||||
$status = true;
|
||||
|
|
|
@ -497,12 +497,6 @@ function message_content(&$a) {
|
|||
|
||||
$tpl = get_markup_template('mail_display.tpl');
|
||||
|
||||
$includes = array(
|
||||
'$mail_conv' => 'mail_conv.tpl',
|
||||
'$prv_message' => 'prv_message.tpl',
|
||||
);
|
||||
$includes = set_template_includes($a->theme['template_engine'], $includes);
|
||||
|
||||
if($a->theme['template_engine'] === 'internal') {
|
||||
$subjtxt_e = template_escape($message['title']);
|
||||
}
|
||||
|
@ -510,7 +504,7 @@ function message_content(&$a) {
|
|||
$subjtxt_e = $message['title'];
|
||||
}
|
||||
|
||||
$o = replace_macros($tpl, $includes + array(
|
||||
$o = replace_macros($tpl, array(
|
||||
'$thread_id' => $a->argv[1],
|
||||
'$thread_subject' => $message['title'],
|
||||
'$thread_seen' => $seen,
|
||||
|
|
|
@ -55,13 +55,7 @@ function nogroup_content(&$a) {
|
|||
}
|
||||
|
||||
$tpl = get_markup_template("nogroup-template.tpl");
|
||||
|
||||
$includes = array(
|
||||
'$contact_template' => 'contact_template.tpl',
|
||||
);
|
||||
$includes = set_template_includes($a->theme['template_engine'], $includes);
|
||||
|
||||
$o .= replace_macros($tpl,$includes + array(
|
||||
$o .= replace_macros($tpl, array(
|
||||
'$header' => t('Contacts who are not members of a group'),
|
||||
'$contacts' => $contacts,
|
||||
'$paginate' => paginate($a),
|
||||
|
|
|
@ -145,12 +145,7 @@ function notifications_content(&$a) {
|
|||
|
||||
$return_addr = bin2hex($a->user['nickname'] . '@' . $a->get_hostname() . (($a->path) ? '/' . $a->path : ''));
|
||||
|
||||
$includes = array(
|
||||
'$field_checkbox' => 'field_checkbox.tpl',
|
||||
);
|
||||
$includes = set_template_includes($a->theme['template_engine'], $includes);
|
||||
|
||||
$notif_content .= replace_macros($sugg,$includes + array(
|
||||
$notif_content .= replace_macros($sugg, array(
|
||||
'$str_notifytype' => t('Notification type: '),
|
||||
'$notify_type' => t('Friend Suggestion'),
|
||||
'$intro_id' => $rr['intro_id'],
|
||||
|
@ -196,12 +191,7 @@ function notifications_content(&$a) {
|
|||
));
|
||||
}
|
||||
|
||||
$includes = array(
|
||||
'$field_checkbox' => 'field_checkbox.tpl',
|
||||
);
|
||||
$includes = set_template_includes($a->theme['template_engine'], $includes);
|
||||
|
||||
$notif_content .= replace_macros($tpl,$includes + array(
|
||||
$notif_content .= replace_macros($tpl, array(
|
||||
'$str_notifytype' => t('Notification type: '),
|
||||
'$notify_type' => (($rr['network'] !== NETWORK_OSTATUS) ? t('Friend/Connect Request') : t('New Follower')),
|
||||
'$dfrn_text' => $dfrn_text,
|
||||
|
@ -226,12 +216,7 @@ function notifications_content(&$a) {
|
|||
else
|
||||
info( t('No introductions.') . EOL);
|
||||
|
||||
$includes = array(
|
||||
'$common_tabs' => 'common_tabs.tpl',
|
||||
);
|
||||
$includes = set_template_includes($a->theme['template_engine'], $includes);
|
||||
|
||||
$o .= replace_macros($notif_tpl,$includes + array(
|
||||
$o .= replace_macros($notif_tpl, array(
|
||||
'$notif_header' => t('Notifications'),
|
||||
'$tabs_data' => $tabs,
|
||||
'$notif_content' => $notif_content,
|
||||
|
@ -317,12 +302,7 @@ function notifications_content(&$a) {
|
|||
$notif_content = t('No more network notifications.');
|
||||
}
|
||||
|
||||
$includes = array(
|
||||
'$common_tabs' => 'common_tabs.tpl',
|
||||
);
|
||||
$includes = set_template_includes($a->theme['template_engine'], $includes);
|
||||
|
||||
$o .= replace_macros($notif_tpl,$includes + array(
|
||||
$o .= replace_macros($notif_tpl, array(
|
||||
'$notif_header' => t('Network Notifications'),
|
||||
'$tabs_data' => $tabs,
|
||||
'$notif_content' => $notif_content,
|
||||
|
@ -352,12 +332,7 @@ function notifications_content(&$a) {
|
|||
$notif_content .= t('No more system notifications.');
|
||||
}
|
||||
|
||||
$includes = array(
|
||||
'$common_tabs' => 'common_tabs.tpl',
|
||||
);
|
||||
$includes = set_template_includes($a->theme['template_engine'], $includes);
|
||||
|
||||
$o .= replace_macros($notif_tpl,$includes + array(
|
||||
$o .= replace_macros($notif_tpl, array(
|
||||
'$notif_header' => t('System Notifications'),
|
||||
'$tabs_data' => $tabs,
|
||||
'$notif_content' => $notif_content,
|
||||
|
@ -452,12 +427,7 @@ function notifications_content(&$a) {
|
|||
$notif_content = t('No more personal notifications.');
|
||||
}
|
||||
|
||||
$includes = array(
|
||||
'$common_tabs' => 'common_tabs.tpl',
|
||||
);
|
||||
$includes = set_template_includes($a->theme['template_engine'], $includes);
|
||||
|
||||
$o .= replace_macros($notif_tpl,$includes + array(
|
||||
$o .= replace_macros($notif_tpl, array(
|
||||
'$notif_header' => t('Personal Notifications'),
|
||||
'$tabs_data' => $tabs,
|
||||
'$notif_content' => $notif_content,
|
||||
|
@ -538,12 +508,7 @@ function notifications_content(&$a) {
|
|||
$notif_content = t('No more home notifications.');
|
||||
}
|
||||
|
||||
$includes = array(
|
||||
'$common_tabs' => 'common_tabs.tpl',
|
||||
);
|
||||
$includes = set_template_includes($a->theme['template_engine'], $includes);
|
||||
|
||||
$o .= replace_macros($notif_tpl,$includes + array(
|
||||
$o .= replace_macros($notif_tpl, array(
|
||||
'$notif_header' => t('Home Notifications'),
|
||||
'$tabs_data' => $tabs,
|
||||
'$notif_content' => $notif_content,
|
||||
|
|
|
@ -61,12 +61,7 @@ function notify_content(&$a) {
|
|||
$notif_content .= t('No more system notifications.');
|
||||
}
|
||||
|
||||
$includes = array(
|
||||
'$common_tabs' => 'common_tabs.tpl',
|
||||
);
|
||||
$includes = set_template_includes($a->theme['template_engine'], $includes);
|
||||
|
||||
$o .= replace_macros($notif_tpl,$includes + array(
|
||||
$o .= replace_macros($notif_tpl, array(
|
||||
'$notif_header' => t('System Notifications'),
|
||||
'$tabs_data' => '', // $tabs,
|
||||
'$notif_content' => $notif_content,
|
||||
|
|
|
@ -1679,13 +1679,7 @@ function photos_content(&$a) {
|
|||
}
|
||||
|
||||
$tpl = get_markup_template('photos_recent.tpl');
|
||||
|
||||
$includes = array(
|
||||
'$photo_top' => 'photo_top.tpl',
|
||||
);
|
||||
$includes = set_template_includes($a->theme['template_engine'], $includes);
|
||||
|
||||
$o .= replace_macros($tpl,$includes + array(
|
||||
$o .= replace_macros($tpl, array(
|
||||
'$title' => t('Recent Photos'),
|
||||
'$can_post' => $can_post,
|
||||
'$upload' => array(t('Upload New Photos'), $a->get_baseurl().'/photos/'.$a->data['user']['nickname'].'/upload'),
|
||||
|
|
|
@ -147,13 +147,7 @@ function poco_init(&$a) {
|
|||
|
||||
if($format === 'xml') {
|
||||
header('Content-type: text/xml');
|
||||
|
||||
$includes = array(
|
||||
'$poco_entry_xml' => 'poco_entry_xml.tpl'
|
||||
);
|
||||
$includes = set_template_includes($a->theme['template_engine'], $includes);
|
||||
|
||||
echo replace_macros(get_markup_template('poco_xml.tpl'),array_xmlify($includes + array('$response' => $ret)));
|
||||
echo replace_macros(get_markup_template('poco_xml.tpl'),array_xmlify(array('$response' => $ret)));
|
||||
http_status_exit(500);
|
||||
}
|
||||
if($format === 'json') {
|
||||
|
|
|
@ -554,13 +554,7 @@ function settings_content(&$a) {
|
|||
|
||||
if(($a->argc > 2) && ($a->argv[2] === 'add')) {
|
||||
$tpl = get_markup_template("settings_oauth_edit.tpl");
|
||||
|
||||
$includes = array(
|
||||
'$field_input' => 'field_input.tpl',
|
||||
);
|
||||
$includes = set_template_includes($a->theme['template_engine'], $includes);
|
||||
|
||||
$o .= replace_macros($tpl, $includes + array(
|
||||
$o .= replace_macros($tpl, array(
|
||||
'$form_security_token' => get_form_security_token("settings_oauth"),
|
||||
'$title' => t('Add application'),
|
||||
'$submit' => t('Submit'),
|
||||
|
@ -586,13 +580,7 @@ function settings_content(&$a) {
|
|||
$app = $r[0];
|
||||
|
||||
$tpl = get_markup_template("settings_oauth_edit.tpl");
|
||||
|
||||
$includes = array(
|
||||
'$field_input' => 'field_input.tpl',
|
||||
);
|
||||
$includes = set_template_includes($a->theme['template_engine'], $includes);
|
||||
|
||||
$o .= replace_macros($tpl, $includes + array(
|
||||
$o .= replace_macros($tpl, array(
|
||||
'$form_security_token' => get_form_security_token("settings_oauth"),
|
||||
'$title' => t('Add application'),
|
||||
'$submit' => t('Update'),
|
||||
|
@ -675,13 +663,7 @@ function settings_content(&$a) {
|
|||
|
||||
|
||||
$tpl = get_markup_template("settings_features.tpl");
|
||||
|
||||
$includes = array(
|
||||
'$field_yesno' => 'field_yesno.tpl',
|
||||
);
|
||||
$includes = set_template_includes($a->theme['template_engine'], $includes);
|
||||
|
||||
$o .= replace_macros($tpl, $includes + array(
|
||||
$o .= replace_macros($tpl, array(
|
||||
'$form_security_token' => get_form_security_token("settings_features"),
|
||||
'$title' => t('Additional Features'),
|
||||
'$features' => $arr,
|
||||
|
@ -733,16 +715,7 @@ function settings_content(&$a) {
|
|||
}
|
||||
|
||||
|
||||
$includes = array(
|
||||
'$field_checkbox' => 'field_checkbox.tpl',
|
||||
'$field_input' => 'field_input.tpl',
|
||||
'$field_select' => 'field_select.tpl',
|
||||
'$field_custom' => 'field_custom.tpl',
|
||||
'$field_password' => 'field_password.tpl',
|
||||
);
|
||||
$includes = set_template_includes($a->theme['template_engine'], $includes);
|
||||
|
||||
$o .= replace_macros($tpl, $includes + array(
|
||||
$o .= replace_macros($tpl, array(
|
||||
'$form_security_token' => get_form_security_token("settings_connectors"),
|
||||
|
||||
'$title' => t('Connector Settings'),
|
||||
|
@ -832,15 +805,7 @@ function settings_content(&$a) {
|
|||
}
|
||||
|
||||
$tpl = get_markup_template("settings_display.tpl");
|
||||
|
||||
$includes = array(
|
||||
'$field_themeselect' => 'field_themeselect.tpl',
|
||||
'$field_checkbox' => 'field_checkbox.tpl',
|
||||
'$field_input' => 'field_input.tpl',
|
||||
);
|
||||
$includes = set_template_includes($a->theme['template_engine'], $includes);
|
||||
|
||||
$o = replace_macros($tpl, $includes + array(
|
||||
$o = replace_macros($tpl, array(
|
||||
'$ptitle' => t('Display Settings'),
|
||||
'$form_security_token' => get_form_security_token("settings_display"),
|
||||
'$submit' => t('Submit'),
|
||||
|
@ -926,13 +891,7 @@ function settings_content(&$a) {
|
|||
|
||||
|
||||
$pageset_tpl = get_markup_template('pagetypes.tpl');
|
||||
|
||||
$includes = array(
|
||||
'$field_radio' => 'field_radio.tpl',
|
||||
);
|
||||
$includes = set_template_includes($a->theme['template_engine'], $includes);
|
||||
|
||||
$pagetype = replace_macros($pageset_tpl,$includes + array(
|
||||
$pagetype = replace_macros($pageset_tpl, array(
|
||||
'$page_normal' => array('page-flags', t('Normal Account Page'), PAGE_NORMAL,
|
||||
t('This account is a normal personal profile'),
|
||||
($a->user['page-flags'] == PAGE_NORMAL)),
|
||||
|
@ -1053,17 +1012,7 @@ function settings_content(&$a) {
|
|||
require_once('include/group.php');
|
||||
$group_select = mini_group_select(local_user(),$a->user['def_gid']);
|
||||
|
||||
$includes = array(
|
||||
'$field_password' => 'field_password.tpl',
|
||||
'$field_input' => 'field_input.tpl',
|
||||
'$field_custom' => 'field_custom.tpl',
|
||||
'$field_checkbox' => 'field_checkbox.tpl',
|
||||
'$field_yesno' => 'field_yesno.tpl',
|
||||
'$field_intcheckbox' => 'field_intcheckbox.tpl',
|
||||
);
|
||||
$includes = set_template_includes($a->theme['template_engine'], $includes);
|
||||
|
||||
$o .= replace_macros($stpl,$includes + array(
|
||||
$o .= replace_macros($stpl, array(
|
||||
'$ptitle' => t('Account Settings'),
|
||||
|
||||
'$submit' => t('Submit'),
|
||||
|
|
|
@ -60,13 +60,7 @@ function uimport_content(&$a) {
|
|||
|
||||
|
||||
$tpl = get_markup_template("uimport.tpl");
|
||||
|
||||
$includes = array(
|
||||
'$field_custom' => 'field_custom.tpl',
|
||||
);
|
||||
$includes = set_template_includes($a->theme['template_engine'], $includes);
|
||||
|
||||
return replace_macros($tpl, $includes + array(
|
||||
return replace_macros($tpl, array(
|
||||
'$regbutt' => t('Import'),
|
||||
'$import' => array(
|
||||
'title' => t("Move account"),
|
||||
|
|
|
@ -72,13 +72,7 @@ function viewcontacts_content(&$a) {
|
|||
|
||||
|
||||
$tpl = get_markup_template("viewcontact_template.tpl");
|
||||
|
||||
$includes = array(
|
||||
'$contact_template' => 'contact_template.tpl',
|
||||
);
|
||||
$includes = set_template_includes($a->theme['template_engine'], $includes);
|
||||
|
||||
$o .= replace_macros($tpl, $includes + array(
|
||||
$o .= replace_macros($tpl, array(
|
||||
'$title' => t('View Contacts'),
|
||||
'$contacts' => $contacts,
|
||||
'$paginate' => paginate($a),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue