hooks(); } /** * Register hooks. * * @since 1.8.7.6 */ private function hooks() { // Maybe load about page. add_action( 'admin_init', [ $this, 'init' ] ); // Enqueue assets. add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_assets' ] ); } /** * Determining if the user is viewing our page, if so, party on. * * @since 1.8.7.6 */ public function init() { // Check what page we are on. // phpcs:ignore WordPress.Security.NonceVerification.Recommended $page = isset( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : ''; // Only load if we are actually on the about page. if ( $page !== self::SLUG ) { return; } // Determine the current active tab. // phpcs:ignore WordPress.Security.NonceVerification.Recommended $this->view = ! empty( $_GET['view'] ) ? sanitize_text_field( wp_unslash( $_GET['view'] ) ) : self::DEFAULT_TAB; // If the user tries to load an invalid view - redirect to About Us. $valid_views = [ 'about', 'lite-vs-pro' ]; if ( ! in_array( $this->view, $valid_views, true ) ) { wp_safe_redirect( admin_url( 'admin.php?page=charitable-about&view=about' ) ); exit; } add_action( 'charitable_admin_page', [ $this, 'output' ] ); // Hook for addons. do_action( 'charitable_admin_about_init' ); } /** * Output the basic page structure. * * @since 1.8.7.6 */ public function output() { charitable_admin_view( 'about/about' ); } /** * Enqueue assets for the About page. * * @since 1.8.7.6 */ public function enqueue_assets() { // Check if we're on the about page // phpcs:ignore WordPress.Security.NonceVerification.Recommended $page = isset( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : ''; if ( $page !== self::SLUG ) { return; } // Enqueue CSS wp_enqueue_style( 'charitable-admin-about', charitable()->get_path( 'assets', false ) . 'css/admin/about-us.css', [], charitable()->get_version() ); // Enqueue JavaScript wp_enqueue_script( 'charitable-admin-about', charitable()->get_path( 'assets', false ) . 'js/admin/about-us.js', [ 'jquery' ], charitable()->get_version(), true ); // Enqueue addons JavaScript wp_enqueue_script( 'charitable-admin-addons', charitable()->get_path( 'assets', false ) . 'js/admin/charitable-admin-addons.js', [ 'jquery' ], charitable()->get_version(), true ); // Localize addons script wp_localize_script( 'charitable-admin-addons', 'charitable_admin_addons', array( 'ajax_url' => admin_url( 'admin-ajax.php' ), 'nonce' => wp_create_nonce( 'charitable_admin_addons' ), ) ); } /** * Get the current view. * * @since 1.8.7.6 * * @return string */ public function get_view() { return $this->view; } /** * Get license data for a specific feature and license level. * * @since 1.8.7.6 * * @param string $feature The feature slug. * @param string $license The license level. * @return array|false */ public function get_license_data( $feature, $license ) { $data = $this->get_licenses_data(); if ( ! isset( $data[ $feature ][ $license ] ) ) { return false; } return $data[ $feature ][ $license ]; } /** * Get all licenses data. * * @since 1.8.7.6 * * @return array */ private function get_licenses_data() { return array( 'campaigns' => array( 'lite' => array( 'status' => 'full', 'text' => array( '' . esc_html__( 'Unlimited Campaigns', 'charitable' ) . '', ), ), 'pro' => array( 'status' => 'full', 'text' => array( '' . esc_html__( 'Unlimited Campaigns', 'charitable' ) . '', ), ), ), 'payment_gateways' => array( 'lite' => array( 'status' => 'full', 'text' => array( '' . esc_html__( 'Stripe, Square, PayPal Standard and Offline Donations', 'charitable' ) . '', ), ), 'pro' => array( 'status' => 'full', 'text' => array( '' . esc_html__( 'Authorize.Net, Windcave, Mollie, Braintree, PayFast, GoCardless, Payrexx, and more', 'charitable' ) . '', ), ), ), 'recurring_donations' => array( 'lite' => array( 'status' => 'none', 'text' => array( '' . esc_html__( 'Not Available', 'charitable' ) . '', ), ), 'pro' => array( 'status' => 'full', 'text' => array( '' . esc_html__( 'Accept weekly, monthly, quarterly, semiannual, or annual donations', 'charitable' ) . '', ), ), ), 'suggested_amounts' => array( 'lite' => array( 'status' => 'full', 'text' => array( '' . esc_html__( 'Available', 'charitable' ) . '', ), ), 'pro' => array( 'status' => 'full', 'text' => array( '' . esc_html__( 'Advanced customization & recurring options', 'charitable' ) . '', ), ), ), 'fundraising_goals' => array( 'lite' => array( 'status' => 'partial', 'text' => array( '' . esc_html__( 'Basic goal display', 'charitable' ) . '', ), ), 'pro' => array( 'status' => 'full', 'text' => array( '' . esc_html__( 'Advanced goal tracking with flexible styles & progress bars', 'charitable' ) . '', ), ), ), 'peer_to_peer' => array( 'lite' => array( 'status' => 'none', 'text' => array( '' . esc_html__( 'Not Available', 'charitable' ) . '', ), ), 'pro' => array( 'status' => 'full', 'text' => array( '' . esc_html__( 'Let supporters create their own fundraising pages & track their progress', 'charitable' ) . '', ), ), ), 'ambassadors' => array( 'lite' => array( 'status' => 'none', 'text' => array( '' . esc_html__( 'Not Available', 'charitable' ) . '', ), ), 'pro' => array( 'status' => 'full', 'text' => array( '' . esc_html__( 'Recruit ambassadors & teams to raise funds on your behalf', 'charitable' ) . '', ), ), ), 'donation_data' => array( 'lite' => array( 'status' => 'full', 'text' => array( '' . esc_html__( 'Full donation record management', 'charitable' ) . '', ), ), 'pro' => array( 'status' => 'full', 'text' => array( '' . esc_html__( 'Full donation and donor records', 'charitable' ) . '', ), ), ), 'donor_comments' => array( 'lite' => array( 'status' => 'none', 'text' => array( '' . esc_html__( 'Not Available', 'charitable' ) . '', ), ), 'pro' => array( 'status' => 'full', 'text' => array( '' . esc_html__( 'Allow donors to leave public or private comments', 'charitable' ) . '', ), ), ), 'donor_dashboard' => array( 'lite' => array( 'status' => 'none', 'text' => array( '' . esc_html__( 'Not Available', 'charitable' ) . '', ), ), 'pro' => array( 'status' => 'full', 'text' => array( '' . esc_html__( 'Donors manage their giving, receipts, and payment methods', 'charitable' ) . '', ), ), ), 'pdf_receipts' => array( 'lite' => array( 'status' => 'none', 'text' => array( '' . esc_html__( 'Not Available', 'charitable' ) . '', ), ), 'pro' => array( 'status' => 'full', 'text' => array( '' . esc_html__( 'Automatically generate & send professional receipts', 'charitable' ) . '', ), ), ), 'fee_relief' => array( 'lite' => array( 'status' => 'none', 'text' => array( '' . esc_html__( 'Not Available', 'charitable' ) . '', ), ), 'pro' => array( 'status' => 'full', 'text' => array( '' . esc_html__( 'Let donors cover processing fees', 'charitable' ) . '', ), ), ), 'marketing' => array( 'lite' => array( 'status' => 'none', 'text' => array( '' . esc_html__( 'Not Available', 'charitable' ) . '', ), ), 'pro' => array( 'status' => 'full', 'text' => array( '' . esc_html__( 'Mailchimp, MailerLite, Campaign Monitor, and more', 'charitable' ) . '', ), ), ), 'reporting' => array( 'lite' => array( 'status' => 'partial', 'text' => array( '' . esc_html__( 'Basic reports', 'charitable' ) . '', ), ), 'pro' => array( 'status' => 'full', 'text' => array( '' . esc_html__( 'Advancing reports (including LYBUNT, SYBUNT, and detailed donor reports) & insights', 'charitable' ) . '', ), ), ), 'extensions' => array( 'lite' => array( 'status' => 'none', 'text' => array( '' . esc_html__( 'None', 'charitable' ) . '', ), ), 'pro' => array( 'status' => 'full', 'text' => array( '' . esc_html__( 'All Pro Extensions included', 'charitable' ) . '', ), ), ), 'support' => array( 'lite' => array( 'status' => 'partial', 'text' => array( '' . esc_html__( 'Community Support Only', 'charitable' ) . '', ), ), 'pro' => array( 'status' => 'full', 'text' => array( '' . esc_html__( 'Priority Email Support', 'charitable' ) . '', ), ), ), ); return $data; } } endif;