web_dor_layout_page_class

The Business Responsive web dor layout page class class.

Defined (1)

The class is defined in the following location(s).

/admin/layout_page.php  
  1. class web_dor_layout_page_class{ 
  2.  
  3. public $themeoptions; 
  4.  
  5. public $shortthemeoptions; 
  6.  
  7. public $layout; 
  8.  
  9. public $options_themeoptions; 
  10.  
  11. function __construct() { 
  12.  
  13. $this->themeoptions = "Layout Editor"; 
  14.  
  15. $this->shortthemeoptions = "gs"; 
  16.  
  17. $this->layout = array( 
  18.  
  19. "1" => "No Sidebar",  
  20.  
  21. "2" => "one right",  
  22.  
  23. "3" => "one left",  
  24.  
  25. "4" => "two right",  
  26.  
  27. "5" => "two left",  
  28.  
  29. "6"=>"one right and one left" 
  30.  
  31. ); 
  32.  
  33. $value_of_std[0]=get_theme_mod($this->shortthemeoptions."_default_layout", 2); 
  34. $value_of_std[1]=get_theme_mod($this->shortthemeoptions."_full_width", "off"); 
  35. $value_of_std[2]=get_theme_mod($this->shortthemeoptions."_content_area", "1024"); 
  36. $value_of_std[3]=get_theme_mod($this->shortthemeoptions."_main_column", "67"); 
  37. $value_of_std[4]=get_theme_mod($this->shortthemeoptions."_pwa_width", "16");  
  38. $this->options_themeoptions = array ( 
  39.  
  40. array(  
  41.  
  42. "name" => "Choose Default Layout",  
  43.  
  44. "desc" => "Here you can select the default layout for pages and posts on the website.",  
  45.  
  46. "id" => $this->shortthemeoptions."_default_layout",  
  47.  
  48. "type" => "radio",  
  49.  
  50. "options" => $this->layout,  
  51.  
  52. "std" => $value_of_std[0] 
  53. ),  
  54.  
  55. array(  
  56.  
  57. "name" => "Full Width",  
  58.  
  59. "desc" => "",  
  60.  
  61. "id" => $this->shortthemeoptions."_full_width",  
  62.  
  63. "type" => "checkbox",  
  64.  
  65. "std" => $value_of_std[1] 
  66. ),  
  67.  
  68. array(  
  69.  
  70. "name" => "Content Area Width",  
  71.  
  72. "desc" => "Specify the width of the Content Area",  
  73.  
  74. "id" => $this->shortthemeoptions."_content_area",  
  75.  
  76. "type" => "text",  
  77.  
  78. "std" => $value_of_std[2] 
  79. ),  
  80.  
  81. array(  
  82.  
  83. "name" => "Main Column Width",  
  84.  
  85. "desc" => "Specify the width of the Main Column",  
  86.  
  87. "id" => $this->shortthemeoptions."_main_column",  
  88.  
  89. "type" => "text",  
  90.  
  91. "std" => $value_of_std[3] 
  92. ),  
  93.  
  94. array(  
  95.  
  96. "name" => "Primary Widget Area width",  
  97.  
  98. "desc" => "Specify the width of the Primary Widget Area",  
  99.  
  100. "id" => $this->shortthemeoptions."_pwa_width",  
  101.  
  102. "type" => "text",  
  103.  
  104. "std" => $value_of_std[4] 
  105. ),  
  106. ); 
  107.  
  108.  
  109.  
  110.  
  111. /// save changes or reset options 
  112. public function web_dorado_theme_update_and_get_options_layout() { 
  113.  
  114. if (isset($_GET['page']) && $_GET['page'] =="web_dorado_theme" && isset($_GET['controller']) && $_GET['controller'] == "layout_page") { 
  115.  
  116. if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'save') { 
  117.  
  118. foreach ($this->options_themeoptions as $value) { 
  119.  
  120. set_theme_mod($value['id'], $_REQUEST[$value['id']]); 
  121.  
  122.  
  123. foreach ($this->options_themeoptions as $value) { 
  124.  
  125. if (isset($_REQUEST[$value['id']])) { 
  126.  
  127. set_theme_mod($value['id'], $_REQUEST[$value['id']]); 
  128.  
  129. } else { 
  130.  
  131. remove_theme_mod($value['id']); 
  132.  
  133.  
  134. header("Location: themes.php?page=web_dorado_theme&controller=layout_page&saved=true"); 
  135. die; 
  136.  
  137. } elseif (isset($_REQUEST['action']) && $_REQUEST['action'] == 'reset') { 
  138.  
  139. foreach ($this->options_themeoptions as $value) { 
  140.  
  141. remove_theme_mod($value['id']); 
  142. header("Location: themes.php?page=web_dorado_theme&controller=layout_page&reset=true"); 
  143. die; 
  144.  
  145.  
  146.  
  147.  
  148.  
  149. public function web_dorado_layout_page_admin_scripts() { 
  150.  
  151. wp_enqueue_style('layout_page_main_style', get_bloginfo('template_directory').'/admin/css/layout_page.css');  
  152.  
  153.  
  154.  
  155. public function dorado_theme_admin_layout() { 
  156.  
  157. // get radio variables 
  158. $radio = $this->get_option_type( 'radio' ); 
  159. $radio_options = $radio[0]['options']; 
  160. $count_radio_options = count( $radio_options ); 
  161.  
  162. // get checkbox variables 
  163. $checkbox=$this->get_option_type( 'checkbox' ); 
  164.  
  165. // get text variables 
  166. $text=$this->get_option_type( 'text' ); 
  167. $count_text = count( $text ); 
  168. if(isset($_REQUEST['controller']) && $_REQUEST['controller']=='layout_page') { 
  169. if (isset($_REQUEST['saved']) && $_REQUEST['saved'] )  
  170.  
  171. echo '<div id="message" class="updated"><p><strong>Layout settings are saved.</strong></p></div>'; 
  172.  
  173. if (isset($_REQUEST['reset']) && $_REQUEST['reset'] )  
  174.  
  175. echo '<div id="message" class="updated"><p><strong>Layout settings are reset.</strong></p></div>'; 
  176. ?> 
  177.  
  178. <div id="main_layout_page"> 
  179. <form method="post" action="themes.php?page=web_dorado_theme&controller=layout_page"> 
  180. <table align="center" width="90%" style="margin-top: 0px;border-bottom: rgb(111, 111, 111) solid 2px;"> 
  181. <tbody> 
  182. <tr>  
  183. <td style="font-size:14px; font-weight:bold"> 
  184. <a href="http://web-dorado.com/wordpress-themes-guide-step-1.html" target="_blank" style="color:#126094; text-decoration:none;">User Manual</a><br />This section allows you to make changes in default layout of the theme. 
  185. <a href="http://web-dorado.com/wordpress-theme-options/3-2.html" target="_blank" style="color:#126094; text-decoration:none;">More...</a> 
  186. </td>  
  187. <td align="right" style="font-size:16px;"> 
  188. <a href="http://web-dorado.com/wordpress-themes/business-responsive.html" target="_blank" style="color:red; text-decoration:none;"> 
  189. <img src="<?php echo get_template_directory_uri() ?>/images/header.png" border="0" alt="" width="215"><br> 
  190. Get the full version     
  191. </a> 
  192. </td> 
  193. </tr> 
  194. <tr> 
  195. <td> 
  196. <h3 style="margin: 0px;font-family:Segoe UI;padding-bottom: 15px;color: rgb(111, 111, 111); font-size:18pt;">Layout Editor</h3> 
  197. </td>  
  198. </tr> 
  199. </tbody> 
  200. </table> 
  201. <table align="center" width="90%" style=" padding-bottom:0px;padding-top:0px;"> 
  202. <tbody> 
  203. <tr> 
  204. <td> 
  205. <div class="optiontitle first"><h3><?php echo $radio[0]['name']; ?></h3></div> 
  206. <div class="optiondescreption"><p><?php echo $radio[0]['desc']; ?></p></div> 
  207. <div class="options_input options_select"></div> 
  208. <table width="100%"> 
  209. <tbody> 
  210. <tr> 
  211. <?php for($i=0;$i<$count_radio_options;$i++) { ?> 
  212. <td> 
  213. <div style="width:50px; height:49px; background:url(<?php echo get_template_directory_uri(); ?>/images/sprite-layouts.png) no-repeat 0 <?php echo -$i*48; ?>px;"></div> 
  214. <input type="radio" <?php echo $this->echo_cheched_option($radio[0]['std'], $i+1); ?> name="<?php echo $radio[0]['id'] ?>" value="<?php echo $i+1; ?>" > 
  215. <br> 
  216. </td> 
  217. <?php } ?> 
  218. </tr> 
  219. </tbody> 
  220. </table> 
  221. <div> 
  222. <div class="optiontitle" style=""> 
  223. <p style="font-size:15px;font-weight:bold;color: #333;">The layout customization parameters are disabled in free version. Please buy the commercial version in order to enable this functionality.</p> 
  224. <img src="<?php echo get_template_directory_uri(); ?>/images/layout.PNG" width="100%" style="border-bottom: 1px solid rgb(206, 206, 206);"> 
  225. </div> 
  226.  
  227. </div> 
  228. </td> 
  229. </tr> 
  230. </tbody> 
  231. </table> 
  232. <br> 
  233. <p class="submit" style="float:left; margin-left: 63px; margin-right: 8px;"> 
  234. <input class="button" name="save" type="submit" value="Save changes"> 
  235. <input type="hidden" name="action" value="save"> 
  236. </p> 
  237. </form> 
  238. <form method="post" action="themes.php?page=web_dorado_theme&controller=layout_page"> 
  239. <p class="submit" style="float:left"> 
  240. <input class="button" name="reset" type="submit" value="Reset"> 
  241. <input type="hidden" name="action" value="reset"> 
  242. </p> 
  243. </form> 
  244. </div> 
  245.  
  246. <?php 
  247.  
  248. /// get one type elements 
  249.  
  250. private function get_option_type($type) { 
  251. $cur_type_elements=array(); 
  252. $k=0; 
  253. foreach( $this->options_themeoptions as $option ) { 
  254.  
  255. if( $option['type'] == $type ) { 
  256.  
  257. $cur_type_elements[$k]=$option; 
  258. $k++; 
  259.  
  260. return $cur_type_elements; 
  261.  
  262. private function echo_cheched_option($value_base, $value) { 
  263.  
  264.  
  265. checked( $value_base, $value );  
  266.  
  267. return ''; 
  268.  
  269.  
  270.