ElementGenerator
10 months ago
Ajax.php
10 months ago
Backend.php
1 year ago
Editor.php
1 year ago
Frontend.php
1 year ago
Helper.php
1 year ago
Hooks.php
11 months ago
Iframe.php
1 year ago
Pages.php
11 months ago
VisibilityCondition.php
1 year ago
Helper.php
52 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * Preview script for html markup generator |
| 5 | * |
| 6 | * @package tutor-droip-elements |
| 7 | */ |
| 8 | |
| 9 | namespace TutorLMSDroip; |
| 10 | |
| 11 | use Droip\Ajax\ExportImport; |
| 12 | use TUTOR\Course; |
| 13 | |
| 14 | if ( ! defined( 'ABSPATH' ) ) { |
| 15 | exit; // Exit if accessed directly. |
| 16 | } |
| 17 | |
| 18 | /** |
| 19 | * Class Helper |
| 20 | * This class is used to define all helper functions. |
| 21 | */ |
| 22 | class Helper { |
| 23 | |
| 24 | |
| 25 | /** |
| 26 | * Function to activate droip elements plugin |
| 27 | */ |
| 28 | public static function t_d_e_activate() { |
| 29 | } |
| 30 | |
| 31 | /** |
| 32 | * This function will verify nonce |
| 33 | * ACT like API calls auth middleware |
| 34 | * |
| 35 | * @param string $action ajax action name. |
| 36 | * |
| 37 | * @return void |
| 38 | */ |
| 39 | public static function verify_nonce( $action = -1 ) { |
| 40 | $nonce = sanitize_text_field( isset( $_SERVER['HTTP_X_WP_NONCE'] ) ? wp_unslash( $_SERVER['HTTP_X_WP_NONCE'] ) : null ); |
| 41 | if ( ! wp_verify_nonce( $nonce, $action ) ) { |
| 42 | wp_send_json_error( 'Not authorized' ); |
| 43 | exit; |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | public static function is_course_for_single_purchaseble($course_id){ |
| 48 | $selling_option = Course::get_selling_option( $course_id ); |
| 49 | return empty($selling_option) || Course::SELLING_OPTION_ONE_TIME == $selling_option; |
| 50 | } |
| 51 | } |
| 52 |