RequirementsManager.php000064400000010541150213070600011226 0ustar00set_initial_groups(); } /** * @return RequirementsManager */ public static function get_instance() { if ( ! isset( self::$instance ) ) { self::$instance = new RequirementsManager(); } return self::$instance; } protected function set_initial_groups() { // Requirements can be added with any group key desired but only registered groups will be displayed. $this->groups = apply_filters( 'ngg_admin_requirements_manager_groups', [ 'phpext' => esc_html__( 'NextGen Gallery requires the following PHP extensions to function correctly. Please contact your hosting provider or systems admin and ask them for assistance:', 'nggallery' ), 'phpver' => esc_html__( 'NextGen Gallery has degraded functionality because of your PHP version. Please contact your hosting provider or systems admin and ask them for assistance:', 'nggallery' ), 'dirperms' => esc_html__( 'NextGen Gallery has found an issue trying to access the following files or directories. Please ensure the following locations have the correct permissions:', 'nggallery' ), ] ); } public static function register_requirements() { $manager = self::get_instance(); $manager->add( 'nextgen_data_sanitation', 'phpext', function () { return class_exists( 'DOMDocument' ); }, [ 'message' => esc_html__( 'XML is strongly encouraged for safely editing image data', 'nggallery' ) ] ); $manager->add( 'nextgen_data_gd_requirement', 'phpext', function () { return function_exists( 'gd_info' ); }, [ 'message' => esc_html__( 'GD is required for generating image thumbnails, resizing images, and generating watermarks', 'nggallery' ), 'dismissable' => false, ] ); $manager->add( 'nextgen_data_ctypes_requirement', 'phpext', function () { return function_exists( 'ctype_lower' ); }, [ 'message' => esc_html__( 'ctype methods are required for securing user submitted data', 'nggallery' ), 'dismissable' => false, ] ); } /** * @param string $name Unique notification ID * @param string $group Choose one of phpext | phpver | dirperms * @param callable $callback Method that determines whether the notification should display * @param array $data Possible keys: className, message, dismissable */ public function add( $name, $group, $callback, $data ) { $this->requirements[ $group ][ $name ] = new RequirementsNotice( $name, $callback, $data ); } /** * @param string $name */ public function remove( $name ) { unset( $this->notifications[ $name ] ); } public function create_notification() { foreach ( $this->groups as $groupID => $groupLabel ) { if ( empty( $this->requirements[ $groupID ] ) ) { continue; } $dismissable = true; $notices = []; foreach ( $this->requirements[ $groupID ] as $key => $requirement ) { $passOrFail = $requirement->run_callback(); if ( ! $passOrFail ) { // If any of the notices can't be dismissed then all notices in that group can't be dismissed. if ( ! $requirement->is_dismissable() ) { // Add important notices to the beginning of the list. $dismissable = false; array_unshift( $notices, $requirement ); } else { $notices[] = $requirement; } } } // Don't display empty group notices. if ( empty( $notices ) ) { continue; } // Generate the combined message for this group. $message = '

' . $this->groups[ $groupID ] . '

'; // Generate the notice object. $name = 'ngg_requirement_notice_' . $groupID . '_' . md5( $message ); $notice = new RequirementsNotice( $name, '__return_true', [ 'dismissable' => $dismissable, 'message' => $message, ] ); NotificationsManager::get_instance()->add( $name, $notice ); } } } FormManager.php000064400000004453150213070600007453 0ustar00forms[ $type ] ) ) { return; } $index_one = array_search( $form_name, $this->forms[ $type ], true ); $index_two = array_search( $form_to_follow_name, $this->forms[ $type ], true ); if ( ! $index_one || ! $index_two ) { return; } $value = $this->forms[ $type ][ $index_one ]; unset( $this->forms[ $type ][ $index_one ] ); array_splice( $this->forms[ $type ], $index_two + 1, 0, $value ); } /** * @param string $type * @param array|string $form_names * @return int Results of get_form_count($type) */ public function add_form( $type, $form_names ) { if ( ! isset( $this->forms[ $type ] ) ) { $this->forms[ $type ] = []; } if ( ! is_array( $form_names ) ) { $form_names = [ $form_names ]; } foreach ( $form_names as $form ) { $this->forms[ $type ][] = $form; } return $this->get_form_count( $type ); } /** * @param string $type * @param bool $instantiate (optional). * @return array */ public function get_forms( $type, $instantiate = false ) { $retval = []; if ( isset( $this->forms[ $type ] ) ) { if ( ! $instantiate ) { $retval = $this->forms[ $type ]; } else { foreach ( $this->forms[ $type ] as $context ) { if ( class_exists( '\C_Component_Registry' ) ) { $retval[] = \C_Component_Registry::get_instance()->get_utility( 'I_Form', $context ); } } } } return $retval; } /** * @param string $type Form type. * @return int */ public function get_form_count( $type ) { return ( isset( $this->forms[ $type ] ) ) ? count( $this->forms[ $type ] ) : 0; } } About.php000064400000105562150213070600006332 0ustar00 */ class About { /** * Imagely Welcome Pages. * * @var array */ public $pages = [ 'nextgen-about-us', ]; /** * Holds the submenu pagehook. * * @since 1.7.0 * * @var string` */ public $hook; /** * Helper method for installed plugins * * @since 1.7.0 * * @var array */ public $installed_plugins; /** * Class Hooks * * @since 1.8.7 * * @return void */ public function hooks() { // Add custom addons submenu. add_action( 'admin_menu', [ $this, 'admin_menu' ], 15 ); // Add scripts and styles. add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_admin_styles' ] ); add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_admin_scripts' ] ); // Misc. add_action( 'admin_print_scripts', [ $this, 'disable_admin_notices' ] ); // Ajax. add_action( 'wp_ajax_nextgen_install_am_plugin', [ $this, 'install_am_plugin' ] ); add_action( 'wp_ajax_nextgen_deactivate_am_plugin', [ $this, 'deactivate_am_plugin' ] ); add_action( 'wp_ajax_nextgen_activate_am_plugin', [ $this, 'activate_am_plugin' ] ); } /** * Register and enqueue addons page specific JS. * * @since 1.5.0 */ public function enqueue_admin_scripts() { global $current_screen; if ( ! empty( $current_screen->base ) && strpos( $current_screen->base, 'nextgen-gallery_page' ) !== false ) { wp_register_script( NGG_PLUGIN_SLUG . '-about-script', plugins_url( 'assets/js/min/about-min.js', NGG_PLUGIN_FILE ), [ 'jquery' ], NGG_PLUGIN_VERSION, true ); wp_enqueue_script( NGG_PLUGIN_SLUG . '-about-script' ); wp_localize_script( NGG_PLUGIN_SLUG . '-about-script', 'nextgen_about', [ 'ajax' => admin_url( 'admin-ajax.php' ), 'activate_nonce' => wp_create_nonce( 'nextgen-activate-partner' ), 'deactivate_nonce' => wp_create_nonce( 'nextgen-deactivate-partner' ), 'install_nonce' => wp_create_nonce( 'nextgen-install-partner' ), 'active' => __( 'Status: Active', 'nggallery' ), 'activate' => __( 'Activate', 'nggallery' ), 'activating' => __( 'Activating...', 'nggallery' ), 'deactivate' => __( 'Deactivate', 'nggallery' ), 'deactivating' => __( 'Deactivating...', 'nggallery' ), 'inactive' => __( 'Status: Inactive', 'nggallery' ), 'install' => __( 'Install', 'nggallery' ), 'installing' => __( 'Installing...', 'nggallery' ), 'proceed' => __( 'Proceed', 'nggallery' ), ] ); } } /** * Register and enqueue addons page specific CSS. * * @since 1.8.1 * * @return void */ public function enqueue_admin_styles() { global $current_screen; if ( ! empty( $current_screen->base ) && strpos( $current_screen->base, 'nextgen-gallery-about-us' ) !== false ) { wp_register_style( NGG_PLUGIN_SLUG . '-about-style', plugins_url( 'assets/css/about.css', NGG_PLUGIN_FILE ), [], NGG_PLUGIN_VERSION ); wp_enqueue_style( NGG_PLUGIN_SLUG . '-about-style' ); } // Run a hook to load in custom styles. do_action( 'nextgen_about_styles' ); } /** * Making page as clean as possible * * @since 1.8.1 * * @return void */ public function disable_admin_notices() { global $wp_filter; global $current_screen; if ( ! empty( $current_screen->base ) && strpos( $current_screen->base, 'nextgen-gallery_page' ) !== false ) { if ( isset( $wp_filter['user_admin_notices'] ) ) { unset( $wp_filter['user_admin_notices'] ); } if ( isset( $wp_filter['admin_notices'] ) ) { unset( $wp_filter['admin_notices'] ); } if ( isset( $wp_filter['all_admin_notices'] ) ) { unset( $wp_filter['all_admin_notices'] ); } } } /** * Helper Method to get AM Plugins * * @since 1.8.7 * * @return array */ public function get_am_plugins() { $images_url = trailingslashit( NGG_PLUGIN_URI . 'assets/images/about' ); $plugins = [ 'optinmonster' => [ 'icon' => $images_url . 'plugin-om.png', 'name' => esc_html__( 'OptinMonster', 'nggallery' ), 'description' => esc_html__( 'Instantly get more subscribers, leads, and sales with the #1 conversion optimization toolkit. Create high converting popups, announcement bars, spin a wheel, and more with smart targeting and personalization.', 'nggallery' ), 'wporg' => 'https://wordpress.org/plugins/optinmonster/', 'url' => 'https://downloads.wordpress.org/plugin/optinmonster.zip', 'basename' => 'optinmonster/optin-monster-wp-api.php', ], 'google-analytics-for-wordpress' => [ 'icon' => $images_url . 'plugin-mi.png', 'name' => esc_html__( 'MonsterInsights', 'nggallery' ), 'description' => esc_html__( 'The leading WordPress analytics plugin that shows you how people find and use your website, so you can make data driven decisions to grow your business. Properly set up Google Analytics without writing code.', 'nggallery' ), 'wporg' => 'https://wordpress.org/plugins/google-analytics-for-wordpress/', 'url' => 'https://downloads.wordpress.org/plugin/google-analytics-for-wordpress.zip', 'basename' => 'google-analytics-for-wordpress/googleanalytics.php', 'pro' => [ 'plug' => 'google-analytics-premium/googleanalytics-premium.php', 'icon' => $images_url . 'plugin-mi.png', 'name' => esc_html__( 'MonsterInsights Pro', 'nggallery' ), 'description' => esc_html__( 'The leading WordPress analytics plugin that shows you how people find and use your website, so you can make data driven decisions to grow your business. Properly set up Google Analytics without writing code.', 'nggallery' ), 'url' => 'https://www.monsterinsights.com/?utm_source=imagelylite&utm_medium=link&utm_campaign=About%20Imagely', 'act' => 'go-to-url', ], ], 'wp-mail-smtp/wp_mail_smtp.php' => [ 'icon' => $images_url . 'plugin-smtp.png', 'name' => esc_html__( 'WP Mail SMTP', 'nggallery' ), 'description' => esc_html__( "Improve your WordPress email deliverability and make sure that your website emails reach user's inbox with the #1 SMTP plugin for WordPress. Over 3 million websites use it to fix WordPress email issues.", 'nggallery' ), 'wporg' => 'https://wordpress.org/plugins/wp-mail-smtp/', 'url' => 'https://downloads.wordpress.org/plugin/wp-mail-smtp.zip', 'basename' => 'wp-mail-smtp/wp_mail_smtp.php', 'pro' => [ 'plug' => 'wp-mail-smtp-pro/wp_mail_smtp.php', 'icon' => $images_url . 'plugin-smtp.png', 'name' => esc_html__( 'WP Mail SMTP Pro', 'nggallery' ), 'description' => esc_html__( "Improve your WordPress email deliverability and make sure that your website emails reach user's inbox with the #1 SMTP plugin for WordPress. Over 3 million websites use it to fix WordPress email issues.", 'nggallery' ), 'url' => 'https://wpmailsmtp.com/?utm_source=imagelylite&utm_medium=link&utm_campaign=About%20Imagely', 'act' => 'go-to-url', ], ], 'all-in-one-seo-pack/all_in_one_seo_pack.php' => [ 'icon' => $images_url . 'plugin-aioseo.png', 'name' => esc_html__( 'AIOSEO', 'nggallery' ), 'description' => esc_html__( "The original WordPress SEO plugin and toolkit that improves your website's search rankings. Comes with all the SEO features like Local SEO, WooCommerce SEO, sitemaps, SEO optimizer, schema, and more.", 'nggallery' ), 'wporg' => 'https://wordpress.org/plugins/all-in-one-seo-pack/', 'url' => 'https://downloads.wordpress.org/plugin/all-in-one-seo-pack.zip', 'basename' => 'all-in-one-seo-pack/all_in_one_seo_pack.php', 'pro' => [ 'plug' => 'all-in-one-seo-pack-pro/all_in_one_seo_pack.php', 'icon' => $images_url . 'plugin-aioseo.png', 'name' => esc_html__( 'AIOSEO Pro', 'nggallery' ), 'description' => esc_html__( "The original WordPress SEO plugin and toolkit that improves your website's search rankings. Comes with all the SEO features like Local SEO, WooCommerce SEO, sitemaps, SEO optimizer, schema, and more.", 'nggallery' ), 'url' => 'https://aioseo.com/?utm_source=imagelylite&utm_medium=link&utm_campaign=About%20Imagely', 'act' => 'go-to-url', ], ], 'coming-soon/coming-soon.php' => [ 'icon' => $images_url . 'plugin-seedprod.png', 'name' => esc_html__( 'SeedProd', 'nggallery' ), 'description' => esc_html__( 'The fastest drag & drop landing page builder for WordPress. Create custom landing pages without writing code, connect them with your CRM, collect subscribers, and grow your audience. Trusted by 1 million sites.', 'nggallery' ), 'wporg' => 'https://wordpress.org/plugins/coming-soon/', 'url' => 'https://downloads.wordpress.org/plugin/coming-soon.zip', 'basename' => 'coming-soon/coming-soon.php', 'pro' => [ 'plug' => 'seedprod-coming-soon-pro-5/seedprod-coming-soon-pro-5.php', 'icon' => $images_url . 'plugin-seedprod.png', 'name' => esc_html__( 'SeedProd Pro', 'nggallery' ), 'description' => esc_html__( 'The fastest drag & drop landing page builder for WordPress. Create custom landing pages without writing code, connect them with your CRM, collect subscribers, and grow your audience. Trusted by 1 million sites.', 'nggallery' ), 'url' => 'https://www.seedprod.com/?utm_source=imagelylite&utm_medium=link&utm_campaign=About%20Imagely', 'act' => 'go-to-url', ], ], 'rafflepress/rafflepress.php' => [ 'icon' => $images_url . 'plugin-rp.png', 'name' => esc_html__( 'RafflePress', 'nggallery' ), 'description' => esc_html__( 'Turn your website visitors into brand ambassadors! Easily grow your email list, website traffic, and social media followers with the most powerful giveaways & contests plugin for WordPress.', 'nggallery' ), 'wporg' => 'https://wordpress.org/plugins/rafflepress/', 'url' => 'https://downloads.wordpress.org/plugin/rafflepress.zip', 'basename' => 'rafflepress/rafflepress.php', 'pro' => [ 'plug' => 'rafflepress-pro/rafflepress-pro.php', 'icon' => $images_url . 'plugin-rp.png', 'name' => esc_html__( 'RafflePress Pro', 'nggallery' ), 'description' => esc_html__( 'Turn your website visitors into brand ambassadors! Easily grow your email list, website traffic, and social media followers with the most powerful giveaways & contests plugin for WordPress.', 'nggallery' ), 'url' => 'https://rafflepress.com/?utm_source=imagelylite&utm_medium=link&utm_campaign=About%20Imagely', 'act' => 'go-to-url', ], ], 'pushengage/main.php' => [ 'icon' => $images_url . 'plugin-pushengage.png', 'name' => esc_html__( 'PushEngage', 'nggallery' ), 'description' => esc_html__( 'Connect with your visitors after they leave your website with the leading web push notification software. Over 10,000+ businesses worldwide use PushEngage to send 15 billion notifications each month.', 'nggallery' ), 'wporg' => 'https://wordpress.org/plugins/pushengage/', 'url' => 'https://downloads.wordpress.org/plugin/pushengage.zip', 'basename' => 'pushengage/main.php', ], 'instagram-feed/instagram-feed.php' => [ 'icon' => $images_url . 'plugin-sb-instagram.png', 'name' => esc_html__( 'Smash Balloon Instagram Feeds', 'nggallery' ), 'description' => esc_html__( 'Easily display Instagram content on your WordPress site without writing any code. Comes with multiple templates, ability to show content from multiple accounts, hashtags, and more. Trusted by 1 million websites.', 'nggallery' ), 'wporg' => 'https://wordpress.org/plugins/instagram-feed/', 'url' => 'https://downloads.wordpress.org/plugin/instagram-feed.zip', 'basename' => 'instagram-feed/instagram-feed.php', 'pro' => [ 'plug' => 'instagram-feed-pro/instagram-feed.php', 'icon' => $images_url . 'plugin-sb-instagram.png', 'name' => esc_html__( 'Smash Balloon Instagram Feeds Pro', 'nggallery' ), 'description' => esc_html__( 'Easily display Instagram content on your WordPress site without writing any code. Comes with multiple templates, ability to show content from multiple accounts, hashtags, and more. Trusted by 1 million websites.', 'nggallery' ), 'url' => 'https://smashballoon.com/instagram-feed/?utm_source=imagelylite&utm_medium=link&utm_campaign=About%20Imagely', 'act' => 'go-to-url', ], ], 'custom-facebook-feed/custom-facebook-feed.php' => [ 'icon' => $images_url . 'plugin-sb-fb.png', 'name' => esc_html__( 'Smash Balloon Facebook Feeds', 'nggallery' ), 'description' => esc_html__( 'Easily display Facebook content on your WordPress site without writing any code. Comes with multiple templates, ability to embed albums, group content, reviews, live videos, comments, and reactions.', 'nggallery' ), 'wporg' => 'https://wordpress.org/plugins/custom-facebook-feed/', 'url' => 'https://downloads.wordpress.org/plugin/custom-facebook-feed.zip', 'basename' => 'custom-facebook-feed/custom-facebook-feed.php', 'pro' => [ 'plug' => 'custom-facebook-feed-pro/custom-facebook-feed.php', 'icon' => $images_url . 'plugin-sb-fb.png', 'name' => esc_html__( 'Smash Balloon Facebook Feeds Pro', 'nggallery' ), 'description' => esc_html__( 'Easily display Facebook content on your WordPress site without writing any code. Comes with multiple templates, ability to embed albums, group content, reviews, live videos, comments, and reactions.', 'nggallery' ), 'url' => 'https://smashballoon.com/custom-facebook-feed/?utm_source=imagelylite&utm_medium=link&utm_campaign=About%20Imagely', 'act' => 'go-to-url', ], ], 'feeds-for-youtube/youtube-feed.php' => [ 'icon' => $images_url . 'plugin-sb-youtube.png', 'name' => esc_html__( 'Smash Balloon YouTube Feeds', 'nggallery' ), 'description' => esc_html__( 'Easily display YouTube videos on your WordPress site without writing any code. Comes with multiple layouts, ability to embed live streams, video filtering, ability to combine multiple channel videos, and more.', 'nggallery' ), 'wporg' => 'https://wordpress.org/plugins/feeds-for-youtube/', 'url' => 'https://downloads.wordpress.org/plugin/feeds-for-youtube.zip', 'basename' => 'feeds-for-youtube/youtube-feed.php', 'pro' => [ 'plug' => 'youtube-feed-pro/youtube-feed.php', 'icon' => $images_url . 'plugin-sb-youtube.png', 'name' => esc_html__( 'Smash Balloon YouTube Feeds Pro', 'nggallery' ), 'description' => esc_html__( 'Easily display YouTube videos on your WordPress site without writing any code. Comes with multiple layouts, ability to embed live streams, video filtering, ability to combine multiple channel videos, and more.', 'nggallery' ), 'url' => 'https://smashballoon.com/youtube-feed/?utm_source=imagelylite&utm_medium=link&utm_campaign=About%20Imagely', 'act' => 'go-to-url', ], ], 'custom-twitter-feeds/custom-twitter-feed.php' => [ 'icon' => $images_url . 'plugin-sb-twitter.png', 'name' => esc_html__( 'Smash Balloon Twitter Feeds', 'nggallery' ), 'description' => esc_html__( 'Easily display Twitter content in WordPress without writing any code. Comes with multiple layouts, ability to combine multiple Twitter feeds, Twitter card support, tweet moderation, and more.', 'nggallery' ), 'wporg' => 'https://wordpress.org/plugins/custom-twitter-feeds/', 'url' => 'https://downloads.wordpress.org/plugin/custom-twitter-feeds.zip', 'basename' => 'custom-twitter-feeds/custom-twitter-feed.php', 'pro' => [ 'plug' => 'custom-twitter-feeds-pro/custom-twitter-feed.php', 'icon' => $images_url . 'plugin-sb-twitter.png', 'name' => esc_html__( 'Smash Balloon Twitter Feeds Pro', 'nggallery' ), 'description' => esc_html__( 'Easily display Twitter content in WordPress without writing any code. Comes with multiple layouts, ability to combine multiple Twitter feeds, Twitter card support, tweet moderation, and more.', 'nggallery' ), 'url' => 'https://smashballoon.com/custom-twitter-feeds/?utm_source=imagelylite&utm_medium=link&utm_campaign=About%20Imagely', 'act' => 'go-to-url', ], ], 'trustpulse-api/trustpulse.php' => [ 'icon' => $images_url . 'plugin-trustpulse.png', 'name' => esc_html__( 'TrustPulse', 'nggallery' ), 'description' => esc_html__( 'Boost your sales and conversions by up to 15% with real-time social proof notifications. TrustPulse helps you show live user activity and purchases to help convince other users to purchase.', 'nggallery' ), 'wporg' => 'https://wordpress.org/plugins/trustpulse-api/', 'url' => 'https://downloads.wordpress.org/plugin/trustpulse-api.zip', 'basename' => 'trustpulse-api/trustpulse.php', ], 'searchwp/index.php' => [ 'icon' => $images_url . 'plugin-searchwp.png', 'name' => esc_html__( 'SearchWP', 'nggallery' ), 'description' => esc_html__( 'The most advanced WordPress search plugin. Customize your WordPress search algorithm, reorder search results, track search metrics, and everything you need to leverage search to grow your business.', 'nggallery' ), 'wporg' => false, 'url' => 'https://searchwp.com/?utm_source=imagelylite&utm_medium=link&utm_campaign=About%20Imagely', 'act' => 'go-to-url', ], 'affiliate-wp/affiliate-wp.php' => [ 'icon' => $images_url . 'plugin-affwp.png', 'name' => esc_html__( 'AffiliateWP', 'nggallery' ), 'description' => esc_html__( 'The #1 affiliate management plugin for WordPress. Easily create an affiliate program for your eCommerce store or membership site within minutes and start growing your sales with the power of referral marketing.', 'nggallery' ), 'wporg' => false, 'url' => 'https://affiliatewp.com/?utm_source=imagelylite&utm_medium=link&utm_campaign=About%20Imagely', 'act' => 'go-to-url', ], 'stripe/stripe-checkout.php' => [ 'icon' => $images_url . 'plugin-wp-simple-pay.png', 'name' => esc_html__( 'WP Simple Pay', 'nggallery' ), 'description' => esc_html__( 'The #1 Stripe payments plugin for WordPress. Start accepting one-time and recurring payments on your WordPress site without setting up a shopping cart. No code required.', 'nggallery' ), 'wporg' => 'https://wordpress.org/plugins/stripe/', 'url' => 'https://downloads.wordpress.org/plugin/stripe.zip', 'basename' => 'stripe/stripe-checkout.php', 'pro' => [ 'plug' => 'wp-simple-pay-pro-3/simple-pay.php', 'icon' => $images_url . 'plugin-wp-simple-pay.png', 'name' => esc_html__( 'WP Simple Pay Pro', 'nggallery' ), 'description' => esc_html__( 'The #1 Stripe payments plugin for WordPress. Start accepting one-time and recurring payments on your WordPress site without setting up a shopping cart. No code required.', 'nggallery' ), 'url' => 'https://wpsimplepay.com/?utm_source=imagelylite&utm_medium=link&utm_campaign=About%20Imagely', 'act' => 'go-to-url', ], ], 'easy-digital-downloads/easy-digital-downloads.php' => [ 'icon' => $images_url . 'plugin-edd.png', 'name' => esc_html__( 'Easy Digital Downloads', 'nggallery' ), 'description' => esc_html__( 'The best WordPress eCommerce plugin for selling digital downloads. Start selling eBooks, software, music, digital art, and more within minutes. Accept payments, manage subscriptions, advanced access control, and more.', 'nggallery' ), 'wporg' => 'https://wordpress.org/plugins/easy-digital-downloads/', 'url' => 'https://downloads.wordpress.org/plugin/easy-digital-downloads.zip', 'basename' => 'easy-digital-downloads/easy-digital-downloads.php', ], 'sugar-calendar-lite/sugar-calendar-lite.php' => [ 'icon' => $images_url . 'plugin-sugarcalendar.png', 'name' => esc_html__( 'Sugar Calendar', 'nggallery' ), 'description' => esc_html__( 'A simple & powerful event calendar plugin for WordPress that comes with all the event management features including payments, scheduling, timezones, ticketing, recurring events, and more.', 'nggallery' ), 'wporg' => 'https://wordpress.org/plugins/sugar-calendar-lite/', 'url' => 'https://downloads.wordpress.org/plugin/sugar-calendar-lite.zip', 'basename' => 'sugar-calendar-lite/sugar-calendar-lite.php', 'pro' => [ 'plug' => 'sugar-calendar/sugar-calendar.php', 'icon' => $images_url . 'plugin-sugarcalendar.png', 'name' => esc_html__( 'Sugar Calendar Pro', 'nggallery' ), 'description' => esc_html__( 'A simple & powerful event calendar plugin for WordPress that comes with all the event management features including payments, scheduling, timezones, ticketing, recurring events, and more.', 'nggallery' ), 'url' => 'https://sugarcalendar.com/?utm_source=imagelylite&utm_medium=link&utm_campaign=About%20Imagely', 'act' => 'go-to-url', ], ], 'charitable/charitable.php' => [ 'icon' => $images_url . 'plugin-charitable.png', 'name' => esc_html__( 'WP Charitable', 'nggallery' ), 'description' => esc_html__( 'Top-rated WordPress donation and fundraising plugin. Over 10,000+ non-profit organizations and website owners use Charitable to create fundraising campaigns and raise more money online.', 'nggallery' ), 'wporg' => 'https://wordpress.org/plugins/charitable/', 'url' => 'https://downloads.wordpress.org/plugin/charitable.zip', 'basename' => 'charitable/charitable.php', ], 'insert-headers-and-footers/ihaf.php' => [ 'icon' => $images_url . 'plugin-wpcode.png', 'name' => esc_html__( 'WPCode', 'nggallery' ), 'description' => esc_html__( 'Future proof your WordPress customizations with the most popular code snippet management plugin for WordPress. Trusted by over 1,500,000+ websites for easily adding code to WordPress right from the admin area.', 'nggallery' ), 'wporg' => 'https://wordpress.org/plugins/insert-headers-and-footers/', 'url' => 'https://downloads.wordpress.org/plugin/insert-headers-and-footers.zip', 'basename' => 'insert-headers-and-footers/ihaf.php', ], 'duplicator/duplicator.php' => [ 'icon' => $images_url . 'plugin-duplicator.png', 'name' => esc_html__( 'Duplicator', 'nggallery' ), 'description' => esc_html__( 'Leading WordPress backup & site migration plugin. Over 1,500,000+ smart website owners use Duplicator to make reliable and secure WordPress backups to protect their websites. It also makes website migration really easy.', 'nggallery' ), 'wporg' => 'https://wordpress.org/plugins/duplicator/', 'url' => 'https://downloads.wordpress.org/plugin/duplicator.zip', 'basename' => 'duplicator/duplicator.php', ], 'soliloquy' => [ 'icon' => $images_url . 'soliloquy.png', 'name' => esc_html__( 'Slider by Soliloquy – Responsive Image Slider for WordPress', 'nggallery' ), 'description' => esc_html__( 'The best WordPress slider plugin. Drag & Drop responsive slider builder that helps you create a beautiful image slideshows with just a few clicks.', 'nggallery' ), 'url' => 'https://downloads.wordpress.org/plugin/soliloquy-lite.zip', 'basename' => 'soliloquy-lite/soliloquy-lite.php', ], ]; return $plugins; } /** * Register the Welcome submenu item for Imagely. * * @since 1.8.1 * * @return void */ public function admin_menu() { global $submenu; $whitelabel = apply_filters( 'nextgen_whitelabel', false ) ? '' : esc_html__( 'NextGen Gallery ', 'nggallery' ); // Register the submenus. add_submenu_page( NGGFOLDER, $whitelabel . esc_html__( 'About Us', 'nggallery' ), ' ' . esc_html__( 'About Us', 'nggallery' ) . '', apply_filters( 'nextgen_menu_cap', 'manage_options' ), NGG_PLUGIN_SLUG . '-about-us', [ $this, 'about_page' ] ); } /** * Output tab navigation * * @since 2.2.0 * * @param string $tab Tab to highlight as active. */ public static function tab_navigation( $tab = 'whats_new' ) { ?>

