'; print_r($data); echo ''; } } if(!function_exists('alphabets_bar')){ function alphabets_bar(){ global $ap; $alphabets = ap_alphabets(); $alphabetz_bar = ''; foreach($alphabets as $language=>$alphabetz){ $alphabetz_bar .= ''; } return $alphabetz_bar; } } if(!function_exists('ap_tax_types_callback')){ function ap_tax_types_callback() { if(!isset($_POST['type'])) die(); global $wpdb; $return['msg'] = false; $return = array(); $args = array( 'type' => 'post', 'child_of' => 0, 'parent' => '', 'orderby' => 'name', 'order' => 'ASC', 'hide_empty' => 0, 'hierarchical' => 1, 'exclude' => '', 'include' => '', 'number' => '', 'taxonomy' => $_POST['type'], 'pad_counts' => false ); $categories = get_categories( $args ); if(!empty($categories)){ $return['msg'] = true; $return['data'][0] = 'Select'; $return['selected'] = get_option('ap_tax_types'); foreach($categories as $cats){ $return['data'][$cats->cat_ID] = $cats->cat_name; } } echo json_encode($return); exit; } } if(!function_exists('ap_has_term')){ function ap_has_term($taxonomy){ $response = false; $ap_tax_types = get_option('ap_tax_types'); switch($taxonomy){ case 'category': $categories = get_the_category(); $current_cat = $categories[0]->cat_ID; $response = is_category(); if(!empty($ap_tax_types)){ $response = !in_array($current_cat, $ap_tax_types); } break; case 'post_tag': $response = is_tag(); break; default: $response = has_term('', $taxonomy); break; } return $response; } } if(!function_exists('ap_go')){ function ap_go(){ $allowed_taxes = get_option('ap_tax'); $ap_go = FALSE; if(!empty($allowed_taxes) && $allowed_taxes[0]!=''){ foreach($allowed_taxes as $taxonomy_allowed){ $ap_go = ap_has_term($taxonomy_allowed); if($ap_go) break; } } if(get_option('ap_all')){ $ap_go = TRUE; } return $ap_go; } } if(!function_exists('ap_ready')){ function ap_ready(){ echo ''; } } if(!function_exists('ap_start')){ function ap_start(){ update_option( 'ap_case', 'U'); update_option( 'ap_layout', 'H'); update_option( 'ap_dom', '#content' ); } } if(!function_exists('ap_end')){ function ap_end(){ delete_option( 'ap_case'); delete_option( 'ap_layout'); delete_option( 'ap_dom'); } } if(!function_exists('ap_pagination')){ function ap_pagination(){ global $wpdb; if(!is_admin() && is_main_query())// && $wpdb->num_rows>0){ if(!function_exists('ap_where')){ function ap_where($where){ global $wpdb; global $ap; $where .= ' AND '.$wpdb->prefix.'posts.post_title LIKE "'.mysql_real_escape_string($ap).'%"'; return $where; } } add_filter( 'posts_where' , 'ap_where' ); if(!function_exists('render_alphabets')){ function render_alphabets(){ $default_place = get_option('ap_dom')==''?'#content':get_option('ap_dom'); $alphabets_bar = alphabets_bar(); $script = ''; if(ap_go()) echo $script; } } add_action("wp_footer", 'render_alphabets'); } } if(!function_exists('ap_alphabets')){ function ap_alphabets(){ $languages_selected = get_option('ap_lang'); if(empty($languages_selected)) $languages_selected = array(); require_once('languages.php'); global $ap_langs; $alphabets = array(); if(empty($languages_selected) || in_array('English', $languages_selected)){ //LETS START WITH AN OLD STRING $str = "quick brown fox jumps over the lazy dog"; $alpha_array = array_unique(str_split(str_replace(' ', '', $str))); asort($alpha_array); $alphabets['english'] = array_values($alpha_array); } if(!empty($languages_selected)){ foreach($languages_selected as $language_selected){ $language_selected = strtolower($language_selected); if(in_array($language_selected, array_keys($ap_langs)) && !isset($alphabets[$language_selected])){ $alphabets[$language_selected] = $ap_langs[$language_selected]; } } } return $alphabets; } } ?>