handle_autoload = $handle_autoload; if ( $this->handle_autoload ) { $this->get_settings( array() ); $this->handle_autoload(); } add_filter( 'woocommerce_get_sections_alg_wc_aps', array( $this, 'settings_section' ) ); add_filter( 'woocommerce_get_settings_alg_wc_aps_' . $this->id, array( $this, 'get_settings', ), PHP_INT_MAX ); } /** * get_settings. * * @version 1.0.0 * @since 1.0.0 */ function get_settings( $settings = array() ) { $this->settings = $settings; return $this->settings; } /** * handle_autoload. * * @version 1.0.0 * @since 1.0.0 */ function handle_autoload() { foreach ( $this->settings as $value ) { if ( isset( $value['default'] ) && isset( $value['id'] ) ) { $autoload = isset( $value['autoload'] ) ? ( bool ) $value['autoload'] : true; add_option( $value['id'], $value['default'], '', ( $autoload ? 'yes' : 'no' ) ); } } } /** * settings_section. * * @version 1.0.0 * @since 1.0.0 */ function settings_section( $sections ) { $sections[ $this->id ] = $this->desc; return $sections; } } endif;