option_name, array( $this, 'sanitize_options' ) ); } // check and set default options function default_options() { $the_coa = $this->get_coa(); $this->the_opt = get_option( $this->option_name ); // if options are empty, sets the default values if ( empty( $this->the_opt ) || !isset( $this->the_opt ) ) { foreach ( $the_coa as $key => $val ) { $this->the_opt[$key] = $the_coa[$key]['default']; } $this->the_opt['version'] = ''; //null value to keep admin notice alive and invite user to discover theme options update_option( $this->option_name , $this->the_opt ); } else if ( !isset( $this->the_opt['version'] ) || $this->the_opt['version'] < $this->get_info( 'version' ) ) { // check for unset values and set them to default value -> when updated to new version foreach ( $the_coa as $key => $val ) { if ( !isset( $this->the_opt[$key] ) ) $this->the_opt[$key] = $the_coa[$key]['default']; } $this->the_opt['version'] = ''; //null value to keep admin notice alive and invite user to discover theme options update_option( $this->option_name , $this->the_opt ); } } // print a reminder message for set the options after the theme is installed or updated function setopt_admin_notice() { if ( current_user_can( 'manage_options' ) && ( $this->get_opt( 'version' ) < $this->get_info( 'version' ) ) ) echo '

' . sprintf( __( "%s theme says: \"Dont forget to set my options!\"", 'boozurk' ), 'Boozurk', get_admin_url() . 'themes.php?page=theme_options' ) . '

'; } //add js script to the options page function options_scripts() { wp_enqueue_media(); wp_enqueue_script( 'wp-color-picker' ); wp_enqueue_script( $this->slug . '-options-script', get_template_directory_uri().'/js/options.js', array( 'jquery', 'thickbox' ), $this->get_info( 'version' ), true ); //thebird js $data = array( 'confirm_to_defaults' => __( 'Are you really sure you want to set all the options to their default values?', 'boozurk' ) ); wp_localize_script( $this->slug . '-options-script', 'theme_options_l10n', $data ); } // the custon header page style function options_style() { wp_enqueue_style( 'wp-color-picker' ); wp_enqueue_style( $this->slug . '-options-style', get_template_directory_uri() . '/css/options.css', array(), '', 'screen' ); } // sanitize options value function sanitize_options($input) { $the_coa = $this->get_coa(); foreach ( $the_coa as $key => $val ) { if( $the_coa[$key]['type'] == 'chk' ) { //CHK if( !isset( $input[$key] ) ) { $input[$key] = 0; } else { $input[$key] = ( $input[$key] == 1 ? 1 : 0 ); } } elseif( $the_coa[$key]['type'] == 'sel' ) { //SEL if ( !in_array( $input[$key], $the_coa[$key]['options'] ) ) $input[$key] = $the_coa[$key]['default']; } elseif( $the_coa[$key]['type'] == 'opt' ) { //OPT if ( !in_array( $input[$key], $the_coa[$key]['options'] ) ) $input[$key] = $the_coa[$key]['default']; } elseif( $the_coa[$key]['type'] == 'col' ) { //COL $color = str_replace( '#' , '' , $input[$key] ); $color = preg_replace( '/[^0-9a-fA-F]/' , '' , $color ); $input[$key] = '#' . $color; } elseif( $the_coa[$key]['type'] == 'url' ) { //URL $input[$key] = esc_url( trim( strip_tags( $input[$key] ) ) ); } elseif( $the_coa[$key]['type'] == 'txt' ) { //TXT if( !isset( $input[$key] ) ) { $input[$key] = ''; } else { $input[$key] = trim( strip_tags( $input[$key] ) ); } } elseif( $the_coa[$key]['type'] == 'int' ) { //INT if( !isset( $input[$key] ) ) { $input[$key] = $the_coa[$key]['default']; } else { $input[$key] = (int) $input[$key] ; } if( isset( $the_coa[$key]['range'] ) ) { $input[$key] = min( $input[$key], $the_coa[$key]['range'][1] ); $input[$key] = max( $input[$key], $the_coa[$key]['range'][0] ); } } elseif( $the_coa[$key]['type'] == 'txtarea' ) { //TXTAREA if( !isset( $input[$key] ) ) { $input[$key] = ''; } else { $input[$key] = trim( strip_tags( $input[$key] ) ); } } } foreach ( $input['boozurk_cat_colors'] as $key => $val ) { //CATCOL $color = str_replace( '#' , '' , $input['boozurk_cat_colors'][$key] ); $color = preg_replace( '/[^0-9a-fA-F]/' , '' , $color ); $input['boozurk_cat_colors'][$key] = '#' . $color; } // check for required options foreach ( $the_coa as $key => $val ) { if ( $the_coa[$key]['req'] != '' ) { if ( $input[$the_coa[$key]['req']] == ( 0 || '') ) $input[$key] = 0; } } $input['version'] = $this->get_info( 'version' ); // keep version number return $input; } function print_option( $option, $value, $is_sub, $option_name, $key, $before = '', $after = '' ) { echo $before; switch ( $option['type'] ) { case 'chk': ?> /> $optionval ) { ?> : get_coa(); $the_hierarchy = $this->get_coa( 'hierarchy' ); if ( isset( $_GET['erase'] ) ) { $_SERVER['REQUEST_URI'] = remove_query_arg( 'erase', $_SERVER['REQUEST_URI'] ); delete_option( $this->option_name ); $this->default_options(); $this->the_opt = get_option( $this->option_name ); } // update version value when admin visit options page if ( $this->the_opt['version'] < $this->get_info( 'version' ) ) { $this->the_opt['version'] = $this->get_info( 'version' ); update_option( $this->option_name , $this->the_opt ); } // options have been updated if ( isset( $_REQUEST['settings-updated'] ) ) { //return options save message echo '

