1
0
Fork 0

Use short form array syntax everywhere

- Add short form array syntax to po2php.php generation
This commit is contained in:
Hypolite Petovan 2018-01-15 08:05:12 -05:00
commit e36f2bb1fb
212 changed files with 5160 additions and 5160 deletions

View file

@ -48,7 +48,7 @@ function theme_content(App $a) {
if (!local_user()) {
return;
}
$arr = array();
$arr = [];
$arr["schema"] = PConfig::get(local_user(), 'frio', 'schema');
$arr["nav_bg"] = PConfig::get(local_user(), 'frio', 'nav_bg');
@ -66,7 +66,7 @@ function theme_admin(App $a) {
if (!local_user()) {
return;
}
$arr = array();
$arr = [];
$arr["schema"] = Config::get('frio', 'schema');
$arr["nav_bg"] = Config::get('frio', 'nav_bg');
@ -87,10 +87,10 @@ function frio_form($arr) {
$scheme_info = get_schema_info($arr["schema"]);
$disable = $scheme_info["overwrites"];
if (!is_array($disable)) {
$disable = array();
$disable = [];
}
$scheme_choices = array();
$scheme_choices = [];
$scheme_choices["---"] = t("Default");
$files = glob('view/theme/frio/schema/*.php');
if ($files) {
@ -106,22 +106,22 @@ function frio_form($arr) {
$background_image_help = "<strong>" . t("Note"). ": </strong>".t("Check image permissions if all users are allowed to visit the image");
$t = get_markup_template('theme_settings.tpl');
$ctx = array(
$ctx = [
'$submit' => t('Submit'),
'$baseurl' => System::baseUrl(),
'$title' => t("Theme settings"),
'$schema' => array('frio_schema', t("Select scheme"), $arr["schema"], '', $scheme_choices),
'$nav_bg' => array_key_exists("nav_bg", $disable) ? "" : array('frio_nav_bg', t('Navigation bar background color'), $arr['nav_bg']),
'$nav_icon_color' => array_key_exists("nav_icon_color", $disable) ? "" : array('frio_nav_icon_color', t('Navigation bar icon color '), $arr['nav_icon_color']),
'$link_color' => array_key_exists("link_color", $disable) ? "" : array('frio_link_color', t('Link color'), $arr['link_color'], '', $link_colors),
'$bgcolor' => array_key_exists("bgcolor", $disable) ? "" : array('frio_background_color', t('Set the background color'), $arr['bgcolor']),
'$contentbg_transp' => array_key_exists("contentbg_transp", $disable) ? "" : array('frio_contentbg_transp', t("Content background transparency"), ((isset($arr["contentbg_transp"]) && $arr["contentbg_transp"] != "") ? $arr["contentbg_transp"] : 100)),
'$background_image' => array_key_exists("background_image", $disable ) ? "" : array('frio_background_image', t('Set the background image'), $arr['background_image'], $background_image_help),
'$schema' => ['frio_schema', t("Select scheme"), $arr["schema"], '', $scheme_choices],
'$nav_bg' => array_key_exists("nav_bg", $disable) ? "" : ['frio_nav_bg', t('Navigation bar background color'), $arr['nav_bg']],
'$nav_icon_color' => array_key_exists("nav_icon_color", $disable) ? "" : ['frio_nav_icon_color', t('Navigation bar icon color '), $arr['nav_icon_color']],
'$link_color' => array_key_exists("link_color", $disable) ? "" : ['frio_link_color', t('Link color'), $arr['link_color'], '', $link_colors],
'$bgcolor' => array_key_exists("bgcolor", $disable) ? "" : ['frio_background_color', t('Set the background color'), $arr['bgcolor']],
'$contentbg_transp' => array_key_exists("contentbg_transp", $disable) ? "" : ['frio_contentbg_transp', t("Content background transparency"), ((isset($arr["contentbg_transp"]) && $arr["contentbg_transp"] != "") ? $arr["contentbg_transp"] : 100)],
'$background_image' => array_key_exists("background_image", $disable ) ? "" : ['frio_background_image', t('Set the background image'), $arr['background_image'], $background_image_help],
'$bg_image_options' => Image::get_options($arr),
);
];
if ( array_key_exists("login_bg_image", $arr ) && !array_key_exists("login_bg_image", $disable ) ) {
$ctx['$login_bg_image'] = array('frio_login_bg_image', t('Login page background image'), $arr['login_bg_image'], $background_image_help);
if ( array_key_exists("login_bg_image", $arr ) && !array_key_exists("login_bg_image", $disable ) ) {
$ctx['$login_bg_image'] = ['frio_login_bg_image', t('Login page background image'), $arr['login_bg_image'], $background_image_help];
}
$o .= replace_macros($t, $ctx);

View file

@ -12,22 +12,22 @@ class Image {
/**
* @brief Give all available options for the background image
*
*
* @param array $arr Array with the present user settings
*
*
* @return array Array with the immage options
*/
public static function get_options($arr) {
$bg_image_options = array(
'repeat' => array(
'frio_bg_image_option', t("Repeat the image"), "repeat", t("Will repeat your image to fill the background."), ($arr["bg_image_option"] == "repeat")),
'stretch' => array(
'frio_bg_image_option', t("Stretch"), "stretch", t("Will stretch to width/height of the image."), ($arr["bg_image_option"] == "stretch")),
'cover' => array(
'frio_bg_image_option', t("Resize fill and-clip"), "cover", t("Resize to fill and retain aspect ratio."), ($arr["bg_image_option"] == "cover")),
'contain' => array(
'frio_bg_image_option', t("Resize best fit"), "contain", t("Resize to best fit and retain aspect ratio."), ($arr["bg_image_option"] == "contain")),
);
$bg_image_options = [
'repeat' => [
'frio_bg_image_option', t("Repeat the image"), "repeat", t("Will repeat your image to fill the background."), ($arr["bg_image_option"] == "repeat")],
'stretch' => [
'frio_bg_image_option', t("Stretch"), "stretch", t("Will stretch to width/height of the image."), ($arr["bg_image_option"] == "stretch")],
'cover' => [
'frio_bg_image_option', t("Resize fill and-clip"), "cover", t("Resize to fill and retain aspect ratio."), ($arr["bg_image_option"] == "cover")],
'contain' => [
'frio_bg_image_option', t("Resize best fit"), "contain", t("Resize to best fit and retain aspect ratio."), ($arr["bg_image_option"] == "contain")],
];
return $bg_image_options;
}

View file

@ -63,7 +63,7 @@ class Color {
$G = hexdec($color[2].$color[3]);
$B = hexdec($color[4].$color[5]);
$HSL = array();
$HSL = [];
$var_R = ($R / 255);
$var_G = ($G / 255);
@ -110,13 +110,13 @@ class Color {
* @return string HEX string
* @throws Exception "Bad HSL Array"
*/
public static function hslToHex( $hsl = array() ){
public static function hslToHex( $hsl = [] ){
// Make sure it's HSL
if(empty($hsl) || !isset($hsl["H"]) || !isset($hsl["S"]) || !isset($hsl["L"]) ) {
throw new Exception("Param was not an HSL array");
}
list($H,$S,$L) = array( $hsl['H']/360,$hsl['S'],$hsl['L'] );
list($H,$S,$L) = [ $hsl['H']/360,$hsl['S'],$hsl['L'] ];
if( $S == 0 ) {
$r = $L * 255;
@ -181,7 +181,7 @@ class Color {
* @return string RGB string
* @throws Exception "Bad RGB Array"
*/
public static function rgbToHex( $rgb = array() ){
public static function rgbToHex( $rgb = [] ){
// Make sure it's RGB
if(empty($rgb) || !isset($rgb["R"]) || !isset($rgb["G"]) || !isset($rgb["B"]) ) {
throw new Exception("Param was not an RGB array");
@ -253,7 +253,7 @@ class Color {
}
// Return our gradient array
return array( "light" => $lightColor, "dark" => $darkColor );
return [ "light" => $lightColor, "dark" => $darkColor ];
}
@ -308,7 +308,7 @@ class Color {
// Return the new value in HEX
return self::hslToHex($hsl);
}
/**
* Returns your color's HSL array
*/
@ -327,7 +327,7 @@ class Color {
public function getRgb() {
return $this->_rgb;
}
/**
* Returns the cross browser CSS3 gradient
* @param int $amount Optional: percentage amount to light/darken the gradient
@ -435,7 +435,7 @@ class Color {
$gmix = (($rgb1['G'] * $r1) + ($rgb2['G'] * $r2)) / 2;
$bmix = (($rgb1['B'] * $r1) + ($rgb2['B'] * $r2)) / 2;
return array('R' => $rmix, 'G' => $gmix, 'B' => $bmix);
return ['R' => $rmix, 'G' => $gmix, 'B' => $bmix];
}
/**

View file

@ -63,12 +63,12 @@ function is_modal() {
*/
function get_modalpage_list() {
//Arry of pages wich getting bootstrap modal dialogs
$modalpages = array('poke/',
$modalpages = ['poke/',
'message/new',
'settings/oauth/add',
'events/new',
// 'fbrowser/image/'
);
];
return $modalpages;
}
@ -83,9 +83,9 @@ function get_modalpage_list() {
*/
function get_standard_page_list() {
//Arry of pages wich getting the standard page template
$standardpages = array(//'profile',
$standardpages = [//'profile',
// 'fbrowser/image/'
);
];
return $standardpages;
}

View file

@ -3,14 +3,14 @@
/**
* @brief: Get info header of the shema
*
*
* This function parses the header of the shemename.php file for inormations like
* Author, Description and Overwrites. Most of the code comes from the get_plugin_info()
* function. We use this to get the variables which get overwritten through the shema.
* All color variables which get overwritten through the theme have to be
* listed (comma seperated) in the shema header under Overwrites:
* This seemst not to be the best solution. We need to investigate further.
*
*
* @param string $schema Name of the shema
* @return array With theme information
* 'author' => Author Name
@ -27,13 +27,13 @@ function get_schema_info($schema){
$themepath = "view/theme/" . $theme . "/";
$schema = PConfig::get(local_user(),'frio', 'schema');
$info=Array(
$info=[
'name' => $schema,
'description' => "",
'author' => array(),
'author' => [],
'version' => "",
'overwrites' => ""
);
];
if (!is_file($themepath . "schema/" . $schema . ".php")) return $info;
@ -51,9 +51,9 @@ function get_schema_info($schema){
if ($k=="author"){
$r=preg_match("|([^<]+)<([^>]+)>|", $v, $m);
if ($r) {
$info['author'][] = array('name'=>$m[1], 'link'=>$m[2]);
$info['author'][] = ['name'=>$m[1], 'link'=>$m[2]];
} else {
$info['author'][] = array('name'=>$v);
$info['author'][] = ['name'=>$v];
}
} elseif ($k == "overwrites") {
$theme_settings = explode(',',str_replace(' ','', $v));

View file

@ -167,7 +167,7 @@ switch ($bg_image_option) {
// Convert transparency level from percentage to opacity value.
$contentbg_transp = $contentbg_transp / 100;
$options = array (
$options = [
'$nav_bg' => $nav_bg,
'$nav_icon_color' => $nav_icon_color,
'$nav_icon_hover_color' => $nav_icon_hover_color,
@ -181,7 +181,7 @@ $options = array (
'$background_image' => $background_image,
'$background_size_img' => $background_size_img,
'$login_bg_image' => $login_bg_image,
);
];
$css_tpl = file_get_contents('view/theme/frio/css/style.css');
@ -211,7 +211,7 @@ header('Last-Modified: '.$modified);
// Only send the CSS file if it was changed.
if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) || isset($_SERVER['HTTP_IF_NONE_MATCH'])) {
$cached_modified = gmdate('r', strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']));
$cached_etag = str_replace(array('"', "-gzip"), array('', ''),
$cached_etag = str_replace(['"', "-gzip"], ['', ''],
stripslashes($_SERVER['HTTP_IF_NONE_MATCH']));
if (($cached_modified == $modified) && ($cached_etag == $etag)) {

View file

@ -94,7 +94,7 @@ function frio_item_photo_links(App $a, &$body_info)
while ($p !== false && ($occurence++ < 500)) {
$link = substr($body_info['html'], $p['start'], $p['end'] - $p['start']);
$matches = array();
$matches = [];
preg_match("/\/photos\/[\w]+\/image\/([\w]+)/", $link, $matches);
if ($matches) {
@ -244,28 +244,28 @@ function frio_remote_nav($a, &$nav)
}
if (DBM::is_result($r)) {
$nav['userinfo'] = array(
$nav['userinfo'] = [
'icon' => (DBM::is_result($r) ? $r[0]['photo'] : "images/person-48.jpg"),
'name' => $r[0]['name'],
);
];
}
if (!local_user() && !empty($server_url)) {
$nav['logout'] = Array($server_url . '/logout', t('Logout'), "", t('End this session'));
$nav['logout'] = [$server_url . '/logout', t('Logout'), "", t('End this session')];
// user menu
$nav['usermenu'][] = Array($server_url . '/profile/' . $a->user['nickname'], t('Status'), "", t('Your posts and conversations'));
$nav['usermenu'][] = Array($server_url . '/profile/' . $a->user['nickname'] . '?tab=profile', t('Profile'), "", t('Your profile page'));
$nav['usermenu'][] = Array($server_url . '/photos/' . $a->user['nickname'], t('Photos'), "", t('Your photos'));
$nav['usermenu'][] = Array($server_url . '/videos/' . $a->user['nickname'], t('Videos'), "", t('Your videos'));
$nav['usermenu'][] = Array($server_url . '/events/', t('Events'), "", t('Your events'));
$nav['usermenu'][] = [$server_url . '/profile/' . $a->user['nickname'], t('Status'), "", t('Your posts and conversations')];
$nav['usermenu'][] = [$server_url . '/profile/' . $a->user['nickname'] . '?tab=profile', t('Profile'), "", t('Your profile page')];
$nav['usermenu'][] = [$server_url . '/photos/' . $a->user['nickname'], t('Photos'), "", t('Your photos')];
$nav['usermenu'][] = [$server_url . '/videos/' . $a->user['nickname'], t('Videos'), "", t('Your videos')];
$nav['usermenu'][] = [$server_url . '/events/', t('Events'), "", t('Your events')];
// navbar links
$nav['network'] = array($server_url . '/network', t('Network'), "", t('Conversations from your friends'));
$nav['events'] = Array($server_url . '/events', t('Events'), "", t('Events and Calendar'));
$nav['messages'] = array($server_url . '/message', t('Messages'), "", t('Private mail'));
$nav['settings'] = array($server_url . '/settings', t('Settings'), "", t('Account settings'));
$nav['contacts'] = array($server_url . '/contacts', t('Contacts'), "", t('Manage/edit friends and contacts'));
$nav['network'] = [$server_url . '/network', t('Network'), "", t('Conversations from your friends')];
$nav['events'] = [$server_url . '/events', t('Events'), "", t('Events and Calendar')];
$nav['messages'] = [$server_url . '/message', t('Messages'), "", t('Private mail')];
$nav['settings'] = [$server_url . '/settings', t('Settings'), "", t('Account settings')];
$nav['contacts'] = [$server_url . '/contacts', t('Contacts'), "", t('Manage/edit friends and contacts')];
$nav['sitename'] = $a->config['sitename'];
}
}
@ -320,7 +320,7 @@ function frio_acl_lookup(App $a, &$results)
intval($_SESSION['uid'])
);
$contacts = array();
$contacts = [];
if (DBM::is_result($r)) {
foreach ($r as $rr) {
@ -346,14 +346,14 @@ function frio_acl_lookup(App $a, &$results)
function frio_display_item(App $a, &$arr)
{
// Add subthread to the item menu
$subthread = array();
$subthread = [];
if (local_user() == $arr['item']['uid'] && $arr['item']['parent'] == $arr['item']['id'] && !$arr['item']['self']) {
$subthread = array(
$subthread = [
'menu' => 'follow_thread',
'title' => t('Follow Thread'),
'action' => 'dosubthread(' . $arr['item']['id'] . '); return false;',
'href' => '#'
);
];
}
$arr['output']['subthread'] = $subthread;
}