# WP SUPER CACHE 1.2 function wpcache_broken_message() { if ( false == strpos( $_SERVER[ 'REQUEST_URI' ], 'wp-admin' ) ) echo ""; } if ( false == defined( 'WPCACHEHOME' ) ) { define( 'ADVANCEDCACHEPROBLEM', 1 ); } elseif ( !include_once( WPCACHEHOME . 'wp-cache-phase1.php' ) ) { if ( !@is_file( WPCACHEHOME . 'wp-cache-phase1.php' ) ) { define( 'ADVANCEDCACHEPROBLEM', 1 ); } } if ( defined( 'ADVANCEDCACHEPROBLEM' ) ) register_shutdown_function( 'wpcache_broken_message' ); ?> /* Plugin Name: Fotomoto Plugin URI: http://www.fotomoto.com Description: Fotomoto Plugin Version: 1.1.6 Author: Fotomoto Author URI: http://www.fotomoto.com/ */ define('FOTOMOTO_VERSION', '1.1.6'); if (!defined('WP_CONTENT_URL')) define('WP_CONTENT_URL', site_url().'/wp-content'); if (!defined('WP_CONTENT_DIR')) define('WP_CONTENT_DIR', ABSPATH.'wp-content'); if (!defined('WP_PLUGIN_URL')) define('WP_PLUGIN_URL', WP_CONTENT_URL.'/plugins'); if (!defined('WP_PLUGIN_DIR')) define('WP_PLUGIN_DIR', WP_CONTENT_DIR.'/plugins'); if (!defined('WP_FOTOMOTO_PLUGIN_URL')) define('WP_FOTOMOTO_PLUGIN_URL', WP_CONTENT_URL.'/plugins/fotomoto'); if (!defined('WP_FOTOMOTO_PLUGIN_DIR')) define('WP_FOTOMOTO_PLUGIN_DIR', WP_CONTENT_DIR.'/plugins/fotomoto'); if (!defined('WP_FOTOMOTO_PLUGIN_ADMIN_URL')) define('WP_FOTOMOTO_PLUGIN_ADMIN_URL', site_url().'/wp-admin/options-general.php?page=fotomoto'); define("FOTOMOTO_ENABLED", "enabled"); define("FOTOMOTO_DISABLED", "disabled"); define("FOTOMOTO_CATEGORY_META", "fotomoto_categorymeta"); define("FOTOMOTO_PRODUCTION_DOMAIN", "fotomoto.com"); global $wpdb; $wpdb->{FOTOMOTO_CATEGORY_META} = $wpdb->prefix . FOTOMOTO_CATEGORY_META; function fotomoto_wp_get_option() { if(is_multisite()) { global $blog_id; return get_blog_option($blog_id, 'fotomoto_options'); } else { return get_option('fotomoto_options'); } } function fotomoto_wp_update_option($options) { if(is_multisite()) { global $blog_id; update_blog_option($blog_id, 'fotomoto_options', $options); } else { update_option('fotomoto_options', $options); } } $fotomoto_options = fotomoto_wp_get_option(); function activate_fotomoto() { global $wpdb; add_option('fotomoto_options', fotomoto_default_options()); $table_name = $wpdb->prefix . FOTOMOTO_CATEGORY_META; if($wpdb->get_var("SHOW TABLES LIKE '$table_name'") != $table_name) { $sql = "CREATE TABLE " . $table_name . " ( `meta_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `fotomoto_category_id` bigint(20) unsigned NOT NULL DEFAULT '0', `meta_key` varchar(255) DEFAULT NULL, `meta_value` longtext, PRIMARY KEY (`meta_id`) );"; $wpdb->query($sql); } fotomoto_wp_update_option(fotomoto_default_options()); } function deactive_fotomoto() { global $wpdb; delete_option('fotomoto_options'); $table_name = $wpdb->prefix . FOTOMOTO_CATEGORY_META; $wpdb->query("DROP TABLE IF EXISTS $table_name"); } function admin_init_fotomoto() { register_setting('fotomoto', 'fotomoto_options'); } function admin_menu_fotomoto() { $page = add_options_page('Fotomoto', 'Fotomoto', 8, 'fotomoto', 'options_page_fotomoto'); add_action("admin_print_styles-$page", 'fotomoto_stylesheet', 1); add_action("admin_print_scripts-$page", 'fotomoto_headscripts'); } function fotomoto_update_category_meta($cat_id, $meta_key, $meta_value, $prev_value = '') { return update_metadata('fotomoto_category', $cat_id, $meta_key, $meta_value, $prev_value); } function fotomoto_get_category_meta($cat_id, $key, $single = false) { return get_metadata('fotomoto_category', $cat_id, $key, $single); } function fotomoto_get_site_key($email, $first_name, $last_name, $domain) { $url = "http://affiliate.".FOTOMOTO_PRODUCTION_DOMAIN."/osignup.json"; $params = array(); $params["api_key"] = fotomoto_get_option('api_key'); $params["affiliate_key"] = fotomoto_get_option('affiliate_key'); $params["email"] = $email; $params["first_name"] = $first_name; $params["last_name"] = $last_name; $params["domain"] = $domain; $params["alternate_sites"] = ""; if (fotomoto_get_option("use_default_pricing") != "") { $params["use_default_pricing"] = ""; } if (fotomoto_get_option("setup_auto_pickup") != "") { $params["setup_auto_pickup"] = ""; } $ch = curl_init($url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $params); curl_setopt($ch, CURLOPT_HEADER, 0); // DO NOT RETURN HTTP HEADERS curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // RETURN THE CONTENTS OF THE CALL $data = curl_exec($ch); return json_decode($data, true); } function options_page_fotomoto() { if ($_GET['act'] == "edit") { if (count($_POST) > 0) { if (trim($_POST["email"]) == "" || trim($_POST["first_name"]) == "" || trim($_POST["last_name"]) == "" || trim($_POST["domain"]) == "") { $message = "Email or First Name or Last Name or Domain cannot be blank."; } else { $response = fotomoto_get_site_key($_POST["email"], $_POST["first_name"], $_POST["last_name"], $_POST["domain"]); if ($response["status"] != 200) { $message = $response["error"]; } else { update_user_meta($_POST["user_id"], "fotomoto_site_key", $response["site_key"]); $message = "User is active now."; } } } include(WP_FOTOMOTO_PLUGIN_DIR.'/site_key.php'); return; } if ($_GET["act"] == "delete") { if (get_user_meta($_GET["user_id"], "fotomoto_site_key", true) != "") update_user_meta($_GET["user_id"], "old_fotomoto_site_key", get_user_meta($_GET["user_id"], "fotomoto_site_key", true)); // backup old key delete_user_meta($_GET["user_id"], "fotomoto_site_key"); // remove key $message = "User is inactive now."; include(WP_FOTOMOTO_PLUGIN_DIR.'/options.php'); return; } if ($_GET["act"] == "reactivate") { $old_site_key = get_user_meta($_GET["user_id"], "old_fotomoto_site_key", true); if ($old_site_key != "") { // having old site key update_user_meta($_GET["user_id"], "fotomoto_site_key", $old_site_key); $message = "User is active now."; include(WP_FOTOMOTO_PLUGIN_DIR.'/options.php'); return; } } if ($_POST["act"] == "update_page_status") { fotomoto_update_page_status($_POST["page_id"], $_POST["status"]); return; } if ($_POST["act"] == "update_category_status") { fotomoto_update_category_meta($_POST["category_id"], "fotomoto_enable_status", $_POST["status"]); return; } if ($_POST["act"] == "update_pages_status") { foreach ($_POST as $key=>$value) { if (!preg_match("/^page_status_/", $key)) continue; $page_id = str_replace("page_status_", "", $key); fotomoto_update_page_status($page_id, $value); } $message = "Page updated."; }; if ($_POST["act"] == "update_categories_status") { foreach ($_POST as $key=>$value) { if (!preg_match("/^category_status_/", $key)) continue; $category_id = str_replace("category_status_", "", $key); fotomoto_update_category_meta($category_id, "fotomoto_enable_status", $value); } $message = "Category updated."; }; if ($_POST["act"] == "activate_all") { $wp_user_search = new WP_User_Search(); foreach ($wp_user_search->get_results() as $user_id) { if (get_user_meta($user_id, "fotomoto_site_key", true) != "") continue; // already activated $old_site_key = get_user_meta($user_id, "old_fotomoto_site_key", true); if ($old_site_key != "") { // having old site key update_user_meta($user_id, "fotomoto_site_key", $old_site_key); } else { fotomoto_save_site_key($user_id); } } $message = "All users are activated."; }; if (count($_POST) > 0 && $_POST["act"] == null) { $validated = true; $message = ""; if (trim($_POST["store_key"]) != "" && strlen(trim($_POST["store_key"])) != 40) { $message .= "Site Key must be 40-characters long.
"; $validated = false; } if (trim($_POST["affiliate_key"]) != "" && strlen(trim($_POST["affiliate_key"])) != 16) { $message .= "Affiliate Key must be 16-character long.
"; $validated = false; } if (trim($_POST["api_key"]) != "" && strlen(trim($_POST["api_key"])) != 40) { $message .= "API Key must be 40-characters long.
"; $validated = false; } if (trim($_POST["affiliate_key"]) == "" || trim($_POST["api_key"]) == "") { $_POST["enable_multiuser"] = ""; } if ($validated) { fotomoto_save_options(); $message = "Settings updated."; } } include(WP_FOTOMOTO_PLUGIN_DIR.'/options.php'); } function fotomoto_update_page_status($page_id, $value) { if ($page_id == "home") { fotomoto_set_option("home_enabled", trim($value)); } else { update_post_meta($page_id, "fotomoto_enable_status", $value); } } function options_page_fotomoto_site_key() { if (count($_POST) > 0) { fotomoto_save_options(); $message = "Settings updated."; } include(WP_FOTOMOTO_PLUGIN_DIR.'/site_key.php'); } function fotomoto_page_enabled($page_id) { if ($page_id == "home") return (fotomoto_get_option("home_enabled") != FOTOMOTO_DISABLED); return (get_post_meta($page_id, "fotomoto_enable_status", true) != FOTOMOTO_DISABLED); } function fotomoto_category_enabled($category_id) { return (fotomoto_get_category_meta($category_id, "fotomoto_enable_status", true) != FOTOMOTO_DISABLED); } function fotomoto_default_options() { $default_options = array(); $default_options["store_key"] = ""; $default_options["api_mode"] = ""; $default_options["enable_multiuser"] = ""; $default_options["affiliate_key"] = ""; $default_options["api_key"] = ""; $default_options["home_enabled"] = ""; $default_options["use_default_pricing"] = ""; $default_options["setup_auto_pickup"] = ""; $default_options["activate_new_user"] = ""; return $default_options; } function fotomoto_set_option($option_name, $option_value) { $fotomoto_options = fotomoto_wp_get_option(); if (!$fotomoto_options) $fotomoto_options = fotomoto_default_options(); if (!array_key_exists($option_name, $fotomoto_options)) { $options = fotomoto_default_options(); $fotomoto_options[$option_name] = $options[$option_name]; } $fotomoto_options[$option_name] = $option_value; fotomoto_wp_update_option($fotomoto_options); } function fotomoto_get_option($option_name) { $fotomoto_options = fotomoto_wp_get_option(); if (!$fotomoto_options) $fotomoto_options = fotomoto_default_options(); if (!array_key_exists($option_name, $fotomoto_options)) { $options = fotomoto_default_options(); $fotomoto_options[$option_name] = $options[$option_name]; } return $fotomoto_options[$option_name]; } function fotomoto_save_options() { fotomoto_set_option("store_key", trim($_POST["store_key"])); fotomoto_set_option("api_mode", trim($_POST["api_mode"])); fotomoto_set_option("enable_multiuser", trim($_POST["enable_multiuser"])); fotomoto_set_option("affiliate_key", trim($_POST["affiliate_key"])); fotomoto_set_option("api_key", trim($_POST["api_key"])); fotomoto_set_option("use_default_pricing", trim($_POST["use_default_pricing"])); fotomoto_set_option("setup_auto_pickup", trim($_POST["setup_auto_pickup"])); fotomoto_set_option("activate_new_user", trim($_POST["activate_new_user"])); } function fotomoto_curPageURL() { $pageURL = 'http'; if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";} $pageURL .= "://"; if ($_SERVER["SERVER_PORT"] != "80") { $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"]; } else { $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; } return $pageURL; } function fotomoto_script($key, $ext="") { $url = "http://widget.".FOTOMOTO_PRODUCTION_DOMAIN."/stores/script/" . $key . ".js"; $has_ext = false; if ($ext != "") { $has_ext = true; $url .= "?ext=" . $ext; } if (fotomoto_get_option("api_mode") != "") { $url .= ($has_ext ? "&" : "?")."api=true"; } return $url; } function is_post_scripted($post) { if (get_post_meta($post->ID, "fotomoto_enable_status", true) == "") { // page enabled is not set, check category enabled foreach((get_the_category($post->ID)) as $category) { if (!fotomoto_category_enabled($category->cat_ID)) return false; // if there is a category disabled } } else { return fotomoto_page_enabled($post->ID); } return true; } function fotomoto_is_scripted() { wp_reset_query(); global $wp_query; $post = $wp_query->queried_object; if (fotomoto_get_option("store_key") == "") return false; if (is_front_page()) return fotomoto_page_enabled("home"); return is_post_scripted($post); } function fotomoto() { if (isset($_GET["fotomoto_debug"])) { ?> } if (!fotomoto_is_scripted()) return; ?> echo fotomoto_script(fotomoto_get_option('store_key'), $ext) ?>"> echo fotomoto_get_option('store_key') ?>" rel="external nofollow">sell my photos, powered by Fotomoto.

} function fotomoto_classes() { global $post; if (!is_post_scripted($post)) return "nofotomoto"; if (fotomoto_get_option("enable_multiuser") == "") return ""; if ($post) { $site_key = get_user_meta($post->post_author, "fotomoto_site_key", true); if (trim($site_key) != "") return "ftmt_id_$site_key"; } return "ftmt_idna nofotomoto"; } register_activation_hook(__FILE__, 'activate_fotomoto'); register_deactivation_hook(__FILE__, 'deactive_fotomoto'); if (is_admin()) { add_action('admin_init', 'admin_init_fotomoto'); add_action('admin_menu', 'admin_menu_fotomoto'); } function fotomoto_headscripts(){ wp_enqueue_script('jquery'); wp_enqueue_script('jquery-ui-core'); wp_enqueue_script('jquery-ui-tabs'); wp_register_script("fotomoto_admin_script", WP_FOTOMOTO_PLUGIN_URL.'/js/admin.js'); wp_enqueue_script('fotomoto_admin_script'); } function fotomoto_stylesheet() { wp_register_style("jquery_css", "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css"); wp_enqueue_style("jquery_css"); wp_register_style("fotomoto_admin_css", WP_FOTOMOTO_PLUGIN_URL.'/css/admin.css'); wp_enqueue_style("fotomoto_admin_css"); } function fotomoto_user_domain($user_login) { $domain = get_site_url(); $domain = str_replace("http://www.", "http://", $domain); $domain = str_replace("http://", "http://{$user_login}.", $domain); return $domain; } function fotomoto_save_site_key($user_id) { $user_object = new WP_User($user_id); if ($user_object->user_level >= 2) { // author level+ $email = $user_object->user_email; $first_name = ($user_object->first_name == "" ? $user_object->user_login : $user_object->first_name); $last_name = ($user_object->last_name == "" ? $user_object->user_login : $user_object->last_name); $domain = fotomoto_user_domain($user_object->user_login); $response = fotomoto_get_site_key($email, $first_name, $last_name, $domain); if ($response["status"] == 200) { update_user_meta($user_id, "fotomoto_site_key", $response["site_key"]); } } } function fotomoto_user_register($user_id) { if (fotomoto_get_option("activate_new_user") != "") { // automatically activate new user fotomoto_save_site_key($user_id); } } function fotomoto_image_tag_class($class){ $class .=' [ftmt_id]'; return $class; } add_filter('get_image_tag_class','fotomoto_image_tag_class'); add_shortcode('ftmt_id', 'fotomoto_classes'); if (!is_admin()) { add_action('wp_footer', 'fotomoto'); } add_action('user_register', 'fotomoto_user_register'); ?> /* Plugin Name: WordPress Hashcash Plugin URI: http://wordpress-plugins.feifei.us/hashcash/ Description: Client-side javascript blocks all spam bots. XHTML 1.1 compliant. Author: Elliott Back Author URI: http://elliottback.com Version: 4.6 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. */ function wphc_option($save = false){ if($save) { if( function_exists( 'update_site_option' ) ) { update_site_option('plugin_wp-hashcash', $save); } else { update_option('plugin_wp-hashcash', $save); } return $save; } else { if( function_exists( 'get_site_option' ) ) { $options = get_site_option('plugin_wp-hashcash'); } else { $options = get_option('plugin_wp-hashcash'); } if(!is_array($options)) $options = array(); return $options; } } /** * Install WP Hashcash */ function wphc_install () { // set our default options $options = wphc_option(); $options['comments-spam'] = $options['comments-spam'] || 0; $options['comments-ham'] = $options['comments-ham'] || 0; $options['signups-spam'] = $options['signups-spam'] || 0; $options['signups-ham'] = $options['signups-ham'] || 0; $options['key'] = array(); $options['key-date'] = 0; $options['refresh'] = 60 * 60 * 24 * 7; $options['signup_active'] = 1; $options['comments_active'] = 1; $options['attribution'] = 1; // akismet compat check if(function_exists('akismet_init')){ $options['moderation'] = 'akismet'; } else { $options['moderation'] = 'moderate'; } // validate ip / url $options['validate-ip'] = true; $options['validate-url'] = true; // logging $options['logging'] = true; // update the key wphc_option($options); wphc_refresh(); } add_action('activate_wp-hashcash/wp-hashcash.php', 'wphc_install'); add_action('activate_wp-hashcash.php', 'wphc_install'); /** * Update the key, if needed */ function wphc_refresh(){ $options = wphc_option(); if( !isset( $options[ 'signup_active' ] ) ) { wphc_install(); return; } if(time() - $options['key-date'] > $options['refresh']) { if(count($options['key']) >= 5) array_shift($options['key']); array_push($options['key'], rand(21474836, 2126008810)); $options['key-date'] = time(); wphc_option($options); } } add_action('shutdown', 'wphc_refresh'); /** * Our plugin can also have a widget */ function get_spam_ratio( $ham, $spam ) { if($spam + $ham == 0) $ratio = 0; else $ratio = round(100 * ($spam/($ham+$spam)),2); return $ratio; } function widget_ratio($options){ $signups_ham = (int)$options['signups-ham']; $signups_spam = (int)$options['signups-spam']; $ham = (int)$options['comments-ham']; $spam = (int)$options['comments-spam']; $ratio = get_spam_ratio( $ham, $spam ); $signups_ratio = get_spam_ratio( $signups_ham, $signups_spam ); $msg = "
  • $spam spam comments blocked out of $ham human comments. " . $ratio ."% of your comments are spam!
  • "; if( $signups_ham && $signups_spam ) $msg = "
  • $signups_spam spam signups blocked out of $signups_ham human signups. " . $signups_ratio ."% of your signups are spam!
  • "; return $msg; } /** * Admin Options */ add_action('admin_menu', 'wphc_add_options_to_admin'); function wphc_add_options_to_admin() { if( function_exists( 'is_site_admin' ) && !is_site_admin() ) return; if (function_exists('add_options_page')) { if( function_exists( 'is_site_admin' ) ) { add_submenu_page('wpmu-admin.php', __('WordPress Hashcash'), __('WordPress Hashcash'), 'manage_options', 'wphc_admin', 'wphc_admin_options'); } else { add_options_page('Wordpress Hashcash', 'Wordpress Hashcash', 8, basename(__FILE__), 'wphc_admin_options'); } } } function wphc_admin_options() { if( function_exists( 'is_site_admin' ) && !is_site_admin() ) return; $options = wphc_option(); if( !isset( $options[ 'signup_active' ] ) ) { wphc_install(); // MU has no activation hook $options = wphc_option(); } // POST HANDLER if($_POST['wphc-submit']){ check_admin_referer( 'wphc-options' ); if ( function_exists('current_user_can') && !current_user_can('manage_options') ) die('Current user not authorized to managed options'); $options['refresh'] = strip_tags(stripslashes($_POST['wphc-refresh'])); $options['moderation'] = strip_tags(stripslashes($_POST['wphc-moderation'])); $options['validate-ip'] = strip_tags(stripslashes($_POST['wphc-validate-ip'])); $options['validate-url'] = strip_tags(stripslashes($_POST['wphc-validate-url'])); $options['logging'] = strip_tags(stripslashes($_POST['wphc-logging'])); $options['signup_active'] = (int) $_POST['signup_active']; $options['comments_active'] = (int) $_POST['comments_active']; wphc_option($options); } // MAIN FORM echo ''; echo '
    '; echo ''; echo '
    '; echo '

    WordPress Hashcash

    '; echo '

    This is an antispam plugin that eradicates spam signups on WordPress sites. It works because your visitors must use obfuscated javascript to submit a proof-of-work that indicates they opened your website in a web browser, not a robot. You can read more about it on the WordPress Hashcash plugin page of my site.

    '; echo '

    Standard Options

    '; echo '
    '; wp_nonce_field('wphc-options'); if( function_exists( 'is_site_admin' ) ) { // MU only $signup_active = (int)$options[ 'signup_active' ]; $comments_active = (int)$options[ 'comments_active' ]; echo "

    "; echo "

    "; } // moderation options $moderate = htmlspecialchars($options['moderation'], ENT_QUOTES); echo '

    '; echo ''; echo '
    The default is to place spam comments into the akismet/moderation queue. Otherwise, the delete option will immediately discard spam comments.'; echo '

    '; // refresh interval $refresh = htmlspecialchars($options['refresh'], ENT_QUOTES); echo '


    Default is one week, or 604800 seconds.

    '; // current key echo '

    Your current key is ' . $options['key'][count($options['key']) - 1] . '.'; if(count($options['key']) > 1) echo ' Previously you had keys '. join(', ', array_reverse(array_slice($options['key'], 0, count($options['key']) - 1))).'.'; echo '

    '; // additional options echo '

    Additional options:

    '; $validate_ip = htmlspecialchars($options['validate-ip'], ENT_QUOTES); echo '


    Checks if the IP address of the trackback sender is equal to the IP address of the webserver the trackback URL is referring to.

    '; $validate_url = htmlspecialchars($options['validate-url'], ENT_QUOTES); echo '


    Retrieves the web page located at the URL included in the trackback to check if it contains a link to your blog. If it does not, it is spam!

    '; // logging options echo '

    Logging:

    '; $logging = htmlspecialchars($options['logging'], ENT_QUOTES); echo '


    Logs the reason why a given comment failed the spam check into the comment body. Works only if moderation / akismet mode is enabled.

    '; echo ''; echo ''; echo '
    '; echo '
    '; echo '
    '; echo '

    © Copyright '.date('Y').' Elliott Bäck

    '; echo '
    '; echo '
    '; } /** * Add JS to the header */ function wphc_posthead() { if( function_exists( 'is_site_admin' ) ) { $options = wphc_option(); if( !$options['comments_active'] ) return; } if((is_single() || is_page())) wphc_addhead(); } add_action('wp_head', 'wphc_posthead'); function wphc_signuphead() { if( function_exists( 'is_site_admin' ) ) { $options = wphc_option(); if( !$options['signup_active'] ) return; } wphc_addhead(); } add_action('signup_header', 'wphc_signuphead'); function wphc_addhead() { echo "\n"; } function wphc_getjs(){ $options = wphc_option(); $val = $options['key'][count($options['key']) - 1]; $js = 'function wphc_compute(){'; switch(rand(0, 3)){ /* Addition of n times of field value / n, + modulus: Time guarantee: 100 iterations or less */ case 0: $inc = rand($val / 100, $val - 1); $n = floor($val / $inc); $r = $val % $inc; $js .= "var wphc_eax = $inc; "; for($i = 0; $i < $n - 1; $i++){ $js .= "wphc_eax += $inc; "; } $js .= "wphc_eax += $r; "; $js .= 'return wphc_eax; '; break; /* Conversion from binary: Time guarantee: log(n) iterations or less */ case 1: $binval = strrev(base_convert($val, 10, 2)); $js .= "var wphc_eax = \"$binval\"; "; $js .= 'var wphc_ebx = 0; '; $js .= 'var wphc_ecx = 0; '; $js .= 'while(wphc_ecx < wphc_eax.length){ '; $js .= 'if(wphc_eax.charAt(wphc_ecx) == "1") { '; $js .= 'wphc_ebx += Math.pow(2, wphc_ecx); '; $js .= '} '; $js .= 'wphc_ecx++; '; $js .= '} '; $js .= 'return wphc_ebx;'; break; /* Multiplication of square roots: Time guarantee: constant time */ case 2: $sqrt = floor(sqrt($val)); $r = $val - ($sqrt * $sqrt); $js .= "return $sqrt * $sqrt + $r; "; break; /* Sum of random numbers to the final value: Time guarantee: log(n) expected value */ case 3: $js .= 'return '; $i = 0; while($val > 0){ if($i++ > 0) $js .= '+'; $temp = rand(1, $val); $val -= $temp; $js .= $temp; } $js .= ';'; break; } $js .= '} wphc_compute();'; // pack bytes if( !function_exists( 'strToLongs' ) ) { function strToLongs($s) { $l = array(); // pad $s to some multiple of 4 $s = preg_split('//', $s, -1, PREG_SPLIT_NO_EMPTY); while(count($s) % 4 != 0){ $s [] = ' '; } for ($i = 0; $i < ceil(count($s)/4); $i++) { $l[$i] = ord($s[$i*4]) + (ord($s[$i*4+1]) << 8) + (ord($s[$i*4+2]) << 16) + (ord($s[$i*4+3]) << 24); } return $l; } } // xor all the bytes with a random key $key = rand(21474836, 2126008810); $js = strToLongs($js); for($i = 0; $i < count($js); $i++){ $js[$i] = $js[$i] ^ $key; } // libs function encapsulation $libs = "function wphc(){\n"; // write bytes to javascript, xor with key $libs .= "\tvar wphc_data = [".join(',',$js)."]; \n"; // do the xor with key $libs .= "\n\tfor (var i=0; i'; } add_action('signup_hidden_fields', 'wphc_add_signupform'); add_action('bp_after_registration_submit_buttons', 'wphc_add_signupform'); function wphc_add_commentform(){ $options = wphc_option(); switch($options['moderation']){ case 'delete': $verb = 'deleted'; break; case 'akismet': $verb = 'queued in Akismet'; break; case 'moderate': default: $verb = 'placed in moderation'; break; } echo '
    '; echo ''; } add_action('comment_form', 'wphc_add_commentform'); /** * Validate our tag */ function wphc_check_signup_hidden_tag( $result ) { // get our options $options = wphc_option(); $spam = false; if( !strpos( $_SERVER[ 'PHP_SELF' ], 'wp-signup.php' ) ) return $result; // Check the wphc values against the last five keys $spam = !in_array($_POST["wphc_value"], $options['key']); if($spam){ $options['signups-spam'] = ((int) $options['signups-spam']) + 1; wphc_option($options); $result['errors']->add( 'blogname', __('You did not pass a spam check. Please enable JavaScript in your browser.') ); } else { $options['signups-ham'] = ((int) $options['signups-ham']) + 1; wphc_option($options); } return $result; } add_filter( 'wpmu_validate_blog_signup', 'wphc_check_signup_hidden_tag' ); add_filter( 'wpmu_validate_user_signup', 'wphc_check_signup_hidden_tag' ); function wphc_check_signup_for_bp(){ global $bp; // get our options $options = wphc_option(); $spam = false; // Check the wphc values against the last five keys $spam = !in_array($_POST["wphc_value"], $options['key']); if($spam){ $options['signups-spam'] = ((int) $options['signups-spam']) + 1; wphc_option($options); $bp->signup->errors['spam'] = __('You did not pass a spam check. Please enable JavaScript in your browser.'); } else { $options['signups-ham'] = ((int) $options['signups-ham']) + 1; wphc_option($options); } } add_action('bp_signup_validate', 'wphc_check_signup_for_bp'); function wphc_error_hook_register_page(){ do_action('bp_spam_errors'); } add_action('bp_before_register_page', 'wphc_error_hook_register_page'); function wphc_check_hidden_tag($comment) { // admins can do what they like if( is_admin() ) return $comment; // get our options $type = $comment['comment_type']; $options = wphc_option(); $spam = false; if($type == "trackback" || $type == "pingback"){ // check the website's IP against the url it's sending as a trackback if($options['validate-ip']){ $server_ip = isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR']; $web_ip = gethostbyname(parse_url($comment['comment_author_url'], PHP_URL_HOST)); $ipv = $server_ip != $web_ip; $spam = $spam || ($ipv); if($options['logging'] && $ipv) $comment['comment_content'] .= "\n\n[WORDPRESS HASHCASH] The comment's server IP (".$server_ip.") doesn't match the" . " comment's URL host IP (".$web_ip.") and so is spam."; } // look for our link in the page itself if(!$spam && $options['validate-url']){ if(!class_exists('Snoopy')) require_once( ABSPATH . WPINC . '/class-snoopy.php' ); $permalink = get_permalink($comment['comment_post_ID']); $permalink = preg_replace('/\/$/', '', $permalink); $snoop = new Snoopy; if (@$snoop->fetchlinks($comment['comment_author_url'])){ $found = false; if( !empty( $snoop->results ) ) { foreach($snoop->results as $url){ $url = preg_replace('/(\/|\/trackback|\/trackback\/)$/', '', $url); if($url == $permalink) $found = true; } } if($options['logging'] && !$found) $comment['comment_content'] .= "\n\n[WORDPRESS HASHCASH] The comment's actual post text did not contain your blog url (".$permalink.") and so is spam."; $spam = $spam || !$found; } else { $spam = true; if($options['logging']) $comment['comment_content'] .= "\n\n[WORDPRESS HASHCASH] Snoopy failed to fetch results for the comment blog url (".$comment['comment_author_url'].") with error '".$snoop->error."' and so is spam."; } } } else { // Check the wphc values against the last five keys $spam = !in_array($_POST["wphc_value"], $options['key']); if($options['logging'] && $spam) $comment['comment_content'] .= "\n\n[WORDPRESS HASHCASH] The poster sent us '".intval($_POST["wphc_value"])." which is not a hashcash value."; } if($spam){ $options['comments-spam'] = ((int) $options['comments-spam']) + 1; wphc_option($options); switch($options['moderation']){ case 'delete': add_filter('comment_post', create_function('$id', 'wp_delete_comment($id); die(\'This comment has been deleted by WP Hashcash\');')); break; case 'akismet': add_filter('pre_comment_approved', create_function('$a', 'return \'spam\';')); break; case 'moderate': default: add_filter('pre_comment_approved', create_function('$a', 'return 0;')); break; } } else { $options['comments-ham'] = ((int) $options['comments-ham']) + 1; wphc_option($options); } return $comment; } add_filter('preprocess_comment', 'wphc_check_hidden_tag'); ?> /* WP-Cache Config Sample File See wp-cache.php for author details. */ $wp_cache_mobile_groups = ''; //Added by WP-Cache Manager $wp_cache_mobile_prefixes = 'w3c , w3c-, acs-, alav, alca, amoi, audi, avan, benq, bird, blac, blaz, brew, cell, cldc, cmd-, dang, doco, eric, hipt, htc_, inno, ipaq, ipod, jigs, kddi, keji, leno, lg-c, lg-d, lg-g, lge-, lg/u, maui, maxo, midp, mits, mmef, mobi, mot-, moto, mwbp, nec-, newt, noki, palm, pana, pant, phil, play, port, prox, qwap, sage, sams, sany, sch-, sec-, send, seri, sgh-, shar, sie-, siem, smal, smar, sony, sph-, symb, t-mo, teli, tim-, tosh, tsm-, upg1, upsi, vk-v, voda, wap-, wapa, wapi, wapp, wapr, webc, winw, winw, xda , xda-'; //Added by WP-Cache Manager $wp_cache_refresh_single_only = '0'; //Added by WP-Cache Manager $wp_cache_make_known_anon = 0; //Added by WP-Cache Manager $wp_cache_mod_rewrite = 0; //Added by WP-Cache Manager $wp_cache_front_page_checks = 0; //Added by WP-Cache Manager $wp_cache_mfunc_enabled = 0; //Added by WP-Cache Manager $wp_supercache_304 = 0; //Added by WP-Cache Manager $wp_cache_no_cache_for_get = 0; //Added by WP-Cache Manager $wp_cache_disable_utf8 = 0; //Added by WP-Cache Manager $cache_time_interval = '600'; //Added by WP-Cache Manager $cache_schedule_type = 'interval'; //Added by WP-Cache Manager $cache_page_secret = 'c00142b1af3bfc1d3fddbd8ddcfe96bc'; //Added by WP-Cache Manager $wp_cache_slash_check = 1; //Added by WP-Cache Manager if ( ! defined('WPCACHEHOME') ) define( 'WPCACHEHOME', WP_CONTENT_DIR . "/plugins/wp-super-cache/" ); //Added by WP-Cache Manager $cache_compression = 0; // Super cache compression $cache_enabled = true; //Added by WP-Cache Manager $super_cache_enabled = true; //Added by WP-Cache Manager $cache_max_time = '1800'; //Added by WP-Cache Manager //$use_flock = true; // Set it true or false if you know what to use $cache_path = WP_CONTENT_DIR . '/cache/'; $file_prefix = 'wp-cache-'; $ossdlcdn = 0; // Array of files that have 'wp-' but should still be cached $cache_acceptable_files = array( 'wp-comments-popup.php', 'wp-links-opml.php', 'wp-locations.php' ); $cache_rejected_uri = array('wp-.*\\.php', 'index\\.php'); $cache_rejected_user_agent = array ( 0 => 'bot', 1 => 'ia_archive', 2 => 'slurp', 3 => 'crawl', 4 => 'spider', 5 => 'Yandex' ); $cache_rebuild_files = 1; //Added by WP-Cache Manager // Disable the file locking system. // If you are experiencing problems with clearing or creating cache files // uncommenting this may help. $wp_cache_mutex_disabled = 1; //Added by WP-Cache Manager // Just modify it if you have conflicts with semaphores $sem_id = 386905760; //Added by WP-Cache Manager if ( '/' != substr($cache_path, -1)) { $cache_path .= '/'; } $wp_cache_mobile = 0; $wp_cache_mobile_whitelist = 'Stand Alone/QNws'; $wp_cache_mobile_browsers = '2.0 MMP, 240x320, 400X240, AvantGo, BlackBerry, Blazer, Cellphone, Danger, DoCoMo, Elaine/3.0, EudoraWeb, Googlebot-Mobile, hiptop, IEMobile, KYOCERA/WX310K, LG/U990, MIDP-2., MMEF20, MOT-V, NetFront, Newt, Nintendo Wii, Nitro, Nokia, Opera Mini, Palm, PlayStation Portable, portalmmm, Proxinet, ProxiNet, SHARP-TQ-GX10, SHG-i900, Small, SonyEricsson, Symbian OS, SymbianOS, TS21i-10, UP.Browser, UP.Link, webOS, Windows CE, WinWAP, YahooSeeker/M1A1-R2D2, iPhone, iPod, Android, BlackBerry9530, LG-TU915 Obigo, LGE VX, webOS, Nokia5800'; //Added by WP-Cache Manager // change to relocate the supercache plugins directory $wp_cache_plugins_dir = WPCACHEHOME . 'plugins'; // set to 1 to do garbage collection during normal process shutdown instead of wp-cron $wp_cache_shutdown_gc = 0; $wp_super_cache_late_init = 0; //Added by WP-Cache Manager // uncomment the next line to enable advanced debugging features $wp_super_cache_advanced_debug = 0; $wp_super_cache_front_page_text = ''; $wp_super_cache_front_page_clear = 0; $wp_super_cache_front_page_check = 0; $wp_super_cache_front_page_notification = '0'; $wp_cache_object_cache = 0; //Added by WP-Cache Manager $wp_cache_anon_only = 0; $wp_supercache_cache_list = 0; //Added by WP-Cache Manager $wp_cache_debug_to_file = 0; $wp_super_cache_debug = 0; $wp_cache_debug_level = 5; $wp_cache_debug_ip = ''; $wp_cache_debug_log = ''; $wp_cache_debug_email = ''; $wp_cache_pages[ "search" ] = 0; $wp_cache_pages[ "feed" ] = 0; $wp_cache_pages[ "category" ] = 0; $wp_cache_pages[ "home" ] = 0; $wp_cache_pages[ "frontpage" ] = 0; $wp_cache_pages[ "tag" ] = 0; $wp_cache_pages[ "archives" ] = 0; $wp_cache_pages[ "pages" ] = 0; $wp_cache_pages[ "single" ] = 0; $wp_cache_pages[ "author" ] = 0; $wp_cache_hide_donation = 0; $wp_cache_not_logged_in = 0; //Added by WP-Cache Manager $wp_cache_clear_on_post_edit = 0; //Added by WP-Cache Manager $wp_cache_hello_world = 0; //Added by WP-Cache Manager $wp_cache_mobile_enabled = 1; //Added by WP-Cache Manager $wp_cache_cron_check = 0; ?> $known_headers = array("Last-Modified", "Expires", "Content-Type", "Content-type", "X-Pingback", "ETag", "Cache-Control", "Pragma"); if (!class_exists('CacheMeta')) { class CacheMeta { var $dynamic = false; var $headers = array(); var $uri = ''; var $post = 0; } } $WPSC_HTTP_HOST = htmlentities( $_SERVER[ 'HTTP_HOST' ] ); // We want to be able to identify each blog in a WordPress MU install $blogcacheid = ''; if ( defined( 'VHOST' ) || ( defined( 'WP_ALLOW_MULTISITE' ) && constant( 'WP_ALLOW_MULTISITE' ) == true ) ) { $blogcacheid = 'blog'; // main blog if( defined( 'SUBDOMAIN_INSTALL' ) && constant( 'SUBDOMAIN_INSTALL' ) == true ) { $blogcacheid = $WPSC_HTTP_HOST; } else { if ( isset( $base ) == false ) $base = ''; $request_uri = preg_replace('/[ <>\'\"\r\n\t\(\)]/', '', str_replace( '..', '', $_SERVER['REQUEST_URI'] ) ); if( strpos( $request_uri, '/', 1 ) ) { if( $base == '/' ) { $blogcacheid = substr( $request_uri, 1, strpos( $request_uri, '/', 1 ) - 1 ); } else { $blogcacheid = str_replace( $base, '', $request_uri ); if ( $blogcacheid != '' ) $blogcacheid = substr( $blogcacheid, 0, strpos( $blogcacheid, '/', 1 ) ); } if ( '/' == substr($blogcacheid, -1)) $blogcacheid = substr($blogcacheid, 0, -1); } $blogcacheid = str_replace( '/', '', $blogcacheid ); } } ?> /* Taken from OSSDL CDN off-linker, a plugin by W-Mark Kubacki (http://mark.ossdl.de/) and used with permission */ /* Set up some defaults */ if ( get_option( 'ossdl_off_cdn_url' ) == false ) add_option('ossdl_off_cdn_url', get_option('siteurl')); $ossdl_off_blog_url = get_option('siteurl'); $ossdl_off_cdn_url = trim( get_option('ossdl_off_cdn_url') ); if ( get_option( 'ossdl_off_include_dirs' ) == false ) add_option('ossdl_off_include_dirs', 'wp-content,wp-includes'); $ossdl_off_include_dirs = trim(get_option('ossdl_off_include_dirs')); if ( get_option( 'ossdl_off_exclude' ) == false ) add_option('ossdl_off_exclude', '.php'); $ossdl_off_exclude = trim(get_option('ossdl_off_exclude')); $arr_of_excludes = array_map('trim', explode(',', $ossdl_off_exclude)); if ( !is_array( $arr_of_excludes ) ) $arr_of_excludes = array(); if ( get_option( 'ossdl_cname' ) == false ) add_option('ossdl_cname', ''); $ossdl_cname = trim(get_option('ossdl_cname')); $ossdl_https = trim(get_option('ossdl_https')); $arr_of_cnames = array_map('trim', explode(',', $ossdl_cname)); if ($arr_of_cnames[0] == '') $arr_of_cnames = array(); /** * Determines whether to exclude a match. * * @param String $match URI to examine * @param Array $excludes array of "badwords" * @return Boolean true if to exclude given match from rewriting */ function scossdl_off_exclude_match($match, $excludes) { foreach ($excludes as $badword) { if (stristr($match, $badword) != false) { return true; } } return false; } /** * Compute string modulo, based on SHA1 hash */ function scossdl_string_mod($s, $mod) { /* The full SHA1 is too large for PHP integer types. This should be * enough for our purpose */ $n = hexdec(substr(sha1($s), 0, 5)); return $n % $mod; } /** * Rewriter of URLs, used as replace-callback. * * Called by #scossdl_off_filter. */ function scossdl_off_rewriter($match) { global $ossdl_off_blog_url, $ossdl_off_cdn_url, $arr_of_excludes, $arr_of_cnames, $ossdl_https; if ( $ossdl_off_cdn_url == '' ) return $match[0]; if ( $ossdl_https && substr( $match[0], 0, 5 ) == 'https' ) return $match[0]; if ( false == in_array( $ossdl_off_cdn_url, $arr_of_cnames ) ) $arr_of_cnames[] = $ossdl_off_cdn_url; if ( scossdl_off_exclude_match( $match[0], $arr_of_excludes ) ) { return $match[0]; } else { $include_dirs = scossdl_off_additional_directories(); if ( preg_match( '/' . $include_dirs . '/', $match[0] ) ) { $offset = scossdl_string_mod($match[1], count($arr_of_cnames)); return str_replace($ossdl_off_blog_url, $arr_of_cnames[$offset], $match[0]); } else { return $match[0]; } } } /** * Creates a regexp compatible pattern from the directories to be included in matching. * * @return String with the pattern with {@literal |} as prefix, or empty */ function scossdl_off_additional_directories() { global $ossdl_off_include_dirs; $input = explode(',', $ossdl_off_include_dirs); if ($ossdl_off_include_dirs == '' || count($input) < 1) { return 'wp\-content|wp\-includes'; } else { return implode('|', array_map('quotemeta', array_map('trim', $input))); } } /** * Output filter which runs the actual plugin logic. */ function scossdl_off_filter($content) { global $ossdl_off_blog_url, $ossdl_off_cdn_url; if ($ossdl_off_blog_url == $ossdl_off_cdn_url) { // no rewrite needed return $content; } else { $dirs = scossdl_off_additional_directories(); $regex = '#(?<=[(\"\'])'.quotemeta($ossdl_off_blog_url).'/(?:((?:'.$dirs.')[^\"\')]+)|([^/\"\']+\.[^/\"\')]+))(?=[\"\')])#'; return preg_replace_callback($regex, 'scossdl_off_rewriter', $content); } } /** * Registers scossdl_off_filter as output buffer, if needed. */ function do_scossdl_off_ob_start() { global $ossdl_off_blog_url, $ossdl_off_cdn_url; if ($ossdl_off_blog_url != $ossdl_off_cdn_url) { add_filter( 'wp_cache_ob_callback_filter', 'scossdl_off_filter' ); } } if ( false == isset( $ossdlcdn ) ) $ossdlcdn = 1; // have to default to on for existing users. if ( $ossdlcdn == 1 ) add_action('init', 'do_scossdl_off_ob_start'); function scossdl_off_options() { global $ossdlcdn, $wp_cache_config_file; $valid_nonce = isset($_REQUEST['_wpnonce']) ? wp_verify_nonce($_REQUEST['_wpnonce'], 'wp-cache') : false; if ( $valid_nonce && isset($_POST['action']) && ( $_POST['action'] == 'update_ossdl_off' )){ update_option('ossdl_off_cdn_url', $_POST['ossdl_off_cdn_url']); update_option('ossdl_off_include_dirs', $_POST['ossdl_off_include_dirs'] == '' ? 'wp-content,wp-includes' : $_POST['ossdl_off_include_dirs']); update_option('ossdl_off_exclude', $_POST['ossdl_off_exclude']); update_option('ossdl_cname', $_POST['ossdl_cname']); update_option('ossdl_https', (int)$_POST['ossdl_https']); if ( isset( $_POST[ 'ossdlcdn' ] ) ) { $ossdlcdn = 1; } else { $ossdlcdn = 0; } wp_cache_replace_line('^ *\$ossdlcdn', "\$ossdlcdn = $ossdlcdn;", $wp_cache_config_file); } $example_cdn_uri = str_replace( 'http://', 'http://cdn.', str_replace( 'www.', '', get_option( 'siteurl' ) ) ); $example_cnames = str_replace( 'http://cdn.', 'http://cdn1.', $example_cdn_uri ); $example_cnames .= ',' . str_replace( 'http://cdn.', 'http://cdn2.', $example_cdn_uri ); $example_cnames .= ',' . str_replace( 'http://cdn.', 'http://cdn3.', $example_cdn_uri ); $example_cdn_uri = get_option('ossdl_off_cdn_url') == get_option('siteurl') ? $example_cdn_uri : get_option('ossdl_off_cdn_url'); $example_cdn_uri .= '/wp-includes/js/prototype.js'; ?> _e( 'Your website probably uses lots of static files. Image, Javascript and CSS files are usually static files that could just as easily be served from another site or CDN. Therefore this plugin replaces any links in the wp-content and wp-includes directories (except for PHP files) on your site with the URL you provide below. That way you can either copy all the static content to a dedicated host or mirror the files to a CDN by origin pull.', 'wp-super-cache' ); ?>

    printf( __( 'The CDN Sync Tool plugin will help upload files to Amazon S3/Cloudfront if you would rather not depend on origin pull. See the plugin support forum if you have any queries about this plugin.', 'wp-super-cache' ), 'http://wordpress.org/extend/plugins/cdn-sync-tool/', 'http://wordpress.org/tags/cdn-sync-tool?forum_id=10' ); ?>

    printf( __( 'WARNING: Test some static urls e.g., %s to ensure your CDN service is fully working before saving changes.', 'wp-super-cache' ), '' . $example_cdn_uri . '' ); ?>

    _e( 'You can define different CDN URLs for each site on a multsite network.', 'wp-super-cache' ); ?>

    wp_nonce_field('wp-cache'); ?> _e( 'Enable CDN Support', 'wp-super-cache' ); ?> _e( 'Off-site URL', 'wp-super-cache' ); ?> _e( 'Include directories', 'wp-super-cache' ); ?> _e( 'Exclude if substring', 'wp-super-cache' ); ?> _e( 'Additional CNAMES', 'wp-super-cache' ); ?> _e( 'Skip https URLs to avoid "mixed content" errors', 'wp-super-cache' ); ?>
    if ( $ossdlcdn ) echo "checked=1"; ?> />
    ?>" size="64" class="regular-text code" />
    printf( __( 'The new URL to be used in place of %1$s for rewriting. No trailing / please.
    Example: %2$s.', 'wp-super-cache' ), get_option( 'siteurl' ), $example_cdn_uri ); ?>
    echo esc_attr( get_option( 'ossdl_off_include_dirs' ) ); ?>" size="64" class="regular-text code" />
    _e( 'Directories to include in static file matching. Use a comma as the delimiter. Default is wp-content, wp-includes, which will be enforced if this field is left empty.', 'wp-super-cache' ); ?>
    echo esc_attr( get_option( 'ossdl_off_exclude' ) ); ?>" size="64" class="regular-text code" />
    _e( 'Excludes something from being rewritten if one of the above strings is found in the match. Use a comma as the delimiter like this, .php, .flv, .do, and always include .php (default).', 'wp-super-cache' ); ?>
    echo esc_attr( get_option( 'ossdl_cname' ) ); ?>" size="64" class="regular-text code" />
    printf( __( 'These CNAMES will be used in place of %1$s for rewriting (in addition to the off-site URL above). Use a comma as the delimiter. For pages with a large number of static files, this can improve browser performance. CNAMEs may also need to be configured on your CDN.
    Example: %2$s', 'wp-super-cache' ), get_option( 'siteurl' ), $example_cnames ); ?>
    _e('Save Changes') ?>" />

    _e( 'CDN functionality provided by OSSDL CDN Off Linker by Mark Kubacki', 'wp-super-cache' ); ?>

    } ?> // Load Theme Options $gpp = get_option( 'gpp_options' ); // Start Theme Functions - Please don't edit this $functions_path = TEMPLATEPATH . '/functions/'; $includes_path = TEMPLATEPATH . '/includes/'; //Internationalization load_theme_textdomain("gpp_i18n", TEMPLATEPATH . '/lang'); // Add Theme Support if ( function_exists( 'add_theme_support' ) ) { // Add Post Thumbnail Support add_theme_support( 'post-thumbnails' ); set_post_thumbnail_size( 240, 240, true ); // 240x240 size add_image_size( '240x160', 240, 160, true ); // 240x160 image size add_image_size( '760x200', 760, 200, true ); // 760x200 image size add_image_size( '760', 760, 9999 ); // 760 image size add_image_size( '1600', 1600, 9999 ); // 1600 image size // Add Nav Menu Support add_theme_support( 'nav-menus' ); // Register our predefined menu positions add_action( 'init', 'register_gpp_menus' ); function register_gpp_menus() { register_nav_menus( array( 'main-menu' => __( 'Main Menu' ) ) ); } } // Make Menu Support compatible with earlier WP versions function gpp_theme_nav() { if ( function_exists( 'wp_nav_menu' ) ) wp_nav_menu( 'sort_column=menu_order&menu_class=menu sf-vertical&menu_location=main-menu&fallback_cb=gpptheme_nav_fallback' ); else gpptheme_nav_fallback(); } // Create our GPP Fallback Menu function gpptheme_nav_fallback() { wp_page_menu( 'depth=1&show_home=Start&menu_class=menu sf-vertical' ); } // Options panel variables and functions require_once ($functions_path . 'admin-setup.php'); // Admin Interface require_once ($functions_path . 'admin-interface.php'); // More Themes Page require_once ($functions_path . 'admin-theme-page.php'); // Videos Page require_once ($functions_path . 'admin-videos-page.php'); // Update Alerts Page require_once ($functions_path . 'admin-update-alerts.php'); // Options panel settings require_once ($includes_path . 'theme-options.php'); // More Themes Page require_once ($functions_path . 'admin-theme-page.php'); // Load Post Template require_once ($includes_path . 'post-template.php'); // Load Post Images require_once ($includes_path . 'images.php'); // Custom Comments require_once ($includes_path . 'theme-comments.php'); // Load Javascript require_once ($includes_path . 'theme-js.php'); // Load App Stylesheets require_once ($includes_path . 'theme-css.php'); // Widgets require_once ($includes_path . 'widgets.php'); // Load PhotoShelter Meta require_once ($includes_path . 'photoshelter-meta.php'); // Load Google Fonts require_once ($includes_path . 'google-fonts.php'); add_action('wp_head', 'gppthemes_wp_head'); add_action('admin_menu', 'gppthemes_add_admin'); add_action('admin_head', 'gppthemes_admin_head'); ?> get_header(); ?> $homepage_design = $gpp['gpp_homepage_design']; if ( $homepage_design == 'slideshow' || $homepage_design == '') { ?> $slideshow_menu = $gpp['gpp_slideshow_menu']; $imgcount = 0; echo '
    '; echo ''; echo '
    '; ?> } elseif ( $homepage_design == 'featured' ) { ?>
    $iphone = $gpp['gpp_iphone']; $iphone_file = $gpp['gpp_iphone_file']; $iphone_image = $gpp['gpp_iphone_image']; $featured_category_ID = $gpp['gpp_featured_cat']; $featured_category = get_cat_name($featured_category_ID); if($featured_category_ID=="0") {$featured_category = __('Latest','gpp_i18n');} $featured_category_number = $gpp['gpp_featured_number']; $excerpt = $gpp['gpp_excerpt']; $meta = $gpp['gpp_meta']; ?> if($gpp['gpp_welcome']!=='') { echo '

    '; echo stripslashes( $gpp['gpp_welcome'] ); echo '

    '; } ?> if($gpp['gpp_embed']!=='') { echo '
    '; echo stripslashes( $gpp['gpp_embed'] ); echo '
    '; } ?> if ($gpp['gpp_iphone'] =='true' && ($iphone_file!="") && ($iphone_image!="") ) { ?> } ?> echo "$featured_category"; ?> $featured = 0; $featured_query = new WP_Query("cat=$featured_category_ID&showposts=$featured_category_number"); while ($featured_query->have_posts()) : $featured_query->the_post(); $do_not_duplicate = $post->ID; $featured++; ?> } ?>"> } ?>"> the_category(' + '); ?>
    if ( $meta == 'show' || $meta == '' ) { ?> ?>

    } ?> if ( $excerpt == 'show' || $excerpt == '' ) { ?> the_excerpt(); ?> } ?> } ?> endwhile; wp_reset_query(); ?> } // end featured content ?> if ( $homepage_design == 'slideshow' || $homepage_design == '' ) { get_footer('slideshow'); } else { get_footer(); } ?>