<?php esc_attr_e( 'Team', 'nggallery' ); ?>
get_am_plugins() as $partner ) : $this->get_plugin_card( $partner ); endforeach; ?>
installed_plugins = get_plugins(); if ( ( isset( $plugin['basename'] ) && ! isset( $this->installed_plugins[ $plugin['basename'] ] ) ) || isset( $plugin['act'] ) ) { ?>
<?php esc_attr_e( 'Icon', 'nggallery' ); ?>

<?php esc_attr_e( 'Icon', 'nggallery' ); ?>

<?php esc_attr_e( 'Icon', 'nggallery' ); ?>

esc_html__( 'You are not allowed to activate plugins.', 'nggallery' ) ] ); } // Activate the addon. if ( isset( $_POST['basename'] ) ) { $activate = activate_plugin( sanitize_text_field( wp_unslash( $_POST['basename'] ) ) ); if ( is_wp_error( $activate ) ) { echo wp_json_encode( [ 'error' => $activate->get_error_message() ] ); die; } } echo wp_json_encode( true ); die; } /** * Helper method to deactivate partner * * @since 1.90 * * @return void */ public function deactivate_am_plugin() { // Run a security check first. check_admin_referer( 'nextgen-deactivate-partner', 'nonce' ); if ( ! current_user_can( 'activate_plugins' ) ) { wp_send_json_error( [ 'message' => esc_html__( 'You are not allowed to deactivate plugins.', 'nggallery' ) ] ); } // Deactivate the addon. if ( isset( $_POST['basename'] ) ) { deactivate_plugins( sanitize_text_field( wp_unslash( $_POST['basename'] ) ) ); } echo wp_json_encode( true ); die; } /** * Helper method to install partner * * @since 1.90 * * @return void */ public function install_am_plugin() { check_admin_referer( 'nextgen-install-partner', 'nonce' ); if ( ! current_user_can( 'install_plugins' ) ) { wp_send_json_error( [ 'message' => esc_html__( 'You are not allowed to install plugins.', 'nggallery' ) ] ); } // Install the addon. if ( isset( $_POST['download_url'] ) ) { $download_url = esc_url_raw( wp_unslash( $_POST['download_url'] ) ); global $hook_suffix; // Set the current screen to avoid undefined notices. set_current_screen(); $method = ''; $url = esc_url_raw( admin_url( 'admin.php?page=nextgen-gallery-about-us' ) ); // Start output bufferring to catch the filesystem form if credentials are needed. ob_start(); $creds = request_filesystem_credentials( $url, $method, false, false, null ); if ( false === $creds ) { $form = ob_get_clean(); echo wp_json_encode( [ 'form' => $form ] ); die; } // If we are not authenticated, make it happen now. if ( ! WP_Filesystem( $creds ) ) { ob_start(); request_filesystem_credentials( $url, $method, true, false, null ); $form = ob_get_clean(); echo wp_json_encode( [ 'form' => $form ] ); die; } // We do not need any extra credentials if we have gotten this far, so let's install the plugin. require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; // Create the plugin upgrader with our custom skin. $skin = new \Imagely\NGG\Util\Installer_Skin(); $installer = new \Plugin_Upgrader( $skin ); $installer->install( $download_url ); // Flush the cache and return the newly installed plugin basename. wp_cache_flush(); if ( $installer->plugin_info() ) { $plugin_basename = $installer->plugin_info(); $active = activate_plugin( $plugin_basename, false, false, true ); wp_send_json_success( [ 'plugin' => $plugin_basename ] ); die(); } } // Send back a response. echo wp_json_encode( true ); die; } } Onboarding_Wizard.php000064400000060464150213070600010663 0ustar00load_onboarding_wizard(); } /** * Load the Onboarding Wizard template. * * @since 3.59.4 * * @return void */ private function load_onboarding_wizard() { $this->enqueue_scripts(); $this->onboarding_wizard_header(); $this->onboarding_wizard_content(); $this->onboarding_wizard_footer(); exit; } /** * Enqueue scripts for the setup wizard. * * @since 3.59.4 * * @return void */ private function enqueue_scripts() { // We don't want any plugin adding notices to our screens. Let's clear them out here. remove_all_actions( 'admin_notices' ); remove_all_actions( 'all_admin_notices' ); $router = \Imagely\NGG\Util\Router::get_instance(); // TODO: Add minified js file and check nonces. wp_register_script( 'nextgen-gallery-onboarding-wizard', plugins_url( 'assets/js/dist/onboarding-wizard.js', NGG_PLUGIN_FILE ), [ 'jquery' ], NGG_PLUGIN_VERSION, true ); wp_localize_script( 'nextgen-gallery-onboarding-wizard', 'nggOnboardingWizard', [ 'ajaxUrl' => admin_url( 'admin-ajax.php' ), 'nonce' => wp_create_nonce( 'nextgen-galleryOnboardingCheck' ), 'connect_nonce' => wp_create_nonce( 'nextgen-gallery-key-nonce' ), 'plugins_list' => $this->get_installed_plugins(), ] ); wp_register_style( 'nextgen-gallery-onboarding-wizard', plugins_url( 'assets/css/onboarding-wizard.css', NGG_PLUGIN_FILE ), [], NGG_PLUGIN_VERSION ); wp_enqueue_style( 'nextgen-gallery-onboarding-wizard' ); wp_enqueue_style( 'common' ); wp_enqueue_media(); } /** * Setup the wizard header. * * @since 3.59.4 * * @return void */ private function onboarding_wizard_header() { ?> dir="ltr"> <?php // translators: %s is the plugin name. printf( esc_html__( '%1$s › Onboarding Wizard', 'nextgen-gallery-gallery' ), esc_html( 'NextGEN Gallery' ) ); ?> 'all-in-one-seo-pack/all_in_one_seo_pack.php', 'wpforms-lite' => 'wpforms-lite/wpforms.php', 'google-analytics-for-wordpress' => 'google-analytics-for-wordpress/googleanalytics.php', 'duplicator' => 'duplicator/duplicator.php', 'wp-mail-smtp' => 'wp-mail-smtp/wp_mail_smtp.php', ]; return $plugins; } /** * Check if a recommended plugin is installed. * * @param string $recommended The plugin slug. * * @return string */ public function is_recommended_plugin_installed( string $recommended ): string { // Check if these plugins are installed already or not. $all_plugins = get_plugins(); $plugins = $this->get_recommended_plugins(); $plugin = ''; $plus = 'nextgen-gallery-plus/ngg-plus.php'; $pro = 'nextgen-gallery-pro/nggallery-pro.php'; $starter = 'nextgen-gallery-pro/ngg-starter.php'; // Switch case to check pro, plus and starter plugins. switch ( $recommended ) { // if $recommended contains plus, then set $plugin to plus. case strpos( $recommended, '-plus' ) !== false: $plugin = $plus; break; // if $recommended contains pro, then set $plugin to pro. case strpos( $recommended, 'gallery-pro' ) !== false: $plugin = $pro; break; // if $recommended contains starter, then set $plugin to starter. case strpos( $recommended, '-starter' ) !== false: $plugin = $starter; break; } // Check if $recommended is a NextGEN Gallery plugin. if ( array_key_exists( $recommended, $plugins ) && '' === $plugin ) { // check if key exists in the array. $plugin = $plugins[ $recommended ]; } if ( in_array( $plugin, array_keys( $all_plugins ), true ) ) { return 'no-clicks disabled'; } return ''; } /** * Get saved onboarding data. * * @param string $key The key to get the data. * * @return mixed */ public function get_onboarding_data( string $key ) { if ( ! empty( $key ) ) { $onboarding_data = get_option( 'ngg_onboarding_data' ); if ( ! empty( $onboarding_data ) && isset( $onboarding_data[ $key ] ) ) { return $onboarding_data[ $key ]; } } return ''; } /** * Save the onboarding data. * * @return void */ public function save_onboarding_data() { // check for nonce nextgen-galleryOnboardingCheck. if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['nonce'] ) ), 'nextgen-galleryOnboardingCheck' ) ) { wp_send_json_error( 'Invalid nonce' ); wp_die(); } // check if the current user can manage options. if ( ! current_user_can( 'manage_options' ) ) { wp_send_json_error( 'You do not have permission to save data' ); wp_die(); } if ( ! empty( $_POST['eow'] ) ) { // Sanitize data and merge to existing data. $onboarding_data = get_option( 'ngg_onboarding_data', [] ); $onboarding_data = $this->sanitize_and_assign( '_usage_tracking', 'sanitize_text_field', $onboarding_data ); $onboarding_data = $this->sanitize_and_assign( '_email_address', 'sanitize_email', $onboarding_data ); $onboarding_data = $this->sanitize_and_assign( '_email_opt_in', 'sanitize_text_field', $onboarding_data ); $onboarding_data = $this->sanitize_and_assign( '_user_type', 'sanitize_text_field', $onboarding_data ); $onboarding_data = $this->sanitize_and_assign( '_others', 'sanitize_text_field', $onboarding_data ); $stats_sent = $onboarding_data['usage_stats_init'] ?? false; $usage_tracking = filter_var( $onboarding_data['_usage_tracking'], FILTER_VALIDATE_BOOLEAN ); if ( $usage_tracking && ! $stats_sent ) { // Send usage tracking on onboarding settings save. ( new UsageTracking() )->send_checkin( true ); $onboarding_data['usage_stats_init'] = true; } update_option( 'ngg_onboarding_data', $onboarding_data ); // Send data to Drip. $this->save_to_drip( $onboarding_data ); wp_send_json_success( 'Data saved successfully' ); wp_die(); } wp_send_json_error( 'Something went wrong. Please try again.' ); wp_die(); } /** * Sanitize and assign the data. * * @param string $key The key to get the data. * @param string $sanitize_function The sanitize function. * @param array $onboarding_data The onboarding data. * * @return array */ public function sanitize_and_assign( string $key, string $sanitize_function, array $onboarding_data ): array { if ( ! function_exists( $sanitize_function ) ) { _doing_it_wrong( __METHOD__, 'Invalid sanitize function', '3.59.4' ); return $onboarding_data; } // phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized if ( isset( $_POST['eow'][ $key ] ) ) { // Nonce is verified in the parent function. // phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized $onboarding_data[ $key ] = $sanitize_function( wp_unslash( $_POST['eow'][ $key ] ) ); } else { unset( $onboarding_data[ $key ] ); } return $onboarding_data; } /** * Save the onboarding data to Drip. * * @param array $onboarding_data The onboarding data. * * @return void */ public function save_to_drip( array $onboarding_data ) { $url = 'https://imagely.com/wp-json/imagely/v1/get_opt_in_data'; $email = sanitize_email( $onboarding_data['_email_address'] ); if ( empty( $email ) ) { return; } $tags = []; $position = ''; $tags[] = 'im-' . $this->get_license_type(); if ( isset( $onboarding_data['_user_type'] ) ) { $position = $onboarding_data['_user_type']; } $body_data = [ 'imagely-drip-email' => base64_encode( $email ), // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_encode 'imagely-drip-tags' => $tags, 'imagely-drip-position' => $position, ]; $body = wp_json_encode( $body_data ); $args = [ 'method' => 'POST', 'headers' => [ 'Content-Type' => 'application/json', 'user-agent' => 'ENVIRA/IMAGELY/' . NGG_PLUGIN_VERSION . '; ' . get_bloginfo( 'url' ), ], 'body' => $body, 'timeout' => '5', // Timeout in seconds. 'redirection' => '5', 'httpversion' => '1.0', 'blocking' => true, 'data_format' => 'body', ]; $response = wp_safe_remote_post( $url, $args ); } /** * Save selected addons to database. */ public function save_selected_addons() { // check for nonce nextgen-galleryOnboardingCheck. if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['nonce'] ) ), 'nextgen-galleryOnboardingCheck' ) ) { wp_send_json_error( 'Invalid nonce' ); wp_die(); } // check if the current user can manage options. if ( ! current_user_can( 'manage_options' ) ) { wp_send_json_error( 'You do not have permission to save data' ); wp_die(); } if ( ! empty( $_POST['addons'] ) ) { $addons = explode( ',', sanitize_text_field( wp_unslash( $_POST['addons'] ) ) ); // Sanitize data and merge to existing data. $onboarding_data = get_option( 'ngg_onboarding_data' ); if ( empty( $onboarding_data ) ) { $onboarding_data = []; } // Save addons as _addons key. $onboarding_data['_addons'] = $addons; $updated = update_option( 'ngg_onboarding_data', $onboarding_data ); wp_send_json_success( 'Addons saved successfully' ); wp_die(); } wp_send_json_error( 'Something went wrong. Please try again.' ); wp_die(); } /** * Get the license type for the current plugin. * * @since 3.59.4 * * @return string */ public function get_license_type() { if ( defined( 'NGG_PRO_PLUGIN_BASENAME' ) ) { return 'pro'; } elseif ( defined( 'NGG_PLUS_PLUGIN_BASENAME' ) ) { return 'plus'; } elseif ( defined( 'NGG_STARTER_PLUGIN_BASENAME' ) ) { return 'starter'; } return 'lite'; } /** * Install the recommended plugins and add-ons. * * @return void */ public function install_recommended_plugins() { // check for nonce nextgen-galleryOnboardingCheck. if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['nonce'] ) ), 'nextgen-galleryOnboardingCheck' ) ) { wp_send_json_error( 'Invalid nonce' ); wp_die(); } // check if the current user can manage options. if ( ! current_user_can( 'manage_options' ) ) { wp_send_json_error( 'You do not have permission to install plugins' ); wp_die(); } if ( ! empty( $_POST['plugins'] ) ) { // Sanitize data, plugins is a string delimited by comma. $plugins = explode( ',', sanitize_text_field( wp_unslash( $_POST['plugins'] ) ) ); // Install the plugins. foreach ( $plugins as $plugin ) { if ( '' !== $this->is_recommended_plugin_installed( $plugin ) ) { continue; // Skip the plugin if it is already installed. } // Generate the plugin URL by slug. $url = 'https://downloads.wordpress.org/plugin/' . $plugin . '.zip'; $this->install_helper( $url ); } } wp_send_json_success( 'Installed the recommended plugins successfully.' ); wp_die(); } /** * Helper function to install the free plugins. * * @param string $download_url The download URL. * * @return void */ public function install_helper( string $download_url ) { if ( empty( $download_url ) ) { return; } global $hook_suffix; // Set the current screen to avoid undefined notices. set_current_screen(); $method = ''; $url = esc_url( admin_url( 'index.php?page=nextgen-gallery-setup-wizard' ) ); // Start output buffering to catch the filesystem form if credentials are needed. ob_start(); $creds = request_filesystem_credentials( $url, $method, false, false, null ); if ( false === $creds ) { $form = ob_get_clean(); echo wp_json_encode( [ 'form' => $form ] ); die; } // If we are not authenticated, make it happen now. if ( ! WP_Filesystem( $creds ) ) { ob_start(); request_filesystem_credentials( $url, $method, true, false, null ); $form = ob_get_clean(); echo wp_json_encode( [ 'form' => $form ] ); die; } // We do not need any extra credentials if we have gotten this far, so let's install the plugin. require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; // Create the plugin upgrader with our custom skin. $skin = new \Imagely\NGG\Util\Installer_Skin(); $installer = new \Plugin_Upgrader( $skin ); $status = $installer->install( $download_url ); if ( is_wp_error( $status ) ) { wp_send_json_error( $status->get_error_message() ); } // Flush the cache and return. wp_cache_flush(); } /** * Verify the license key. * * @since 3.59.4 * * @return void * * Copy of maybe_verify_key in License class. * Modified to return wp_send_json_success and wp_send_json_error. */ public function ngg_plugin_verify_license_key() { if ( ! isset( $_POST['nextgen-gallery-license-key'], $_POST['nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['nonce'] ) ), 'nextgen-galleryOnboardingCheck' ) ) { wp_send_json_error( 'Invalid Request', \WP_Http::FORBIDDEN ); wp_die(); } $url = 'https://members.photocrati.com/wp-json/licensing/v1/register_site'; $license_key = isset( $_POST['nextgen-gallery-license-key'] ) ? sanitize_text_field( wp_unslash( $_POST['nextgen-gallery-license-key'] ) ) : null; if ( empty( $license_key ) ) { wp_send_json_error( 'License key is required' ); wp_die(); } $query_args = [ 'license_key' => $license_key, 'site_url' => site_url(), ]; $args = [ 'method' => 'POST', 'timeout' => 45, 'redirection' => 5, 'httpversion' => '1.0', 'body' => $query_args, 'user-agent' => 'ImagelyUpdates/' . NGG_PLUGIN_VERSION . '; ' . get_bloginfo( 'url' ), 'blocking' => true, ]; $response = wp_safe_remote_post( $url, $args ); if ( is_wp_error( $response ) ) { $error_message = $response->get_error_message(); wp_send_json_error( $error_message ); wp_die(); } else { $http_code = wp_remote_retrieve_response_code( $response ); $result = json_decode( wp_remote_retrieve_body( $response ) ); // check if the response has error and bail out. // check if the response has error and bail out. if ( isset( $result->error ) && '' !== $result->error ) { wp_send_json_error( $this->get_error_message( $result->error ) ); wp_die(); } $valid = in_array( $result->status ?? '', ['active', 'inactive','disabled'], true ) ?? false; // Check if status is active/inactive not expired or disabled. if ( 200 === $http_code && $valid ) { $product = $result->level ?? false; if ( ! $product ) { wp_send_json_error( 'Product not found.' ); wp_die(); } // Check if the product is already installed. $current_level = $this->get_license_type(); if ( $current_level === $product ) { // If the product is already installed, return success. wp_send_json_success( 'Congratulations! This site is now receiving automatic updates.' ); wp_die(); } // Check if limit is reached. if ( '' === $result->is_at_limit ) { wp_send_json_error( 'Sorry, you have reached the limit of sites for this license key.' ); wp_die(); } $url = $this->download_pro( $license_key, $product ); if ( isset( $url ) ) { $this->install_helper( $url ); } wp_send_json_success( 'Congratulations! This site is now receiving automatic updates.' ); wp_die(); } else { // if license is expired, throw error. if ( 'expired' === $result->status ) { wp_send_json_error( $this->get_error_message( 'license_expired' ) ); wp_die(); } // if license is invalid, throw error. wp_send_json_error( $this->get_error_message( null ) ); wp_die(); } } } /** * Download the pro version of the plugin. * * @param string $key The license key. * @param string $product The product name. * * @return boolean|string */ public function download_pro( string $key, string $product ) { // Check if the product already exist in the installed plugins. if( 'no-clicks disabled' === $this->is_recommended_plugin_installed( 'nextgen-gallery-' . $product ) ){ return false; } $url = 'https://members.photocrati.com/wp-json/licensing/v1/get_update?product=nextgen-gallery-' . $product . '&license_key=' . $key . '&site_url=' . site_url(); $args = [ 'method' => 'GET', 'timeout' => 45, 'redirection' => 5, 'httpversion' => '1.0', 'user-agent' => 'ImagelyUpdates/' . NGG_PLUGIN_VERSION . '; ' . get_bloginfo( 'url' ), 'blocking' => true, ]; $response = wp_safe_remote_get( $url, $args ); if ( ! is_wp_error( $response ) ) { $http_code = wp_remote_retrieve_response_code( $response ); $body = wp_remote_retrieve_body( $response ); if ( 200 === $http_code ) { return json_decode( $body )->download_url ?? ''; } else { return false; } } } /** * Get a list of installed recommended plugins and addons. * * @return array */ public function get_installed_plugins(): array { $plugins = $this->get_recommended_plugins(); // Check if these plugins are installed already or not. $all_plugins = get_plugins(); $installed = []; foreach ( $plugins as $plugin ) { if ( in_array( $plugin, array_keys( $all_plugins ), true ) ) { // Get array key of $plugins. $installed[] = array_search( $plugin, $plugins, true ); } } return $installed; } /** * Get error messages. * * @since 3.59.4 * * @param string|null $code The error message. * * @return string */ public function get_error_message( ?string $code ): string { if ( ! isset( $code ) ) { return 'Something went wrong, please try again later.'; } $message = ''; switch ( $code ) { case 'empty_site_url': $message = __( 'The site URL is missing. Please provide a valid URL.', 'nextgen-gallery' ); break; case 'license_not_found': $message = __( 'The license key was not found. Please verify and try again.', 'nextgen-gallery' ); break; case 'license_status_expired': case 'license_expired': $message = __( 'The license key has expired. Please renew your license.', 'nextgen-gallery' ); break; case 'license_status_disabled': case 'license_disabled': $message = __( 'The license key has not been activated yet. Please contact support.', 'nextgen-gallery' ); break; case 'license_status_revoked': case 'license_revoked': $message = __( 'The license key has been revoked. Please contact support.', 'nextgen-gallery' ); break; case 'license_limit_installations': $message = __( 'The license key has reached the maximum number of installations.', 'nextgen-gallery' ); break; default: $message = __( 'An unknown error occurred. Please try again.', 'nextgen-gallery' ); break; } return $message; } } Ecommerce_Preview.php000064400000002220150213070600010643 0ustar00_name = $name; $this->_data = $data; $this->_callback = $callback; } /** * @return bool */ public function is_renderable() { return true; } /** * @return bool */ public function is_dismissable() { return isset( $this->_data['dismissable'] ) ? $this->_data['dismissable'] : true; } /** * @return string */ public function render() { return $this->_data['message']; } /** * @return string */ public function get_mvc_template() { return 'photocrati-nextgen_admin#requirement_notice'; } /** * @return string */ public function get_name() { return $this->_name; } /** * @return bool */ public function run_callback() { if ( is_callable( $this->_callback ) ) { return call_user_func( $this->_callback ); } else { return false; } } /** * @return string */ public function get_css_class() { $prefix = 'notice notice-'; if ( $this->is_dismissable() ) { return $prefix . 'warning'; } else { return $prefix . 'error'; } } public function get_message() { return empty( $this->_data['message'] ) ? '' : $this->_data['message']; } } Notifications/Manager.php000064400000015207150213070600011437 0ustar00_dismiss_url = site_url( '/?ngg_dismiss_notice=1' ); } public function has_displayed_notice() { return $this->_displayed_notice; } public function add( $name, $handler ) { $this->_notifications[ $name ] = $handler; } public function remove( $name ) { unset( $this->_notifications[ $name ] ); } public function render() { $output = []; foreach ( array_keys( $this->_notifications ) as $notice ) { if ( ( $html = $this->render_notice( $notice ) ) ) { $output[] = $html; } } echo implode( "\n", $output ); } public function is_dismissed( $name ) { $retval = false; $settings = Settings::get_instance(); $dismissed = $settings->get( 'dismissed_notifications', [] ); if ( isset( $dismissed[ $name ] ) ) { if ( ( $id = get_current_user_id() ) ) { if ( in_array( $id, $dismissed[ $name ] ) ) { $retval = true; } elseif ( in_array( 'unknown', $dismissed[ $name ] ) ) { $retval = true; } } } return $retval; } public function dismiss( $name, $dismiss_code = 1 ) { $response = []; if ( ( $handler = $this->get_handler_instance( $name ) ) ) { $has_method = method_exists( $handler, 'is_dismissable' ); if ( ( $has_method && $handler->is_dismissable() ) || ! $has_method ) { if ( method_exists( $handler, 'dismiss' ) ) { $response = $handler->dismiss( $dismiss_code ); $response['handled'] = true; } if ( is_bool( $response ) ) { $response = [ 'dismiss' => $response ]; } // Set default key/values if ( ! isset( $response['handled'] ) ) { $response['handled'] = false; } if ( ! isset( $response['dismiss'] ) ) { $response['dismiss'] = true; } if ( ! isset( $response['persist'] ) ) { $response['persist'] = $response['dismiss']; } if ( ! isset( $response['success'] ) ) { $response['success'] = $response['dismiss']; } if ( ! isset( $response['code'] ) ) { $response['code'] = $dismiss_code; } if ( $response['dismiss'] ) { $settings = Settings::get_instance(); $dismissed = $settings->get( 'dismissed_notifications', [] ); if ( ! isset( $dismissed[ $name ] ) ) { $dismissed[ $name ] = []; } $user_id = get_current_user_id(); $dismissed[ $name ][] = ( $user_id ? $user_id : 'unknown' ); $settings->set( 'dismissed_notifications', $dismissed ); if ( $response['persist'] ) { $settings->save(); } } } else { $response['error'] = __( 'Notice is not dismissible', 'nggallery' ); } } else { $response['error'] = __( 'No handler defined for this notice', 'nggallery' ); } return $response; } public function get_handler_instance( $name ) { $retval = null; if ( isset( $this->_notifications[ $name ] ) ) { $handler = $this->_notifications[ $name ]; if ( is_object( $handler ) ) { $retval = $handler; } elseif ( is_array( $handler ) ) { $retval = new Wrapper( $name, $handler ); } elseif ( class_exists( $handler ) ) { $retval = call_user_func( [ $handler, 'get_instance' ], $name ); } } return $retval; } public function enqueue_scripts() { if ( $this->has_displayed_notice() ) { $router = \Imagely\NGG\Util\Router::get_instance(); wp_enqueue_script( 'ngg_admin_notices', $router->get_static_url( 'photocrati-nextgen_admin#admin_notices.js' ), [], NGG_SCRIPT_VERSION, true ); wp_localize_script( 'ngg_admin_notices', 'ngg_notification_dismiss_settings', [ 'url' => $this->_dismiss_url, 'nonce' => \wp_create_nonce( 'ngg_dismiss_notification' ), ] ); } } public function serve_ajax_request() { if ( isset( $_REQUEST['ngg_dismiss_notice'] ) ) { $retval = [ 'failure' => true ]; if ( ! headers_sent() ) { header( 'Content-Type: application/json' ); } ob_start(); if ( ! isset( $_REQUEST['nonce'] ) || ! \wp_verify_nonce( sanitize_text_field( wp_unslash( $_REQUEST['nonce'] ) ), 'ngg_dismiss_notification' ) ) { $retval['msg'] = __( 'Invalid security token', 'nggallery' ); } else { if ( ! isset( $_REQUEST['code'] ) ) { $_REQUEST['code'] = 1; } if ( isset( $_REQUEST['name'] ) ) { $retval = $this->dismiss( sanitize_text_field( wp_unslash( $_REQUEST['name'] ) ), intval( sanitize_text_field( wp_unslash( $_REQUEST['code'] ) ) ) ); } else { $retval['msg'] = __( 'Not a valid notice name', 'nggallery' ); } } ob_end_clean(); echo json_encode( $retval ); exit(); } } public function render_notice( $name ) { $retval = ''; if ( ( $handler = $this->get_handler_instance( $name ) ) && ! $this->is_dismissed( $name ) ) { // Does the handler want to render? $has_method = method_exists( $handler, 'is_renderable' ); if ( ( $has_method && $handler->is_renderable() ) || ! $has_method ) { $show_dismiss_button = false; if ( method_exists( $handler, 'show_dismiss_button' ) ) { $show_dismiss_button = $handler->show_dismiss_button(); } elseif ( method_exists( $handler, 'is_dismissable' ) ) { $show_dismiss_button = $handler->is_dismissable(); } $template = method_exists( $handler, 'get_mvc_template' ) ? $handler->get_mvc_template() : 'photocrati-nextgen_admin#admin_notice'; // The 'inline' class is necessary to prevent our notices from being moved in the DOM // see https://core.trac.wordpress.org/ticket/34570 for reference $css_class = 'inline '; $css_class .= ( method_exists( $handler, 'get_css_class' ) ? $handler->get_css_class() : 'updated' ); $view = new \C_MVC_View( $template, [ 'css_class' => $css_class, 'is_dismissable' => ( method_exists( $handler, 'is_dismissable' ) ? $handler->is_dismissable() : false ), 'html' => ( method_exists( $handler, 'render' ) ? $handler->render() : '' ), 'show_dismiss_button' => $show_dismiss_button, 'notice_name' => $name, ] ); $retval = $view->render( true ); if ( method_exists( $handler, 'enqueue_backend_resources' ) ) { $handler->enqueue_backend_resources(); } $this->_displayed_notice = true; } } return $retval; } } Notifications/Wrapper.php000064400000000570150213070600011502 0ustar00_name = $name; $this->_data = $data; } public function is_renderable() { return true; } public function is_dismissable() { return true; } public function render() { return $this->_data['message']; } } Notifications/Review.php000064400000007762150213070600011335 0ustar00_data['name'] = $params['name']; $this->_data['range'] = $params['range']; $this->_data['follows'] = $params['follows']; } public function get_name() { return $this->_data['name']; } public function get_gallery_count() { // Get the total # of galleries if we don't have them $settings = Settings::get_instance(); $count = $settings->get( 'gallery_count', false ); if ( ! $count ) { $count = \M_NextGen_Admin::update_gallery_count_setting(); } return $count; } public function get_range() { return $this->_data['range']; } public function is_renderable() { return ( $this->is_on_dashboard() || $this->is_on_ngg_admin_page() ) && $this->is_at_gallery_count() && $this->is_previous_notice_dismissed() && $this->gallery_created_flag_check(); } public function gallery_created_flag_check() { $settings = Settings::get_instance(); return $settings->get( 'gallery_created_after_reviews_introduced' ); } public function is_at_gallery_count() { $retval = false; $range = $this->_data['range']; $count = $this->get_gallery_count(); $manager = Manager::get_instance(); // Determine if we match the current range if ( $count >= $range['min'] && $count <= $range['max'] ) { $retval = true; } // If the current number of galleries exceeds the parent notice's maximum we should dismiss the parent if ( ! empty( $this->_data['follows'] ) ) { $follows = $this->_data['follows']; $parent_range = $follows->get_range(); if ( $count > $parent_range['max'] && ! $manager->is_dismissed( $follows->get_name() ) ) { $manager->dismiss( $follows->get_name(), 2 ); } } return $retval; } public function is_previous_notice_dismissed( $level = false ) { $retval = false; $manager = Manager::get_instance(); if ( empty( $level ) ) { $level = $this; } if ( ! empty( $level->_data['follows'] ) ) { $parent = $level->_data['follows']; $retval = $manager->is_dismissed( $parent->get_name() ); if ( ! $retval && ! empty( $parent->_data['follows'] ) ) { $retval = $this->is_previous_notice_dismissed( $parent ); } } else { $retval = true; } return $retval; } public function is_on_dashboard(): bool { if ( ! isset( $_SERVER['REQUEST_URI'] ) ) { return false; } return preg_match( '#/wp-admin/?(index\.php)?$#', $_SERVER['REQUEST_URI'] ) == true; } public function is_on_ngg_admin_page(): bool { if ( ! isset( $_SERVER['REQUEST_URI'] ) ) { return false; } // Do not show this notification inside of the ATP popup. // // Nonce verification is not necessary here, and should be performed by methods invoking this method. // // phpcs:disable WordPress.Security.NonceVerification.Recommended return ( preg_match( '/wp-admin.*(ngg|nextgen).*/', $_SERVER['REQUEST_URI'] ) || ( isset( $_REQUEST['page'] ) && preg_match( '/ngg|nextgen/', sanitize_text_field( wp_unslash( $_REQUEST['page'] ) ) ) ) ) && ( false === strpos( strtolower( $_SERVER['REQUEST_URI'] ), '&attach_to_post' ) ); // phpcs:enable WordPress.Security.NonceVerification.Recommended } public function render() { $view = new View( 'Admin/ReviewNotice', [ 'number' => $this->get_gallery_count() ], 'photocrati-nextgen_admin#review_notice' ); return $view->render( true ); } public function dismiss( $code ) { $retval = [ 'dismiss' => true, 'persist' => true, 'success' => true, 'code' => $code, 'dismiss_code' => $code, ]; $manager = Manager::get_instance(); if ( $code == 1 || $code == 3 ) { $retval['review_level_1'] = $manager->dismiss( 'review_level_1', 2 ); $retval['review_level_2'] = $manager->dismiss( 'review_level_2', 2 ); $retval['review_level_3'] = $manager->dismiss( 'review_level_3', 2 ); } return $retval; } } Views/header.php000064400000005242150213070600007577 0ustar00get_count(); $dismissed_count = $notifications->get_dismissed_count(); $data_count = ''; if ( $notifications_count > 0 ) { $data_count = sprintf( 'data-count="%d"', absint( $notifications_count ) ); } $is_pro = nextgen_is_plus_or_pro_enabled(); ?>

