$mtd) { $button_id = 'npr_btn_'.$mti.''; $m_div_id = 'npr_con_'.$mti.''; $m_inner_div = $m_div_id.'_inner'; $b_tabs = $mtd['tabs']; if(!is_array($b_tabs)) $b_tabs = array(); $itabs = array(); $icontents = array(); $c = ''; $npr_buttons[] = ''.($mtd['icon'] != '' ? '' : '').''.$mtd['button'].''; if(count($b_tabs) > 0) { $c = ''; $e = 0; foreach($b_tabs AS $bti => $btd) { $irows = array(); $itabid = 'npr_it_'.$mti.'_'.$bti; $itabbtn = $button_id.'_'.$bti; $t_div_id = $m_div_id.'_'.$bti; $rowsa = $btd['rows']; if(!is_array($rowsa)) $rowsa = array(); if(count($rowsa) > 0) { foreach($rowsa AS $row) { $irows[] = npr_generate_row($row); } } $itabs[] = '
  • '.($btd['icon'] != '' ? '' : '').''.$btd['tab_title'].'
  • '; $icontents[] = '
    '.($btd['title'] != '' ? '

    '.($btd['icon'] != '' ? '' : '').''.$btd['title'].'

    ' : '').' '.($btd['description'] != '' ? '
    '.$btd['description'].'
    ' : '').' '.implode($irows).'
    '; $e++; } $c = '
    '.implode($icontents).'
    '; $npr_panels[] = $c; } $d++; } } else { $npr_panels[] = __('Configuration file is missing.
    Please reinstall '.$theme_name.' theme.','above_skyline_demo'); } print '
    '.$theme_name.' theme options
      '.implode($npr_buttons).'
    '.implode($npr_panels).'
    Save Failed!
    Settings Saved
    '; } function npr_options_page_js() { $dir = get_template_directory_uri() . '/admin/js'; wp_register_script('jquery-ui','http://code.jquery.com/ui/1.10.3/jquery-ui.js'); wp_enqueue_script('jquery'); wp_enqueue_script('jquery-ui'); wp_enqueue_script('media-upload'); wp_enqueue_script('thickbox'); wp_enqueue_script('npr_admin_panel',$dir.'/admin_panel.js'); } function npr_options_page_css() { $dir = get_template_directory_uri() . '/admin/css'; wp_enqueue_style('thickbox'); wp_enqueue_style('npr_admin_panel_forn','http://fonts.googleapis.com/css?family=Open+Sans:300italic,700italic,800italic,400,300,700,800,600&subset=latin,latin-ext'); wp_enqueue_style('npr_admin_fontawesome',$dir.'/font-awesome.min.css'); wp_enqueue_style('npr_admin_panel_css',$dir.'/admin_default.css'); } function npr_generate_row($row) { global $npr_theme_config, $theme_name, $theme_slug, $theme_version, $fields; $row_types = array('header','infobox','image','tooltip','list','text','textbox','checkbox','color','image_upload','category','pages','post_info','select','post_list','category_select','widget_select'); if(in_array($row['type'],$row_types)) { $pre_locations = array('admin' => get_template_directory_uri() . '/admin', 'template' => get_template_directory_uri()); if(!isset($row['box'])) $row['box'] = true; if(!isset($row['half'])) $row['half'] = false; if(!isset($row['color'])) $row['color'] = 'default'; if($row['type'] == 'header') { if(!isset($row['h'])) $row['h'] = 'h3'; $htag = $row['h']; $c .= '<'.$htag.'>'.($row['icon'] != '' ? '' : '').''.$row['title'].''; } if($row['type'] == 'infobox') { $c .= '

    '.($row['icon'] != '' ? '' : '').''.$row['title'].'

    '.$row['content'].'
    '; } elseif($row['type'] == 'image') { if(array_key_exists($row['location'],$pre_locations)) $img_url = $pre_locations[$row['location']].$row['file']; else $img_url = $row['file']; $c.= '

    '.($row['icon'] != '' ? '' : '').''.$row['title'].'

    '.$row['title'].'
    '; } elseif($row['type'] == 'list') { $li = array(); $icons = array('tick' => 'fa fa-ok','x' => 'fa fa-remove'); $icolors = array('tick' => '#00bb00','x' => '#bb0000'); $lists = $row['list']; if(!is_array($lists)) $lists = array(); if(count($lists) > 0) { foreach($lists AS $list) { $li[] = '
  • '.($list['icon'] != '' ? '' : '').''.$list['title'].'
  • '; } } $c .= ($row['title'] != '' ? '

    '.($row['icon'] != '' ? '' : '').''.$row['title'].'

    ' : '').'
    '; } elseif($row['type'] == 'npr_installed') { /* in development */ } elseif($row['type'] == 'checkbox') { $btn_enabled_text = ($row['enabled'] != '') ? $row['enabled'] : esc_html__('Enabled','above_skyline_demo'); $btn_disabled_text = ($row['disabled'] != '') ? $row['disabled'] : esc_html__('Disabled','above_skyline_demo'); $c .= '

    '.($row['icon'] != '' ? '' : '').''.$row['title'].'

    '; } elseif($row['type'] == 'text') { $c .= '

    '.($row['icon'] != '' ? '' : '').''.$row['title'].'

    '; } elseif($row['type'] == 'textbox') { $c .= '

    '.($row['icon'] != '' ? '' : '').''.$row['title'].'

    '; } elseif($row['type'] == 'image_upload') { $logo_file = get_template_directory_uri().'/images/logo.png'; $c .= '

    '.($row['icon'] != '' ? '' : '').''.$row['title'].'

    '.($row['preview'] === true ? '
    ' : '').'
    '; if($row['preview'] === true) { $c .= ''; } } elseif($row['type'] == 'select') { if($row['empty'] === true) $sel_opts .= ''; if(is_array($row['options'])) { foreach($row['options'] AS $k => $d) { $sel_opts .= ''; } } $c .= '

    '.($row['icon'] != '' ? '' : '').''.$row['title'].'

    '; } elseif($row['type'] == 'post_info') { $ops = explode('|',$row['value']); $c .= '

    '.($row['icon'] != '' ? '' : '').''.$row['title'].'

    '.__('Author','above_skyline_demo').' '.__('Date','above_skyline_demo').' '.__('Category','above_skyline_demo').' '.__('Comments','above_skyline_demo').'
    '; } elseif($row['type'] == 'post_list') { if($row['max_item'] == 0) $row['max_item'] = 999; $pli = array(); $ops = explode(',',$row['value']); $get_all_posts = get_pages(); foreach($get_all_posts AS $gap) { if(in_array($gap->ID,$ops)) { $pli[$gap->ID] = $gap; } else { $post_list_container .= '
  • '.$gap->post_title.'
  • '; } } foreach($ops AS $plo) { if($plo != '') $post_list_target .= '
  • '.$pli[$plo]->post_title.'
  • '; } if($post_list_target != '') $empty_post_list_target = ' style="display:none;"'; if($post_list_container != '') $empty_all_post = ' style="display:none;"'; $c .= '

    '.($row['icon'] != '' ? '' : '').''.$row['title'].'

    '.__('Selected Pages','above_skyline_demo').'

    '.__('Drag to reorder. Click to remove','above_skyline_demo').'
    '.($row['no_items'] == '' ? __('No pages selected','above_skyline_demo') : $row['no_items']).'
      '.$post_list_target.'

    '.__('Available Pages','above_skyline_demo').'

    '.__('Click to add','above_skyline_demo').'
    '.__('No available pages','above_skyline_demo').'
      '.$post_list_container.'
    '; } elseif($row['type'] == 'category_select') { if($row['empty'] === true) $sel_opts .= ''; $allcateg = get_categories(array('hide_empty' => 0)); if(is_array($allcateg)) { foreach($allcateg AS $categ) { $sel_opts .= ''; } } $c .= '

    '.($row['icon'] != '' ? '' : '').''.$row['title'].'

    '; } elseif($row['type'] == 'widget_select') { $arearows = ''; $allarea = array('1' => 'sidebar_no','2' => 'sidebar_single_left','3' => 'sidebar_single_right','sidebar_double_left','sidebar_double_right','sidebar_both'); if(is_array($row['available'])) { foreach($row['available'] AS $k) { $arearows .= ''; } } $c .= '

    '.($row['icon'] != '' ? '' : '').''.$row['title'].'

    '.$arearows.'
    '.__('Select the sidebar position','above_skyline_demo').'
    '; } /**/ if($row['box'] === true) { $c = '
    '.$c.'
    '; } /**/ if($row['clear'] === true) $c .= '
    '; } return $c; } function npr_save_settings() { global $npr_theme_config, $theme_name, $theme_slug, $theme_version, $fields; /**/ foreach($_POST AS $k=>$d) { if(strpos($k,'npr_') !== false) { $k = str_ireplace('npr_','',$k); $ccc .= "'".$k."',"; } } /**/ foreach($_POST AS $k=>$d) { if(strpos($k,'npr_') !== false) { $k = str_ireplace('npr_','',$k); if(in_array($k,$fields)) { $fi = $theme_slug.'_'.$k; update_option($fi,$_POST['npr_'.$k]); } } } if($_GET['ajq'] == 1) { print 1; exit(); } else { header("location:" . admin_url('admin.php?page=npr_settings_panel.php')); } } function npr_nicepanel_url() { return admin_url('admin.php?page=npr_settings_panel.php'); } ?>