' . esc_html__( 'Gridsmith needs WooCommerce. Please install and activate WooCommerce to edit products in bulk.', 'gridsmith' ) . '

'; } /** * Activation: set defaults. */ public static function activate() { add_option( 'bdbe_settings', self::default_settings(), '', false ); add_option( 'bdbe_delete_data', 0, '', false ); } /** * Deactivation: clear every scheduled hook (pending jobs are re-queued on reactivation). */ public static function deactivate() { wp_unschedule_hook( 'bdbe_run_job' ); wp_unschedule_hook( 'bdbe_prune_history' ); if ( function_exists( 'as_unschedule_all_actions' ) ) { as_unschedule_all_actions( 'bdbe_run_job' ); } } /** * Default settings. * * @return array */ public static function default_settings() { return array( 'per_page' => 50, 'custom_fields' => '', 'history_days' => 90, ); } /** * Saved settings merged with defaults. * * @return array */ public static function settings() { if ( null === self::$settings ) { $saved = get_option( 'bdbe_settings', array() ); self::$settings = array_merge( self::default_settings(), is_array( $saved ) ? $saved : array() ); } return self::$settings; } /** * Forget cached settings after an update. */ public static function flush_settings() { self::$settings = null; } /** * All grid entities (products in Free; orders and coupons added by Pro). * * @return BDBE_Entity[] */ public static function entities() { if ( null === self::$entities ) { $list = array( 'product' => new BDBE_Entity_Products() ); self::$entities = (array) apply_filters( 'bdbe_entities', $list ); } return self::$entities; } /** * One entity by key. * * @param string $key Entity key. * @return BDBE_Entity|null */ public static function entity( $key ) { $all = self::entities(); return isset( $all[ $key ] ) ? $all[ $key ] : null; } /** * Parent menu for the licence screen. * * @return string */ public static function menu_parent() { return 'bdbe'; } /** * Settings link on the Plugins screen. * * @return string */ public static function settings_url() { return admin_url( 'admin.php?page=bdbe' ); } /** * Pro features listed on the Free upgrade screen. * * @return array */ public static function pro_features() { return array( __( 'Variation rows', 'gridsmith' ), __( 'Orders and coupons grids', 'gridsmith' ), __( 'Category, tag and custom field columns', 'gridsmith' ), __( 'Find & replace', 'gridsmith' ), __( 'Saved views', 'gridsmith' ), __( 'Scheduled price changes', 'gridsmith' ), __( 'History with rollback', 'gridsmith' ), ); } }