define_constants(); // Initialize add_action( 'init', array( $this, 'init' ) ); // Widgets add_filter( 'sportspress_widget_update', array( $this, 'widget_update' ), 10, 2 ); add_filter( 'sportspress_widget_defaults', array( $this, 'widget_defaults' ) ); add_action( 'sportspress_before_widget_template_form', array( $this, 'before_widget_form' ), 10, 2 ); add_action( 'sportspress_before_widget', array( $this, 'before_widget'), 10, 2 ); add_action( 'sportspress_after_widget', array( $this, 'after_widget') ); } /** * Define constants */ private function define_constants() { if ( !defined( 'SP_WIDGET_ALIGNMENT_VERSION' ) ) define( 'SP_WIDGET_ALIGNMENT_VERSION', '1.8.3' ); if ( !defined( 'SP_WIDGET_ALIGNMENT_URL' ) ) define( 'SP_WIDGET_ALIGNMENT_URL', plugin_dir_url( __FILE__ ) ); if ( !defined( 'SP_WIDGET_ALIGNMENT_DIR' ) ) define( 'SP_WIDGET_ALIGNMENT_DIR', plugin_dir_path( __FILE__ ) ); } /** * Initialize */ public function init() { $this->options = array( 'none' => __( 'None', 'sportspress' ), 'left' => __( 'Left', 'sportspress' ), 'right' => __( 'Right', 'sportspress' ), ); } /** * Widget update */ function widget_update( $instance, $new_instance ) { $instance['align'] = strip_tags( $new_instance['align'] ); return $instance; } /** * Widget defaults */ function widget_defaults( $defaults ) { $defaults['align'] = 'none'; return $defaults; } /** * Before widget forms */ function before_widget_form( $object, $instance ) { ?>

'; } /** * After widget */ function after_widget() { echo ''; } } endif; new SportsPress_Widget_Alignment();