| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Base class |
| 5 |
* |
| 6 |
* @since 2.0.0 |
| 7 |
*/ |
| 8 |
|
| 9 |
// Load library classes |
| 10 |
require_once( EWD_US_PLUGIN_DIR . '/views/View.class.php' ); |
| 11 |
require_once( EWD_US_PLUGIN_DIR . '/views/View.Slide.class.php' ); |
| 12 |
require_once( EWD_US_PLUGIN_DIR . '/views/View.Slide.UPCP.class.php' ); |
| 13 |
require_once( EWD_US_PLUGIN_DIR . '/views/View.Slide.URP.class.php' ); |
| 14 |
require_once( EWD_US_PLUGIN_DIR . '/views/View.Slide.WooCommerce.class.php' ); |
| 15 |
require_once( EWD_US_PLUGIN_DIR . '/views/View.Slider.class.php' ); |
| 16 |
|
| 17 |
class ewdusBase { |
| 18 |
|
| 19 |
public $id = null; |
| 20 |
|
| 21 |
// Collect errors during processing |
| 22 |
public $errors = array(); |
| 23 |
|
| 24 |
|
| 25 |
/** |
| 26 |
* Initialize the class |
| 27 |
* @since 2.0.0 |
| 28 |
*/ |
| 29 |
public function __construct( $args ) { |
| 30 |
|
| 31 |
// Parse the values passed |
| 32 |
$this->parse_args( $args ); |
| 33 |
|
| 34 |
} |
| 35 |
|
| 36 |
/** |
| 37 |
* Parse the arguments passed in the construction and assign them to |
| 38 |
* internal variables. |
| 39 |
* @since 2.0.0 |
| 40 |
*/ |
| 41 |
public function parse_args( $args ) { |
| 42 |
foreach ( $args as $key => $val ) { |
| 43 |
switch ( $key ) { |
| 44 |
|
| 45 |
case 'id' : |
| 46 |
$this->{$key} = esc_attr( $val ); |
| 47 |
|
| 48 |
default : |
| 49 |
$this->{$key} = $val; |
| 50 |
|
| 51 |
} |
| 52 |
} |
| 53 |
} |
| 54 |
|
| 55 |
/** |
| 56 |
* Set an error |
| 57 |
* @since 2.0.0 |
| 58 |
*/ |
| 59 |
public function set_error( $error ) { |
| 60 |
$this->errors[] = array_merge( |
| 61 |
$error, |
| 62 |
array( |
| 63 |
'class' => get_class( $this ), |
| 64 |
'id' => $this->id, |
| 65 |
'backtrace' => debug_backtrace() |
| 66 |
) |
| 67 |
); |
| 68 |
} |
| 69 |
|
| 70 |
} |
| 71 |
|