Skip to content

Commit 5ba168f

Browse files
authored
Merge pull request #15 from jmau111/master
shortcode factory is not a factory
2 parents 6433411 + 20cff27 commit 5ba168f

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

classes/shortcodes/shortcode-factory.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,12 @@ public static function register( $class_name ) {
3939
* @var Shortcode $class
4040
*/
4141
try {
42-
$class = $class_name::get_instance()->add();
42+
$class = new $class_name;
43+
$class->add();
4344
} catch ( \Exception $e ) {
4445
return new \WP_Error( 'fail_shortcode_instanciation', sprintf( 'Fail to instantiate shortcode with error %s', $e->getMessage() ) );
4546
}
4647

4748
return $class;
4849
}
49-
}
50+
}

classes/shortcodes/shortcode.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
<?php
22
namespace BEA\PB\Shortcodes;
33

4-
use BEA\PB\Singleton;
5-
6-
74
/**
85
* This class is the base class of Shortcode
96
* It have to be used as base for all Shortcodes
@@ -15,8 +12,6 @@
1512
*/
1613
abstract class Shortcode {
1714

18-
use Singleton;
19-
2015
/**
2116
* The shortcode [tag]
2217
* @since 2.1.0

0 commit comments

Comments
 (0)