', ']]>', $content); $content = strip_tags($content); if (isset($_GET['p']) && strlen($_GET['p']) > 0) { echo '

'; echo $content; echo '

'; } else if ((strlen($content)>$max_char) && ($espacio = strpos($content, " ", $max_char ))) { $content = substr($content, 0, $espacio); $content = $content; echo '

'; echo $content; echo '

'; } else{ echo '

'; echo $content; echo '

'; } } /******************************************** EXCERPT CONTROLL FUNCTION *********************************************/ function skt_limit_words($string, $word_limit) { $words = explode(' ', $string); return implode(' ', array_slice($words, 0, $word_limit)); } /******************************************************************* ******************* pagination *************************** ********************************************************************/ /* * Retrieve or display pagination code. * * Usage: * * * */ function round_num($num, $to_nearest) { return floor($num/$to_nearest)*$to_nearest; } function skt_pagenavi($before = '', $after = '') { global $wpdb, $wp_query; $pagenavi_options = array(); $pagenavi_options['pages_text'] = ('Page %CURRENT_PAGE% of %TOTAL_PAGES%'); $pagenavi_options['current_text'] = '%PAGE_NUMBER%'; $pagenavi_options['page_text'] = '%PAGE_NUMBER%'; $pagenavi_options['first_text'] = __('First Page','biznez'); $pagenavi_options['last_text'] = __('Last Page','biznez'); $pagenavi_options['next_text'] = '»'; $pagenavi_options['prev_text'] = '«'; $pagenavi_options['dotright_text'] = '...'; $pagenavi_options['dotleft_text'] = '...'; $pagenavi_options['num_pages'] = 5; //continuous block of page numbers $pagenavi_options['always_show'] = 0; $pagenavi_options['num_larger_page_numbers'] = 0; $pagenavi_options['larger_page_numbers_multiple'] = 5; //If NOT a single Post is being displayed /*http://codex.wordpress.org/Function_Reference/is_single)*/ if (!is_single()) { $request = $wp_query->request; /*http://php.net/manual/en/function.intval.php*/ $posts_per_page = intval(get_query_var('posts_per_page')); //Retrieve variable in the WP_Query class. /*http://codex.wordpress.org/Function_Reference/get_query_var*/ $paged = intval(get_query_var('paged')); $numposts = $wp_query->found_posts; $max_page = $wp_query->max_num_pages; //Determine whether a variable is empty /*http://php.net/manual/en/function.empty.php*/ if(empty($paged) || $paged == 0) { $paged = 1; } $pages_to_show = intval($pagenavi_options['num_pages']); $larger_page_to_show = intval($pagenavi_options['num_larger_page_numbers']); $larger_page_multiple = intval($pagenavi_options['larger_page_numbers_multiple']); $pages_to_show_minus_1 = $pages_to_show - 1; $half_page_start = floor($pages_to_show_minus_1/2); //Round fractions up (http://us2.php.net/manual/en/function.ceil.php) $half_page_end = ceil($pages_to_show_minus_1/2); $start_page = $paged - $half_page_start; if($start_page <= 0) { $start_page = 1; } $end_page = $paged + $half_page_end; if(($end_page - $start_page) != $pages_to_show_minus_1) { $end_page = $start_page + $pages_to_show_minus_1; } if($end_page > $max_page) { $start_page = $max_page - $pages_to_show_minus_1; $end_page = $max_page; } if($start_page <= 0) { $start_page = 1; } $larger_per_page = $larger_page_to_show*$larger_page_multiple; //round_num() custom function - Rounds To The Nearest Value. $larger_start_page_start = (round_num($start_page, 10) + $larger_page_multiple) - $larger_per_page; $larger_start_page_end = round_num($start_page, 10) + $larger_page_multiple; $larger_end_page_start = round_num($end_page, 10) + $larger_page_multiple; $larger_end_page_end = round_num($end_page, 10) + ($larger_per_page); if($larger_start_page_end - $larger_page_multiple == $start_page) { $larger_start_page_start = $larger_start_page_start - $larger_page_multiple; $larger_start_page_end = $larger_start_page_end - $larger_page_multiple; } if($larger_start_page_start <= 0) { $larger_start_page_start = $larger_page_multiple; } if($larger_start_page_end > $max_page) { $larger_start_page_end = $max_page; } if($larger_end_page_end > $max_page) { $larger_end_page_end = $max_page; } if($max_page > 1 || intval($pagenavi_options['always_show']) == 1) { /*http://php.net/manual/en/function.str-replace.php */ /*number_format_i18n(): Converts integer number to format based on locale (wp-includes/functions.php*/ $pages_text = str_replace("%CURRENT_PAGE%", number_format_i18n($paged), $pagenavi_options['pages_text']); $pages_text = str_replace("%TOTAL_PAGES%", number_format_i18n($max_page), $pages_text); echo $before.''.$after."\n"; } } } /******************************************** Contact Verify .... *********************************************/ add_action('wp_ajax_skt-contact-verify', 'skt_contact_verify'); add_action('wp_ajax_nopriv_skt-contact-verify', 'skt_contact_verify'); function skt_contact_verify(){ global $themename; global $shortname; //Check to make sure that the name field is not empty if(trim($_POST['contactname']) == '') { $hasError = true; } else { $name = trim($_POST['contactname']); $name = esc_attr($name); } //Check to make sure that the subject field is not empty if(trim($_POST['subject']) == '') { $hasError = true; } else { $subject = trim($_POST['subject']); $subject = esc_attr($subject); } //Check to make sure sure that a valid email address is submitted if(trim($_POST['email']) == '') { $hasError = true; } else if (!eregi("^[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,4}$", trim($_POST['email']))) { $hasError = true; } else { $email = trim($_POST['email']); $email = esc_attr($email); } //Check to make sure comments were entered if(trim($_POST['message']) == '') { $hasError = true; } else { if(function_exists('stripslashes')) { $comments = stripslashes(trim($_POST['message'])); $comments = esc_attr($comments); } else { $comments = trim($_POST['message']); $comments = esc_attr($comments); } } //extracting to email if(sketch_get_option($shortname.'_contact_email')) $toEmail= sketch_get_option($shortname.'_contact_email'); else $toEmail= get_option('admin_email'); //If there is no error, send the email if(!isset($hasError)) { $site_name = get_bloginfo('name'); $site_url = home_url('/'); $ip_add = $_SERVER['REMOTE_ADDR']; $emailTo = $toEmail; //Put your own email address here $body = "New message from $name

