@@ -19,37 +19,37 @@ discard block |
||
19 | 19 | abstract class AdminPageFramework_PostType_Controller extends AdminPageFramework_PostType_View { |
20 | 20 | |
21 | 21 | /** |
22 | - * The method for necessary set-ups. |
|
23 | - * |
|
24 | - * <h4>Example</h4> |
|
25 | - * <code>public function setUp() { |
|
26 | - * $this->setAutoSave( false ); |
|
27 | - * $this->setAuthorTableFilter( true ); |
|
28 | - * $this->addTaxonomy( |
|
29 | - * 'sample_taxonomy', // taxonomy slug |
|
30 | - * array( // argument - for the argument array keys, refer to : http://codex.wordpress.org/Function_Reference/register_taxonomy#Arguments |
|
31 | - * 'labels' => array( |
|
32 | - * 'name' => 'Genre', |
|
33 | - * 'add_new_item' => 'Add New Genre', |
|
34 | - * 'new_item_name' => "New Genre" |
|
35 | - * ), |
|
36 | - * 'show_ui' => true, |
|
37 | - * 'show_tagcloud' => false, |
|
38 | - * 'hierarchical' => true, |
|
39 | - * 'show_admin_column' => true, |
|
40 | - * 'show_in_nav_menus' => true, |
|
41 | - * 'show_table_filter' => true, // framework specific key |
|
42 | - * 'show_in_sidebar_menus' => false, // framework specific key |
|
43 | - * ) |
|
44 | - * ); |
|
45 | - * }</code> |
|
46 | - * |
|
47 | - * @abstract |
|
48 | - * @since 2.0.0 |
|
49 | - * @remark The user should override this method in their class definition. |
|
50 | - * @remark A callback for the `wp_loaded` hook. |
|
51 | - * @callback action init |
|
52 | - */ |
|
22 | + * The method for necessary set-ups. |
|
23 | + * |
|
24 | + * <h4>Example</h4> |
|
25 | + * <code>public function setUp() { |
|
26 | + * $this->setAutoSave( false ); |
|
27 | + * $this->setAuthorTableFilter( true ); |
|
28 | + * $this->addTaxonomy( |
|
29 | + * 'sample_taxonomy', // taxonomy slug |
|
30 | + * array( // argument - for the argument array keys, refer to : http://codex.wordpress.org/Function_Reference/register_taxonomy#Arguments |
|
31 | + * 'labels' => array( |
|
32 | + * 'name' => 'Genre', |
|
33 | + * 'add_new_item' => 'Add New Genre', |
|
34 | + * 'new_item_name' => "New Genre" |
|
35 | + * ), |
|
36 | + * 'show_ui' => true, |
|
37 | + * 'show_tagcloud' => false, |
|
38 | + * 'hierarchical' => true, |
|
39 | + * 'show_admin_column' => true, |
|
40 | + * 'show_in_nav_menus' => true, |
|
41 | + * 'show_table_filter' => true, // framework specific key |
|
42 | + * 'show_in_sidebar_menus' => false, // framework specific key |
|
43 | + * ) |
|
44 | + * ); |
|
45 | + * }</code> |
|
46 | + * |
|
47 | + * @abstract |
|
48 | + * @since 2.0.0 |
|
49 | + * @remark The user should override this method in their class definition. |
|
50 | + * @remark A callback for the `wp_loaded` hook. |
|
51 | + * @callback action init |
|
52 | + */ |
|
53 | 53 | public function setUp() {} |
54 | 54 | |
55 | 55 | /** |
@@ -115,49 +115,49 @@ discard block |
||
115 | 115 | * Front-end methods |
116 | 116 | */ |
117 | 117 | /** |
118 | - * Enables or disables the auto-save feature in the custom post type's post submission page. |
|
119 | - * |
|
120 | - * <h4>Example</h4> |
|
121 | - * <code>$this->setAutoSave( false ); |
|
122 | - * </code> |
|
123 | - * |
|
124 | - * @since 2.0.0 |
|
125 | - * @param boolean If true, it enables the auto-save; otherwise, it disables it. |
|
126 | - * return void |
|
127 | - */ |
|
118 | + * Enables or disables the auto-save feature in the custom post type's post submission page. |
|
119 | + * |
|
120 | + * <h4>Example</h4> |
|
121 | + * <code>$this->setAutoSave( false ); |
|
122 | + * </code> |
|
123 | + * |
|
124 | + * @since 2.0.0 |
|
125 | + * @param boolean If true, it enables the auto-save; otherwise, it disables it. |
|
126 | + * return void |
|
127 | + */ |
|
128 | 128 | protected function setAutoSave( $bEnableAutoSave=True ) { |
129 | 129 | $this->oProp->bEnableAutoSave = $bEnableAutoSave; |
130 | 130 | } |
131 | 131 | |
132 | 132 | /** |
133 | - * Adds a custom taxonomy to the class post type. |
|
134 | - * <h4>Example</h4> |
|
135 | - * <code>$this->addTaxonomy( |
|
136 | - * 'sample_taxonomy', // taxonomy slug |
|
137 | - * array( // argument |
|
138 | - * 'labels' => array( |
|
139 | - * 'name' => 'Genre', |
|
140 | - * 'add_new_item' => 'Add New Genre', |
|
141 | - * 'new_item_name' => "New Genre" |
|
142 | - * ), |
|
143 | - * 'show_ui' => true, |
|
144 | - * 'show_tagcloud' => false, |
|
145 | - * 'hierarchical' => true, |
|
146 | - * 'show_admin_column' => true, |
|
147 | - * 'show_in_nav_menus' => true, |
|
148 | - * 'show_table_filter' => true, // framework specific key |
|
149 | - * 'show_in_sidebar_menus' => false, // framework specific key |
|
150 | - * ) |
|
151 | - * );</code> |
|
152 | - * |
|
153 | - * @see http://codex.wordpress.org/Function_Reference/register_taxonomy#Arguments |
|
154 | - * @since 2.0.0 |
|
155 | - * @since 3.1.1 Added the third parameter. |
|
156 | - * @param string $sTaxonomySlug The taxonomy slug. |
|
157 | - * @param array $aArguments The taxonomy argument array passed to the second parameter of the <a href="http://codex.wordpress.org/Function_Reference/register_taxonomy#Arguments">register_taxonomy()</a> function. |
|
158 | - * @param array $aAdditionalObjectTypes Additional object types (post types) besides the caller post type. |
|
159 | - * @return void |
|
160 | - */ |
|
133 | + * Adds a custom taxonomy to the class post type. |
|
134 | + * <h4>Example</h4> |
|
135 | + * <code>$this->addTaxonomy( |
|
136 | + * 'sample_taxonomy', // taxonomy slug |
|
137 | + * array( // argument |
|
138 | + * 'labels' => array( |
|
139 | + * 'name' => 'Genre', |
|
140 | + * 'add_new_item' => 'Add New Genre', |
|
141 | + * 'new_item_name' => "New Genre" |
|
142 | + * ), |
|
143 | + * 'show_ui' => true, |
|
144 | + * 'show_tagcloud' => false, |
|
145 | + * 'hierarchical' => true, |
|
146 | + * 'show_admin_column' => true, |
|
147 | + * 'show_in_nav_menus' => true, |
|
148 | + * 'show_table_filter' => true, // framework specific key |
|
149 | + * 'show_in_sidebar_menus' => false, // framework specific key |
|
150 | + * ) |
|
151 | + * );</code> |
|
152 | + * |
|
153 | + * @see http://codex.wordpress.org/Function_Reference/register_taxonomy#Arguments |
|
154 | + * @since 2.0.0 |
|
155 | + * @since 3.1.1 Added the third parameter. |
|
156 | + * @param string $sTaxonomySlug The taxonomy slug. |
|
157 | + * @param array $aArguments The taxonomy argument array passed to the second parameter of the <a href="http://codex.wordpress.org/Function_Reference/register_taxonomy#Arguments">register_taxonomy()</a> function. |
|
158 | + * @param array $aAdditionalObjectTypes Additional object types (post types) besides the caller post type. |
|
159 | + * @return void |
|
160 | + */ |
|
161 | 161 | protected function addTaxonomy( $sTaxonomySlug, array $aArguments, array $aAdditionalObjectTypes=array() ) { |
162 | 162 | |
163 | 163 | $sTaxonomySlug = $this->oUtil->sanitizeSlug( $sTaxonomySlug ); |
@@ -219,16 +219,16 @@ discard block |
||
219 | 219 | } |
220 | 220 | |
221 | 221 | /** |
222 | - * Sets whether the author drop-down filter is enabled/disabled in the post type post list table. |
|
223 | - * |
|
224 | - * <h4>Example</h4> |
|
225 | - * <code>$this->setAuthorTableFilter( true ); |
|
226 | - * </code> |
|
227 | - * |
|
228 | - * @since 2.0.0 |
|
229 | - * @param boolean $bEnableAuthorTableFileter If true, it enables the author filter; otherwise, it disables it. |
|
230 | - * @return void |
|
231 | - */ |
|
222 | + * Sets whether the author drop-down filter is enabled/disabled in the post type post list table. |
|
223 | + * |
|
224 | + * <h4>Example</h4> |
|
225 | + * <code>$this->setAuthorTableFilter( true ); |
|
226 | + * </code> |
|
227 | + * |
|
228 | + * @since 2.0.0 |
|
229 | + * @param boolean $bEnableAuthorTableFileter If true, it enables the author filter; otherwise, it disables it. |
|
230 | + * @return void |
|
231 | + */ |
|
232 | 232 | protected function setAuthorTableFilter( $bEnableAuthorTableFileter=false ) { |
233 | 233 | $this->oProp->bEnableAuthorTableFileter = $bEnableAuthorTableFileter; |
234 | 234 | } |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | * @param boolean If true, it enables the auto-save; otherwise, it disables it. |
154 | 154 | * return void |
155 | 155 | */ |
156 | - protected function setAutoSave( $bEnableAutoSave=True ) { |
|
156 | + protected function setAutoSave( $bEnableAutoSave = True ) { |
|
157 | 157 | $this->oProp->bEnableAutoSave = $bEnableAutoSave; |
158 | 158 | } |
159 | 159 | |
@@ -186,20 +186,20 @@ discard block |
||
186 | 186 | * @param array $aAdditionalObjectTypes Additional object types (post types) besides the caller post type. |
187 | 187 | * @return void |
188 | 188 | */ |
189 | - protected function addTaxonomy( $sTaxonomySlug, array $aArguments, array $aAdditionalObjectTypes=array() ) { |
|
189 | + protected function addTaxonomy( $sTaxonomySlug, array $aArguments, array $aAdditionalObjectTypes = array() ) { |
|
190 | 190 | |
191 | 191 | $sTaxonomySlug = $this->oUtil->sanitizeSlug( $sTaxonomySlug ); |
192 | 192 | $aArguments = $aArguments + array( |
193 | 193 | 'show_table_filter' => null, |
194 | 194 | 'show_in_sidebar_menus' => null, |
195 | - 'submenu_order' => 15, // 3.7.4 |
|
196 | - ) ; |
|
195 | + 'submenu_order' => 15, // 3.7.4 |
|
196 | + ); |
|
197 | 197 | $this->oProp->aTaxonomies[ $sTaxonomySlug ] = $aArguments; |
198 | 198 | |
199 | 199 | if ( $aArguments[ 'show_table_filter' ] ) { |
200 | - $this->oProp->aTaxonomyTableFilters[] = $sTaxonomySlug; |
|
200 | + $this->oProp->aTaxonomyTableFilters[ ] = $sTaxonomySlug; |
|
201 | 201 | } |
202 | - if ( ! $aArguments[ 'show_in_sidebar_menus' ] ) { |
|
202 | + if ( !$aArguments[ 'show_in_sidebar_menus' ] ) { |
|
203 | 203 | // @todo investigate the best handling method of taxonomy sub-menu items of a custom post type added to another custom post type menu with the `show_in_menu` argument. |
204 | 204 | $this->oProp->aTaxonomyRemoveSubmenuPages[ "edit-tags.php?taxonomy={$sTaxonomySlug}&post_type={$this->oProp->sPostType}" ] = "edit.php?post_type={$this->oProp->sPostType}"; |
205 | 205 | } |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | * @param boolean $bEnableAuthorTableFileter If true, it enables the author filter; otherwise, it disables it. |
258 | 258 | * @return void |
259 | 259 | */ |
260 | - protected function setAuthorTableFilter( $bEnableAuthorTableFileter=false ) { |
|
260 | + protected function setAuthorTableFilter( $bEnableAuthorTableFileter = false ) { |
|
261 | 261 | $this->oProp->bEnableAuthorTableFileter = $bEnableAuthorTableFileter; |
262 | 262 | } |
263 | 263 | |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | * @since 3.2.0 |
284 | 284 | * @return void |
285 | 285 | */ |
286 | - protected function setArguments( array $aArguments=array() ) { |
|
286 | + protected function setArguments( array $aArguments = array() ) { |
|
287 | 287 | $this->oProp->aPostTypeArgs = $aArguments; |
288 | 288 | } |
289 | 289 |
@@ -92,7 +92,7 @@ |
||
92 | 92 | |
93 | 93 | } |
94 | 94 | |
95 | - /** |
|
95 | + /** |
|
96 | 96 | * Resets the rewrite rules for custom post types. |
97 | 97 | * |
98 | 98 | * This must be done after the post type is registered. So the shutdown action hook is used. |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public function __construct( $oFactory ) { |
30 | 30 | |
31 | - if ( ! $this->_shouldProceed( $oFactory ) ) { |
|
31 | + if ( !$this->_shouldProceed( $oFactory ) ) { |
|
32 | 32 | return; |
33 | 33 | } |
34 | 34 | |
@@ -53,10 +53,10 @@ discard block |
||
53 | 53 | */ |
54 | 54 | private function _shouldProceed( $oFactory ) { |
55 | 55 | |
56 | - if ( ! $oFactory->oProp->bIsAdmin ) { |
|
56 | + if ( !$oFactory->oProp->bIsAdmin ) { |
|
57 | 57 | return false; |
58 | 58 | } |
59 | - if ( ! $oFactory->oProp->sCallerPath ) { |
|
59 | + if ( !$oFactory->oProp->sCallerPath ) { |
|
60 | 60 | return false; |
61 | 61 | } |
62 | 62 | return 'plugin' === $oFactory->oProp->sScriptType; |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | } |
87 | 87 | |
88 | 88 | // If the execution flow in the plugin activation hook, schedule flushing rewrite rules. |
89 | - if ( did_action( 'activate_' . plugin_basename( $this->oFactory->oProp->sCallerPath ) ) ) { |
|
89 | + if ( did_action( 'activate_'.plugin_basename( $this->oFactory->oProp->sCallerPath ) ) ) { |
|
90 | 90 | add_action( 'shutdown', array( $this, '_replyToFlushRewriteRules' ) ); |
91 | 91 | } |
92 | 92 |
@@ -73,7 +73,7 @@ |
||
73 | 73 | 'title' => 'Title', // Post title. Includes "edit", "quick edit", "trash" and "view" links. If $mode (set from $_REQUEST['mode']) is 'excerpt', a post excerpt is included between the title and links. |
74 | 74 | 'author' => 'Author', // Post author. |
75 | 75 | 'comments' => '<div class="comment-grey-bubble"></div>', // Number of pending comments. |
76 | - 'date' => 'Date', // The date and publish status of the post. |
|
76 | + 'date' => 'Date', // The date and publish status of the post. |
|
77 | 77 | ); |
78 | 78 | |
79 | 79 | /** |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | |
31 | 31 | $this->oFactory = $oFactory; |
32 | 32 | |
33 | - if ( ! $oFactory->oProp->bIsAdmin ) { |
|
33 | + if ( !$oFactory->oProp->bIsAdmin ) { |
|
34 | 34 | return; |
35 | 35 | } |
36 | 36 | |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | |
47 | 47 | add_action( |
48 | 48 | 'admin_menu', |
49 | - array( $this, 'sortAdminSubMenu' ), // defined in the framework utility class. |
|
49 | + array( $this, 'sortAdminSubMenu' ), // defined in the framework utility class. |
|
50 | 50 | 9999 |
51 | 51 | ); |
52 | 52 | |
@@ -61,15 +61,15 @@ discard block |
||
61 | 61 | |
62 | 62 | // Check the post type `show_ui` and other related UI arguments. |
63 | 63 | $_bsShowInMeenu = $this->getShowInMenuPostTypeArgument( $this->oFactory->oProp->aPostTypeArgs ); |
64 | - if ( ! $_bsShowInMeenu ) { |
|
64 | + if ( !$_bsShowInMeenu ) { |
|
65 | 65 | return; |
66 | 66 | } |
67 | 67 | |
68 | 68 | // If the user sets a menu slug to the 'show_in_menu' argument, use that. |
69 | 69 | // It is used to set a custom post type sub-menu belong to another menu. |
70 | - $_sSubMenuSlug = is_string( $_bsShowInMeenu ) |
|
70 | + $_sSubMenuSlug = is_string( $_bsShowInMeenu ) |
|
71 | 71 | ? $_bsShowInMeenu |
72 | - : 'edit.php?post_type=' . $this->oFactory->oProp->sPostType; |
|
72 | + : 'edit.php?post_type='.$this->oFactory->oProp->sPostType; |
|
73 | 73 | |
74 | 74 | // Set the index to the framework specific global array for sorting. |
75 | 75 | $this->_setSubMenuSlugForSorting( $_sSubMenuSlug ); |
@@ -130,11 +130,11 @@ discard block |
||
130 | 130 | |
131 | 131 | // @remark This is the partial link url set in the third element ( index of 2 ) in the third dimension of submenu global array element. |
132 | 132 | // This is not the submenu slug. |
133 | - $_sLinkSlugManage = 'edit.php?post_type=' . $this->oFactory->oProp->sPostType; |
|
133 | + $_sLinkSlugManage = 'edit.php?post_type='.$this->oFactory->oProp->sPostType; |
|
134 | 134 | |
135 | 135 | $_aLinkSlugs = array( |
136 | 136 | $_sLinkSlugManage => $_nSubMenuOrderManage, |
137 | - 'post-new.php?post_type=' . $this->oFactory->oProp->sPostType => $_nSubMenuOrderAddNew, |
|
137 | + 'post-new.php?post_type='.$this->oFactory->oProp->sPostType => $_nSubMenuOrderAddNew, |
|
138 | 138 | ); |
139 | 139 | |
140 | 140 | // If the user does not set a custom value, unset it |
@@ -143,8 +143,8 @@ discard block |
||
143 | 143 | } |
144 | 144 | |
145 | 145 | // If the user does not want to show the Add New sub menu, no need to change the order. |
146 | - if ( ! $_bShowAddNew || 10 == $_nSubMenuOrderAddNew ) { |
|
147 | - unset( $_aLinkSlugs[ 'post-new.php?post_type=' . $this->oFactory->oProp->sPostType ] ); |
|
146 | + if ( !$_bShowAddNew || 10 == $_nSubMenuOrderAddNew ) { |
|
147 | + unset( $_aLinkSlugs[ 'post-new.php?post_type='.$this->oFactory->oProp->sPostType ] ); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | return $_aLinkSlugs; |
@@ -164,9 +164,9 @@ discard block |
||
164 | 164 | */ |
165 | 165 | private function _setSubMenuIndexByLinksSlugs( $sSubMenuSlug, array $aLinkSlugs ) { |
166 | 166 | |
167 | - foreach( $this->getElementAsArray( $GLOBALS, array( 'submenu', $sSubMenuSlug ) ) as $_nIndex => $_aSubMenuItem ) { |
|
167 | + foreach ( $this->getElementAsArray( $GLOBALS, array( 'submenu', $sSubMenuSlug ) ) as $_nIndex => $_aSubMenuItem ) { |
|
168 | 168 | |
169 | - foreach( $aLinkSlugs as $_sLinkSlug => $_nOrder ) { |
|
169 | + foreach ( $aLinkSlugs as $_sLinkSlug => $_nOrder ) { |
|
170 | 170 | |
171 | 171 | $_bIsSet = $this->_setSubMenuIndexByLinksSlug( $sSubMenuSlug, $_nIndex, $_aSubMenuItem, $_sLinkSlug, $_nOrder ); |
172 | 172 | |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | private function _setSubMenuIndexByLinksSlug( $sSubMenuSlug, $nIndex, $aSubMenuItem, $sLinkSlug, $nOrder ) { |
193 | 193 | |
194 | 194 | // The third item is the link slug. |
195 | - if ( ! isset( $aSubMenuItem[ 2 ] ) ) { |
|
195 | + if ( !isset( $aSubMenuItem[ 2 ] ) ) { |
|
196 | 196 | return false; |
197 | 197 | } |
198 | 198 | if ( $aSubMenuItem[ 2 ] !== $sLinkSlug ) { |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | |
38 | 38 | if ( $this->oProp->bIsAdmin ) { |
39 | 39 | |
40 | - add_action( 'load_' . $this->oProp->sPostType, array( $this, '_replyToSetUpHooksForModel' ) ); |
|
40 | + add_action( 'load_'.$this->oProp->sPostType, array( $this, '_replyToSetUpHooksForModel' ) ); |
|
41 | 41 | |
42 | 42 | if ( $this->oProp->sCallerPath ) { |
43 | 43 | new AdminPageFramework_PostType_Model__FlushRewriteRules( $this ); |
@@ -64,11 +64,11 @@ discard block |
||
64 | 64 | |
65 | 65 | // Properties - sets translatable labels. |
66 | 66 | $this->oProp->aColumnHeaders = array( |
67 | - 'cb' => '<input type="checkbox" />', // Checkbox for bulk actions. |
|
68 | - 'title' => $this->oMsg->get( 'title' ), // Post title. Includes "edit", "quick edit", "trash" and "view" links. If $mode (set from $_REQUEST['mode']) is 'excerpt', a post excerpt is included between the title and links. |
|
69 | - 'author' => $this->oMsg->get( 'author' ), // Post author. |
|
67 | + 'cb' => '<input type="checkbox" />', // Checkbox for bulk actions. |
|
68 | + 'title' => $this->oMsg->get( 'title' ), // Post title. Includes "edit", "quick edit", "trash" and "view" links. If $mode (set from $_REQUEST['mode']) is 'excerpt', a post excerpt is included between the title and links. |
|
69 | + 'author' => $this->oMsg->get( 'author' ), // Post author. |
|
70 | 70 | 'comments' => '<div class="comment-grey-bubble"></div>', // Number of pending comments. |
71 | - 'date' => $this->oMsg->get( 'date' ), // The date and publish status of the post. |
|
71 | + 'date' => $this->oMsg->get( 'date' ), // The date and publish status of the post. |
|
72 | 72 | ); |
73 | 73 | |
74 | 74 | } |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | echo $this->oUtil->addAndApplyFilter( |
131 | 131 | $this, |
132 | 132 | "cell_{$this->oProp->sPostType}_{$sColumnKey}", |
133 | - '', // value to be filtered - cell output |
|
133 | + '', // value to be filtered - cell output |
|
134 | 134 | $iPostID |
135 | 135 | ); |
136 | 136 | } |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | * @internal |
180 | 180 | */ |
181 | 181 | public function _replyToRegisterTaxonomies() { |
182 | - foreach( $this->oProp->aTaxonomies as $_sTaxonomySlug => $_aArguments ) { |
|
182 | + foreach ( $this->oProp->aTaxonomies as $_sTaxonomySlug => $_aArguments ) { |
|
183 | 183 | $this->_registerTaxonomy( |
184 | 184 | $_sTaxonomySlug, |
185 | 185 | $this->oUtil->getAsArray( $this->oProp->aTaxonomyObjectTypes[ $_sTaxonomySlug ] ), // object types |
@@ -195,8 +195,8 @@ discard block |
||
195 | 195 | */ |
196 | 196 | public function _registerTaxonomy( $sTaxonomySlug, array $aObjectTypes, array $aArguments ) { |
197 | 197 | |
198 | - if ( ! in_array( $this->oProp->sPostType, $aObjectTypes ) ) { |
|
199 | - $aObjectTypes[] = $this->oProp->sPostType; |
|
198 | + if ( !in_array( $this->oProp->sPostType, $aObjectTypes ) ) { |
|
199 | + $aObjectTypes[ ] = $this->oProp->sPostType; |
|
200 | 200 | } |
201 | 201 | register_taxonomy( |
202 | 202 | $sTaxonomySlug, |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | */ |
235 | 235 | public function _replyToRemoveTexonomySubmenuPages() { |
236 | 236 | |
237 | - foreach( $this->oProp->aTaxonomyRemoveSubmenuPages as $sSubmenuPageSlug => $sTopLevelPageSlug ) { |
|
237 | + foreach ( $this->oProp->aTaxonomyRemoveSubmenuPages as $sSubmenuPageSlug => $sTopLevelPageSlug ) { |
|
238 | 238 | |
239 | 239 | remove_submenu_page( $sTopLevelPageSlug, $sSubmenuPageSlug ); |
240 | 240 |
@@ -63,21 +63,21 @@ discard block |
||
63 | 63 | */ |
64 | 64 | public function _replyToSaveFieldValues( $iUserID ) { |
65 | 65 | |
66 | - if ( ! current_user_can( 'edit_user', $iUserID ) ) { |
|
66 | + if ( !current_user_can( 'edit_user', $iUserID ) ) { |
|
67 | 67 | return; |
68 | 68 | } |
69 | 69 | |
70 | 70 | // Extract the fields data from $_POST |
71 | 71 | // Retrieve the submitted data. |
72 | - $_aInputs = $this->oForm->getSubmittedData( |
|
73 | - $_POST, // subject data to be parsed |
|
74 | - true, // extract data with the fieldset structure |
|
72 | + $_aInputs = $this->oForm->getSubmittedData( |
|
73 | + $_POST, // subject data to be parsed |
|
74 | + true, // extract data with the fieldset structure |
|
75 | 75 | false // strip slashes |
76 | 76 | ); |
77 | - $_aInputsRaw = $_aInputs; // store one for the last input array. |
|
77 | + $_aInputsRaw = $_aInputs; // store one for the last input array. |
|
78 | 78 | |
79 | 79 | // Prepare the saved data. For a new post, the id is set to 0. |
80 | - $_aSavedMeta = $this->oUtil->getSavedUserMetaArray( $iUserID, array_keys( $_aInputs ) ); |
|
80 | + $_aSavedMeta = $this->oUtil->getSavedUserMetaArray( $iUserID, array_keys( $_aInputs ) ); |
|
81 | 81 | |
82 | 82 | // Apply filters to the array of the submitted values. |
83 | 83 | $_aInputs = $this->oUtil->addAndApplyFilters( |
@@ -97,8 +97,8 @@ discard block |
||
97 | 97 | } |
98 | 98 | |
99 | 99 | $this->oForm->updateMetaDataByType( |
100 | - $iUserID, // object id |
|
101 | - $_aInputs, // user submit form data |
|
100 | + $iUserID, // object id |
|
101 | + $_aInputs, // user submit form data |
|
102 | 102 | $this->oForm->dropRepeatableElements( $_aSavedMeta ), // Drop repeatable section elements from the saved meta array. |
103 | 103 | $this->oForm->sStructureType // fields type |
104 | 104 | ); |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | |
27 | 27 | parent::__construct( $oProp ); |
28 | 28 | |
29 | - if ( ! $this->oProp->bIsAdmin ) { |
|
29 | + if ( !$this->oProp->bIsAdmin ) { |
|
30 | 30 | return; |
31 | 31 | } |
32 | 32 | |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | ); |
39 | 39 | |
40 | 40 | // 3.7.10+ |
41 | - add_action( 'set_up_' . $this->oProp->sClassName, array( $this, '_replyToSetUpHooks' ) ); |
|
41 | + add_action( 'set_up_'.$this->oProp->sClassName, array( $this, '_replyToSetUpHooks' ) ); |
|
42 | 42 | |
43 | 43 | } |
44 | 44 | |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | */ |
53 | 53 | protected function _isInThePage() { |
54 | 54 | |
55 | - if ( ! $this->oProp->bIsAdmin ) { |
|
55 | + if ( !$this->oProp->bIsAdmin ) { |
|
56 | 56 | return false; |
57 | 57 | } |
58 | 58 | |
@@ -94,14 +94,14 @@ discard block |
||
94 | 94 | public function _replyToSetUpHooks( $oFactory ) { |
95 | 95 | |
96 | 96 | // Hooks to display fields. |
97 | - add_action( 'show_user_profile', array( $this, '_replyToPrintFields' ) ); // profile.php |
|
98 | - add_action( 'edit_user_profile', array( $this, '_replyToPrintFields' ) ); // profile.php |
|
99 | - add_action( 'user_new_form', array( $this, '_replyToPrintFields' ) ); // user-new.php |
|
97 | + add_action( 'show_user_profile', array( $this, '_replyToPrintFields' ) ); // profile.php |
|
98 | + add_action( 'edit_user_profile', array( $this, '_replyToPrintFields' ) ); // profile.php |
|
99 | + add_action( 'user_new_form', array( $this, '_replyToPrintFields' ) ); // user-new.php |
|
100 | 100 | |
101 | 101 | // Hooks to save field values. |
102 | - add_action( 'personal_options_update', array( $this, '_replyToSaveFieldValues' ) ); // profile.php |
|
103 | - add_action( 'edit_user_profile_update', array( $this, '_replyToSaveFieldValues' ) ); // profile.php |
|
104 | - add_action('user_register', array( $this, '_replyToSaveFieldValues' ) ); // user-new.php |
|
102 | + add_action( 'personal_options_update', array( $this, '_replyToSaveFieldValues' ) ); // profile.php |
|
103 | + add_action( 'edit_user_profile_update', array( $this, '_replyToSaveFieldValues' ) ); // profile.php |
|
104 | + add_action( 'user_register', array( $this, '_replyToSaveFieldValues' ) ); // user-new.php |
|
105 | 105 | |
106 | 106 | $this->_load(); // 3.8.14+ |
107 | 107 |
@@ -44,17 +44,17 @@ |
||
44 | 44 | $_aOutput = array(); |
45 | 45 | |
46 | 46 | // Get the field outputs |
47 | - $_aOutput[] = $this->oForm->get(); |
|
47 | + $_aOutput[ ] = $this->oForm->get(); |
|
48 | 48 | |
49 | 49 | // Filter the output |
50 | 50 | $_sOutput = $this->oUtil->addAndApplyFilters( |
51 | 51 | $this, |
52 | - 'content_' . $this->oProp->sClassName, |
|
52 | + 'content_'.$this->oProp->sClassName, |
|
53 | 53 | $this->content( implode( PHP_EOL, $_aOutput ) ) |
54 | 54 | ); |
55 | 55 | |
56 | 56 | // Do action |
57 | - $this->oUtil->addAndDoActions( $this, 'do_' . $this->oProp->sClassName, $this ); |
|
57 | + $this->oUtil->addAndDoActions( $this, 'do_'.$this->oProp->sClassName, $this ); |
|
58 | 58 | |
59 | 59 | // Output |
60 | 60 | echo $_sOutput; |
@@ -24,10 +24,10 @@ discard block |
||
24 | 24 | * @return numeric |
25 | 25 | * @since 3.7.4 |
26 | 26 | */ |
27 | - static public function getUnusedNumericIndex( $aArray, $nIndex, $iOffset=1 ) { |
|
27 | + static public function getUnusedNumericIndex( $aArray, $nIndex, $iOffset = 1 ) { |
|
28 | 28 | |
29 | 29 | // Check if the order value is not used. |
30 | - if ( ! isset( $aArray[ $nIndex ] ) ) { |
|
30 | + if ( !isset( $aArray[ $nIndex ] ) ) { |
|
31 | 31 | return $nIndex; |
32 | 32 | } |
33 | 33 | |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | * @return boolean |
43 | 43 | */ |
44 | 44 | static public function isAssociative( array $aArray ) { |
45 | - return array_keys ( $aArray ) !== range( 0, count( $aArray ) - 1 ); |
|
45 | + return array_keys( $aArray ) !== range( 0, count( $aArray ) - 1 ); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
@@ -75,9 +75,9 @@ discard block |
||
75 | 75 | */ |
76 | 76 | static public function getReadableListOfArray( array $aArray ) { |
77 | 77 | |
78 | - $_aOutput = array(); |
|
79 | - foreach( $aArray as $_sKey => $_vValue ) { |
|
80 | - $_aOutput[] = self::getReadableArrayContents( $_sKey, $_vValue, 32 ) . PHP_EOL; |
|
78 | + $_aOutput = array(); |
|
79 | + foreach ( $aArray as $_sKey => $_vValue ) { |
|
80 | + $_aOutput[ ] = self::getReadableArrayContents( $_sKey, $_vValue, 32 ).PHP_EOL; |
|
81 | 81 | } |
82 | 82 | return implode( PHP_EOL, $_aOutput ); |
83 | 83 | |
@@ -88,37 +88,37 @@ discard block |
||
88 | 88 | * @since 3.3.0 |
89 | 89 | * @return string The generated human readable array contents. |
90 | 90 | */ |
91 | - static public function getReadableArrayContents( $sKey, $vValue, $sLabelCharLengths=16, $iOffset=0 ) { |
|
91 | + static public function getReadableArrayContents( $sKey, $vValue, $sLabelCharLengths = 16, $iOffset = 0 ) { |
|
92 | 92 | |
93 | 93 | $_aOutput = array(); |
94 | - $_aOutput[] = ( $iOffset |
|
95 | - ? str_pad( ' ', $iOffset ) |
|
94 | + $_aOutput[ ] = ( $iOffset |
|
95 | + ? str_pad( ' ', $iOffset ) |
|
96 | 96 | : '' |
97 | 97 | ) |
98 | 98 | . ( $sKey |
99 | - ? '[' . $sKey . ']' |
|
99 | + ? '['.$sKey.']' |
|
100 | 100 | : '' |
101 | 101 | ); |
102 | 102 | |
103 | - if ( ! in_array( gettype( $vValue ), array( 'array', 'object' ) ) ) { |
|
104 | - $_aOutput[] = $vValue; |
|
103 | + if ( !in_array( gettype( $vValue ), array( 'array', 'object' ) ) ) { |
|
104 | + $_aOutput[ ] = $vValue; |
|
105 | 105 | return implode( PHP_EOL, $_aOutput ); |
106 | 106 | } |
107 | 107 | |
108 | 108 | foreach ( $vValue as $_sTitle => $_asDescription ) { |
109 | - if ( ! in_array( gettype( $_asDescription ), array( 'array', 'object' ) ) ) { |
|
110 | - $_aOutput[] = str_pad( ' ', $iOffset ) |
|
109 | + if ( !in_array( gettype( $_asDescription ), array( 'array', 'object' ) ) ) { |
|
110 | + $_aOutput[ ] = str_pad( ' ', $iOffset ) |
|
111 | 111 | . $_sTitle |
112 | 112 | . str_pad( ':', $sLabelCharLengths - self::getStringLength( $_sTitle ) ) |
113 | 113 | . $_asDescription; |
114 | 114 | continue; |
115 | 115 | } |
116 | - $_aOutput[] = str_pad( ' ', $iOffset ) |
|
116 | + $_aOutput[ ] = str_pad( ' ', $iOffset ) |
|
117 | 117 | . $_sTitle |
118 | 118 | . ": {" |
119 | 119 | . self::getReadableArrayContents( '', $_asDescription, 16, $iOffset + 4 ) |
120 | 120 | . PHP_EOL |
121 | - . str_pad( ' ', $iOffset ) . "}"; |
|
121 | + . str_pad( ' ', $iOffset )."}"; |
|
122 | 122 | } |
123 | 123 | return implode( PHP_EOL, $_aOutput ); |
124 | 124 | |
@@ -131,11 +131,11 @@ discard block |
||
131 | 131 | */ |
132 | 132 | static public function getReadableListOfArrayAsHTML( array $aArray ) { |
133 | 133 | |
134 | - $_aOutput = array(); |
|
135 | - foreach( $aArray as $_sKey => $_vValue ) { |
|
136 | - $_aOutput[] = "<ul class='array-contents'>" |
|
134 | + $_aOutput = array(); |
|
135 | + foreach ( $aArray as $_sKey => $_vValue ) { |
|
136 | + $_aOutput[ ] = "<ul class='array-contents'>" |
|
137 | 137 | . self::getReadableArrayContentsHTML( $_sKey, $_vValue ) |
138 | - . "</ul>" . PHP_EOL; |
|
138 | + . "</ul>".PHP_EOL; |
|
139 | 139 | } |
140 | 140 | return implode( PHP_EOL, $_aOutput ); |
141 | 141 | |
@@ -152,25 +152,25 @@ discard block |
||
152 | 152 | $_aOutput = array(); |
153 | 153 | |
154 | 154 | // Title - array key |
155 | - $_aOutput[] = $sKey |
|
156 | - ? "<h3 class='array-key'>" . $sKey . "</h3>" |
|
155 | + $_aOutput[ ] = $sKey |
|
156 | + ? "<h3 class='array-key'>".$sKey."</h3>" |
|
157 | 157 | : ""; |
158 | 158 | |
159 | 159 | // If it does not have a nested array or object, |
160 | - if ( ! in_array( gettype( $vValue ), array( 'array', 'object' ) ) ) { |
|
161 | - $_aOutput[] = "<div class='array-value'>" |
|
160 | + if ( !in_array( gettype( $vValue ), array( 'array', 'object' ) ) ) { |
|
161 | + $_aOutput[ ] = "<div class='array-value'>" |
|
162 | 162 | . html_entity_decode( nl2br( str_replace( ' ', ' ', $vValue ) ), ENT_QUOTES ) |
163 | 163 | . "</div>"; |
164 | - return "<li>" . implode( PHP_EOL, $_aOutput ) . "</li>"; |
|
164 | + return "<li>".implode( PHP_EOL, $_aOutput )."</li>"; |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | // Now it is a nested item. |
168 | 168 | foreach ( $vValue as $_sKey => $_vValue ) { |
169 | - $_aOutput[] = "<ul class='array-contents'>" |
|
169 | + $_aOutput[ ] = "<ul class='array-contents'>" |
|
170 | 170 | . self::getReadableArrayContentsHTML( $_sKey, $_vValue ) |
171 | 171 | . "</ul>"; |
172 | 172 | } |
173 | - return implode( PHP_EOL, $_aOutput ) ; |
|
173 | + return implode( PHP_EOL, $_aOutput ); |
|
174 | 174 | |
175 | 175 | } |
176 | 176 |