', '' ); ?>

<?php esc_attr_e( 'Nextgen Gallery', 'nggallery' ); ?>

>
Views/footer.php000064400000007554150213070600007655 0ustar00
Views/onboarding-wizard/welcome.php000064400000002460150213070600013421 0ustar00 ←  Views/onboarding-wizard/step-3.php000064400000030276150213070600013107 0ustar00
Views/onboarding-wizard/step-4.php000064400000015301150213070600013100 0ustar00 Views/onboarding-wizard/step-5.php000064400000012545150213070600013110 0ustar00 Views/onboarding-wizard/step-1.php000064400000021727150213070600013106 0ustar00 Views/onboarding-wizard/step-2.php000064400000037164150213070600013111 0ustar00 Views/notifications.php000064400000004704150213070600011222 0ustar00

' . absint( $notifications->get_count() ) . '' ); ?>

' . absint( $notifications->get_dismissed_count() ) . '' ); ?>

Views/ecommerce.php000064400000155217150213070600010316 0ustar00

', '', '', '' ); ?>

Ecommerce Options

Good work. Keep making the web beautiful.

General Options

USD
 

SALES TAX NOTE: Sales tax is complex. CLICK HERE to learn more about sales tax and how NextGEN Pro calculates it. Because we use a third party service (TaxJar), an active Pro license is required to enable sales tax.

 
 

