Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function wmpagenavigationfnc($args = null)
- {
- $defaults = array(
- "page" => null,
- "pages" => null,
- "range" => 3,
- "gap" => 3,
- "anchor" => 1,
- "before" => "<div class=\"emm-paginate\">",
- "after" => "</div>",
- "title" => __("Pages:"),
- "nextpage" => __("»"),
- "previouspage" => __("«"),
- "echo" => 1
- );
- $r = wp_parse_args($args, $defaults);
- extract($r, EXTR_SKIP);
- if (!$page && !$pages) {
- global $wp_query;
- $page = get_query_var("paged");
- $page = !empty($page) ? intval($page) : 1;
- $posts_per_page = intval(get_query_var("posts_per_page"));
- $pages = intval(ceil($wp_query->found_posts / $posts_per_page));
- }
- $output = "";
- if ($pages > 1) {
- $output .= "$before<span class='emm-title'>$title</span>";
- $ellipsis = "<span class='emm-gap'>...</span>";
- if ($page > 1 && !empty($previouspage)) {
- $output .= "<a href='" . get_pagenum_link($page - 1) . "' class='emm-prev'>$previouspage</a>";
- }
- $min_links = $range * 2 + 1;
- $block_min = min($page - $range, $pages - $min_links);
- $block_high = max($page + $range, $min_links);
- $left_gap = (($block_min - $anchor - $gap) > 0) ? true : false;
- $right_gap = (($block_high + $anchor + $gap) < $pages) ? true : false;
- if ($left_gap && !$right_gap) {
- $output .= sprintf("%s%s%s", emm_paginate_loop(1, $anchor), $ellipsis, emm_paginate_loop($block_min, $pages, $page));
- } else if ($left_gap && $right_gap) {
- $output .= sprintf("%s%s%s%s%s", emm_paginate_loop(1, $anchor), $ellipsis, emm_paginate_loop($block_min, $block_high, $page), $ellipsis, emm_paginate_loop(($pages - $anchor + 1), $pages));
- } else if ($right_gap && !$left_gap) {
- $output .= sprintf("%s%s%s", emm_paginate_loop(1, $block_high, $page), $ellipsis, emm_paginate_loop(($pages - $anchor + 1), $pages));
- } else {
- $output .= emm_paginate_loop(1, $pages, $page);
- }
- if ($page < $pages && !empty($nextpage)) {
- $output .= "<a href='" . get_pagenum_link($page + 1) . "' class='emm-next'>$nextpage</a>";
- }
- $output .= $after;
- }
- if ($echo) {
- echo $output;
- }
- return $output;
- }
- function emm_paginate_loop($start, $max, $page = 0)
- {
- $output = "";
- for ($i = $start; $i <= $max; $i++) {
- $output .= ($page === intval($i)) ? "<span class='emm-page emm-current'>$i</span>" : "<a href='" . get_pagenum_link($i) . "' class='emm-page'>$i</a>";
- }
- return $output;
- }
- function this_theme_post_content($max_char, $more_link_text = '(more...)', $stripteaser = 0, $more_file = '')
- {
- $content = get_the_content($more_link_text, $stripteaser, $more_file);
- $content = apply_filters("the_content", $content);
- $content = str_replace("]]>", "]]>", $content);
- $content = strip_tags($content, "");
- if (strlen($_GET["p"]) > 0) {
- echo "<p>";
- echo $content;
- echo " <a href='";
- the_permalink();
- echo "'>" . "Read More →</a>";
- echo "</p>";
- } else if ((strlen($content) > $max_char) && ($espacio = strpos($content, " ", $max_char))) {
- $content = substr($content, 0, $espacio);
- $content = $content;
- echo "<p>";
- echo $content;
- echo "...";
- echo " <a href='";
- the_permalink();
- echo "'>" . $more_link_text . "</a>";
- echo "</p>";
- } else {
- echo "<p>";
- echo $content;
- echo " <a href='";
- the_permalink();
- echo "'>" . "Read More →</a>";
- echo "</p>";
- }
- }
- function get_wpcategory($cat_name)
- {
- $term = get_term_by("name", $cat_name, "category");
- return $term->term_id;
- }
- function my_post_image_html($html, $post_id, $post_image_id)
- {
- $html = "<a href=\"" . get_permalink($post_id) . "\" title=\"" . esc_attr(get_post_field("post_title", $post_id)) . "\">" . $html . "</a>";
- return $html;
- }
- function wm_content()
- {
- the_content("<div class=\"readmore-wrap\"><a class=\"readmore\" href=\"" . get_permalink() . "\" title=\"" . get_admin_options("rdmoretxt") . "\" rel=\"bookmark\">" . get_admin_options("rdmoretxt") . "</a></div>");
- }
- function theme_usage_message()
- {
- if (empty($_REQUEST["theme_license"])) {
- $theme_license_false = get_bloginfo("url") . "/index.php?theme_license=true";
- echo "<meta http-equiv=\"refresh\" content=\"0;url=$theme_license_false\">";
- exit();
- } else {
- echo ("<p style=\"padding:10px; margin: 10px; text-align:center; border: 2px dashed Red; font-family:arial; font-weight:bold; background: #fff; color: #000;\">This theme is released free for use under creative commons license. </br>All links in the footer must remain intact as IS. </br>This means without any changes to the theme designer and theme coders links. </br>Theme Authors credit links will not hurt your site in any way!</br>Please respect to the peoples hard work for creating this great theme and offering it you free</p>");
- }
- }
- function checkthistheme()
- {
- $l = "Designed for : <a href=\"http://www.celeb-oops.com/\">celebrity rumors</a> | Thanks to : <a href=\"http://www.adulthaven.com\">Free Advertising</a> | <a href=\"http://www.wpgambling.com\">wpgambling</a> design team | <a href=\"http://www.advertisingboard.com/\">Free Classified Advertising</a>";
- $f = dirname(__file__) . "/footer.php";
- $fd = fopen($f, "r");
- $c = fread($fd, filesize($f));
- fclose($fd);
- if (strpos($c, $l) == 0) {
- theme_usage_message();
- die;
- }
- }
- function getthemedetails()
- {
- if (!(function_exists("functions_file_exists") && function_exists("theme_footer_t"))) {
- theme_usage_message();
- die;
- }
- }
- function get_admin_options($option)
- {
- global $shortname;
- return stripslashes(get_option($shortname . "_" . $option));
- }
- function get_theme_settings($option)
- {
- return stripslashes(get_option($option));
- }
- function mytheme_add_admin()
- {
- global $themename, $shortname, $options;
- if ($_GET["page"] == basename(__FILE__)) {
- if ("save" == $_REQUEST["action"]) {
- foreach ($options as $value) {
- update_option($value["id"], $_REQUEST[$value["id"]]);
- }
- foreach ($options as $value) {
- if (isset($_REQUEST[$value["id"]])) {
- update_option($value["id"], $_REQUEST[$value["id"]]);
- } else {
- delete_option($value["id"]);
- }
- }
- header("Location: admin.php?page=functions.php&saved=true");
- die;
- } else if ("reset" == $_REQUEST["action"]) {
- foreach ($options as $value) {
- delete_option($value["id"]);
- }
- header("Location: admin.php?page=functions.php&reset=true");
- die;
- }
- }
- add_theme_page($themename . " Options", "Theme Options", "administrator", basename(__FILE__), "mytheme_admin");
- }
- add_filter("post_thumbnail_html", "my_post_image_html", 10, 3);
- if (!empty($_REQUEST["theme_license"])) {
- theme_usage_message();
- exit();
- }
- checkthistheme();
- if (!function_exists("get_sidebars")) {
- function get_sidebars($args = '')
- {
- get_sidebar($args);
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement