$category) { $catvalue .= $key . ': ' . $category . "\n"; } $tagsvalue = ''; foreach (get_option('catheaders_tags') as $key => $tag) { $tagsvalue .= $key . ': ' . $tag . "\n"; } $defaultheadervalue = get_option('catheaders_defaultheader'); } ?>

Category Image Headers

Categories
Tags
Default header:

prefix . "highlightunreadcomments"; register_activation_hook(__FILE__, 'HighlightUnreadComments_PluginActivated'); register_deactivation_hook(__FILE__, 'HighlightUnreadComments_PluginDeactivated'); function HighlightUnreadComments_PluginActivated() { global $wpdb; update_option('hlunreadcomments_enabled', true); // This assignment is necessary!! You ask why? Try removing it, and shit won't work (even if $table_hlunreadcomments is declared global)! $table_hlunreadcomments = $wpdb->prefix . "highlightunreadcomments"; $hlunreadcomments_db_version = '1.0'; $installedver = get_option('hlunreadcomments_db_version'); if ($wpdb->get_var("SHOW TABLES LIKE '$table_hlunreadcomments'") != $table_hlunreadcomments || ($installedver === false || $installedver != $hlunreadcomments_db_version)) { $sql = "CREATE TABLE $table_hlunreadcomments ( userid BIGINT(20) unsigned NOT NULL, postid BIGINT(20) unsigned NOT NULL, lastread INT unsigned NOT NULL, PRIMARY KEY userpost (userid, postid) ) CHARACTER SET utf8 COLLATE utf8_general_ci;"; require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); dbDelta($sql); update_option('hlunreadcomments_db_version', $hlunreadcomments_db_version); } } function HighlightUnreadComments_PluginDeactivated() { update_option('hlunreadcomments_enabled', false); } function HighlightUnreadComments_PostRead($content) { global $wp_query, $wpdb, $query_vars, $hlunreadcomments_lastread, $global_matchid; if (!is_user_logged_in()) return $content; if (is_single() || isset($global_matchid)) { $user = wp_get_current_user(); $userid = $user->ID; $postid = $wp_query->post->ID; $time = time(); $hlunreadcomments_lastread = HighlightUnreadComments_DB_GetLastRead($userid, $postid); HighlightUnreadComments_DB_SetLastRead($userid, $postid, $time); } return $content; } function HighlightUnreadComments_CommentClass($classes = array()) { global $comment, $hlunreadcomments_lastread; if (!is_user_logged_in()) return $classes; $postid = $comment->comment_post_ID; $comment_time = strtotime($comment->comment_date); if (isset($hlunreadcomments_lastread)) { if ($comment_time > $hlunreadcomments_lastread) { $classes[] = 'unread'; } } return $classes; } function HighlightUnreadComments_NumberOfComments($num_total_comments, $add_unread = false) { global $post, $wpdb; // If 0 comments, display 0. // If not on front page, display the original number. // If the theme requests not to show the number of unread comments, then don't. // If the user is not logged in, display the original number. if ($num_total_comments == 0 || /*!is_home() ||*/ !$add_unread || !is_user_logged_in()) return $num_total_comments; $user = wp_get_current_user(); $userid = $user->ID; $postid = $post->ID; $lastread = HighlightUnreadComments_DB_GetLastRead($userid, $postid); if ($lastread === false) $num_new_comments = "★"; else { $num_new_comments = intval($wpdb->get_var($wpdb->prepare(" SELECT COUNT(*) FROM {$wpdb->prefix}comments WHERE comment_post_ID = %d AND UNIX_TIMESTAMP(comment_date) > %d AND comment_approved = 1 ", $postid, $lastread))); } if ($num_new_comments === 0) return $num_total_comments; else return $num_new_comments . "/" . $num_total_comments; } ?>prefix . "steamlogin"; function SteamLogin_Plugin_Activated() { global $wpdb, $wp_roles; //, $table_steamlogin; $wp_roles->add_cap('administrator', 'change_displayname'); update_option('steamlogin_enabled', true); save_mod_rewrite_rules(); // This assignment is necessary!! You ask why? Try removing it, and shit won't work (even if $table_steamlogin is declared global)! $table_steamlogin = $wpdb->prefix . "steamlogin"; $steamlogin_db_version = '1.0'; $installedver = get_option('steamlogin_db_version'); if ($wpdb->get_var("SHOW TABLES LIKE '$table_steamlogin'") != $table_steamlogin || ($installedver === false || $installedver != $steamlogin_db_version)) { $sql = "CREATE TABLE $table_steamlogin ( steamid VARCHAR(64) NOT NULL, userid bigint(20) DEFAULT NULL, secretkey VARCHAR(64) DEFAULT NULL, secretkeyexpire DATETIME DEFAULT NULL, PRIMARY KEY steamid (steamid), UNIQUE KEY userid (userid) ) CHARACTER SET utf8 COLLATE utf8_general_ci;"; require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); dbDelta($sql); update_option('steamlogin_db_version', $steamlogin_db_version); } } function SteamLogin_Plugin_Deactivated() { update_option('steamlogin_enabled', false); save_mod_rewrite_rules(); } function SteamLogin_SiteUrl($url, $path, $orig_scheme) { if (!get_option('steamlogin_enabled')) return $url; global $pagenow; if ('wp-login.php' != $pagenow && strpos($url, 'wp-login.php') !== false /*&& !isset($_REQUEST['interim-login'])*/) { $parsed_url = parse_url($url); $url = site_url('/wp-content/plugins/steam-login/login.php'); if ('https' == strtolower($orig_scheme)) $url = preg_replace('|^http://|', 'https://', $url); if (isset($parsed_url['query'])) { wp_parse_str($parsed_url['query'], $r); foreach ($r as $k => $v) { if (strpos($v, ' ') !== false) $r[$k] = rawurlencode($v); } $url = add_query_arg($r, $url); } } return $url; } function SteamLogin_BlockLogin_RewriteRules($rules) { if (!get_option('steamlogin_enabled')) return $rules; return $rules . ' # BEGIN SteamLogin # We have our own login file, so deny the use of the original one order allow,deny deny from all # END SteamLogin '; } function SteamLogin_LogoutRedirect($redirect_to, $url_redirect_to = '', $user = null) { return '/'; } function SteamLogin_BlockPasswordFields($showfields, $user = null) { // Show the password fields in "Add New User" but hide them in the User Profile. return empty($user); } function SteamLogin_DeletedUser($userid) { global $wpdb, $table_steamlogin; $wpdb->query($wpdb->prepare("DELETE FROM $table_steamlogin WHERE userid = %d", $userid)); } function SteamLogin_PluginsLoaded() { wp_enqueue_script('jquery'); global $table_steamlogin, $wpdb; if (!is_user_logged_in()) return; get_currentuserinfo(); global $current_user; $user = $current_user; $steamid = $wpdb->get_var($wpdb->prepare("SELECT steamid FROM $table_steamlogin WHERE userid = %s", $user->ID)); if (empty($steamid)) { wp_logout(); wp_safe_redirect(site_url($_SERVER['REQUEST_URI'])); exit; } } function SteamLogin_OverrideNickname($author) { global $authordata; if (!is_object($authordata)) return $author; if (current_user_can('change_displayname')) return $authordata->display_name; return $authordata->user_login; } function SteamLogin_PreprocessComment($commentdata) { global $wpdb; if (!is_user_logged_in()) return $commentdata; if (current_user_can('change_displayname')) return $commentdata; $user = wp_get_current_user(); $commentdata['comment_author'] = $wpdb->escape($user->user_login); return $commentdata; } if (!function_exists('steamid_to_profileid')): function steamid_to_profileid($steamid) { /* steamid_to_profileid by f2@krus.dk */ if (!function_exists('bcadd')) return false; // $steamid in format: array('0', '1', '38660') if (!is_array($steamid) || count($steamid) != 3) return false; if ($steamid[0] != '0' && $steamid[0] != '1') return false; $server = $steamid[1]; if ($server != '0' && $server != '1') return false; $authid = $steamid[2]; if (strlen($authid) == 0 || !ctype_digit($authid)) return false; return bcadd(bcadd('76561197960265728', bcadd($authid, $authid)), $server); } endif; if (!function_exists('profileid_to_steamid')): function profileid_to_steamid($profileid) { /* profileid_to_steamid by f2@krus.dk */ if (!ctype_digit($profileid) || !function_exists('bcsub') || !function_exists('bcdiv')) return false; $server = intval($profileid{strlen($profileid)-1})&1; // bcadd(bcadd('76561197960265728', bcadd($authid, $authid)), $server) $n = bcsub($profileid, "$server"); // bcadd('76561197960265728', bcadd($authid, $authid)) $n = bcsub($n, '76561197960265728'); // bcadd($authid, $authid) $authid = bcdiv($n, '2'); return "STEAM_0:$server:$authid"; } endif; function SteamLogin_Steam2ProfileID($steamid) { /* Steam2ProfileID by f2@krus.dk */ // $steamid might be one of these formats: // - http://steamcommunity.com/id/f2 // - http://steamcommunity.com/profiles/76561197999889807 // - 76561197999889807 // - STEAM_0:0:38660 // - 0:0:38660 $steamid = strtolower($steamid); if (substr($steamid, 0, strlen('http://steamcommunity.com/id/')) == 'http://steamcommunity.com/id/') { // FORMAT: http://steamcommunity.com/id/f2 $profilename = substr($steamid, strlen('http://steamcommunity.com/id/')); if (substr($profilename, -1) == '/') $profilename = substr($profilename, 0, -1); if (empty($profilename)) return false; $data = file_get_contents('http://steamcommunity.com/id/'.$profilename.'?&xml=1'); if ($data === false) return false; $pos = stripos($data, ''); if ($pos === false) return false; $pos += strlen(''); $pos2 = stripos($data, '', $pos); if ($pos2 === false) return false; return substr($data, $pos, $pos2 - $pos); } else if (substr($steamid, 0, strlen('http://steamcommunity.com/profiles/')) == 'http://steamcommunity.com/profiles/') { // FORMAT: http://steamcommunity.com/profiles/76561197999889807 $profileid = substr($steamid, strlen('http://steamcommunity.com/profiles/')); if (substr($profileid, -1) == '/') $profileid = substr($profileid, 0, -1); if (empty($profileid) || !ctype_digit($profileid)) return false; return $profileid; } else if (substr($steamid, 0, 3) == '765' && ctype_digit($steamid)) { // FORMAT: 76561197999889807 return $steamid; } else if (substr($steamid, 0, strlen('steam_')) == 'steam_' && in_array(substr($steamid, strlen('steam_'), 4), array('0:0:', '0:1:', '1:0:', '1:1:')) && ctype_digit(substr($steamid, strlen('steam_')+4))) { // FORMAT: STEAM_0:0:38660 return steamid_to_profileid(explode(':', substr($steamid, strlen('steam_')))); } else if (in_array(substr($steamid, 0, 4), array('0:0:', '0:1:', '1:0:', '1:1:')) && ctype_digit(substr($steamid, 4))) { // FORMAT 0:0:38660 return steamid_to_profileid(explode(':', $steamid)); } // Unknown format return false; } ?> 'i like unicorn')); } function UnicornAvatars_GetAvatar($avatar, $id_or_email, $size, $default, $alt) { if (strpos($default, 'http://unicornify.appspot.com/') === false) return $avatar; if ($alt === false) $safe_alt = ''; else $safe_alt = esc_attr($alt); $email = ''; if ( is_numeric($id_or_email) ) { $id = (int) $id_or_email; $user = get_userdata($id); if ( $user ) $email = $user->user_email; } elseif ( is_object($id_or_email) ) { // No avatar for pingbacks or trackbacks $allowed_comment_types = apply_filters( 'get_avatar_comment_types', array( 'comment' ) ); if ( ! empty( $id_or_email->comment_type ) && ! in_array( $id_or_email->comment_type, (array) $allowed_comment_types ) ) return false; if ( !empty($id_or_email->user_id) ) { $id = (int) $id_or_email->user_id; $user = get_userdata($id); if ( $user) $email = $user->user_email; } elseif ( !empty($id_or_email->comment_author_email) ) { $email = $id_or_email->comment_author_email; } } else { $email = $id_or_email; } if (empty($email)) $email = 'unknown'; $url = 'http://unicornify.appspot.com/avatar/'.md5(strtolower($email)).'?s='.$size; return "{$safe_alt}"; } function UnicornAvatars_PluginDeactivated() { $avatar_default = get_option('avatar_default'); if (!empty($avatar_default)) { if ($avatar_default == 'http://unicornify.appspot.com/') { update_option('avatar_default', 'identicon'); } } } ?>