BREBootstrapEcommerceSetup

This file is part of Bootstrap eCommerce theme.

Defined (1)

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

/admin/bootstrap-ecommerce-setup.class.php  
  1. class BREBootstrapEcommerceSetup { 
  2.  
  3. function __construct() { 
  4. add_action( 'admin_menu', array( &$this, 'admin_menu' ), 50 ); 
  5.  
  6. function admin_menu() { 
  7. $page = add_theme_page( __( 'Bootstrap eCommerce options', 'bre-bootstrap-ecommerce' ), __( 'Options', 'bre-bootstrap-ecommerce' ), 'edit_theme_options', 'bootstrap_ecommerce_settings', array( &$this, 'admin_page' ) ); 
  8. add_action( "load-$page", array( &$this, 'admin_action' ) ); 
  9.  
  10. function admin_page() { 
  11. $bre_primary_menu = get_option( 'bre_primary_menu', '' ); 
  12. $bre_primary_menu_transparent = get_option( 'bre_primary_menu_transparent', true ); 
  13. $bre_secondary_menu = get_option( 'bre_secondary_menu', 'navbar-inverse' ); 
  14. $bre_secondary_menu_transparent = get_option( 'bre_secondary_menu_transparent', false ); 
  15. $bre_label_one = get_option( 'bre_label_one', __( 'Label one', 'bre-bootstrap-ecommerce' ) ); 
  16. $bre_label_two = get_option( 'bre_label_two', __( 'Label two', 'bre-bootstrap-ecommerce' ) ); 
  17. $bre_label_three = get_option( 'bre_label_three', __( 'Label three', 'bre-bootstrap-ecommerce' ) ); 
  18. $bre_sidebar_style = get_option( 'bre_sidebar_style', false ); 
  19. $bre_layout = get_option( 'bre_layout', 'content-sidebar' ); 
  20. $bre_carousel_hide = get_option( 'bre_carousel_hide', false ); 
  21. $bre_carousel_excerpt_length = get_option( 'bre_carousel_excerpt_length', 50 ); 
  22. $bre_carousel_hide_more_details = get_option( 'bre_carousel_hide_more_details', false ); 
  23. $bre_carousel_opacity = get_option( 'bre_carousel_opacity', 0.6 ); 
  24. $bre_site_description_hide = get_option( 'bre_site_description_hide', false ); 
  25.  
  26. ?> 
  27. <div class="wrap"> 
  28. <?php screen_icon(); ?><h2><?php _e( 'Theme options', 'bre-bootstrap-ecommerce' ); ?></h2> 
  29.  
  30. <?php bre_ecommerce_upgrade(); ?> 
  31.  
  32. <?php if ( ! empty( $this->updated ) ) : ?> 
  33. <div id="message" class="updated"> 
  34. <p><?php _e( 'Settings updated', 'bre-bootstrap-ecommerce' ); ?></p> 
  35. </div> 
  36. <?php endif; ?> 
  37.  
  38. <div class="clear"></div> 
  39.  
  40. <form method="post" enctype="multipart/form-data"> 
  41. <?php submit_button( null, 'primary', 'save-bootstrap_ecommerce_logo-settings' ); ?> 
  42.  
  43. <h3><?php _e( 'Logo', 'bre-bootstrap-ecommerce' ); ?></h3> 
  44. <p class="description"><?php _e( 'Image logo replaces the site title text. Be careful with the size of your logo.', 'bre-bootstrap-ecommerce' ); ?><p> 
  45. <div class="postbox"> 
  46. <div class="inside"> 
  47. <table class="form-table"> 
  48. <tbody> 
  49. <tr valign="top"> 
  50. <th scope="row"> 
  51. <label for="bre_image_logo"><?php _e( 'Select Image', 'bre-bootstrap-ecommerce' ); ?></label> 
  52. </th> 
  53. <td> 
  54. <?php $url = get_option( 'bre_image_logo', false ); 
  55. if ( $url !== false ) : $url = $url['url']; ?> 
  56. <img src="<?php echo $url; ?>" alt="<?php bloginfo( 'name' ); ?>" /> 
  57. <br/> 
  58. <input type="submit" name="remove_bootstrap_logo" value="<?php _e( 'Remove logo', 'bre-bootstrap-ecommerce' ); ?>" class="btn"/> 
  59. <?php endif; ?> 
  60. <br/> 
  61. <label for="bre_image_logo"><?php _e( 'Choose an image from your computer:', 'bre-bootstrap-ecommerce' ); ?></label> 
  62. <br/> 
  63. <input type="file" name="bre_image_logo" id="bre_image_logo"/> 
  64. </td> 
  65. </tr> 
  66. <tr valign="top"> 
  67. <th scope="row"> 
  68. <label for="bre_site_description_hide"><?php _e( 'Hide Site Description', 'bre-bootstrap-ecommerce' ); ?></label> 
  69. </th> 
  70. <td> 
  71. <input type="checkbox" name="bre_site_description_hide" id="bre_site_description_hide" value="yes" <?php checked( $bre_site_description_hide ); ?>/> 
  72. </td> 
  73. </tr> 
  74. </tbody> 
  75. </table> 
  76. </div><!-- .inside --> 
  77. </div><!-- .postbox --> 
  78.  
  79. <h3><?php _e( 'Layout', 'bre-bootstrap-ecommerce' ); ?></h3> 
  80. <p class="description"><?php _e( 'If you do not assign widgets to sidebars you will see one column layout', 'bre-bootstrap-ecommerce' ); ?><p> 
  81. <div class="postbox"> 
  82. <div class="inside"> 
  83. <table class="form-table"> 
  84. <tbody> 
  85. <tr valign="top"> 
  86. <th scope="row"> 
  87. <label for="bre_layout"><?php _e( 'Layout', 'bre-bootstrap-ecommerce' ); ?></label> 
  88. </th> 
  89. <td> 
  90. <div style="display: inline-block; margin-right: 2em;"> 
  91. <input type="radio" name="bre_layout" id="bre_layout_content_sidebar" value="content-sidebar" <?php checked( $bre_layout, 'content-sidebar' ); ?> /> 
  92. <?php _e( 'Sidebar on right', 'bre-bootstrap-ecommerce' ); ?> 
  93. <br/> 
  94. <img src="<?php echo get_template_directory_uri(); ?>/images/content-sidebar.png" style="vertical-align: top;margin-left: 1em;"/> 
  95. </div> 
  96. <div style="display: inline-block"> 
  97. <input type="radio" name="bre_layout" id="bre_layout_sidebar_content" value="sidebar-content" <?php checked( $bre_layout, 'sidebar-content' ); ?> /> 
  98. <?php _e( 'Sidebar on left', 'bre-bootstrap-ecommerce' ); ?> 
  99. <br/> 
  100. <img src="<?php echo get_template_directory_uri(); ?>/images/sidebar-content.png" style="vertical-align: top;margin-left: 1em;"/> 
  101. </div> 
  102. </td> 
  103. </tr> 
  104. </tbody> 
  105. </table> 
  106. </div><!-- .inside --> 
  107. </div><!-- .postbox --> 
  108.  
  109. <h3><?php _e( 'Menus', 'bre-bootstrap-ecommerce' ); ?></h3> 
  110. <p class="description"><?php _e( 'To use these options you need to have WordPress menus defined. And dont forget to assign the menus to theme locations. (Appearance > menu)', 'bre-bootstrap-ecommerce' ); ?><p> 
  111. <div class="postbox"> 
  112. <div class="inside"> 
  113. <table class="form-table"> 
  114. <tbody> 
  115. <tr valign="top"> 
  116. <th scope="row"> 
  117. <label for="bre_primary_menu"><?php _e( 'Primary top menu', 'bre-bootstrap-ecommerce' ); ?></label> 
  118. </th> 
  119. <td> 
  120. <select name="bre_primary_menu" id="bre_primary_menu"> 
  121. <option value="navbar-inverse" <?php selected( 'navbar-inverse', $bre_primary_menu ); ?>><?php _e( 'Dark', 'bre-bootstrap-ecommerce' ); ?></option> 
  122. <option value="" <?php selected( '', $bre_primary_menu ); ?>><?php _e( 'Light', 'bre-bootstrap-ecommerce' ); ?></option> 
  123. </select> 
  124. <label><?php _e( 'Transparent', 'bre-bootstrap-ecommerce' ); ?>: <input type="checkbox" name="bre_primary_menu_transparent" <?php checked( $bre_primary_menu_transparent ); ?> /></label> 
  125. </td> 
  126. </tr> 
  127. <tr> 
  128. <th> 
  129. <label for="bre_secondary_menu"><?php _e( 'Secondary top menu', 'bre-bootstrap-ecommerce' ); ?></label> 
  130. </th> 
  131. <td> 
  132. <select name="bre_secondary_menu" id="bre_secondary_menu"> 
  133. <option value="navbar-inverse" <?php selected( 'navbar-inverse', $bre_secondary_menu ); ?>><?php _e( 'Dark', 'bre-bootstrap-ecommerce' ); ?></option> 
  134. <option value="" <?php selected( '', $bre_secondary_menu ); ?>><?php _e( 'Light', 'bre-bootstrap-ecommerce' ); ?></option> 
  135. </select> 
  136. <label><?php _e( 'Transparent', 'bre-bootstrap-ecommerce' ); ?>: <input type="checkbox" name="bre_secondary_menu_transparent" <?php checked( $bre_secondary_menu_transparent ); ?> /></label> 
  137. </td> 
  138. </tr> 
  139. <tr valign="top"> 
  140. <th scope="row"> 
  141. <label for="bre_sidebar_style"><?php _e( 'Sidebar menus', 'bre-bootstrap-ecommerce' ); ?></label> 
  142. </th> 
  143. <td> 
  144. <input type="checkbox" name="bre_sidebar_style" id="bre_sidebar_style" value="yes" <?php checked( $bre_sidebar_style ); ?> /> 
  145. <span class="description"><?php _e( 'Apply special styles to sidebar Navigation Trees, WordPress Menus, etc.', 'bre-bootstrap-ecommerce' ); ?></span> 
  146. </td> 
  147. </tr> 
  148. </tbody> 
  149. </table> 
  150. </div><!-- .inside --> 
  151. </div><!-- .postbox --> 
  152.  
  153. <h3><?php _e( 'Titles for Product Detail Tabs', 'bre-bootstrap-ecommerce' ); ?></h3> 
  154. <p class="description"><?php printf( __( 'This tabs are for additional content in single product detail page. You can add content to each tab managing the different <a href="%swidgets.php">widgetizable areas</a>', 'bre-bootstrap-ecommerce' ), get_admin_url() ); ?><p> 
  155. <div class="postbox"> 
  156. <div class="inside"> 
  157. <table class="form-table"> 
  158. <tr valign="top"> 
  159. <th scope="row"> 
  160. <label for="bre_label_one"><?php _e( 'Label One', 'bre-bootstrap-ecommerce' ); ?></label> 
  161. </th> 
  162. <td> 
  163. <input type="text" name="bre_label_one" id="bre_label_one" value="<?php echo $bre_label_one; ?>"> 
  164. </td> 
  165. </tr> 
  166. <tr valign="top"> 
  167. <th scope="row"> 
  168. <label for="bre_label_two"><?php _e( 'Label Two', 'bre-bootstrap-ecommerce' ); ?></label> 
  169. </th> 
  170. <td> 
  171. <input type="text" name="bre_label_two" id="bre_label_two" value="<?php echo $bre_label_two; ?>"> 
  172. </td> 
  173. </tr> 
  174. <tr valign="top"> 
  175. <th scope="row"> 
  176. <label for="bre_label_three"><?php _e( 'Label Three', 'bre-bootstrap-ecommerce' ); ?></label> 
  177. </th> 
  178. <td> 
  179. <input type="text" name="bre_label_three" id="bre_label_three" value="<?php echo $bre_label_three; ?>" /> 
  180. </td> 
  181. </tr> 
  182. </table> 
  183. </div><!-- .inside --> 
  184. </div><!-- .postbox --> 
  185.  
  186. <h3><?php _e( 'Carousel Setup', 'bre-bootstrap-ecommerce' ); ?></h3> 
  187. <p class="description"><?php _e( 'Carousel can be displayed or not in front page. When you use full-width-carousel.php template the carousel always will be visible if it has items', 'bre-bootstrap-ecommerce' ); ?><p> 
  188. <div class="postbox"> 
  189. <div class="inside"> 
  190. <table class="form-table"> 
  191. <tr valign="top"> 
  192. <th scope="row"> 
  193. <label for="bre_carousel_hide"><?php _e( 'Hide Carousel in front page', 'bre-bootstrap-ecommerce' ); ?></label> 
  194. </th> 
  195. <td> 
  196. <input type="checkbox" name="bre_carousel_hide" id="bre_carousel_hide" value="yes" <?php checked( $bre_carousel_hide ); ?> /> 
  197. </td> 
  198. </tr> 
  199. <tr valign="top"> 
  200. <th scope="row"> 
  201. <label for="bre_carousel_opacity"><?php _e( 'Opacity', 'bre-bootstrap-ecommerce' ); ?></label> 
  202. </th> 
  203. <td> 
  204. <input type="number" min="0" max="1" step="0.1" name="bre_carousel_opacity" id="bre_carousel_opacity" value="<?php echo $bre_carousel_opacity; ?>"> 
  205. <span class="description"><?php _e( 'Number between 0 and 1, where 0 is transparent and 1 is total opacity.', 'bre-bootstrap-ecommerce' ); ?></span> 
  206. </td> 
  207. </tr> 
  208. <tr valign="top"> 
  209. <th scope="row"> 
  210. <label for="bre_carousel_excerpt_length"><?php _e( 'Excerpt length', 'bre-bootstrap-ecommerce' ); ?></label> 
  211. </th> 
  212. <td> 
  213. <input type="number" min="0" max="1" step="1" name="bre_carousel_excerpt_length" id="bre_carousel_excerpt_length" value="<?php echo $bre_carousel_excerpt_length; ?>"> 
  214. </td> 
  215. </tr> 
  216. <tr valign="top"> 
  217. <th scope="row"> 
  218. <label for="bre_carousel_hide_more_details"><?php _e( 'Hide More details button', 'bre-bootstrap-ecommerce' ); ?></label> 
  219. </th> 
  220. <td> 
  221. <input type="checkbox" name="bre_carousel_hide_more_details" id="bre_carousel_hide_more_details" value="yes" <?php checked( $bre_carousel_hide_more_details ); ?> /> 
  222. </td> 
  223. </tr> 
  224. </table> 
  225. </div><!-- .inside --> 
  226. </div><!-- .postbox --> 
  227.  
  228. <div class="postbox"> 
  229. <div class="inside"> 
  230. <table class="form-table"> 
  231. <tbody> 
  232. <?php $hide_home_shortcuts = get_option( 'bre_hide_home_shortcuts', false ); ?> 
  233. <tr valign="top"> 
  234. <th scope="row"> 
  235. <label for="hide_home_shortcuts"><?php _e( 'Hide 3 Shortcuts', 'bre-bootstrap-ecommerce' ); ?></label> 
  236. </th> 
  237. <td> 
  238. <input type="checkbox" name="hide_home_shortcuts" value="yes" <?php checked( $hide_home_shortcuts ); ?> /> 
  239. <span class="description"> 
  240. <?php _e( 'The 3 box shortcuts appears in front page. Also you can display them wherever you want using [3boxes] shortcode', 'bre-bootstrap-ecommerce' ); ?><br /> 
  241. <?php _e( 'Recommended image width: 350px', 'bre-bootstrap-ecommerce' ); ?></span> 
  242. </td> 
  243. </tr> 
  244. </tbody> 
  245. </table> 
  246. </div><!-- .inside --> 
  247. </div><!-- .postbox --> 
  248. <h2><?php _e( 'Shortcuts, 3 Cols', 'bre-bootstrap-ecommerce' ); ?></h2> 
  249. <h3><?php _e( 'Left Box', 'bre-bootstrap-ecommerce' ); ?></h3> 
  250. <div class="postbox"> 
  251. <div class="inside"> 
  252. <table class="form-table"> 
  253. <tbody> 
  254. <?php $url = get_option( 'bre_image_a', false ); 
  255. if ( $url !== false ) $url = $url['url']; 
  256. if ( strlen( $url ) ) : ?> 
  257. <tr valign="top"> 
  258. <th scope="row"> 
  259. <label for="bre_url_a"><?php _e( 'Current image', 'bre-bootstrap-ecommerce' ); ?></label> 
  260. </th> 
  261. <td> 
  262. <img src="<?php echo $url; ?>" alt="<?php echo $url; ?>" width="325px" /> 
  263. <br/><input type="submit" name="save-pagina_home-remove_image_a" value="<?php _e( 'Remove file', 'bre-bootstrap-ecommerce' ); ?>" /> 
  264. </td> 
  265. </tr> 
  266. <?php endif; ?> 
  267. <tr valign="top"> 
  268. <th scope="row"> 
  269. <label>link:</label> 
  270. </th> 
  271. <td> 
  272. <input type="text" name="bre_url_a" id="bre_url_a" value="<?php echo get_option( 'bre_url_a', '' ); ?>" size="40" /> 
  273. </td> 
  274. </tr> 
  275. <tr valign="top"> 
  276. <th scope="row"> 
  277. <label>New image:</label> 
  278. </th> 
  279. <td> 
  280. <input type="file" name="bre_image_a" /> 
  281. </td> 
  282. </tr> 
  283. <tr valign="top"> 
  284. <th scope="row"> 
  285. <label><?php _e( 'Title', 'bre-bootstrap-ecommerce' ); ?>:</label> 
  286. </th> 
  287. <td> 
  288. <input type="text" name="bre_label_a" value="<?php echo get_option( 'bre_label_a', '' ); ?>" /> 
  289. </td> 
  290. </tr> 
  291. <tr valign="top"> 
  292. <th scope="row"> 
  293. <label><?php _e( 'Description', 'bre-bootstrap-ecommerce' ); ?>:</label> 
  294. <td> 
  295. <textarea name="bre_description_a" cols="80" rows="5"><?php echo get_option( 'bre_description_a', '' ); ?></textarea> 
  296. </td> 
  297. </tr> 
  298. </tbody> 
  299. </table> 
  300. </div><!-- .inside --> 
  301. </div><!-- .postbox --> 
  302.  
  303. <h3><?php _e( 'Center Box', 'bre-bootstrap-ecommerce' ); ?></h3> 
  304.  
  305. <div class="postbox"> 
  306. <div class="inside"> 
  307. <table class="form-table"> 
  308. <tbody> 
  309. <?php $url = get_option( 'bre_image_b', false ); 
  310. if ( $url !== false ) $url = $url['url']; 
  311. if ( strlen( $url ) ) : ?> 
  312. <tr valign="top"> 
  313. <th scope="row"> 
  314. <label for="bre_url_b"><?php _e( 'Current image', 'bre-bootstrap-ecommerce' ); ?></label> 
  315. </th> 
  316. <td> 
  317. <img src="<?php echo $url; ?>" alt="<?php echo $url; ?>" width="325px" /> 
  318. <br/><input type="submit" name="save-pagina_home-remove_image_b" value="<?php _e( 'Remove file', 'bre-bootstrap-ecommerce' ); ?>" /> 
  319. </td> 
  320. </tr> 
  321. <?php endif; ?> 
  322. <tr valign="top"> 
  323. <th scope="row"> 
  324. <label>link:</label> 
  325. </th> 
  326. <td> 
  327. <input type="text" name="bre_url_b" id="bre_url_b" value="<?php echo get_option( 'bre_url_b', '' ); ?>" size="40" /> 
  328. </td> 
  329. </tr> 
  330. <tr valign="top"> 
  331. <th scope="row"> 
  332. <label>New image:</label> 
  333. </th> 
  334. <td> 
  335. <input type="file" name="bre_image_b" /> 
  336. </td> 
  337. </tr> 
  338. <tr valign="top"> 
  339. <th scope="row"> 
  340. <label><?php _e( 'Title', 'bre-bootstrap-ecommerce' ); ?>:</label> 
  341. </th> 
  342. <td> 
  343. <input type="text" name="bre_label_b" value="<?php echo get_option( 'bre_label_b', '' ); ?>" /> 
  344. </td> 
  345. </tr> 
  346. <tr valign="top"> 
  347. <th scope="row"> 
  348. <label><?php _e( 'Description', 'bre-bootstrap-ecommerce' ); ?>:</label> 
  349. <td> 
  350. <textarea name="bre_description_b" cols="80" rows="5"><?php echo get_option( 'bre_description_b', '' ); ?></textarea> 
  351. </td> 
  352. </tr> 
  353. </tbody> 
  354. </table> 
  355. </div><!-- .inside --> 
  356. </div><!-- .postbox --> 
  357.  
  358. <h3><?php _e( 'Right Box', 'bre-bootstrap-ecommerce' ); ?></h3> 
  359.  
  360. <div class="postbox"> 
  361. <div class="inside"> 
  362. <table class="form-table"> 
  363. <tbody> 
  364. <?php $url = get_option( 'bre_image_c', false ); 
  365. if ( $url !== false ) $url = $url['url']; 
  366. if ( strlen( $url ) ) : ?> 
  367. <tr valign="top"> 
  368. <th scope="row"> 
  369. <label for="bre_url_c"><?php _e( 'Current image', 'bre-bootstrap-ecommerce' ); ?></label> 
  370. </th> 
  371. <td> 
  372. <img src="<?php echo $url; ?>" alt="<?php echo $url; ?>" width="325px" /> 
  373. <br/><input type="submit" name="save-pagina_home-remove_image_c" value="<?php _e( 'Remove file', 'bre-bootstrap-ecommerce' ); ?>" /> 
  374. </td> 
  375. </tr> 
  376. <?php endif; ?> 
  377. <tr valign="top"> 
  378. <th scope="row"> 
  379. <label>link:</label> 
  380. </th> 
  381. <td> 
  382. <input type="text" name="bre_url_c" id="bre_url_c" value="<?php echo get_option( 'bre_url_c', '' ); ?>" size="40" /> 
  383. </td> 
  384. </tr> 
  385. <tr valign="top"> 
  386. <th scope="row"> 
  387. <label>New image:</label> 
  388. </th> 
  389. <td> 
  390. <input type="file" name="bre_image_c" /> 
  391. </td> 
  392. </tr> 
  393. <tr valign="top"> 
  394. <th scope="row"> 
  395. <label><?php _e( 'Title', 'bre-bootstrap-ecommerce' ); ?>:</label> 
  396. </th> 
  397. <td> 
  398. <input type="text" name="bre_label_c" value="<?php echo get_option( 'bre_label_c', '' ); ?>" /> 
  399. </td> 
  400. </tr> 
  401. <tr valign="top"> 
  402. <th scope="row"> 
  403. <label><?php _e( 'Description', 'bre-bootstrap-ecommerce' ); ?>:</label> 
  404. <td> 
  405. <textarea name="bre_description_c" cols="80" rows="5"><?php echo get_option( 'bre_description_c', '' ); ?></textarea> 
  406. </td> 
  407. </tr> 
  408. </tbody> 
  409. </table> 
  410. </div><!-- .inside --> 
  411. </div><!-- .postbox --> 
  412. <?php wp_nonce_field( 'bootstrap_ecommerce_settings' ); ?> 
  413. <?php submit_button( null, 'primary', 'save-bootstrap_ecommerce_logo-settings' ); ?> 
  414. </form> 
  415. </div><!-- .wrap --><?php 
  416.  
  417. function admin_action() { 
  418. if ( empty( $_POST ) ) return; 
  419. check_admin_referer( 'bootstrap_ecommerce_settings' );  
  420. if ( isset( $_REQUEST['save-bootstrap_ecommerce_logo-settings'] ) ) { 
  421. $this->update_file( 'bre_image_logo' ); 
  422. } elseif ( isset( $_REQUEST['remove_bootstrap_logo'] ) ) { 
  423. $this->remove_file( 'bre_image_logo' ); 
  424. update_option( 'bre_primary_menu', $_REQUEST['bre_primary_menu'] ); 
  425. update_option( 'bre_primary_menu_transparent', isset( $_REQUEST['bre_primary_menu_transparent'] ) ); 
  426. update_option( 'bre_secondary_menu', $_REQUEST['bre_secondary_menu'] ); 
  427. update_option( 'bre_secondary_menu_transparent', isset( $_REQUEST['bre_secondary_menu_transparent'] ) ); 
  428. update_option( 'bre_label_one', $_REQUEST['bre_label_one'] ); 
  429. if ( function_exists( 'bre_register_string' ) ) bre_register_string( 'Bootstrap eCommerce', 'label one', $_REQUEST['bre_label_one'] ); 
  430. update_option( 'bre_label_two', $_REQUEST['bre_label_two'] ); 
  431. if ( function_exists( 'bre_register_string' ) ) bre_register_string( 'Bootstrap eCommerce', 'label two', $_REQUEST['bre_label_two'] ); 
  432. update_option( 'bre_label_three', $_REQUEST['bre_label_three'] ); 
  433. if ( function_exists( 'bre_register_string' ) ) bre_register_string( 'Bootstrap eCommerce', 'label three', $_REQUEST['bre_label_three'] ); 
  434. update_option( 'bre_sidebar_style', isset( $_REQUEST['bre_sidebar_style'] ) ); 
  435. update_option( 'bre_layout', $_REQUEST['bre_layout'] ); 
  436.  
  437. update_option( 'bre_carousel_hide', isset( $_REQUEST['bre_carousel_hide'] ) ); 
  438. update_option( 'bre_carousel_opacity', (float)$_REQUEST['bre_carousel_opacity'] ); 
  439. update_option( 'bre_carousel_excerpt_length', (float)$_REQUEST['bre_carousel_excerpt_length'] ); 
  440. update_option( 'bre_carousel_hide_more_details', isset( $_REQUEST['bre_carousel_hide_more_details'] ) ); 
  441.  
  442. update_option( 'bre_site_description_hide', isset( $_REQUEST['bre_site_description_hide'] ) ); 
  443.  
  444. //3 ShortCuts 
  445. update_option( 'bre_hide_home_shortcuts', isset( $_POST['hide_home_shortcuts'] ) ); 
  446. update_option( 'bre_url_a', $_POST['bre_url_a'] ); 
  447. update_option( 'bre_url_b', $_POST['bre_url_b'] ); 
  448. update_option( 'bre_url_c', $_POST['bre_url_c'] ); 
  449. update_option( 'bre_label_a', $_POST['bre_label_a'] ); 
  450. update_option( 'bre_label_b', $_POST['bre_label_b'] ); 
  451. update_option( 'bre_label_c', $_POST['bre_label_c'] ); 
  452. update_option( 'bre_description_a', $_POST['bre_description_a'] ); 
  453. update_option( 'bre_description_b', $_POST['bre_description_b'] ); 
  454. update_option( 'bre_description_c', $_POST['bre_description_c'] ); 
  455. $this->update_file( 'bre_image_a' ); 
  456. $this->update_file( 'bre_image_b' ); 
  457. $this->update_file( 'bre_image_c' ); 
  458. if ( isset( $_REQUEST['save-pagina_home-remove_image_a'] ) ) { 
  459. $this->remove_file( 'bre_image_a' ); 
  460. } elseif ( isset( $_REQUEST['save-pagina_home-remove_image_b'] ) ) { 
  461. $this->remove_file( 'bre_image_b' ); 
  462. } elseif ( isset( $_REQUEST['save-pagina_home-remove_image_c'] ) ) { 
  463. $this->remove_file( 'bre_image_c' ); 
  464. $this->updated = true; 
  465.  
  466. function update_file( $id ) { 
  467. if ( isset( $_FILES[$id] ) && $_FILES[$id]['name'] !== '' ) { 
  468. $this->remove_file( $id ); 
  469. $file = $_FILES[$id]; 
  470. if ( ! function_exists( 'wp_handle_upload' ) ) require_once( ABSPATH . 'wp-admin/includes/file.php' ); 
  471. $upload_overrides = array( 'test_form' => false ); 
  472. $movefile = wp_handle_upload( $file, $upload_overrides ); 
  473. update_option( $id, $movefile ); 
  474.  
  475. private function remove_file( $id ) { 
  476. $path_to_delete = get_option( $id, false ); 
  477. if ( $path_to_delete !== false ) unlink( $path_to_delete['file'] ); 
  478. delete_option( $id );