PluginProbe
WpStream – Live Streaming, Video on Demand, Pay Per View / 4.8
WpStream – Live Streaming, Video on Demand, Pay Per View v4.8
4.14.1 4.14.0 4.13.2 4.13.1 4.13 4.12.5 4.12.4 4.12.3 4.12.2 4.12.1 4.12 4.4.4 4.4.5 4.4.6 4.4.7 4.4.8 4.4.9 4.5 4.5.1 4.5.11 4.5.11.1 4.5.11.2 4.5.11.4 4.5.11.5 4.5.11.6 All 181 releases
wpstream / hello-wpstream / framework / widgets / class-wpstream-widget-manager.php

class-wpstream-widget-manager.php in WpStream – Live Streaming, Video on Demand, Pay Per View 4.8, at hello-wpstream/framework/widgets/class-wpstream-widget-manager.php

69 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Widget manager
4 *
5 * @package wpstream-theme
6 */
7
8 // Exit if accessed directly.
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit;
11 }
12
13 /**
14 * Class is used to register widgets
15 */
16 if ( ! class_exists( 'Wpstream_Widget_Manager' ) ) {
17 /**
18 * Class for managing custom widgets.
19 */
20 class Wpstream_Widget_Manager {
21 /**
22 * Constructor function.
23 */
24 public function __construct() {
25 add_action( 'widgets_init', array( $this, 'register_widgets' ) );
26
27 add_filter( 'woocommerce_before_widget_product_list', array( $this, 'remove_class' ) );
28 }
29
30 /**
31 * Remove class from ul.
32 *
33 * @return string The modified ul tag.
34 */
35 public function remove_class() {
36 return "<ul class=''>";
37 }
38
39 /**
40 * Register custom widgets.
41 */
42 public function register_widgets() {
43 require_once 'class-wpstream-widget-base.php';
44
45 $widgets = glob( __DIR__ . '/*-widget.php' );
46
47 if ( ! empty( $widgets ) ) {
48 foreach ( $widgets as $file ) {
49 if ( file_exists( $file ) ) {
50 $file_name = pathinfo( $file, PATHINFO_FILENAME );
51 $class_name = implode( '_', array_map( 'ucwords', array_slice( explode( '-', $file_name ), 1 ) ) );
52 require_once $file;
53
54 if ( class_exists( $class_name ) && is_a( $class_name, 'Wpstream_Widget_Base', true ) ) {
55 // Unregister widgets.
56 foreach ( $class_name::get_widgets_for_unregister() as $widget ) {
57 unregister_widget( $widget );
58 }
59 register_widget( $class_name );
60 }
61 }
62 }
63 }
64 }
65 }
66
67 }
68 ( new Wpstream_Widget_Manager() );
69