web_dor_color_control_page_class

The Business Responsive web dor color control page class class.

Defined (1)

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

/admin/color_control.php  
  1. class web_dor_color_control_page_class{ 
  2.  
  3. public $colorcontrol; 
  4. public $shortcolorcontrol; 
  5. public $options_colorcontrol; 
  6.  
  7. function __construct() { 
  8. $this->colorcontrol = "Color Control"; 
  9. $this->shortcolorcontrol = "cc"; 
  10.  
  11. $value_of_std[0]=get_theme_mod($this->shortcolorcontrol."_head_elem_back_color", '#e8e8e8'); 
  12. $value_of_std[1]=get_theme_mod($this->shortcolorcontrol."_content_back_color", '#ececec'); 
  13. $value_of_std[2]=get_theme_mod($this->shortcolorcontrol."_shadow_background_color", '#ffffff'); 
  14. $value_of_std[3]=get_theme_mod($this->shortcolorcontrol."_footer_back_color", '#ececec'); 
  15. $value_of_std[4]=get_theme_mod($this->shortcolorcontrol."_text_headers_color", '#1f1f1f'); 
  16. $value_of_std[5]=get_theme_mod($this->shortcolorcontrol."_primary_text_color", '#1f1f1f'); 
  17. $value_of_std[6]=get_theme_mod($this->shortcolorcontrol."_footer_text_color", '#1f1f1f'); 
  18. $value_of_std[7]=get_theme_mod($this->shortcolorcontrol."_primary_links_color", '#575757'); 
  19. $value_of_std[8]=get_theme_mod($this->shortcolorcontrol."_primary_links_hover_color", '#ffffff'); 
  20. $value_of_std[9]=get_theme_mod($this->shortcolorcontrol."_menu_color", '#dd9100'); 
  21. $value_of_std[10]=get_theme_mod($this->shortcolorcontrol."_selected_menu_color", '#dd9100'); 
  22. $value_of_std[11]=get_theme_mod($this->shortcolorcontrol."_color_scheme", '#E0E0E0');  
  23.  
  24.  
  25. $this->options_colorcontrol = array( 
  26. array( 
  27.  
  28. "name" => "Header Element Backround ",  
  29.  
  30. "desc" => "",  
  31.  
  32. "id" => $this->shortcolorcontrol . "_head_elem_back_color",  
  33.  
  34. "type" => "picker",  
  35.  
  36. "std" => $value_of_std[0] 
  37. ),  
  38.  
  39. array( 
  40.  
  41. "name" => "Body Background",  
  42.  
  43. "desc" => "",  
  44.  
  45. "id" => $this->shortcolorcontrol . "_content_back_color",  
  46.  
  47. "type" => "picker",  
  48.  
  49. "std" => $value_of_std[1] 
  50.  
  51. ),  
  52.  
  53. array( 
  54.  
  55. "name" => "Slider Background",  
  56.  
  57. "desc" => "",  
  58.  
  59. "id" => $this->shortcolorcontrol . "_shadow_background_color",  
  60.  
  61. "type" => "picker",  
  62.  
  63. "std" => $value_of_std[2] 
  64. ),  
  65.  
  66. array( 
  67.  
  68. "name" => "Footer Background",  
  69.  
  70. "desc" => "",  
  71.  
  72. "id" => $this->shortcolorcontrol . "_footer_back_color",  
  73.  
  74. "type" => "picker",  
  75.  
  76. "std" => $value_of_std[3] 
  77. ),  
  78.  
  79. array( 
  80.  
  81. "name" => "Header Text",  
  82.  
  83. "desc" => "",  
  84.  
  85. "id" => $this->shortcolorcontrol . "_text_headers_color",  
  86.  
  87. "type" => "picker",  
  88.  
  89. "std" => $value_of_std[4] 
  90. ),  
  91.  
  92.  
  93.  
  94. array( 
  95.  
  96. "name" => "Primary Text",  
  97.  
  98. "desc" => "",  
  99.  
  100. "id" => $this->shortcolorcontrol . "_primary_text_color",  
  101.  
  102. "type" => "picker",  
  103.  
  104. "std" => $value_of_std[5] 
  105. ),  
  106.  
  107. array( 
  108.  
  109. "name" => "Footer Text",  
  110.  
  111. "desc" => "",  
  112.  
  113. "id" => $this->shortcolorcontrol . "_footer_text_color",  
  114.  
  115. "type" => "picker",  
  116.  
  117. "std" => $value_of_std[6] 
  118. ),  
  119.  
  120.  
  121.  
  122. array( 
  123.  
  124. "name" => "Primary Links",  
  125.  
  126. "desc" => "",  
  127.  
  128. "id" => $this->shortcolorcontrol . "_primary_links_color",  
  129.  
  130. "type" => "picker",  
  131.  
  132. "std" => $value_of_std[7] 
  133. ),  
  134.  
  135. array( 
  136.  
  137. "name" => "Primary Links Hover",  
  138.  
  139. "desc" => "",  
  140.  
  141. "id" => $this->shortcolorcontrol . "_primary_links_hover_color",  
  142.  
  143. "type" => "picker",  
  144.  
  145. "std" => $value_of_std[8] 
  146. ),  
  147.  
  148.  
  149.  
  150. array( 
  151.  
  152. "name" => "Hover Menu Item",  
  153.  
  154. "desc" => "",  
  155.  
  156. "id" => $this->shortcolorcontrol . "_menu_color",  
  157.  
  158. "type" => "picker",  
  159.  
  160. "std" => $value_of_std[9] 
  161. ),  
  162.  
  163. array( 
  164.  
  165. "name" => "Selected Menu Item",  
  166.  
  167. "desc" => "",  
  168.  
  169. "id" => $this->shortcolorcontrol . "_selected_menu_color",  
  170.  
  171. "type" => "picker",  
  172.  
  173. "std" => $value_of_std[10] 
  174. ),  
  175.  
  176. array( 
  177.  
  178. "name" => " ",  
  179.  
  180. "id" => $this->shortcolorcontrol . "_color_scheme",  
  181.  
  182. "std" => $value_of_std[11] 
  183. ),  
  184.  
  185.  
  186.  
  187. ); 
  188.  
  189.  
  190.  
  191.  
  192.  
  193. /// save changes or reset options 
  194. public function web_dorado_theme_update_and_get_options_color_control() { 
  195.  
  196. if ( isset($_GET['page']) && $_GET['page'] == "web_dorado_theme" && isset($_GET['controller']) && $_GET['controller'] == "color_control_page") { 
  197.  
  198. if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'save' ) { 
  199. foreach ($this->options_colorcontrol as $value) { 
  200. set_theme_mod($value['id'], $_REQUEST[$value['id']]); 
  201.  
  202. foreach ($this->options_colorcontrol as $value) { 
  203. if (isset($_REQUEST[$value['id']])) { 
  204. set_theme_mod($value['id'], $_REQUEST[$value['id']]); 
  205. } else { 
  206. remove_theme_mod($value['id']); 
  207. header("Location: themes.php?page=web_dorado_theme&controller=color_control_page&saved=true"); 
  208. die; 
  209. } else if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'reset' ) { 
  210. foreach ($this->options_colorcontrol as $value) { 
  211. remove_theme_mod($value['id']); 
  212. header("Location: themes.php?page=web_dorado_theme&controller=color_control_page&reset=true"); 
  213. die; 
  214. }  
  215.  
  216. public function web_dorado_color_control_page_admin_scripts() { 
  217.  
  218. wp_enqueue_style('color_control_page_main_style', get_bloginfo('template_directory').'/admin/css/color_control.css');  
  219. wp_enqueue_style('color_control_picker', get_bloginfo('template_directory').'/pickercss/colorpicker.css'); 
  220. wp_enqueue_script('jquery'); 
  221. wp_enqueue_script('picker_1', get_template_directory_uri().'/pickerjs/colorpicker.js'); 
  222. wp_enqueue_script('picker_2', get_template_directory_uri().'/pickerjs/eye.js'); 
  223. wp_enqueue_script('picker_3', get_template_directory_uri().'/pickerjs/utils.js'); 
  224. wp_enqueue_script('picker_5', get_template_directory_uri().'/pickerjs/layout.js');  
  225. wp_enqueue_script('picker_4', get_template_directory_uri().'/pickerjs/my.js'); 
  226.  
  227.  
  228.  
  229. public function dorado_theme_admin_color_control() { 
  230. if(isset($_REQUEST['controller']) && $_REQUEST['controller']=='color_control_page') { 
  231. if (isset($_REQUEST['saved']) && $_REQUEST['saved'] )  
  232.  
  233. echo '<div id="message" class="updated"><p><strong>' . $this->colorcontrol . ' settings saved.</strong></p></div>'; 
  234.  
  235. if (isset($_REQUEST['reset']) && $_REQUEST['reset'] )  
  236.  
  237. echo '<div id="message" class="updated"><p><strong>' . $this->colorcontrol . ' settings reset.</strong></p></div>'; 
  238. $pickers=$this->get_option_type('picker'); 
  239. $count_picker=count( $pickers ); 
  240. ?> 
  241. <script> 
  242. jQuery(function () { 
  243. jQuery("#cc_color_scheme").change(function () { 
  244. var bkg = jQuery("#cc_color_scheme option:selected").val(); 
  245. if (bkg == "Theme-2") {  
  246. jQuery("#cc_footer_back_color").val("#ececec"); 
  247. jQuery("#cc_footer_back_color").css('backgroundColor', '#ececec'); 
  248. jQuery("#cc_footer_back_color_picker").children('div').css('backgroundColor', '#ececec'); 
  249. jQuery("#cc_content_back_color").val("#ececec"); 
  250. jQuery("#cc_content_back_color").css('backgroundColor', '#ececec'); 
  251. jQuery("#cc_content_back_color_picker").children('div').css('backgroundColor', '#ececec'); 
  252. jQuery("#cc_primary_text_color").val("#1f1f1f"); 
  253. jQuery("#cc_primary_text_color").css('backgroundColor', '#1f1f1f'); 
  254. jQuery("#cc_primary_text_color_picker").children('div').css('backgroundColor', '#1f1f1f'); 
  255. jQuery("#cc_text_headers_color").val("#1f1f1f"); 
  256. jQuery("#cc_text_headers_color").css('backgroundColor', '#1f1f1f'); 
  257. jQuery("#cc_text_headers_color_picker").children('div').css('backgroundColor', '#1f1f1f'); 
  258. jQuery("#cc_primary_links_color").val("#575757"); 
  259. jQuery("#cc_primary_links_color").css('backgroundColor', '#575757'); 
  260. jQuery("#cc_primary_links_color_picker").children('div').css('backgroundColor', '#575757'); 
  261. jQuery("#cc_primary_links_hover_color").val("#ffffff"); 
  262. jQuery("#cc_primary_links_hover_color").css('backgroundColor', '#ffffff'); 
  263. jQuery("#cc_primary_links_hover_color_picker").children('div').css('backgroundColor', '#ffffff'); 
  264. jQuery("#cc_footer_text_color").val("#1f1f1f"); 
  265. jQuery("#cc_footer_text_color").css('backgroundColor', '#1f1f1f'); 
  266. jQuery("#cc_footer_text_color_picker").children('div').css('backgroundColor', '#1f1f1f'); 
  267. jQuery("#cc_menu_color").val("#029ee1"); 
  268. jQuery("#cc_menu_color").css('backgroundColor', '#029ee1'); 
  269. jQuery("#cc_menu_color_picker").children('div').css('backgroundColor', '#029ee1'); 
  270. jQuery("#cc_selected_menu_color").val("#029ee1"); 
  271. jQuery("#cc_selected_menu_color").css('backgroundColor', '#029ee1'); 
  272. jQuery("#cc_selected_menu_color_picker").children('div').css('backgroundColor', '#029ee1'); 
  273. jQuery("#cc_shadow_background_color").val("#ffffff"); 
  274. jQuery("#cc_shadow_background_color").css('backgroundColor', '#ffffff'); 
  275. jQuery("#cc_shadow_background_color_picker").children('div').css('backgroundColor', '#ffffff'); 
  276. jQuery("#cc_head_elem_back_color").val("#e8e8e8"); 
  277. jQuery("#cc_head_elem_back_color").css('backgroundColor', '#e8e8e8'); 
  278. jQuery("#cc_head_elem_back_color_picker").children('div').css('backgroundColor', '#e8e8e8'); 
  279. if (bkg == "Theme-1") {  
  280. jQuery("#cc_footer_back_color").val("#ececec"); 
  281. jQuery("#cc_footer_back_color").css('backgroundColor', '#ececec'); 
  282. jQuery("#cc_footer_back_color_picker").children('div').css('backgroundColor', '#ececec'); 
  283. jQuery("#cc_content_back_color").val("#ececec"); 
  284. jQuery("#cc_content_back_color").css('backgroundColor', '#ececec'); 
  285. jQuery("#cc_content_back_color_picker").children('div').css('backgroundColor', '#ececec'); 
  286. jQuery("#cc_primary_text_color").val("#1f1f1f"); 
  287. jQuery("#cc_primary_text_color").css('backgroundColor', '#1f1f1f'); 
  288. jQuery("#cc_primary_text_color_picker").children('div').css('backgroundColor', '#1f1f1f'); 
  289. jQuery("#cc_text_headers_color").val("#1f1f1f"); 
  290. jQuery("#cc_text_headers_color").css('backgroundColor', '#1f1f1f'); 
  291. jQuery("#cc_text_headers_color_picker").children('div').css('backgroundColor', '#1f1f1f'); 
  292. jQuery("#cc_primary_links_color").val("#575757"); 
  293. jQuery("#cc_primary_links_color").css('backgroundColor', '#575757'); 
  294. jQuery("#cc_primary_links_color_picker").children('div').css('backgroundColor', '#575757'); 
  295. jQuery("#cc_primary_links_hover_color").val("#ffffff"); 
  296. jQuery("#cc_primary_links_hover_color").css('backgroundColor', '#ffffff'); 
  297. jQuery("#cc_primary_links_hover_color_picker").children('div').css('backgroundColor', '#ffffff'); 
  298. jQuery("#cc_footer_text_color").val("#1f1f1f"); 
  299. jQuery("#cc_footer_text_color").css('backgroundColor', '#1f1f1f'); 
  300. jQuery("#cc_footer_text_color_picker").children('div').css('backgroundColor', '#1f1f1f'); 
  301. jQuery("#cc_menu_color").val("#dd9100"); 
  302. jQuery("#cc_menu_color").css('backgroundColor', '#dd9100'); 
  303. jQuery("#cc_menu_color_picker").children('div').css('backgroundColor', '#dd9100'); 
  304. jQuery("#cc_selected_menu_color").val("#dd9100"); 
  305. jQuery("#cc_selected_menu_color").css('backgroundColor', '#dd9100'); 
  306. jQuery("#cc_selected_menu_color_picker").children('div').css('backgroundColor', '#dd9100'); 
  307. jQuery("#cc_shadow_background_color").val("#ffffff"); 
  308. jQuery("#cc_shadow_background_color").css('backgroundColor', '#ffffff'); 
  309. jQuery("#cc_shadow_background_color_picker").children('div').css('backgroundColor', '#ffffff'); 
  310. jQuery("#cc_head_elem_back_color").val("#e8e8e8"); 
  311. jQuery("#cc_head_elem_back_color").css('backgroundColor', '#e8e8e8'); 
  312. jQuery("#cc_head_elem_back_color_picker").children('div').css('backgroundColor', '#e8e8e8'); 
  313. if (bkg == "Theme-3") { 
  314. jQuery("#cc_footer_back_color").val("#ececec"); 
  315. jQuery("#cc_footer_back_color").css('backgroundColor', '#ececec'); 
  316. jQuery("#cc_footer_back_color_picker").children('div').css('backgroundColor', '#ececec'); 
  317. jQuery("#cc_content_back_color").val("#ececec"); 
  318. jQuery("#cc_content_back_color").css('backgroundColor', '#ececec'); 
  319. jQuery("#cc_content_back_color_picker").children('div').css('backgroundColor', '#ececec'); 
  320. jQuery("#cc_primary_text_color").val("#1f1f1f"); 
  321. jQuery("#cc_primary_text_color").css('backgroundColor', '#1f1f1f'); 
  322. jQuery("#cc_primary_text_color_picker").children('div').css('backgroundColor', '#1f1f1f'); 
  323. jQuery("#cc_text_headers_color").val("#1f1f1f"); 
  324. jQuery("#cc_text_headers_color").css('backgroundColor', '#1f1f1f'); 
  325. jQuery("#cc_text_headers_color_picker").children('div').css('backgroundColor', '#1f1f1f'); 
  326. jQuery("#cc_primary_links_color").val("#575757"); 
  327. jQuery("#cc_primary_links_color").css('backgroundColor', '#575757'); 
  328. jQuery("#cc_primary_links_color_picker").children('div').css('backgroundColor', '#575757'); 
  329. jQuery("#cc_primary_links_hover_color").val("#ffffff"); 
  330. jQuery("#cc_primary_links_hover_color").css('backgroundColor', '#ffffff'); 
  331. jQuery("#cc_primary_links_hover_color_picker").children('div').css('backgroundColor', '#ffffff'); 
  332. jQuery("#cc_footer_text_color").val("#1f1f1f"); 
  333. jQuery("#cc_footer_text_color").css('backgroundColor', '#1f1f1f'); 
  334. jQuery("#cc_footer_text_color_picker").children('div').css('backgroundColor', '#1f1f1f'); 
  335. jQuery("#cc_menu_color").val("#018a24"); 
  336. jQuery("#cc_menu_color").css('backgroundColor', '#018a24'); 
  337. jQuery("#cc_menu_color_picker").children('div').css('backgroundColor', '#018a24'); 
  338. jQuery("#cc_selected_menu_color").val("#018a24"); 
  339. jQuery("#cc_selected_menu_color").css('backgroundColor', '#018a24'); 
  340. jQuery("#cc_selected_menu_color_picker").children('div').css('backgroundColor', '#018a24'); 
  341. jQuery("#cc_shadow_background_color").val("#ffffff"); 
  342. jQuery("#cc_shadow_background_color").css('backgroundColor', '#ffffff'); 
  343. jQuery("#cc_shadow_background_color_picker").children('div').css('backgroundColor', '#ffffff'); 
  344. jQuery("#cc_head_elem_back_color").val("#e8e8e8"); 
  345. jQuery("#cc_head_elem_back_color").css('backgroundColor', '#e8e8e8'); 
  346. jQuery("#cc_head_elem_back_color_picker").children('div').css('backgroundColor', '#e8e8e8'); 
  347. }); 
  348. }); 
  349. </script> 
  350.  
  351. <div id="main_color_control_page">  
  352. <table align="center" width="90%" style="margin-top: 0px;border-bottom: rgb(111, 111, 111) solid 2px;"> 
  353. <tr>  
  354. <td style="font-size:14px; font-weight:bold"> 
  355. <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 customize the color features. 
  356. <a href="http://web-dorado.com/wordpress-theme-options/3-6.html" target="_blank" style="color:#126094; text-decoration:none;">More...</a> 
  357. </td>  
  358. <td align="right" style="font-size:16px;"> 
  359. <a href="http://web-dorado.com/wordpress-themes/business-responsive.html" target="_blank" style="color:red; text-decoration:none;"> 
  360. <img src="<?php echo get_template_directory_uri() ?>/images/header.png" border="0" alt="" width="215"><br> 
  361. Get the full version     
  362. </a> 
  363. </td> 
  364. </tr> 
  365. <tr> 
  366. <td style="height: 70px;"><h3 style="margin: 0px;font-family:Segoe UI;color: rgb(111, 111, 111); font-size:18pt;">Color Control</h3></td> 
  367. </tr> 
  368. </table>  
  369. <form method="post" action="themes.php?page=web_dorado_theme&controller=color_control_page"> 
  370. <table align="center" width="90%" style=" padding-bottom:0px; padding-top:0px;"> 
  371. <tr> 
  372. <td colspan="4"> 
  373. <div class="optiontitle"> 
  374. <h3>Color Scheme</h3> 
  375. </div> 
  376. <div class="optiondescription"> 
  377. <p>The theme has different color schemes. Use the drop-down menu below to change the color scheme. Click 
  378. Save to apply the new scheme.</p> 
  379. </div> 
  380. <div class="optioninput"> 
  381. <select name="cc_color_scheme" id="cc_color_scheme"> 
  382. <option <?php if (get_theme_mod("cc_color_scheme", 'Theme-1') == "Theme-1") { echo ' selected="selected"'; } ?> selected="selected">Theme-1 </option> 
  383. <option <?php if (get_theme_mod("cc_color_scheme", 'Theme-1') == "Theme-2") { echo ' selected="selected"'; } ?>>Theme-2 </option> 
  384. <option <?php if (get_theme_mod("cc_color_scheme", 'Theme-1') == "Theme-3") { echo ' selected="selected"'; } ?>>Theme-3 </option> 
  385. </select> 
  386.  
  387. </td> 
  388. </tr> 
  389. <tr>  
  390.  
  391.  
  392.  
  393. <?php for($i=0;$i<$count_picker;$i++) {  
  394. if($i==4 || $i==8) {echo "</tr><tr>";} 
  395. ?> 
  396.  
  397.  
  398. <!-- color picker options --> 
  399.  
  400. <td> 
  401.  
  402. <!-- in layout.js id="ct_border_color" --> 
  403.  
  404. <div> 
  405. <div> 
  406. <div class="optioninput"> 
  407. <label style="margin: 0px;" for="<?php echo $pickers[$i]['id']; ?>"><?php echo $pickers[$i]['name']; ?></label> 
  408.  
  409. <div style="position: relative; top: 20px;"> 
  410. <div id="<?php echo $pickers[$i]['id']; ?>_picker" class="colorSelector"> 
  411. <div style="background-color: <?php echo $pickers[$i]['std'] ?>; "> 
  412. </div> 
  413. </div> 
  414. <input type="text" id="<?php echo $pickers[$i]['id']; ?>" name="<?php echo $pickers[$i]['id']; ?>" value="<?php echo $pickers[$i]['std']; ?>" style="background-color:<?php echo $pickers[$i]['std']; ?>;"> 
  415. </div> 
  416. </div> 
  417. </div> 
  418. </div> 
  419. <script type="text/javascript">setColorPicker("<?php echo $pickers[$i]['id']; ?>", "<?php echo $pickers[$i]['std']; ?>");</script> 
  420. </td> 
  421.  
  422. <!-- color picker options --> 
  423.  
  424. <?php 
  425.  
  426.  
  427. ?> 
  428. </tr> 
  429. </table> 
  430.  
  431.  
  432. <p class="submit" style="float: left; margin-left: 63px; margin-right: 8px;"> 
  433. <input class="button" name="save" type="submit" value="Save changes" /> 
  434. <input type="hidden" name="action" value="save"/> 
  435. </p> 
  436. </form> 
  437. <form method="post" action="themes.php?page=web_dorado_theme&controller=color_control_page"> 
  438. <p class="submit"> 
  439. <input class="button" name="reset" type="submit" value="Reset"/> 
  440. <input type="hidden" name="action" value="reset"/> 
  441. </p> 
  442. </form> 
  443. </div > 
  444. <?php 
  445.  
  446. private function get_option_type($type='') { 
  447. $cur_type_elements=array(); 
  448. $k=0; 
  449. foreach( $this->options_colorcontrol as $option ) { 
  450.  
  451. if(isset($type) && isset($option['type']) && $option['type'] == $type ) { 
  452.  
  453. $cur_type_elements[$k]=$option; 
  454. $k++; 
  455.  
  456. return $cur_type_elements; 
  457.