function apoc_setup() { // Load the Apocrypha class require_once trailingslashit(TEMPLATEPATH) . 'library/apocrypha.php'; // Initialize the Apocrypha theme object if (class_exists('Apocrypha')) { apoc(); } }
/** * Generates a class for the homepage headers. * Randomizes between the six artistic header images. * Ensures that each of the headers are only displayed once * * @version 2.0 */ function apoc_post_header_class($context) { if (!isset(apoc()->post_headers)) { $headers = range(1, 6); shuffle($headers); apoc()->post_headers = $headers; } $header = array_shift(apoc()->post_headers); echo $context . '-header-' . $header; }
/** * Customize map view properties */ function setup_map() { // Set theme objects $apoc = apoc(); $apoc->classes = array_merge($apoc->classes, array('singular', 'page', 'map')); $apoc->crumbs[] = "Interactive Map"; $apoc->title = "Interactive Map of Tamriel"; $apoc->description = "A richly interactive map of the entirety of Tamriel which is available in The Elder Scrolls Online."; // Add custom scripts and styles add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts')); }
/** * Callback function for choosing the comment template * @version 2 */ function apoc_comments_template($comment, $args, $depth) { // Determine the post type for this comment $apoc = apoc(); $post_type = isset($apoc->post_type) ? $apoc->post_type : 'post'; $comment_type = get_comment_type($comment->comment_ID); // Is the comment count already set? if (isset($apoc->counts['comment'])) { $count = ++$apoc->counts['comment']; } else { // Get comment page $apoc->counts['cpage'] = '' == $args['page'] ? get_query_var('cpage') : $args['page']; // Adjust the count $adj = ($apoc->counts['cpage'] - 1) * $args['per_page']; $count = $adj + 1; // Update the object $apoc->counts['comment'] = $count; } // Load the comment template include THEME_DIR . '/library/templates/comment.php'; }
/** * Create the breadcrumb trail */ function generate_crumbs() { // Declare variables $breadcrumbs = ''; extract($this->args, EXTR_SKIP); // Get the items based on page context $trail = apoc()->crumbs; // If we have items, build the trail if (!empty($trail) && is_array($trail)) { // Wrap the trail and add the 'Before' element $breadcrumbs = '<' . $container . ' class="breadcrumbs">'; $breadcrumbs .= !empty($before) ? '<span class="trail-before">' . $before . '</span> ' : ''; // Add 'trail-end' class around last item array_push($trail, '<span class="trail-end">' . array_pop($trail) . '</span>'); // Join the individual trail items into a single string $breadcrumbs .= join("{$separator}", $trail); // Close the breadcrumb trail containers $breadcrumbs .= '</' . $container . '>'; } // Return the breadcrumbs return $breadcrumbs; }
function apoc_donate_box() { // Get the user's name $user = apoc()->user; $user_id = $user->ID; $name = $user_id == 0 ? 'Anonymous' : $user->data->display_name; // Echo the HTML ?> <div class="widget donate-widget"> <header class="widget-header"><h3 class="widget-title">Support Us!</h3></header> <p>Please donate to help support Tamriel Foundry, fund further improvements, and unlock account perks!</p> <form id="donation-form" action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top"> <input type="hidden" name="cmd" value="_donations"> <input type="hidden" name="business" value="*****@*****.**"> <input type="hidden" name="lc" value="US"> <input type="hidden" name="item_name" value="Tamriel Foundry"> <input type="hidden" name="item_number" value="Donation From <?php echo $name; ?> (<?php echo $user_id; ?> )"> <input type="hidden" name="currency_code" value="USD"> <input type="hidden" name="user_id" value="<?php echo $user_id; ?> "> <input type="image" id="donate-image" src="<?php echo THEME_URI . '/images/icons/donate.png'; ?> " border="0" name="submit" width="200" height="50" alt="Donate to support Tamriel Foundry!"> </form> </div> <?php }
<header id="registration-header" class="post-header <?php apoc_post_header_class('post'); ?> "> <h1 class="post-title"><?php apoc_title(); ?> </h1></h1> <p class="post-byline"><?php apoc_description(); ?> </p> </header> <form id="signup-form" action="<?php echo apoc()->url; ?> " name="signup_form" method="post" enctype="multipart/form-data"> <?php do_action('template_notices'); ?> <?php // New user registration is disabled if ('registration-disabled' == bp_get_current_signup_step()) { ?> <p class="error">Sorry, but new user registration is currently disabled on <?php echo SITENAME; ?> . Please try again later!</p>
<?php /** * Apocrypha Theme Admin Bar * Andrew Clayton * Version 2.0 * 4-30-2014 */ // Get current user information $user = apoc()->user; $user_id = $user->ID; $logged_in = $user_id > 0; // Get current url $url = apoc()->url; // Get current search information $search = apoc()->search; ?> <div id="top-login" class="<?php echo $logged_in ? 'logged-in' : 'logged-out'; ?> "> <form name="top-login-form" id="top-login-form" action="<?php echo SITEURL . '/wp-login.php'; ?> " method="post"> <?php if ($logged_in) { ?>
?> </span> <?php } ?> </a> </li> <?php } ?> </ul> </nav><!-- #directory-nav --> <?php if (is_user_logged_in()) { $user = apoc()->user; ?> <blockquote id="profile-status" class="user-status"> <?php echo '@' . $user->display_name . ' → '; ?> <div id="latest-status"><?php echo wpautop(bp_get_activity_latest_update($user->ID)); ?> </div> <a class="update-status-button button-dark"><i class="fa fa-pencil"></i>What's New?</a> </blockquote> <?php locate_template(array('activity/post-form.php'), true); ?> <?php
function apoc_private_forum_ids() { $private = array(); // Get the current user $user = apoc()->user; // Example - logged in only if ($user->ID == 0) { $private[] = 23; } // Return the list of private forums $private = empty($private) ? '' : $private; return $private; }
function apoc_body_class() { echo implode(' ', array_unique(apoc()->classes)); }
function post_registration() { // Get the BuddyPress object global $bp; // Prevent special characters or spaces in usernames $_POST['signup_username'] = str_replace(" ", "-", trim($_POST['signup_username'])); if (strpos($_POST['signup_username'], "@") || strpos($_POST['signup_username'], ".")) { $bp->signup->errors['signup_username'] = '******'; } // Check extra fields if (empty($_POST['confirm_tos_box'])) { $bp->signup->errors['confirm_tos_box'] = 'You must indicate that you understand the fundamental purpose of the Tamriel Foundry website and community.'; } if (empty($_POST['confirm_coc_box'])) { $bp->signup->errors['confirm_coc_box'] = 'You must indicate your acknowledgement of the Tamriel Foundry code of conduct.'; } if (apoc()->humanity != trim(strtolower($_POST['confirm_humanity']))) { $bp->signup->errors['confirm_humanity'] = 'That is incorrect. Hover on the image if you require a hint.'; } }
//Adslot 3 declaration //gptadslots[3]= googletag.defineSlot('/1045124/TamrielFoundry', [[1,1]],'div-gpt-ad-821545701545728213-3').addService(googletag.pubads()); //Adslot 4 declaration //gptadslots[4]= googletag.defineSlot('/1045124/TamrielFoundry_Interstitial', [[1,1]],'div-gpt-ad-821545701545728213-4').addService(googletag.pubads()); googletag.pubads().setTargeting('section',['<?php echo apoc()->classes[1]; ?> ']).setTargeting('platform',['<?php if (apoc()->user->ID != 0) { echo get_user_meta(apoc()->user->ID, "server", true); } ?> ']).setTargeting('GS_Game',['TF_Game']).setTargeting('GS_Genre',['TF_Genre']).setTargeting('URL',['<?php echo str_replace(SITEURL, '', apoc()->url); ?> ']); googletag.pubads().enableSyncRendering(); googletag.enableServices(); </script> <!-- End: GPT --> <!-- Begin comScore Tag --> <script> var _comscore = _comscore || []; _comscore.push({ c1: "2", c2: "20676402" }); (function() { var s = document.createElement("script"), el = document.getElementsByTagName("script")[0]; s.async = true; s.src = (document.location.protocol == "https:" ? "https://sb" : "http://b") + ".scorecardresearch.com/beacon.js";
<?php /** * Apocrypha Theme Comments Template * Andrew Clayton * Version 2.0 * 9-13-2014 */ // Get some information global $comment; $count = apoc()->counts['comment']; $user = new Apoc_User($comment->user_id, 'reply'); // Display the comment ?> <li id="comment-<?php echo $comment->comment_ID; ?> " class="reply"> <header class="reply-header"> <time class="reply-time" datetime="<?php echo date('Y-m-d\\TH:i', strtotime($comment->comment_date)); ?> "><?php echo bp_core_time_since($comment->comment_date_gmt, current_time('timestamp', true)); ?> </time> <?php apoc_report_post_button('comment'); ?> <div class="reply-admin-links">