?> </a></li> <?php } ?> </ul> </div> <?php } ?> <?php if ((!ThemexCourse::isSubscriber() || !ThemexCourse::isMember()) && !ThemexCourse::isAuthor()) { ?> <div class="popup hidden"> <?php if (!ThemexCourse::isSubscriber()) { ?> <h2 class="popup-text"><?php _e('Subscribe to view this content', 'academy'); ?> </h2> <?php } else { ?> <h2 class="popup-text"><?php _e('Take a course to view this content', 'academy'); ?> </h2> <?php } ?>
/** * 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; } }