-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from javorszky/no-more-singleton
No more singleton
- Loading branch information
Showing
4 changed files
with
53 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
namespace Mindsize\Plugin_Base; | ||
|
||
if ( ! defined( 'ABSPATH' ) ) { | ||
exit; | ||
} | ||
|
||
/** | ||
* Plugin factory, so we get one shared instance of the class that's not a singleton. | ||
* | ||
* @since 1.0.0 | ||
* @author Mindsize <[email protected]> | ||
* @copyright Copyright (c) 2017 Mindsize <[email protected]> | ||
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2.0 | ||
*/ | ||
class WP_Plugin_Factory { | ||
public static function create() { | ||
static $plugin = null; | ||
|
||
if ( null === $plugin ) { | ||
$plugin = new WP_Plugin_Base(); | ||
} | ||
|
||
return $plugin; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters