mirror of
https://github.com/felixfoertsch/wordpress-dev-env.git
synced 2026-04-18 15:28:44 +02:00
Initial commit
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
* Factory.class.php
|
||||
*/
|
||||
|
||||
# Define Namespace
|
||||
namespace WCFE;
|
||||
|
||||
# Imports
|
||||
use WPPFW\Plugin\PluginFactory;
|
||||
|
||||
/**
|
||||
* WCFE Plugin base and currently the only object factory
|
||||
*
|
||||
* The class is to provide objects factory and objects storage
|
||||
* Its used for interconnectios between different comonents and between
|
||||
* Plugins and Plugins Framework
|
||||
*
|
||||
* @author AHMeD SAiD
|
||||
*/
|
||||
class Factory extends PluginFactory {
|
||||
|
||||
/**
|
||||
* CReate class maps for Framework class to
|
||||
* be constructed through WCFE Plugin
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function createMap() {
|
||||
# Create Map.
|
||||
$this->addClassMap('WPPFW\Database\Wordpress\WordpressOptions', 'WordpressOptions');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/**
|
||||
* WordpressOptions.class.php
|
||||
*/
|
||||
|
||||
# Define namespace
|
||||
namespace WCFE\Factory;
|
||||
|
||||
# Imports
|
||||
use WPPFW\Obj;
|
||||
|
||||
# Original object
|
||||
use WPPFW\Database\Wordpress;
|
||||
|
||||
/**
|
||||
* Factoring Wordpress Database Options Table
|
||||
*
|
||||
* @author AHMeD SAiD
|
||||
*/
|
||||
class WordpressOptions {
|
||||
|
||||
/**
|
||||
* Creating new WPPFW\Database\Wordpress\WordpressOptions object
|
||||
* configued for WCFE Plugin
|
||||
*
|
||||
* @param Obj\Factory $factory
|
||||
* @return Wordpress\WordpressOptions
|
||||
*/
|
||||
public function getInstance( Obj\Factory & $factory )
|
||||
{
|
||||
# Getting Plugin instance.
|
||||
$plugin =& $factory->get( 'WPPFW\Plugin\PluginBase' );
|
||||
# Return Wordpress options object instance
|
||||
return new Wordpress\WordpressOptions( strtolower( $plugin->getNamespace()->getNamespace() . '-' ) );
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user