PageRenderTime 48ms CodeModel.GetById 17ms RepoModel.GetById 1ms app.codeStats 0ms

/wp-content/themes/catch-box/inc/theme-options.php

https://github.com/ActivateNY/activateny.org
PHP | 1472 lines | 976 code | 204 blank | 292 comment | 149 complexity | 5f4a986b06eebbf77f1c14c54c17dec5 MD5 | raw file
Possible License(s): GPL-2.0, AGPL-1.0, LGPL-2.1

Large files files are truncated, but you can click here to view the full file

  1. <?php
  2. /**
  3. * Catch Box Theme Options
  4. *
  5. * @package Catch Themes
  6. * @subpackage Catch_Box
  7. * @since Catch Box 1.0
  8. */
  9. /**
  10. * Properly enqueue styles and scripts for our theme options page.
  11. *
  12. * This function is attached to the admin_enqueue_scripts action hook.
  13. *
  14. * @since Catch Box 1.0
  15. *
  16. */
  17. function catchbox_admin_enqueue_scripts( $hook_suffix ) {
  18. wp_enqueue_style( 'catchbox-theme-options', get_template_directory_uri() . '/inc/theme-options.css', false, '2011-04-28' );
  19. wp_enqueue_script( 'catchbox-theme-options', get_template_directory_uri() . '/inc/theme-options.js', array( 'farbtastic' ), '2011-06-10' );
  20. wp_enqueue_style( 'farbtastic' );
  21. wp_enqueue_script( 'simplecatch_upload', get_template_directory_uri().'/inc/add_image_scripts.js', array( 'jquery','media-upload','thickbox' ) );
  22. wp_enqueue_style( 'thickbox' );
  23. }
  24. add_action( 'admin_print_styles-appearance_page_theme_options', 'catchbox_admin_enqueue_scripts' );
  25. add_action( 'admin_print_styles-appearance_page_slider_options', 'catchbox_admin_enqueue_scripts' );
  26. add_action( 'admin_print_styles-appearance_page_social_links', 'catchbox_admin_enqueue_scripts' );
  27. add_action( 'admin_print_styles-appearance_page_webmaster_tools', 'catchbox_admin_enqueue_scripts' );
  28. /**
  29. * Register the form setting for our catchbox_options array.
  30. *
  31. * This function is attached to the admin_init action hook.
  32. *
  33. * This call to register_setting() registers a validation callback, catchbox_theme_options_validate(),
  34. * which is used when the option is saved, to ensure that our option values are complete, properly
  35. * formatted, and safe.
  36. *
  37. * We also use this function to add our theme option if it doesn't already exist.
  38. *
  39. * @since Catch Box 1.0
  40. */
  41. function catchbox_theme_options_init() {
  42. // If we have no options in the database, let's add them now.
  43. if ( false === catchbox_get_theme_options() )
  44. add_option( 'catchbox_theme_options', catchbox_get_default_theme_options() );
  45. register_setting(
  46. 'catchbox_options', // Options group, see settings_fields() call in catchbox_theme_options_render_page()
  47. 'catchbox_theme_options', // Database option, see catchbox_get_theme_options()
  48. 'catchbox_theme_options_validate' // The sanitization callback, see catchbox_theme_options_validate()
  49. );
  50. register_setting(
  51. 'catchbox_options_slider', // Options group, see settings_fields() call in catchbox_theme_options_render_page()
  52. 'catchbox_options_slider', // Database option, see catchbox_get_theme_options()
  53. 'catchbox_options_validation' // The sanitization callback, see catchbox_theme_options_validate()
  54. );
  55. register_setting(
  56. 'catchbox_options_webmaster', // Options group, see settings_fields() call in catchbox_theme_options_render_page()
  57. 'catchbox_options_webmaster', // Database option, see catchbox_get_theme_options()
  58. 'catchbox_options_webmaster_validation' // The sanitization callback, see catchbox_theme_options_validate()
  59. );
  60. register_setting(
  61. 'catchbox_options_social_links', // Options group, see settings_fields() call in catchbox_theme_options_render_page()
  62. 'catchbox_options_social_links', // Database option, see catchbox_get_theme_options()
  63. 'catchbox_options_social_links_validation' // The sanitization callback, see catchbox_theme_options_validate()
  64. );
  65. // Register our settings field group
  66. add_settings_section(
  67. 'general', // Unique identifier for the settings section
  68. '', // Section title (we don't want one)
  69. '__return_false', // Section callback (we don't want anything)
  70. 'theme_options' // Menu slug, used to uniquely identify the page; see catchbox_theme_options_add_page()
  71. );
  72. // Register our individual settings fields
  73. add_settings_field(
  74. 'favicon', // Unique identifier for the field for this section
  75. __( 'Favicon URL', 'catchbox' ), // Setting field label
  76. 'catchbox_settings_field_favicon', // Function that renders the settings field
  77. 'theme_options', // Menu slug, used to uniquely identify the page; see catchbox_theme_options_add_page()
  78. 'general' // Settings section. Same as the first argument in the add_settings_section() above
  79. );
  80. // Register our individual settings fields
  81. add_settings_field(
  82. 'webclip', // Unique identifier for the field for this section
  83. __( 'Web Clip Icon URL', 'catchbox' ), // Setting field label
  84. 'catchbox_settings_field_webclip', // Function that renders the settings field
  85. 'theme_options', // Menu slug, used to uniquely identify the page; see catchbox_theme_options_add_page()
  86. 'general' // Settings section. Same as the first argument in the add_settings_section() above
  87. );
  88. // Register our individual settings fields
  89. add_settings_field(
  90. 'color_scheme', // Unique identifier for the field for this section
  91. __( 'Color Scheme', 'catchbox' ), // Setting field label
  92. 'catchbox_settings_field_color_scheme', // Function that renders the settings field
  93. 'theme_options', // Menu slug, used to uniquely identify the page; see catchbox_theme_options_add_page()
  94. 'general' // Settings section. Same as the first argument in the add_settings_section() above
  95. );
  96. add_settings_field(
  97. 'link_color', // Unique identifier for the field for this section
  98. __( 'Link Color', 'catchbox' ), // Setting field label
  99. 'catchbox_settings_field_link_color', // Function that renders the settings field
  100. 'theme_options', // Menu slug, used to uniquely identify the page; see catchbox_theme_options_add_page()
  101. 'general' // Settings section. Same as the first argument in the add_settings_section() above
  102. );
  103. add_settings_field(
  104. 'layout', // Unique identifier for the field for this section
  105. __( 'Default Layout', 'catchbox' ), // Setting field label
  106. 'catchbox_settings_field_layout', // Function that renders the settings field
  107. 'theme_options', // Menu slug, used to uniquely identify the page; see catchbox_theme_options_add_page()
  108. 'general' // Settings section. Same as the first argument in the add_settings_section() above
  109. );
  110. add_settings_field(
  111. 'content_layout', // Unique identifier for the settings section
  112. __( 'Content layout', 'catchbox' ), // Setting field label
  113. 'catchbox_settings_field_content_scheme', // Function that renders the settings field
  114. 'theme_options', // Menu slug, used to uniquely identify the page; see catchbox_theme_options_add_page()
  115. 'general' // Settings section. Same as the first argument in the add_settings_section() above
  116. );
  117. add_settings_field(
  118. 'excerpt_length', // Unique identifier for the settings section
  119. __( 'Excerpt Length in Words', 'catchbox' ), // Setting field label
  120. 'catchbox_settings_field_excerpt_length', // Function that renders the settings field
  121. 'theme_options', // Menu slug, used to uniquely identify the page; see catchbox_theme_options_add_page()
  122. 'general' // Settings section. Same as the first argument in the add_settings_section() above
  123. );
  124. add_settings_field(
  125. 'feed_redirect', // Unique identifier for the settings section
  126. __( 'Feed Redirect URL', 'catchbox' ), // Setting field label
  127. 'catchbox_settings_field_feed_redirect', // Function that renders the settings field
  128. 'theme_options', // Menu slug, used to uniquely identify the page; see catchbox_theme_options_add_page()
  129. 'general' // Settings section. Same as the first argument in the add_settings_section() above
  130. );
  131. add_settings_field(
  132. 'disable_header_search', // Unique identifier for the settings section
  133. __( 'Disable Search in Header', 'catchbox' ), // Setting field label
  134. 'catchbox_settings_field_disable_header_search', // Function that renders the settings field
  135. 'theme_options', // Menu slug, used to uniquely identify the page; see catchbox_theme_options_add_page()
  136. 'general' // Settings section. Same as the first argument in the add_settings_section() above
  137. );
  138. add_settings_field(
  139. 'custom_css', // Unique identifier for the settings section
  140. __( 'Custom CSS Styles', 'catchbox' ), // Setting field label
  141. 'catchbox_settings_field_custom_css', // Function that renders the settings field
  142. 'theme_options', // Menu slug, used to uniquely identify the page; see catchbox_theme_options_add_page()
  143. 'general' // Settings section. Same as the first argument in the add_settings_section() above
  144. );
  145. }
  146. add_action( 'admin_init', 'catchbox_theme_options_init' );
  147. /**
  148. * Change the capability required to save the 'catchbox_options' options group.
  149. *
  150. * @see catchbox_theme_options_init() First parameter to register_setting() is the name of the options group.
  151. * @see catchbox_theme_options_add_page() The edit_theme_options capability is used for viewing the page.
  152. *
  153. * By default, the options groups for all registered settings require the manage_options capability.
  154. * This filter is required to change our theme options page to edit_theme_options instead.
  155. * By default, only administrators have either of these capabilities, but the desire here is
  156. * to allow for finer-grained control for roles and users.
  157. *
  158. * @param string $capability The capability used for the page, which is manage_options by default.
  159. * @return string The capability to actually use.
  160. */
  161. function catchbox_option_page_capability( $capability ) {
  162. return 'edit_theme_options';
  163. }
  164. add_filter( 'option_page_capability_catchbox_options', 'catchbox_option_page_capability' );
  165. /**
  166. * Add our theme options page to the admin menu, including some help documentation.
  167. *
  168. * This function is attached to the admin_menu action hook.
  169. *
  170. * @since Catch Box 1.0
  171. */
  172. function catchbox_theme_options_add_page() {
  173. $theme_page = add_theme_page(
  174. __( 'Theme Options', 'catchbox' ), // Name of page
  175. __( 'Theme Options', 'catchbox' ), // Label in menu
  176. 'edit_theme_options', // Capability required
  177. 'theme_options', // Menu slug, used to uniquely identify the page
  178. 'catchbox_theme_options_render_page' // Function that renders the options page
  179. );
  180. $slider_options = add_theme_page(
  181. __( 'Featured Slider', 'catchbox' ), // Name of page
  182. __( 'Featured Slider', 'catchbox' ), // Label in menu
  183. 'edit_theme_options', // Capability required
  184. 'slider_options', // Menu slug, used to uniquely identify the page
  185. 'catchbox_options_slider_page' // Function that renders the options page
  186. );
  187. $social_link_options = add_theme_page(
  188. __( 'Social Links', 'catchbox' ), // Name of page
  189. __( 'Social Links', 'catchbox' ), // Label in menu
  190. 'edit_theme_options', // Capability required
  191. 'social_links', // Menu slug, used to uniquely identify the page
  192. 'catchbox_options_social_links' // Function that renders the options page
  193. );
  194. $webmaster_tool_options = add_theme_page(
  195. __( 'Webmaster Tools', 'catchbox' ), // Name of page
  196. __( 'Webmaster Tools', 'catchbox' ), // Label in menu
  197. 'edit_theme_options', // Capability required
  198. 'webmaster_tools', // Menu slug, used to uniquely identify the page
  199. 'catchbox_options_webmaster_tools' // Function that renders the options page
  200. );
  201. if ( ! $theme_page )
  202. return;
  203. add_action( "load-$theme_page", 'catchbox_theme_options_help' );
  204. add_action( "load-$slider_options", 'catchbox_slider_options_help' );
  205. }
  206. add_action( 'admin_menu', 'catchbox_theme_options_add_page' );
  207. function catchbox_theme_options_help() {
  208. $help = '<p>' . __( 'Some themes provide customization options that are grouped together on a Theme Options screen. If you change themes, options may change or disappear, as they are theme-specific. Your current theme, Catch Box, provides the following Theme Options:', 'catchbox' ) . '</p>' .
  209. '<ol>' .
  210. '<li>' . __( '<strong>Color Scheme</strong>: You can choose a color palette of "Light" (light background with dark text) or "Dark" (dark background with light text) for your site.', 'catchbox' ) . '</li>' .
  211. '<li>' . __( '<strong>Link Color</strong>: You can choose the color used for text links on your site. You can enter the HTML color or hex code, or you can choose visually by clicking the "Select a Color" button to pick from a color wheel.', 'catchbox' ) . '</li>' .
  212. '<li>' . __( '<strong>Default Layout</strong>: You can choose if you want your site&#8217;s default layout to have a sidebar on the left, the right, or not at all.', 'catchbox' ) . '</li>' .
  213. '</ol>' .
  214. '<p>' . __( 'Remember to click "Save Changes" to save any changes you have made to the theme options.', 'catchbox' ) . '</p>';
  215. $sidebar = '<p><strong>' . __( 'For more information:', 'catchbox' ) . '</strong></p>' .
  216. '<p>' . __( '<a href="http://codex.wordpress.org/Appearance_Theme_Options_Screen" target="_blank">Documentation on Theme Options</a>', 'catchbox' ) . '</p>' .
  217. '<p>' . __( '<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>', 'catchbox' ) . '</p>';
  218. $screen = get_current_screen();
  219. if ( method_exists( $screen, 'add_help_tab' ) ) {
  220. // WordPress 3.3
  221. $screen->add_help_tab( array(
  222. 'title' => __( 'Overview', 'catchbox' ),
  223. 'id' => 'theme-options-help',
  224. 'content' => $help,
  225. )
  226. );
  227. $screen->set_help_sidebar( $sidebar );
  228. }
  229. }
  230. function catchbox_slider_options_help() {
  231. $help = '<p>' . __( 'Slider Some themes provide customization options that are grouped together on a Theme Options screen. If you change themes, options may change or disappear, as they are theme-specific. Your current theme, Catch Box, provides the following Theme Options:', 'catchbox' ) . '</p>' .
  232. '<ol>' .
  233. '<li>' . __( '<strong>Color Scheme</strong>: You can choose a color palette of "Light" (light background with dark text) or "Dark" (dark background with light text) for your site.', 'catchbox' ) . '</li>' .
  234. '<li>' . __( '<strong>Link Color</strong>: You can choose the color used for text links on your site. You can enter the HTML color or hex code, or you can choose visually by clicking the "Select a Color" button to pick from a color wheel.', 'catchbox' ) . '</li>' .
  235. '<li>' . __( '<strong>Default Layout</strong>: You can choose if you want your site&#8217;s default layout to have a sidebar on the left, the right, or not at all.', 'catchbox' ) . '</li>' .
  236. '</ol>' .
  237. '<p>' . __( 'Remember to click "Save Changes" to save any changes you have made to the theme options.', 'catchbox' ) . '</p>';
  238. $screen = get_current_screen();
  239. if ( method_exists( $screen, 'add_help_tab' ) ) {
  240. // WordPress 3.3
  241. $screen->add_help_tab( array(
  242. 'title' => __( 'Overview', 'catchbox' ),
  243. 'id' => 'slider-options-help',
  244. 'content' => $help,
  245. )
  246. );
  247. }
  248. }
  249. /**
  250. * Renders the favicon url setting field.
  251. *
  252. * @since Catch Box 1.6
  253. */
  254. function catchbox_settings_field_favicon() {
  255. $options = catchbox_get_theme_options();
  256. ?>
  257. <input class="upload-url" type="text" name="catchbox_theme_options[fav_icon]" id="fav-icon" size="65" value="<?php if ( isset( $options[ 'fav_icon' ] ) ) echo esc_attr( $options[ 'fav_icon'] ); ?>" />
  258. <input id="st_upload_button" class="st_upload_button button" name="wsl-image-add" type="button" value="<?php esc_attr_e( 'Add/Change Favicon','simplecatch' );?>" />
  259. <?php
  260. }
  261. /**
  262. * Renders the favicon url setting field.
  263. *
  264. * @since Catch Box 2.0.3
  265. */
  266. function catchbox_settings_field_webclip() {
  267. $options = catchbox_get_theme_options();
  268. ?>
  269. <input class="upload-url" type="text" name="catchbox_theme_options[web_clip]" id="web-clip" size="65" value="<?php if ( isset( $options[ 'web_clip' ] ) ) echo esc_attr( $options[ 'web_clip'] ); ?>" />
  270. <input id="st_upload_button" class="st_upload_button button" name="wsl-image-add" type="button" value="<?php esc_attr_e( 'Add/Change Web Clip Icon','simplecatch' );?>" />
  271. <?php
  272. }
  273. /**
  274. * Returns an array of color schemes registered for Catch Box.
  275. *
  276. * @since Catch Box 1.0
  277. */
  278. function catchbox_color_schemes() {
  279. $color_scheme_options = array(
  280. 'light' => array(
  281. 'value' => 'light',
  282. 'label' => __( 'Light', 'catchbox' ),
  283. 'thumbnail' => get_template_directory_uri() . '/inc/images/light.png',
  284. 'default_link_color' => '#1b8be0',
  285. ),
  286. 'dark' => array(
  287. 'value' => 'dark',
  288. 'label' => __( 'Dark', 'catchbox' ),
  289. 'thumbnail' => get_template_directory_uri() . '/inc/images/dark.png',
  290. 'default_link_color' => '#e4741f',
  291. ),
  292. 'blue' => array(
  293. 'value' => 'blue',
  294. 'label' => __( 'Blue', 'catchbox' ),
  295. 'thumbnail' => get_template_directory_uri() . '/inc/images/blue.png',
  296. 'default_link_color' => '#326693',
  297. ),
  298. );
  299. return apply_filters( 'catchbox_color_schemes', $color_scheme_options );
  300. }
  301. /**
  302. * Returns an array of layout options registered for Catch Box.
  303. *
  304. * @since Catch Box 1.0
  305. */
  306. function catchbox_layouts() {
  307. $layout_options = array(
  308. 'content-sidebar' => array(
  309. 'value' => 'content-sidebar',
  310. 'label' => __( 'Content on left', 'catchbox' ),
  311. 'thumbnail' => get_template_directory_uri() . '/inc/images/content-sidebar.png',
  312. ),
  313. 'sidebar-content' => array(
  314. 'value' => 'sidebar-content',
  315. 'label' => __( 'Content on right', 'catchbox' ),
  316. 'thumbnail' => get_template_directory_uri() . '/inc/images/sidebar-content.png',
  317. ),
  318. 'content-onecolumn' => array(
  319. 'value' => 'content-onecolumn',
  320. 'label' => __( 'One-column, no sidebar', 'catchbox' ),
  321. 'thumbnail' => get_template_directory_uri() . '/inc/images/content.png',
  322. ),
  323. );
  324. return apply_filters( 'catchbox_layouts', $layout_options );
  325. }
  326. /**
  327. * Returns an array of content layout options registered for Catch Box.
  328. *
  329. * @since Catch Box 1.0
  330. */
  331. function catchbox_content_layout() {
  332. $content_options = array(
  333. 'excerpt' => array(
  334. 'value' => 'excerpt',
  335. 'label' => __( 'Show excerpt', 'catchbox' ),
  336. 'thumbnail' => get_template_directory_uri() . '/inc/images/excerpt.png',
  337. ),
  338. 'full-content' => array(
  339. 'value' => 'full-content',
  340. 'label' => __( 'Show full content', 'catchbox' ),
  341. 'thumbnail' => get_template_directory_uri() . '/inc/images/full-content.png',
  342. )
  343. );
  344. return apply_filters( 'catchbox_content_layouts', $content_options );
  345. }
  346. /**
  347. * Returns the default options for Catch Box.
  348. *
  349. * @since Catch Box 1.0
  350. */
  351. function catchbox_get_default_theme_options() {
  352. $default_theme_options = array(
  353. 'excerpt_length' => 40,
  354. 'color_scheme' => 'light',
  355. 'link_color' => catchbox_get_default_link_color( 'light' ),
  356. 'theme_layout' => 'content-sidebar',
  357. 'content_layout' => 'excerpt',
  358. 'disable_header_search' => '0'
  359. );
  360. if ( is_rtl() )
  361. $default_theme_options['theme_layout'] = 'sidebar-content';
  362. return apply_filters( 'catchbox_default_theme_options', $default_theme_options );
  363. }
  364. /**
  365. * Returns the default link color for Catch Box, based on color scheme.
  366. *
  367. * @since Catch Box 1.0
  368. *
  369. * @param $string $color_scheme Color scheme. Defaults to the active color scheme.
  370. * @return $string Color.
  371. */
  372. function catchbox_get_default_link_color( $color_scheme = null ) {
  373. if ( null === $color_scheme ) {
  374. $options = catchbox_get_theme_options();
  375. $color_scheme = $options['color_scheme'];
  376. }
  377. $color_schemes = catchbox_color_schemes();
  378. if ( ! isset( $color_schemes[ $color_scheme ] ) )
  379. return false;
  380. return $color_schemes[ $color_scheme ]['default_link_color'];
  381. }
  382. /**
  383. * Returns the options array for Catch Box.
  384. *
  385. * @since Catch Box 1.0
  386. */
  387. function catchbox_get_theme_options() {
  388. return get_option( 'catchbox_theme_options', catchbox_get_default_theme_options() );
  389. }
  390. /**
  391. * Renders the Color Scheme setting field.
  392. *
  393. * @since Catch Box 1.0
  394. */
  395. function catchbox_settings_field_color_scheme() {
  396. $options = catchbox_get_theme_options();
  397. foreach ( catchbox_color_schemes() as $scheme ) {
  398. ?>
  399. <div class="layout image-radio-option color-scheme">
  400. <label class="description">
  401. <input type="radio" name="catchbox_theme_options[color_scheme]" value="<?php echo esc_attr( $scheme['value'] ); ?>" <?php checked( $options['color_scheme'], $scheme['value'] ); ?> />
  402. <input type="hidden" id="default-color-<?php echo esc_attr( $scheme['value'] ); ?>" value="<?php echo esc_attr( $scheme['default_link_color'] ); ?>" />
  403. <span>
  404. <img src="<?php echo esc_url( $scheme['thumbnail'] ); ?>" width="164" height="122" alt="" />
  405. <?php echo $scheme['label']; ?>
  406. </span>
  407. </label>
  408. </div>
  409. <?php
  410. }
  411. }
  412. /**
  413. * Renders the Link Color setting field.
  414. *
  415. * @since Catch Box 1.0
  416. */
  417. function catchbox_settings_field_link_color() {
  418. $options = catchbox_get_theme_options();
  419. ?>
  420. <input type="text" name="catchbox_theme_options[link_color]" id="link-color" value="<?php echo esc_attr( $options['link_color'] ); ?>" />
  421. <a href="#" class="pickcolor hide-if-no-js" id="link-color-example"></a>
  422. <input type="button" class="pickcolor button hide-if-no-js" value="<?php esc_attr_e( 'Select a Color', 'catchbox' ); ?>" />
  423. <div id="colorPickerDiv" style="z-index: 100; background:#eee; border:1px solid #ccc; position:absolute; display:none;"></div>
  424. <br />
  425. <span><?php printf( __( 'Default color: %s', 'catchbox' ), '<span id="default-color">' . catchbox_get_default_link_color( $options['color_scheme'] ) . '</span>' ); ?></span>
  426. <?php
  427. }
  428. /**
  429. * Renders the excerpt length setting field.
  430. *
  431. * @since Catch Box 1.1.3
  432. */
  433. function catchbox_settings_field_excerpt_length() {
  434. $options = catchbox_get_theme_options();
  435. if( empty( $options['excerpt_length'] ) )
  436. $options = catchbox_get_default_theme_options();
  437. ?>
  438. <input type="text" name="catchbox_theme_options[excerpt_length]" id="excerpt-length" size="3" value="<?php if ( isset( $options[ 'excerpt_length' ] ) ) echo absint( $options[ 'excerpt_length'] ); ?>" />
  439. <?php
  440. }
  441. /**
  442. * Renders the feed redirect setting field.
  443. *
  444. * @since Catch Box 1.0
  445. */
  446. function catchbox_settings_field_feed_redirect() {
  447. $options = catchbox_get_theme_options();
  448. ?>
  449. <input type="text" name="catchbox_theme_options[feed_url]" id="feed-url" size="65" value="<?php if ( isset( $options[ 'feed_url' ] ) ) echo esc_attr( $options[ 'feed_url'] ); ?>" />
  450. <?php
  451. }
  452. /**
  453. * Renders the feed redirect setting field.
  454. *
  455. * @since Catch Box 1.3.1
  456. */
  457. function catchbox_settings_field_disable_header_search() {
  458. $options = catchbox_get_theme_options();
  459. if( empty( $options['disable_header_search'] ) )
  460. $options = catchbox_get_default_theme_options();
  461. ?>
  462. <input type="checkbox" id="disable-header-search" name="catchbox_theme_options[disable_header_search]" value="1" <?php checked( '1', $options['disable_header_search'] ); ?> />
  463. <?php
  464. }
  465. /**
  466. * Renders the Custom CSS styles setting fields
  467. *
  468. * @since Catch Box 1.0
  469. */
  470. function catchbox_settings_field_custom_css() {
  471. $options = catchbox_get_theme_options();
  472. ?>
  473. <textarea id="custom-css" cols="90" rows="12" name="catchbox_theme_options[custom_css]"><?php if (!empty($options['custom_css'] ) )echo esc_attr($options['custom_css']); ?></textarea> <br />
  474. <?php _e('CSS Tutorial from W3Schools.', 'catchbox'); ?> <a class="button" href="<?php echo esc_url( __( 'http://www.w3schools.com/css/default.asp','catchbox' ) ); ?>" title="<?php esc_attr_e( 'CSS Tutorial', 'catchbox' ); ?>" target="_blank"><?php _e( 'Click Here to Read', 'catchbox' );?></a>
  475. <?php
  476. }
  477. /**
  478. * Renders the Layout setting field.
  479. *
  480. * @since Catch Box 1.0
  481. */
  482. function catchbox_settings_field_layout() {
  483. $options = catchbox_get_theme_options();
  484. foreach ( catchbox_layouts() as $layout ) {
  485. ?>
  486. <div class="layout image-radio-option theme-layout">
  487. <label class="description">
  488. <input type="radio" name="catchbox_theme_options[theme_layout]" value="<?php echo esc_attr( $layout['value'] ); ?>" <?php checked( $options['theme_layout'], $layout['value'] ); ?> />
  489. <span>
  490. <img src="<?php echo esc_url( $layout['thumbnail'] ); ?>" width="136" height="122" alt="" />
  491. <?php echo $layout['label']; ?>
  492. </span>
  493. </label>
  494. </div>
  495. <?php
  496. }
  497. }
  498. /**
  499. * Renders the Content layout setting fields.
  500. *
  501. * @since Catch Box 1.0
  502. */
  503. function catchbox_settings_field_content_scheme() {
  504. $options = catchbox_get_theme_options();
  505. foreach ( catchbox_content_layout() as $content ) {
  506. ?>
  507. <div class="layout image-radio-option theme-layout">
  508. <label class="description">
  509. <input type="radio" name="catchbox_theme_options[content_layout]" value="<?php echo esc_attr( $content['value'] ); ?>" <?php checked( $options['content_layout'], $content['value'] ); ?> />
  510. <span>
  511. <img src="<?php echo esc_url( $content['thumbnail'] ); ?>" width="164" height="163" alt="" />
  512. <?php echo $content['label']; ?>
  513. </span>
  514. </label>
  515. </div>
  516. <?php
  517. }
  518. }
  519. /**
  520. * Returns the options array for Catch Box.
  521. *
  522. * @since Catch Box 1.0
  523. */
  524. function catchbox_theme_options_render_page() {
  525. ?>
  526. <div class="wrap">
  527. <?php screen_icon(); ?>
  528. <h2>
  529. <?php
  530. if( function_exists( 'wp_get_theme' ) ) {
  531. printf( __( '%s Theme Options By', 'catchbox' ), wp_get_theme() );
  532. } else {
  533. printf( __( '%s Theme Options By', 'catchbox' ), get_current_theme() );
  534. }
  535. ?>
  536. <a href="<?php echo esc_url( __( 'http://catchthemes.com/', 'catchbox' ) ); ?>" title="<?php echo esc_attr_e( 'Catch Themes', 'catchbox' ); ?>" target="_blank"><?php _e( 'Catch Themes', 'catchbox' ); ?></a>
  537. </h2>
  538. <div id="info-support">
  539. <a class="support button" href="<?php echo esc_url(__('http://catchthemes.com/support/','catchbox')); ?>" title="<?php esc_attr_e('Theme Support', 'catchbox'); ?>" target="_blank">
  540. <?php printf(__('Theme Support','catchbox')); ?></a>
  541. <a class="themes button" href="<?php echo esc_url(__('http://catchthemes.com/themes/catch-box-pro/','catchbox')); ?>" title="<?php esc_attr_e('Upgrade to Catch Box Pro', 'catchbox'); ?>" target="_blank">
  542. <?php printf(__('Upgrade to Catch Box Pro','catchbox')); ?></a>
  543. <a class="facebook button" href="<?php echo esc_url(__('http://facebook.com/catchthemes','catchbox')); ?>" title="<?php esc_attr_e('Facebook', 'catchbox'); ?>" target="_blank">
  544. <?php printf(__('Facebook','catchbox')); ?></a>
  545. <a class="twitter button" href="<?php echo esc_url(__('http://twitter.com/#!/catchthemes','catchbox')); ?>" title="<?php esc_attr_e('Twitter', 'catchbox'); ?>" target="_blank">
  546. <?php printf(__('Twitter','catchbox')); ?></a>
  547. <a class="donate button" href="<?php echo esc_url(__('http://catchthemes.com/donate/','catchbox')); ?>" title="<?php esc_attr_e('Donate Now', 'catchbox'); ?>" target="_blank">
  548. <?php printf(__('Donate Now','catchbox')); ?></a>
  549. </div>
  550. <?php settings_errors(); ?>
  551. <form method="post" action="options.php">
  552. <?php
  553. settings_fields( 'catchbox_options' );
  554. do_settings_sections( 'theme_options' );
  555. submit_button();
  556. ?>
  557. </form>
  558. </div>
  559. <?php
  560. }
  561. /**
  562. * Renders the slider options for Catch Box.
  563. *
  564. * @since Catch Box 1.0
  565. */
  566. function catchbox_options_slider_page() {
  567. ?>
  568. <div class="wrap">
  569. <?php screen_icon(); ?>
  570. <h2>
  571. <?php
  572. if( function_exists( 'wp_get_theme' ) ) {
  573. printf( __( '%s Theme Options By', 'catchbox' ), wp_get_theme() );
  574. } else {
  575. printf( __( '%s Theme Options By', 'catchbox' ), get_current_theme() );
  576. }
  577. ?>
  578. <a href="<?php echo esc_url( __( 'http://catchthemes.com/', 'catchbox' ) ); ?>" title="<?php echo esc_attr_e( 'Catch Themes', 'catchbox' ); ?>" target="_blank"><?php _e( 'Catch Themes', 'catchbox' ); ?></a></h2>
  579. <form method="post" action="options.php">
  580. <?php
  581. settings_fields( 'catchbox_options_slider' );
  582. $options = get_option( 'catchbox_options_slider' );
  583. if( is_array( $options ) && ( !array_key_exists( 'slider_qty', $options ) || !is_numeric( $options[ 'slider_qty' ] ) ) ) $options[ 'slider_qty' ] = 4;
  584. elseif( !is_array( $options ) ) $options = array( 'slider_qty' => 4);
  585. ?>
  586. <?php if( isset( $_GET [ 'settings-updated' ] ) && $_GET[ 'settings-updated' ] == 'true' ): ?>
  587. <div class="updated" id="message">
  588. <p><strong><?php _e( 'Settings saved.', 'catchbox' );?></strong></p>
  589. </div>
  590. <?php endif; ?>
  591. <div class="option-container">
  592. <h3 class="option-toggle"><a href="#"><?php _e( 'Slider Options', 'catchbox' ); ?></a></h3>
  593. <div class="option-content inside">
  594. <table class="form-table">
  595. <tr>
  596. <th scope="row"><?php _e( 'Exclude Slider post from Home page posts:', 'catchbox' ); ?></th>
  597. <input type='hidden' value='0' name='catchbox_options_slider[exclude_slider_post]'>
  598. <td><input type="checkbox" id="headerlogo" name="catchbox_options_slider[exclude_slider_post]" value="1" <?php isset($options['exclude_slider_post']) ? checked( '1', $options['exclude_slider_post'] ) : checked('0', '1'); ?> /> <?php _e( 'Check to disable', 'catchbox' ); ?></td>
  599. </tr>
  600. <tr>
  601. <th scope="row"><?php _e( 'Number of Slides', 'catchbox' ); ?></th>
  602. <td><input type="text" name="catchbox_options_slider[slider_qty]" value="<?php if ( array_key_exists ( 'slider_qty', $options ) ) echo intval( $options[ 'slider_qty' ] ); ?>" /></td>
  603. </tr>
  604. <tbody class="sortable">
  605. <?php for ( $i = 1; $i <= $options[ 'slider_qty' ]; $i++ ): ?>
  606. <tr>
  607. <th scope="row"><label class="handle"><?php _e( 'Featured Col #', 'catchbox' ); ?><span class="count"><?php echo absint( $i ); ?></span></label></th>
  608. <td><input type="text" name="catchbox_options_slider[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 ] ); ?>" />
  609. <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', 'catchbox' ); ?></a>
  610. </td>
  611. </tr>
  612. <?php endfor; ?>
  613. </tbody>
  614. </table>
  615. <p><?php _e( '<strong>Note</strong>: Here you add in Post IDs which displays on Homepage Featured Slider.', 'catchbox' ); ?> </p>
  616. <p class="submit"><input type="submit" class="button-primary" value="<?php esc_attr_e( 'Save', 'catchbox' ); ?>" /></p>
  617. </div><!-- .option-content -->
  618. </div><!-- .option-container -->
  619. <div class="option-container">
  620. <h3 class="option-toggle"><a href="#"><?php _e( 'Slider Effect Options', 'catchbox' ); ?></a></h3>
  621. <div class="option-content inside">
  622. <table class="form-table">
  623. <tr>
  624. <th>
  625. <label for="catchbox_cycle_style"><?php _e( 'Transition Effect:', 'catchbox' ); ?></label>
  626. </th>
  627. <?php if( empty( $options['transition_effect'] ) ) { $options['transition_effect'] = "fade"; } ?>
  628. <td>
  629. <select id="catchbox_cycle_style" name="catchbox_options_slider[transition_effect]">
  630. <option value="fade" <?php selected('fade', $options['transition_effect']); ?>><?php _e( 'fade', 'catchbox' ); ?></option>
  631. <option value="wipe" <?php selected('wipe', $options['transition_effect']); ?>><?php _e( 'wipe', 'catchbox' ); ?></option>
  632. <option value="scrollUp" <?php selected('scrollUp', $options['transition_effect']); ?>><?php _e( 'scrollUp', 'catchbox' ); ?></option>
  633. <option value="scrollDown" <?php selected('scrollDown', $options['transition_effect']); ?>><?php _e( 'scrollDown', 'catchbox' ); ?></option>
  634. <option value="scrollLeft" <?php selected('scrollLeft', $options['transition_effect']); ?>><?php _e( 'scrollLeft', 'catchbox' ); ?></option>
  635. <option value="scrollRight" <?php selected('scrollRight', $options['transition_effect']); ?>><?php _e( 'scrollRight', 'catchbox' ); ?></option>
  636. <option value="blindX" <?php selected('blindX', $options['transition_effect']); ?>><?php _e( 'blindX', 'catchbox' ); ?></option>
  637. <option value="blindY" <?php selected('blindY', $options['transition_effect']); ?>><?php _e( 'blindY', 'catchbox' ); ?></option>
  638. <option value="blindZ" <?php selected('blindZ', $options['transition_effect']); ?>><?php _e( 'blindZ', 'catchbox' ); ?></option>
  639. <option value="cover" <?php selected('cover', $options['transition_effect']); ?>><?php _e( 'cover', 'catchbox' ); ?></option>
  640. <option value="shuffle" <?php selected('shuffle', $options['transition_effect']); ?>><?php _e( 'shuffle', 'catchbox' ); ?></option>
  641. </select>
  642. </td>
  643. </tr>
  644. <?php if( empty( $options['transition_delay'] ) ) { $options['transition_delay'] = 4; } ?>
  645. <tr>
  646. <th scope="row"><?php _e( 'Transition Delay', 'catchbox' ); ?></th>
  647. <td>
  648. <input type="text" name="catchbox_options_slider[transition_delay]" value="<?php if( isset( $options [ 'transition_delay' ] ) ) echo $options[ 'transition_delay' ]; ?>" size="4" />
  649. <span class="description"><?php _e( 'second(s)', 'catchbox' ); ?></span>
  650. </td>
  651. </tr>
  652. <?php if( empty( $options['transition_duration'] ) ) { $options['transition_duration'] = 1; } ?>
  653. <tr>
  654. <th scope="row"><?php _e( 'Transition Length', 'catchbox' ); ?></th>
  655. <td>
  656. <input type="text" name="catchbox_options_slider[transition_duration]" value="<?php if( isset( $options [ 'transition_duration' ] ) ) echo $options[ 'transition_duration' ]; ?>" size="4" />
  657. <span class="description"><?php _e( 'second(s)', 'catchbox' ); ?></span>
  658. </td>
  659. </tr>
  660. </table>
  661. <p class="submit"><input type="submit" class="button-primary" value="<?php esc_attr_e( 'Save', 'catchbox' ); ?>" /></p>
  662. </div><!-- .option-content -->
  663. </div><!-- .option-container -->
  664. </form>
  665. </div><!-- .wrap -->
  666. <?php
  667. }
  668. /**
  669. * Renders the social links options for Catch Box.
  670. *
  671. * @since Catch Box 1.0
  672. */
  673. function catchbox_options_social_links() {
  674. ?>
  675. <div class="wrap">
  676. <?php screen_icon(); ?>
  677. <h2>
  678. <?php
  679. if( function_exists( 'wp_get_theme' ) ) {
  680. printf( __( '%s Theme Options By', 'catchbox' ), wp_get_theme() );
  681. } else {
  682. printf( __( '%s Theme Options By', 'catchbox' ), get_current_theme() );
  683. }
  684. ?> <a href="<?php echo esc_url( __( 'http://catchthemes.com/', 'catchbox' ) ); ?>" title="<?php echo esc_attr_e( 'Catch Themes', 'catchbox' ); ?>" target="_blank"><?php _e( 'Catch Themes', 'catchbox' ); ?></a></h2>
  685. <form method="post" action="options.php">
  686. <?php
  687. settings_fields( 'catchbox_options_social_links' );
  688. $options = get_option( 'catchbox_options_social_links' );
  689. ?>
  690. <?php if( isset( $_GET [ 'settings-updated' ] ) && $_GET[ 'settings-updated' ] == 'true' ): ?>
  691. <div class="updated" id="message">
  692. <p><strong><?php _e( 'Settings saved.', 'catchbox' );?></strong></p>
  693. </div>
  694. <?php endif; ?>
  695. <table class="form-table">
  696. <tbody>
  697. <tr>
  698. <th scope="row"><label><?php _e( 'Facebook', 'catchbox' ); ?></label></th>
  699. <td><input type="text" size="45" name="catchbox_options_social_links[social_facebook]" value="<?php if( isset( $options[ 'social_facebook' ] ) ) echo esc_url( $options[ 'social_facebook' ] ); ?>" />
  700. </td>
  701. </tr>
  702. <tr>
  703. <th scope="row"><label><?php _e( 'Twitter', 'catchbox' ); ?></label></th>
  704. <td><input type="text" size="45" name="catchbox_options_social_links[social_twitter]" value="<?php if ( isset( $options[ 'social_twitter' ] ) ) echo esc_url( $options[ 'social_twitter'] ); ?>" />
  705. </td>
  706. </tr>
  707. <tr>
  708. <th scope="row"><label><?php _e( 'Google +', 'catchbox' ); ?></label></th>
  709. <td><input type="text" size="45" name="catchbox_options_social_links[social_google]" value="<?php if ( isset( $options[ 'social_google' ] ) ) echo esc_url( $options[ 'social_google' ] ); ?>" />
  710. </td>
  711. </tr>
  712. <tr>
  713. <th scope="row"><label><?php _e( 'LinkedIn', 'catchbox' ); ?></label></th>
  714. <td><input type="text" size="45" name="catchbox_options_social_links[social_linkedin]" value="<?php if ( isset( $options[ 'social_linkedin' ] ) ) echo esc_url( $options[ 'social_linkedin' ] ); ?>" />
  715. </td>
  716. </tr>
  717. <tr>
  718. <th scope="row"><label><?php _e( 'Pinterest', 'catchbox' ); ?></label></th>
  719. <td><input type="text" size="45" name="catchbox_options_social_links[social_pinterest]" value="<?php if ( isset( $options[ 'social_pinterest' ] ) ) echo esc_url( $options[ 'social_pinterest' ] ); ?>" />
  720. </td>
  721. </tr>
  722. <tr>
  723. <th scope="row"><label><?php _e( 'Youtube', 'catchbox' ); ?></label></th>
  724. <td><input type="text" size="45" name="catchbox_options_social_links[social_youtube]" value="<?php if ( isset( $options[ 'social_youtube' ] ) ) echo esc_url( $options[ 'social_youtube' ] ); ?>" />
  725. </td>
  726. </tr>
  727. <tr>
  728. <th scope="row"><label><?php _e( 'RSS Feed', 'catchbox' ); ?></label></th>
  729. <td><input type="text" size="45" name="catchbox_options_social_links[social_rss]" value="<?php if ( isset( $options[ 'social_rss' ] ) ) echo esc_url( $options[ 'social_rss' ] ); ?>" />
  730. </td>
  731. </tr>
  732. <tr>
  733. <th scope="row"><label><?php _e( 'Deviantart', 'catchbox' ); ?></label></th>
  734. <td><input type="text" size="45" name="catchbox_options_social_links[social_deviantart]" value="<?php if ( isset( $options[ 'social_deviantart' ] ) ) echo esc_url( $options[ 'social_deviantart' ] ); ?>" />
  735. </td>
  736. </tr>
  737. <tr>
  738. <th scope="row"><label><?php _e( 'Tumblr', 'catchbox' ); ?></label></th>
  739. <td><input type="text" size="45" name="catchbox_options_social_links[social_tumblr]" value="<?php if ( isset( $options[ 'social_tumblr' ] ) ) echo esc_url( $options[ 'social_tumblr' ] ); ?>" />
  740. </td>
  741. </tr>
  742. <tr>
  743. <th scope="row"><label><?php _e( 'Vimeo', 'catchbox' ); ?></label></th>
  744. <td><input type="text" size="45" name="catchbox_options_social_links[social_viemo]" value="<?php if ( isset( $options[ 'social_viemo' ] ) ) echo esc_url( $options[ 'social_viemo' ] ); ?>" />
  745. </td>
  746. </tr>
  747. <tr>
  748. <th scope="row"><label><?php _e( 'Dribbble', 'catchbox' ); ?></label></th>
  749. <td><input type="text" size="45" name="catchbox_options_social_links[social_dribbble]" value="<?php if ( isset( $options[ 'social_dribbble' ] ) ) echo esc_url( $options[ 'social_dribbble' ] ); ?>" />
  750. </td>
  751. </tr>
  752. <tr>
  753. <th scope="row"><label><?php _e( 'MySpace', 'catchbox' ); ?></label></th>
  754. <td><input type="text" size="45" name="catchbox_options_social_links[social_myspace]" value="<?php if ( isset( $options[ 'social_myspace' ] ) ) echo esc_url( $options[ 'social_myspace' ] ); ?>" />
  755. </td>
  756. </tr>
  757. <tr>
  758. <th scope="row"><label><?php _e( 'Aim', 'catchbox' ); ?></label></th>
  759. <td><input type="text" size="45" name="catchbox_options_social_links[social_aim]" value="<?php if ( isset( $options[ 'social_aim' ] ) ) echo esc_url( $options[ 'social_aim' ] ); ?>" />
  760. </td>
  761. </tr>
  762. <tr>
  763. <th scope="row"><label><?php _e( 'Flickr', 'catchbox' ); ?></label></th>
  764. <td><input type="text" size="45" name="catchbox_options_social_links[social_flickr]" value="<?php if ( isset( $options[ 'social_flickr' ] ) ) echo esc_url( $options[ 'social_flickr' ] ); ?>" />
  765. </td>
  766. </tr>
  767. </tbody>
  768. </table>
  769. <p><?php _e( '<strong>Note:</strong> Enter the url for correponding social networking website', 'catchbox' ); ?></p>
  770. <p class="submit"><input type="submit" class="button-primary" value="<?php esc_attr_e( 'Save', 'catchbox' ); ?>" /></p>
  771. </form>
  772. </div><!-- .wrap -->
  773. <?php
  774. }
  775. /**
  776. * Returns the options array for Catch Box.
  777. *
  778. * @since Catch Box 1.0
  779. */
  780. function catchbox_options_webmaster_tools() {
  781. ?>
  782. <div class="wrap">
  783. <?php screen_icon(); ?>
  784. <h2>
  785. <?php
  786. if( function_exists( 'wp_get_theme' ) ) {
  787. printf( __( '%s Theme Options By', 'catchbox' ), wp_get_theme() );
  788. } else {
  789. printf( __( '%s Theme Options By', 'catchbox' ), get_current_theme() );
  790. }
  791. ?>
  792. <a href="<?php echo esc_url( __( 'http://catchthemes.com/', 'catchbox' ) ); ?>" title="<?php echo esc_attr_e( 'Catch Themes', 'catchbox' ); ?>" target="_blank"><?php _e( 'Catch Themes', 'catchbox' ); ?></a></h2>
  793. <form method="post" action="options.php">
  794. <?php
  795. settings_fields( 'catchbox_options_webmaster' );
  796. $options = get_option( 'catchbox_options_webmaster' );
  797. ?>
  798. <?php if( isset( $_GET [ 'settings-updated' ] ) && $_GET[ 'settings-updated' ] == 'true' ): ?>
  799. <div class="updated" id="message">
  800. <p><strong><?php _e( 'Settings saved.', 'catchbox' );?></strong></p>
  801. </div>
  802. <?php endif; ?>
  803. <div class="option-container">
  804. <h3 class="option-toggle"><a href="#"><?php _e( 'Webmaster Site Verification IDs', 'catchbox' ); ?></a></h3>
  805. <div class="option-content inside">
  806. <table class="form-table">
  807. <tbody>
  808. <tr>
  809. <th scope="row"><label><?php _e( 'Google Site Verification ID', 'catchbox' ); ?></label></th>
  810. <td><input type="text" size="45" name="catchbox_options_webmaster[google_verification]" value="<?php if( isset( $options[ 'google_verification' ] ) ) echo esc_attr( $options[ 'google_verification' ] ); ?>" /> <?php _e('Enter your Google ID number only', 'catchbox'); ?>
  811. </td>
  812. </tr>
  813. <tr>
  814. <th scope="row"><label><?php _e( 'Yahoo Site Verification ID', 'catchbox' ); ?> </label></th>
  815. <td><input type="text" size="45" name="catchbox_options_webmaster[yahoo_verification]" value="<?php if ( isset( $options[ 'yahoo_verification' ] ) ) echo esc_attr( $options[ 'yahoo_verification'] ); ?>" /> <?php _e('Enter your Yahoo ID number only', 'catchbox'); ?>
  816. </td>
  817. </tr>
  818. <tr>
  819. <th scope="row"><label><?php _e( 'Bing Site Verification ID', 'catchbox' ); ?></label></th>
  820. <td><input type="text" size="45" name="catchbox_options_webmaster[bing_verification]" value="<?php if ( isset( $options[ 'bing_verification' ] ) ) echo esc_attr( $options[ 'bing_verification' ] ); ?>" /> <?php _e('Enter your Bing ID number only', 'catchbox'); ?>
  821. </td>
  822. </tr>
  823. </tbody>
  824. </table>
  825. <p class="submit"><input type="submit" class="button-primary" value="<?php esc_attr_e( 'Save', 'catchbox' ); ?>" /></p>
  826. </div> <!-- .option-content -->
  827. </div> <!-- .option-container -->
  828. <div class="option-container">
  829. <h3 class="option-toggle"><a href="#"><?php _e( 'Webmaster Site Verification Code', 'catchbox' ); ?></a></h3>
  830. <div class="option-content inside">
  831. <table class="form-table">
  832. <table class="form-table">
  833. <tr>
  834. <th scope="row"><label><?php _e('Analytics, site stats Header code', 'catchbox' ); ?></label></th>
  835. <td>
  836. <textarea name="catchbox_options_webmaster[tracker_header]" rows="7" cols="80" ><?php if ( isset( $options [ 'tracker_header' ] ) ) echo esc_attr( $options[ 'tracker_header' ] ); ?></textarea>
  837. </td>
  838. </tr>
  839. <tr>
  840. <th scope="row"><label><?php _e('Analytics, site stats footer code', 'catchbox' ); ?></label></th>
  841. <td>
  842. <textarea name="catchbox_options_webmaster[tracker_footer]" rows="7" cols="80" ><?php if ( isset( $options [ 'tracker_footer' ] ) ) echo esc_attr( $options[ 'tracker_footer' ] ); ?></textarea>
  843. </td>
  844. </tr>
  845. </tbody>
  846. </table>
  847. <p class="submit"><input type="submit" class="button-primary" value="<?php esc_attr_e( 'Save', 'catchbox' ); ?>" /></p>
  848. </div> <!-- .option-content -->
  849. </div> <!-- .option-container -->
  850. </form>
  851. </div><!-- .wrap -->
  852. <?php
  853. }
  854. /**
  855. * Sanitize and validate form input. Accepts an array, return a sanitized array.
  856. *
  857. * @since Catch Box 1.0
  858. */
  859. function catchbox_options_validation($options) {
  860. $options_validated = array();
  861. //data validation for Featured Slider
  862. if ( isset( $options[ 'slider_qty' ] ) ) {
  863. $options_validated[ 'slider_qty' ] = absint( $options[ 'slider_qty' ] ) ? $options [ 'slider_qty' ] : 4;
  864. }
  865. if ( isset( $options[ 'featured_slider' ] ) ) {
  866. $options_validated[ 'featured_slider' ] = array();
  867. }
  868. if( isset( $options[ 'slider_qty' ] ) )
  869. for ( $i = 1; $i <= $options [ 'slider_qty' ]; $i++ ) {
  870. if ( absint( $options[ 'featured_slider' ][ $i ] ) )
  871. $options_validated[ 'featured_slider' ][ $i ] = absint($options[ 'featured_slider' ][ $i ] );
  872. }
  873. if ( isset( $options['exclude_slider_post'] ) ) {
  874. // Our checkbox value is either 0 or 1
  875. $options_validated[ 'exclude_slider_post' ] = $options[ 'exclude_slider_post' ];
  876. }
  877. if( !empty( $options[ 'transition_effect' ] ) ) {
  878. $options_validated['transition_effect'] = wp_filter_nohtml_kses( $options['transition_effect'] );
  879. }
  880. // data validation for transition delay
  881. if ( !empty( $options[ 'transition_delay' ] ) && is_numeric( $options[ 'transition_delay' ] ) ) {
  882. $options_validated[ 'transition_delay' ] = $options[ 'transition_delay' ];
  883. }
  884. // data validation for transition length
  885. if ( !empty( $options[ 'transition_duration' ] ) && is_numeric( $options[ 'transition_duration' ] ) ) {
  886. $options_validated[ 'transition_duration' ] = $options[ 'transition_duration' ];
  887. }
  888. //Clearing the theme option cache
  889. if( function_exists( 'catchbox_themeoption_invalidate_caches' ) ) { catchbox_themeoption_invalidate_caches(); }
  890. return $options_validated;
  891. }
  892. /**
  893. * Sanitize and validate forms for webmaster tools options. Accepts an array, return a sanitized array.
  894. *
  895. * @since Catch Box 1.0
  896. */
  897. function catchbox_options_webmaster_validation( $options ) {

Large files files are truncated, but you can click here to view the full file