| @@ -25,15 +25,16 @@ | ||
| 25 | 25 | global $current_user; |
| 26 | 26 | $current_user_role=$current_user->roles[0]; |
| 27 | 27 | $proversion1 = wpsp_check_pro_version('wpsp_addon_version'); |
| 28 | 28 | $prodisable1 = !$proversion1['status'] ? 'notinstalled' : 'installed'; |
| 29 | - $propayment = wpsp_check_pro_version('pay_WooCommerce'); | |
| 29 | + $propayment_gate_class = apply_filters('wpsp_payment_addon_gate_class', 'pay_WooCommerce'); | |
| 30 | + $propayment = wpsp_check_pro_version($propayment_gate_class); | |
| 30 | 31 | $propayment = !$propayment['status'] ? 'notinstalled' : 'installed'; |
| 31 | 32 | |
| 32 | 33 | $promessage2 = wpsp_check_pro_version('wpsp_message_version'); |
| 33 | 34 | $prodisablemessage2 = !$promessage2['status'] ? 'notinstalled' : 'installed'; |
| 34 | 35 | |
| 35 | - add_menu_page(__('WPSchoolPress', 'wpschoolpress') , __('WPSchoolPress', 'wpschoolpress') , 'manage_options', 'wpschoolpress', array( | |
| 36 | + add_menu_page(__('wpschoolpress', 'wpschoolpress') , __('WPSchoolPress', 'wpschoolpress') , 'manage_options', 'wpschoolpress', array( | |
| 36 | 37 | $this, |
| 37 | 38 | 'wpsp_admin_details' |
| 38 | 39 | ) , WPSP_PLUGIN_URL . 'img/favicon.png'); |
| 39 | 40 | add_submenu_page('wpschoolpress', 'wpschoolpress', '<i class="dashicons dashicons-dashboard icon"></i> Dashboard', 'edit_posts', 'sch-dashboard', array( |
| @@ -43,30 +44,30 @@ | ||
| 43 | 44 | |
| 44 | 45 | /* Social Posts */ |
| 45 | 46 | if( $current_user_role=='administrator' || $current_user_role=='teacher' || $current_user_role=='student' ||$current_user_role=='parent' ) |
| 46 | 47 | { |
| 47 | - add_submenu_page('WPSchoolPress', 'WPSchoolPress', '<i class="dashicons-before dashicons-admin-post"></i> Posts', 'edit_posts', 'sch-posts', array( | |
| 48 | + add_submenu_page('wpschoolpress', 'wpschoolpress', '<i class="dashicons-before dashicons-admin-post"></i> Posts', 'edit_posts', 'sch-posts', array( | |
| 48 | 49 | $this, |
| 49 | 50 | 'wpsp_callback_posts' |
| 50 | 51 | )); |
| 51 | 52 | |
| 52 | - add_submenu_page('WPSchoolPress', 'WPSchoolPress', '<i class="dashicons-before dashicons-admin-post"></i> Social Profile', 'edit_posts', 'sch-postsprofile', array( | |
| 53 | + add_submenu_page('wpschoolpress', 'wpschoolpress', '<i class="dashicons-before dashicons-admin-post"></i> Social Profile', 'edit_posts', 'sch-postsprofile', array( | |
| 53 | 54 | $this, |
| 54 | 55 | 'wpsp_callback_postsprofile' |
| 55 | 56 | )); |
| 56 | 57 | if( $current_user_role=='administrator'){ |
| 57 | - add_submenu_page('WPSchoolPress', 'WPSchoolPress', '<i class="dashicons-before dashicons-admin-post"></i> Reported Posts', 'edit_posts', 'sch-reported-posts', array( | |
| 58 | + add_submenu_page('wpschoolpress', 'wpschoolpress', '<i class="dashicons-before dashicons-admin-post"></i> Reported Posts', 'edit_posts', 'sch-reported-posts', array( | |
| 58 | 59 | $this, |
| 59 | 60 | 'wpsp_callback_reported_post' |
| 60 | 61 | )); |
| 61 | 62 | } |
| 62 | 63 | //if( $current_user_role=='administrator'){ |
| 63 | - add_submenu_page('WPSchoolPress', 'WPSchoolPress', '<i class="dashicons-before dashicons-admin-post"></i> Notification', 'edit_posts', 'sch-posts-notification', array( | |
| 64 | + add_submenu_page('wpschoolpress', 'wpschoolpress', '<i class="dashicons-before dashicons-admin-post"></i> Notification', 'edit_posts', 'sch-posts-notification', array( | |
| 64 | 65 | $this, |
| 65 | 66 | 'wpsp_callback_posts_notification' |
| 66 | 67 | )); |
| 67 | 68 | //} |
| 68 | - add_submenu_page('WPSchoolPress', 'WPSchoolPress', '<i class="dashicons-before dashicons-admin-post"></i> Documents', 'edit_posts', 'sch-documents', array( | |
| 69 | + add_submenu_page('wpschoolpress', 'wpschoolpress', '<i class="dashicons-before dashicons-admin-post"></i> Documents', 'edit_posts', 'sch-documents', array( | |
| 69 | 70 | $this, |
| 70 | 71 | 'wpsp_callback_documents' |
| 71 | 72 | )); |
| 72 | 73 | } |
| @@ -179,13 +180,15 @@ | ||
| 179 | 180 | 'wpsp_callback_payment' |
| 180 | 181 | )); |
| 181 | 182 | } |
| 182 | 183 | add_submenu_page( 'wpschoolpress', 'wpschoolpress', '<i class="dashicons dashicons-welcome-add-page"></i> Addons', |
| 183 | - 'manage_options', 'addons', | |
| 184 | - array( | |
| 185 | - $this, | |
| 186 | - 'wpsp_addons' | |
| 187 | - )); | |
| 184 | + 'edit_posts', 'sch-addons', | |
| 185 | + array( $this, 'wpsp_addons' ) | |
| 186 | + ); | |
| 187 | + add_submenu_page( 'wpschoolpress', 'wpschoolpress', '<i class="fa fa-pencil-square-o"></i> Customization', | |
| 188 | + 'edit_posts', 'sch-customization', | |
| 189 | + array( $this, 'wpsp_customization' ) | |
| 190 | + ); | |
| 188 | 191 | } |
| 189 | 192 | /* |
| 190 | 193 | * Call html of purchase code validation and contact |
| 191 | 194 | * @package WPSchoolPress |
| @@ -196,10 +199,14 @@ | ||
| 196 | 199 | require_once (WPSP_PLUGIN_PATH . 'lib/wpsp-admin-options.php'); |
| 197 | 200 | } |
| 198 | 201 | function wpsp_addons() |
| 199 | 202 | { |
| 200 | - require_once (WPSP_PLUGIN_PATH . 'lib/wpsp-admin-addons.php'); | |
| 203 | + require_once (WPSP_PLUGIN_PATH . 'pages/wpsp-addons.php'); | |
| 201 | 204 | } |
| 205 | + function wpsp_customization() | |
| 206 | + { | |
| 207 | + require_once (WPSP_PLUGIN_PATH . 'pages/wpsp-customization.php'); | |
| 208 | + } | |
| 202 | 209 | function wpsp_callback_dashboard() |
| 203 | 210 | { |
| 204 | 211 | require_once (WPSP_PLUGIN_PATH . 'pages/wpsp-dashboard.php'); |
| 205 | 212 | } |
| @@ -472,8 +479,28 @@ | ||
| 472 | 479 | } |
| 473 | 480 | if ( $hook === 'wpschoolpress_page_sch-leavecalendar' ) { |
| 474 | 481 | wp_enqueue_script( 'wpsp_wp_admin_jquery42', WPSP_PLUGIN_URL . 'js/wpsp-leavecalendar.js', array( 'jquery' ), '1.0.0', true ); |
| 475 | 482 | } |
| 483 | + if ( $hook === 'wpschoolpress_page_sch-addons' || $hook === 'wpschoolpress_page_sch-customization' ) { | |
| 484 | + wp_register_style( 'wpsp_addons_customization', WPSP_PLUGIN_URL . 'css/wpsp-addons-customization.css', false, WPSP_PLUGIN_VERSION ); | |
| 485 | + wp_enqueue_style( 'wpsp_addons_customization' ); | |
| 486 | + } | |
| 487 | + if ( $hook === 'wpschoolpress_page_sch-customization' ) { | |
| 488 | + wp_enqueue_script( 'wpsp_customization_js', WPSP_PLUGIN_URL . 'js/wpsp-customization.js', array( 'jquery' ), WPSP_PLUGIN_VERSION, true ); | |
| 489 | + wp_localize_script( 'wpsp_customization_js', 'wpspCustomization', array( | |
| 490 | + 'ajax_url' => admin_url( 'admin-ajax.php' ), | |
| 491 | + 'i18n' => array( | |
| 492 | + 'sending' => esc_html__( 'Sending...', 'wpschoolpress' ), | |
| 493 | + 'submit' => esc_html__( 'Submit Request', 'wpschoolpress' ), | |
| 494 | + 'error' => esc_html__( 'Something went wrong. Please try again.', 'wpschoolpress' ), | |
| 495 | + 'name_error' => esc_html__( 'Please enter a valid name (min 2 characters).', 'wpschoolpress' ), | |
| 496 | + 'email_error' => esc_html__( 'Please enter a valid email address.', 'wpschoolpress' ), | |
| 497 | + 'type_error' => esc_html__( 'Please select a customization type.', 'wpschoolpress' ), | |
| 498 | + 'subject_error' => esc_html__( 'Please enter a subject (min 5 characters).', 'wpschoolpress' ), | |
| 499 | + 'desc_error' => esc_html__( 'Please enter a description (min 20 characters).', 'wpschoolpress' ), | |
| 500 | + ), | |
| 501 | + ) ); | |
| 502 | + } | |
| 476 | 503 | } |
| 477 | 504 | /* |
| 478 | 505 | * Add pages in menu default |
| 479 | 506 | * @package WPSchoolPress |
| @@ -521,14 +548,14 @@ | ||
| 521 | 548 | function add_hooks() |
| 522 | 549 | { |
| 523 | 550 | function wpsp_custom_loginlogo() |
| 524 | 551 | { |
| 525 | - global $current_user, $wpdb, $wpsp_settings_data,$post,$current_user_name; | |
| 526 | - $url = plugin_dir_url( __FILE__ ).'img/wpschoolpresslogo.jpg'; | |
| 527 | - $imglogo = isset( $wpsp_settings_data['sch_logo'] ) ? sanitize_text_field($wpsp_settings_data['sch_logo']) : $url; | |
| 528 | - echo '<style type="text/css"> | |
| 529 | - .login h1 a {background-image: url(' . $imglogo . ') !important; } | |
| 530 | - </style>'; | |
| 552 | + global $current_user, $wpdb, $wpsp_settings_data, $post, $current_user_name; | |
| 553 | + $url = plugin_dir_url( __FILE__ ) . 'img/wpschoolpresslogo.jpg'; | |
| 554 | + $imglogo = isset( $wpsp_settings_data['sch_logo'] ) ? sanitize_text_field( $wpsp_settings_data['sch_logo'] ) : $url; | |
| 555 | + echo '<style type="text/css"> | |
| 556 | + .login h1 a {background-image: url(' . esc_url( $imglogo ) . ') !important; } | |
| 557 | + </style>'; | |
| 531 | 558 | } |
| 532 | 559 | // Add menu page for purchase code validation |
| 533 | 560 | add_action('admin_menu', array( |
| 534 | 561 | $this, |