PageRenderTime 57ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 1ms

/wp-content/themes/simple-catch/functions/panel/theme_options.php

https://github.com/Bochet/festival_lgbt
PHP | 1225 lines | 991 code | 114 blank | 120 comment | 113 complexity | 422004c632a3f388837df38514600c85 MD5 | raw file
Possible License(s): GPL-2.0, AGPL-1.0, LGPL-2.1
  1. <?php
  2. /**
  3. * Simple Catch Theme Options
  4. *
  5. * @package Catch Themes
  6. * @subpackage Simple_Catch
  7. * @since Simple Catch 1.0
  8. */
  9. add_action( 'admin_init', 'simplecatch_register_settings' );
  10. add_action( 'admin_menu', 'simplecatch_options_menu' );
  11. /**
  12. * Enqueue admin script / style
  13. *
  14. * @uses wp_enqueue_script
  15. * @Calling jquery, jquery-ui-tabs,jquery-cookie, jquery-ui-sortable, jquery-ui-draggable
  16. */
  17. function simplecatch_admin_scripts() {
  18. //jquery-cookie registered in functions.php
  19. wp_enqueue_script( 'simplecatch_admin', get_template_directory_uri().'/functions/panel/admin.js', array( 'jquery', 'jquery-ui-tabs', 'jquery-cookie', 'jquery-ui-sortable', 'jquery-ui-draggable', 'farbtastic' ), '1.0', false );
  20. wp_enqueue_script( 'simplecatch_upload', get_template_directory_uri().'/functions/panel/add_image_scripts.js', array( 'jquery','media-upload','thickbox' ) );
  21. wp_enqueue_script( 'simplecatch_color', get_template_directory_uri().'/functions/panel/color_picker.js', array( 'farbtastic' ) );
  22. wp_enqueue_style( 'simplecatch_admin_style',get_template_directory_uri().'/functions/panel/admin.css', array( 'farbtastic', 'thickbox' ), '1.0', 'screen' );
  23. }
  24. add_action('admin_print_styles-appearance_page_theme_options', 'simplecatch_admin_scripts');
  25. add_action('admin_print_styles-appearance_page_slider_options', 'simplecatch_admin_scripts');
  26. add_action('admin_print_styles-appearance_page_social_options', 'simplecatch_admin_scripts');
  27. add_action('admin_print_styles-appearance_page_webmaster_options', 'simplecatch_admin_scripts');
  28. /*
  29. * Create a function for Theme Options Page
  30. *
  31. * @uses add_menu_page
  32. * @add action admin_menu
  33. */
  34. function simplecatch_options_menu() {
  35. add_theme_page(
  36. __( 'Theme Options', 'simplecatch' ), // Name of page
  37. __( 'Theme Options', 'simplecatch' ), // Label in menu
  38. 'edit_theme_options', // Capability required
  39. 'theme_options', // Menu slug, used to uniquely identify the page
  40. 'simplecatch_theme_options_do_page' // Function that renders the options page
  41. );
  42. add_theme_page(
  43. __( 'Slider Options', 'simplecatch' ), // Name of page
  44. __( 'Featured Slider', 'simplecatch' ), // Label in menu
  45. 'edit_theme_options', // Capability required
  46. 'slider_options', // Menu slug, used to uniquely identify the page
  47. 'simplecatch_slider_options_do_page' // Function that renders the options page
  48. );
  49. add_theme_page(
  50. __( 'Social Links', 'simplecatch' ), // Name of page
  51. __( 'Social Links', 'simplecatch' ), // Label in menu
  52. 'edit_theme_options', // Capability required
  53. 'social_options', // Menu slug, used to uniquely identify the page
  54. 'simplecatch_social_options_do_page' // Function that renders the options page
  55. );
  56. add_theme_page(
  57. __( 'Webmaster Tools', 'simplecatch' ), // Name of page
  58. __( 'Webmaster Tools', 'simplecatch' ), // Label in menu
  59. 'edit_theme_options', // Capability required
  60. 'webmaster_options', // Menu slug, used to uniquely identify the page
  61. 'simplecatch_webmaster_options_do_page' // Function that renders the options page
  62. );
  63. }
  64. /*
  65. * Admin Social Links
  66. * use facebook and twitter scripts
  67. */
  68. function simplecatch_admin_social() { ?>
  69. <!-- Start Social scripts -->
  70. <div id="fb-root"></div>
  71. <script>(function(d, s, id) {
  72. var js, fjs = d.getElementsByTagName(s)[0];
  73. if (d.getElementById(id)) return;
  74. js = d.createElement(s); js.id = id;
  75. js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=276203972392824";
  76. fjs.parentNode.insertBefore(js, fjs);
  77. }(document, 'script', 'facebook-jssdk'));</script>
  78. <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
  79. <!-- End Social scripts -->
  80. <?php
  81. }
  82. add_action('adminmenu','simplecatch_admin_social');
  83. /*
  84. * Register options and validation callbacks
  85. *
  86. * @uses register_setting
  87. * @action admin_init
  88. */
  89. function simplecatch_register_settings(){
  90. register_setting( 'simplecatch_options', 'simplecatch_options', 'simplecatch_theme_options_validate' );
  91. }
  92. /*
  93. * Render Simple Catch Theme Options page
  94. *
  95. * @uses settings_fields, get_option, bloginfo
  96. * @Settings Updated
  97. */
  98. function simplecatch_theme_options_do_page() {
  99. ?>
  100. <div id="catchthemes" class="wrap">
  101. <form method="post" action="options.php">
  102. <?php
  103. settings_fields( 'simplecatch_options' );
  104. global $simplecatch_options_settings;
  105. $options = $simplecatch_options_settings;
  106. ?>
  107. <?php screen_icon(); ?> <h2><?php bloginfo( 'name' ); ?> "<?php _e( 'Theme Options', 'simplecatch' ); ?>" <?php _e( 'By', 'simplecatch' ); ?> <a href="<?php echo esc_url( __( 'http://catchthemes.com/', 'simplecatch' ) ); ?>" title="<?php esc_attr_e( 'Catch Themes', 'simplecatch' ); ?>" target="_blank"><?php _e( 'Catch Themes', 'simplecatch' ); ?></a></h2>
  108. <?php
  109. // Function to show the info bar
  110. if ( function_exists( 'simplecatch_infobar' ) ) :
  111. simplecatch_infobar();
  112. endif;
  113. ?>
  114. <?php if( isset( $_GET [ 'settings-updated' ] ) && $_GET[ 'settings-updated' ] == 'true' ): ?>
  115. <div class="updated" id="message">
  116. <p><strong><?php _e( 'Settings saved.', 'simplecatch' );?></strong></p>
  117. </div>
  118. <?php endif; ?>
  119. <div id="simplecatch_ad_tabs">
  120. <ul class="tabNavigation" id="mainNav">
  121. <li><a href="#designsettings"><?php _e( 'Design Settings', 'simplecatch' );?></a></li>
  122. <li><a href="#themesettings"><?php _e( 'Theme Settings', 'simplecatch' );?></a></li>
  123. </ul><!-- .tabsNavigation #mainNav -->
  124. <!-- Option for Design Settings -->
  125. <div id="designsettings">
  126. <div class="option-container">
  127. <h3 class="option-toggle"><a href="#"><?php _e( 'Logo Options', 'simplecatch' ); ?></a></h3>
  128. <div class="option-content inside">
  129. <table class="form-table">
  130. <tbody>
  131. <tr>
  132. <th scope="row"><?php _e( 'Disable Header Logo:', 'simplecatch' ); ?></th>
  133. <input type='hidden' value='0' name='simplecatch_options[remove_header_logo]'>
  134. <td><input type="checkbox" id="headerlogo" name="simplecatch_options[remove_header_logo]" value="1" <?php checked( '1', $options['remove_header_logo'] ); ?> /></td>
  135. </tr>
  136. <tr>
  137. <th scope="row"><?php _e( 'Header logo url:', 'simplecatch' ); ?></th>
  138. <td>
  139. <?php if ( !empty ( $options[ 'featured_logo_header' ] ) ) { ?>
  140. <input class="upload-url" size="65" type="text" name="simplecatch_options[featured_logo_header]" value="<?php echo esc_url ( $options [ 'featured_logo_header' ]); ?>" class="upload" />
  141. <?php } else { ?>
  142. <input size="65" type="text" name="simplecatch_options[featured_logo_header]" value="<?php echo get_template_directory_uri(); ?>/images/logo.png" alt="logo" />
  143. <?php } ?>
  144. <input id="st_upload_button" class="st_upload_button button" name="wsl-image-add" type="button" value="<?php esc_attr_e( 'Change Header Logo','simplecatch' ); ?>" />
  145. </td>
  146. </tr>
  147. <tr>
  148. <th scope="row"><?php _e( 'Preview:', 'simplecatch' ); ?></th>
  149. <td>
  150. <?php
  151. if ( !empty( $options[ 'featured_logo_header' ] ) ) {
  152. echo '<img src="'.esc_url( $options[ 'featured_logo_header' ] ).'" alt="logo"/>';
  153. } else {
  154. echo '<img src="'. get_template_directory_uri().'/images/logo.png" alt="logo" />';
  155. }
  156. ?>
  157. </td>
  158. </tr>
  159. <tr>
  160. <th scope="row"><?php _e( 'Disable Site Title:', 'simplecatch' ); ?></th>
  161. <input type='hidden' value='0' name='simplecatch_options[remove_site_title]'>
  162. <td><input type="checkbox" id="headerlogo" name="simplecatch_options[remove_site_title]" value="1" <?php checked( '1', $options['remove_site_title'] ); ?> /></td>
  163. </tr>
  164. <tr>
  165. <th scope="row"><?php _e( 'Disable Site Description:', 'simplecatch' ); ?></th>
  166. <input type='hidden' value='0' name='simplecatch_options[remove_site_description]'>
  167. <td><input type="checkbox" id="headerlogo" name="simplecatch_options[remove_site_description]" value="1" <?php checked( '1', $options['remove_site_description'] ); ?> /></td>
  168. </tr>
  169. <tr>
  170. <th scope="row"><?php _e( 'Disable Footer Logo:', 'simplecatch' ); ?></th>
  171. <input type='hidden' value='0' name='simplecatch_options[remove_footer_logo]'>
  172. <td><input type="checkbox" id="headerlogo" name="simplecatch_options[remove_footer_logo]" value="1" <?php checked( '1', $options['remove_footer_logo'] ); ?> /></td>
  173. </tr>
  174. <tr>
  175. <th scope="row"><?php _e( 'Footer logo url: ', 'simplecatch' ); ?></th>
  176. <td>
  177. <?php if ( !empty ( $options[ 'featured_logo_footer' ] ) ) { ?>
  178. <input class="upload-url" size="65" type="text" name="simplecatch_options[featured_logo_footer]" value="<?php echo esc_url( $options[ 'featured_logo_footer' ] ); ?>" class="upload" />
  179. <?php } else { ?>
  180. <input size="65" type="text" name="simplecatch_options[featured_logo_footer]" value="<?php echo get_template_directory_uri(); ?>/images/logo-foot.png" alt="logo" />
  181. <?php } ?>
  182. <input id="st_upload_button" class="st_upload_button button" name="wsl-image-add" type="button" value="<?php esc_attr_e( 'Change Footer Logo','simplecatch' );?>" />
  183. </td>
  184. </tr>
  185. <tr>
  186. <th scope="row"><?php _e( 'Preview: ', 'simplecatch' ); ?></th>
  187. <td>
  188. <?php
  189. if ( !empty( $options[ 'featured_logo_footer' ] ) ) {
  190. echo '<img src="'.esc_url( $options[ 'featured_logo_footer' ] ).'" alt="logo"/>';
  191. } else {
  192. echo '<img src="'. get_template_directory_uri().'/images/logo-foot.png" alt="logo" />';
  193. }
  194. ?>
  195. </td>
  196. </tr>
  197. </tbody>
  198. </table>
  199. <p class="submit"><input type="submit" class="button-primary" value="<?php esc_attr_e( 'Save', 'simplecatch' ); ?>" /></p>
  200. </div><!-- .option-content -->
  201. </div><!-- .option-container -->
  202. <div class="option-container">
  203. <h3 class="option-toggle"><a href="#"><?php _e( 'Fav Icon Options', 'simplecatch' ); ?></a></h3>
  204. <div class="option-content inside">
  205. <table class="form-table">
  206. <tbody>
  207. <tr>
  208. <th scope="row"><?php _e( 'Disable Favicon:', 'simplecatch' ); ?></th>
  209. <input type='hidden' value='0' name='simplecatch_options[remove_favicon]'>
  210. <td><input type="checkbox" id="favicon" name="simplecatch_options[remove_favicon]" value="1" <?php checked( '1', $options['remove_favicon'] ); ?> /></td>
  211. </tr>
  212. <tr>
  213. <th scope="row"><?php _e( 'Fav Icon URL:', 'simplecatch' ); ?></th>
  214. <td><?php if ( !empty ( $options[ 'fav_icon' ] ) ) { ?>
  215. <input class="upload-url" size="65" type="text" name="simplecatch_options[fav_icon]" value="<?php echo esc_url( $options [ 'fav_icon' ] ); ?>" class="upload" />
  216. <?php } else { ?>
  217. <input size="65" type="text" name="simplecatch_options[fav_icon]" value="<?php echo get_template_directory_uri(); ?>/images/favicon.ico" alt="fav" />
  218. <?php } ?>
  219. <input id="st_upload_button" class="st_upload_button button" name="wsl-image-add" type="button" value="<?php esc_attr_e( 'Change Fav Icon','simplecatch' );?>" />
  220. </td>
  221. </tr>
  222. <tr>
  223. <th scope="row"><?php _e( 'Preview: ', 'simplecatch' ); ?></th>
  224. <td>
  225. <?php
  226. if ( !empty( $options[ 'fav_icon' ] ) ) {
  227. echo '<img src="'.esc_url( $options[ 'fav_icon' ] ).'" alt="fav" />';
  228. } else {
  229. echo '<img src="'. get_template_directory_uri().'/images/favicon.ico" alt="fav" />';
  230. }
  231. ?>
  232. </td>
  233. </tr>
  234. </tbody>
  235. </table>
  236. <p class="submit"><input type="submit" class="button-primary" value="<?php esc_attr_e( 'Save', 'simplecatch' ); ?>" /></p>
  237. </div><!-- .option-content -->
  238. </div><!-- .option-container -->
  239. <div class="option-container">
  240. <h3 class="option-toggle"><a href="#"><?php _e( 'Content Background', 'simplecatch' ); ?></a></h3>
  241. <div class="option-content inside">
  242. <p><?php printf(__('Need to replace default background?','simplecatch')); ?> <?php printf(__('<a class="button" href="%s">Click here</a>', 'simplecatch'), admin_url('themes.php?page=custom-background')); ?></p>
  243. </div><!-- .option-content -->
  244. </div><!-- .option-container -->
  245. <div class="option-container">
  246. <h3 class="option-toggle"><a href="#"><?php _e( 'Content Color Options', 'simplecatch' ); ?></a></h3>
  247. <div class="option-content inside">
  248. <table class="form-table">
  249. <tbody>
  250. <tr>
  251. <th>
  252. <label for="simplecatch_heading_color">
  253. <?php _e( 'Heading Color:', 'simplecatch' ); ?>
  254. </label>
  255. </th>
  256. <td>
  257. <input type="text" id="simplecatch_heading_color" name="simplecatch_options[heading_color]" size="8" value="<?php echo ( isset( $options[ 'heading_color' ] ) ) ? esc_attr( $options[ 'heading_color' ] ) : '#444444'; ?>" />
  258. <div id="colorpicker_heading_color" style="z-index: 100; background:#eee; border:1px solid #ccc; position:absolute; display:none;"></div>
  259. </td>
  260. </tr>
  261. <tr>
  262. <th>
  263. <label for="simplecatch_meta_color">
  264. <?php _e( 'Meta Description Color:', 'simplecatch' ); ?>
  265. </label>
  266. </th>
  267. <td>
  268. <input type="text" id="simplecatch_meta_color" name="simplecatch_options[meta_color]" size="8" value="<?php echo ( isset( $options[ 'meta_color' ] ) ) ? esc_attr( $options[ 'meta_color' ] ) : '#999999'; ?>" />
  269. <div id="colorpicker_meta_color" style="z-index: 100; background:#eee; border:1px solid #ccc; position:absolute; display:none;"></div>
  270. </td>
  271. </tr>
  272. <tr>
  273. <th>
  274. <label for="simplecatch_text_color">
  275. <?php _e( 'Text Color:', 'simplecatch' ); ?>
  276. </label>
  277. </th>
  278. <td>
  279. <input type="text" id="simplecatch_text_color" name="simplecatch_options[text_color]" size="8" value="<?php echo ( isset( $options[ 'text_color' ] ) ) ? esc_attr( $options[ 'text_color' ] ) : '#555555'; ?>" />
  280. <div id="colorpicker_text_color" style="z-index: 100; background:#eee; border:1px solid #ccc; position:absolute; display:none;"></div>
  281. </td>
  282. </tr>
  283. <tr>
  284. <th>
  285. <label for="simplecatch_link_color">
  286. <?php _e( 'Link Color:', 'simplecatch' ); ?>
  287. </label>
  288. </th>
  289. <td>
  290. <input type="text" id="simplecatch_link_color" name="simplecatch_options[link_color]" size="8" value="<?php echo ( isset( $options[ 'link_color' ] ) ) ? esc_attr( $options[ 'link_color' ] ) : '#000000'; ?>" />
  291. <div id="colorpicker_link_color" style="z-index: 100; background:#eee; border:1px solid #ccc; position:absolute; display:none;"></div>
  292. </td>
  293. </tr>
  294. <tr>
  295. <th>
  296. <label for="simplecatch_widget_heading_color">
  297. <?php _e( 'Sidebar Widget Heading Color:', 'simplecatch' ); ?>
  298. </label>
  299. </th>
  300. <td>
  301. <input type="text" id="simplecatch_widget_heading_color" name="simplecatch_options[widget_heading_color]" size="8" value="<?php echo ( isset( $options[ 'widget_heading_color' ] ) ) ? esc_attr( $options[ 'widget_heading_color' ] ) : '#666666'; ?>" />
  302. <div id="colorpicker_widget_heading_color" style="z-index: 100; background:#eee; border:1px solid #ccc; position:absolute; display:none;"></div>
  303. </td>
  304. </tr>
  305. <tr>
  306. <th>
  307. <label for="simplecatch_widget_text_color">
  308. <?php _e( 'Sidebar Widget Text Color:', 'simplecatch' ); ?>
  309. </label>
  310. </th>
  311. <td>
  312. <input type="text" id="simplecatch_widget_text_color" name="simplecatch_options[widget_text_color]" size="8" value="<?php echo ( isset( $options[ 'widget_text_color' ] ) ) ? esc_attr( $options[ 'widget_text_color' ] ) : '#666666'; ?>" />
  313. <div id="colorpicker_widget_text_color" style="z-index: 100; background:#eee; border:1px solid #ccc; position:absolute; display:none;"></div>
  314. </td>
  315. </tr>
  316. <?php if( $options[ 'reset_color' ] == "1" ) { $options[ 'reset_color' ] = "0"; } ?>
  317. <tr>
  318. <th scope="row"><?php _e( 'Reset Color:', 'simplecatch' ); ?></th>
  319. <input type='hidden' value='0' name='simplecatch_options[reset_color]'>
  320. <td>
  321. <input type="checkbox" id="headerlogo" name="simplecatch_options[reset_color]" value="1" <?php checked( '1', $options['reset_color'] ); ?> />
  322. </td>
  323. </tr>
  324. </tbody>
  325. </table>
  326. <p class="submit"><input type="submit" class="button-primary" value="<?php esc_attr_e( 'Save', 'simplecatch' ); ?>" /></p>
  327. </div><!-- .option-content -->
  328. </div><!-- .option-container -->
  329. <div class="option-container">
  330. <h3 class="option-toggle"><a href="#"><?php _e( 'Custom CSS', 'simplecatch' ); ?></a></h3>
  331. <div class="option-content inside">
  332. <table class="form-table">
  333. <tbody>
  334. <tr>
  335. <th scope="row"><?php _e( 'Enter your custom CSS styles.', 'simplecatch' ); ?></th>
  336. <td>
  337. <textarea name="simplecatch_options[custom_css]" id="custom-css" cols="90" rows="12"><?php echo esc_attr( $options[ 'custom_css' ] ); ?></textarea>
  338. </td>
  339. </tr>
  340. <tr>
  341. <th scope="row"><?php _e( 'CSS Tutorial from W3Schools.', 'simplecatch' ); ?></th>
  342. <td>
  343. <a class="button" href="<?php echo esc_url( __( 'http://www.w3schools.com/css/default.asp','simplecatch' ) ); ?>" title="<?php esc_attr_e( 'CSS Tutorial', 'simplecatch' ); ?>" target="_blank"><?php _e( 'Click Here to Read', 'simplecatch' );?></a>
  344. </td>
  345. </tr>
  346. </tbody>
  347. </table>
  348. <p class="submit"><input type="submit" class="button-primary" value="<?php esc_attr_e( 'Save', 'simplecatch' ); ?>" /></p>
  349. </div><!-- .option-content -->
  350. </div><!-- .option-container -->
  351. <div class="option-container">
  352. <h3 class="option-toggle"><a href="#"><?php _e( 'Default Layout', 'simplecatch' ); ?></a></h3>
  353. <div class="option-content inside">
  354. <table class="form-table">
  355. <tbody>
  356. <tr>
  357. <th scope="row"><label><?php _e( 'Default Layout', 'simplecatch' ); ?></label></th>
  358. <td>
  359. <label title="no-sidebar" class="box"><img src="<?php echo get_template_directory_uri(); ?>/functions/panel/images/no-sidebar.gif" alt="Content-Sidebar" /><br />
  360. <input type="radio" name="simplecatch_options[sidebar_layout]" id="no-sidebar" <?php checked($options['sidebar_layout'], 'no-sidebar') ?> value="no-sidebar" />
  361. <?php _e( 'No Sidebar, One Column', 'simplecatch' ); ?>
  362. </label>
  363. <label title="left-Sidebar" class="box"><img src="<?php echo get_template_directory_uri(); ?>/functions/panel/images/left-sidebar.gif" alt="Content-Sidebar" /><br />
  364. <input type="radio" name="simplecatch_options[sidebar_layout]" id="left-sidebar" <?php checked($options['sidebar_layout'], 'left-sidebar') ?> value="left-sidebar" />
  365. <?php _e( 'Content on Right', 'simplecatch' ); ?>
  366. </label>
  367. <label title="right-sidebar" class="box"><img src="<?php echo get_template_directory_uri(); ?>/functions/panel/images/right-sidebar.gif" alt="Content-Sidebar" /><br />
  368. <input type="radio" name="simplecatch_options[sidebar_layout]" id="right-sidebar" <?php checked($options['sidebar_layout'], 'right-sidebar') ?> value="right-sidebar" />
  369. <?php _e( 'Content on Left', 'simplecatch' ); ?>
  370. </label>
  371. </td>
  372. </tr>
  373. </tbody>
  374. </table>
  375. <p class="submit"><input type="submit" class="button-primary" value="<?php esc_attr_e( 'Save', 'simplecatch' ); ?>" /></p>
  376. </div><!-- .option-content -->
  377. </div><!-- .option-container -->
  378. </div> <!-- #designsettings -->
  379. <!-- Options for Theme Settings -->
  380. <div id="themesettings">
  381. <div class="option-container">
  382. <h3 class="option-toggle"><a href="#"><?php _e( 'Homepage / Frontpage Category Setting', 'simplecatch' ); ?></a></h3>
  383. <div class="option-content inside">
  384. <table class="form-table">
  385. <tbody>
  386. <tr>
  387. <th scope="row">
  388. <?php _e( 'Front page posts categories:', 'simplecatch' ); ?>
  389. <p>
  390. <small><?php _e( 'Only posts that belong to the categories selected here will be displayed on the front page.', 'simplecatch' ); ?></small>
  391. </p>
  392. </th>
  393. <td>
  394. <select name="simplecatch_options[front_page_category][]" id="frontpage_posts_cats" multiple="multiple" class="select-multiple">
  395. <option value="" <?php if ( empty( $options['front_page_category'] ) ) { echo 'selected="selected"'; } ?>><?php _e( '--Disabled--', 'simplecatch' ); ?></option>
  396. <?php /* Get the list of categories */
  397. if( empty( $options[ 'front_page_category' ] ) ) {
  398. $options[ 'front_page_category' ] = array();
  399. }
  400. $categories = get_categories();
  401. foreach ( $categories as $category) :
  402. ?>
  403. <option value="<?php echo $category->cat_ID; ?>" <?php if ( in_array( $category->cat_ID, $options['front_page_category'] ) ) {echo 'selected="selected"';}?>><?php echo $category->cat_name; ?></option>
  404. <?php endforeach; ?>
  405. </select><br />
  406. <span class="description"><?php _e( 'You may select multiple categories by holding down the CTRL key.', 'simplecatch' ); ?></span>
  407. </td>
  408. </tr>
  409. </tbody>
  410. </table>
  411. <p class="submit"><input type="submit" class="button-primary" value="<?php esc_attr_e( 'Save', 'simplecatch' ); ?>" /></p>
  412. </div><!-- .option-content -->
  413. </div><!-- .option-container -->
  414. <div class="option-container">
  415. <h3 class="option-toggle"><a href="#"><?php _e( 'Search Text Settings', 'simplecatch' ); ?></a></h3>
  416. <div class="option-content inside">
  417. <table class="form-table">
  418. <tbody>
  419. <tr>
  420. <th scope="row"><label><?php _e( 'Default Display Text in Search', 'simplecatch' ); ?></label></th>
  421. <td><input type="text" size="45" name="simplecatch_options[search_display_text]" value="<?php echo esc_attr( $options[ 'search_display_text'] ); ?>" />
  422. </td>
  423. </tr>
  424. <tr>
  425. <th scope="row"><label><?php _e( 'Search Button\'s text', 'simplecatch' ); ?></label></th>
  426. <td><input type="text" size="45" name="simplecatch_options[search_button_text]" value="<?php echo esc_attr( $options[ 'search_button_text' ] ); ?>" />
  427. </td>
  428. </tr>
  429. </tbody>
  430. </table>
  431. <p class="submit"><input type="submit" class="button-primary" value="<?php esc_attr_e( 'Save', 'simplecatch' ); ?>" /></p>
  432. </div><!-- .option-content -->
  433. </div><!-- .option-container -->
  434. <div class="option-container">
  435. <h3 class="option-toggle"><a href="#"><?php _e( 'Excerpt / More Tag Settings', 'simplecatch' ); ?></a></h3>
  436. <div class="option-content inside">
  437. <table class="form-table">
  438. <tbody>
  439. <tr>
  440. <th scope="row"><label><?php _e( 'More Tag Text', 'simplecatch' ); ?></label></th>
  441. <td><input type="text" size="45" name="simplecatch_options[more_tag_text]" value="<?php echo esc_attr( $options[ 'more_tag_text' ] ); ?>" />
  442. </td>
  443. </tr>
  444. <tr>
  445. <th scope="row"><?php _e( 'Excerpt length(words)', 'simplecatch' ); ?></th>
  446. <td><input type="text" size="3" name="simplecatch_options[excerpt_length]" value="<?php echo intval( $options[ 'excerpt_length' ] ); ?>" /></td>
  447. </tr>
  448. </tbody>
  449. </table>
  450. <p class="submit"><input type="submit" class="button-primary" value="<?php esc_attr_e( 'Save', 'simplecatch' ); ?>" /></p>
  451. </div><!-- .option-content -->
  452. </div><!-- .option-container -->
  453. <div class="option-container">
  454. <h3 class="option-toggle"><a href="#"><?php _e( 'Feed Redirect', 'simplecatch' ); ?></a></h3>
  455. <div class="option-content inside">
  456. <table class="form-table">
  457. <tbody>
  458. <tr>
  459. <th scope="row"><label><?php _e( 'Feed Redirect URL', 'simplecatch' ); ?></label></th>
  460. <td><input type="text" size="70" name="simplecatch_options[feed_url]" value="<?php echo esc_attr( $options[ 'feed_url' ] ); ?>" />
  461. </td>
  462. </tr>
  463. </tbody>
  464. </table>
  465. <p class="submit"><input type="submit" class="button-primary" value="<?php esc_attr_e( 'Save', 'simplecatch' ); ?>" /></p>
  466. </div><!-- .option-content -->
  467. </div><!-- .option-container -->
  468. </div> <!-- #themesettings -->
  469. </div><!-- #simplecatch_ad_tabs -->
  470. </form>
  471. </div><!-- .wrap -->
  472. <?php
  473. }
  474. /*
  475. * Render catch options page
  476. * @uses settings_fields, get_option, bloginfo
  477. * @Settings Updated
  478. */
  479. function simplecatch_slider_options_do_page(){
  480. ?>
  481. <div id="catchthemes" class="wrap">
  482. <form method="post" action="options.php">
  483. <?php
  484. settings_fields( 'simplecatch_options' );
  485. global $simplecatch_options_settings;
  486. $options = $simplecatch_options_settings;
  487. ?>
  488. <?php screen_icon(); ?> <h2><?php bloginfo( 'name' ); ?> "<?php _e( 'Featured Slider Options', 'simplecatch' ); ?>" <?php _e( 'By', 'simplecatch' ); ?> <a href="<?php echo esc_url( __( 'http://catchthemes.com/', 'simplecatch' ) ); ?>" title="<?php esc_attr_e( 'Catch Themes', 'simplecatch' ); ?>" target="_blank"><?php _e( 'Catch Themes', 'simplecatch' ); ?></a></h2>
  489. <?php
  490. // Function to show the info bar
  491. if ( function_exists( 'simplecatch_infobar' ) ) :
  492. simplecatch_infobar();
  493. endif;
  494. ?>
  495. <?php if( isset( $_GET [ 'settings-updated' ] ) && $_GET[ 'settings-updated' ] == 'true' ): ?>
  496. <div class="updated" id="message">
  497. <p><strong><?php _e( 'Settings saved.', 'simplecatch' );?></strong></p>
  498. </div>
  499. <?php endif; ?>
  500. <div class="option-container">
  501. <h3 class="option-toggle"><a href="#"><?php _e( 'Add Slider Options', 'simplecatch' ); ?></a></h3>
  502. <div class="option-content inside">
  503. <table class="form-table">
  504. <tr>
  505. <th scope="row"><?php _e( 'Exclude Slider post from Home page posts:', 'simplecatch' ); ?></th>
  506. <input type='hidden' value='0' name='simplecatch_options[exclude_slider_post]'>
  507. <td><input type="checkbox" id="headerlogo" name="simplecatch_options[exclude_slider_post]" value="1" <?php checked( '1', $options['exclude_slider_post'] ); ?> /></td>
  508. </tr>
  509. <tr>
  510. <th scope="row"><?php _e( 'Number of Slides', 'simplecatch' ); ?></th>
  511. <td><input type="text" name="simplecatch_options[slider_qty]" value="<?php echo intval( $options[ 'slider_qty' ] ); ?>" /></td>
  512. </tr>
  513. <tbody class="sortable">
  514. <?php for ( $i = 1; $i <= $options[ 'slider_qty' ]; $i++ ): ?>
  515. <tr>
  516. <th scope="row"><label class="handle"><?php _e( 'Featured Slider Post #', 'simplecatch' ); ?><span class="count"><?php echo absint( $i ); ?></span></label></th>
  517. <td><input type="text" name="simplecatch_options[featured_slider][<?php echo absint( $i ); ?>]" value="<?php if( array_key_exists( 'featured_slider', $options ) && array_key_exists( $i, $options[ 'featured_slider' ] ) ) echo absint( $options[ 'featured_slider' ][ $i ] ); ?>" />
  518. <a href="<?php bloginfo ( 'url' );?>/wp-admin/post.php?post=<?php if( array_key_exists ( 'featured_slider', $options ) && array_key_exists ( $i, $options[ 'featured_slider' ] ) ) echo absint( $options[ 'featured_slider' ][ $i ] ); ?>&action=edit" class="button" title="<?php esc_attr_e('Click Here To Edit'); ?>" target="_blank"><?php _e( 'Click Here To Edit', 'simplecatch' ); ?></a>
  519. </td>
  520. </tr>
  521. <?php endfor; ?>
  522. </tbody>
  523. </table>
  524. <p><?php _e( 'Note: Here You can put your Post IDs which displays on Homepage as slider.', 'simplecatch' ); ?> </p>
  525. <p class="submit"><input type="submit" class="button-primary" value="<?php esc_attr_e( 'Save', 'simplecatch' ); ?>" /></p>
  526. </div><!-- .option-content -->
  527. </div><!-- .option-container -->
  528. <!-- Option for More Slider Options -->
  529. <div class="option-container">
  530. <h3 class="option-toggle"><a href="#"><?php _e( 'Slider Effect Options', 'simplecatch' ); ?></a></h3>
  531. <div class="option-content inside">
  532. <table class="form-table">
  533. <tr>
  534. <th scope="row"><?php _e( 'Disable Slider Background Effect:', 'simplecatch' ); ?></th>
  535. <input type='hidden' value='0' name='simplecatch_options[remove_noise_effect]'>
  536. <td><input type="checkbox" id="headerlogo" name="simplecatch_options[remove_noise_effect]" value="1" <?php checked( '1', $options['remove_noise_effect'] ); ?> /></td>
  537. </tr>
  538. <tr>
  539. <th>
  540. <label for="simplecatch_cycle_style"><?php _e( 'Transition Effect:', 'simplecatch' ); ?></label>
  541. </th>
  542. <td>
  543. <select id="simplecatch_cycle_style" name="simplecatch_options[transition_effect]">
  544. <option value="fade" <?php selected('fade', $options['transition_effect']); ?>><?php _e( 'fade', 'simplecatch' ); ?></option>
  545. <option value="wipe" <?php selected('wipe', $options['transition_effect']); ?>><?php _e( 'wipe', 'simplecatch' ); ?></option>
  546. <option value="scrollUp" <?php selected('scrollUp', $options['transition_effect']); ?>><?php _e( 'scrollUp', 'simplecatch' ); ?></option>
  547. <option value="scrollDown" <?php selected('scrollDown', $options['transition_effect']); ?>><?php _e( 'scrollDown', 'simplecatch' ); ?></option>
  548. <option value="scrollLeft" <?php selected('scrollLeft', $options['transition_effect']); ?>><?php _e( 'scrollLeft', 'simplecatch' ); ?></option>
  549. <option value="scrollRight" <?php selected('scrollRight', $options['transition_effect']); ?>><?php _e( 'scrollRight', 'simplecatch' ); ?></option>
  550. <option value="blindX" <?php selected('blindX', $options['transition_effect']); ?>><?php _e( 'blindX', 'simplecatch' ); ?></option>
  551. <option value="blindY" <?php selected('blindY', $options['transition_effect']); ?>><?php _e( 'blindY', 'simplecatch' ); ?></option>
  552. <option value="blindZ" <?php selected('blindZ', $options['transition_effect']); ?>><?php _e( 'blindZ', 'simplecatch' ); ?></option>
  553. <option value="cover" <?php selected('cover', $options['transition_effect']); ?>><?php _e( 'cover', 'simplecatch' ); ?></option>
  554. <option value="shuffle" <?php selected('shuffle', $options['transition_effect']); ?>><?php _e( 'shuffle', 'simplecatch' ); ?></option>
  555. </select>
  556. </td>
  557. </tr>
  558. <tr>
  559. <th scope="row"><?php _e( 'Transition Delay', 'simplecatch' ); ?></th>
  560. <td>
  561. <input type="text" name="simplecatch_options[transition_delay]" value="<?php echo $options[ 'transition_delay' ]; ?>" size="4" />
  562. <span class="description"><?php _e( 'second(s)', 'simplecatch' ); ?></span>
  563. </td>
  564. </tr>
  565. <tr>
  566. <th scope="row"><?php _e( 'Transition Length', 'simplecatch' ); ?></th>
  567. <td>
  568. <input type="text" name="simplecatch_options[transition_duration]" value="<?php echo $options[ 'transition_duration' ]; ?>" size="4" />
  569. <span class="description"><?php _e( 'second(s)', 'simplecatch' ); ?></span>
  570. </td>
  571. </tr>
  572. </table>
  573. <p class="submit"><input type="submit" class="button-primary" value="<?php esc_attr_e( 'Save', 'simplecatch' ); ?>" /></p>
  574. </div><!-- .option-content -->
  575. </div><!-- .option-container -->
  576. </form>
  577. </div><!-- .wrap -->
  578. <?php
  579. }
  580. /*
  581. * Render catch options page
  582. * @uses settings_fields, get_option, bloginfo
  583. * @Settings Updated
  584. */
  585. function simplecatch_social_options_do_page(){
  586. ?>
  587. <div id="sociallinks" class="wrap">
  588. <form method="post" action="options.php">
  589. <?php
  590. settings_fields( 'simplecatch_options' );
  591. global $simplecatch_options_settings;
  592. $options = $simplecatch_options_settings;
  593. ?>
  594. <?php screen_icon(); ?><h2><?php bloginfo( 'name' ); ?> "<?php _e( 'Social Links Option', 'simplecatch' ); ?>" <?php _e( 'By', 'simplecatch' ); ?> <a href="<?php echo esc_url( __( 'http://catchthemes.com/', 'simplecatch' ) ); ?>" title="<?php esc_attr_e( 'Catch Themes', 'simplecatch' ); ?>" target="_blank"><?php _e( 'Catch Themes', 'simplecatch' ); ?></a></h2>
  595. <?php
  596. // Function to show the info bar
  597. if ( function_exists( 'simplecatch_infobar' ) ) :
  598. simplecatch_infobar();
  599. endif;
  600. ?>
  601. <?php if( isset( $_GET [ 'settings-updated' ] ) && $_GET[ 'settings-updated' ] == 'true' ): ?>
  602. <div class="updated" id="message">
  603. <p><strong><?php _e( 'Settings saved.', 'simplecatch' );?></strong></p>
  604. </div>
  605. <?php endif; ?>
  606. <table class="form-table">
  607. <tbody>
  608. <tr>
  609. <th scope="row"><h4><?php _e( 'Facebook', 'simplecatch' ); ?></h4></th>
  610. <td><input type="text" size="45" name="simplecatch_options[social_facebook]" value="<?php echo esc_url( $options[ 'social_facebook' ] ); ?>" />
  611. </td>
  612. </tr>
  613. <tr>
  614. <th scope="row"><h4><?php _e( 'Twitter', 'simplecatch' ); ?> </h4></th>
  615. <td><input type="text" size="45" name="simplecatch_options[social_twitter]" value="<?php echo esc_url( $options[ 'social_twitter'] ); ?>" />
  616. </td>
  617. </tr>
  618. <tr>
  619. <th scope="row"><h4><?php _e( 'Google+', 'simplecatch' ); ?> </h4></th>
  620. <td><input type="text" size="45" name="simplecatch_options[social_googleplus]" value="<?php echo esc_url( $options[ 'social_googleplus'] ); ?>" />
  621. </td>
  622. </tr>
  623. <tr>
  624. <th scope="row"><h4><?php _e( 'Pinterest', 'simplecatch' ); ?> </h4></th>
  625. <td><input type="text" size="45" name="simplecatch_options[social_pinterest]" value="<?php echo esc_url( $options[ 'social_pinterest'] ); ?>" />
  626. </td>
  627. </tr>
  628. <tr>
  629. <th scope="row"><h4><?php _e( 'Youtube', 'simplecatch' ); ?></h4></th>
  630. <td><input type="text" size="45" name="simplecatch_options[social_youtube]" value="<?php echo esc_url( $options[ 'social_youtube' ] ); ?>" />
  631. </td>
  632. </tr>
  633. <tr>
  634. <th scope="row"><h4><?php _e( 'Vimeo', 'simplecatch' ); ?></h4></th>
  635. <td><input type="text" size="45" name="simplecatch_options[social_vimeo]" value="<?php echo esc_url( $options[ 'social_vimeo' ] ); ?>" />
  636. </td>
  637. </tr>
  638. <tr>
  639. <th scope="row"><h4><?php _e( 'Linkedin', 'simplecatch' ); ?> </h4></th>
  640. <td><input type="text" size="45" name="simplecatch_options[social_linkedin]" value="<?php echo esc_url( $options[ 'social_linkedin'] ); ?>" />
  641. </td>
  642. </tr>
  643. <tr>
  644. <th scope="row"><h4><?php _e( 'Slideshare', 'simplecatch' ); ?> </h4></th>
  645. <td><input type="text" size="45" name="simplecatch_options[social_slideshare]" value="<?php echo esc_url( $options[ 'social_slideshare'] ); ?>" />
  646. </td>
  647. </tr>
  648. <tr>
  649. <th scope="row"><h4><?php _e( 'Foursquare', 'simplecatch' ); ?></h4></th>
  650. <td><input type="text" size="45" name="simplecatch_options[social_foursquare]" value="<?php echo esc_url( $options[ 'social_foursquare' ] ); ?>" />
  651. </td>
  652. </tr>
  653. <tr>
  654. <th scope="row"><h4><?php _e( 'Flickr', 'simplecatch' ); ?></h4></th>
  655. <td><input type="text" size="45" name="simplecatch_options[social_flickr]" value="<?php echo esc_url( $options[ 'social_flickr' ] ); ?>" />
  656. </td>
  657. </tr>
  658. <tr>
  659. <th scope="row"><h4><?php _e( 'Tumblr', 'simplecatch' ); ?></h4></th>
  660. <td><input type="text" size="45" name="simplecatch_options[social_tumblr]" value="<?php echo esc_url( $options[ 'social_tumblr' ] ); ?>" />
  661. </td>
  662. </tr>
  663. <tr>
  664. <th scope="row"><h4><?php _e( 'deviantART', 'simplecatch' ); ?></h4></th>
  665. <td><input type="text" size="45" name="simplecatch_options[social_deviantart]" value="<?php echo esc_url( $options[ 'social_deviantart' ] ); ?>" />
  666. </td>
  667. </tr>
  668. <tr>
  669. <th scope="row"><h4><?php _e( 'Dribbble', 'simplecatch' ); ?></h4></th>
  670. <td><input type="text" size="45" name="simplecatch_options[social_dribbble]" value="<?php echo esc_url( $options[ 'social_dribbble' ] ); ?>" />
  671. </td>
  672. </tr>
  673. <tr>
  674. <th scope="row"><h4><?php _e( 'MySpace', 'simplecatch' ); ?></h4></th>
  675. <td><input type="text" size="45" name="simplecatch_options[social_myspace]" value="<?php echo esc_url( $options[ 'social_myspace' ] ); ?>" />
  676. </td>
  677. </tr>
  678. <tr>
  679. <th scope="row"><h4><?php _e( 'WordPress', 'simplecatch' ); ?></h4></th>
  680. <td><input type="text" size="45" name="simplecatch_options[social_wordpress]" value="<?php echo esc_url( $options[ 'social_wordpress' ] ); ?>" />
  681. </td>
  682. </tr>
  683. <tr>
  684. <th scope="row"><h4><?php _e( 'RSS', 'simplecatch' ); ?> </h4></th>
  685. <td><input type="text" size="45" name="simplecatch_options[social_rss]" value="<?php echo esc_url( $options[ 'social_rss' ] ); ?>" />
  686. </td>
  687. </tr>
  688. <tr>
  689. <th scope="row"><h4><?php _e( 'Delicious', 'simplecatch' ); ?></h4></th>
  690. <td><input type="text" size="45" name="simplecatch_options[social_delicious]" value="<?php echo esc_url( $options[ 'social_delicious' ] ); ?>" />
  691. </td>
  692. </tr>
  693. <tr>
  694. <th scope="row"><h4><?php _e( 'Last.fm', 'simplecatch' ); ?> </h4></th>
  695. <td><input type="text" size="45" name="simplecatch_options[social_lastfm]" value="<?php echo esc_url( $options[ 'social_lastfm' ] ); ?>" />
  696. </td>
  697. </tr>
  698. </tbody>
  699. </table>
  700. <p class="submit"><input type="submit" class="button-primary" value="<?php esc_attr_e( 'Save', 'simplecatch' ); ?>" /></p>
  701. </form>
  702. </div><!-- .wrap -->
  703. <?php
  704. }
  705. /*
  706. * Render catch options page
  707. * @uses settings_fields, get_option, bloginfo
  708. * @Settings Updated
  709. */
  710. function simplecatch_webmaster_options_do_page(){
  711. ?>
  712. <div id="catchthemes" class="wrap">
  713. <form method="post" action="options.php">
  714. <?php
  715. settings_fields( 'simplecatch_options' );
  716. global $simplecatch_options_settings;
  717. $options = $simplecatch_options_settings;
  718. ?>
  719. <?php screen_icon(); ?>
  720. <h2><?php bloginfo( 'name' ); ?> "<?php _e( 'Webmaster Tools Option', 'simplecatch' ); ?>" <?php _e( 'By', 'simplecatch' ); ?> <a href="<?php echo esc_url( __( 'http://catchthemes.com/', 'simplecatch' ) ); ?>" title="<?php esc_attr_e( 'Catch Themes', 'simplecatch' ); ?>" target="_blank"><?php _e( 'Catch Themes', 'simplecatch' ); ?></a></h2>
  721. <?php
  722. // Function to show the info bar
  723. if ( function_exists( 'simplecatch_infobar' ) ) :
  724. simplecatch_infobar();
  725. endif;
  726. ?>
  727. <?php if( isset( $_GET [ 'settings-updated' ] ) && $_GET[ 'settings-updated' ] == 'true' ): ?>
  728. <div class="updated" id="message">
  729. <p><strong><?php _e( 'Settings saved.', 'simplecatch' );?></strong></p>
  730. </div>
  731. <?php endif; ?>
  732. <div class="option-container">
  733. <h3 class="option-toggle"><a href="#"><?php _e( 'Site Verification', 'simplecatch' ); ?></a></h3>
  734. <div class="option-content inside">
  735. <table class="form-table">
  736. <tbody>
  737. <tr>
  738. <th scope="row"><label><?php _e( 'Google Site Verification ID', 'simplecatch' ); ?></label></th>
  739. <td><input type="text" size="45" name="simplecatch_options[google_verification]" value="<?php echo esc_attr( $options[ 'google_verification' ] ); ?>" /> <?php _e('Enter your Google ID number only', 'simplecatch'); ?>
  740. </td>
  741. </tr>
  742. <tr>
  743. <th scope="row"><label><?php _e( 'Yahoo Site Verification ID', 'simplecatch' ); ?></label></th>
  744. <td><input type="text" size="45" name="simplecatch_options[yahoo_verification]" value="<?php echo esc_attr( $options[ 'yahoo_verification'] ); ?>" /> <?php _e('Enter your Yahoo ID number only', 'simplecatch'); ?>
  745. </td>
  746. </tr>
  747. <tr>
  748. <th scope="row"><label><?php _e( 'Bing Site Verification ID', 'simplecatch' ); ?></label></th>
  749. <td><input type="text" size="45" name="simplecatch_options[bing_verification]" value="<?php echo esc_attr( $options[ 'bing_verification' ] ); ?>" /> <?php _e('Enter your Bing ID number only', 'simplecatch'); ?>
  750. </td>
  751. </tr>
  752. </tbody>
  753. </table>
  754. <p class="submit"><input type="submit" class="button-primary" value="<?php esc_attr_e( 'Save', 'simplecatch' ); ?>" /></p>
  755. </div><!-- .option-content -->
  756. </div><!-- .option-container -->
  757. <div class="option-container">
  758. <h3 class="option-toggle"><a href="#"><?php _e( 'Analytics', 'simplecatch' ); ?></a></h3>
  759. <div class="option-content inside">
  760. <table class="form-table">
  761. <tbody>
  762. <tr>
  763. <th scope="row"><?php _e( 'Code to display on Header', 'simplecatch' ); ?></th>
  764. <td>
  765. <textarea name="simplecatch_options[analytic_header]" id="analytics" rows="7" cols="80" ><?php echo esc_html( $options[ 'analytic_header' ] ); ?></textarea>
  766. </td>
  767. </tr>
  768. <tr>
  769. <td></td><td><?php _e('Note: Here you can put scripts from Google, Facebook etc. which will load on Header', 'simplecatch' ); ?></td>
  770. </tr>
  771. <tr>
  772. <th scope="row"><?php _e('Code to display on Footer', 'simplecatch' ); ?></th>
  773. <td>
  774. <textarea name="simplecatch_options[analytic_footer]" id="analytics" rows="7" cols="80" ><?php echo esc_html( $options[ 'analytic_footer' ] ); ?></textarea>
  775. </td>
  776. </tr>
  777. <tr>
  778. <td></td><td><?php _e( 'Note: Here you can put scripts from Google, Facebook, Add This etc. which will load on footer', 'simplecatch' ); ?></td>
  779. </tr>
  780. </tbody>
  781. </table>
  782. <p class="submit"><input type="submit" class="button-primary" value="<?php esc_attr_e( 'Save', 'simplecatch' ); ?>" /></p>
  783. </div><!-- .option-content -->
  784. </div><!-- .option-container -->
  785. </form>
  786. </div><!-- .wrap -->
  787. <?php
  788. }
  789. /**
  790. * Validate content options
  791. * @param array $options
  792. * @uses esc_url_raw, absint, esc_textarea, sanitize_text_field, simplecatch_invalidate_caches
  793. * @return array
  794. */
  795. function simplecatch_theme_options_validate( $options ) {
  796. global $simplecatch_options_settings;
  797. $input_validated = $simplecatch_options_settings;
  798. $input = array();
  799. $input = $options;
  800. // data validation for logo
  801. if ( isset( $input[ 'featured_logo_header' ] ) ) {
  802. $input_validated[ 'featured_logo_header' ] = esc_url_raw( $input[ 'featured_logo_header' ] );
  803. }
  804. if ( isset( $input['remove_header_logo'] ) ) {
  805. // Our checkbox value is either 0 or 1
  806. $input_validated[ 'remove_header_logo' ] = $input[ 'remove_header_logo' ];
  807. }
  808. if ( isset( $input['remove_site_title'] ) ) {
  809. // Our checkbox value is either 0 or 1
  810. $input_validated[ 'remove_site_title' ] = $input[ 'remove_site_title' ];
  811. }
  812. if ( isset( $input['remove_site_description'] ) ) {
  813. // Our checkbox value is either 0 or 1
  814. $input_validated[ 'remove_site_description' ] = $input[ 'remove_site_description' ];
  815. }
  816. if ( isset( $input[ 'featured_logo_footer' ] ) ) {
  817. $input_validated[ 'featured_logo_footer' ] = esc_url_raw( $input[ 'featured_logo_footer' ] );
  818. }
  819. if ( isset( $input['remove_footer_logo'] ) ) {
  820. // Our checkbox value is either 0 or 1
  821. $input_validated[ 'remove_footer_logo' ] = $input[ 'remove_footer_logo' ];
  822. }
  823. if ( isset( $input[ 'fav_icon' ] ) ) {
  824. $input_validated[ 'fav_icon' ] = esc_url_raw( $input[ 'fav_icon' ] );
  825. }
  826. if ( isset( $input['remove_favicon'] ) ) {
  827. // Our checkbox value is either 0 or 1
  828. $input_validated[ 'remove_favicon' ] = $input[ 'remove_favicon' ];
  829. }
  830. //Color Options
  831. if( isset( $input[ 'heading_color' ] ) ) {
  832. $input_validated[ 'heading_color' ] = wp_filter_nohtml_kses( $input[ 'heading_color' ] );
  833. }
  834. if( isset( $input[ 'meta_color' ] ) ) {
  835. $input_validated[ 'meta_color' ] = wp_filter_nohtml_kses( $input[ 'meta_color' ] );
  836. }
  837. if( isset( $input[ 'text_color' ] ) ) {
  838. $input_validated[ 'text_color' ] = wp_filter_nohtml_kses( $input[ 'text_color' ] );
  839. }
  840. if( isset( $input[ 'link_color' ] ) ) {
  841. $input_validated[ 'link_color' ] = wp_filter_nohtml_kses( $input[ 'link_color' ] );
  842. }
  843. if( isset( $input[ 'widget_heading_color' ] ) ) {
  844. $input_validated[ 'widget_heading_color' ] = wp_filter_nohtml_kses( $input[ 'widget_heading_color' ] );
  845. }
  846. if( isset( $input[ 'widget_text_color' ] ) ) {
  847. $input_validated[ 'widget_text_color' ] = wp_filter_nohtml_kses( $input[ 'widget_text_color' ] );
  848. }
  849. if ( isset( $input['reset_color'] ) ) {
  850. // Our checkbox value is either 0 or 1
  851. $input_validated[ 'reset_color' ] = $input[ 'reset_color' ];
  852. }
  853. //Reset Color Options
  854. if( $input[ 'reset_color' ] == 1 ) {
  855. global $simplecatch_options_defaults;
  856. $defaults = $simplecatch_options_defaults;
  857. $input_validated[ 'heading_color' ] = $defaults[ 'heading_color' ];
  858. $input_validated[ 'meta_color' ] = $defaults[ 'meta_color' ];
  859. $input_validated[ 'text_color' ] = $defaults[ 'text_color' ];
  860. $input_validated[ 'link_color' ] = $defaults[ 'link_color' ];
  861. $input_validated[ 'widget_heading_color' ] = $defaults[ 'widget_heading_color' ];
  862. $input_validated[ 'widget_text_color' ] = $defaults[ 'widget_text_color' ];
  863. }
  864. if ( isset( $input['exclude_slider_post'] ) ) {
  865. // Our checkbox value is either 0 or 1
  866. $input_validated[ 'exclude_slider_post' ] = $input[ 'exclude_slider_post' ];
  867. }
  868. // Front page posts categories
  869. if ( ! in_array ( '', (array) isset( $input['front_page_category'] ) ) ) {
  870. if ( in_array ( false, array_map( 'ctype_digit', (array) $input['front_page_category'] ) ) ) {
  871. unset($input['front_page_category']);
  872. } else {
  873. $input_validated['front_page_category'] = $input['front_page_category'];
  874. }
  875. }
  876. //data validation for Featured Slider
  877. if ( isset( $input[ 'slider_qty' ] ) ) {
  878. $input_validated[ 'slider_qty' ] = absint( $input[ 'slider_qty' ] ) ? $input [ 'slider_qty' ] : 4;
  879. }
  880. if ( isset( $input[ 'featured_slider' ] ) ) {
  881. $input_validated[ 'featured_slider' ] = array();
  882. }
  883. if ( isset( $input[ 'slider_qty' ] ) ) {
  884. for ( $i = 1; $i <= $input [ 'slider_qty' ]; $i++ ) {
  885. if ( !empty( $input[ 'featured_slider' ][ $i ] ) && intval( $input[ 'featured_slider' ][ $i ] ) ) {
  886. $input_validated[ 'featured_slider' ][ $i ] = absint($input[ 'featured_slider' ][ $i ] );
  887. }
  888. }
  889. }
  890. if ( isset( $input['remove_noise_effect'] ) ) {
  891. // Our checkbox value is either 0 or 1
  892. $input_validated[ 'remove_noise_effect' ] = $input[ 'remove_noise_effect' ];
  893. }
  894. if( isset( $input[ 'transition_effect' ] ) ) {
  895. $input_validated['transition_effect'] = wp_filter_nohtml_kses( $input['transition_effect'] );
  896. }
  897. // data validation for transition delay
  898. if ( isset( $input[ 'transition_delay' ] ) && is_numeric( $input[ 'transition_delay' ] ) ) {
  899. $input_validated[ 'transition_delay' ] = $input[ 'transition_delay' ];
  900. }
  901. // data validation for transition length
  902. if ( isset( $input[ 'transition_duration' ] ) && is_numeric( $input[ 'transition_duration' ] ) ) {
  903. $input_validated[ 'transition_duration' ] = $input[ 'transition_duration' ];
  904. }
  905. // data validation for Social Icons
  906. if( isset( $input[ 'social_facebook' ] ) ) {
  907. $input_validated[ 'social_facebook' ] = esc_url_raw( $input[ 'social_facebook' ] );
  908. }
  909. if( isset( $input[ 'social_twitter' ] ) ) {
  910. $input_validated[ 'social_twitter' ] = esc_url_raw( $input[ 'social_twitter' ] );
  911. }
  912. if( isset( $input[ 'social_googleplus' ] ) ) {
  913. $input_validated[ 'social_googleplus' ] = esc_url_raw( $input[ 'social_googleplus' ] );
  914. }
  915. if( isset( $input[ 'social_pinterest' ] ) ) {
  916. $input_validated[ 'social_pinterest' ] = esc_url_raw( $input[ 'social_pinterest' ] );
  917. }
  918. if( isset( $input[ 'social_youtube' ] ) ) {
  919. $input_validated[ 'social_youtube' ] = esc_url_raw( $input[ 'social_youtube' ] );
  920. }
  921. if( isset( $input[ 'social_vimeo' ] ) ) {
  922. $input_validated[ 'social_vimeo' ] = esc_url_raw( $input[ 'social_vimeo' ] );
  923. }
  924. if( isset( $input[ 'social_linkedin' ] ) ) {
  925. $input_validated[ 'social_linkedin' ] = esc_url_raw( $input[ 'social_linkedin' ] );
  926. }
  927. if( isset( $input[ 'social_slideshare' ] ) ) {
  928. $input_validated[ 'social_slideshare' ] = esc_url_raw( $input[ 'social_slideshare' ] );
  929. }
  930. if( isset( $input[ 'social_foursquare' ] ) ) {
  931. $input_validated[ 'social_foursquare' ] = esc_url_raw( $input[ 'social_foursquare' ] );
  932. }
  933. if( isset( $input[ 'social_flickr' ] ) ) {
  934. $input_validated[ 'social_flickr' ] = esc_url_raw( $input[ 'social_flickr' ] );
  935. }
  936. if( isset( $input[ 'social_tumblr' ] ) ) {
  937. $input_validated[ 'social_tumblr' ] = esc_url_raw( $input[ 'social_tumblr' ] );
  938. }
  939. if( isset( $input[ 'social_deviantart' ] ) ) {
  940. $input_validated[ 'social_deviantart' ] = esc_url_raw( $input[ 'social_deviantart' ] );
  941. }
  942. if( isset( $input[ 'social_dribbble' ] ) ) {
  943. $input_validated[ 'social_dribbble' ] = esc_url_raw( $input[ 'social_dribbble' ] );
  944. }
  945. if( isset( $input[ 'social_myspace' ] ) ) {
  946. $input_validated[ 'social_myspace' ] = esc_url_raw( $input[ 'social_myspace' ] );
  947. }
  948. if( isset( $input[ 'social_wordpress' ] ) ) {
  949. $input_validated[ 'social_wordpress' ] = esc_url_raw( $input[ 'social_wordpress' ] );
  950. }
  951. if( isset( $input[ 'social_rss' ] ) ) {
  952. $input_validated[ 'social_rss' ] = esc_url_raw( $input[ 'social_rss' ] );
  953. }
  954. if( isset( $input[ 'social_delicious' ] ) ) {
  955. $input_validated[ 'social_delicious' ] = esc_url_raw( $input[ 'social_delicious' ] );
  956. }
  957. if( isset( $input[ 'social_lastfm' ] ) ) {
  958. $input_validated[ 'social_lastfm' ] = esc_url_raw( $input[ 'social_lastfm' ] );
  959. }
  960. //Custom CSS Style Validation
  961. if ( isset( $input['custom_css'] ) ) {
  962. $input_validated['custom_css'] = wp_kses_stripslashes($input['custom_css']);
  963. }
  964. //Webmaster Tool Verification
  965. if( isset( $input[ 'google_verification' ] ) ) {
  966. $input_validated[ 'google_verification' ] = wp_filter_post_kses( $input[ 'google_verification' ] );
  967. }
  968. if( isset( $input[ 'yahoo_verification' ] ) ) {
  969. $input_validated[ 'yahoo_verification' ] = wp_filter_post_kses( $input[ 'yahoo_verification' ] );
  970. }
  971. if( isset( $input[ 'bing_verification' ] ) ) {
  972. $input_validated[ 'bing_verification' ] = wp_filter_post_kses( $input[ 'bing_verification' ] );
  973. }
  974. if( isset( $input[ 'analytic_header' ] ) ) {
  975. $input_validated[ 'analytic_header' ] = wp_kses_stripslashes( $input[ 'analytic_header' ] );
  976. }
  977. if( isset( $input[ 'analytic_footer' ] ) ) {
  978. $input_validated[ 'analytic_footer' ] = wp_kses_stripslashes( $input[ 'analytic_footer' ] );
  979. }
  980. // Layout settings verification
  981. if( isset( $input[ 'sidebar_layout' ] ) ) {
  982. $input_validated[ 'sidebar_layout' ] = $input[ 'sidebar_layout' ];
  983. }
  984. if( isset( $input[ 'more_tag_text' ] ) ) {
  985. $input_validated[ 'more_tag_text' ] = htmlentities( sanitize_text_field ( $input[ 'more_tag_text' ] ), ENT_QUOTES, 'UTF-8' );
  986. }
  987. if( isset( $input[ 'search_display_text' ] ) ) {
  988. $input_validated[ 'search_display_text' ] = sanitize_text_field( $input[ 'search_display_text' ] );
  989. }
  990. if( isset( $input[ 'search_button_text' ] ) ) {
  991. $input_validated[ 'search_button_text' ] = sanitize_text_field( $input[ 'search_button_text' ] );
  992. }
  993. //data validation for excerpt length
  994. if ( isset( $input[ 'excerpt_length' ] ) ) {
  995. $input_validated[ 'excerpt_length' ] = absint( $input[ 'excerpt_length' ] ) ? $input [ 'excerpt_length' ] : 30;
  996. }
  997. //Feed Redirect
  998. if ( isset( $input[ 'feed_url' ] ) ) {
  999. $input_validated['feed_url'] = esc_url_raw($input['feed_url']);
  1000. }
  1001. //Clearing the theme option cache
  1002. if( function_exists( 'simplecatch_themeoption_invalidate_caches' ) ) simplecatch_themeoption_invalidate_caches();
  1003. return $input_validated;
  1004. }
  1005. /*
  1006. * Clearing the cache if any changes in Admin Theme Option
  1007. */
  1008. function simplecatch_themeoption_invalidate_caches(){
  1009. delete_transient( 'simplecatch_headerdetails' ); // header logo on header
  1010. delete_transient( 'simplecatch_footerlogo' ); // footer logo on footer
  1011. delete_transient( 'simplecatch_favicon' ); // favicon on cpanel/ backend and frontend
  1012. delete_transient( 'simplecatch_sliders' ); // featured slider
  1013. delete_transient( 'simplecatch_headersocialnetworks' ); // Social links on header
  1014. delete_transient( 'simplecatch_site_verification' ); // scripts which loads on header
  1015. delete_transient( 'simplecatch_footercode' ); // scripts which loads on footer
  1016. delete_transient( 'simplecatch_inline_css' ); // Custom Inline CSS
  1017. }
  1018. /*
  1019. * Clears caching for header title and description
  1020. */
  1021. function simplecatch_header_caching() {
  1022. delete_transient( 'simplecatch_headerdetails' );
  1023. }
  1024. add_action('update_option_blogname','simplecatch_header_caching');
  1025. add_action('update_option_blogdescription','simplecatch_header_caching');
  1026. /*
  1027. * Clearing the cache if any changes in post or page
  1028. */
  1029. function simplecatch_post_invalidate_caches(){
  1030. delete_transient( 'simplecatch_sliders' );
  1031. }
  1032. //Add action hook here save post
  1033. add_action( 'save_post', 'simplecatch_post_invalidate_caches' );
  1034. /**
  1035. * Backward Comaptibility for simplecatch version 1.2.7 and below
  1036. *
  1037. * Fetch the old values of options array and merge it with new one
  1038. * Fetch the old meta values of the page template and update the layout metabox using those metavalues
  1039. * @used init hook
  1040. */
  1041. function simplecatch_backward_compatibility() {
  1042. $old = get_option('simplecatch_options_slider');
  1043. if( !empty( $old ) ) {
  1044. $new = get_option( 'simplecatch_options' );
  1045. $result = array_merge( $new, $old );
  1046. update_option( 'simplecatch_options', $result );
  1047. delete_option( 'simplecatch_options_slider');
  1048. }
  1049. }
  1050. add_action('init','simplecatch_backward_compatibility');
  1051. /**
  1052. * Backward Comaptibility for simplecatch version below 1.3.2
  1053. *
  1054. * Fetch the old meta values of the page template and update the layout metabox using those metavalues
  1055. * @used init hook
  1056. */
  1057. function simplecatch_template_backward_compatibility() {
  1058. global $post;
  1059. $reset_template=get_option('reset_template');
  1060. if( empty( $reset_template ) ):
  1061. $query = new WP_Query( array( 'post_type' => 'page','posts_per_page' => -1 ) );
  1062. while( $query->have_posts() ): $query->the_post();
  1063. $flag = get_post_meta( $post->ID, '_wp_page_template', 'true' );
  1064. if( $flag == 'sidebar-right.php' )
  1065. update_post_meta( $post->ID, 'Sidebar-layout', 'right-sidebar' );
  1066. elseif( $flag == 'sidebar-left.php')
  1067. update_post_meta( $post->ID, 'Sidebar-layout', 'left-sidebar' );
  1068. elseif( $flag == 'default' )
  1069. update_post_meta( $post->ID, 'Sidebar-layout', 'no-sidebar');
  1070. delete_post_meta( $post->ID, '_wp_page_template');
  1071. endwhile;
  1072. // Reset Post Data
  1073. wp_reset_postdata();
  1074. update_option( 'reset_template',true );
  1075. endif;
  1076. }
  1077. add_action('init','simplecatch_template_backward_compatibility', 10 );
  1078. /**
  1079. * Backward Comaptibility for simplecatch version 1.3.2
  1080. * Deleting Sidebar-layout meta key from database and replacing it with simplecatch-sidebarlayout
  1081. *
  1082. * Fetch the old meta values of the page and post template and update the layout metabox using those metavalues
  1083. * @used init hook
  1084. */
  1085. function simplecatch_sidebar_layout_backward_compatibility() {
  1086. global $post;
  1087. $reset_sidebar_layoutkey = get_option('reset_sidebar_layoutkey');
  1088. if( empty( $reset_sidebar_layoutkey ) ):
  1089. // Updating the date format
  1090. update_option( 'date_format', 'j F, Y' );
  1091. $query = new WP_Query( array( 'post_type' => array('page', 'post'),'posts_per_page' => -1 ) );
  1092. while( $query->have_posts() ): $query->the_post();
  1093. $flag = get_post_meta( $post->ID, 'Sidebar-layout', 'true' );
  1094. update_post_meta( $post->ID, 'simplecatch-sidebarlayout', $flag );
  1095. delete_post_meta( $post->ID, 'Sidebar-layout');
  1096. endwhile;
  1097. // Reset Post Data
  1098. wp_reset_postdata();
  1099. update_option( 'reset_sidebar_layoutkey',true );
  1100. endif;
  1101. }
  1102. add_action('init','simplecatch_sidebar_layout_backward_compatibility', 20 );
  1103. /**
  1104. * Delete the database option on theme switch
  1105. * @used switch_theme hook
  1106. */
  1107. function simplecatch_reset_template_cache() {
  1108. delete_option( 'reset_template' );
  1109. delete_option( 'reset_sidebar_layoutkey' );
  1110. }
  1111. add_action( 'switch_theme', 'simplecatch_reset_template_cache');