' . __( 'Options saved.','boozurk' ) . '

'; } // options to defaults done if ( isset( $_GET['erase'] ) ) { echo '

' . __( 'Defaults values loaded.', 'boozurk' ) . '

'; } ?>

get_info( 'current_theme' ) . ' - ' . __( 'Theme Options','boozurk' ); ?>


PayPal - The safer, easier way to pay online.
$genus ) { ?>
$species ) { ?>

' . $species['description'] . ''; ?>
$item ) { ?>
the_opt[$key] ) ) $this->the_opt[$key] = $the_coa[$key]['default']; ?> ' . $the_coa[$key]['description'] . ''; break; case 'chk': $this->print_option( $the_coa[$key], $this->the_opt[$key], false, $this->option_name, $key , '' . $the_coa[$key]['description'] . '', '' ); break; case 'sel': $this->print_option( $the_coa[$key], $this->the_opt[$key], false, $this->option_name, $key , '' . $the_coa[$key]['description'] . '', '' ); break; case 'opt': $this->print_option( $the_coa[$key], $this->the_opt[$key], false, $this->option_name, $key , '' . $the_coa[$key]['description'] . '', '' ); break; case 'col': $this->print_option( $the_coa[$key], $this->the_opt[$key], false, $this->option_name, $key , '
' . $the_coa[$key]['description'] . '
', '
' ); break; case 'url': if ( $key == 'boozurk_logo' ) $after = '' . __( 'Choose Image' , 'boozurk' ) . ''; $this->print_option( $the_coa[$key], $this->the_opt[$key], false, $this->option_name, $key , '' . $the_coa[$key]['description'] . '', $after ); break; case 'txt': $this->print_option( $the_coa[$key], $this->the_opt[$key], false, $this->option_name, $key , '' . $the_coa[$key]['description'] . '', '' ); break; case 'int': $this->print_option( $the_coa[$key], $this->the_opt[$key], false, $this->option_name, $key , '' . $the_coa[$key]['description'] . '', '' ); break; case 'txtarea': $this->print_option( $the_coa[$key], $this->the_opt[$key], false, $this->option_name, $key , '' . $the_coa[$key]['description'] . '', '' ); break; case 'catcol': echo '' . $the_coa[$key]['description'] . ''; $args = array( 'orderby' => 'name', 'order' => 'ASC', 'hide_empty' => 0, ); $categories = get_categories( $args ); foreach( $categories as $category ) { $hexnumber = '#'; for ( $i2=1; $i2<=3; $i2++ ) { $hexnumber .= dechex( rand( 64, 255 ) ); } $catcolor = isset( $this->the_opt[$key][$category->term_id] ) ? $this->the_opt[$key][$category->term_id] : $hexnumber; $this->print_option( array( 'type' => 'col', 'default' => $the_coa[$key]['defaultcolor'] ), $catcolor, false, $this->option_name, $key . '][' . $category->term_id, '
' . $category->name . ' (' . $category->count . ')
', '' . __( 'Default' , 'boozurk' ) . ': ' . $the_coa[$key]['defaultcolor'] . '
' ); } break; } ?>
'; continue;} ?> ' . $the_coa[$subkey]['info'] . '' : ''; ?>
the_opt[$subkey]) ) $this->the_opt[$subkey] = $the_coa[$subkey]['default']; ?> print_option( $the_coa[$subkey], $this->the_opt[$subkey], false, $this->option_name, $subkey , '' . $the_coa[$subkey]['description'] . ' : ', $after ); break; case 'sel': $this->print_option( $the_coa[$subkey], $this->the_opt[$subkey], false, $this->option_name, $subkey , '' . $the_coa[$subkey]['description'] . ' : ', $after ); break; case 'opt': $this->print_option( $the_coa[$subkey], $this->the_opt[$subkey], false, $this->option_name, $subkey , '' . $the_coa[$subkey]['description'] . ' : ', $after ); break; case 'col': $this->print_option( $the_coa[$subkey], $this->the_opt[$subkey], false, $this->option_name, $subkey , '
' . $the_coa[$subkey]['description'] . '
', '
' . $after ); break; case 'url': if ( $subkey == 'boozurk_logo' ) $after = '' . __( 'Choose Image' , 'boozurk' ) . '' . $after; $this->print_option( $the_coa[$subkey], $this->the_opt[$subkey], false, $this->option_name, $subkey , '' . $the_coa[$subkey]['description'] . ' : ', $after ); break; case 'txt': $this->print_option( $the_coa[$subkey], $this->the_opt[$subkey], false, $this->option_name, $subkey , '' . $the_coa[$subkey]['description'] . ' : ', $after ); break; case 'int': $this->print_option( $the_coa[$subkey], $this->the_opt[$subkey], false, $this->option_name, $subkey , '' . $the_coa[$subkey]['description'] . ' : ', $after ); break; case 'txtarea': $this->print_option( $the_coa[$subkey], $this->the_opt[$subkey], false, $this->option_name, $subkey , '' . $the_coa[$subkey]['description'] . ' : ', $after ); break; case 'catcol': echo '' . $the_coa[$subkey]['description'] . ''; $args = array( 'orderby' => 'name', 'order' => 'ASC', 'hide_empty' => 0, ); $categories = get_categories( $args ); foreach( $categories as $category ) { $hexnumber = '#'; for ( $i2=1; $i2<=3; $i2++ ) { $hexnumber .= dechex( rand( 64, 255 ) ); } $catcolor = isset( $this->the_opt[$subkey][$category->term_id] ) ? $this->the_opt[$subkey][$category->term_id] : $hexnumber; $this->print_option( array( 'type' => 'col', 'default' => $the_coa[$subkey]['defaultcolor'] ), $catcolor, false, $this->option_name, $subkey . '][' . $category->term_id, '
' . $category->name . ' (' . $category->count . ')
', '' . __( 'Default' , 'boozurk' ) . ': ' . $the_coa[$subkey]['defaultcolor'] . '
' ); } break; } ?>

' . __('requires','boozurk') . ': ' . $the_coa[$the_coa[$key]['req']]['description']; ?>

-

-

-
Support the theme in your language, provide a translation.

'_blank' ); $wp_admin_bar->add_menu( array( 'id' => $this->slug . '_theme_options', 'parent' => 'appearance', 'title' => __( 'Theme Options','boozurk' ), 'href' => get_admin_url() . 'themes.php?page=theme_options', 'meta' => $add_menu_meta, ) ); } // Add Thumbnail Column in Manage Posts/Pages List function add_thumb_column($cols) { $cols['thumbnail'] = ucwords( __('thumbnail', 'boozurk') ); return $cols; } // Add Thumbnails in Manage Posts/Pages List function add_thumb_value($column_name, $post_id) { $width = (int) 60; $height = (int) 60; if ( 'thumbnail' == $column_name ) { $thumbnail_id = get_post_meta( $post_id, '_thumbnail_id', true ); if ($thumbnail_id) $thumb = wp_get_attachment_image( $thumbnail_id, array($width, $height), true ); if ( isset($thumb) && $thumb ) { echo $thumb; } else { echo ''; } } } // Add Thumbnail Column style in Manage Posts/Pages List function post_manage_style(){ ?>