/** * Adds custom fonts * * @access public * @return void */ public static function renderFonts() { $fonts = array(); $out = ''; foreach (ThemexCore::$options as $option) { if ($option['type'] == 'select_font') { $font = ThemexCore::getOption($option['id'], $option['default']); if ($font == 'Open Sans') { $font .= ':400,600'; } else { if ($font == 'Asap') { $font .= ':700'; } } $fonts[] = $font; } } if (!empty($fonts)) { $out .= '<script type="text/javascript"> WebFontConfig = {google: { families: [ "' . implode($fonts, '","') . '" ] } }; (function() { var wf = document.createElement("script"); wf.src = ("https:" == document.location.protocol ? "https" : "http") + "://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js"; wf.type = "text/javascript"; wf.async = "true"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(wf, s); })(); </script>'; echo $out; } }
" value="<?php echo esc_attr($value); ?> " /> </div> <?php } ?> </td> </tr> <?php } } ?> <?php if (!ThemexCore::checkOption('product_variations') && in_array(ThemexCore::getOption('product_type', 'all'), array('all', 'physical'))) { $options = ThemexWoo::getOptions(ThemexWoo::$data['product']['ID']); ?> <tr class="trigger-type-physical"> <th><?php _e('Attributes', 'makery'); ?> </th> <td> <div class="element-options" id="attribute"> <?php $index = 0; foreach ($options as $option) { $index++; ?> <div class="option">
/** * Refreshes module data * * @access public * @return void */ public static function refresh() { self::$data = (array) ThemexCore::getOption(__CLASS__); }
if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('footer')) { } ?> </div> <?php } ?> </div> </div> <!-- /content --> <div class="footer-wrap"> <footer class="site-footer"> <div class="row"> <div class="copyright left"> <?php echo ThemexCore::getOption('copyright', 'Academy Theme © ' . date('Y')); ?> </div> <nav class="footer-navigation right"> <?php wp_nav_menu(array('theme_location' => 'footer_menu')); ?> </nav> <!-- /navigation --> </div> </footer> </div> <!-- /footer --> </div> <!-- /site wrap --> <?php
<?php /* Template Name: Posts */ get_header(); $layout = ThemexCore::getOption('posts_layout', 'right'); if ($layout == 'left') { ?> <aside class="sidebar column fourcol"> <?php get_sidebar(); ?> </aside> <div class="column eightcol last"> <?php } else { if ($layout == 'right') { ?> <div class="column eightcol"> <?php } else { ?> <div class="fullwidth-section"> <?php } } ?> <?php echo category_description(); ?>
/** * Renders footer * * @access public * @return void */ public static function renderFooter() { $out = ThemexCore::getOption('tracking'); echo $out; }
/** * Resets password * * @access public * @param array $data * @return void */ public static function resetPassword($data) { global $wpdb, $wp_hasher; if (email_exists(sanitize_email($data['user_email']))) { $user = get_user_by('email', sanitize_email($data['user_email'])); do_action('lostpassword_post'); $login = $user->user_login; $email = $user->user_email; do_action('retrieve_password', $login); $allow = apply_filters('allow_password_reset', true, $user->ID); if (!$allow || is_wp_error($allow)) { ThemexInterface::$messages[] = __('Password recovery not allowed', 'academy'); } else { $key = wp_generate_password(20, false); do_action('retrieve_password_key', $login, $key); if (empty($wp_hasher)) { require_once ABSPATH . 'wp-includes/class-phpass.php'; $wp_hasher = new PasswordHash(8, true); } $hashed = $wp_hasher->HashPassword($key); $wpdb->update($wpdb->users, array('user_activation_key' => $hashed), array('user_login' => $login)); $link = network_site_url('wp-login.php?action=rp&key=' . $key . '&login='******'login'); $message = ThemexCore::getOption('email_password', 'Hi, %username%! Click this link to reset your password %link%'); $keywords = array('username' => $user->user_login, 'link' => $link); if (themex_mail($email, __('Password Recovery', 'academy'), themex_keywords($message, $keywords))) { ThemexInterface::$messages[] = __('Password reset link is sent', 'academy'); } else { ThemexInterface::$messages[] = __('Error sending email', 'academy'); } } } else { ThemexInterface::$messages[] = __('Invalid email address', 'academy'); } ThemexInterface::renderMessages(); die; }
/** * Validates lesson question * * @access public * @param array $comment * @return array */ public static function validateQuestion($comment) { if (get_post_type() == 'lesson') { if ($comment['comment_parent'] == 0 && (!isset($_POST['title']) || empty($_POST['title']))) { wp_die('<strong>' . __('ERROR', 'academy') . '</strong>: ' . __('please type a question.', 'academy')); } $message = ThemexCore::getOption('email_question'); if ($comment['comment_parent'] !== 0 && !empty($message)) { $question = get_comment($comment['comment_parent'], ARRAY_A); $replies = get_comments(array('parent' => $comment['comment_parent'])); $emails = wp_list_pluck($replies, 'comment_author_email'); if (!empty($question)) { $emails[] = $question['comment_author_email']; } $emails = array_unique(array_filter($emails)); foreach ($emails as $email) { if ($email != $comment['comment_author_email']) { $data = get_user_by('email', $email); if ($data !== false) { $keywords = array('username' => $data->user_login, 'title' => get_comment_meta($comment['comment_parent'], 'title', true), 'link' => get_comment_link($comment['comment_parent'])); themex_mail($emails, __('Question Answered', 'academy'), themex_keywords($message, $keywords)); } } } } } return $comment; }
<div class="column eightcol"> <?php } else { ?> <div class="fullcol"> <?php } } ?> <?php echo category_description(); ?> <div class="shops-wrap clearfix"> <?php if (is_page()) { query_posts(array('post_type' => 'shop', 'paged' => themex_paged(), 'posts_per_page' => ThemexCore::getOption('shops_per_page', 6))); } $counter = 0; while (have_posts()) { the_post(); $counter++; ?> <div class="column <?php echo $width; ?> col <?php echo $counter == $columns ? 'last' : ''; ?> "> <?php get_template_part('content', 'shop');
/** * Submits user message * * @access public * @param int $ID * @param array $data * @return void */ public static function submitMessage($ID, $data) { $user = intval(themex_value('user_id', $data)); if (!empty($user)) { $message = sanitize_text_field(themex_value('message', $data)); if (empty($message)) { ThemexInterface::$messages[] = '"' . __('Message', 'makery') . '" ' . __('field is required', 'makery'); } if (empty(ThemexInterface::$messages)) { $subject = __('New Message', 'makery'); $content = ThemexCore::getOption('email_message', 'Sender: %user%<br />Message: %message%'); $receiver = get_userdata($user); $sender = get_userdata($ID); $keywords = array('user' => '<a href="' . get_author_posts_url($sender->ID) . '">' . $sender->user_login . '</a>', 'message' => wpautop($message)); $content = themex_keywords($content, $keywords); themex_mail($receiver->user_email, $subject, $content, $sender->user_email); ThemexInterface::$messages[] = __('Message has been successfully sent', 'makery'); ThemexInterface::renderMessages(true); } else { ThemexInterface::renderMessages(); } } die; }
/** * Submits shop report * * @access public * @param array $data * @return void */ public static function submitReport($data) { $shop = intval(themex_value('shop_id', $data)); if (!empty($shop)) { $reason = sanitize_text_field(themex_value('reason', $data)); if (empty($reason)) { ThemexInterface::$messages[] = '"' . __('Reason', 'makery') . '" ' . __('field is required', 'makery'); } if (empty(ThemexInterface::$messages)) { $subject = __('Shop Report', 'makery'); $content = ThemexCore::getOption('email_shop_report', 'Sender: %user%<br />Shop: %shop%<br />Reason: %reason%'); $user = get_userdata(get_current_user_id()); $keywords = array('user' => '<a href="' . get_author_posts_url($user->ID) . '">' . $user->user_login . '</a>', 'shop' => '<a href="' . get_permalink($shop) . '">' . get_the_title($shop) . '</a>', 'reason' => wpautop($reason)); $content = themex_keywords($content, $keywords); themex_mail(get_option('admin_email'), $subject, $content, $user->user_email); ThemexInterface::$messages[] = __('Report has been successfully sent', 'makery'); ThemexInterface::renderMessages(true); } else { ThemexInterface::renderMessages(); } } die; }
/** * Renders background * * @access public * @return void */ public static function renderBackground() { global $post; $out = ''; if (ThemexCore::getOption('background_type', 'fullwidth') != 'tiled') { $background = ThemexCore::getOption('background_image', THEME_URI . 'images/bgs/site_bg.jpg'); if (is_page()) { $background = ThemexCore::getPostMeta($post->ID, 'page_background', $background); } else { if (is_singular('course')) { $background = ThemexCore::getPostMeta($post->ID, 'course_background', $background); } else { if (is_singular('lesson')) { $course = ThemexCore::getPostRelations($post->ID, 0, 'lesson_course', true); if ($course != 0) { $background = ThemexCore::getPostMeta($course, 'course_background', $background); } } } } $out = '<img src="' . $background . '" class="fullwidth" alt="" />'; } echo $out; }
<?php } ?> <?php } ?> </div> <!-- /login options --> <div class="search-form right"> <?php get_search_form(); ?> </div> <!-- /search form --> <?php if ($code = ThemexCore::getOption('sharing')) { ?> <div class="button-wrap share-button tooltip right"> <a href="#" class="element-button dark"><span class="button-icon plus nomargin"></span></a> <div class="tooltip-wrap"> <div class="corner"></div> <div class="tooltip-text"><?php echo themex_html($code); ?> </div> </div> </div> <!-- /share button --> <?php } ?>
<?php /* @version 3.0.0 */ if (!defined('ABSPATH')) { exit; } $view = ThemexCore::getOption('products_view', 'grid'); ?> <div class="items-view left"> <form action="<?php echo themex_url(); ?> " method="GET" class="woocommerce-ordering"> <?php if ($view == 'grid') { ?> <a href="#view" title="<?php _e('Grid View', 'makery'); ?> " class="element-submit <?php if (themex_value('view', $_GET, 'grid') == 'grid') { ?> active<?php } ?> " data-value="grid"><span class="fa fa-th-large"></span></a> <a href="#view" title="<?php _e('List View', 'makery'); ?>
?> </head> <body <?php body_class(); ?> > <div class="site-wrap"> <div class="header-wrap clearfix"> <header class="site-header container"> <div class="header-logo left"> <a href="<?php echo SITE_URL; ?> " rel="home"> <img src="<?php echo ThemexCore::getOption('site_logo', THEME_URI . 'images/logo.png'); ?> " alt="<?php bloginfo('name'); ?> " /> </a> </div> <!-- /logo --> <div class="header-options right clearfix"> <?php if (is_user_logged_in()) { ?> <a href="<?php echo wp_logout_url(SITE_URL); ?>
<?php get_header(); ?> <div class="woocommerce"> <?php $woocommerce_loop['single'] = true; $woocommerce_loop['columns'] = 4; $products = array_merge(ThemexShop::$data['products'], array(0)); $limit = intval(themex_value('limit', $_GET, ThemexCore::getOption('products_per_page', 9))); $order = ThemexWoo::getSorting(); query_posts(array('post_type' => 'product', 'post_status' => 'publish', 'paged' => themex_paged(), 'posts_per_page' => $limit, 'post__in' => $products, 'orderby' => $order['orderby'], 'order' => $order['order'], 'meta_key' => $order['meta_key'])); $layout = 'full'; $shop = $post->ID; ThemexWoo::getTemplate('archive-product.php'); ?> </div> <?php get_footer();
/** * Decode Facebook cookie * * @access public * @return array */ public static function decodeCookie() { $cookie = array(); if (list($encoded_sign, $payload) = explode('.', $_COOKIE['fbsr_' . ThemexCore::getOption('facebook_id')], 2)) { $sign = base64_decode(strtr($encoded_sign, '-_', '+/')); if (hash_hmac('sha256', $payload, ThemexCore::getOption('facebook_secret'), true) == $sign) { $cookie = json_decode(base64_decode(strtr($payload, '-_', '+/')), true); } } return $cookie; }
/** * Updates upsell limit * * @access public * @return void */ public static function updateUpsellLimit() { $columns = 4; $limit = ThemexCore::getOption('product_upsell_number', 4); woocommerce_upsell_display($limit, $columns); }
<?php $type = ThemexCore::getOption('slider_type', 'parallax'); $pause = ThemexCore::getOption('slider_pause', '0'); $speed = ThemexCore::getOption('slider_speed', '1000'); $query = new WP_Query(array('post_type' => 'slide', 'showposts' => -1, 'orderby' => 'menu_order', 'order' => 'ASC')); if ($query->have_posts()) { if ($type == 'boxed') { ?> <div class="row"> <div class="boxed-slider themex-slider"> <ul> <?php while ($query->have_posts()) { ?> <?php $query->the_post(); $video = ThemexCore::getPostMeta($post->ID, 'slide_video'); $link = ThemexCore::getPostMeta($post->ID, 'slide_link'); ?> <li> <?php if (!empty($video)) { ?> <div class="embedded-video"> <?php echo themex_html($video); ?> </div> <?php } else {
<?php get_header(); the_post(); ThemexLesson::refresh($post->ID, true); ThemexCourse::refresh(ThemexLesson::$data['course'], true); $layout = ThemexCore::getOption('lessons_layout', 'right'); if ($layout == 'left') { ?> <aside class="sidebar column fourcol"> <?php get_sidebar('lesson'); ?> </aside> <div class="column eightcol last"> <?php } else { ?> <div class="column eightcol lesson-content"> <?php } ?> <?php if (ThemexLesson::$data['prerequisite']['progress'] == 0 && ThemexLesson::$data['status'] != 'free' && ThemexCore::checkOption('lesson_hide') && !ThemexCourse::isAuthor()) { printf(__('Complete "%s" lesson before taking this lesson.', 'academy'), '<a href="' . get_permalink(ThemexLesson::$data['prerequisite']['ID']) . '">' . get_the_title(ThemexLesson::$data['prerequisite']['ID']) . '</a>'); } else { the_content(); comments_template('/questions.php'); } ?> </div>
<?php /* @version 3.0.0 */ if (!defined('ABSPATH')) { exit; } $limit = ThemexCore::getOption('products_per_page', 9); $extend = $limit * 2; ?> <div class="items-order right"> <form action="<?php echo themex_url(); ?> " method="GET" class="woocommerce-ordering"> <a href="#limit" class="element-submit <?php if (themex_value('limit', $_GET, $limit) == $limit) { ?> active<?php } ?> " data-value="<?php echo $limit; ?> "><?php echo $limit; ?> </a> <a href="#limit" class="element-submit <?php if (themex_value('limit', $_GET) == $extend) {
/** * Gets course questions * * @access public * @return array */ public static function getQuestions($ID) { global $lessons; $lessons = ThemexCore::getPostRelations(0, $ID, 'lesson_course'); $number = intval(ThemexCore::getOption('course_questions_number', '7')); $questions = array(); if ($number != 0) { add_filter('comments_clauses', array(__CLASS__, 'filterQuestions')); $questions = get_comments(array('parent' => 0, 'number' => ThemexCore::getOption('course_questions_number', '7'), 'type' => 'comment')); } return $questions; }
<?php $speed = intval(ThemexCore::getOption('slider_speed', '1000')); $pause = intval(ThemexCore::getOption('slider_pause', '0')); $query = new WP_Query(array('post_type' => 'slide', 'showposts' => -1, 'orderby' => 'menu_order', 'order' => 'ASC')); if ($query->have_posts()) { ?> <div class="slider-wrap"> <div class="element-slider header-slider" data-effect="slide" data-pause="<?php echo $pause; ?> " data-speed="<?php echo $speed; ?> "> <ul> <?php while ($query->have_posts()) { $query->the_post(); ?> <li> <div class="container"> <?php the_content(); ?> </div> </li> <?php } ?> </ul>
<?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('footer')) { } ?> </div> <?php } ?> </section> <!-- /content --> </div> <div class="footer-wrap"> <footer class="site-footer container"> <div class="site-copyright left"> <?php echo ThemexCore::getOption('copyright', 'Makery Theme © ' . date('Y')); ?> </div> <nav class="footer-menu right"> <?php wp_nav_menu(array('theme_location' => 'footer_menu')); ?> </nav> </footer> <!-- /footer --> </div> </div> <?php wp_footer(); ?> </body>
<?php if (!ThemexCore::checkOption('shop_multiple') && ThemexShop::$data['status'] == 'publish') { ?> <tr> <th><?php _e('Current Rate', 'makery'); ?> </th> <td><?php echo ThemexShop::filterRate(ThemexShop::$data['ID'], ThemexShop::$data['rate']); ?> %</td> </tr> <?php } $methods = array_flip(ThemexCore::getOption('withdrawal_methods', array('paypal', 'skrill', 'swift'))); $gateways = ThemexWoo::getPaymentMethods(); if (count($gateways) > 1 || !isset($gateways['paypal-adaptive-payments'])) { foreach (ThemexCore::$components['forms']['withdrawal'] as $name => $field) { if (is_array(reset($field))) { if (isset($methods[$name])) { foreach ($field as $key => $child) { ?> <tr class="trigger-method-<?php echo $name; ?> "> <th><?php echo $child['label']; ?> </th>
<?php /* Template Name: Courses */ get_header(); $layout = ThemexCore::getOption('courses_layout', 'fullwidth'); $view = ThemexCore::getOption('courses_view', 'grid'); $columns = intval(ThemexCore::getOption('courses_columns', '4')); if ($layout == 'left') { ?> <aside class="sidebar fourcol column"> <?php get_sidebar(); ?> </aside> <div class="eightcol column last"> <?php } else { if ($layout == 'right') { ?> <div class="eightcol column"> <?php } else { ?> <div class="fullwidth-section"> <?php } } ?> <?php
<td> <div class="field-wrap"> <input type="text" name="link" class="element-copy" readonly="readonly" value="<?php echo home_url('?ref=' . ThemexUser::$data['current']['login']); ?> " /> </div> </td> </tr> <tr> <th><?php _e('Current Rate', 'makery'); ?> </th> <td><?php echo ThemexCore::getOption('shop_rate_referral', '30'); ?> %</td> </tr> <tr> <th><?php _e('Clickthroughs', 'makery'); ?> </th> <td><?php echo ThemexUser::$data['current']['clicks']; ?> </td> </tr> </tbody> </table>