Advertisement
plas71k

@Chakka => php file => hex decoded + replaced "GLOBALS" vars

Dec 20th, 2012
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 7.56 KB | None | 0 0
  1. <?php
  2. function wmpagenavigationfnc($args = null)
  3. {
  4.     $defaults  = array(
  5.         "page" => null,
  6.         "pages" => null,
  7.         "range" => 3,
  8.         "gap" => 3,
  9.         "anchor" => 1,
  10.         "before" => "<div class=\"emm-paginate\">",
  11.         "after" => "</div>",
  12.         "title" => __("Pages:"),
  13.         "nextpage" => __("&raquo;"),
  14.         "previouspage" => __("&laquo"),
  15.         "echo" => 1
  16.     );
  17.     $r = wp_parse_args($args, $defaults);
  18.     extract($r, EXTR_SKIP);
  19.     if (!$page && !$pages) {
  20.         global $wp_query;
  21.         $page  = get_query_var("paged");
  22.         $page  = !empty($page) ? intval($page) : 1;
  23.         $posts_per_page   = intval(get_query_var("posts_per_page"));
  24.         $pages = intval(ceil($wp_query->found_posts / $posts_per_page));
  25.     }
  26.     $output = "";
  27.     if ($pages > 1) {
  28.         $output .= "$before<span class='emm-title'>$title</span>";
  29.         $ellipsis               = "<span class='emm-gap'>...</span>";
  30.         if ($page > 1 && !empty($previouspage)) {
  31.             $output .= "<a href='" . get_pagenum_link($page - 1) . "' class='emm-prev'>$previouspage</a>";
  32.         }
  33.         $min_links                     = $range * 2 + 1;
  34.         $block_min      = min($page - $range, $pages - $min_links);
  35.         $block_high  = max($page + $range, $min_links);
  36.         $left_gap                 = (($block_min - $anchor - $gap) > 0) ? true : false;
  37.         $right_gap = (($block_high + $anchor + $gap) < $pages) ? true : false;
  38.         if ($left_gap && !$right_gap) {
  39.             $output .= sprintf("%s%s%s", emm_paginate_loop(1, $anchor), $ellipsis, emm_paginate_loop($block_min, $pages, $page));
  40.         } else if ($left_gap && $right_gap) {
  41.             $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));
  42.         } else if ($right_gap && !$left_gap) {
  43.             $output .= sprintf("%s%s%s", emm_paginate_loop(1, $block_high, $page), $ellipsis, emm_paginate_loop(($pages - $anchor + 1), $pages));
  44.         } else {
  45.             $output .= emm_paginate_loop(1, $pages, $page);
  46.         }
  47.         if ($page < $pages && !empty($nextpage)) {
  48.             $output .= "<a href='" . get_pagenum_link($page + 1) . "' class='emm-next'>$nextpage</a>";
  49.         }
  50.         $output .= $after;
  51.     }
  52.     if ($echo) {
  53.         echo $output;
  54.     }
  55.     return $output;
  56. }
  57. function emm_paginate_loop($start, $max, $page = 0)
  58. {
  59.     $output = "";
  60.     for ($i = $start; $i <= $max; $i++) {
  61.         $output .= ($page === intval($i)) ? "<span class='emm-page emm-current'>$i</span>" : "<a href='" . get_pagenum_link($i) . "' class='emm-page'>$i</a>";
  62.     }
  63.     return $output;
  64. }
  65. function this_theme_post_content($max_char, $more_link_text = '(more...)', $stripteaser = 0, $more_file = '')
  66. {
  67.     $content                = get_the_content($more_link_text, $stripteaser, $more_file);
  68.     $content = apply_filters("the_content", $content);
  69.     $content               = str_replace("]]>", "]]&gt;", $content);
  70.     $content = strip_tags($content, "");
  71.     if (strlen($_GET["p"]) > 0) {
  72.         echo "<p>";
  73.         echo $content;
  74.         echo "&nbsp;<a href='";
  75.         the_permalink();
  76.         echo "'>" . "Read More &rarr;</a>";
  77.         echo "</p>";
  78.     } else if ((strlen($content) > $max_char) && ($espacio = strpos($content, " ", $max_char))) {
  79.         $content = substr($content, 0, $espacio);
  80.         $content = $content;
  81.         echo "<p>";
  82.         echo $content;
  83.         echo "...";
  84.         echo "&nbsp;<a href='";
  85.         the_permalink();
  86.         echo "'>" . $more_link_text . "</a>";
  87.         echo "</p>";
  88.     } else {
  89.         echo "<p>";
  90.         echo $content;
  91.         echo "&nbsp;<a href='";
  92.         the_permalink();
  93.         echo "'>" . "Read More &rarr;</a>";
  94.         echo "</p>";
  95.     }
  96. }
  97. function get_wpcategory($cat_name)
  98. {
  99.     $term = get_term_by("name", $cat_name, "category");
  100.     return $term->term_id;
  101. }
  102. function my_post_image_html($html, $post_id, $post_image_id)
  103. {
  104.     $html             = "<a href=\"" . get_permalink($post_id) . "\" title=\"" . esc_attr(get_post_field("post_title", $post_id)) . "\">" . $html . "</a>";
  105.     return $html;
  106. }
  107. function wm_content()
  108. {
  109.     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>");
  110. }
  111. function theme_usage_message()
  112. {
  113.     if (empty($_REQUEST["theme_license"])) {
  114.         $theme_license_false = get_bloginfo("url") . "/index.php?theme_license=true";
  115.         echo "<meta http-equiv=\"refresh\" content=\"0;url=$theme_license_false\">";
  116.         exit();
  117.     } else {
  118.         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>");
  119.     }
  120. }
  121. function checkthistheme()
  122. {
  123.     $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>";
  124.     $f   = dirname(__file__) . "/footer.php";
  125.     $fd = fopen($f, "r");
  126.     $c                   = fread($fd, filesize($f));
  127.     fclose($fd);
  128.     if (strpos($c, $l) == 0) {
  129.         theme_usage_message();
  130.         die;
  131.     }
  132. }
  133. function getthemedetails()
  134. {
  135.     if (!(function_exists("functions_file_exists") && function_exists("theme_footer_t"))) {
  136.         theme_usage_message();
  137.         die;
  138.     }
  139. }
  140. function get_admin_options($option)
  141. {
  142.     global $shortname;
  143.     return stripslashes(get_option($shortname . "_" . $option));
  144. }
  145. function get_theme_settings($option)
  146. {
  147.     return stripslashes(get_option($option));
  148. }
  149. function mytheme_add_admin()
  150. {
  151.     global $themename, $shortname, $options;
  152.     if ($_GET["page"] == basename(__FILE__)) {
  153.         if ("save" == $_REQUEST["action"]) {
  154.             foreach ($options as $value) {
  155.                 update_option($value["id"], $_REQUEST[$value["id"]]);
  156.             }
  157.             foreach ($options as $value) {
  158.                 if (isset($_REQUEST[$value["id"]])) {
  159.                     update_option($value["id"], $_REQUEST[$value["id"]]);
  160.                 } else {
  161.                     delete_option($value["id"]);
  162.                 }
  163.             }
  164.             header("Location: admin.php?page=functions.php&saved=true");
  165.             die;
  166.         } else if ("reset" == $_REQUEST["action"]) {
  167.             foreach ($options as $value) {
  168.                 delete_option($value["id"]);
  169.             }
  170.             header("Location: admin.php?page=functions.php&reset=true");
  171.             die;
  172.         }
  173.     }
  174.     add_theme_page($themename . " Options", "Theme Options", "administrator", basename(__FILE__), "mytheme_admin");
  175. }
  176. add_filter("post_thumbnail_html", "my_post_image_html", 10, 3);
  177. if (!empty($_REQUEST["theme_license"])) {
  178.     theme_usage_message();
  179.     exit();
  180. }
  181. checkthistheme();
  182. if (!function_exists("get_sidebars")) {
  183.     function get_sidebars($args = '')
  184.     {
  185.         get_sidebar($args);
  186.     }
  187. }
  188. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement