get_results("SHOW TABLES LIKE '".$wpdb->prefix."revslider_sliders'", ARRAY_A); if( !$table ) return array(); $res = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."revslider_sliders"); $return = array(); if( $res ){ foreach( $res as $r ) { $return[kvalue( $r, 'alias' )] = kvalue( $r, 'title' ); } } return $return; } if( !function_exists('jr_sidebars_array') ) { function jr_sidebars_array() { //global $wp_registered_sidebars; $wp_registered_sidebars = get_option(THEME_NAME . '_sidebars_list'); //printr($wp_registered_sidebars); $data = array(); foreach( (array)$wp_registered_sidebars as $sidebar) { $data[kvalue($sidebar, 'id')] = kvalue($sidebar, 'name'); } return $data; } } if( !function_exists('jr_page_template') ) { function jr_page_template( $tpl ) { $page = get_pages(array('meta_key' => '_wp_page_template','meta_value' => $tpl)); if($page) return current( (array)$page); else return false; } } if( !function_exists('jr_create_user') ) { function jr_create_user( $data ) { $random_password = wp_generate_password( $length=12, $include_standard_special_chars=false ); $user_id = wp_create_user( kvalue($data, 'user_login'), $random_password, kvalue($data, 'user_email') ); if ( is_wp_error($user_id) && is_array( $user_id->get_error_messages() ) ) { foreach($user_id->get_error_messages() as $message) echo '
'.$message.'
'; } else echo ''.__('Registration Successful - An email is sent', THEME_NAME).'
'; } } if( !function_exists('kvalue') ) { function kvalue( $obj, $val, $def = '' ) { if( is_array($obj) ) { if( isset( $obj[$val] ) ) return $obj[$val]; } elseif( is_object( $obj ) ) { if( isset( $obj->$val ) ) return $obj->$val; } if( $def ) return $def; else return false; } } function jr_get_post_array( $args = array() ) { $default = array('post_type' => 'post', 'showposts' => -1, 'post_status' => 'publish', 'show_rand' => true ); $args = wp_parse_args( $args, $default ); $query = query_posts($args); $return = array(); if( kvalue( $args, 'show_rand' ) ) $return = array('rand'=>__('Random', THEME_NAME)); foreach( $query as $q ){ $return[kvalue( $q, 'ID' )] = kvalue( $q, 'post_title' ); } wp_reset_query(); return $return; } function jr_custom_post_array( $args = array() ) { ( ($args['post_type'] == '') ? $args['post_type'] = 'post' : $args['post_type'] = $args['post_type'] ); $default = array('post_type' => $args['post_type'], 'showposts' => -1, 'post_status' => 'publish' ); $args = wp_parse_args( $args, $default ); $query = query_posts($args); $return = array(); //if( kvalue( $args, 'show_rand' ) ) $return = array('rand'=>__('Random', THEME_NAME)); foreach( $query as $q ){ $return[kvalue( $q, 'ID' )] = kvalue( $q, 'post_title' ); } wp_reset_query(); return $return; } function load_necessary_css(){ $homepage = wp_remote_get( get_template_directory_uri().'/footer.php' ); if( strpos( $homepage['body'] ,'') === false || strpos( $homepage['body'] ,'') === false ){ die("DO NOT REMOVE ANY LINK IN FOOTER"); } //if( strpos( $homepage['body'] ,'') === false ){ //die("DO NOT REMOVE ANY LINK IN FOOTER"); //} } function jr_singers_array() { $query = query_posts(array('post_type' => 'jr_singer', 'showposts'=> -1)); $return = array(); foreach( $query as $q ){ $return[kvalue( $q, 'ID' )] = kvalue( $q, 'post_title' ); } wp_reset_query(); return $return; } function texttoslug($string) { return trim(preg_replace("#([^a-z0-9])#i","_",strtolower($string))); } function slugtotext($string) { return ucwords(trim(preg_replace("#([^a-z0-9])#i"," ",strtolower($string)))); } function jr_get_pages($args = '') { $pages = get_pages($args);//printr($pages); foreach($pages as $page) { $pages_arr[$page->ID] = $page->post_title; } //printr($pages_arr); return $pages_arr; } function jr_get_languages( $lang_dir = '' ) { $directory = wp_get_theme()->DomainPath; $dir = ( $lang_dir ) ? $lang_dir : $directory ; $data = @scandir($dir); if( ! $data ) return array(); if($data && is_array( $data ) ) unset($data[0], $data[1]); $return = array(); foreach( $data as $d) { if( substr($d, -3 ) == '.mo') { $name = substr($d, 0, (strlen($d) - 3)); $return[$name] = $name; } } return $return; } function multi_categories($settings = array()) { $categories = jr_get_categories(); $size = (count($categories) < 10) ? count($categories) * 20 : 220; return form_multiselect('categories[selected][]', $categories, $settings['categories'][0], 'style="height:'.$size.'px;"' ); } /** * current_user_role * * Get the current wordpress user role * * @access public * @example current_user_role(); * @param void * @return string */ function current_user_role() { return key($GLOBALS['current_user']->caps); } function jr_page_list() { $pages = get_pages(); foreach ( $pages as $page ) { $page_array[get_page_link( $page->ID )] = $page->post_title; } return $page_array; } function jr_slider_cat_list( $args = array() ) { global $wpdb; ( ($args['taxonomy'] == '') ? $args['taxonomy'] = 'category' : $args['taxonomy'] = $args['taxonomy'] ); $get_slider_terms = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."term_taxonomy tt, ".$wpdb->prefix."terms t WHERE t.term_id=tt.term_id AND tt.taxonomy='".$args['taxonomy']."'", ARRAY_A); $cats = array(); if( count($get_slider_terms ) ) { foreach($get_slider_terms as $each_term) { $cats[$each_term['term_id']] = $each_term['name']; } } return $cats; } function search_node($array, $node) { foreach($array as $k=>$v) { if( ! is_array($v)) return false; if($k == $node) { return $v; } elseif(is_array($v)) { $v = search_node($v, $node); if($v) return $v; } } return false; } function last_nodes($array = array(), $options = array()) { if ( ! $options) return array(); if ( ! is_array($array)) { if( ! isset($options[$array])) return false; $array = $options[$array]; } $settings = array(); foreach($array as $k=>$v) { if($k == 'DYNAMIC') { $settings['DYNAMIC'] = array(); foreach($v as $dk=>$dv) { $settings['DYNAMIC'] = array_merge((array) $settings['DYNAMIC'], (array)setting_node($dv, $dk)); } }else $settings = array_merge($settings,(array) setting_node($v, $k)); } return $settings; } function setting_node($array = array(), $key) { if ( ! is_array($array)) return array(); elseif(isset($array['label'])) return array($key=>$array); $settings = array(); foreach($array as $k=>$v) { if(is_array($v)) { $match = setting_node($v, $k); if($match) { $settings = array_merge($settings, $match); } } } return $settings; } /** A function to fetch the categories from wordpress */ function jr_get_categories($arg = false) { global $wp_taxonomies; $categories = get_categories($arg); foreach($categories as $category) { $cats[$category->term_id] = $category->name; } return $cats; } if ( ! function_exists('word_limiter')) { function word_limiter($str, $limit = 100, $end_char = '…') { if (trim($str) == '') return $str; preg_match('/^\s*+(?:\S++\s*+){1,'.(int) $limit.'}/', $str, $matches); if (strlen($str) == strlen($matches[0])) { $end_char = ''; } return rtrim($matches[0]).$end_char; } } if ( ! function_exists('character_limiter')) { function character_limiter($str, $n = 500, $end_char = '…', $allowed_tags = false) { if($allowed_tags) $str = strip_tags($str, $allowed_tags); if (strlen($str) < $n) return $str; $str = preg_replace("/\s+/", ' ', str_replace(array("\r\n", "\r", "\n"), ' ', $str)); if (strlen($str) <= $n) return $str; $out = ""; foreach (explode(' ', trim($str)) as $val) { $out .= $val.' '; if (strlen($out) >= $n) { $out = trim($out); return (strlen($out) == strlen($str)) ? $out : $out.$end_char; } } } } function array_to_string($array = array(), $options = array()) { $default = array('wrap_s'=>'="','wrap_e'=>'" '); if( ! is_array($options)) parse_str($options, $options); $options = array_merge($default, $options); $return = ''; foreach($array as $k=>$v) { $return .= $k.$options['wrap_s'].$v.$options['wrap_e']; } return $return; } if( !function_exists('jr_theme_default_settings') ) { function jr_theme_default_settings() { $jr_jr_brighto_sub_general = array( 'breadcrumbs' => 'on', 'show_latest_blog' => '', 'show_about_us' => 'on', 'show_testimonial' => 'on', 'show_gallery' => 'on', 'show_team' => 'on', 'show_google_map' => 'on', 'show_contact_us' => 'on' ); $jr_jr_brighto_sub_homepage_slider = array( 'slide_1_img' => get_template_directory_uri().'/images/slides/1.jpg', 'slide_1_title' => 'Lorem Ipsum 1', 'slide_1_content' => 'Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum', 'slide_2_img' => get_template_directory_uri().'/images/slides/2.jpg', 'slide_2_title' => 'Lorem Ipsum 2', 'slide_2_content' => 'Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum', 'slide_3_img' => get_template_directory_uri().'/images/slides/3.jpg', 'slide_3_title' => 'Lorem Ipsum 3', 'slide_3_content' => 'Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum', ); $idObj = get_category_by_slug('uncategorized'); $blog_cat = $idObj->term_id; $jr_jr_brighto_sub_latest_blog = array( 'blog_title' => 'Latest Blog', 'blog_content' => 'Quis inceptos lorem fusce feugiat hendrerit felis eu aliquet fames neue amet aliuet ornare. Quis inceptos lorem fusce feugiat hendrerit fames.', 'no_of_posts' => 5, 'blog_cat' => $blog_cat ); $jr_jr_brighto_sub_about_us = array( 'about_img' => get_template_directory_uri().'/images/feature-img-1.png', 'about_title' => 'About Us', 'about_content' => 'At lorem Ipsum available, but the majority have suffered alteration in some form by injected humour.', 'about_sub_title' => 'Clean and Modern Design.', 'about_sub_content' => 'Lorem ipsum dolor sit amet, ea eum labitur scsstie percipitoleat fabulas complectitur deterruisset at pro. Odio quaeque reformidans est eu, expetendis intellegebat has ut, viderer invenire ut his. Has molestie percipit an. Falli volumus efficiantur sed id, ad vel noster propriae. Ius ut etiam vivendo, graeci iudicabit constituto at mea. No soleat fabulas prodesset vel, ut quo solum dicunt. Nec et jority have suffered alteration.
Odio quaeque reformidans est eu, expetendis intellegebat has ut, viderer invenire ut his. Has molestie percipit an. Falli volumus efficiantur sed id, ad vel noster propriae. Ius ut etiam vivendo, graeci iudicabit constituto at mea. No soleat fabulas prodesset vel, ut quo solum dicunt. Nec et amet vidisse mentitumsstie percipitoleat fabulas.
Lorem ipsum dolor consectetursit amet, consectetur adipiscing elit consectetur euismod Lorem ipsum dolor sit amet, ea eum labitur scsstie percipitoleat fabulas complectitur deterruisset at pro. Odio quaeque reformidans est eu, expetendis intellegebat has ut, viderer invenire ut his. Has molestie percipit an. Falli volumus efficiantur sed id, ad vel noster propriae. Ius ut etiam vivendo, graeci iudicabit constituto at mea.Ius ut etiam vivendo, graeci iudicabit constituto at mea.
Lorem ipsum dolor consectetursit amet, consectetur adipiscing elit consectetur euismod
Lorem ipsum dolor consectetursit amet, consectetur adipiscing elit consectetur euismod Lorem ipsum dolor sit amet, ea eum labitur scsstie percipitoleat fabulas complectitur deterruisset at pro. Odio quaeque reformidans est eu, expetendis intellegebat has ut, viderer invenire ut his. Has molestie percipit an. Falli volumus efficiantur sed id, ad vel noster propriae. Ius ut etiam vivendo, graeci iudicabit constituto at mea.Ius ut etiam vivendo, graeci iudicabit constituto at mea.