]> git.mxchange.org Git - friendica.git/blob - view/theme/frio/php/frio_boot.php
Merge branch 'master' of ../save/merge/frio into frio_merge
[friendica.git] / view / theme / frio / php / frio_boot.php
1 <?php
2
3 /**
4  * @file view/theme/frio/php/frio_boot.php
5  * 
6  * @brief This file contains functions for page contstruction
7  * 
8  */
9
10
11 /**
12  * @brief Load page template in dependence of the template mode
13  * 
14  * @todo Check if this is really needed.
15  */
16 function load_page(&$a) {
17         if(isset($_GET["mode"]) AND ($_GET["mode"] == "minimal")) {
18                 require "view/theme/frio/minimal.php";
19         } elseif((isset($_GET["mode"]) AND ($_GET["mode"] == "none"))) {
20                 require "view/theme/frio/none.php";
21         } else {
22                 $template = 'view/theme/' . current_theme() . '/'
23                         . ((x($a->page,'template')) ? $a->page['template'] : 'default' ) . '.php';
24                 if(file_exists($template))
25                         require_once($template);
26                 else
27                         require_once(str_replace('theme/' . current_theme() . '/', '', $template));
28         }
29
30         
31 }
32
33
34 /**
35  * @brief Check if page is a modal page
36  * 
37  * This function checks if $_REQUEST['pagename'] is
38  * a defined in a $modalpages
39  * 
40  * @return bool
41  */
42 function is_modal() {
43         $is_modal = false;
44         $modalpages = get_modalpage_list();
45
46         foreach ($modalpages as $r => $value) {
47                 if(strpos($_REQUEST['pagename'],$value) !== false) {
48                         $is_modal = true;
49                 }
50         }
51         
52         return $is_modal;
53 }
54
55 /**
56  * @brief Array with modalpages
57  * 
58  * The array contains the page names of the pages
59  * which should displayed as modals
60  * 
61  * @return array Pagenames as path
62  */
63 function get_modalpage_list() {
64         //Arry of pages wich getting bootstrap modal dialogs
65         $modalpages = array('poke/',
66                         'message/new',
67                         'settings/oauth/add',
68                         'events/new',
69 //                      'fbrowser/image/'
70         );
71
72         return $modalpages;
73 }
74
75 /**
76  * @brief Array with standard pages
77  * 
78  * The array contains the page names of the pages
79  * which should displayed as standard-page
80  * 
81  * @return array Pagenames as path
82  */
83 function get_standard_page_list() {
84         //Arry of pages wich getting the standard page template
85         $standardpages = array(//'profile',
86 //                      'fbrowser/image/'
87         );
88
89         return $standardpages;
90 }
91
92 /**
93  * @brief Check if page is standard page
94  * 
95  * This function checks if $_REQUEST['pagename'] is
96  * a defined $standardpages
97  * 
98  * @param string $pagetitle Title of the actual page
99  * @return bool
100  */
101 function is_standard_page($pagetitle) {
102         $is_standard_page = false;
103         $standardpages = get_standard_page_list();
104
105         foreach ($standardpages as $r => $value) {
106                 if(strpos($pagetitle,$value) !== false) {
107                         $is_standard_page = true;
108                 }
109         }
110         
111         return $is_standard_page;
112 }
113 /**
114  * @brief Get the typ of the page
115  * 
116  * @param type $pagetitle
117  * @return string
118  */
119 function get_page_type($pagetitle) {
120         $page_type = "";
121
122         if(is_modal())
123                 $page_type = "modal";
124
125         if(is_standard_page($pagetitle))
126                 $page_type = "standard_page";
127
128         if($page_type)
129                 return $page_type;
130
131 }