'

' . __( sprintf( 'The element you have written is already exists. Please, add another name.' ) ) . '

', 'saved' => '

'.$themename.' '.__('settings saved', TEXTDOMAIN).'.

', 'reset' => '

'.$themename.' '.__('settings reset', TEXTDOMAIN).'.

', 'delete' => '

' . __( 'Element deleted correctly.', TEXTDOMAIN ) . '

', 'updated' => '

' . __( 'Element updated correctly.', TEXTDOMAIN ) . '

', 'imported' => '

' . __( 'Database imported correctly.', TEXTDOMAIN ) . '

', 'no-imported' => '

' . __( 'An error encoured during during import. Please try again.', TEXTDOMAIN ) . '

', 'file-not-valid' => '

' . __( "The file you have insert doesn't valid.", TEXTDOMAIN ) . '

', 'cant-import' => '

' . __( "I'm sorry, the import featured is disabled.", TEXTDOMAIN ) . '

', 'ord' => '

' . __( "Sorting done correctly.", TEXTDOMAIN ) . '

' ); if( isset( $_GET['message'] ) ) echo $message[ $_GET['message'] ]; } /** * ARRAYS */ require_once 'arrays.php'; // ------------- $options = array(); include_once 'panel_functions.php'; $includes_file = array( 'install' => dirname(__FILE__) . '/install/install.php', ); //include_once 'homepage/homepage.php'; if( file_exists( $includes_file['install'] ) ) include_once $includes_file['install']; // includes options array foreach( $submenu_items as $item => $v ) { $file = dirname(__FILE__) . '/' . "options/$item-options.php"; if( !file_exists( $file ) ) unset( $submenu_items[$item] ); elseif( isset( $_GET['tab'] ) AND $_GET['tab'] == $item ) require_once $file; else require_once dirname(__FILE__) . '/' . "options/general-options.php"; unset( $file ); } function yiw_add_admin() { global $themename, $submenu_items, $includes_file; $page = 'yiw_panel.php'; add_theme_page( $themename, $themename, 'edit_theme_options', 'yiw_panel', 'yiw_panel' ); if( file_exists( $includes_file['install'] ) ) add_theme_page( 'Install theme data', 'Import/Export', 'edit_theme_options', 'install', 'install_panel' ); } add_action('admin_menu', 'yiw_add_admin'); // add items to admin bar if( version_compare($wp_version, "3.1", ">=") ) { function yiw_add_items_admin_bar() { global $submenu_items, $wp_admin_bar, $themename; $wp_admin_bar->add_menu( array( 'parent' => false, 'title' => $themename, 'id' => "theme-options-home", 'href' => admin_url('admin.php')."?page=yiw_panel" ) ); foreach( $submenu_items as $item => $title ) { $wp_admin_bar->add_menu( array( 'parent' => "theme-options-home", 'title' => $title, 'id' => "theme-options-$item", 'href' => admin_url('admin.php')."?page=yiw_panel&tab=$item" ) ); } } add_action( 'wp_before_admin_bar_render', 'yiw_add_items_admin_bar' ); } function init_panel() { global $themename, $shortname, $options; $ajax = FALSE; if( isset( $_REQUEST['type-send'] ) AND $_REQUEST['type-send'] == 'ajax' ) $ajax = TRUE; $tab = 'general'; if( isset( $_GET['tab'] ) ) $tab = $_GET['tab']; $solo = false; // retrive the var for saving only specific options if( isset( $_REQUEST['save_only'] ) ) $solo = $_REQUEST['save_only']; if ( isset( $_GET['page'] ) AND ( $_GET['page'] == 'yiw_panel' ) ) { if( isset( $_GET['tab'] ) ) $vars = $options[ $_GET['tab'] ]; else $vars = $options['general']; if ( isset( $_REQUEST['secondary-action'] ) ) { // create example contact form if( 'create-contact-form' == $_REQUEST['secondary-action'] AND $_REQUEST['name-form'] != '' ) { $forms = maybe_unserialize( get_option( 'bl_contact_forms', array() ) ); $new_form = check_if_exists( sanitize_title( $_REQUEST['name-form'] ), $forms ); // add new form $forms[] = $new_form; update_option( 'bl_contact_forms', serialize( $forms ) ); // choose form to configure update_option( 'bl_contact_form_choosen', $new_form ); // create fields update_option( 'bl_contact_fields_' . $new_form, get_option( 'bl_default_contact_form' ) ); $url = "$_SERVER[PHP_SELF]?page=$_GET[page]&tab=$tab&message=saved"; if( !$ajax ) wp_redirect( $url ); else echo $url; die; } } if( !isset( $_REQUEST['action'] ) ) return; if ( 'save' == $_REQUEST['action'] ) { foreach($vars as $section => $options) { foreach($options as $value) { // go next if is been set a specific option to save if( $solo != false AND $value['id'] != $solo ) continue; // check if there is a cols key, to specific more values for the same var $n = 1; if( array_key_exists('cols', $value) ) { $n = $value['cols']; } for($i=1;$i<=$n;$i++) { $ext = ($n > 1) ? "_$i" : ''; $val = $value['id'] . $ext; // echo '
';
//                         print_r($value["control"]);
//                         echo '
'; if( isset( $_REQUEST[ $val ] ) AND $_REQUEST[ $val ] != '' ) { if( array_key_exists( 'data', $value ) AND $value['data'] == 'array' ) { if( !array_key_exists( 'control', $value ) OR ( array_key_exists( 'control', $value ) AND !array_key_exists( strtolower( str_replace( ' ', '_', $_REQUEST[ $value['id'] ] ) ), $value['control'] ) ) ) { $data_array = get_option( $value['id'] ); if( $data_array AND $data_array != '' ) $value_array = unserialize( $data_array ); else $value_array = array(); if( array_key_exists( 'mode', $value ) AND $value['mode'] == 'merge' ) $value_array[] = $_REQUEST[ $value['id'] ]; else $value_array = $_REQUEST[ $value['id'] ]; update_option( $val, serialize( yiw_cleanArray( $value_array ) ) ); } else { $url = "$_SERVER[PHP_SELF]?page=$_GET[page]&message=element_exists"; if( !$ajax ) wp_redirect( $url ); else echo $url; die; } } elseif( is_array($_REQUEST[ $val ]) ) { $cats = "-1"; foreach($_REQUEST[ $val ] as $cat) { $cats .= "," . $cat; } update_option( $val, str_replace("-1,", "", $cats) ); } else { update_option( $val, $_REQUEST[ $value['id'] ] ); } } else { if( !array_key_exists( 'data', $value ) OR $value['data'] != 'array' ) delete_option( $val ); } } } } $url = "$_SERVER[PHP_SELF]?page=$_GET[page]&tab=$tab&message=saved"; if( !$ajax ) wp_redirect( $url ); else echo $url; die; } else if( 'reset' == $_REQUEST['action'] ) { foreach($vars as $section => $options) { foreach ($options as $value) { if( !array_key_exists( 'noreset', $value ) OR ( array_key_exists( 'noreset', $value ) AND !$value['noreset'] ) ) delete_option( $value['id'] ); } } $url = "$_SERVER[PHP_SELF]?page=$_GET[page]&tab=$tab&message=reset"; if( !$ajax ) wp_redirect( $url ); else echo $url; die; } else if( 'update-array' == $_REQUEST['action'] ) { $value_array = unserialize( get_option( $_REQUEST['id'] ) ); $value_array[ $_REQUEST['c'] ] = $_REQUEST[ $_REQUEST['id'] ]; //print_r($value_array); update_option( $_REQUEST['id'], serialize( $value_array ) ); $url = "$_SERVER[PHP_SELF]?page=$_GET[page]&tab=$tab&message=updated"; if( !$ajax ) wp_redirect( $url ); else echo $url; die; } elseif( 'delete' == $_REQUEST['action'] ) { foreach($vars as $section => $options) { foreach ($options as $value) { // check if passed delete mode on querystr, to delete specific vars if( isset( $_GET[ $value[ $_GET[ 'key' ] ] ] ) ) { $value_array = unserialize( get_option( $value[ $_GET[ 'key' ] ] ) ); unset( $value_array[ $_GET[ $value[ $_GET[ 'key' ] ] ] ] ); //print_r($value_array); update_option( $value[ $_GET[ 'key' ] ], serialize( $value_array ) ); $url = "$_SERVER[PHP_SELF]?page=$_GET[page]&tab=$tab&message=delete"; if( !$ajax ) wp_redirect( $url ); else echo $url; die; } } } } elseif( 'array-ord' == $_REQUEST['action'] AND isset( $_REQUEST['id'] ) AND isset( $_REQUEST['dir'] ) AND isset( $_REQUEST['from'] ) ) { $a = maybe_unserialize( get_option( $_REQUEST['id'], array() ) ); if( empty( $a ) ) return; $el1 = $_REQUEST['from']; $offset = 1; if( $_REQUEST['dir'] == 'up' ) $offset *= -1; $el2 = $el1 + $offset; // change $temp = $a[ $el1 ]; $a[ $el1 ] = $a[ $el2 ]; $a[ $el2 ] = $temp; update_option( $_REQUEST['id'], serialize( $a ) ); $url = "$_SERVER[PHP_SELF]?page=$_GET[page]&tab=$tab&message=ord"; if( !$ajax ) wp_redirect( $url ); else echo $url; die; } } elseif ( isset( $_GET['page'] ) AND $_GET['page'] == 'install' ) { if( !isset( $_REQUEST['action'] ) ) return; if( 'export' == $_REQUEST['action'] ) { $export = export_theme(); $export_size = strlen( $export['content'] ); header("Content-type: application/gzip-compressed"); header("Content-Disposition: attachment; filename=$export[filename]"); header("Content-Length: $export_size"); header("Content-Transfer-Encoding: binary"); header('Accept-Ranges: bytes'); /* The three lines below basically make the download non-cacheable */ header("Cache-control: private"); header('Pragma: private'); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); echo $export['content']; die; } } } add_action( 'admin_init', 'init_panel' ); function yiw_add_init() { $file_dir = get_template_directory_uri()."/admin-options/include"; wp_enqueue_style( "functions", $file_dir."/functions.css", false, "1.0", "all" ); wp_enqueue_style( "iphone-style-checkboxes", $file_dir."/iphone-style-checkboxes.css", false, "1.0", "all" ); wp_enqueue_style( "jquery-ui-overcast", $file_dir."/overcast/jquery-ui-1.8.9.custom.css", false, "1.8.8", "all" ); wp_enqueue_style( "wp-admin" ); add_thickbox(); wp_enqueue_style( "farbtastic" ); wp_admin_css( 'widgets' ); $deps = array( 'jquery', 'jquery-ui-custom', //'jquery-ui-sortable', //'jquery-ui-draggable', //'jquery-ui-droppable', //'admin-widgets', 'media-upload', 'thickbox', 'farbtastic' ); wp_deregister_script( 'jquery-ui-core' ); wp_deregister_script( 'jquery-ui-sortable' ); wp_deregister_script( 'jquery-ui-draggable' ); wp_deregister_script( 'jquery-ui-droppable' ); wp_enqueue_script( "jquery-ui-custom", $file_dir."/jquery-ui-1.8.9.custom.min.js", array(), '1.8.9', true ); wp_enqueue_script( 'farbtastic'); wp_enqueue_script( "rm_script", $file_dir."/rm_script.js", $deps, '1.0', true ); wp_enqueue_script( "iphone-style-checkboxes", $file_dir."/iphone-style-checkboxes.js", '1', true ); } if ( isset( $_GET['page'] ) AND ( $_GET['page'] == 'yiw_panel' ) ) add_action('admin_init', 'yiw_add_init'); function yiw_panel() { global $options; $tab = 'general'; if( isset( $_GET['tab'] ) ) $tab = $_GET['tab']; yiw_admin( $options[ $tab ] ); } function yiw_admin($vars) { global $themename, $shortname, $options, $submenu_items; $i = $show_form = 0; //if ( $_REQUEST['saved'] ) echo '

