@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
| 4 | - exit( 'No direct script access allowed' ); |
|
| 3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
| 4 | + exit('No direct script access allowed'); |
|
| 5 | 5 | } |
| 6 | 6 | |
| 7 | 7 | |
@@ -53,10 +53,10 @@ discard block |
||
| 53 | 53 | * @param \EE_Message_Resource_Manager $Messenger_And_Message_Type_Manager |
| 54 | 54 | * @return \EE_Message_Factory instance |
| 55 | 55 | */ |
| 56 | - public static function instance( EE_Message_Resource_Manager $Messenger_And_Message_Type_Manager = null ) { |
|
| 56 | + public static function instance(EE_Message_Resource_Manager $Messenger_And_Message_Type_Manager = null) { |
|
| 57 | 57 | // check if class object is instantiated, and instantiated properly |
| 58 | - if ( ! self::$_instance instanceof EE_Message_Factory ) { |
|
| 59 | - self::$_instance = new EE_Message_Factory( $Messenger_And_Message_Type_Manager ); |
|
| 58 | + if ( ! self::$_instance instanceof EE_Message_Factory) { |
|
| 59 | + self::$_instance = new EE_Message_Factory($Messenger_And_Message_Type_Manager); |
|
| 60 | 60 | } |
| 61 | 61 | return self::$_instance; |
| 62 | 62 | } |
@@ -69,9 +69,9 @@ discard block |
||
| 69 | 69 | * @param bool $validate - whether or not to throw exceptions if resources are invalid |
| 70 | 70 | * @return mixed |
| 71 | 71 | */ |
| 72 | - public static function create( $props_n_values = array(), $validate = true ) { |
|
| 73 | - $Message_Factory = EE_Registry::instance()->load_lib( 'Message_Factory' ); |
|
| 74 | - return $Message_Factory->_create( $props_n_values, $validate ); |
|
| 72 | + public static function create($props_n_values = array(), $validate = true) { |
|
| 73 | + $Message_Factory = EE_Registry::instance()->load_lib('Message_Factory'); |
|
| 74 | + return $Message_Factory->_create($props_n_values, $validate); |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | |
@@ -83,9 +83,9 @@ discard block |
||
| 83 | 83 | * @return \EE_Message |
| 84 | 84 | * @throws \EE_Error |
| 85 | 85 | */ |
| 86 | - public static function set_messenger_and_message_type( EE_Message $message, $validate = true ) { |
|
| 87 | - $Message_Factory = EE_Registry::instance()->load_lib( 'Message_Factory' ); |
|
| 88 | - return $Message_Factory->_set_messenger_and_message_type( $message, $validate ); |
|
| 86 | + public static function set_messenger_and_message_type(EE_Message $message, $validate = true) { |
|
| 87 | + $Message_Factory = EE_Registry::instance()->load_lib('Message_Factory'); |
|
| 88 | + return $Message_Factory->_set_messenger_and_message_type($message, $validate); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | |
@@ -97,9 +97,9 @@ discard block |
||
| 97 | 97 | * @return \EE_Message |
| 98 | 98 | * @throws \EE_Error |
| 99 | 99 | */ |
| 100 | - public static function set_messenger( EE_Message $message, $validate = true ) { |
|
| 101 | - $Message_Factory = EE_Registry::instance()->load_lib( 'Message_Factory' ); |
|
| 102 | - return $Message_Factory->_set_messenger( $message, $validate ); |
|
| 100 | + public static function set_messenger(EE_Message $message, $validate = true) { |
|
| 101 | + $Message_Factory = EE_Registry::instance()->load_lib('Message_Factory'); |
|
| 102 | + return $Message_Factory->_set_messenger($message, $validate); |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | |
@@ -111,9 +111,9 @@ discard block |
||
| 111 | 111 | * @return \EE_Message |
| 112 | 112 | * @throws \EE_Error |
| 113 | 113 | */ |
| 114 | - public static function set_message_type( EE_Message $message, $validate = true ) { |
|
| 115 | - $Message_Factory = EE_Registry::instance()->load_lib( 'Message_Factory' ); |
|
| 116 | - return $Message_Factory->_set_message_type( $message, $validate ); |
|
| 114 | + public static function set_message_type(EE_Message $message, $validate = true) { |
|
| 115 | + $Message_Factory = EE_Registry::instance()->load_lib('Message_Factory'); |
|
| 116 | + return $Message_Factory->_set_message_type($message, $validate); |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | |
@@ -125,13 +125,13 @@ discard block |
||
| 125 | 125 | * @return \EE_Message |
| 126 | 126 | * @throws \EE_Error |
| 127 | 127 | */ |
| 128 | - protected function _create( $props_n_values = array(), $validate = true ) { |
|
| 129 | - if ( ! empty( $props_n_values['MSG_ID'] ) ) { |
|
| 130 | - $message = EE_Message::new_instance_from_db( $props_n_values ); |
|
| 128 | + protected function _create($props_n_values = array(), $validate = true) { |
|
| 129 | + if ( ! empty($props_n_values['MSG_ID'])) { |
|
| 130 | + $message = EE_Message::new_instance_from_db($props_n_values); |
|
| 131 | 131 | } else { |
| 132 | - $message = EE_Message::new_instance( $props_n_values ); |
|
| 132 | + $message = EE_Message::new_instance($props_n_values); |
|
| 133 | 133 | } |
| 134 | - return $this->_set_messenger_and_message_type( $message, $validate ); |
|
| 134 | + return $this->_set_messenger_and_message_type($message, $validate); |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | |
@@ -143,9 +143,9 @@ discard block |
||
| 143 | 143 | * @return \EE_Message |
| 144 | 144 | * @throws \EE_Error |
| 145 | 145 | */ |
| 146 | - protected function _set_messenger_and_message_type( EE_Message $message, $validate = true ) { |
|
| 147 | - $message = $this->_set_messenger( $message, $validate ); |
|
| 148 | - $message = $this->_set_message_type( $message, $validate ); |
|
| 146 | + protected function _set_messenger_and_message_type(EE_Message $message, $validate = true) { |
|
| 147 | + $message = $this->_set_messenger($message, $validate); |
|
| 148 | + $message = $this->_set_message_type($message, $validate); |
|
| 149 | 149 | return $message; |
| 150 | 150 | } |
| 151 | 151 | |
@@ -158,14 +158,14 @@ discard block |
||
| 158 | 158 | * @return \EE_Message |
| 159 | 159 | * @throws \EE_Error |
| 160 | 160 | */ |
| 161 | - protected function _set_messenger( EE_Message $message, $validate = true ) { |
|
| 162 | - $messenger = $this->_messenger_and_message_type_manager->get_messenger( $message->messenger() ); |
|
| 163 | - if ( $messenger instanceof EE_Messenger ) { |
|
| 164 | - $message->set_messenger_object( $messenger ); |
|
| 165 | - } else if ( $validate ) { |
|
| 161 | + protected function _set_messenger(EE_Message $message, $validate = true) { |
|
| 162 | + $messenger = $this->_messenger_and_message_type_manager->get_messenger($message->messenger()); |
|
| 163 | + if ($messenger instanceof EE_Messenger) { |
|
| 164 | + $message->set_messenger_object($messenger); |
|
| 165 | + } else if ($validate) { |
|
| 166 | 166 | throw new EE_Error( |
| 167 | 167 | sprintf( |
| 168 | - __( 'The "%1$s" messenger set for this message is missing or invalid. Please double-check the spelling and verify that the correct files exist.', 'event_espresso' ), |
|
| 168 | + __('The "%1$s" messenger set for this message is missing or invalid. Please double-check the spelling and verify that the correct files exist.', 'event_espresso'), |
|
| 169 | 169 | $message->messenger() |
| 170 | 170 | ) |
| 171 | 171 | ); |
@@ -182,14 +182,14 @@ discard block |
||
| 182 | 182 | * @return \EE_Message |
| 183 | 183 | * @throws \EE_Error |
| 184 | 184 | */ |
| 185 | - protected function _set_message_type( EE_Message $message, $validate = true ) { |
|
| 186 | - $message_type = $this->_messenger_and_message_type_manager->get_message_type( $message->message_type() ); |
|
| 187 | - if ( $message_type instanceof EE_Message_Type ) { |
|
| 188 | - $message->set_message_type_object( $message_type ); |
|
| 189 | - } else if ( $validate ) { |
|
| 185 | + protected function _set_message_type(EE_Message $message, $validate = true) { |
|
| 186 | + $message_type = $this->_messenger_and_message_type_manager->get_message_type($message->message_type()); |
|
| 187 | + if ($message_type instanceof EE_Message_Type) { |
|
| 188 | + $message->set_message_type_object($message_type); |
|
| 189 | + } else if ($validate) { |
|
| 190 | 190 | throw new EE_Error( |
| 191 | 191 | sprintf( |
| 192 | - __( 'The %1$s message type set for this message is missing or invalid. Please double-check the spelling and verify that the correct files exist.', 'event_espresso' ), |
|
| 192 | + __('The %1$s message type set for this message is missing or invalid. Please double-check the spelling and verify that the correct files exist.', 'event_espresso'), |
|
| 193 | 193 | $message->message_type() |
| 194 | 194 | ) |
| 195 | 195 | ); |
@@ -101,13 +101,13 @@ discard block |
||
| 101 | 101 | $context = '', |
| 102 | 102 | $preview = false |
| 103 | 103 | ) { |
| 104 | - $this->data = is_array( $data ) ? $data : array( $data ); |
|
| 104 | + $this->data = is_array($data) ? $data : array($data); |
|
| 105 | 105 | $this->context = $context; |
| 106 | 106 | $this->preview = $preview; |
| 107 | 107 | $this->_EEMSG = $ee_msg; |
| 108 | 108 | //this immediately validates whether the given messenger/messagetype are active or not |
| 109 | 109 | //and sets the valid flag. |
| 110 | - $this->_set_valid( $messenger, $message_type ); |
|
| 110 | + $this->_set_valid($messenger, $message_type); |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | * @param string $messenger_slug |
| 117 | 117 | * @param string $message_type_slug |
| 118 | 118 | */ |
| 119 | - protected function _set_valid( $messenger_slug , $message_type_slug ) { |
|
| 119 | + protected function _set_valid($messenger_slug, $message_type_slug) { |
|
| 120 | 120 | $this->_valid = true; |
| 121 | 121 | $validated_for_use = $this->_EEMSG->validate_for_use( |
| 122 | 122 | EE_Message_Factory::create( |
@@ -127,17 +127,17 @@ discard block |
||
| 127 | 127 | ) |
| 128 | 128 | ); |
| 129 | 129 | |
| 130 | - if ( ! isset( $validated_for_use['messenger'] ) || ! $validated_for_use['messenger'] instanceof EE_Messenger ) { |
|
| 131 | - $this->_error_msg[] = sprintf( __( 'The %s Messenger is not active.', 'event_espresso' ), $messenger_slug ); |
|
| 130 | + if ( ! isset($validated_for_use['messenger']) || ! $validated_for_use['messenger'] instanceof EE_Messenger) { |
|
| 131 | + $this->_error_msg[] = sprintf(__('The %s Messenger is not active.', 'event_espresso'), $messenger_slug); |
|
| 132 | 132 | $this->_valid = false; |
| 133 | 133 | } else { |
| 134 | 134 | $this->messenger = $validated_for_use['messenger']; |
| 135 | 135 | $this->_send_now = $this->messenger->send_now(); |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | - if ( ! isset( $validated_for_use['message_type'] ) || ! $validated_for_use['message_type'] instanceof EE_message_type ) { |
|
| 138 | + if ( ! isset($validated_for_use['message_type']) || ! $validated_for_use['message_type'] instanceof EE_message_type) { |
|
| 139 | 139 | $this->_valid = false; |
| 140 | - $this->_error_msg[] = sprintf( __( 'The %s Message Type is not active.', 'event_espresso' ), $message_type_slug ); |
|
| 140 | + $this->_error_msg[] = sprintf(__('The %s Message Type is not active.', 'event_espresso'), $message_type_slug); |
|
| 141 | 141 | } else { |
| 142 | 142 | $this->message_type = $validated_for_use['message_type']; |
| 143 | 143 | } |
@@ -164,10 +164,10 @@ discard block |
||
| 164 | 164 | * Returns an instantiated EE_Message object from the internal data. |
| 165 | 165 | */ |
| 166 | 166 | public function get_EE_Message() { |
| 167 | - if ( ! $this->valid() ) { |
|
| 167 | + if ( ! $this->valid()) { |
|
| 168 | 168 | return null; |
| 169 | 169 | } |
| 170 | - if ( $this->_EE_Message instanceof EE_Message ) { |
|
| 170 | + if ($this->_EE_Message instanceof EE_Message) { |
|
| 171 | 171 | return $this->_EE_Message; |
| 172 | 172 | } |
| 173 | 173 | $this->_EE_Message = EE_Message_Factory::create( |
@@ -192,15 +192,15 @@ discard block |
||
| 192 | 192 | * @param bool $preview Used to indicate that the preview data handler is to be returned. |
| 193 | 193 | * @return string |
| 194 | 194 | */ |
| 195 | - public function get_data_handler_class_name( $preview = false ) { |
|
| 196 | - if ( $this->_data_handler_class_name === '' && $this->valid() ) { |
|
| 197 | - $ref = $preview ? 'Preview' : $this->message_type->get_data_handler( $this->data ); |
|
| 195 | + public function get_data_handler_class_name($preview = false) { |
|
| 196 | + if ($this->_data_handler_class_name === '' && $this->valid()) { |
|
| 197 | + $ref = $preview ? 'Preview' : $this->message_type->get_data_handler($this->data); |
|
| 198 | 198 | //make sure internal data is updated. |
| 199 | 199 | $this->data = $this->message_type->get_data(); |
| 200 | 200 | |
| 201 | 201 | //verify |
| 202 | - $this->_data_handler_class_name = EE_Message_To_Generate::verify_and_retrieve_class_name_for_data_handler_reference( $ref ); |
|
| 203 | - if ( $this->_data_handler_class_name === '' ) { |
|
| 202 | + $this->_data_handler_class_name = EE_Message_To_Generate::verify_and_retrieve_class_name_for_data_handler_reference($ref); |
|
| 203 | + if ($this->_data_handler_class_name === '') { |
|
| 204 | 204 | $this->_valid = false; |
| 205 | 205 | } |
| 206 | 206 | } |
@@ -216,9 +216,9 @@ discard block |
||
| 216 | 216 | * @param string $data_handler_reference |
| 217 | 217 | * @return string |
| 218 | 218 | */ |
| 219 | - public static function verify_and_retrieve_class_name_for_data_handler_reference( $data_handler_reference ) { |
|
| 220 | - $class_name = 'EE_Messages_' . $data_handler_reference . '_incoming_data'; |
|
| 221 | - if ( ! class_exists( $class_name ) ) { |
|
| 219 | + public static function verify_and_retrieve_class_name_for_data_handler_reference($data_handler_reference) { |
|
| 220 | + $class_name = 'EE_Messages_'.$data_handler_reference.'_incoming_data'; |
|
| 221 | + if ( ! class_exists($class_name)) { |
|
| 222 | 222 | EE_Error::add_error( |
| 223 | 223 | sprintf( |
| 224 | 224 | __( |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
| 3 | - exit( 'No direct script access allowed' ); |
|
| 2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
| 3 | + exit('No direct script access allowed'); |
|
| 4 | 4 | } |
| 5 | 5 | |
| 6 | 6 | |
@@ -39,9 +39,9 @@ discard block |
||
| 39 | 39 | * @param mixed $info |
| 40 | 40 | * @return bool |
| 41 | 41 | */ |
| 42 | - public function add( $object, $info = null ) { |
|
| 43 | - $info = empty( $info ) && $object instanceof EE_Message_Type ? $object->name : $info; |
|
| 44 | - return parent::add( $object, $info ); // TODO: Change the autogenerated stub |
|
| 42 | + public function add($object, $info = null) { |
|
| 43 | + $info = empty($info) && $object instanceof EE_Message_Type ? $object->name : $info; |
|
| 44 | + return parent::add($object, $info); // TODO: Change the autogenerated stub |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | |
@@ -57,9 +57,9 @@ discard block |
||
| 57 | 57 | * @param mixed $info |
| 58 | 58 | * @return bool |
| 59 | 59 | */ |
| 60 | - public function set_info( $object, $info = null ) { |
|
| 61 | - $info = empty( $info ) && $object instanceof EE_Message_Type ? $object->name : $info; |
|
| 62 | - return parent::set_info( $object, $info ); |
|
| 60 | + public function set_info($object, $info = null) { |
|
| 61 | + $info = empty($info) && $object instanceof EE_Message_Type ? $object->name : $info; |
|
| 62 | + return parent::set_info($object, $info); |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | |
@@ -74,8 +74,8 @@ discard block |
||
| 74 | 74 | * @param mixed |
| 75 | 75 | * @return null | object |
| 76 | 76 | */ |
| 77 | - public function get_by_info( $info ) { |
|
| 78 | - return parent::get_by_info( $info ); // TODO: Change the autogenerated stub |
|
| 77 | + public function get_by_info($info) { |
|
| 78 | + return parent::get_by_info($info); // TODO: Change the autogenerated stub |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | |
@@ -89,8 +89,8 @@ discard block |
||
| 89 | 89 | * @param object $object |
| 90 | 90 | * @return bool |
| 91 | 91 | */ |
| 92 | - public function has( $object ) { |
|
| 93 | - return parent::has( $object ); // TODO: Change the autogenerated stub |
|
| 92 | + public function has($object) { |
|
| 93 | + return parent::has($object); // TODO: Change the autogenerated stub |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | |
@@ -104,8 +104,8 @@ discard block |
||
| 104 | 104 | * @param string $message_type_classname |
| 105 | 105 | * @return bool |
| 106 | 106 | */ |
| 107 | - public function has_by_classname( $message_type_classname ) { |
|
| 108 | - return $this->get_by_info( $message_type_classname ) instanceof $message_type_classname ? true :false; |
|
| 107 | + public function has_by_classname($message_type_classname) { |
|
| 108 | + return $this->get_by_info($message_type_classname) instanceof $message_type_classname ? true : false; |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | |
@@ -119,8 +119,8 @@ discard block |
||
| 119 | 119 | * @param $object |
| 120 | 120 | * @return bool |
| 121 | 121 | */ |
| 122 | - public function remove( $object ) { |
|
| 123 | - return parent::remove( $object ); // TODO: Change the autogenerated stub |
|
| 122 | + public function remove($object) { |
|
| 123 | + return parent::remove($object); // TODO: Change the autogenerated stub |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | |
@@ -134,8 +134,8 @@ discard block |
||
| 134 | 134 | * @param $object |
| 135 | 135 | * @return void |
| 136 | 136 | */ |
| 137 | - public function set_current( $object ) { |
|
| 138 | - parent::set_current( $object ); // TODO: Change the autogenerated stub |
|
| 137 | + public function set_current($object) { |
|
| 138 | + parent::set_current($object); // TODO: Change the autogenerated stub |
|
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | |
@@ -149,8 +149,8 @@ discard block |
||
| 149 | 149 | * @param $info |
| 150 | 150 | * @return void |
| 151 | 151 | */ |
| 152 | - public function set_current_by_info( $info ) { |
|
| 153 | - parent::set_current_by_info( $info ); // TODO: Change the autogenerated stub |
|
| 152 | + public function set_current_by_info($info) { |
|
| 153 | + parent::set_current_by_info($info); // TODO: Change the autogenerated stub |
|
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | |
@@ -164,10 +164,10 @@ discard block |
||
| 164 | 164 | * @return void |
| 165 | 165 | */ |
| 166 | 166 | public function show_collection_classes() { |
| 167 | - if ( WP_DEBUG ) { |
|
| 167 | + if (WP_DEBUG) { |
|
| 168 | 168 | $this->rewind(); |
| 169 | - while ( $this->valid() ) { |
|
| 170 | - echo '<h5 style="color:#2EA2CC;">collection class : <span style="color:#E76700">' . $this->getInfo() |
|
| 169 | + while ($this->valid()) { |
|
| 170 | + echo '<h5 style="color:#2EA2CC;">collection class : <span style="color:#E76700">'.$this->getInfo() |
|
| 171 | 171 | . '</span></h5>'; |
| 172 | 172 | $this->next(); |
| 173 | 173 | } |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
| 3 | - exit( 'No direct script access allowed' ); |
|
| 2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
| 3 | + exit('No direct script access allowed'); |
|
| 4 | 4 | } |
| 5 | 5 | |
| 6 | 6 | |
@@ -32,8 +32,8 @@ discard block |
||
| 32 | 32 | * |
| 33 | 33 | * @param EE_Messenger_Collection $messengers |
| 34 | 34 | */ |
| 35 | - public function __construct( EE_Messenger_Collection $messengers ) { |
|
| 36 | - $this->set_messenger_collection( $messengers ); |
|
| 35 | + public function __construct(EE_Messenger_Collection $messengers) { |
|
| 36 | + $this->set_messenger_collection($messengers); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | /** |
| 51 | 51 | * @param mixed $messengers |
| 52 | 52 | */ |
| 53 | - public function set_messenger_collection( EE_Messenger_Collection $messengers ) { |
|
| 53 | + public function set_messenger_collection(EE_Messenger_Collection $messengers) { |
|
| 54 | 54 | $this->_messenger_collection = $messengers; |
| 55 | 55 | } |
| 56 | 56 | |
@@ -63,25 +63,25 @@ discard block |
||
| 63 | 63 | * @param string $folder |
| 64 | 64 | * @return void |
| 65 | 65 | */ |
| 66 | - public function load_messengers_from_folder( $folder = '' ) { |
|
| 66 | + public function load_messengers_from_folder($folder = '') { |
|
| 67 | 67 | //make sure autoloaders are set (fail-safe) |
| 68 | 68 | EED_Messages::set_autoloaders(); |
| 69 | - $folder = ! empty( $folder ) ? $folder : EE_LIBRARIES . 'messages' . DS . 'messenger'; |
|
| 70 | - $folder .= $folder[ strlen( $folder ) - 1 ] != DS ? DS : ''; |
|
| 69 | + $folder = ! empty($folder) ? $folder : EE_LIBRARIES.'messages'.DS.'messenger'; |
|
| 70 | + $folder .= $folder[strlen($folder) - 1] != DS ? DS : ''; |
|
| 71 | 71 | // get all the files in that folder that end in ".class.php |
| 72 | 72 | $filepaths = apply_filters( |
| 73 | 73 | 'FHEE__EE_messages__get_installed__messenger_files', |
| 74 | - glob( $folder . '*.class.php' ) |
|
| 74 | + glob($folder.'*.class.php') |
|
| 75 | 75 | ); |
| 76 | - if ( empty( $filepaths ) ) { |
|
| 76 | + if (empty($filepaths)) { |
|
| 77 | 77 | return; |
| 78 | 78 | } |
| 79 | - foreach ( (array)$filepaths as $file_path ) { |
|
| 79 | + foreach ((array) $filepaths as $file_path) { |
|
| 80 | 80 | // extract filename from path |
| 81 | - $file_path = basename( $file_path ); |
|
| 81 | + $file_path = basename($file_path); |
|
| 82 | 82 | // now remove any file extensions |
| 83 | - $messenger_class_name = substr( $file_path, 0, strpos( $file_path, '.' ) ); |
|
| 84 | - $this->_load_messenger( new $messenger_class_name() ); |
|
| 83 | + $messenger_class_name = substr($file_path, 0, strpos($file_path, '.')); |
|
| 84 | + $this->_load_messenger(new $messenger_class_name()); |
|
| 85 | 85 | } |
| 86 | 86 | } |
| 87 | 87 | |
@@ -97,10 +97,10 @@ discard block |
||
| 97 | 97 | EED_Messages::set_autoloaders(); |
| 98 | 98 | $active_messengers = apply_filters( |
| 99 | 99 | 'FHEE__EEH_MSG_Template__get_active_messengers_in_db', |
| 100 | - get_option( 'ee_active_messengers', array() ) |
|
| 100 | + get_option('ee_active_messengers', array()) |
|
| 101 | 101 | ); |
| 102 | - foreach ( (array)$active_messengers as $active_messenger_classname => $active_messenger ) { |
|
| 103 | - $this->_load_messenger( $active_messenger ); |
|
| 102 | + foreach ((array) $active_messengers as $active_messenger_classname => $active_messenger) { |
|
| 103 | + $this->_load_messenger($active_messenger); |
|
| 104 | 104 | } |
| 105 | 105 | } |
| 106 | 106 | |
@@ -112,8 +112,8 @@ discard block |
||
| 112 | 112 | * @param \EE_Messenger $messenger |
| 113 | 113 | * @return bool |
| 114 | 114 | */ |
| 115 | - protected function _load_messenger( EE_Messenger $messenger ) { |
|
| 116 | - if ( $this->messenger_collection()->has_by_classname( $messenger->name ) ) { |
|
| 115 | + protected function _load_messenger(EE_Messenger $messenger) { |
|
| 116 | + if ($this->messenger_collection()->has_by_classname($messenger->name)) { |
|
| 117 | 117 | return true; |
| 118 | 118 | } |
| 119 | 119 | return $this->messenger_collection()->add( |