aboutsummaryrefslogtreecommitdiffstats
path: root/lib/template.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/template.php')
-rw-r--r--lib/template.php80
1 files changed, 40 insertions, 40 deletions
diff --git a/lib/template.php b/lib/template.php
index 2359bd50c46..8c872a2059b 100644
--- a/lib/template.php
+++ b/lib/template.php
@@ -30,7 +30,7 @@
*
* For further information have a look at OC_Helper::linkTo
*/
-function link_to( $app, $file, $args = array() ){
+function link_to( $app, $file, $args = array() ) {
return OC_Helper::linkTo( $app, $file, $args );
}
@@ -42,7 +42,7 @@ function link_to( $app, $file, $args = array() ){
*
* For further information have a look at OC_Helper::imagePath
*/
-function image_path( $app, $image ){
+function image_path( $app, $image ) {
return OC_Helper::imagePath( $app, $image );
}
@@ -53,7 +53,7 @@ function image_path( $app, $image ){
*
* For further information have a look at OC_Helper::mimetypeIcon
*/
-function mimetype_icon( $mimetype ){
+function mimetype_icon( $mimetype ) {
return OC_Helper::mimetypeIcon( $mimetype );
}
@@ -64,7 +64,7 @@ function mimetype_icon( $mimetype ){
*
* For further information have a look at OC_Helper::humanFileSize
*/
-function human_file_size( $bytes ){
+function human_file_size( $bytes ) {
return OC_Helper::humanFileSize( $bytes );
}
@@ -99,25 +99,25 @@ function relative_modified_date($timestamp) {
}
function html_select_options($options, $selected, $params=array()) {
- if (!is_array($selected)){
+ if (!is_array($selected)) {
$selected=array($selected);
}
- if (isset($params['combine']) && $params['combine']){
+ if (isset($params['combine']) && $params['combine']) {
$options = array_combine($options, $options);
}
$value_name = $label_name = false;
- if (isset($params['value'])){
+ if (isset($params['value'])) {
$value_name = $params['value'];
}
- if (isset($params['label'])){
+ if (isset($params['label'])) {
$label_name = $params['label'];
}
$html = '';
- foreach($options as $value => $label){
- if ($value_name && is_array($label)){
+ foreach($options as $value => $label) {
+ if ($value_name && is_array($label)) {
$value = $label[$value_name];
}
- if ($label_name && is_array($label)){
+ if ($label_name && is_array($label)) {
$label = $label[$label_name];
}
$select = in_array($value, $selected) ? ' selected="selected"' : '';
@@ -150,7 +150,7 @@ class OC_Template{
* according layout. For now, renderas can be set to "guest", "user" or
* "admin".
*/
- public function __construct( $app, $name, $renderas = "" ){
+ public function __construct( $app, $name, $renderas = "" ) {
// Set the private data
$this->renderas = $renderas;
$this->application = $app;
@@ -175,14 +175,14 @@ class OC_Template{
* sidebar, just the application. Useful to use just a specific
* app on the desktop in a standalone window.
*/
- public static function detectFormfactor(){
+ public static function detectFormfactor() {
// please add more useragent strings for other devices
- if(isset($_SERVER['HTTP_USER_AGENT'])){
+ if(isset($_SERVER['HTTP_USER_AGENT'])) {
if(stripos($_SERVER['HTTP_USER_AGENT'],'ipad')>0) {
$mode='tablet';
- }elseif(stripos($_SERVER['HTTP_USER_AGENT'],'iphone')>0){
+ }elseif(stripos($_SERVER['HTTP_USER_AGENT'],'iphone')>0) {
$mode='mobile';
- }elseif((stripos($_SERVER['HTTP_USER_AGENT'],'N9')>0) and (stripos($_SERVER['HTTP_USER_AGENT'],'nokia')>0)){
+ }elseif((stripos($_SERVER['HTTP_USER_AGENT'],'N9')>0) and (stripos($_SERVER['HTTP_USER_AGENT'],'nokia')>0)) {
$mode='mobile';
}else{
$mode='default';
@@ -201,11 +201,11 @@ class OC_Template{
// if the formfactor is not yet autodetected do the
// autodetection now. For possible formfactors check the
// detectFormfactor documentation
- if(!isset($_SESSION['formfactor'])){
+ if(!isset($_SESSION['formfactor'])) {
$_SESSION['formfactor'] = self::detectFormfactor();
}
// allow manual override via GET parameter
- if(isset($_GET['formfactor'])){
+ if(isset($_GET['formfactor'])) {
$_SESSION['formfactor']=$_GET['formfactor'];
}
$formfactor=$_SESSION['formfactor'];
@@ -240,9 +240,9 @@ class OC_Template{
$app = $this->application;
// Check if it is a app template or not.
- if( $app != "" ){
+ if( $app != "" ) {
// Check if the app is in the app folder or in the root
- if( file_exists(OC_App::getAppPath($app)."/templates/" )){
+ if( file_exists(OC_App::getAppPath($app)."/templates/" )) {
// Check if the template is overwritten by the selected theme
if ($this->checkPathForTemplate(OC::$SERVERROOT."/themes/$theme/apps/$app/templates/", $name, $fext)) {
}elseif ($this->checkPathForTemplate(OC_App::getAppPath($app)."/templates/", $name, $fext)) {
@@ -282,9 +282,9 @@ class OC_Template{
{
if ($name =='') return false;
$template = null;
- if( is_file( $path.$name.$fext.'.php' )){
+ if( is_file( $path.$name.$fext.'.php' )) {
$template = $path.$name.$fext.'.php';
- }elseif( is_file( $path.$name.'.php' )){
+ }elseif( is_file( $path.$name.'.php' )) {
$template = $path.$name.'.php';
}
if ($template) {
@@ -307,7 +307,7 @@ class OC_Template{
*
* If the key existed before, it will be overwritten
*/
- public function assign( $key, $value, $sanitizeHTML=true ){
+ public function assign( $key, $value, $sanitizeHTML=true ) {
if($sanitizeHTML == true) $value=OC_Util::sanitizeHTML($value);
$this->vars[$key] = $value;
return true;
@@ -323,8 +323,8 @@ class OC_Template{
* exists, the value will be appended. It can be accessed via
* $_[$key][$position] in the template.
*/
- public function append( $key, $value ){
- if( array_key_exists( $key, $this->vars )){
+ public function append( $key, $value ) {
+ if( array_key_exists( $key, $this->vars )) {
$this->vars[$key][] = $value;
}
else{
@@ -338,7 +338,7 @@ class OC_Template{
* @param array $attributes array of attrobutes for the element
* @param string $text the text content for the element
*/
- public function addHeader( $tag, $attributes, $text=''){
+ public function addHeader( $tag, $attributes, $text='') {
$this->headers[]=array('tag'=>$tag,'attributes'=>$attributes,'text'=>$text);
}
@@ -348,9 +348,9 @@ class OC_Template{
*
* This function proceeds the template and prints its output.
*/
- public function printPage(){
+ public function printPage() {
$data = $this->fetchPage();
- if( $data === false ){
+ if( $data === false ) {
return false;
}
else{
@@ -366,10 +366,10 @@ class OC_Template{
* This function proceeds the template. If $this->renderas is set, it
* will produce a full page.
*/
- public function fetchPage(){
+ public function fetchPage() {
$data = $this->_fetch();
- if( $this->renderas ){
+ if( $this->renderas ) {
$page = new OC_TemplateLayout($this->renderas);
if($this->renderas == 'user') {
$page->assign('requesttoken', $this->vars['requesttoken']);
@@ -377,7 +377,7 @@ class OC_Template{
// Add custom headers
$page->assign('headers',$this->headers, false);
- foreach(OC_Util::$headers as $header){
+ foreach(OC_Util::$headers as $header) {
$page->append('headers',$header);
}
@@ -395,7 +395,7 @@ class OC_Template{
*
* Includes the template file, fetches its output
*/
- private function _fetch(){
+ private function _fetch() {
// Register the variables
$_ = $this->vars;
$l = $this->l10n;
@@ -417,12 +417,12 @@ class OC_Template{
* Includes another template. use <?php echo $this->inc('template'); ?> to
* do this.
*/
- public function inc( $file, $additionalparams = null ){
+ public function inc( $file, $additionalparams = null ) {
// $_ erstellen
$_ = $this->vars;
$l = $this->l10n;
- if( !is_null($additionalparams)){
+ if( !is_null($additionalparams)) {
$_ = array_merge( $additionalparams, $this->vars );
}
@@ -443,9 +443,9 @@ class OC_Template{
* @param $parameters Parameters for the template
* @returns true/false
*/
- public static function printUserPage( $application, $name, $parameters = array() ){
+ public static function printUserPage( $application, $name, $parameters = array() ) {
$content = new OC_Template( $application, $name, "user" );
- foreach( $parameters as $key => $value ){
+ foreach( $parameters as $key => $value ) {
$content->assign( $key, $value, false );
}
print $content->printPage();
@@ -458,9 +458,9 @@ class OC_Template{
* @param $parameters Parameters for the template
* @returns true/false
*/
- public static function printAdminPage( $application, $name, $parameters = array() ){
+ public static function printAdminPage( $application, $name, $parameters = array() ) {
$content = new OC_Template( $application, $name, "admin" );
- foreach( $parameters as $key => $value ){
+ foreach( $parameters as $key => $value ) {
$content->assign( $key, $value, false );
}
return $content->printPage();
@@ -473,9 +473,9 @@ class OC_Template{
* @param $parameters Parameters for the template
* @returns true/false
*/
- public static function printGuestPage( $application, $name, $parameters = array() ){
+ public static function printGuestPage( $application, $name, $parameters = array() ) {
$content = new OC_Template( $application, $name, "guest" );
- foreach( $parameters as $key => $value ){
+ foreach( $parameters as $key => $value ) {
$content->assign( $key, $value, false );
}
return $content->printPage();