@@ -10,17 +10,17 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if we aren't being uninstalled. |
| 13 | -if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { |
|
| 13 | +if ( ! defined('WP_UNINSTALL_PLUGIN')) { |
|
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | -require_once( dirname( __FILE__ ) . '/includes/constants.php' ); |
|
| 18 | -require_once( WORDPOINTS_DIR . '/includes/functions.php' ); |
|
| 19 | -require_once( WORDPOINTS_DIR . '/includes/class-installables.php' ); |
|
| 20 | -require_once( WORDPOINTS_DIR . '/includes/class-un-installer-base.php' ); |
|
| 17 | +require_once(dirname(__FILE__) . '/includes/constants.php'); |
|
| 18 | +require_once(WORDPOINTS_DIR . '/includes/functions.php'); |
|
| 19 | +require_once(WORDPOINTS_DIR . '/includes/class-installables.php'); |
|
| 20 | +require_once(WORDPOINTS_DIR . '/includes/class-un-installer-base.php'); |
|
| 21 | 21 | |
| 22 | 22 | wordpoints_register_installer(); |
| 23 | 23 | |
| 24 | -WordPoints_Installables::uninstall( 'plugin', 'wordpoints' ); |
|
| 24 | +WordPoints_Installables::uninstall('plugin', 'wordpoints'); |
|
| 25 | 25 | |
| 26 | 26 | // EOF |
@@ -40,11 +40,11 @@ discard block |
||
| 40 | 40 | |
| 41 | 41 | $this->backup['original_blog_id'] = get_current_blog_id(); |
| 42 | 42 | |
| 43 | - if ( isset( $GLOBALS['_wp_switched_stack'] ) ) { |
|
| 43 | + if (isset($GLOBALS['_wp_switched_stack'])) { |
|
| 44 | 44 | $this->backup['switched_stack'] = $GLOBALS['_wp_switched_stack']; |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - if ( isset( $GLOBALS['switched'] ) ) { |
|
| 47 | + if (isset($GLOBALS['switched'])) { |
|
| 48 | 48 | $this->backup['switched'] = $GLOBALS['switched']; |
| 49 | 49 | } |
| 50 | 50 | |
@@ -62,18 +62,18 @@ discard block |
||
| 62 | 62 | */ |
| 63 | 63 | public function restore() { |
| 64 | 64 | |
| 65 | - switch_to_blog( $this->backup['original_blog_id'] ); |
|
| 65 | + switch_to_blog($this->backup['original_blog_id']); |
|
| 66 | 66 | |
| 67 | - if ( isset( $this->backup['switched_stack'] ) ) { |
|
| 67 | + if (isset($this->backup['switched_stack'])) { |
|
| 68 | 68 | $GLOBALS['_wp_switched_stack'] = $this->backup['switched_stack']; |
| 69 | 69 | } else { |
| 70 | - unset( $GLOBALS['_wp_switched_stack'] ); |
|
| 70 | + unset($GLOBALS['_wp_switched_stack']); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - if ( isset( $this->backup['switched'] ) ) { |
|
| 73 | + if (isset($this->backup['switched'])) { |
|
| 74 | 74 | $GLOBALS['switched'] = $this->backup['switched']; |
| 75 | 75 | } else { |
| 76 | - unset( $GLOBALS['switched'] ); |
|
| 76 | + unset($GLOBALS['switched']); |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | return $this->backup['original_blog_id']; |
@@ -94,15 +94,15 @@ discard block |
||
| 94 | 94 | /** |
| 95 | 95 | * @since 2.1.0 |
| 96 | 96 | */ |
| 97 | - public function __construct( $slug, $parent = null ) { |
|
| 97 | + public function __construct($slug, $parent = null) { |
|
| 98 | 98 | |
| 99 | 99 | $this->slug = $slug; |
| 100 | 100 | $this->full_slug = $slug; |
| 101 | 101 | |
| 102 | - if ( $parent instanceof WordPoints_App ) { |
|
| 102 | + if ($parent instanceof WordPoints_App) { |
|
| 103 | 103 | $this->parent = $parent; |
| 104 | 104 | |
| 105 | - if ( 'apps' !== $this->parent->full_slug ) { |
|
| 105 | + if ('apps' !== $this->parent->full_slug) { |
|
| 106 | 106 | $this->full_slug = $this->parent->full_slug . '-' . $this->full_slug; |
| 107 | 107 | } |
| 108 | 108 | } |
@@ -122,21 +122,21 @@ discard block |
||
| 122 | 122 | * @return null|object|WordPoints_App|WordPoints_Class_RegistryI|WordPoints_Class_Registry_ChildrenI|WordPoints_Class_Registry_DeepI |
| 123 | 123 | * The sub app, or null if not found. |
| 124 | 124 | */ |
| 125 | - public function get_sub_app( $slug ) { |
|
| 125 | + public function get_sub_app($slug) { |
|
| 126 | 126 | |
| 127 | - $sub_app = $this->sub_apps->get( $slug, array( $this ) ); |
|
| 127 | + $sub_app = $this->sub_apps->get($slug, array($this)); |
|
| 128 | 128 | |
| 129 | - if ( ! $sub_app ) { |
|
| 129 | + if ( ! $sub_app) { |
|
| 130 | 130 | return null; |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | if ( |
| 134 | - empty( $this->did_init[ $slug ] ) |
|
| 134 | + empty($this->did_init[$slug]) |
|
| 135 | 135 | && ! self::$main->silent |
| 136 | - && $this->should_do_registry_init( $sub_app ) |
|
| 136 | + && $this->should_do_registry_init($sub_app) |
|
| 137 | 137 | ) { |
| 138 | 138 | |
| 139 | - $this->did_init[ $slug ] = true; |
|
| 139 | + $this->did_init[$slug] = true; |
|
| 140 | 140 | |
| 141 | 141 | /** |
| 142 | 142 | * Initialization of an app registry. |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | * @param WordPoints_Class_RegistryI|WordPoints_Class_Registry_ChildrenI |
| 147 | 147 | * $registry The registry object. |
| 148 | 148 | */ |
| 149 | - do_action( "wordpoints_init_app_registry-{$this->full_slug}-{$slug}", $sub_app ); |
|
| 149 | + do_action("wordpoints_init_app_registry-{$this->full_slug}-{$slug}", $sub_app); |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | return $sub_app; |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | * |
| 173 | 173 | * @return bool Whether to call the init action or not. |
| 174 | 174 | */ |
| 175 | - protected function should_do_registry_init( $registry ) { |
|
| 175 | + protected function should_do_registry_init($registry) { |
|
| 176 | 176 | return ( |
| 177 | 177 | $registry instanceof WordPoints_Class_RegistryI |
| 178 | 178 | || $registry instanceof WordPoints_Class_Registry_ChildrenI |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | * |
| 198 | 198 | * @param WordPoints_App $app The app object. |
| 199 | 199 | */ |
| 200 | - do_action( "wordpoints_init_app-{$this->full_slug}", $this ); |
|
| 200 | + do_action("wordpoints_init_app-{$this->full_slug}", $this); |
|
| 201 | 201 | } |
| 202 | 202 | } |
| 203 | 203 | |
@@ -40,13 +40,13 @@ discard block |
||
| 40 | 40 | protected function init() { |
| 41 | 41 | |
| 42 | 42 | $sub_apps = $this->sub_apps; |
| 43 | - $sub_apps->register( 'router', 'WordPoints_Hook_Router' ); |
|
| 44 | - $sub_apps->register( 'actions', 'WordPoints_Hook_Actions' ); |
|
| 45 | - $sub_apps->register( 'events', 'WordPoints_Hook_Events' ); |
|
| 46 | - $sub_apps->register( 'reactors', 'WordPoints_Class_Registry_Persistent' ); |
|
| 47 | - $sub_apps->register( 'reaction_stores', 'WordPoints_Class_Registry_Children' ); |
|
| 48 | - $sub_apps->register( 'extensions', 'WordPoints_Class_Registry_Persistent' ); |
|
| 49 | - $sub_apps->register( 'conditions', 'WordPoints_Class_Registry_Children' ); |
|
| 43 | + $sub_apps->register('router', 'WordPoints_Hook_Router'); |
|
| 44 | + $sub_apps->register('actions', 'WordPoints_Hook_Actions'); |
|
| 45 | + $sub_apps->register('events', 'WordPoints_Hook_Events'); |
|
| 46 | + $sub_apps->register('reactors', 'WordPoints_Class_Registry_Persistent'); |
|
| 47 | + $sub_apps->register('reaction_stores', 'WordPoints_Class_Registry_Children'); |
|
| 48 | + $sub_apps->register('extensions', 'WordPoints_Class_Registry_Persistent'); |
|
| 49 | + $sub_apps->register('conditions', 'WordPoints_Class_Registry_Children'); |
|
| 50 | 50 | |
| 51 | 51 | parent::init(); |
| 52 | 52 | } |
@@ -69,8 +69,8 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | public function get_current_mode() { |
| 71 | 71 | |
| 72 | - if ( ! isset( $this->current_mode ) ) { |
|
| 73 | - $this->current_mode = ( wordpoints_is_network_context() ? 'network' : 'standard' ); |
|
| 72 | + if ( ! isset($this->current_mode)) { |
|
| 73 | + $this->current_mode = (wordpoints_is_network_context() ? 'network' : 'standard'); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | return $this->current_mode; |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | * |
| 89 | 89 | * @param string $mode The slug of the mode to set as the current mode. |
| 90 | 90 | */ |
| 91 | - public function set_current_mode( $mode ) { |
|
| 91 | + public function set_current_mode($mode) { |
|
| 92 | 92 | $this->current_mode = $mode; |
| 93 | 93 | } |
| 94 | 94 | |
@@ -101,19 +101,19 @@ discard block |
||
| 101 | 101 | * |
| 102 | 102 | * @return WordPoints_Hook_Reaction_StoreI|false The reaction storage object. |
| 103 | 103 | */ |
| 104 | - public function get_reaction_store( $slug ) { |
|
| 104 | + public function get_reaction_store($slug) { |
|
| 105 | 105 | |
| 106 | - $reaction_store = $this->get_sub_app( 'reaction_stores' )->get( |
|
| 106 | + $reaction_store = $this->get_sub_app('reaction_stores')->get( |
|
| 107 | 107 | $this->get_current_mode() |
| 108 | 108 | , $slug |
| 109 | 109 | ); |
| 110 | 110 | |
| 111 | - if ( ! $reaction_store instanceof WordPoints_Hook_Reaction_StoreI ) { |
|
| 111 | + if ( ! $reaction_store instanceof WordPoints_Hook_Reaction_StoreI) { |
|
| 112 | 112 | return false; |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | // Allowing access to stores out-of-context would lead to strange behavior. |
| 116 | - if ( false === $reaction_store->get_context_id() ) { |
|
| 116 | + if (false === $reaction_store->get_context_id()) { |
|
| 117 | 117 | return false; |
| 118 | 118 | } |
| 119 | 119 | |
@@ -129,30 +129,30 @@ discard block |
||
| 129 | 129 | * |
| 130 | 130 | * @return WordPoints_Hook_Reaction_StoreI[] The reaction stores with this slug. |
| 131 | 131 | */ |
| 132 | - public function get_reaction_stores( $slug ) { |
|
| 132 | + public function get_reaction_stores($slug) { |
|
| 133 | 133 | |
| 134 | - $reaction_stores = $this->get_sub_app( 'reaction_stores' ); |
|
| 134 | + $reaction_stores = $this->get_sub_app('reaction_stores'); |
|
| 135 | 135 | |
| 136 | 136 | $stores = array(); |
| 137 | 137 | |
| 138 | - foreach ( $reaction_stores->get_all_slugs() as $mode => $slugs ) { |
|
| 138 | + foreach ($reaction_stores->get_all_slugs() as $mode => $slugs) { |
|
| 139 | 139 | |
| 140 | - if ( ! in_array( $slug, $slugs ) ) { |
|
| 140 | + if ( ! in_array($slug, $slugs)) { |
|
| 141 | 141 | continue; |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | - $store = $reaction_stores->get( $mode, $slug, array( $mode ) ); |
|
| 144 | + $store = $reaction_stores->get($mode, $slug, array($mode)); |
|
| 145 | 145 | |
| 146 | - if ( ! $store instanceof WordPoints_Hook_Reaction_StoreI ) { |
|
| 146 | + if ( ! $store instanceof WordPoints_Hook_Reaction_StoreI) { |
|
| 147 | 147 | continue; |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | // Allowing access to stores out-of-context would lead to strange behavior. |
| 151 | - if ( false === $store->get_context_id() ) { |
|
| 151 | + if (false === $store->get_context_id()) { |
|
| 152 | 152 | continue; |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | - $stores[ $mode ] = $store; |
|
| 155 | + $stores[$mode] = $store; |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | return $stores; |
@@ -174,19 +174,19 @@ discard block |
||
| 174 | 174 | $action_type |
| 175 | 175 | ) { |
| 176 | 176 | |
| 177 | - foreach ( $this->get_sub_app( 'reaction_stores' )->get_all() as $reaction_stores ) { |
|
| 178 | - foreach ( $reaction_stores as $reaction_store ) { |
|
| 177 | + foreach ($this->get_sub_app('reaction_stores')->get_all() as $reaction_stores) { |
|
| 178 | + foreach ($reaction_stores as $reaction_store) { |
|
| 179 | 179 | |
| 180 | - if ( ! $reaction_store instanceof WordPoints_Hook_Reaction_StoreI ) { |
|
| 180 | + if ( ! $reaction_store instanceof WordPoints_Hook_Reaction_StoreI) { |
|
| 181 | 181 | continue; |
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | // Allowing access to stores out-of-context would lead to strange behavior. |
| 185 | - if ( false === $reaction_store->get_context_id() ) { |
|
| 185 | + if (false === $reaction_store->get_context_id()) { |
|
| 186 | 186 | continue; |
| 187 | 187 | } |
| 188 | 188 | |
| 189 | - foreach ( $reaction_store->get_reactions_to_event( $event_slug ) as $reaction ) { |
|
| 189 | + foreach ($reaction_store->get_reactions_to_event($event_slug) as $reaction) { |
|
| 190 | 190 | |
| 191 | 191 | $fire = new WordPoints_Hook_Fire( |
| 192 | 192 | $event_args |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | , $action_type |
| 195 | 195 | ); |
| 196 | 196 | |
| 197 | - $this->fire_reaction( $fire ); |
|
| 197 | + $this->fire_reaction($fire); |
|
| 198 | 198 | } |
| 199 | 199 | } |
| 200 | 200 | } |
@@ -207,32 +207,32 @@ discard block |
||
| 207 | 207 | * |
| 208 | 208 | * @param WordPoints_Hook_Fire $fire The hook fire object. |
| 209 | 209 | */ |
| 210 | - protected function fire_reaction( $fire ) { |
|
| 210 | + protected function fire_reaction($fire) { |
|
| 211 | 211 | |
| 212 | 212 | /** @var WordPoints_Hook_ReactorI $reactor */ |
| 213 | - $reactor = $this->get_sub_app( 'reactors' )->get( $fire->reaction->get_reactor_slug() ); |
|
| 213 | + $reactor = $this->get_sub_app('reactors')->get($fire->reaction->get_reactor_slug()); |
|
| 214 | 214 | |
| 215 | - if ( ! in_array( $fire->action_type, $reactor->get_action_types(), true ) ) { |
|
| 215 | + if ( ! in_array($fire->action_type, $reactor->get_action_types(), true)) { |
|
| 216 | 216 | return; |
| 217 | 217 | } |
| 218 | 218 | |
| 219 | - $validator = new WordPoints_Hook_Reaction_Validator( $fire->reaction, true ); |
|
| 219 | + $validator = new WordPoints_Hook_Reaction_Validator($fire->reaction, true); |
|
| 220 | 220 | $validator->validate(); |
| 221 | 221 | |
| 222 | - if ( $validator->had_errors() ) { |
|
| 222 | + if ($validator->had_errors()) { |
|
| 223 | 223 | return; |
| 224 | 224 | } |
| 225 | 225 | |
| 226 | - unset( $validator ); |
|
| 226 | + unset($validator); |
|
| 227 | 227 | |
| 228 | 228 | /** @var WordPoints_Hook_ExtensionI[] $extensions */ |
| 229 | - $extensions = $this->get_sub_app( 'extensions' )->get_all(); |
|
| 229 | + $extensions = $this->get_sub_app('extensions')->get_all(); |
|
| 230 | 230 | |
| 231 | - foreach ( $extensions as $extension ) { |
|
| 232 | - if ( ! $extension->should_hit( $fire ) ) { |
|
| 233 | - foreach ( $extensions as $ext ) { |
|
| 234 | - if ( $ext instanceof WordPoints_Hook_Extension_Miss_ListenerI ) { |
|
| 235 | - $ext->after_miss( $fire ); |
|
| 231 | + foreach ($extensions as $extension) { |
|
| 232 | + if ( ! $extension->should_hit($fire)) { |
|
| 233 | + foreach ($extensions as $ext) { |
|
| 234 | + if ($ext instanceof WordPoints_Hook_Extension_Miss_ListenerI) { |
|
| 235 | + $ext->after_miss($fire); |
|
| 236 | 236 | } |
| 237 | 237 | } |
| 238 | 238 | |
@@ -242,11 +242,11 @@ discard block |
||
| 242 | 242 | |
| 243 | 243 | $fire->hit(); |
| 244 | 244 | |
| 245 | - $reactor->hit( $fire ); |
|
| 245 | + $reactor->hit($fire); |
|
| 246 | 246 | |
| 247 | - foreach ( $extensions as $extension ) { |
|
| 248 | - if ( $extension instanceof WordPoints_Hook_Extension_Hit_ListenerI ) { |
|
| 249 | - $extension->after_hit( $fire ); |
|
| 247 | + foreach ($extensions as $extension) { |
|
| 248 | + if ($extension instanceof WordPoints_Hook_Extension_Hit_ListenerI) { |
|
| 249 | + $extension->after_hit($fire); |
|
| 250 | 250 | } |
| 251 | 251 | } |
| 252 | 252 | } |
@@ -62,24 +62,24 @@ discard block |
||
| 62 | 62 | * |
| 63 | 63 | * @param string $dir The full path of the directory. |
| 64 | 64 | */ |
| 65 | - public static function register_dir( $dir ) { |
|
| 65 | + public static function register_dir($dir) { |
|
| 66 | 66 | |
| 67 | - if ( ! isset( self::$spl_enabled ) ) { |
|
| 67 | + if ( ! isset(self::$spl_enabled)) { |
|
| 68 | 68 | |
| 69 | - self::$spl_enabled = function_exists( 'spl_autoload_register' ); |
|
| 69 | + self::$spl_enabled = function_exists('spl_autoload_register'); |
|
| 70 | 70 | |
| 71 | - if ( self::$spl_enabled ) { |
|
| 72 | - spl_autoload_register( __CLASS__ . '::load_class' ); |
|
| 71 | + if (self::$spl_enabled) { |
|
| 72 | + spl_autoload_register(__CLASS__ . '::load_class'); |
|
| 73 | 73 | } |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | - $dir = trailingslashit( $dir ); |
|
| 76 | + $dir = trailingslashit($dir); |
|
| 77 | 77 | |
| 78 | - self::$dirs[ $dir ] = require( $dir . '/index.php' ); |
|
| 78 | + self::$dirs[$dir] = require($dir . '/index.php'); |
|
| 79 | 79 | |
| 80 | - if ( ! self::$spl_enabled ) { |
|
| 81 | - foreach ( self::$dirs[ $dir ] as $file ) { |
|
| 82 | - require_once( $dir . $file ); |
|
| 80 | + if ( ! self::$spl_enabled) { |
|
| 81 | + foreach (self::$dirs[$dir] as $file) { |
|
| 82 | + require_once($dir . $file); |
|
| 83 | 83 | } |
| 84 | 84 | } |
| 85 | 85 | } |
@@ -91,13 +91,13 @@ discard block |
||
| 91 | 91 | * |
| 92 | 92 | * @param string $class_name The name fo the class to load. |
| 93 | 93 | */ |
| 94 | - public static function load_class( $class_name ) { |
|
| 94 | + public static function load_class($class_name) { |
|
| 95 | 95 | |
| 96 | - $class_name = strtolower( $class_name ); |
|
| 96 | + $class_name = strtolower($class_name); |
|
| 97 | 97 | |
| 98 | - foreach ( self::$dirs as $dir => $map ) { |
|
| 99 | - if ( isset( $map[ $class_name ] ) ) { |
|
| 100 | - require_once( $dir . $map[ $class_name ] ); |
|
| 98 | + foreach (self::$dirs as $dir => $map) { |
|
| 99 | + if (isset($map[$class_name])) { |
|
| 100 | + require_once($dir . $map[$class_name]); |
|
| 101 | 101 | return; |
| 102 | 102 | } |
| 103 | 103 | } |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | * |
| 29 | 29 | * @return object[] The child objects, indexed by slug. |
| 30 | 30 | */ |
| 31 | - public function get_children( array $parent_slugs = array() ); |
|
| 31 | + public function get_children(array $parent_slugs = array()); |
|
| 32 | 32 | |
| 33 | 33 | /** |
| 34 | 34 | * Get the slugs of all of the direct children of a certain parent. |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | * |
| 40 | 40 | * @return string[] The child slugs. |
| 41 | 41 | */ |
| 42 | - public function get_children_slugs( array $parent_slugs = array() ); |
|
| 42 | + public function get_children_slugs(array $parent_slugs = array()); |
|
| 43 | 43 | |
| 44 | 44 | /** |
| 45 | 45 | * Get an object by its slug. |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | * |
| 53 | 53 | * @return false|object The object or false on failure. |
| 54 | 54 | */ |
| 55 | - public function get( $slug, array $parent_slugs = array() ); |
|
| 55 | + public function get($slug, array $parent_slugs = array()); |
|
| 56 | 56 | |
| 57 | 57 | /** |
| 58 | 58 | * Register a type of object. |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | * |
| 67 | 67 | * @return bool Whether the class was registered successfully. |
| 68 | 68 | */ |
| 69 | - public function register( $slug, array $parent_slugs, $class, array $args = array() ); |
|
| 69 | + public function register($slug, array $parent_slugs, $class, array $args = array()); |
|
| 70 | 70 | |
| 71 | 71 | /** |
| 72 | 72 | * Deregister a type of object. |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | * @param string[] $parent_slugs The slug(s) of the class's parent(s) in the |
| 78 | 78 | * hierarchy. |
| 79 | 79 | */ |
| 80 | - public function deregister( $slug, array $parent_slugs = array() ); |
|
| 80 | + public function deregister($slug, array $parent_slugs = array()); |
|
| 81 | 81 | |
| 82 | 82 | /** |
| 83 | 83 | * Deregister all children of a particular parent in the hierarchy. |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | * |
| 87 | 87 | * @param string[] $parent_slugs The hierarchy of the parent. |
| 88 | 88 | */ |
| 89 | - public function deregister_children( array $parent_slugs = array() ); |
|
| 89 | + public function deregister_children(array $parent_slugs = array()); |
|
| 90 | 90 | |
| 91 | 91 | /** |
| 92 | 92 | * Check if a type of object is registered by its slug. |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | * |
| 102 | 102 | * @return bool Whether the class is registered. |
| 103 | 103 | */ |
| 104 | - public function is_registered( $slug, array $parent_slugs = array() ); |
|
| 104 | + public function is_registered($slug, array $parent_slugs = array()); |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | // EOF |
@@ -32,6 +32,7 @@ discard block |
||
| 32 | 32 | * @since 2.1.0 |
| 33 | 33 | * |
| 34 | 34 | * @param WordPoints_Entity $entity An entity. |
| 35 | + * @return void |
|
| 35 | 36 | */ |
| 36 | 37 | public function add_entity( WordPoints_Entity $entity ); |
| 37 | 38 | |
@@ -41,6 +42,7 @@ discard block |
||
| 41 | 42 | * @since 2.1.0 |
| 42 | 43 | * |
| 43 | 44 | * @param string $slug The slug of the entity to remove. |
| 45 | + * @return void |
|
| 44 | 46 | */ |
| 45 | 47 | public function remove_entity( $slug ); |
| 46 | 48 | |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | * |
| 47 | 47 | * @return object[] The child objects, indexed by slug. |
| 48 | 48 | */ |
| 49 | - public function get_children( $parent_slug ); |
|
| 49 | + public function get_children($parent_slug); |
|
| 50 | 50 | |
| 51 | 51 | /** |
| 52 | 52 | * Get the slugs of all of the classes that are children of a certain parent. |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | * |
| 58 | 58 | * @return string[] The child slugs. |
| 59 | 59 | */ |
| 60 | - public function get_children_slugs( $parent_slug ); |
|
| 60 | + public function get_children_slugs($parent_slug); |
|
| 61 | 61 | |
| 62 | 62 | /** |
| 63 | 63 | * Get an object by its slug. |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | * |
| 70 | 70 | * @return object|false The object or false on failure. |
| 71 | 71 | */ |
| 72 | - public function get( $parent_slug, $slug ); |
|
| 72 | + public function get($parent_slug, $slug); |
|
| 73 | 73 | |
| 74 | 74 | /** |
| 75 | 75 | * Register a type of object. |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | * |
| 84 | 84 | * @return bool Whether the class was registered successfully. |
| 85 | 85 | */ |
| 86 | - public function register( $parent_slug, $slug, $class, array $args = array() ); |
|
| 86 | + public function register($parent_slug, $slug, $class, array $args = array()); |
|
| 87 | 87 | |
| 88 | 88 | /** |
| 89 | 89 | * Deregister a type of object. |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | * @param string $parent_slug The group slug. |
| 94 | 94 | * @param string $slug The slug of the class to deregister. |
| 95 | 95 | */ |
| 96 | - public function deregister( $parent_slug, $slug ); |
|
| 96 | + public function deregister($parent_slug, $slug); |
|
| 97 | 97 | |
| 98 | 98 | /** |
| 99 | 99 | * Deregister all children of a particular parent. |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | * |
| 103 | 103 | * @param string $parent_slug The group slug. |
| 104 | 104 | */ |
| 105 | - public function deregister_children( $parent_slug ); |
|
| 105 | + public function deregister_children($parent_slug); |
|
| 106 | 106 | |
| 107 | 107 | /** |
| 108 | 108 | * Check if a type of object is registered by its slug. |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | * |
| 118 | 118 | * @return bool Whether the class is registered. |
| 119 | 119 | */ |
| 120 | - public function is_registered( $parent_slug, $slug = null ); |
|
| 120 | + public function is_registered($parent_slug, $slug = null); |
|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | // EOF |
@@ -32,6 +32,7 @@ discard block |
||
| 32 | 32 | * @since 2.1.0 |
| 33 | 33 | * |
| 34 | 34 | * @param WordPoints_Entity $entity An entity. |
| 35 | + * @return void |
|
| 35 | 36 | */ |
| 36 | 37 | public function add_entity( WordPoints_Entity $entity ); |
| 37 | 38 | |
@@ -41,6 +42,7 @@ discard block |
||
| 41 | 42 | * @since 2.1.0 |
| 42 | 43 | * |
| 43 | 44 | * @param string $slug The slug of the entity to remove. |
| 45 | + * @return void |
|
| 44 | 46 | */ |
| 45 | 47 | public function remove_entity( $slug ); |
| 46 | 48 | |
@@ -50,18 +50,18 @@ discard block |
||
| 50 | 50 | /** |
| 51 | 51 | * @since 2.1.0 |
| 52 | 52 | */ |
| 53 | - public function get_all( array $args = array() ) { |
|
| 53 | + public function get_all(array $args = array()) { |
|
| 54 | 54 | |
| 55 | 55 | $items = array(); |
| 56 | 56 | |
| 57 | - if ( $this->settings['pass_slugs'] ) { |
|
| 58 | - array_unshift( $args, null ); |
|
| 57 | + if ($this->settings['pass_slugs']) { |
|
| 58 | + array_unshift($args, null); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | - foreach ( $this->classes as $parent_slug => $classes ) { |
|
| 62 | - $items[ $parent_slug ] = WordPoints_Class_Registry::construct_with_args( |
|
| 61 | + foreach ($this->classes as $parent_slug => $classes) { |
|
| 62 | + $items[$parent_slug] = WordPoints_Class_Registry::construct_with_args( |
|
| 63 | 63 | $classes |
| 64 | - , $this->settings['pass_slugs'] ? array( $parent_slug ) + $args : $args |
|
| 64 | + , $this->settings['pass_slugs'] ? array($parent_slug) + $args : $args |
|
| 65 | 65 | , $this->settings |
| 66 | 66 | ); |
| 67 | 67 | } |
@@ -73,24 +73,24 @@ discard block |
||
| 73 | 73 | * @since 2.1.0 |
| 74 | 74 | */ |
| 75 | 75 | public function get_all_slugs() { |
| 76 | - return array_map( 'array_keys', $this->classes ); |
|
| 76 | + return array_map('array_keys', $this->classes); |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | /** |
| 80 | 80 | * @since 2.1.0 |
| 81 | 81 | */ |
| 82 | - public function get_children( $parent_slug, array $args = array() ) { |
|
| 82 | + public function get_children($parent_slug, array $args = array()) { |
|
| 83 | 83 | |
| 84 | 84 | $items = array(); |
| 85 | 85 | |
| 86 | - if ( isset( $this->classes[ $parent_slug ] ) ) { |
|
| 86 | + if (isset($this->classes[$parent_slug])) { |
|
| 87 | 87 | |
| 88 | - if ( $this->settings['pass_slugs'] ) { |
|
| 89 | - array_unshift( $args, $parent_slug ); |
|
| 88 | + if ($this->settings['pass_slugs']) { |
|
| 89 | + array_unshift($args, $parent_slug); |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | $items = WordPoints_Class_Registry::construct_with_args( |
| 93 | - $this->classes[ $parent_slug ] |
|
| 93 | + $this->classes[$parent_slug] |
|
| 94 | 94 | , $args |
| 95 | 95 | , $this->settings |
| 96 | 96 | ); |
@@ -102,12 +102,12 @@ discard block |
||
| 102 | 102 | /** |
| 103 | 103 | * @since 2.1.0 |
| 104 | 104 | */ |
| 105 | - public function get_children_slugs( $parent_slug ) { |
|
| 105 | + public function get_children_slugs($parent_slug) { |
|
| 106 | 106 | |
| 107 | 107 | $slugs = array(); |
| 108 | 108 | |
| 109 | - if ( isset( $this->classes[ $parent_slug ] ) ) { |
|
| 110 | - $slugs = array_keys( $this->classes[ $parent_slug ] ); |
|
| 109 | + if (isset($this->classes[$parent_slug])) { |
|
| 110 | + $slugs = array_keys($this->classes[$parent_slug]); |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | return $slugs; |
@@ -116,38 +116,38 @@ discard block |
||
| 116 | 116 | /** |
| 117 | 117 | * @since 2.1.0 |
| 118 | 118 | */ |
| 119 | - public function get( $parent_slug, $slug, array $args = array() ) { |
|
| 119 | + public function get($parent_slug, $slug, array $args = array()) { |
|
| 120 | 120 | |
| 121 | - if ( ! isset( $this->classes[ $parent_slug ][ $slug ] ) ) { |
|
| 121 | + if ( ! isset($this->classes[$parent_slug][$slug])) { |
|
| 122 | 122 | return false; |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | - $class = $this->classes[ $parent_slug ][ $slug ]; |
|
| 125 | + $class = $this->classes[$parent_slug][$slug]; |
|
| 126 | 126 | |
| 127 | - if ( empty( $args ) ) { |
|
| 127 | + if (empty($args)) { |
|
| 128 | 128 | |
| 129 | - if ( $this->settings['pass_slugs'] ) { |
|
| 130 | - return new $class( $slug, $parent_slug ); |
|
| 129 | + if ($this->settings['pass_slugs']) { |
|
| 130 | + return new $class($slug, $parent_slug); |
|
| 131 | 131 | } else { |
| 132 | 132 | return new $class(); |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | } else { |
| 136 | 136 | |
| 137 | - if ( $this->settings['pass_slugs'] ) { |
|
| 138 | - array_unshift( $args, $slug, $parent_slug ); |
|
| 137 | + if ($this->settings['pass_slugs']) { |
|
| 138 | + array_unshift($args, $slug, $parent_slug); |
|
| 139 | 139 | } |
| 140 | 140 | |
| 141 | - return wordpoints_construct_class_with_args( $class, $args ); |
|
| 141 | + return wordpoints_construct_class_with_args($class, $args); |
|
| 142 | 142 | } |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | /** |
| 146 | 146 | * @since 2.1.0 |
| 147 | 147 | */ |
| 148 | - public function register( $parent_slug, $slug, $class, array $args = array() ) { |
|
| 148 | + public function register($parent_slug, $slug, $class, array $args = array()) { |
|
| 149 | 149 | |
| 150 | - $this->classes[ $parent_slug ][ $slug ] = $class; |
|
| 150 | + $this->classes[$parent_slug][$slug] = $class; |
|
| 151 | 151 | |
| 152 | 152 | return true; |
| 153 | 153 | } |
@@ -155,26 +155,26 @@ discard block |
||
| 155 | 155 | /** |
| 156 | 156 | * @since 2.1.0 |
| 157 | 157 | */ |
| 158 | - public function deregister( $parent_slug, $slug ) { |
|
| 159 | - unset( $this->classes[ $parent_slug ][ $slug ] ); |
|
| 158 | + public function deregister($parent_slug, $slug) { |
|
| 159 | + unset($this->classes[$parent_slug][$slug]); |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | /** |
| 163 | 163 | * @since 2.1.0 |
| 164 | 164 | */ |
| 165 | - public function deregister_children( $parent_slug ) { |
|
| 166 | - unset( $this->classes[ $parent_slug ] ); |
|
| 165 | + public function deregister_children($parent_slug) { |
|
| 166 | + unset($this->classes[$parent_slug]); |
|
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | /** |
| 170 | 170 | * @since 2.1.0 |
| 171 | 171 | */ |
| 172 | - public function is_registered( $parent_slug, $slug = null ) { |
|
| 172 | + public function is_registered($parent_slug, $slug = null) { |
|
| 173 | 173 | |
| 174 | - if ( isset( $slug ) ) { |
|
| 175 | - return isset( $this->classes[ $parent_slug ][ $slug ] ); |
|
| 174 | + if (isset($slug)) { |
|
| 175 | + return isset($this->classes[$parent_slug][$slug]); |
|
| 176 | 176 | } else { |
| 177 | - return isset( $this->classes[ $parent_slug ] ); |
|
| 177 | + return isset($this->classes[$parent_slug]); |
|
| 178 | 178 | } |
| 179 | 179 | } |
| 180 | 180 | } |
@@ -29,11 +29,11 @@ discard block |
||
| 29 | 29 | /** |
| 30 | 30 | * @since 2.1.0 |
| 31 | 31 | */ |
| 32 | - public function get_all( array $args = array() ) { |
|
| 32 | + public function get_all(array $args = array()) { |
|
| 33 | 33 | |
| 34 | - $classes = array_diff_key( $this->classes, $this->objects ); |
|
| 34 | + $classes = array_diff_key($this->classes, $this->objects); |
|
| 35 | 35 | |
| 36 | - if ( ! empty( $classes ) ) { |
|
| 36 | + if ( ! empty($classes)) { |
|
| 37 | 37 | |
| 38 | 38 | $objects = WordPoints_Class_Registry::construct_with_args( |
| 39 | 39 | $classes |
@@ -49,40 +49,40 @@ discard block |
||
| 49 | 49 | /** |
| 50 | 50 | * @since 2.1.0 |
| 51 | 51 | */ |
| 52 | - public function get( $slug, array $args = array() ) { |
|
| 52 | + public function get($slug, array $args = array()) { |
|
| 53 | 53 | |
| 54 | - if ( ! isset( $this->objects[ $slug ] ) ) { |
|
| 54 | + if ( ! isset($this->objects[$slug])) { |
|
| 55 | 55 | |
| 56 | - $object = parent::get( $slug, $args ); |
|
| 56 | + $object = parent::get($slug, $args); |
|
| 57 | 57 | |
| 58 | - if ( ! $object ) { |
|
| 58 | + if ( ! $object) { |
|
| 59 | 59 | return false; |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - $this->objects[ $slug ] = $object; |
|
| 62 | + $this->objects[$slug] = $object; |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - return $this->objects[ $slug ]; |
|
| 65 | + return $this->objects[$slug]; |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | /** |
| 69 | 69 | * @since 2.1.0 |
| 70 | 70 | */ |
| 71 | - public function register( $slug, $class, array $args = array() ) { |
|
| 71 | + public function register($slug, $class, array $args = array()) { |
|
| 72 | 72 | |
| 73 | - unset( $this->objects[ $slug ] ); |
|
| 73 | + unset($this->objects[$slug]); |
|
| 74 | 74 | |
| 75 | - return parent::register( $slug, $class, $args ); |
|
| 75 | + return parent::register($slug, $class, $args); |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | /** |
| 79 | 79 | * @since 2.1.0 |
| 80 | 80 | */ |
| 81 | - public function deregister( $slug ) { |
|
| 81 | + public function deregister($slug) { |
|
| 82 | 82 | |
| 83 | - parent::deregister( $slug ); |
|
| 83 | + parent::deregister($slug); |
|
| 84 | 84 | |
| 85 | - unset( $this->objects[ $slug ] ); |
|
| 85 | + unset($this->objects[$slug]); |
|
| 86 | 86 | } |
| 87 | 87 | } |
| 88 | 88 | |