components ) ){ require_once "assets/components/list_categories.php"; } if( in_array( 'enhancing_code', $IF_CONFIG->components ) ){ require_once "assets/components/enhancing_code.php"; } // __________________________________________________________________________________ // REQUIRED FILES TO RUN if ( !class_exists('ilen_framework_1_1') ) { class ilen_framework_1_1 { var $options = ""; var $parameter = ""; var $save_status = null; var $IF_CONFIG = null; function __construct(){ // set default if not exists self::_ini_(); // add menu options self::iLenFramework_add_menu(); // add scripts & styles add_action('admin_enqueue_scripts', array( &$this,'ilenframeword_add_scripts_admin') ); } // =Definitions Fields function theme_definitions(){ return $this->options; } // =Add Menu function iLenFramework_add_menu(){ if( $this->parameter['type'] == "theme" ){ if( $this->parameter['method'] == "free" ){ add_action('admin_menu', array( &$this,'menu_free') ); }elseif( $this->parameter['method'] == "buy" ){ add_action('admin_menu', array( &$this,'menu_pay') ); } }elseif( $this->parameter['type'] == "plugin" ){ if( $this->parameter['method'] == "free" ){ add_action('admin_menu', array( &$this,'menu_free') ); }elseif( $this->parameter['method'] == "buy" ){ add_action('admin_menu', array( &$this,'menu_pay') ); } } } // =INIT theme function _ini_(){ global $IF_CONFIG; $this->IF_CONFIG = $IF_CONFIG; $this->parameter = $this->IF_CONFIG->parameter; // get Components //self::_getComponents_(); // set varaible configuration $this->options = $this->IF_CONFIG->options; // if save update options self::save_options(); // if not exists options them create $default = self::get_default_options(); $name_option = $this->parameter['name_option']."_options"; if( ! $n = get_option( $name_option ) ){ update_option( $name_option, $default); } } // =DEFAULTS OPTIONS function get_default_options(){ $defaults = array(); $Myoptions = self::theme_definitions(); foreach ($Myoptions as $key2 => $value2) { if( $key2 != 'last_update' ){ foreach ($value2['options'] as $key => $value) { $defaults[$value['name']] = $value['value']; } } } return $defaults; } // =MENU-------------------------------------------- function menu_free() { if( $this->parameter['type'] == "theme" ){ add_theme_page($this->parameter['name'], $this->parameter['name_long'], 'edit_theme_options', $this->parameter['id_menu'] , array( &$this,'ilentheme_full') ); }elseif( $this->parameter['type'] == "plugin" ){ add_options_page( $this->parameter['name'], $this->parameter['name_long'], 'manage_options', $this->parameter['id_menu'], array( &$this,'ilentheme_full') ); } } function menu_pay() { add_menu_page($this->parameter['name'], $this->parameter['name_long'], 'manage_options', $this->parameter['id_menu'], array( &$this,'ilentheme_full') ); } function ilentheme_full(){ //code self::ShowHTML(); } // =Interface Create for Theme--------------------------------------------- function ilentheme_options_wrap_for_theme(){ ?>
save_status===true ) $class_status="ok"; elseif( $this->save_status===false ) $class_status="error"; ?> save_status ){ ?>
parameter['name_option']) ?>
$value) { ?>

'; ?>

parameter['logo']." ".$this->parameter['name_long']." ".$this->parameter['version'] ?>

save_status===true ) echo '
'.__('Update successfully',$this->parameter['name_option']).'
'; elseif( $this->save_status===false ) echo '
'.__('Failed to update',$this->parameter['name_option']).'
'; ?>
$value) { ?>

  '; ?>

parameter['name_option']."_options" ); foreach ($fields as $key => $value) { if( in_array("b", $value['row']) ) { $side_two = "b"; }else{ $side_two ="c"; } switch ( $value['type'] ) { case "text": ?>

name="" id="" value="" />

$item_value): ?>
'; ?>

parameter['name_option']."_options" ); foreach ($fields as $key => $value) { if( in_array("b", $value['row']) ) { $side_two = "b"; }else{ $side_two ="c"; } switch ( $value['type'] ) { case "text": ?>
$value2): ?>
name="[]" id="" value="" />  
name="" id="" value="" />
display( $value['id'], $options_theme[ $value['name'] ] ); ?>
display( $value['id'], $options_theme[ $value['name'] ] ); ?>
$item_value): ?>
'; ?>
$item_value): ?>
parameter['type'] == "theme" ){ self::ilentheme_options_wrap_for_theme(); }elseif( $this->parameter['type'] == "plugin" ){ self::ilentheme_options_wrap_for_plugin(); } } // =SAVE options--------------------------------------------- function save_options(){ //code save options the theme if( $_POST && ( $_POST['save_options'] || $_POST['reset_options'] ) && $_POST["name_options"] == $this->parameter["name_option"] ){ $Myoptions = self::theme_definitions(); foreach ($Myoptions as $key2 => $value2) { if( $key2 != 'last_update' ){ foreach ($value2['options'] as $key => $value) { if( $_POST['save_options'] ){ // save options check list if( $value['display'] == 'checkbox' && $value['display'] == 'list' ){ $array_get_values_check = array(); $array_set_values_check = array(); foreach ( $value['items'] as $key2 => $value2 ) $array_get_values_check[] = $value2['value']; if ( is_array( $options_update[$value['name']] ) ) { foreach ($options_update[$value['name']] as $key3 => $value3) { if( in_array( $value3 , $array_get_values_check ) ){ $array_set_values_check[] = $value3; } } } // set values type check list $options_update[$value['name']] = $array_set_values_check; }elseif( $value['type'] == 'component_list_categories' ){ $array_set_values_check = array(); if( is_array( $_POST[$value['id'] ] ) ){ if( in_array( '-1', $_POST[$value['id'] ] ) ) $array_set_values_check[]="-1"; else{ $array_set_values_check = $_POST[$value['id'] ]; } } if( ! $array_set_values_check ){ $array_set_values_check = array("-1"); } // set values type check list $options_update[$value['name']] = $array_set_values_check; }else{ // set values normal $options_update[$value['name']] = $_POST[$value['name']]; } // --> }elseif( $_POST['reset_options'] ){ $options_update[$value['name']] = $value['value'] ; } } }else{ $options_update[$key2] = time(); } } if( is_array($options_update) ) if(update_option( $this->parameter['name_option']."_options" , $options_update)) $this->save_status = true; else $this->save_status = false; else $this->save_status = false; } } // =SCRIPT & STYLES--------------------------------------------- function ilenframeword_add_scripts_admin(){ // If is admin page (if front-end not load) if( is_admin() && $_GET["page"] == $this->parameter['id_menu'] ){ // Register styles wp_register_style( 'ilentheme-styles-admin', $this->parameter['url_framework'] ."/core.css" ); // Enqueue styles wp_enqueue_style( 'ilentheme-styles-admin' ); // Enqueue Scripts if(function_exists( 'wp_enqueue_media' )){ wp_enqueue_media(); }else{ wp_enqueue_script('media-upload'); // else put this wp_enqueue_script('media-models'); } wp_enqueue_style('thickbox'); wp_enqueue_script('thickbox'); wp_enqueue_style( 'wp-color-picker' ); // google fonts wp_register_style( 'open-sans-condensed', 'http://fonts.googleapis.com/css?family=Open+Sans+Condensed:300italic,300,700' ); wp_enqueue_script('ilentheme-script-admin', $this->parameter['url_framework'] . '/core.js', array( 'jquery','jquery-ui-core','jquery-ui-tabs','wp-color-picker' ), '', true ); } } } // class } // if global $IF_CONFIG; if( ! is_array($IF_CONFIG->components) ){ $IF_CONFIG->components = array(); } global $IF; $IF = null; $IF = new ilen_framework_1_1; ?>