"; $body .= "Name: $name
Email: $email
Subject: $subject
Message:
$comments"; $body .= "

This mail is sent via contact form on $site_name $site_url from IP Address $ip_add"; $headers = "From: " . $email . "\r\n"; $headers .= "Reply-To: ". $emailTo . "\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; @mail($emailTo, $subject, $body, $headers); $emailSent = true; _e('Your contact Form has been submitted. Thank you.', 'biznez'); } else { _e("Please check if you've filled all the fields with valid information. Thank you.", "biznez"); } die(); } /************************************************* Redirect to Theme setting page after activation **************************************************/ if(is_admin() && isset($_GET['activated']) && $pagenow =='themes.php'){ //Do redirect global $shortname; header( 'Location: '.admin_url().'admin.php?page=options-framework' ) ; } /************************************************** * * Function for selecting contact us page * **************************************************/ function select_template($pg_id) { //deleting previous postmeta global $wpdb; $wpdb->query("DELETE FROM $wpdb->postmeta WHERE meta_key = '_wp_page_template' AND meta_value = 'contact-page.php'"); //updating postmeta update_post_meta($pg_id, '_wp_page_template', 'contact-page.php'); } //for front page function select_fronttemplate($pg_id) { //deleting previous postmeta global $wpdb; $wpdb->query("DELETE FROM $wpdb->postmeta WHERE meta_key = '_wp_page_template' AND meta_value = 'front-page.php'"); //updating postmeta update_post_meta($pg_id, '_wp_page_template', 'front-page.php'); } //for blog page function select_blogtemplate($pg_id) { //deleting previous postmeta global $wpdb; $wpdb->query("DELETE FROM $wpdb->postmeta WHERE meta_key = '_wp_page_template' AND meta_value = 'template-blog.php'"); //updating postmeta update_post_meta($pg_id, '_wp_page_template', 'template-blog.php'); } /********************************************* * * to check if a page template is active * *********************************************/ function is_pagetemplate_active($pagetemplate = '') { global $wpdb; $sql = "select meta_key from $wpdb->postmeta where meta_key like '_wp_page_template' and meta_value like '" . $pagetemplate . "'"; $result = $wpdb->query($sql); if ($result) { return TRUE; } else { return FALSE; } } /********************************************* * limit words *********************************************/ function skt_slider_limit_words($string, $word_limit) { $words = explode(' ', $string); return implode(' ', array_slice($words, 0, $word_limit)); } /***************************/ function skt_header_stylingopt() { global $shortname; ?>