$plugin_data ) { if ( strpos( $plugin_file, 'give.php' ) !== false || strpos( $plugin_file, 'give/' ) === 0 ) { return true; } } return false; } /** * Get dashboard notices for GiveWP import suggestion. * * @since 1.8.10 * * @return array */ public function get_dashboard_notices() { $dashboard_notices = get_option( 'charitable_dashboard_notifications', array() ); // If the notice has already been dismissed, bail. if ( isset( $dashboard_notices['givewp_import'] ) && isset( $dashboard_notices['givewp_import']['dismissed'] ) ) { return $dashboard_notices; } // If GiveWP is not installed, remove notice if it exists and bail. if ( ! $this->is_givewp_installed() ) { if ( isset( $dashboard_notices['givewp_import'] ) ) { unset( $dashboard_notices['givewp_import'] ); update_option( 'charitable_dashboard_notifications', $dashboard_notices ); } return $dashboard_notices; } // If the notice already exists and has the current format, don't add it again. if ( isset( $dashboard_notices['givewp_import'] ) && ! empty( $dashboard_notices['givewp_import']['button_url'] ) ) { return $dashboard_notices; } $dashboard_notices['givewp_import'] = array( 'type' => 'notice', 'priority' => 5, 'dismiss' => true, 'title' => esc_html__( 'Notice', 'charitable' ), 'custom_css' => 'charitable-notification-type-notice', 'message' => '

' . __( 'We noticed you have GiveWP installed. You can import your donation data from GiveWP to Charitable.', 'charitable' ) . '

', 'button_url' => admin_url( 'admin.php?page=charitable-tools&tab=import' ), 'button_text' => __( 'Import Now', 'charitable' ), ); update_option( 'charitable_dashboard_notifications', $dashboard_notices ); return $dashboard_notices; } /** * Create and return the class object. * * @since 1.8.10 * * @return Charitable_GiveWP_Notice */ public static function get_instance() { if ( is_null( self::$instance ) ) { self::$instance = new self(); } return self::$instance; } } endif;