'.$themename.' '.__('settings saved', TEXTDOMAIN).'.

'; //if ( $_REQUEST['reset'] ) echo '

'.$themename.' '.__('settings reset', TEXTDOMAIN).'.

'; yiw_message(); $current_tab = 'general'; if( isset( $_GET['tab'] ) ) $current_tab = $_GET['tab']; foreach($vars as $section => $values) { foreach($values as $value) { if( !isset( $value['std'] ) ) $value['std'] = ''; switch ( $value['type'] ) { // ================== OPEN ===================== case "open": ?> '; if( array_key_exists( 'valueButton', $value ) ) $valueButton = __($value['valueButton'], TEXTDOMAIN); else $valueButton = __('Save changes', TEXTDOMAIN); ?>




'; $after_text = '
'; $button = '' . __( 'Copy to clipboard', TEXTDOMAIN ) . ''; } ?>
value="" style="width:240px;" />
/>
class="on_off" />
1) $descr = "$value[desc]"; } ?> 1) ? "_$i" : '' ?>

 Color Picker
$sidebar ) : ?>
<?php _e( 'Delete', TEXTDOMAIN ) ?>
'; //print_r( yiw_cleanArray($value_array) ); //echo ''; array_push( $value_array, array() ); $config = explode( ',', str_replace(" ", "", $value['config']) ); ?>
', print_r($fields), ''; ?>

Add field

$field ) : ?> valign="top">
 
  |  
" title="" onclick="return confirm('');" />
Icons: WooFunction