E-mail

 

Payment Gateway

 
 
 
 
 
 
 

Print Lab Integration

DO I NEED THIS? A credit card is needed only if you want to use automated print fulfillment.

WILL YOU CHARGE ME? You will not be charged now. Your card will only be charged if someone submits a print lab order on your site. At that point, you will be billed for print and shipping costs from the print lab. You would pay those costs yourself if you worked directly with the lab. We're just automating the process for you.

IS THIS SECURE? Assuming you've enabled SSL on your website, then yes. This form sends your card information directly to Stripe, one of the world's leading payment processors. It is stored securely at Stripe, not locally by WordPress or NextGEN Gallery. Note: Without SSL, this form is not 100% secure. You should also enable SSL before receiving payments from your own visitors.

AGREEMENT: By submitting your card here, you authorise Imagely to bill your card for the cost of print lab orders.

No card on file.

Proofing

 

AMNotifications.php000064400000045471150213070600010311 0ustar00option && $cache ) { return $this->option; } $option = get_option( self::$option_name, [] ); $this->option = [ 'update' => ! empty( $option['update'] ) ? $option['update'] : 0, 'events' => ! empty( $option['events'] ) ? $option['events'] : [], 'feed' => ! empty( $option['feed'] ) ? $option['feed'] : [], 'dismissed' => ! empty( $option['dismissed'] ) ? $option['dismissed'] : [], ]; return $this->option; } /** * Fetch notifications from feed. * * @since 1.8.7 * * @return array */ public function fetch_feed() { $res = wp_remote_get( self::SOURCE_URL ); if ( is_wp_error( $res ) ) { return []; } $body = wp_remote_retrieve_body( $res ); if ( empty( $body ) ) { return []; } return $this->verify( json_decode( $body, true ) ); } /** * Verify notification data before it is saved. * * @since 1.8.7 * * @param array $notifications Array of notifications items to verify. * @return array */ public function verify( $notifications ) { $data = []; if ( ! is_array( $notifications ) || empty( $notifications ) ) { return $data; } $option = $this->get_option(); foreach ( $notifications as $notification ) { // The message and license should never be empty, if they are, ignore. if ( empty( $notification['content'] ) && empty( $notification['type'] ) ) { continue; } // Ignore if notification is not ready to display(based on start time). if ( ! empty( $notification['start'] ) && time() < strtotime( $notification['start'] ) ) { continue; } // Ignore if expired. if ( ! empty( $notification['end'] ) && time() > strtotime( $notification['end'] ) ) { continue; } // Check that the license type matches. if ( ! in_array( $this->get_license_type(), (array) $notification['type'], true ) ) { continue; } // Ignore if notification has already been dismissed. $notification_already_dismissed = false; if ( is_array( $option['dismissed'] ) && ! empty( $option['dismissed'] ) ) { foreach ( $option['dismissed'] as $dismiss_notification ) { if ( $notification['id'] === $dismiss_notification['id'] ) { $notification_already_dismissed = true; break; } } } if ( true === $notification_already_dismissed ) { continue; } $data[] = $notification; } return $data; } /** * Verify saved notification data for active notifications. * * @since 1.8.7 * * @param array $notifications Array of notifications items to verify. * @return array */ public function verify_active( $notifications ) { if ( ! is_array( $notifications ) || empty( $notifications ) ) { return []; } // Remove notifications that are not active, or if the license type not exists. foreach ( $notifications as $key => $notification ) { if ( ( ! empty( $notification['start'] ) && time() < strtotime( $notification['start'] ) ) || ( ! empty( $notification['end'] ) && time() > strtotime( $notification['end'] ) ) ) { unset( $notifications[ $key ] ); } } return $notifications; } /** * Get notification data. * * @since 1.8.7 * * @return array */ public function get() { if ( ! $this->has_access() ) { return []; } $option = $this->get_option(); // Update notifications using async task. if ( empty( $option['update'] ) || time() > $option['update'] + DAY_IN_SECONDS ) { if ( false === wp_next_scheduled( 'nextgen_admin_notifications_update' ) ) { wp_schedule_single_event( time(), 'nextgen_admin_notifications_update' ); } } $events = ! empty( $option['events'] ) ? $this->verify_active( $option['events'] ) : []; $feed = ! empty( $option['feed'] ) ? $this->verify_active( $option['feed'] ) : []; $notifications = []; $notifications['active'] = array_merge( $events, $feed ); $notifications['active'] = $this->get_notifications_with_human_readeable_start_time( $notifications['active'] ); $notifications['active'] = $this->get_notifications_with_formatted_content( $notifications['active'] ); $notifications['dismissed'] = ! empty( $option['dismissed'] ) ? $option['dismissed'] : []; $notifications['dismissed'] = $this->get_notifications_with_human_readeable_start_time( $notifications['dismissed'] ); $notifications['dismissed'] = $this->get_notifications_with_formatted_content( $notifications['dismissed'] ); return $notifications; } /** * Improve format of the content of notifications before display. By default, it just runs wpautop. * * @since 1.8.7 * * @param array $notifications The notifications to be parsed. * @return array */ public function get_notifications_with_formatted_content( $notifications ) { if ( ! is_array( $notifications ) || empty( $notifications ) ) { return $notifications; } foreach ( $notifications as $key => $notification ) { if ( ! empty( $notification['content'] ) ) { $notifications[ $key ]['content'] = wpautop( $notification['content'] ); $notifications[ $key ]['content'] = apply_filters( 'nextgen_notification_content_display', $notifications[ $key ]['content'] ); } } return $notifications; } /** * Get notifications start time with human time difference * * @since 1.8.7 * * @param array $notifications The array of notifications to convert. * @return array */ public function get_notifications_with_human_readeable_start_time( $notifications ) { if ( ! is_array( $notifications ) || empty( $notifications ) ) { return []; } foreach ( $notifications as $key => $notification ) { if ( empty( $notification['start'] ) ) { continue; } // Translators: Human-Readable time to display. $modified_start_time = sprintf( __( '%1$s ago', 'nggallery' ), human_time_diff( strtotime( $notification['start'] ), time() ) ); $notifications[ $key ]['start'] = $modified_start_time; } return $notifications; } /** * Get active notifications. * * @since 1.8.7 * * @return array $notifications['active'] active notifications */ public function get_active_notifications() { $notifications = $this->get(); // Show only 5 active notifications plus any that has a priority of 1. $all_active = isset( $notifications['active'] ) ? $notifications['active'] : []; $displayed = []; foreach ( $all_active as $notification ) { if ( ( isset( $notification['priority'] ) && 1 === $notification['priority'] ) || count( $displayed ) < 5 ) { $displayed[] = $notification; } } return $displayed; } /** * Get dismissed notifications. * * @since 1.8.7 * * @return array $notifications['dismissed'] dismissed notifications */ public function get_dismissed_notifications() { $notifications = $this->get(); return isset( $notifications['dismissed'] ) ? $notifications['dismissed'] : []; } /** * Get notification count. * * @since 1.8.7 * * @return int */ public function get_count() { return count( $this->get_active_notifications() ); } /** * Get the dismissed notifications count. * * @since 1.8.7 * * @return int */ public function get_dismissed_count() { return count( $this->get_dismissed_notifications() ); } /** * Check if a notification has been dismissed before * * @since 1.8.7 * * @param array $notification The notification to check if is dismissed. * @return bool */ public function is_dismissed( $notification ) { if ( empty( $notification['id'] ) ) { return true; } $option = $this->get_option(); foreach ( $option['dismissed'] as $item ) { if ( $item['id'] === $notification['id'] ) { return true; } } return false; } /** * Add a manual notification event. * * @since 1.8.7 * * @param array $notification Notification data. * @return bool */ public function add( $notification ) { if ( empty( $notification['id'] ) || $this->is_dismissed( $notification ) ) { return false; } $option = $this->get_option(); $current_notifications = $option['events']; foreach ( $current_notifications as $item ) { if ( $item['id'] === $notification['id'] ) { return false; } } $notification = $this->verify( [ $notification ] ); $notifications = array_merge( $notification, $current_notifications ); // Sort notifications by priority. usort( $notifications, function ( $a, $b ) { if ( ! isset( $a['priority'] ) || ! isset( $b['priority'] ) ) { return 0; } if ( $a['priority'] === $b['priority'] ) { return 0; } return $a['priority'] < $b['priority'] ? - 1 : 1; } ); update_option( self::$option_name, [ 'update' => $option['update'], 'feed' => $option['feed'], 'events' => $notifications, 'dismissed' => $option['dismissed'], ], false ); return true; } /** * Update notification data from feed. * * @since 1.8.7 * * @return void */ public function update() { $feed = $this->fetch_feed(); $option = $this->get_option(); update_option( self::$option_name, [ 'update' => time(), 'feed' => $feed, 'timeout' => strtotime( '+2 hours', current_time( 'timestamp' ) ), // phpcs:ignore WordPress.DateTime.CurrentTimeTimestamp.Requested 'events' => $option['events'], 'dismissed' => array_slice( $option['dismissed'], 0, 30 ), ], false ); } /** * Dismiss notification via AJAX. * * @since 1.8.7 */ public function dismiss() { // Run a security check. check_ajax_referer( 'nextgen_dismiss_notification', 'nonce' ); // Check for access and required param. if ( ! $this->has_access() || empty( $_POST['id'] ) ) { wp_send_json_error(); } $id = sanitize_text_field( wp_unslash( $_POST['id'] ) ); $option = $this->get_option(); // Dismiss all notifications and add them to dissmiss array. if ( 'all' === $id ) { if ( is_array( $option['feed'] ) && ! empty( $option['feed'] ) ) { foreach ( $option['feed'] as $key => $notification ) { array_unshift( $option['dismissed'], $notification ); unset( $option['feed'][ $key ] ); } } if ( is_array( $option['events'] ) && ! empty( $option['events'] ) ) { foreach ( $option['events'] as $key => $notification ) { array_unshift( $option['dismissed'], $notification ); unset( $option['events'][ $key ] ); } } } $type = is_numeric( $id ) ? 'feed' : 'events'; // Remove notification and add in dismissed array. if ( is_array( $option[ $type ] ) && ! empty( $option[ $type ] ) ) { foreach ( $option[ $type ] as $key => $notification ) { if ( $notification['id'] == $id ) { // phpcs:ignore WordPress.PHP.StrictComparisons,Universal.Operators.StrictComparisons.LooseEqual // Add notification to dismissed array. array_unshift( $option['dismissed'], $notification ); // Remove notification from feed or events. unset( $option[ $type ][ $key ] ); break; } } } update_option( self::$option_name, $option, false ); wp_send_json_success(); } /** * Delete the notification options. * * @since 1.8.7 * * @return void */ public static function delete_notifications_data() { delete_option( self::$option_name ); } /** * Get the license type for the current plugin. * * @since 1.8.7 * * @return string */ public function get_license_type() { if ( defined( 'NGG_PRO_PLUGIN_BASENAME' ) ) { return 'pro'; } elseif ( defined( 'NGG_PLUS_PLUGIN_BASENAME' ) ) { return 'plus'; } elseif ( defined( 'NGG_STARTER_PLUGIN_BASENAME' ) ) { return 'starter'; } return 'lite'; } /** * Helper Method to get icon * * @since 1.8.7 * * @param string $type Icon type. * @return string */ public function get_icon( $type = 'gear' ) { switch ( $type ) { case 'info': return ' '; case 'percent': return ' '; case 'check': return ' '; default: case 'gear': return ' '; } } /** * Helper to get notification marketup * * @since 1.8.7 * * @param array $notification The notification. * @return void */ public function get_notification_markup( $notification ) { $type = ! empty( $notification['icon'] ) ? $notification['icon'] : 'gear'; $allowed_html = [ 'svg' => [ 'class' => true, 'aria-hidden' => true, 'aria-labelledby' => true, 'role' => true, 'xmlns' => true, 'width' => true, 'height' => true, 'viewbox' => true, ], 'g' => [ 'fill' => true ], 'title' => [ 'title' => true ], 'path' => [ 'd' => true, 'fill' => true, ], ]; ?>
  • get_icon( $notification['icon'] ), $allowed_html ); ?>
  • ngg_condition_check_to_display_tooltip(); if ( ! $display_tooltip ) { return; } $url = admin_url( 'admin.php?page=ngg_addgallery' ); ?>

    ngg_condition_check_to_display_tooltip(); if ( ! $display_tooltip ) { return; } ?> count(); // Check if there are any galleries. if ( $gallery_count > 0 ) { return false; } // Bail if user is on manage galleries screen. $screen = get_current_screen(); if ( false !== strpos( $screen->id, 'ngg_addgallery' ) || false !== strpos( $screen->id, 'nggallery-manage-gallery' ) ) { return false; } // Bail if the user is not allowed to save settings. if ( ! current_user_can( 'manage_options' ) ) { return false; } // Bail if the user has dismissed the tooltip within 7 days. $show_tooltip = get_option( 'ngg_admin_menu_tooltip', 0 ); if ( $show_tooltip && ( $show_tooltip + 7 * DAY_IN_SECONDS > time() ) ) { // Dismissed less than 7 days ago. return false; } return true; } /** * Store the time when the float bar was hidden so it won't show again for 14 days. */ public function mark_admin_menu_tooltip_hidden() { check_ajax_referer( 'ngg-tooltip-admin-nonce', 'nonce' ); update_option( 'ngg_admin_menu_tooltip', time() ); wp_send_json_success(); } }