@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | namespace EventEspresso\core\services\container; |
3 | 3 | |
4 | 4 | if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
5 | - exit('No direct script access allowed'); |
|
5 | + exit('No direct script access allowed'); |
|
6 | 6 | } |
7 | 7 | |
8 | 8 | |
@@ -17,39 +17,39 @@ discard block |
||
17 | 17 | interface InjectorInterface |
18 | 18 | { |
19 | 19 | |
20 | - /** |
|
21 | - * getReflectionClass |
|
22 | - * checks if a ReflectionClass object has already been generated for a class |
|
23 | - * and returns that instead of creating a new one |
|
24 | - * |
|
25 | - * @access public |
|
26 | - * @param string $class_name |
|
27 | - * @return \ReflectionClass |
|
28 | - */ |
|
29 | - public function getReflectionClass($class_name); |
|
30 | - |
|
31 | - |
|
32 | - |
|
33 | - /** |
|
34 | - * resolveDependencies |
|
35 | - * examines the constructor for the requested class to determine |
|
36 | - * if any dependencies exist, and if they can be injected. |
|
37 | - * If so, then those classes will be added to the array of arguments passed to the constructor |
|
38 | - * PLZ NOTE: this is achieved by type hinting the constructor params |
|
39 | - * For example: |
|
40 | - * if attempting to load a class "Foo" with the following constructor: |
|
41 | - * __construct( Bar $bar_class, Fighter $grohl_class ) |
|
42 | - * then $bar_class and $grohl_class will be added to the $arguments array, |
|
43 | - * but only IF they are NOT already present in the incoming arguments array, |
|
44 | - * and the correct classes can be loaded |
|
45 | - * |
|
46 | - * @access public |
|
47 | - * @param \EventEspresso\core\services\container\RecipeInterface $recipe |
|
48 | - * @param \ReflectionClass $reflector |
|
49 | - * @param array $arguments |
|
50 | - * @return array |
|
51 | - */ |
|
52 | - public function resolveDependencies(RecipeInterface $recipe, \ReflectionClass $reflector, $arguments = array()); |
|
20 | + /** |
|
21 | + * getReflectionClass |
|
22 | + * checks if a ReflectionClass object has already been generated for a class |
|
23 | + * and returns that instead of creating a new one |
|
24 | + * |
|
25 | + * @access public |
|
26 | + * @param string $class_name |
|
27 | + * @return \ReflectionClass |
|
28 | + */ |
|
29 | + public function getReflectionClass($class_name); |
|
30 | + |
|
31 | + |
|
32 | + |
|
33 | + /** |
|
34 | + * resolveDependencies |
|
35 | + * examines the constructor for the requested class to determine |
|
36 | + * if any dependencies exist, and if they can be injected. |
|
37 | + * If so, then those classes will be added to the array of arguments passed to the constructor |
|
38 | + * PLZ NOTE: this is achieved by type hinting the constructor params |
|
39 | + * For example: |
|
40 | + * if attempting to load a class "Foo" with the following constructor: |
|
41 | + * __construct( Bar $bar_class, Fighter $grohl_class ) |
|
42 | + * then $bar_class and $grohl_class will be added to the $arguments array, |
|
43 | + * but only IF they are NOT already present in the incoming arguments array, |
|
44 | + * and the correct classes can be loaded |
|
45 | + * |
|
46 | + * @access public |
|
47 | + * @param \EventEspresso\core\services\container\RecipeInterface $recipe |
|
48 | + * @param \ReflectionClass $reflector |
|
49 | + * @param array $arguments |
|
50 | + * @return array |
|
51 | + */ |
|
52 | + public function resolveDependencies(RecipeInterface $recipe, \ReflectionClass $reflector, $arguments = array()); |
|
53 | 53 | |
54 | 54 | } |
55 | 55 | // End of file InjectorInterface.php |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | namespace EventEspresso\core\services\container; |
3 | 3 | |
4 | 4 | if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
5 | - exit('No direct script access allowed'); |
|
5 | + exit('No direct script access allowed'); |
|
6 | 6 | } |
7 | 7 | |
8 | 8 | |
@@ -24,46 +24,46 @@ discard block |
||
24 | 24 | |
25 | 25 | |
26 | 26 | |
27 | - /** |
|
28 | - * @return string |
|
29 | - */ |
|
30 | - public function type() |
|
31 | - { |
|
32 | - return CoffeeMaker::BREW_SHARED; |
|
33 | - } |
|
27 | + /** |
|
28 | + * @return string |
|
29 | + */ |
|
30 | + public function type() |
|
31 | + { |
|
32 | + return CoffeeMaker::BREW_SHARED; |
|
33 | + } |
|
34 | 34 | |
35 | 35 | |
36 | 36 | |
37 | - /** |
|
38 | - * @param RecipeInterface $recipe |
|
39 | - * @param array $arguments |
|
40 | - * @return mixed |
|
41 | - */ |
|
42 | - public function brew(RecipeInterface $recipe, $arguments = array()) |
|
43 | - { |
|
44 | - $this->resolveClassAndFilepath($recipe); |
|
45 | - $reflector = $this->injector()->getReflectionClass($recipe->fqcn()); |
|
46 | - $method = $this->resolveInstantiationMethod($reflector); |
|
47 | - switch ($method) { |
|
48 | - case 'instance' : |
|
49 | - case 'new_instance' : |
|
50 | - case 'new_instance_from_db'; |
|
51 | - $service = call_user_func_array( |
|
52 | - array($reflector->getName(), $method), |
|
53 | - $this->injector()->resolveDependencies($recipe, $reflector, $arguments) |
|
54 | - ); |
|
55 | - break; |
|
56 | - case 'newInstance' : |
|
57 | - $service = $reflector->newInstance(); |
|
58 | - break; |
|
59 | - case 'newInstanceArgs' : |
|
60 | - default : |
|
61 | - $service = $reflector->newInstanceArgs( |
|
62 | - $this->injector()->resolveDependencies($recipe, $reflector, $arguments) |
|
63 | - ); |
|
64 | - } |
|
65 | - return $this->coffeePot()->addService($recipe->identifier(), $service); |
|
66 | - } |
|
37 | + /** |
|
38 | + * @param RecipeInterface $recipe |
|
39 | + * @param array $arguments |
|
40 | + * @return mixed |
|
41 | + */ |
|
42 | + public function brew(RecipeInterface $recipe, $arguments = array()) |
|
43 | + { |
|
44 | + $this->resolveClassAndFilepath($recipe); |
|
45 | + $reflector = $this->injector()->getReflectionClass($recipe->fqcn()); |
|
46 | + $method = $this->resolveInstantiationMethod($reflector); |
|
47 | + switch ($method) { |
|
48 | + case 'instance' : |
|
49 | + case 'new_instance' : |
|
50 | + case 'new_instance_from_db'; |
|
51 | + $service = call_user_func_array( |
|
52 | + array($reflector->getName(), $method), |
|
53 | + $this->injector()->resolveDependencies($recipe, $reflector, $arguments) |
|
54 | + ); |
|
55 | + break; |
|
56 | + case 'newInstance' : |
|
57 | + $service = $reflector->newInstance(); |
|
58 | + break; |
|
59 | + case 'newInstanceArgs' : |
|
60 | + default : |
|
61 | + $service = $reflector->newInstanceArgs( |
|
62 | + $this->injector()->resolveDependencies($recipe, $reflector, $arguments) |
|
63 | + ); |
|
64 | + } |
|
65 | + return $this->coffeePot()->addService($recipe->identifier(), $service); |
|
66 | + } |
|
67 | 67 | |
68 | 68 | } |
69 | 69 | // End of file SharedCoffeeMaker.php |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | namespace EventEspresso\core\services\container; |
3 | 3 | |
4 | 4 | if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
5 | - exit('No direct script access allowed'); |
|
5 | + exit('No direct script access allowed'); |
|
6 | 6 | } |
7 | 7 | |
8 | 8 | |
@@ -25,54 +25,54 @@ discard block |
||
25 | 25 | { |
26 | 26 | |
27 | 27 | |
28 | - /** |
|
29 | - * @return string |
|
30 | - */ |
|
31 | - public function type() |
|
32 | - { |
|
33 | - return CoffeeMaker::BREW_NEW; |
|
34 | - } |
|
28 | + /** |
|
29 | + * @return string |
|
30 | + */ |
|
31 | + public function type() |
|
32 | + { |
|
33 | + return CoffeeMaker::BREW_NEW; |
|
34 | + } |
|
35 | 35 | |
36 | 36 | |
37 | 37 | |
38 | - /** |
|
39 | - * @param RecipeInterface $recipe |
|
40 | - * @param array $arguments |
|
41 | - * @return mixed |
|
42 | - */ |
|
43 | - public function brew(RecipeInterface $recipe, $arguments = array()) |
|
44 | - { |
|
45 | - $this->resolveClassAndFilepath($recipe); |
|
46 | - $reflector = $this->injector()->getReflectionClass($recipe->fqcn()); |
|
47 | - $method = $this->resolveInstantiationMethod($reflector); |
|
48 | - switch ($method) { |
|
49 | - case 'instance' : |
|
50 | - case 'new_instance' : |
|
51 | - case 'new_instance_from_db'; |
|
52 | - $injector = $this->injector(); |
|
53 | - $closure = function ($arguments) use ($recipe, $reflector, $method, $injector) { |
|
54 | - return call_user_func_array( |
|
55 | - array($reflector->getName(), $method), |
|
56 | - $injector->resolveDependencies($recipe, $reflector, $arguments) |
|
57 | - ); |
|
58 | - }; |
|
59 | - break; |
|
60 | - case 'newInstance' : |
|
61 | - $closure = function () use ($reflector) { |
|
62 | - return $reflector->newInstance(); |
|
63 | - }; |
|
64 | - break; |
|
65 | - case 'newInstanceArgs' : |
|
66 | - default : |
|
67 | - $injector = $this->injector(); |
|
68 | - $closure = function ($arguments) use ($recipe, $reflector, $injector) { |
|
69 | - return $reflector->newInstanceArgs( |
|
70 | - $injector->resolveDependencies($recipe, $reflector, $arguments) |
|
71 | - ); |
|
72 | - }; |
|
73 | - } |
|
74 | - return $this->coffeePot()->addClosure($recipe->identifier(), $closure); |
|
75 | - } |
|
38 | + /** |
|
39 | + * @param RecipeInterface $recipe |
|
40 | + * @param array $arguments |
|
41 | + * @return mixed |
|
42 | + */ |
|
43 | + public function brew(RecipeInterface $recipe, $arguments = array()) |
|
44 | + { |
|
45 | + $this->resolveClassAndFilepath($recipe); |
|
46 | + $reflector = $this->injector()->getReflectionClass($recipe->fqcn()); |
|
47 | + $method = $this->resolveInstantiationMethod($reflector); |
|
48 | + switch ($method) { |
|
49 | + case 'instance' : |
|
50 | + case 'new_instance' : |
|
51 | + case 'new_instance_from_db'; |
|
52 | + $injector = $this->injector(); |
|
53 | + $closure = function ($arguments) use ($recipe, $reflector, $method, $injector) { |
|
54 | + return call_user_func_array( |
|
55 | + array($reflector->getName(), $method), |
|
56 | + $injector->resolveDependencies($recipe, $reflector, $arguments) |
|
57 | + ); |
|
58 | + }; |
|
59 | + break; |
|
60 | + case 'newInstance' : |
|
61 | + $closure = function () use ($reflector) { |
|
62 | + return $reflector->newInstance(); |
|
63 | + }; |
|
64 | + break; |
|
65 | + case 'newInstanceArgs' : |
|
66 | + default : |
|
67 | + $injector = $this->injector(); |
|
68 | + $closure = function ($arguments) use ($recipe, $reflector, $injector) { |
|
69 | + return $reflector->newInstanceArgs( |
|
70 | + $injector->resolveDependencies($recipe, $reflector, $arguments) |
|
71 | + ); |
|
72 | + }; |
|
73 | + } |
|
74 | + return $this->coffeePot()->addClosure($recipe->identifier(), $closure); |
|
75 | + } |
|
76 | 76 | |
77 | 77 | |
78 | 78 | } |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | case 'new_instance' : |
51 | 51 | case 'new_instance_from_db'; |
52 | 52 | $injector = $this->injector(); |
53 | - $closure = function ($arguments) use ($recipe, $reflector, $method, $injector) { |
|
53 | + $closure = function($arguments) use ($recipe, $reflector, $method, $injector) { |
|
54 | 54 | return call_user_func_array( |
55 | 55 | array($reflector->getName(), $method), |
56 | 56 | $injector->resolveDependencies($recipe, $reflector, $arguments) |
@@ -58,14 +58,14 @@ discard block |
||
58 | 58 | }; |
59 | 59 | break; |
60 | 60 | case 'newInstance' : |
61 | - $closure = function () use ($reflector) { |
|
61 | + $closure = function() use ($reflector) { |
|
62 | 62 | return $reflector->newInstance(); |
63 | 63 | }; |
64 | 64 | break; |
65 | 65 | case 'newInstanceArgs' : |
66 | 66 | default : |
67 | 67 | $injector = $this->injector(); |
68 | - $closure = function ($arguments) use ($recipe, $reflector, $injector) { |
|
68 | + $closure = function($arguments) use ($recipe, $reflector, $injector) { |
|
69 | 69 | return $reflector->newInstanceArgs( |
70 | 70 | $injector->resolveDependencies($recipe, $reflector, $arguments) |
71 | 71 | ); |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | namespace EventEspresso\core\services\container; |
3 | 3 | |
4 | 4 | if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
5 | - exit('No direct script access allowed'); |
|
5 | + exit('No direct script access allowed'); |
|
6 | 6 | } |
7 | 7 | |
8 | 8 | |
@@ -17,84 +17,84 @@ discard block |
||
17 | 17 | interface RecipeInterface |
18 | 18 | { |
19 | 19 | |
20 | - /** |
|
21 | - * @return string |
|
22 | - */ |
|
23 | - public function identifier(); |
|
24 | - |
|
25 | - /** |
|
26 | - * @return string |
|
27 | - */ |
|
28 | - public function fqcn(); |
|
29 | - |
|
30 | - /** |
|
31 | - * @return array |
|
32 | - */ |
|
33 | - public function ingredients(); |
|
34 | - |
|
35 | - /** |
|
36 | - * @return string |
|
37 | - */ |
|
38 | - public function type(); |
|
39 | - |
|
40 | - /** |
|
41 | - * @return array |
|
42 | - */ |
|
43 | - public function filters(); |
|
44 | - |
|
45 | - /** |
|
46 | - * @return array |
|
47 | - */ |
|
48 | - public function paths(); |
|
49 | - |
|
50 | - /** |
|
51 | - * @param string $identifier Identifier for the entity class that the Recipe applies to |
|
52 | - * Typically a Fully Qualified Class Name |
|
53 | - */ |
|
54 | - public function setIdentifier($identifier); |
|
55 | - |
|
56 | - /** |
|
57 | - * Ensures incoming string is a valid Fully Qualified Class Name, |
|
58 | - * except if this is the default wildcard Recipe ( * ), |
|
59 | - * or it's NOT an actual FQCN because the Recipe is using filepaths |
|
60 | - * for classes that are not PSR-4 compatible |
|
61 | - * PLZ NOTE: |
|
62 | - * Recipe::setFqcn() has a check to see if Recipe::$paths is empty or not, |
|
63 | - * therefore you should always call Recipe::setPaths() before Recipe::setFqcn() |
|
64 | - * |
|
65 | - * @param string $fqcn |
|
66 | - */ |
|
67 | - public function setFqcn($fqcn); |
|
68 | - |
|
69 | - /** |
|
70 | - * @param array $ingredients an array of dependencies where keys are the aliases and values are the FQCNs |
|
71 | - * example: |
|
72 | - * array( 'ClassInterface' => 'Fully\Qualified\ClassName' ) |
|
73 | - */ |
|
74 | - public function setIngredients(array $ingredients); |
|
75 | - |
|
76 | - /** |
|
77 | - * @param string $type one of the class constants returned from CoffeeMaker::getTypes() |
|
78 | - */ |
|
79 | - public function setType($type = CoffeeMaker::BREW_NEW); |
|
80 | - |
|
81 | - /** |
|
82 | - * @param array $filters an array of filters where keys are the aliases and values are the FQCNs |
|
83 | - * example: |
|
84 | - * array( 'ClassInterface' => 'Fully\Qualified\ClassName' ) |
|
85 | - */ |
|
86 | - public function setFilters(array $filters); |
|
87 | - |
|
88 | - /** |
|
89 | - * Ensures incoming paths is a valid filepath, or array of valid filepaths, |
|
90 | - * and merges them in with any existing filepaths |
|
91 | - * PLZ NOTE: |
|
92 | - * Recipe::setFqcn() has a check to see if Recipe::$paths is empty or not, |
|
93 | - * therefore you should always call Recipe::setPaths() before Recipe::setFqcn() |
|
94 | - * |
|
95 | - * @param string|array $paths |
|
96 | - */ |
|
97 | - public function setPaths($paths = array()); |
|
20 | + /** |
|
21 | + * @return string |
|
22 | + */ |
|
23 | + public function identifier(); |
|
24 | + |
|
25 | + /** |
|
26 | + * @return string |
|
27 | + */ |
|
28 | + public function fqcn(); |
|
29 | + |
|
30 | + /** |
|
31 | + * @return array |
|
32 | + */ |
|
33 | + public function ingredients(); |
|
34 | + |
|
35 | + /** |
|
36 | + * @return string |
|
37 | + */ |
|
38 | + public function type(); |
|
39 | + |
|
40 | + /** |
|
41 | + * @return array |
|
42 | + */ |
|
43 | + public function filters(); |
|
44 | + |
|
45 | + /** |
|
46 | + * @return array |
|
47 | + */ |
|
48 | + public function paths(); |
|
49 | + |
|
50 | + /** |
|
51 | + * @param string $identifier Identifier for the entity class that the Recipe applies to |
|
52 | + * Typically a Fully Qualified Class Name |
|
53 | + */ |
|
54 | + public function setIdentifier($identifier); |
|
55 | + |
|
56 | + /** |
|
57 | + * Ensures incoming string is a valid Fully Qualified Class Name, |
|
58 | + * except if this is the default wildcard Recipe ( * ), |
|
59 | + * or it's NOT an actual FQCN because the Recipe is using filepaths |
|
60 | + * for classes that are not PSR-4 compatible |
|
61 | + * PLZ NOTE: |
|
62 | + * Recipe::setFqcn() has a check to see if Recipe::$paths is empty or not, |
|
63 | + * therefore you should always call Recipe::setPaths() before Recipe::setFqcn() |
|
64 | + * |
|
65 | + * @param string $fqcn |
|
66 | + */ |
|
67 | + public function setFqcn($fqcn); |
|
68 | + |
|
69 | + /** |
|
70 | + * @param array $ingredients an array of dependencies where keys are the aliases and values are the FQCNs |
|
71 | + * example: |
|
72 | + * array( 'ClassInterface' => 'Fully\Qualified\ClassName' ) |
|
73 | + */ |
|
74 | + public function setIngredients(array $ingredients); |
|
75 | + |
|
76 | + /** |
|
77 | + * @param string $type one of the class constants returned from CoffeeMaker::getTypes() |
|
78 | + */ |
|
79 | + public function setType($type = CoffeeMaker::BREW_NEW); |
|
80 | + |
|
81 | + /** |
|
82 | + * @param array $filters an array of filters where keys are the aliases and values are the FQCNs |
|
83 | + * example: |
|
84 | + * array( 'ClassInterface' => 'Fully\Qualified\ClassName' ) |
|
85 | + */ |
|
86 | + public function setFilters(array $filters); |
|
87 | + |
|
88 | + /** |
|
89 | + * Ensures incoming paths is a valid filepath, or array of valid filepaths, |
|
90 | + * and merges them in with any existing filepaths |
|
91 | + * PLZ NOTE: |
|
92 | + * Recipe::setFqcn() has a check to see if Recipe::$paths is empty or not, |
|
93 | + * therefore you should always call Recipe::setPaths() before Recipe::setFqcn() |
|
94 | + * |
|
95 | + * @param string|array $paths |
|
96 | + */ |
|
97 | + public function setPaths($paths = array()); |
|
98 | 98 | |
99 | 99 | } |
100 | 100 | // End of file RecipeInterface.php |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | */ |
59 | 59 | public static function instance() { |
60 | 60 | // check if class object is instantiated, and instantiated properly |
61 | - if ( self::$_instance === NULL or ! is_object( self::$_instance ) or ! ( self::$_instance instanceof EE_Network_Config )) { |
|
61 | + if (self::$_instance === NULL or ! is_object(self::$_instance) or ! (self::$_instance instanceof EE_Network_Config)) { |
|
62 | 62 | self::$_instance = new self(); |
63 | 63 | } |
64 | 64 | return self::$_instance; |
@@ -73,15 +73,15 @@ discard block |
||
73 | 73 | * @access private |
74 | 74 | */ |
75 | 75 | private function __construct() { |
76 | - do_action( 'AHEE__EE_Network_Config__construct__begin',$this ); |
|
76 | + do_action('AHEE__EE_Network_Config__construct__begin', $this); |
|
77 | 77 | //set defaults |
78 | - $this->core = apply_filters( 'FHEE__EE_Network_Config___construct__core', new EE_Network_Core_Config() ); |
|
78 | + $this->core = apply_filters('FHEE__EE_Network_Config___construct__core', new EE_Network_Core_Config()); |
|
79 | 79 | $this->addons = array(); |
80 | 80 | |
81 | 81 | $this->_load_config(); |
82 | 82 | |
83 | 83 | // construct__end hook |
84 | - do_action( 'AHEE__EE_Network_Config__construct__end',$this ); |
|
84 | + do_action('AHEE__EE_Network_Config__construct__end', $this); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | |
@@ -94,25 +94,25 @@ discard block |
||
94 | 94 | */ |
95 | 95 | private function _load_config() { |
96 | 96 | //load network config start hook |
97 | - do_action( 'AHEE__EE_Network_Config___load_config__start', $this ); |
|
97 | + do_action('AHEE__EE_Network_Config___load_config__start', $this); |
|
98 | 98 | $config = $this->get_config(); |
99 | - foreach ( $config as $config_prop => $settings ) { |
|
100 | - if ( is_object( $settings ) && property_exists( $this, $config_prop ) ) { |
|
101 | - $this->{$config_prop} = apply_filters( 'FHEE__EE_Network_Config___load_config__config_settings', $settings, $config_prop, $this ); |
|
102 | - if ( method_exists( $settings, 'populate' ) ) { |
|
99 | + foreach ($config as $config_prop => $settings) { |
|
100 | + if (is_object($settings) && property_exists($this, $config_prop)) { |
|
101 | + $this->{$config_prop} = apply_filters('FHEE__EE_Network_Config___load_config__config_settings', $settings, $config_prop, $this); |
|
102 | + if (method_exists($settings, 'populate')) { |
|
103 | 103 | $this->{$config_prop}->populate(); |
104 | 104 | } |
105 | - if ( method_exists( $settings, 'do_hooks' ) ) { |
|
105 | + if (method_exists($settings, 'do_hooks')) { |
|
106 | 106 | $this->{$config_prop}->do_hooks(); |
107 | 107 | } |
108 | 108 | } |
109 | 109 | } |
110 | - if ( apply_filters( 'FHEE__EE_Network_Config___load_config__update_network_config', false ) ) { |
|
110 | + if (apply_filters('FHEE__EE_Network_Config___load_config__update_network_config', false)) { |
|
111 | 111 | $this->update_config(); |
112 | 112 | } |
113 | 113 | |
114 | 114 | //load network config end hook |
115 | - do_action( 'AHEE__EE_Network_Config___load_config__end', $this ); |
|
115 | + do_action('AHEE__EE_Network_Config___load_config__end', $this); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | |
@@ -126,8 +126,8 @@ discard block |
||
126 | 126 | */ |
127 | 127 | public function get_config() { |
128 | 128 | // grab network configuration |
129 | - $CFG = get_site_option( 'ee_network_config', array() ); |
|
130 | - $CFG = apply_filters( 'FHEE__EE_Network_Config__get_config__CFG', $CFG ); |
|
129 | + $CFG = get_site_option('ee_network_config', array()); |
|
130 | + $CFG = apply_filters('FHEE__EE_Network_Config__get_config__CFG', $CFG); |
|
131 | 131 | return $CFG; |
132 | 132 | } |
133 | 133 | |
@@ -141,39 +141,39 @@ discard block |
||
141 | 141 | * @param bool $add_error |
142 | 142 | * @return bool success |
143 | 143 | */ |
144 | - public function update_config( $add_success = FALSE, $add_error = TRUE ) { |
|
145 | - do_action( 'AHEE__EE_Network_Config__update_config__begin',$this ); |
|
144 | + public function update_config($add_success = FALSE, $add_error = TRUE) { |
|
145 | + do_action('AHEE__EE_Network_Config__update_config__begin', $this); |
|
146 | 146 | |
147 | 147 | //need to bust cache for comparing original if this is a multisite install |
148 | - if ( is_multisite() ) { |
|
148 | + if (is_multisite()) { |
|
149 | 149 | global $current_site; |
150 | - $cache_key = $current_site->id . ':ee_network_config'; |
|
151 | - wp_cache_delete( $cache_key, 'site-options' ); |
|
150 | + $cache_key = $current_site->id.':ee_network_config'; |
|
151 | + wp_cache_delete($cache_key, 'site-options'); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | //we have to compare existing saved config with config in memory because if there is no difference that means |
155 | 155 | //that the method executed fine but there just was no update. WordPress doesn't distinguish between false because |
156 | 156 | //there were 0 records updated because of no change vs false because some error produced problems with the update. |
157 | - $original = get_site_option( 'ee_network_config' ); |
|
157 | + $original = get_site_option('ee_network_config'); |
|
158 | 158 | |
159 | - if ( $original == $this ) { |
|
159 | + if ($original == $this) { |
|
160 | 160 | return true; |
161 | 161 | } |
162 | 162 | // update |
163 | - $saved = update_site_option( 'ee_network_config', $this ); |
|
163 | + $saved = update_site_option('ee_network_config', $this); |
|
164 | 164 | |
165 | - do_action( 'AHEE__EE_Network_Config__update_config__end', $this, $saved ); |
|
165 | + do_action('AHEE__EE_Network_Config__update_config__end', $this, $saved); |
|
166 | 166 | // if config remains the same or was updated successfully |
167 | - if ( $saved ) { |
|
168 | - if ( $add_success ) { |
|
169 | - $msg = is_multisite() ? __( 'The Event Espresso Network Configuration Settings have been successfully updated.', 'event_espresso' ) : __( 'Extra Event Espresso Configuration settings were successfully updated.', 'event_espresso' ); |
|
170 | - EE_Error::add_success( $msg ); |
|
167 | + if ($saved) { |
|
168 | + if ($add_success) { |
|
169 | + $msg = is_multisite() ? __('The Event Espresso Network Configuration Settings have been successfully updated.', 'event_espresso') : __('Extra Event Espresso Configuration settings were successfully updated.', 'event_espresso'); |
|
170 | + EE_Error::add_success($msg); |
|
171 | 171 | } |
172 | 172 | return true; |
173 | 173 | } else { |
174 | - if ( $add_error ) { |
|
175 | - $msg = is_multisite() ? __( 'The Event Espresso Network Configuration Settings were not updated.', 'event_espresso' ) : __( 'Extra Event Espresso Network Configuration settings were not updated.', 'event_espresso' ); |
|
176 | - EE_Error::add_error( $msg , __FILE__, __FUNCTION__, __LINE__ ); |
|
174 | + if ($add_error) { |
|
175 | + $msg = is_multisite() ? __('The Event Espresso Network Configuration Settings were not updated.', 'event_espresso') : __('Extra Event Espresso Network Configuration settings were not updated.', 'event_espresso'); |
|
176 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
177 | 177 | } |
178 | 178 | return false; |
179 | 179 | } |
@@ -187,9 +187,9 @@ discard block |
||
187 | 187 | * @return array |
188 | 188 | */ |
189 | 189 | public function __sleep() { |
190 | - return apply_filters( 'FHEE__EE_Network_Config__sleep',array( |
|
190 | + return apply_filters('FHEE__EE_Network_Config__sleep', array( |
|
191 | 191 | 'core', |
192 | - ) ); |
|
192 | + )); |
|
193 | 193 | } |
194 | 194 | |
195 | 195 | } //end EE_Network_Config. |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -20,13 +20,13 @@ |
||
20 | 20 | { |
21 | 21 | |
22 | 22 | |
23 | - /** |
|
24 | - * @return string |
|
25 | - */ |
|
26 | - public function capability() |
|
27 | - { |
|
28 | - return ''; |
|
29 | - } |
|
23 | + /** |
|
24 | + * @return string |
|
25 | + */ |
|
26 | + public function capability() |
|
27 | + { |
|
28 | + return ''; |
|
29 | + } |
|
30 | 30 | |
31 | 31 | |
32 | 32 | } |
@@ -13,20 +13,20 @@ |
||
13 | 13 | interface CapCheckInterface |
14 | 14 | { |
15 | 15 | |
16 | - /** |
|
17 | - * @return string |
|
18 | - */ |
|
19 | - public function capability(); |
|
16 | + /** |
|
17 | + * @return string |
|
18 | + */ |
|
19 | + public function capability(); |
|
20 | 20 | |
21 | - /** |
|
22 | - * @return string |
|
23 | - */ |
|
24 | - public function context(); |
|
21 | + /** |
|
22 | + * @return string |
|
23 | + */ |
|
24 | + public function context(); |
|
25 | 25 | |
26 | - /** |
|
27 | - * @return int|string |
|
28 | - */ |
|
29 | - public function ID(); |
|
26 | + /** |
|
27 | + * @return int|string |
|
28 | + */ |
|
29 | + public function ID(); |
|
30 | 30 | |
31 | 31 | } |
32 | 32 | // End of file CapCheckInterface.php |
@@ -23,30 +23,30 @@ |
||
23 | 23 | abstract class Command implements CommandInterface |
24 | 24 | { |
25 | 25 | |
26 | - /* |
|
26 | + /* |
|
27 | 27 | * @var CapCheckInterface $cap_check |
28 | 28 | */ |
29 | - protected $cap_check; |
|
29 | + protected $cap_check; |
|
30 | 30 | |
31 | 31 | |
32 | 32 | |
33 | - /** |
|
34 | - * @return mixed |
|
35 | - */ |
|
36 | - public function getCapCheck() |
|
37 | - { |
|
38 | - return $this->cap_check; |
|
39 | - } |
|
33 | + /** |
|
34 | + * @return mixed |
|
35 | + */ |
|
36 | + public function getCapCheck() |
|
37 | + { |
|
38 | + return $this->cap_check; |
|
39 | + } |
|
40 | 40 | |
41 | 41 | |
42 | 42 | |
43 | - /** |
|
44 | - * @param CapCheckInterface $cap_check |
|
45 | - */ |
|
46 | - public function setCapCheck(CapCheckInterface $cap_check) |
|
47 | - { |
|
48 | - $this->cap_check = $cap_check; |
|
49 | - } |
|
43 | + /** |
|
44 | + * @param CapCheckInterface $cap_check |
|
45 | + */ |
|
46 | + public function setCapCheck(CapCheckInterface $cap_check) |
|
47 | + { |
|
48 | + $this->cap_check = $cap_check; |
|
49 | + } |
|
50 | 50 | |
51 | 51 | } |
52 | 52 | // End of file Command.php |
@@ -4,8 +4,8 @@ |
||
4 | 4 | |
5 | 5 | use EventEspresso\core\domain\services\capabilities\CapCheckInterface; |
6 | 6 | |
7 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
8 | - exit( 'No direct script access allowed' ); |
|
7 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
8 | + exit('No direct script access allowed'); |
|
9 | 9 | } |
10 | 10 | |
11 | 11 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('NO direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -58,96 +58,96 @@ discard block |
||
58 | 58 | '[CO_GOOGLE_URL]' => esc_html__('Link to organization Google page', 'event_espresso'), |
59 | 59 | '[CO_LINKEDIN_URL]' => esc_html__('Link to organization LinkedIn page', 'event_espresso'), |
60 | 60 | '[CO_INSTAGRAM_URL]' => esc_html__('Link to organization Instagram page', 'event_espresso'), |
61 | - '[CO_TAX_NUMBER_*]' => sprintf( esc_html__('This is the shortcode used for displaying any tax number for the company. %1$sNote: This is a special dynamic shortcode.%2$s You can use the "prefix" parameter to indicate what the prefix for this tax number is. It defaults to "VAT/Tax Number:". To change this prefix you do the following format for this shortcode: [CO_TAX_NUMBER_* prefix="GST: "] and that will output: GST: 12345t56. Also take note that if you have NO number in your settings, the prefix is not output either.', 'event_espresso' ),'<strong>','</strong>') |
|
61 | + '[CO_TAX_NUMBER_*]' => sprintf(esc_html__('This is the shortcode used for displaying any tax number for the company. %1$sNote: This is a special dynamic shortcode.%2$s You can use the "prefix" parameter to indicate what the prefix for this tax number is. It defaults to "VAT/Tax Number:". To change this prefix you do the following format for this shortcode: [CO_TAX_NUMBER_* prefix="GST: "] and that will output: GST: 12345t56. Also take note that if you have NO number in your settings, the prefix is not output either.', 'event_espresso'), '<strong>', '</strong>') |
|
62 | 62 | ); |
63 | 63 | } |
64 | 64 | |
65 | 65 | |
66 | - protected function _parser( $shortcode ) { |
|
66 | + protected function _parser($shortcode) { |
|
67 | 67 | |
68 | - switch ( $shortcode ) { |
|
68 | + switch ($shortcode) { |
|
69 | 69 | |
70 | 70 | case '[COMPANY]' : |
71 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'name' ); |
|
71 | + return EE_Registry::instance()->CFG->organization->get_pretty('name'); |
|
72 | 72 | break; |
73 | 73 | |
74 | 74 | case '[CO_ADD1]' : |
75 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'address_1' ); |
|
75 | + return EE_Registry::instance()->CFG->organization->get_pretty('address_1'); |
|
76 | 76 | break; |
77 | 77 | |
78 | 78 | case '[CO_ADD2]' : |
79 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'address_2' ); |
|
79 | + return EE_Registry::instance()->CFG->organization->get_pretty('address_2'); |
|
80 | 80 | break; |
81 | 81 | |
82 | 82 | case '[CO_CITY]' : |
83 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'city' ); |
|
83 | + return EE_Registry::instance()->CFG->organization->get_pretty('city'); |
|
84 | 84 | break; |
85 | 85 | |
86 | 86 | case '[CO_STATE]' : |
87 | - $state = EE_Registry::instance()->load_model( 'State' )->get_one_by_ID( EE_Registry::instance()->CFG->organization->STA_ID ); |
|
87 | + $state = EE_Registry::instance()->load_model('State')->get_one_by_ID(EE_Registry::instance()->CFG->organization->STA_ID); |
|
88 | 88 | return $state->name(); |
89 | 89 | break; |
90 | 90 | |
91 | 91 | case '[CO_ZIP]' : |
92 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'zip' ); |
|
92 | + return EE_Registry::instance()->CFG->organization->get_pretty('zip'); |
|
93 | 93 | break; |
94 | 94 | |
95 | 95 | case '[CO_EMAIL]' : |
96 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'email' ); |
|
96 | + return EE_Registry::instance()->CFG->organization->get_pretty('email'); |
|
97 | 97 | break; |
98 | 98 | |
99 | 99 | case '[CO_PHONE]' : |
100 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'phone' ); |
|
100 | + return EE_Registry::instance()->CFG->organization->get_pretty('phone'); |
|
101 | 101 | break; |
102 | 102 | |
103 | 103 | case '[CO_LOGO]' : |
104 | - return '<img src="' . EE_Registry::instance()->CFG->organization->get_pretty( 'logo_url' ) . '" id="headerImage" />'; |
|
104 | + return '<img src="'.EE_Registry::instance()->CFG->organization->get_pretty('logo_url').'" id="headerImage" />'; |
|
105 | 105 | break; |
106 | 106 | |
107 | 107 | case '[CO_LOGO_URL]' : |
108 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'logo_url' ); |
|
108 | + return EE_Registry::instance()->CFG->organization->get_pretty('logo_url'); |
|
109 | 109 | break; |
110 | 110 | |
111 | 111 | case '[CO_FACEBOOK_URL]' : |
112 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'facebook' ); |
|
112 | + return EE_Registry::instance()->CFG->organization->get_pretty('facebook'); |
|
113 | 113 | break; |
114 | 114 | |
115 | 115 | case '[CO_TWITTER_URL]' : |
116 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'twitter' ); |
|
116 | + return EE_Registry::instance()->CFG->organization->get_pretty('twitter'); |
|
117 | 117 | break; |
118 | 118 | |
119 | 119 | case '[CO_PINTEREST_URL]' : |
120 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'pinterest' ); |
|
120 | + return EE_Registry::instance()->CFG->organization->get_pretty('pinterest'); |
|
121 | 121 | break; |
122 | 122 | |
123 | 123 | case '[CO_LINKEDIN_URL]' : |
124 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'linkedin' ); |
|
124 | + return EE_Registry::instance()->CFG->organization->get_pretty('linkedin'); |
|
125 | 125 | break; |
126 | 126 | |
127 | 127 | case '[CO_GOOGLE_URL]' : |
128 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'google' ); |
|
128 | + return EE_Registry::instance()->CFG->organization->get_pretty('google'); |
|
129 | 129 | break; |
130 | 130 | |
131 | 131 | case '[CO_INSTAGRAM_URL]' : |
132 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'instagram' ); |
|
132 | + return EE_Registry::instance()->CFG->organization->get_pretty('instagram'); |
|
133 | 133 | break; |
134 | 134 | |
135 | 135 | } |
136 | 136 | |
137 | 137 | //also allow for parameter shortcode |
138 | - if ( strpos( $shortcode, '[CO_TAX_NUMBER_*' ) !== FALSE ) { |
|
138 | + if (strpos($shortcode, '[CO_TAX_NUMBER_*') !== FALSE) { |
|
139 | 139 | //first see if there is any company tax number set and bail early if not |
140 | 140 | $tax_number = EE_Registry::instance()->CFG->organization->vat; |
141 | - if ( empty( $tax_number ) ) { |
|
141 | + if (empty($tax_number)) { |
|
142 | 142 | return ''; |
143 | 143 | } |
144 | 144 | |
145 | 145 | //see if there are any attributes. |
146 | - $attrs = $this->_get_shortcode_attrs( $shortcode ); |
|
146 | + $attrs = $this->_get_shortcode_attrs($shortcode); |
|
147 | 147 | |
148 | 148 | //set custom attrs if present (or default) |
149 | - $prefix = isset( $attrs['prefix'] ) ? $attrs['prefix'] : esc_html__('VAT/Tax Number: ', 'event_espresso'); |
|
150 | - return $prefix . $tax_number; |
|
149 | + $prefix = isset($attrs['prefix']) ? $attrs['prefix'] : esc_html__('VAT/Tax Number: ', 'event_espresso'); |
|
150 | + return $prefix.$tax_number; |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | return ''; |
@@ -1,6 +1,7 @@ |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | +} |
|
4 | 5 | |
5 | 6 | /** |
6 | 7 | * Event Espresso |