@@ -42,8 +42,6 @@ discard block |
||
42 | 42 | * Sets up properties. |
43 | 43 | * @since 3.6.0 |
44 | 44 | * @since 3.7.0 Changed the parameter structure. |
45 | - * @param array|string $asArguments The content output or the tooltip argument array. |
|
46 | - * @param string $sTitleElementID Not used at the moment. |
|
47 | 45 | */ |
48 | 46 | public function __construct( /* $aArguments, $sTitleElementID */ ) { |
49 | 47 | |
@@ -170,6 +168,7 @@ discard block |
||
170 | 168 | |
171 | 169 | /** |
172 | 170 | * Generates HTML attributes of the specified element. |
171 | + * @param string $sElementKey |
|
173 | 172 | * @return string |
174 | 173 | * @since 3.8.5 |
175 | 174 | */ |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | /** |
22 | 22 | * Stores the default argument values. |
23 | 23 | */ |
24 | - public $aArguments = array( |
|
24 | + public $aArguments = array( |
|
25 | 25 | 'attributes' => array( |
26 | 26 | 'container' => array(), |
27 | 27 | 'title' => array(), |
@@ -29,11 +29,11 @@ discard block |
||
29 | 29 | 'description' => array(), |
30 | 30 | 'icon' => array(), |
31 | 31 | ), |
32 | - 'icon' => null, // the icon output to override |
|
33 | - 'dash-icon' => 'dashicons-editor-help', // the dash-icon class selector for the icon |
|
34 | - 'icon_alt_text' => '[?]', // [3.8.5+] alternative text when icon is not available. For WP v3.7.x or below. |
|
32 | + 'icon' => null, // the icon output to override |
|
33 | + 'dash-icon' => 'dashicons-editor-help', // the dash-icon class selector for the icon |
|
34 | + 'icon_alt_text' => '[?]', // [3.8.5+] alternative text when icon is not available. For WP v3.7.x or below. |
|
35 | 35 | 'title' => null, |
36 | - 'content' => null, // will be assigned in the constructor |
|
36 | + 'content' => null, // will be assigned in the constructor |
|
37 | 37 | ); |
38 | 38 | |
39 | 39 | public $sTitleElementID; |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | if ( is_string( $asContent ) ) { |
91 | 91 | return true; |
92 | 92 | } |
93 | - if ( is_array( $asContent ) && ! $this->isAssociative( $asContent ) ) { |
|
93 | + if ( is_array( $asContent ) && !$this->isAssociative( $asContent ) ) { |
|
94 | 94 | return true; |
95 | 95 | } |
96 | 96 | return false; |
@@ -104,12 +104,12 @@ discard block |
||
104 | 104 | * @return string The output. |
105 | 105 | */ |
106 | 106 | public function get() { |
107 | - if ( ! $this->aArguments[ 'content' ] ) { |
|
107 | + if ( !$this->aArguments[ 'content' ] ) { |
|
108 | 108 | return ''; |
109 | 109 | } |
110 | - return "<a " . $this->_getElementAttributes( 'container', 'admin-page-framework-form-tooltip' ) . ">" |
|
110 | + return "<a ".$this->_getElementAttributes( 'container', 'admin-page-framework-form-tooltip' ).">" |
|
111 | 111 | . $this->_getTipLinkIcon() |
112 | - . "<span " . $this->_getElementAttributes( 'content', 'admin-page-framework-form-tooltip-content' ) . ">" |
|
112 | + . "<span ".$this->_getElementAttributes( 'content', 'admin-page-framework-form-tooltip-content' ).">" |
|
113 | 113 | . $this->_getTipTitle() |
114 | 114 | . $this->_getDescriptions() |
115 | 115 | . "</span>" |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | return $this->aArguments[ 'icon' ]; |
128 | 128 | } |
129 | 129 | if ( version_compare( $GLOBALS[ 'wp_version' ], '3.8', '>=' ) ) { |
130 | - return "<span " . $this->_getElementAttributes( |
|
130 | + return "<span ".$this->_getElementAttributes( |
|
131 | 131 | 'icon', |
132 | 132 | array( |
133 | 133 | 'dashicons', |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | */ |
146 | 146 | private function _getTipTitle() { |
147 | 147 | if ( isset( $this->aArguments[ 'title' ] ) ) { |
148 | - return "<span " . $this->_getElementAttributes( 'title', 'admin-page-framework-form-tooltip-title' ) . ">" |
|
148 | + return "<span ".$this->_getElementAttributes( 'title', 'admin-page-framework-form-tooltip-title' ).">" |
|
149 | 149 | . $this->aArguments[ 'title' ] |
150 | 150 | . "</span>"; |
151 | 151 | } |
@@ -157,9 +157,9 @@ discard block |
||
157 | 157 | */ |
158 | 158 | private function _getDescriptions() { |
159 | 159 | if ( isset( $this->aArguments[ 'content' ] ) ) { |
160 | - return "<span " . $this->_getElementAttributes( 'description', 'admin-page-framework-form-tooltip-description' ) . ">" |
|
160 | + return "<span ".$this->_getElementAttributes( 'description', 'admin-page-framework-form-tooltip-description' ).">" |
|
161 | 161 | . implode( |
162 | - "</span><span " . $this->_getElementAttributes( 'description', 'admin-page-framework-form-tooltip-description' ) . ">", |
|
162 | + "</span><span ".$this->_getElementAttributes( 'description', 'admin-page-framework-form-tooltip-description' ).">", |
|
163 | 163 | $this->getAsArray( $this->aArguments[ 'content' ] ) |
164 | 164 | ) |
165 | 165 | . "</span>" |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | $_aContainerAttributes = $this->getElementAsArray( |
179 | 179 | $this->aArguments, |
180 | 180 | array( 'attributes', $sElementKey ) |
181 | - ) + array( 'class' => '' ) ; |
|
181 | + ) + array( 'class' => '' ); |
|
182 | 182 | $_aContainerAttributes[ 'class' ] = $this->getClassAttribute( |
183 | 183 | $_aContainerAttributes[ 'class' ], |
184 | 184 | $asClassSelectors |
@@ -16,9 +16,9 @@ discard block |
||
16 | 16 | */ |
17 | 17 | class AdminPageFrameworkLoader_Registry_Base { |
18 | 18 | |
19 | - const VERSION = '3.8.5b01'; // <--- DON'T FORGET TO CHANGE THIS AS WELL!! |
|
19 | + const VERSION = '3.8.5b01'; // <--- DON'T FORGET TO CHANGE THIS AS WELL!! |
|
20 | 20 | const NAME = 'Admin Page Framework - Loader'; // the name is not 'Admin Page Framework' because warning messages gets confusing. |
21 | - const SHORTNAME = 'Admin Page Framework'; // used for a menu title etc. |
|
21 | + const SHORTNAME = 'Admin Page Framework'; // used for a menu title etc. |
|
22 | 22 | const DESCRIPTION = 'Loads Admin Page Framework which facilitates WordPress plugin and theme development.'; |
23 | 23 | const URI = 'http://admin-page-framework.michaeluno.jp/'; |
24 | 24 | const AUTHOR = 'miunosoft (Michael Uno)'; |
@@ -55,14 +55,14 @@ discard block |
||
55 | 55 | * @remark This is also accessed from `uninstall.php` so do not remove. |
56 | 56 | * @remark Do not exceed 8 characters as a transient name allows 45 characters or less ( 40 for site transients ) so that md5 (32 characters) can be added. |
57 | 57 | */ |
58 | - const TRANSIENT_PREFIX = 'APFL_'; |
|
58 | + const TRANSIENT_PREFIX = 'APFL_'; |
|
59 | 59 | |
60 | 60 | /** |
61 | 61 | * The hook slug used for the prefix of action and filter hook names. |
62 | 62 | * |
63 | 63 | * @remark The ending underscore is not necessary. |
64 | 64 | */ |
65 | - const HOOK_SLUG = 'admin_page_framework_loader'; |
|
65 | + const HOOK_SLUG = 'admin_page_framework_loader'; |
|
66 | 66 | |
67 | 67 | /** |
68 | 68 | * The text domain slug and its path. |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | */ |
117 | 117 | static public $aAdminPages = array( |
118 | 118 | // key => 'page slug' |
119 | - 'about' => 'apfl_about', // the welcome page |
|
119 | + 'about' => 'apfl_about', // the welcome page |
|
120 | 120 | 'addon' => 'apfl_addons', |
121 | 121 | 'tool' => 'apfl_tools', |
122 | 122 | 'help' => 'apfl_contact', |
@@ -154,12 +154,12 @@ discard block |
||
154 | 154 | * @since 3.5.0 |
155 | 155 | * @return string |
156 | 156 | */ |
157 | - public static function getPluginURL( $sRelativePath='' ) { |
|
157 | + public static function getPluginURL( $sRelativePath = '' ) { |
|
158 | 158 | if ( isset( self::$_sPluginURLCache ) ) { |
159 | - return self::$_sPluginURLCache . $sRelativePath; |
|
159 | + return self::$_sPluginURLCache.$sRelativePath; |
|
160 | 160 | } |
161 | 161 | self::$_sPluginURLCache = trailingslashit( plugins_url( '', self::$sFilePath ) ); |
162 | - return self::$_sPluginURLCache . $sRelativePath; |
|
162 | + return self::$_sPluginURLCache.$sRelativePath; |
|
163 | 163 | } |
164 | 164 | /** |
165 | 165 | * @since 3.7.9 |
@@ -189,13 +189,13 @@ discard block |
||
189 | 189 | * @since 3.5.0 |
190 | 190 | * @return void |
191 | 191 | */ |
192 | - static public function setAdminNotice( $sMessage, $sClassAttribute='error' ) { |
|
193 | - if ( ! is_admin() ) { |
|
192 | + static public function setAdminNotice( $sMessage, $sClassAttribute = 'error' ) { |
|
193 | + if ( !is_admin() ) { |
|
194 | 194 | return; |
195 | 195 | } |
196 | - self::$_aAdminNotices[] = array( |
|
196 | + self::$_aAdminNotices[ ] = array( |
|
197 | 197 | 'message' => $sMessage, |
198 | - 'class_attribute' => trim( $sClassAttribute ) . ' notice is-dismissible', |
|
198 | + 'class_attribute' => trim( $sClassAttribute ).' notice is-dismissible', |
|
199 | 199 | ); |
200 | 200 | add_action( 'admin_notices', array( __CLASS__, '_replyToSetAdminNotice' ) ); |
201 | 201 | } |
@@ -205,12 +205,12 @@ discard block |
||
205 | 205 | * @return void |
206 | 206 | */ |
207 | 207 | static public function _replyToSetAdminNotice() { |
208 | - foreach( self::$_aAdminNotices as $_aAdminNotice ) { |
|
209 | - echo "<div class='" . esc_attr( $_aAdminNotice['class_attribute'] ) . " notice is-dismissible'>" |
|
208 | + foreach ( self::$_aAdminNotices as $_aAdminNotice ) { |
|
209 | + echo "<div class='".esc_attr( $_aAdminNotice[ 'class_attribute' ] )." notice is-dismissible'>" |
|
210 | 210 | ."<p>" |
211 | 211 | . sprintf( |
212 | - '<strong>%1$s</strong>: ' . $_aAdminNotice['message'], |
|
213 | - self::NAME . ' ' . self::VERSION |
|
212 | + '<strong>%1$s</strong>: '.$_aAdminNotice[ 'message' ], |
|
213 | + self::NAME.' '.self::VERSION |
|
214 | 214 | ) |
215 | 215 | . "</p>" |
216 | 216 | . "</div>"; |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | AdminPageFrameworkLoader_Registry::setUp( __FILE__ ); |
223 | 223 | |
224 | 224 | // Initial checks. - Do no load if accessed directly, not exiting because the 'uninstall.php' and inclusion list generator will load this file. |
225 | -if ( ! defined( 'ABSPATH' ) ) { |
|
225 | +if ( !defined( 'ABSPATH' ) ) { |
|
226 | 226 | return; |
227 | 227 | } |
228 | 228 | if ( defined( 'DOING_UNINSTALL' ) ) { |
@@ -234,8 +234,8 @@ discard block |
||
234 | 234 | |
235 | 235 | $_bFrameworkLoaded = class_exists( 'AdminPageFramework_Registry', false ); |
236 | 236 | if ( |
237 | - ! $_bFrameworkLoaded |
|
238 | - || ! defined( 'AdminPageFramework_Registry::VERSION' ) // backward compatibility |
|
237 | + !$_bFrameworkLoaded |
|
238 | + || !defined( 'AdminPageFramework_Registry::VERSION' ) // backward compatibility |
|
239 | 239 | || version_compare( AdminPageFramework_Registry::VERSION, AdminPageFrameworkLoader_Registry::VERSION, '<' ) |
240 | 240 | ) { |
241 | 241 | AdminPageFrameworkLoader_Registry::setAdminNotice( |
@@ -253,18 +253,18 @@ discard block |
||
253 | 253 | add_action( 'admin_init', 'AdminPageFrameworkLoader_Warning' ); |
254 | 254 | |
255 | 255 | // Include the library file - the development version will be available if you cloned the GitHub repository. |
256 | -$_sDevelopmentVersionPath = AdminPageFrameworkLoader_Registry::$sDirPath . '/development/admin-page-framework.php'; |
|
256 | +$_sDevelopmentVersionPath = AdminPageFrameworkLoader_Registry::$sDirPath.'/development/admin-page-framework.php'; |
|
257 | 257 | $_bDebugMode = defined( 'WP_DEBUG' ) && WP_DEBUG; |
258 | 258 | $_bLoadDevelopmentVersion = $_bDebugMode && file_exists( $_sDevelopmentVersionPath ); |
259 | 259 | include( |
260 | 260 | $_bLoadDevelopmentVersion |
261 | 261 | ? $_sDevelopmentVersionPath |
262 | - : AdminPageFrameworkLoader_Registry::$sDirPath . '/library/apf/admin-page-framework.php' |
|
262 | + : AdminPageFrameworkLoader_Registry::$sDirPath.'/library/apf/admin-page-framework.php' |
|
263 | 263 | ); |
264 | 264 | |
265 | 265 | // Include the framework loader plugin components. |
266 | 266 | include( AdminPageFramework_Registry::$aClassFiles[ 'AdminPageFramework_PluginBootstrap' ] ); |
267 | -include( AdminPageFrameworkLoader_Registry::$sDirPath . '/include/class/AdminPageFrameworkLoader_Bootstrap.php' ); |
|
267 | +include( AdminPageFrameworkLoader_Registry::$sDirPath.'/include/class/AdminPageFrameworkLoader_Bootstrap.php' ); |
|
268 | 268 | new AdminPageFrameworkLoader_Bootstrap( |
269 | 269 | AdminPageFrameworkLoader_Registry::$sFilePath, |
270 | 270 | AdminPageFrameworkLoader_Registry::HOOK_SLUG // hook prefix |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | |
34 | 34 | $_aParameters = func_get_args() + array( |
35 | 35 | $this->aFieldset, |
36 | - $this->aSavedData, // passed by reference. @todo: examine why it needs to be passed by reference. |
|
36 | + $this->aSavedData, // passed by reference. @todo: examine why it needs to be passed by reference. |
|
37 | 37 | $this->aFieldErrors, |
38 | 38 | $this->aFieldTypeDefinitions, |
39 | 39 | $this->aCallbacks, // field output element callables. |
@@ -61,14 +61,14 @@ discard block |
||
61 | 61 | |
62 | 62 | $aFieldset = $this->aFieldset; |
63 | 63 | |
64 | - if ( ! $this->isNormalPlacement( $aFieldset ) ) { |
|
64 | + if ( !$this->isNormalPlacement( $aFieldset ) ) { |
|
65 | 65 | return ''; |
66 | 66 | } |
67 | 67 | |
68 | - $_oFieldrowAttribute = new AdminPageFramework_Form_View___Attribute_Fieldrow( |
|
68 | + $_oFieldrowAttribute = new AdminPageFramework_Form_View___Attribute_Fieldrow( |
|
69 | 69 | $aFieldset, |
70 | 70 | array( |
71 | - 'id' => 'fieldrow-' . $aFieldset[ 'tag_id' ], |
|
71 | + 'id' => 'fieldrow-'.$aFieldset[ 'tag_id' ], |
|
72 | 72 | 'valign' => 'top', |
73 | 73 | 'class' => 'admin-page-framework-fieldrow', |
74 | 74 | ) |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | return $this->_getFieldByContainer( |
78 | 78 | $aFieldset, |
79 | 79 | array( |
80 | - 'open_container' => "<tr " . $_oFieldrowAttribute->get() . ">", |
|
80 | + 'open_container' => "<tr ".$_oFieldrowAttribute->get().">", |
|
81 | 81 | 'close_container' => "</tr>", |
82 | 82 | 'open_title' => "<th>", |
83 | 83 | 'close_title' => "</th>", |
@@ -126,13 +126,13 @@ discard block |
||
126 | 126 | $this->aCallbacks, |
127 | 127 | $this->oMsg |
128 | 128 | ); |
129 | - $_aOutput = array(); |
|
129 | + $_aOutput = array(); |
|
130 | 130 | if ( $aFieldset[ 'show_title_column' ] ) { |
131 | - $_aOutput[] = $aOpenCloseTags[ 'open_title' ] |
|
131 | + $_aOutput[ ] = $aOpenCloseTags[ 'open_title' ] |
|
132 | 132 | . $_oFieldTitle->get() |
133 | 133 | . $aOpenCloseTags[ 'close_title' ]; |
134 | 134 | } |
135 | - $_aOutput[] = $aOpenCloseTags[ 'open_main' ] |
|
135 | + $_aOutput[ ] = $aOpenCloseTags[ 'open_main' ] |
|
136 | 136 | // . call_user_func_array( $hfCallback, array( $aFieldset ) ) |
137 | 137 | . $this->getFieldsetOutput( $aFieldset ) |
138 | 138 | . $aOpenCloseTags[ 'close_main' ]; |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | |
71 | 71 | $aField = $this->aFieldset; |
72 | 72 | |
73 | - if ( ! $aField[ 'show_title_column' ] ) { |
|
73 | + if ( !$aField[ 'show_title_column' ] ) { |
|
74 | 74 | return ''; |
75 | 75 | } |
76 | 76 | |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | 'for' => $_oInputTagIDGenerator->get(), |
85 | 85 | ); |
86 | 86 | $_sOutput .= $aField[ 'title' ] |
87 | - ? "<label " . $this->getAttributes( $_aLabelAttributes ) . "'>" |
|
87 | + ? "<label ".$this->getAttributes( $_aLabelAttributes )."'>" |
|
88 | 88 | . "<a id='{$aField[ 'field_id' ]}'></a>" // to allow the browser to link to the element. |
89 | 89 | . "<span title='" |
90 | 90 | . esc_attr( |
@@ -115,12 +115,12 @@ discard block |
||
115 | 115 | */ |
116 | 116 | private function _getFieldOutputsInFieldTitleAreaFromNestedFields( $aField ) { |
117 | 117 | |
118 | - if ( ! $this->hasNestedFields( $aField ) ) { |
|
118 | + if ( !$this->hasNestedFields( $aField ) ) { |
|
119 | 119 | return ''; |
120 | 120 | } |
121 | 121 | |
122 | 122 | $_sOutput = ''; |
123 | - foreach( $aField[ 'content' ] as $_aNestedField ) { |
|
123 | + foreach ( $aField[ 'content' ] as $_aNestedField ) { |
|
124 | 124 | |
125 | 125 | if ( 'field_title' !== $_aNestedField[ 'placement' ] ) { |
126 | 126 | continue; |
@@ -128,13 +128,13 @@ discard block |
||
128 | 128 | |
129 | 129 | $_oFieldset = new AdminPageFramework_Form_View___Fieldset( |
130 | 130 | $_aNestedField, |
131 | - $this->aSavedData, // passed by reference. @todo: examine why it needs to be passed by reference. |
|
131 | + $this->aSavedData, // passed by reference. @todo: examine why it needs to be passed by reference. |
|
132 | 132 | $this->aFieldErrors, |
133 | 133 | $this->aFieldTypeDefinitions, |
134 | 134 | $this->oMsg, |
135 | 135 | $this->aCallbacks // field output element callables. |
136 | 136 | ); |
137 | - $_sOutput .= $_oFieldset->get(); // field output |
|
137 | + $_sOutput .= $_oFieldset->get(); // field output |
|
138 | 138 | |
139 | 139 | } |
140 | 140 | return $_sOutput; |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | * @since 3.7.0 |
147 | 147 | */ |
148 | 148 | private function _getToolTip( $asTip, $sElementID ) { |
149 | - $_oToolTip = new AdminPageFramework_Form_View___ToolTip( |
|
149 | + $_oToolTip = new AdminPageFramework_Form_View___ToolTip( |
|
150 | 150 | $asTip, |
151 | 151 | $sElementID |
152 | 152 | ); |
@@ -160,18 +160,18 @@ discard block |
||
160 | 160 | */ |
161 | 161 | private function _getDebugInfo( $aField ) { |
162 | 162 | |
163 | - if ( ! $this->isDebugMode() ) { |
|
163 | + if ( !$this->isDebugMode() ) { |
|
164 | 164 | return ''; |
165 | 165 | } |
166 | 166 | |
167 | - $_oToolTip = new AdminPageFramework_Form_View___ToolTip( |
|
167 | + $_oToolTip = new AdminPageFramework_Form_View___ToolTip( |
|
168 | 168 | array( |
169 | 169 | 'title' => $this->oMsg->get( 'field_arguments' ), |
170 | 170 | 'dash-icon' => 'dashicons-info', |
171 | - 'icon_alt_text' => '[' . $this->oMsg->get( 'debug' ) . ' ]', |
|
171 | + 'icon_alt_text' => '['.$this->oMsg->get( 'debug' ).' ]', |
|
172 | 172 | 'content' => AdminPageFramework_Debug::get( $aField ) |
173 | 173 | . '<span class="admin-page-framework-info">' |
174 | - . $this->getFrameworkName() . ' ' . $this->getFrameworkVersion() |
|
174 | + . $this->getFrameworkName().' '.$this->getFrameworkVersion() |
|
175 | 175 | . '</span>', |
176 | 176 | 'attributes' => array( |
177 | 177 | 'container' => array( |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | ), |
180 | 180 | ) |
181 | 181 | ), |
182 | - $aField[ 'field_id' ] . '_debug' |
|
182 | + $aField[ 'field_id' ].'_debug' |
|
183 | 183 | ); |
184 | 184 | return $_oToolTip->get(); |
185 | 185 | |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | */ |
192 | 192 | private function _getTitleColon( $aField ) { |
193 | 193 | |
194 | - if ( ! isset( $aField[ 'title' ] ) || '' === $aField[ 'title' ] ) { |
|
194 | + if ( !isset( $aField[ 'title' ] ) || '' === $aField[ 'title' ] ) { |
|
195 | 195 | return ''; |
196 | 196 | } |
197 | 197 | if ( |
@@ -199,8 +199,8 @@ discard block |
||
199 | 199 | $aField[ '_structure_type' ], |
200 | 200 | array( 'widget', 'post_meta_box', 'page_meta_box' ) |
201 | 201 | ) |
202 | - ){ |
|
203 | - return "<span class='title-colon'>:</span>" ; |
|
202 | + ) { |
|
203 | + return "<span class='title-colon'>:</span>"; |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | } |