> <head> <title><?php wp_title('|', true, 'right'); ?> </title> <?php wp_head(); ?> </head> <body <?php body_class('single-certificate'); ?> > <?php $ID = ThemexCore::getRewriteRule('certificate'); $certificate = ThemexCourse::getCertificate(themex_decode($ID), themex_decode($ID, true)); if (isset($certificate['user'])) { ?> <div class="certificate-wrap"> <?php if (!empty($certificate['background'])) { ?> <div class="substrate"> <img src="<?php echo $certificate['background']; ?> " class="fullwidth" alt="" /> </div> <?php }
/** * Redirects course or plan * * @access public * @return void */ public static function redirectCourse() { $ID = ThemexCore::getRewriteRule('redirect'); if (!empty($ID)) { $post = get_post($ID); if (!empty($post)) { if ($post->post_type == 'plan') { self::subscribeUser($post->ID, get_current_user_id()); } else { if ($post->post_type == 'course') { self::addUser($post->ID, get_current_user_id()); } } } wp_redirect(SITE_URL); exit; } }
/** * Saves lesson attachment * * @access public * @return void */ public static function saveAttachment() { $file = ThemexCore::getRewriteRule('file'); if (!empty($file)) { $index = themex_decode($file); $lesson = themex_decode($file, true); self::refresh($lesson); if (!empty(self::$data['course'])) { ThemexCourse::refresh(self::$data['course']); if (isset(self::$data['attachments'][$index]) && (ThemexCourse::isSubscriber() && ThemexCourse::isMember() || ThemexCourse::isAuthor() || self::$data['status'] == 'free')) { $attachment = self::$data['attachments'][$index]; if (isset($attachment['status']) && $attachment['status'] == 'link') { wp_redirect($attachment['url']); } else { $name = basename($attachment['url']); header('Content-Type: application/octet-stream'); header('Content-Transfer-Encoding: Binary'); header('Content-disposition: attachment; filename="' . $name . '"'); readfile($attachment['url']); } } else { wp_redirect(get_permalink(self::$data['course'])); } exit; } wp_redirect(SITE_URL); exit; } }