is_pro_loaded() ) { return false; } switch ( $feature ) { case 'lazyload': return version_compare( AdCommanderPro::version(), '1.1.7', '>=' ); break; case 'bbPress': case 'buddyPress': return version_compare( AdCommanderPro::version(), '1.1.10', '>=' ) && version_compare( AdCommander::version(), '1.1.15', '>=' ); case 'adviewhandler': return version_compare( AdCommanderPro::version(), '1.2.0', '>=' ); case 'exportreports': case 'clickfraud': return version_compare( AdCommanderPro::version(), '1.2.1', '>=' ); case 'maxmindapiupdate': return version_compare( AdCommanderPro::version(), '1.3.3', '>=' ); case 'campaigns': return version_compare( AdCommanderPro::version(), '1.4.0', '>=' ); case 'tracking_no_admin_ajax': return version_compare( AdCommanderPro::version(), '1.4.1', '>=' ); } return false; } /** * Check if the pro plugin is active. * This constant is defined when the file is loaded -- before plugins_loaded. * * @return bool */ public function is_pro_activated() { return defined( 'ADCMDR_PRO_PLUGIN_BASENAME' ) && ADCMDR_PRO_PLUGIN_BASENAME !== null && ADCMDR_PRO_PLUGIN_BASENAME !== false; } /** * Get and set the addons settings url. * * @return string */ public function addons_admin_url() { return AddonBridge::instance()->addons_admin_url(); } /** * The EDD Pro license name. * * This is included here instead of Pro, because if it changes in a future we can push an update to the public repo. * Then Pro could update from the private repo using the correct name. */ public static function edd_item_name() { return 'Ad Commander Pro'; } /** * Is the pro license added? * * @return bool */ public function is_pro_license_added() { if ( $this->is_pro_loaded() ) { return License::instance()->is_pro_license_added(); } return false; } /** * Get the pro license status. * * @param bool $refresh Whether to refresh the status. * * @return bool|string */ public function pro_license_status( $refresh = false ) { if ( $this->is_pro_loaded() ) { return License::instance()->license_status( $refresh ); } return false; } /** * Enqueue script data for the license settings page. * * @param string $status The status to pass to the data. * * @return void */ public function enqueue_pro_license_script_data( $status ) { if ( $this->is_pro_loaded() ) { $admin_license = new AdminLicense(); $admin_license->enqueue_script_data( $status ); } } /** * Reset the pro license status. * * @param bool $hard Hard reset or not. * @param bool $pending Reset to pending or not. * * @return void */ public function pro_license_reset_status( $hard = true, $pending = false ) { if ( $this->is_pro_loaded() ) { License::instance()->reset_status( $hard ); if ( $pending ) { License::instance()->reset_status_to_pending(); } } } /** * Deactivate the license key. * * @param mixed $license_key The license key, if one exists. * * @return void */ public function pro_license_deactivate( $license_key ) { if ( $this->is_pro_loaded() ) { License::instance()->deactivate_license( $license_key ); } } /** * Group modes tha require Pro. * * @return array */ public function pro_group_modes() { return array( 'grid' ); } /** * Insert positions that require pro. * * @return array */ public function pro_placement_positions() { return array_merge( array( 'within_content', 'post_list', 'above_title', 'after_p_tag', 'popup', 'sticky' ), array_keys( bbPressInterface::bbpress_placement_positions() ), array_keys( buddyPressInterface::buddypress_placement_positions() ) ); } /** * Check for specific version of Pro. * * @param string $ver The required version. * * @return array */ public function pro_version_required( $ver ) { if ( ! self::is_pro_loaded() ) { return false; } return version_compare( AdCommanderPro::version(), $ver, '>=' ); } /** * These conditions are only usable if Pro is installed. * * @return array */ public function pro_visitor_conditions() { /** * All conditions except 'logged in' */ $targets = TargetingMeta::allowed_visitor_targets(); if ( isset( $targets['logged_in'] ) ) { unset( $targets['logged_in'] ); } return array_keys( $targets ); } /** * These group ordering methods are only usable if Pro is installed. * * @return array */ public function pro_group_order_methods() { return array( 'weighted', 'sequential' ); } /** * These rotate methods are only usable if Pro is installed. * * @return array */ public function pro_rotate_methods() { return array( 'slide_t', 'slide_b', 'slide_l', 'slide_r' ); } /** * The label appended to featurs that require pro. * * @return string */ public static function pro_label( $pro_link = false ) { if ( $pro_link ) { /* translators: This text is appended to features that are only included in the pro version. Leading spacing and hyphen (or equivalent) should be included. */ return ' - ' . esc_html__( 'Upgrade to Pro', 'ad-commander' ) . ''; } /* translators: This text is appended to features that are only included in the pro version. Leading spacing and hyphen (or equivalent) should be included. */ return esc_html__( ' - Pro Add-on', 'ad-commander' ); } }