@@ -232,6 +232,8 @@ discard block |
||
232 | 232 | * @remark The meta box class may be instantiated multiple times so prevent echoing the same styles multiple times. |
233 | 233 | * @parameter string $sIDPrefix The id selector embedded in the script tag. |
234 | 234 | * @parameter string $sClassName The class name that identify the call group. This is important for the meta-box class because it can be instantiated multiple times in one particular page. |
235 | + * @param string $sIDPrefix |
|
236 | + * @param string $sClassName |
|
235 | 237 | */ |
236 | 238 | protected function _printCommonStyles( $sIDPrefix, $sClassName ) { |
237 | 239 | |
@@ -315,6 +317,8 @@ discard block |
||
315 | 317 | * @remark The meta box class may be instantiated multiple times so prevent echoing the same styles multiple times. |
316 | 318 | * @parametr string $sIDPrefix The id selector embedded in the script tag. |
317 | 319 | * @parametr string $sClassName The class name that identify the call group. This is important for the meta-box class because it can be instantiated multiple times in one particular page. |
320 | + * @param string $sIDPrefix |
|
321 | + * @param string $sClassName |
|
318 | 322 | */ |
319 | 323 | protected function _printCommonScripts( $sIDPrefix, $sClassName ) { |
320 | 324 |
@@ -36,19 +36,19 @@ discard block |
||
36 | 36 | |
37 | 37 | /* The system internal keys. */ |
38 | 38 | 'sSRC' => null, |
39 | - 'aPostTypes' => array(), // for meta box class |
|
39 | + 'aPostTypes' => array(), // for meta box class |
|
40 | 40 | 'sPageSlug' => null, |
41 | 41 | 'sTabSlug' => null, |
42 | - 'sType' => null, // script or style |
|
42 | + 'sType' => null, // script or style |
|
43 | 43 | |
44 | 44 | /* The below keys are for users. */ |
45 | 45 | 'handle_id' => null, |
46 | 46 | 'dependencies' => array(), |
47 | - 'version' => false, // although the type should be string, the wp_enqueue_...() functions want false as the default value. |
|
48 | - 'translation' => array(), // only for scripts |
|
49 | - 'in_footer' => false, // only for scripts |
|
50 | - 'media' => 'all', // only for styles |
|
51 | - 'attributes' => array(), // 3.3.0+ - the attribute array |
|
47 | + 'version' => false, // although the type should be string, the wp_enqueue_...() functions want false as the default value. |
|
48 | + 'translation' => array(), // only for scripts |
|
49 | + 'in_footer' => false, // only for scripts |
|
50 | + 'media' => 'all', // only for styles |
|
51 | + 'attributes' => array(), // 3.3.0+ - the attribute array |
|
52 | 52 | |
53 | 53 | ); |
54 | 54 | |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | * @remark This value should be overridden in an extended class. |
60 | 60 | * @internal |
61 | 61 | */ |
62 | - protected $_sClassSelector_Style = 'admin-page-framework-style'; |
|
62 | + protected $_sClassSelector_Style = 'admin-page-framework-style'; |
|
63 | 63 | |
64 | 64 | /** |
65 | 65 | * Stores the class selector used to the class-specific script. |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * @remark This value should be overridden in an extended class. |
69 | 69 | * @internal |
70 | 70 | */ |
71 | - protected $_sClassSelector_Script = 'admin-page-framework-script'; |
|
71 | + protected $_sClassSelector_Script = 'admin-page-framework-script'; |
|
72 | 72 | |
73 | 73 | /** |
74 | 74 | * Stores hand IDs by resource url to look up handle id and add custom arguments. |
@@ -142,8 +142,8 @@ discard block |
||
142 | 142 | * @internal |
143 | 143 | */ |
144 | 144 | |
145 | - public function _forceToEnqueueStyle( $sSRC, $aCustomArgs=array() ) {} |
|
146 | - public function _forceToEnqueueScript( $sSRC, $aCustomArgs=array() ) {} |
|
145 | + public function _forceToEnqueueStyle( $sSRC, $aCustomArgs = array() ) {} |
|
146 | + public function _forceToEnqueueScript( $sSRC, $aCustomArgs = array() ) {} |
|
147 | 147 | |
148 | 148 | /** |
149 | 149 | * A helper function for the _replyToEnqueueScripts() and the `_replyToEnqueueStyle()` methods. |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | } |
205 | 205 | |
206 | 206 | $_sAttributes = $this->getAttributes( $_aAttributes ); |
207 | - $_sModifiedURL = $sSanitizedURL . "' " . rtrim( $_sAttributes, "'\"" ); // '" |
|
207 | + $_sModifiedURL = $sSanitizedURL."' ".rtrim( $_sAttributes, "'\"" ); // '" |
|
208 | 208 | |
209 | 209 | return $_sModifiedURL; |
210 | 210 | |
@@ -252,19 +252,19 @@ discard block |
||
252 | 252 | */ |
253 | 253 | private function _getStyleTag( $oCaller, $sIDPrefix ) { |
254 | 254 | |
255 | - $_sStyle = $this->addAndApplyFilters( |
|
255 | + $_sStyle = $this->addAndApplyFilters( |
|
256 | 256 | $oCaller, |
257 | 257 | array( |
258 | - "style_common_admin_page_framework", // 3.2.1+ |
|
258 | + "style_common_admin_page_framework", // 3.2.1+ |
|
259 | 259 | "style_common_{$this->oProp->sClassName}", |
260 | 260 | ), |
261 | 261 | AdminPageFramework_CSS::getDefaultCSS() |
262 | 262 | ); |
263 | - $_sStyle = $this->isDebugMode() |
|
263 | + $_sStyle = $this->isDebugMode() |
|
264 | 264 | ? trim( $_sStyle ) |
265 | 265 | : $this->minifyCSS( $_sStyle ); |
266 | 266 | if ( $_sStyle ) { |
267 | - echo "<style type='text/css' id='" . esc_attr( $sIDPrefix ) . "'>" |
|
267 | + echo "<style type='text/css' id='".esc_attr( $sIDPrefix )."'>" |
|
268 | 268 | . $_sStyle |
269 | 269 | . "</style>"; |
270 | 270 | } |
@@ -278,20 +278,20 @@ discard block |
||
278 | 278 | */ |
279 | 279 | private function _getIEStyleTag( $oCaller, $sIDPrefix ) { |
280 | 280 | |
281 | - $_sStyleIE = $this->addAndApplyFilters( |
|
281 | + $_sStyleIE = $this->addAndApplyFilters( |
|
282 | 282 | $oCaller, |
283 | 283 | array( |
284 | - "style_ie_common_admin_page_framework", // 3.2.1+ |
|
284 | + "style_ie_common_admin_page_framework", // 3.2.1+ |
|
285 | 285 | "style_ie_common_{$this->oProp->sClassName}", |
286 | 286 | ), |
287 | 287 | AdminPageFramework_CSS::getDefaultCSSIE() |
288 | 288 | ); |
289 | 289 | |
290 | - $_sStyleIE = $this->isDebugMode() |
|
290 | + $_sStyleIE = $this->isDebugMode() |
|
291 | 291 | ? trim( $_sStyleIE ) |
292 | 292 | : $this->minifyCSS( $_sStyleIE ); |
293 | 293 | return $_sStyleIE |
294 | - ? "<!--[if IE]><style type='text/css' id='" . esc_attr( $sIDPrefix . "-ie" ) . "'>" |
|
294 | + ? "<!--[if IE]><style type='text/css' id='".esc_attr( $sIDPrefix."-ie" )."'>" |
|
295 | 295 | . $_sStyleIE |
296 | 296 | . "</style><![endif]-->" |
297 | 297 | : ''; |
@@ -324,14 +324,14 @@ discard block |
||
324 | 324 | $_sScript = $this->addAndApplyFilters( |
325 | 325 | $this->oProp->_getCallerObject(), |
326 | 326 | array( |
327 | - "script_common_admin_page_framework", // 3.2.1+ |
|
327 | + "script_common_admin_page_framework", // 3.2.1+ |
|
328 | 328 | "script_common_{$this->oProp->sClassName}", |
329 | 329 | ), |
330 | 330 | AdminPageFramework_Property_Base::$_sDefaultScript |
331 | 331 | ); |
332 | 332 | $_sScript = trim( $_sScript ); |
333 | 333 | if ( $_sScript ) { |
334 | - echo "<script type='text/javascript' id='" . esc_attr( $sIDPrefix ) . "'>" |
|
334 | + echo "<script type='text/javascript' id='".esc_attr( $sIDPrefix )."'>" |
|
335 | 335 | . $_sScript |
336 | 336 | . "</script>"; |
337 | 337 | } |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | */ |
349 | 349 | protected function _printClassSpecificStyles( $sIDPrefix ) { |
350 | 350 | |
351 | - $_oCaller = $this->oProp->_getCallerObject(); |
|
351 | + $_oCaller = $this->oProp->_getCallerObject(); |
|
352 | 352 | echo $this->_getClassSpecificStyleTag( $_oCaller, $sIDPrefix ); |
353 | 353 | echo $this->_getClassSpecificIEStyleTag( $_oCaller, $sIDPrefix ); |
354 | 354 | |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | ? trim( $_sStyle ) |
377 | 377 | : $this->minifyCSS( $_sStyle ); |
378 | 378 | if ( $_sStyle ) { |
379 | - return "<style type='text/css' id='" . esc_attr( "{$sIDPrefix}-{$this->oProp->sClassName}_{$_iCallCount}" ) . "'>" |
|
379 | + return "<style type='text/css' id='".esc_attr( "{$sIDPrefix}-{$this->oProp->sClassName}_{$_iCallCount}" )."'>" |
|
380 | 380 | . $_sStyle |
381 | 381 | . "</style>"; |
382 | 382 | $_iCallCount++; |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | ? trim( $_sStyleIE ) |
403 | 403 | : $this->minifyCSS( $_sStyleIE ); |
404 | 404 | if ( $_sStyleIE ) { |
405 | - return "<!--[if IE]><style type='text/css' id='" . esc_attr( "{$sIDPrefix}-ie-{$this->oProp->sClassName}_{$_iCallCountIE}" ) . "'>" |
|
405 | + return "<!--[if IE]><style type='text/css' id='".esc_attr( "{$sIDPrefix}-ie-{$this->oProp->sClassName}_{$_iCallCountIE}" )."'>" |
|
406 | 406 | . $_sStyleIE |
407 | 407 | . "</style><![endif]-->"; |
408 | 408 | $_iCallCountIE++; |
@@ -430,7 +430,7 @@ discard block |
||
430 | 430 | ); |
431 | 431 | $_sScript = trim( $_sScript ); |
432 | 432 | if ( $_sScript ) { |
433 | - echo "<script type='text/javascript' id='" . esc_attr( "{$sIDPrefix}-{$this->oProp->sClassName}_{$_iCallCount}" ) . "'>" |
|
433 | + echo "<script type='text/javascript' id='".esc_attr( "{$sIDPrefix}-{$this->oProp->sClassName}_{$_iCallCount}" )."'>" |
|
434 | 434 | . $_sScript |
435 | 435 | . "</script>"; |
436 | 436 | $_iCallCount++; |
@@ -454,12 +454,12 @@ discard block |
||
454 | 454 | public function _replyToAddStyle() { |
455 | 455 | |
456 | 456 | $_oCaller = $this->oProp->_getCallerObject(); |
457 | - if ( ! $_oCaller->_isInThePage() ) { |
|
457 | + if ( !$_oCaller->_isInThePage() ) { |
|
458 | 458 | return; |
459 | 459 | } |
460 | 460 | |
461 | 461 | $this->_printCommonStyles( 'admin-page-framework-style-common', get_class() ); |
462 | - $this->_printClassSpecificStyles( $this->_sClassSelector_Style . '-' . $this->oProp->sStructureType ); |
|
462 | + $this->_printClassSpecificStyles( $this->_sClassSelector_Style.'-'.$this->oProp->sStructureType ); |
|
463 | 463 | |
464 | 464 | } |
465 | 465 | /** |
@@ -474,12 +474,12 @@ discard block |
||
474 | 474 | public function _replyToAddScript() { |
475 | 475 | |
476 | 476 | $_oCaller = $this->oProp->_getCallerObject(); |
477 | - if ( ! $_oCaller->_isInThePage() ) { |
|
477 | + if ( !$_oCaller->_isInThePage() ) { |
|
478 | 478 | return; |
479 | 479 | } |
480 | 480 | |
481 | 481 | $this->_printCommonScripts( 'admin-page-framework-script-common', get_class() ); |
482 | - $this->_printClassSpecificScripts( $this->_sClassSelector_Script . '-' . $this->oProp->sStructureType ); |
|
482 | + $this->_printClassSpecificScripts( $this->_sClassSelector_Script.'-'.$this->oProp->sStructureType ); |
|
483 | 483 | |
484 | 484 | } |
485 | 485 | |
@@ -494,28 +494,28 @@ discard block |
||
494 | 494 | protected function _enqueueSRC( $aEnqueueItem ) { |
495 | 495 | |
496 | 496 | // For styles |
497 | - if ( 'style' === $aEnqueueItem['sType'] ) { |
|
497 | + if ( 'style' === $aEnqueueItem[ 'sType' ] ) { |
|
498 | 498 | wp_enqueue_style( |
499 | - $aEnqueueItem['handle_id'], |
|
500 | - $aEnqueueItem['sSRC'], |
|
501 | - $aEnqueueItem['dependencies'], |
|
502 | - $aEnqueueItem['version'], |
|
503 | - $aEnqueueItem['media'] |
|
499 | + $aEnqueueItem[ 'handle_id' ], |
|
500 | + $aEnqueueItem[ 'sSRC' ], |
|
501 | + $aEnqueueItem[ 'dependencies' ], |
|
502 | + $aEnqueueItem[ 'version' ], |
|
503 | + $aEnqueueItem[ 'media' ] |
|
504 | 504 | ); |
505 | 505 | return; |
506 | 506 | } |
507 | 507 | |
508 | 508 | // For scripts |
509 | 509 | wp_enqueue_script( |
510 | - $aEnqueueItem['handle_id'], |
|
511 | - $aEnqueueItem['sSRC'], |
|
512 | - $aEnqueueItem['dependencies'], |
|
513 | - $aEnqueueItem['version'], |
|
514 | - did_action( 'admin_body_class' ) ? true : $aEnqueueItem['in_footer'] |
|
510 | + $aEnqueueItem[ 'handle_id' ], |
|
511 | + $aEnqueueItem[ 'sSRC' ], |
|
512 | + $aEnqueueItem[ 'dependencies' ], |
|
513 | + $aEnqueueItem[ 'version' ], |
|
514 | + did_action( 'admin_body_class' ) ? true : $aEnqueueItem[ 'in_footer' ] |
|
515 | 515 | ); |
516 | 516 | |
517 | - if ( $aEnqueueItem['translation'] ) { |
|
518 | - wp_localize_script( $aEnqueueItem['handle_id'], $aEnqueueItem['handle_id'], $aEnqueueItem['translation'] ); |
|
517 | + if ( $aEnqueueItem[ 'translation' ] ) { |
|
518 | + wp_localize_script( $aEnqueueItem[ 'handle_id' ], $aEnqueueItem[ 'handle_id' ], $aEnqueueItem[ 'translation' ] ); |
|
519 | 519 | } |
520 | 520 | |
521 | 521 | } |
@@ -531,7 +531,7 @@ discard block |
||
531 | 531 | * @internal |
532 | 532 | */ |
533 | 533 | public function _replyToEnqueueStyles() { |
534 | - foreach( $this->oProp->aEnqueuingStyles as $_sKey => $_aEnqueuingStyle ) { |
|
534 | + foreach ( $this->oProp->aEnqueuingStyles as $_sKey => $_aEnqueuingStyle ) { |
|
535 | 535 | $this->_enqueueSRCByCondition( $_aEnqueuingStyle ); |
536 | 536 | unset( $this->oProp->aEnqueuingStyles[ $_sKey ] ); |
537 | 537 | } |
@@ -548,7 +548,7 @@ discard block |
||
548 | 548 | * @internal |
549 | 549 | */ |
550 | 550 | public function _replyToEnqueueScripts() { |
551 | - foreach( $this->oProp->aEnqueuingScripts as $_sKey => $_aEnqueuingScript ) { |
|
551 | + foreach ( $this->oProp->aEnqueuingScripts as $_sKey => $_aEnqueuingScript ) { |
|
552 | 552 | $this->_enqueueSRCByCondition( $_aEnqueuingScript ); |
553 | 553 | unset( $this->oProp->aEnqueuingScripts[ $_sKey ] ); |
554 | 554 | } |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | */ |
236 | 236 | protected function _printCommonStyles( $sIDPrefix, $sClassName ) { |
237 | 237 | |
238 | - if ( self::$_bCommonStyleLoaded ) { |
|
238 | + if ( self::$_bCommonStyleLoaded ) { |
|
239 | 239 | return; |
240 | 240 | } |
241 | 241 | self::$_bCommonStyleLoaded = true; |
@@ -474,7 +474,7 @@ discard block |
||
474 | 474 | public function _replyToAddScript() { |
475 | 475 | |
476 | 476 | $_oCaller = $this->oProp->_getCallerObject(); |
477 | - if ( ! $_oCaller->_isInThePage() ) { |
|
477 | + if ( ! $_oCaller->_isInThePage() ) { |
|
478 | 478 | return; |
479 | 479 | } |
480 | 480 | |
@@ -530,7 +530,7 @@ discard block |
||
530 | 530 | * @since 3.2.0 Changed it unset the enqueued item so that the method can be called multiple times. |
531 | 531 | * @internal |
532 | 532 | */ |
533 | - public function _replyToEnqueueStyles() { |
|
533 | + public function _replyToEnqueueStyles() { |
|
534 | 534 | foreach( $this->oProp->aEnqueuingStyles as $_sKey => $_aEnqueuingStyle ) { |
535 | 535 | $this->_enqueueSRCByCondition( $_aEnqueuingStyle ); |
536 | 536 | unset( $this->oProp->aEnqueuingStyles[ $_sKey ] ); |
@@ -547,7 +547,7 @@ discard block |
||
547 | 547 | * @since 3.2.0 Changed it unset the enqueued item so that the method can be called multiple times. |
548 | 548 | * @internal |
549 | 549 | */ |
550 | - public function _replyToEnqueueScripts() { |
|
550 | + public function _replyToEnqueueScripts() { |
|
551 | 551 | foreach( $this->oProp->aEnqueuingScripts as $_sKey => $_aEnqueuingScript ) { |
552 | 552 | $this->_enqueueSRCByCondition( $_aEnqueuingScript ); |
553 | 553 | unset( $this->oProp->aEnqueuingScripts[ $_sKey ] ); |
@@ -109,7 +109,7 @@ |
||
109 | 109 | * Converts bytes to HR. |
110 | 110 | * |
111 | 111 | * @access private |
112 | - * @param mixed $bytes |
|
112 | + * @param mixed $nBytes |
|
113 | 113 | * @remark This is influenced by the work of Mike Jolley. |
114 | 114 | * @see http://mikejolley.com/projects/wp-page-load-stats/ |
115 | 115 | */ |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | |
20 | 20 | function __construct( $oProp, $oMsg ) { |
21 | 21 | |
22 | - if ( $oProp->bIsAdminAjax || ! $oProp->bIsAdmin ) { |
|
22 | + if ( $oProp->bIsAdminAjax || !$oProp->bIsAdmin ) { |
|
23 | 23 | return; |
24 | 24 | } |
25 | 25 | |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | self::$_bLoadedPageLoadInfo = true; |
59 | 59 | |
60 | 60 | $_nSeconds = timer_stop( 0 ); |
61 | - $_nQueryCount = get_num_queries(); |
|
61 | + $_nQueryCount = get_num_queries(); |
|
62 | 62 | $_nMemoryUsage = round( $this->_convertBytesToHR( memory_get_usage() ), 2 ); |
63 | 63 | $_nMemoryPeakUsage = round( $this->_convertBytesToHR( memory_get_peak_usage() ), 2 ); |
64 | 64 | $_nMemoryLimit = round( $this->_convertBytesToHR( $this->_convertToNumber( WP_MEMORY_LIMIT ) ), 2 ); |
@@ -67,10 +67,10 @@ discard block |
||
67 | 67 | return $sFooterHTML |
68 | 68 | . "<div id='admin-page-framework-page-load-stats'>" |
69 | 69 | . "<ul>" |
70 | - . "<li>" . sprintf( $this->oMsg->get( 'queries_in_seconds' ), $_nQueryCount, $_nSeconds ) . "</li>" |
|
71 | - . "<li>" . sprintf( $this->oMsg->get( 'out_of_x_memory_used' ), $_nMemoryUsage, $_nMemoryLimit, round( ( $_nMemoryUsage / $_nMemoryLimit ), 2 ) * 100 . '%' ) . "</li>" |
|
72 | - . "<li>" . sprintf( $this->oMsg->get( 'peak_memory_usage' ), $_nMemoryPeakUsage ) . "</li>" |
|
73 | - . "<li>" . sprintf( $this->oMsg->get( 'initial_memory_usage' ), $_sInitialMemoryUsage ) . "</li>" |
|
70 | + . "<li>".sprintf( $this->oMsg->get( 'queries_in_seconds' ), $_nQueryCount, $_nSeconds )."</li>" |
|
71 | + . "<li>".sprintf( $this->oMsg->get( 'out_of_x_memory_used' ), $_nMemoryUsage, $_nMemoryLimit, round( ( $_nMemoryUsage / $_nMemoryLimit ), 2 ) * 100.'%' )."</li>" |
|
72 | + . "<li>".sprintf( $this->oMsg->get( 'peak_memory_usage' ), $_nMemoryPeakUsage )."</li>" |
|
73 | + . "<li>".sprintf( $this->oMsg->get( 'initial_memory_usage' ), $_sInitialMemoryUsage )."</li>" |
|
74 | 74 | . "</ul>" |
75 | 75 | . "</div>"; |
76 | 76 | |
@@ -88,8 +88,8 @@ discard block |
||
88 | 88 | */ |
89 | 89 | private function _convertToNumber( $nSize ) { |
90 | 90 | |
91 | - $_nReturn = substr( $nSize, 0, -1 ); |
|
92 | - switch( strtoupper( substr( $nSize, -1 ) ) ) { |
|
91 | + $_nReturn = substr( $nSize, 0, -1 ); |
|
92 | + switch ( strtoupper( substr( $nSize, -1 ) ) ) { |
|
93 | 93 | case 'P': |
94 | 94 | $_nReturn *= 1024; |
95 | 95 | case 'T': |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | $_nLog = log( $nBytes, 1024 ); |
119 | 119 | $_iPower = ( int ) $_nLog; |
120 | 120 | $_iSize = pow( 1024, $_nLog - $_iPower ); |
121 | - return $_iSize . $_aUnits[ $_iPower ]; |
|
121 | + return $_iSize.$_aUnits[ $_iPower ]; |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | } |
125 | 125 | \ No newline at end of file |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | * @access public |
188 | 188 | * @remark The actual registration will be performed in the `_replyToRegisterSettings()` method with the `admin_menu` hook. |
189 | 189 | * @remark The `$oForm` property should be created in each extended class. |
190 | - * @param array|string $aSection the section array. If a string is passed, it is considered as a target page slug that will be used as a page slug element from the next call so that the element can be omitted. |
|
190 | + * @param array|string $aSectionset the section array. If a string is passed, it is considered as a target page slug that will be used as a page slug element from the next call so that the element can be omitted. |
|
191 | 191 | * <h4>Section Definition Array</h4> |
192 | 192 | * <ul> |
193 | 193 | * <li>**section_id** - (string) the section ID. Avoid using non-alphabetic characters except underscore and numbers.</li> |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | * @since 3.0.0 The scope changed to public to indicate the users will use. |
300 | 300 | * @return void |
301 | 301 | * @remark The $oForm property should be created in each extended class. |
302 | - * @param array|string $asField A field definition array or a string of the target section id. |
|
302 | + * @param array|string $asFieldset A field definition array or a string of the target section id. |
|
303 | 303 | * <h4>Built-in Field Types</h4> |
304 | 304 | * <ul> |
305 | 305 | * <li>**text** - a normal field to enter text input.</li> |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | */ |
170 | 170 | public function addSettingSections( /* $aSection1, $aSection2=null, $_and_more=null */ ) { |
171 | 171 | |
172 | - foreach( func_get_args() as $_asSectionset ) { |
|
172 | + foreach( func_get_args() as $_asSectionset ) { |
|
173 | 173 | $this->addSettingSection( $_asSectionset ); |
174 | 174 | } |
175 | 175 | |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | */ |
239 | 239 | public function addSettingSection( $aSectionset ) { |
240 | 240 | |
241 | - if ( ! is_array( $aSectionset ) ) { |
|
241 | + if ( ! is_array( $aSectionset ) ) { |
|
242 | 242 | return; |
243 | 243 | } |
244 | 244 | |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | * @return void |
272 | 272 | */ |
273 | 273 | public function addSettingFields( /* $aField1, $aField2=null, $_and_more=null */ ) { |
274 | - foreach( func_get_args() as $_aFieldset ) { |
|
274 | + foreach( func_get_args() as $_aFieldset ) { |
|
275 | 275 | $this->addSettingField( $_aFieldset ); |
276 | 276 | } |
277 | 277 | } |
@@ -258,18 +258,18 @@ discard block |
||
258 | 258 | } |
259 | 259 | |
260 | 260 | /** |
261 | - * Adds form fields. |
|
262 | - * |
|
263 | - * It inserts the given field definition arrays into the class property and later they are parsed when fields are registered. The field definition array requires specific keys. Refer to the parameter section of this method. |
|
264 | - * |
|
265 | - * @since 2.0.0 |
|
266 | - * @since 3.5.3 Removed the parameter declarations as they are caught with the func_get_args(). |
|
267 | - * @remark Accepts variadic parameters; the number of accepted parameters are not limited to three. |
|
268 | - * @param array the field definition array. |
|
269 | - * @param array (optional) another field array. |
|
270 | - * @param array (optional) add more field arrays to the next parameters as many as necessary. |
|
271 | - * @return void |
|
272 | - */ |
|
261 | + * Adds form fields. |
|
262 | + * |
|
263 | + * It inserts the given field definition arrays into the class property and later they are parsed when fields are registered. The field definition array requires specific keys. Refer to the parameter section of this method. |
|
264 | + * |
|
265 | + * @since 2.0.0 |
|
266 | + * @since 3.5.3 Removed the parameter declarations as they are caught with the func_get_args(). |
|
267 | + * @remark Accepts variadic parameters; the number of accepted parameters are not limited to three. |
|
268 | + * @param array the field definition array. |
|
269 | + * @param array (optional) another field array. |
|
270 | + * @param array (optional) add more field arrays to the next parameters as many as necessary. |
|
271 | + * @return void |
|
272 | + */ |
|
273 | 273 | public function addSettingFields( /* $aField1, $aField2=null, $_and_more=null */ ) { |
274 | 274 | foreach( func_get_args() as $_aFieldset ) { |
275 | 275 | $this->addSettingField( $_aFieldset ); |
@@ -300,248 +300,248 @@ discard block |
||
300 | 300 | * @return void |
301 | 301 | * @remark The $oForm property should be created in each extended class. |
302 | 302 | * @param array|string $asField A field definition array or a string of the target section id. |
303 | - * <h4>Built-in Field Types</h4> |
|
304 | - * <ul> |
|
305 | - * <li>**text** - a normal field to enter text input.</li> |
|
306 | - * <li>**password** - a masked text input field.</li> |
|
307 | - * <li>**textarea** - a text input field with multiple lines. It supports rich text editor.</li> |
|
308 | - * <li>**radio** - a set of radio buttons that lets the user pick an option.</li> |
|
309 | - * <li>**checkbox** - a check box that lets the user enable/disable an item.</li> |
|
310 | - * <li>**select** - a drop-down list that lest the user pick one or more item(s) from a list.</li> |
|
311 | - * <li>**hidden** - a hidden field that will be useful to insert invisible values.</li> |
|
312 | - * <li>**file** - a file uploader that lets the user upload files.</li> |
|
313 | - * <li>**image** - a custom text field with the image uploader script that lets the user set the image URL.</li> |
|
314 | - * <li>**media** - a custom text field with the media uploader script that lets the user set the file URL.</li> |
|
315 | - * <li>**color** - a custom text field with the color picker script.</li> |
|
316 | - * <li>**submit** - a submit button that lets the user send the form.</li> |
|
317 | - * <li>**export** - a custom submit field that lets the user export the stored data.</li> |
|
318 | - * <li>**import** - a custom combination field of the file and the submit fields that let the user import data.</li> |
|
319 | - * <li>**posttype** - a check-list of post types enabled on the site.</li> |
|
320 | - * <li>**taxonomy** - a set of check-lists of taxonomies enabled on the site in a tabbed box.</li> |
|
321 | - * <li>**size** - a combination field of the text and the select fields that let the user set sizes with a selectable unit.</li> |
|
322 | - * <li>**section_title** - [3.0.0+] a text field type that will be placed in the section title so that it lets the user set the section title. Note that only one field with this field type is allowed per a section.</li> |
|
323 | - * <li>**system** - [3.3.0+] a custom textara field that displays the system information including the PHP settings, the framework version, MySQL version etc.</li> |
|
324 | - * </ul> |
|
325 | - * <h4>Field Definition Array</h4> |
|
326 | - * <ul> |
|
327 | - * <li>**field_id** - ( required, string) the field ID. Avoid using non-alphabetic characters except underscore and numbers.</li> |
|
328 | - * <li>**type** - ( required, string) the type of the field. The supported types are listed below.</li> |
|
329 | - * <li>**section_id** - (optional, string) the section ID that the field belongs to. If not set, the internal `_default` section ID will be assigned.</li> |
|
330 | - * <li>**title** - (optional, string) the title of the section.</li> |
|
331 | - * <li>**description** - (optional, string) the description of the field which is inserted into the after the input field tag.</li> |
|
332 | - * <li>**tip** - (optional, string) the tip for the field which is displayed when the mouse is hovered over the field title.</li> |
|
333 | - * <li>**capability** - (optional, string) the <a href="http://codex.wordpress.org/Roles_and_Capabilities">access level</a> of the section. If the page visitor does not have sufficient capability, the section will be invisible to them.</li> |
|
334 | - * <li>**error_message** - (optional, string) the error message to display above the input field.</li> |
|
335 | - * <li>**before_field** - (optional, string) the HTML string to insert before the input field output.</li> |
|
336 | - * <li>**after_field** - (optional, string) the HTML string to insert after the input field output.</li> |
|
337 | - * <li>**if** - (optional, boolean) if the passed value is false, the section will not be registered.</li> |
|
338 | - * <li>**order** - (optional, integer) the order number of the section. The higher the number is, the lower the position it gets.</li> |
|
339 | - * <li>**label** - (optional, string) the text label(s) associated with and displayed along with the input field. Some input types can ignore this key.</li> |
|
340 | - * <li>**default** - (optional, string|array) the default value(s) assigned to the input tag's value attribute.</li> |
|
341 | - * <li>**value** - (optional, string|array) the value(s) assigned to the input tag's `value` attribute to override the default and the stored value.</li> |
|
342 | - * <li>**delimiter** - (optional, string) the HTML string that delimits multiple elements. This is available if the <var>label</var> key is passed as array. It will be enclosed in inline-block elements so the passed HTML string should not contain block elements.</li> |
|
343 | - * <li>**before_input** - (optional, string) the HTML string inserted right before the input tag. It will be enclosed in the <code>label</code> tag so the passed HTML string should not contain block elements.</li> |
|
344 | - * <li>**after_input** - (optional, string) the HTML string inserted right after the input tag. It will be enclosed in the <code>label</code> tag so the passed HTML string should not contain block elements.</li> |
|
345 | - * <li>**label_min_width** - (optional, string) the inline style property of the `min-width` of the label tag for the field. If the unit is not specified, 'px' is applied. Default: `120`. e.g. `100%`</li> |
|
346 | - * <li>**help** - (optional, string) the help description added to the contextual help tab.</li> |
|
347 | - * <li>**help_aside** - (optional, string) the additional help description for the side bar of the contextual help tab.</li> |
|
348 | - * <li>**repeatable** - [3.0.0+] (optional, array|boolean) whether the fields should be repeatable. If it yields true, the plus and the minus buttons appear next to each field that lets the user add/remove the fields. Optionally an setting array can be passed. |
|
349 | - * <h5>Repeatable Fields Setting Array</h5> |
|
350 | - * <ul> |
|
351 | - * <li>**max** - the allowed maximum number of fields to be repeated.</li> |
|
352 | - * <li>**min** - the allowed minimum number of fields to be repeated.</li> |
|
353 | - * </ul> |
|
354 | - * </li> |
|
355 | - * <li>**sortable** - [3.0.0+] (optional, boolean) whether the fields should be sortable. If it yields true, the fields will be enclosed in a draggable box. |
|
356 | - * <li>**attributes** - [3.0.0+] (optional, array) holds key-value pairs representing the attribute and its property. Note that some field types have specific keys in the first dimensions. e.g. `array( 'class' => 'my_custom_class_selector', 'style' => 'background-color:#777', 'size' => 20, )` Every field holds the following nested attribute definition arrays. |
|
357 | - * <ul> |
|
358 | - * <li>**fieldrow** - the `td` tag element containing the field output.</li> |
|
359 | - * <li>**fieldset** - the `fieldset` tag element containing the field output.</li> |
|
360 | - * <li>**fields** - the `div` tag element containing the sub-fields and the main field.</li> |
|
361 | - * <li>**field** - the `div` tag element containing each field.</li> |
|
362 | - * </ul> |
|
363 | - * </li> |
|
364 | - * <li>**show_title_column** - [3.0.0+] (optional, boolean) If true, the field title column will be omitted from the output.</li> |
|
365 | - * <li>**hidden** - [3.0.0+] (optional, boolean) If true, the entire field row output will be invisible with the inline style attribute of `style="display:none"`.</li> |
|
366 | - * <li>**save** - [3.6.0+] (optional, boolean) If `false`, the field value will not be saved. Default: `true`</li> |
|
367 | - * <li>**content** - (optional, string) [3.6.1+] a custom section output.</li> |
|
368 | - * </ul> |
|
369 | - * |
|
370 | - * <h4>Field Type Specific Arguments</h4> |
|
371 | - * <p>Each field type uses specific array arguments.</p> |
|
372 | - * <ul> |
|
373 | - * <li>**text** - a text input field which allows the user to type text.</li> |
|
374 | - * <li>**password** - a password input field which allows the user to type text.</li> |
|
375 | - * <li>**number, range** - HTML5 input field types. Some browsers do not support these.</li> |
|
376 | - * <li>**textarea** - a textarea input field. The following array keys are supported. |
|
377 | - * <ul> |
|
378 | - * <li>**rich** - [2.1.2+] (optional, array) to make it a rich text editor pass a non-empty value. It accept a setting array of the <code>_WP_Editors</code> class defined in the core. |
|
379 | - * For more information, see the argument section of <a href="http://codex.wordpress.org/Function_Reference/wp_editor" target="_blank">this page</a>. |
|
380 | - * </li> |
|
381 | - * </ul> |
|
382 | - * </li> |
|
383 | - * <li>**radio** - a radio button input field.</li> |
|
384 | - * <li>**checkbox** - a check box input field.</li> |
|
385 | - * <ul> |
|
386 | - * <li>**select_all_button** - [3.3.0+] (optional, array) pass `true` to enable the `Select All` button. To set a custom label, set the text such as `__( 'Check All', 'test-domain' )`. Default: `true`.</li> |
|
387 | - * <li>**select_none_button** - [3.3.0+] (optional, array) pass `true` to enable the `Select None` button. To set a custom label, set the text such as `__( 'Check All', 'test-domain' )`. Default: `true`.</li> |
|
388 | - * </ul> |
|
389 | - * <li>**select** - a drop-down input field. |
|
390 | - * <ul> |
|
391 | - * <li>**is_multiple** - (optional, boolean) if this is set to true, the `multiple` attribute will be inserted into the field input tag, which enables the multiple selections for the user.</li> |
|
392 | - * </ul> |
|
393 | - * </li> |
|
394 | - * <li>**size** - a size input field. This is a combination of number and select fields. |
|
395 | - * <ul> |
|
396 | - * <li> |
|
397 | - * **units** - (optional, array) defines the units to show. e.g. `array( 'px' => 'px', '%' => '%', 'em' => 'em' )` |
|
398 | - * Default: `array( 'px' => 'px', '%' => '%', 'em' => 'em', 'ex' => 'ex', 'in' => 'in', 'cm' => 'cm', 'mm' => 'mm', 'pt' => 'pt', 'pc' => 'pc' )` |
|
399 | - * </li> |
|
400 | - * <li>**is_multiple** - (optional, boolean) if this is set to true, the `multiple` attribute will be inserted into the field input tag, which enables the multiple selections for the user.</li> |
|
401 | - * <li>**attributes** - [3.0.0+] (optional, array) The attributes array of this field type has four initial keys: size, unit, optgroup, and option and they have a regular attribute array in each.</li> |
|
402 | - * </ul> |
|
403 | - * </li> |
|
404 | - * <li>**hidden** - a hidden input field.</li> |
|
405 | - * <li>**file** - a file upload input field.</li> |
|
406 | - * <li>**submit** - a submit button input field. |
|
407 | - * <ul> |
|
408 | - * <li>**href** - (optional, string) the url(s) linked to the submit button.</li> |
|
409 | - * <li>**redirect_url** - (optional, string) the url(s) redirected to after submitting the input form.</li> |
|
410 | - * <li>**reset** - [2.1.2+] (optional, boolean|string|array) the option key to delete. Set 1 for the entire option. [3.5.3+] In order to reset a particular field that belongs to a section, set an array representing the dimensional keys such as `array( 'my_sectio_id', 'my_field_id' )`.</li> |
|
411 | - * <li>**email** - [3.3.0+] (optional, array) Coming soon... |
|
412 | - * <ul> |
|
413 | - * <li>**to** - (string|array) the email address to send the email to. For multiple email addressed, set comma delimited items.</li> |
|
414 | - * <li>**subject** - (string|array) the email title.</li> |
|
415 | - * <li>**message** - (string|array) the email body text.</li> |
|
416 | - * <li>**attachments** - (string|array) the file path.</li> |
|
417 | - * <li>**name** - (string|array) the sender name.</li> |
|
418 | - * <li>**from** - (string|array) the sender email.</li> |
|
419 | - * <li>**is_html** - (boolean|array) indicates whether the message should be sent as an html or plain text.</li> |
|
420 | - * </ul> |
|
421 | - * </li> |
|
422 | - * </ul> |
|
423 | - * </li> |
|
424 | - * <li>**import** - an import input field. This is a custom file and submit field. |
|
425 | - * <ul> |
|
426 | - * <li>**option_key** - (optional, string) the option table key to save the importing data.</li> |
|
427 | - * <li>**format** - (optional, string) the import format. json, or array is supported. Default: array</li> |
|
428 | - * <li>**is_merge** - (optional, boolean) [2.0.5+] determines whether the imported data should be merged with the existing options.</li> |
|
429 | - * </ul> |
|
430 | - * </li> |
|
431 | - * <li>**export** - an export input field. This is a custom submit field. |
|
432 | - * <ul> |
|
433 | - * <li>**file_name** - (optional, string) the file name to download.</li> |
|
434 | - * <li>**format** - (optional, string) the format type. array, json, or text is supported. Default: array.</li> |
|
435 | - * <li>**data** - (optional, string|array|object ) the data to export.</li> |
|
436 | - * </ul> |
|
437 | - * </li> |
|
438 | - * <li>**image** - an image input field. This is a custom text field with an attached JavaScript script. |
|
439 | - * <ul> |
|
440 | - * <li>**show_preview** - (optional, boolean) if this is set to false, the image preview will be disabled.</li> |
|
441 | - * <li>**attributes_to_store** - [2.1.3+] (optional, array) the array of the attribute names of the image to save. If this is set, the field will be an array with the specified attributes. The supported attributes are, 'title', 'alt', 'width', 'height', 'caption', 'id', 'align', and 'link'. Note that for external URLs, ID will not be captured. e.g. `'attributes_to_store' => array( 'id', 'caption', 'description' )`</li> |
|
442 | - * <li>**allow_external_source** - [2.1.3+] (optional, boolean) whether external URL can be set via the uploader.</li> |
|
443 | - * <li>**attributes** - [3.0.0+] (optional, array) The attributes array of this field type has three keys: input, button, and preview and they have a regular attribute array in each.</li> |
|
444 | - * </ul> |
|
445 | - * </li> |
|
446 | - * <li>**media** - [2.1.3+] a media input field. This is a custom text field with an attached JavaScript script. |
|
447 | - * <ul> |
|
448 | - * <li>**attributes_to_store** - [2.1.3+] (optional, array) the array of the attribute names of the image to save. If this is set, the field will be an array with the specified attributes. The supported attributes are, 'id', 'caption', and 'description'. Note that for external URLs, ID will not be captured. e.g. `'attributes_to_store' => array( 'id', 'caption', 'description' )`</li> |
|
449 | - * <li>**allow_external_source** - [2.1.3+] (optional, boolean) whether external URL can be set via the uploader.</li> |
|
450 | - * </ul> |
|
451 | - * </li> |
|
452 | - * <li>**color** - a color picker input field. This is a custom text field with a JavaScript script.</li> |
|
453 | - * <li>**taxonomy** - a taxonomy check list. This is a set of check boxes listing a specified taxonomy. This does not accept to create multiple fields by passing an array of labels. |
|
454 | - * <ul> |
|
455 | - * <li>**taxonomy_slugs** - (optional, array) the taxonomy slug to list.</li> |
|
456 | - * <li>**max_width** - (optional, string) the inline style property value of `max-width` of this element. Include the unit such as px, %. Default: 100%</li> |
|
457 | - * <li>**height** - (optional, string) the inline style property value of `height` of this element. Include the unit such as px, %. Default: 250px</li> |
|
458 | - * <li>**select_all_button** - [3.3.0+] (optional, array) pass `true` to enable the `Select All` button. To set a custom label, set the text such as `__( 'Check All', 'test-domain' )`. Default: `true`.</li> |
|
459 | - * <li>**select_none_button** - [3.3.0+] (optional, array) pass `true` to enable the `Select None` button. To set a custom label, set the text such as `__( 'Check All', 'test-domain' )`. Default: `true`.</li> |
|
460 | - * <li>**label_no_term_found** - [3.3.2+] (optional, string) The label to display when no term is found. Default: `No Term Found`.</li> |
|
461 | - * <li>**label_list_title** - [3.3.2+] (optional, string) The heading title string for a term list. Default: `''`. Insert an HTML custom string right before the list starts.</li> |
|
462 | - * <li>**query** - [3.3.2+] (optional, array) the query array to search terms. For more details, see the argument of the [get_terms()](http://codex.wordpress.org/Function_Reference/get_terms#Parameters) function. |
|
463 | - * <ul> |
|
464 | - * <li>child_of - (integer) The parent term ID. All the descendant terms such as child's child term will be listed. default: `0`</li> |
|
465 | - * <li>parent - (integer) The direct parent term ID. Only the first level children will be listed. default: ``</li> |
|
466 | - * <li>orderby - (string) The type of how the term list should be ordered by. Either `ID`, `term_id`, or `name` can be accepted. Default: `name`.</li> |
|
467 | - * <li>order - (string) The order of the list. `ASC` or `DESC`. Default: `ASC`.</li> |
|
468 | - * <li>hide_empty - (boolean) whether to show the terms with no post associated. Default: `false`.</li> |
|
469 | - * <li>hierarchical - (boolean) whether to show the terms as a hierarchical tree. Default: `true`</li> |
|
470 | - * <li>number - (integer) The maximum number of the terms to show. 0 for no limit. Default: `0`.</li> |
|
471 | - * <li>pad_counts - (boolean) whether to sum up the post counts with the child post counts. Default: `false`</li> |
|
472 | - * <li>exclude - (string|array) Comma separated term IDs or an array to exclude from the list. for example `1` will remove the 'Uncategorized' category from the list. </li> |
|
473 | - * <li>exclude_tree - (integer) For more details see [get_terms()](http://codex.wordpress.org/Function_Reference/get_terms#Parameters)..</li> |
|
474 | - * <li>include - (string|array) Comma separated term IDs to include in the list.</li> |
|
475 | - * <li>fields - (string) Default: `all`. For more details see [get_terms()](http://codex.wordpress.org/Function_Reference/get_terms#Parameters).</li> |
|
476 | - * <li>slug - (string) Default: ``. For more details see [get_terms()](http://codex.wordpress.org/Function_Reference/get_terms#Parameters).</li> |
|
477 | - * <li>get - (string) Default ``. For more details see [get_terms()](http://codex.wordpress.org/Function_Reference/get_terms#Parameters).</li> |
|
478 | - * <li>name__like - (string) Default ``. For more details see [get_terms()](http://codex.wordpress.org/Function_Reference/get_terms#Parameters).</li> |
|
479 | - * <li>description__like - (string) Default ``. For more details see [get_terms()](http://codex.wordpress.org/Function_Reference/get_terms#Parameters).</li> |
|
480 | - * <li>offset - (integer) Default ``. For more details see [get_terms()](http://codex.wordpress.org/Function_Reference/get_terms#Parameters).</li> |
|
481 | - * <li>search - (string) The search keyword to get the term with. Default ``.</li> |
|
482 | - * <li>cache_domain - (string) Default:`core`. For more details see [get_terms()](http://codex.wordpress.org/Function_Reference/get_terms#Parameters).</li> |
|
483 | - * </ul> |
|
484 | - * </li> |
|
485 | - * <li>**queries** - [3.3.2+] (optional, array) Allows to set a query argument for each taxonomy. The array key must be the taxonomy slug and the value is the query argument array.</li> |
|
486 | - * </ul> |
|
487 | - * <h4>Example</h4> |
|
488 | - * <pre><code>array( |
|
489 | - * 'field_id' => 'taxonomy_custom_queries', |
|
490 | - * 'title' => __( 'Custom Taxonomy Queries', 'admin-page-framework-demo' ), |
|
491 | - * 'type' => 'taxonomy', |
|
492 | - * 'description' => |
|
493 | - * array( |
|
494 | - * __( 'With the <code>query</code> argument array, you can customize how the terms should be retrieved.', 'admin-page-framework-demo' ), |
|
495 | - * sprintf( __( 'For the structure and the array key specifications, refer to the parameter section of the <a href="%1$s" target="_blank">get_term()</a> function.', 'admin-page-framework-demo' ), 'http://codex.wordpress.org/Function_Reference/get_terms#Parameters' ), |
|
496 | - * ), |
|
497 | - * |
|
498 | - * // (required) Determines which taxonomies should be listed |
|
499 | - * 'taxonomy_slugs' => $aTaxnomies = get_taxonomies( '', 'names' ), |
|
500 | - * |
|
501 | - * // (optional) This defines the default query argument. For the structure and supported arguments, see http://codex.wordpress.org/Function_Reference/get_terms#Parameters |
|
502 | - * 'query' => array( |
|
503 | - * 'depth' => 2, |
|
504 | - * 'orderby' => 'term_id', // accepts 'ID', 'term_id', or 'name' |
|
505 | - * 'order' => 'DESC', |
|
506 | - * // 'exclude' => '1', // removes the 'Uncategorized' category. |
|
507 | - * // 'search' => 'PHP', // the search keyward |
|
508 | - * // 'parent' => 9, // only show terms whose direct parent ID is 9. |
|
509 | - * // 'child_of' => 8, // only show child terms of the term ID of 8. |
|
510 | - * ), |
|
511 | - * // (optional) This allows to set a query argument for each taxonomy. |
|
512 | - * // Note that each element will be merged with the above default 'query' argument array. |
|
513 | - * // So unset keys here will be overridden by the default argument array above. |
|
514 | - * 'queries' => array( |
|
515 | - * // taxonomy slug => query argument array |
|
516 | - * 'category' => array( |
|
517 | - * 'depth' => 2, |
|
518 | - * 'orderby' => 'term_id', |
|
519 | - * 'order' => 'DESC', |
|
520 | - * 'exclude' => array( 1 ), |
|
521 | - * ), |
|
522 | - * 'post_tag' => array( |
|
523 | - * 'orderby' => 'name', |
|
524 | - * 'order' => 'ASC', |
|
525 | - * // 'include' => array( 4, ), // term ids |
|
526 | - * ), |
|
527 | - * ), |
|
528 | - * ), |
|
529 | - * </code></pre> |
|
530 | - * </li> |
|
531 | - * <li>**posttype** - a post-type check list. This is a set of check boxes listing post type slugs. |
|
532 | - * <ul> |
|
533 | - * <li>**slugs_to_remove** - (optional, array) the post type slugs not to be listed. e.g.`array( 'revision', 'attachment', 'nav_menu_item' )`</li> |
|
534 | - * <li>**select_all_button** - [3.3.0+] (optional, array) pass `true` to enable the `Select All` button. To set a custom label, set the text such as `__( 'Check All', 'test-domain' )`. Default: `true`.</li> |
|
535 | - * <li>**select_none_button** - [3.3.0+] (optional, array) pass `true` to enable the `Select None` button. To set a custom label, set the text such as `__( 'Check All', 'test-domain' )`. Default: `true`.</li> |
|
536 | - * </ul> |
|
537 | - * </li> |
|
538 | - * <li>**system** - [3.3.0+] a custom textara field that displays system information. |
|
539 | - * <ul> |
|
540 | - * <li>**data** - (optional, array) an associative array ta that holds the data to display.</li> |
|
541 | - * <li>**print_type** - [3.3.6+] (optional, integer) Indicates how the data array should be displayed. 1: readable array representation. 2. the output of the print_r() function. Default: `1`.</li> |
|
542 | - * </ul> |
|
543 | - * </li> |
|
544 | - * </ul> |
|
303 | + * <h4>Built-in Field Types</h4> |
|
304 | + * <ul> |
|
305 | + * <li>**text** - a normal field to enter text input.</li> |
|
306 | + * <li>**password** - a masked text input field.</li> |
|
307 | + * <li>**textarea** - a text input field with multiple lines. It supports rich text editor.</li> |
|
308 | + * <li>**radio** - a set of radio buttons that lets the user pick an option.</li> |
|
309 | + * <li>**checkbox** - a check box that lets the user enable/disable an item.</li> |
|
310 | + * <li>**select** - a drop-down list that lest the user pick one or more item(s) from a list.</li> |
|
311 | + * <li>**hidden** - a hidden field that will be useful to insert invisible values.</li> |
|
312 | + * <li>**file** - a file uploader that lets the user upload files.</li> |
|
313 | + * <li>**image** - a custom text field with the image uploader script that lets the user set the image URL.</li> |
|
314 | + * <li>**media** - a custom text field with the media uploader script that lets the user set the file URL.</li> |
|
315 | + * <li>**color** - a custom text field with the color picker script.</li> |
|
316 | + * <li>**submit** - a submit button that lets the user send the form.</li> |
|
317 | + * <li>**export** - a custom submit field that lets the user export the stored data.</li> |
|
318 | + * <li>**import** - a custom combination field of the file and the submit fields that let the user import data.</li> |
|
319 | + * <li>**posttype** - a check-list of post types enabled on the site.</li> |
|
320 | + * <li>**taxonomy** - a set of check-lists of taxonomies enabled on the site in a tabbed box.</li> |
|
321 | + * <li>**size** - a combination field of the text and the select fields that let the user set sizes with a selectable unit.</li> |
|
322 | + * <li>**section_title** - [3.0.0+] a text field type that will be placed in the section title so that it lets the user set the section title. Note that only one field with this field type is allowed per a section.</li> |
|
323 | + * <li>**system** - [3.3.0+] a custom textara field that displays the system information including the PHP settings, the framework version, MySQL version etc.</li> |
|
324 | + * </ul> |
|
325 | + * <h4>Field Definition Array</h4> |
|
326 | + * <ul> |
|
327 | + * <li>**field_id** - ( required, string) the field ID. Avoid using non-alphabetic characters except underscore and numbers.</li> |
|
328 | + * <li>**type** - ( required, string) the type of the field. The supported types are listed below.</li> |
|
329 | + * <li>**section_id** - (optional, string) the section ID that the field belongs to. If not set, the internal `_default` section ID will be assigned.</li> |
|
330 | + * <li>**title** - (optional, string) the title of the section.</li> |
|
331 | + * <li>**description** - (optional, string) the description of the field which is inserted into the after the input field tag.</li> |
|
332 | + * <li>**tip** - (optional, string) the tip for the field which is displayed when the mouse is hovered over the field title.</li> |
|
333 | + * <li>**capability** - (optional, string) the <a href="http://codex.wordpress.org/Roles_and_Capabilities">access level</a> of the section. If the page visitor does not have sufficient capability, the section will be invisible to them.</li> |
|
334 | + * <li>**error_message** - (optional, string) the error message to display above the input field.</li> |
|
335 | + * <li>**before_field** - (optional, string) the HTML string to insert before the input field output.</li> |
|
336 | + * <li>**after_field** - (optional, string) the HTML string to insert after the input field output.</li> |
|
337 | + * <li>**if** - (optional, boolean) if the passed value is false, the section will not be registered.</li> |
|
338 | + * <li>**order** - (optional, integer) the order number of the section. The higher the number is, the lower the position it gets.</li> |
|
339 | + * <li>**label** - (optional, string) the text label(s) associated with and displayed along with the input field. Some input types can ignore this key.</li> |
|
340 | + * <li>**default** - (optional, string|array) the default value(s) assigned to the input tag's value attribute.</li> |
|
341 | + * <li>**value** - (optional, string|array) the value(s) assigned to the input tag's `value` attribute to override the default and the stored value.</li> |
|
342 | + * <li>**delimiter** - (optional, string) the HTML string that delimits multiple elements. This is available if the <var>label</var> key is passed as array. It will be enclosed in inline-block elements so the passed HTML string should not contain block elements.</li> |
|
343 | + * <li>**before_input** - (optional, string) the HTML string inserted right before the input tag. It will be enclosed in the <code>label</code> tag so the passed HTML string should not contain block elements.</li> |
|
344 | + * <li>**after_input** - (optional, string) the HTML string inserted right after the input tag. It will be enclosed in the <code>label</code> tag so the passed HTML string should not contain block elements.</li> |
|
345 | + * <li>**label_min_width** - (optional, string) the inline style property of the `min-width` of the label tag for the field. If the unit is not specified, 'px' is applied. Default: `120`. e.g. `100%`</li> |
|
346 | + * <li>**help** - (optional, string) the help description added to the contextual help tab.</li> |
|
347 | + * <li>**help_aside** - (optional, string) the additional help description for the side bar of the contextual help tab.</li> |
|
348 | + * <li>**repeatable** - [3.0.0+] (optional, array|boolean) whether the fields should be repeatable. If it yields true, the plus and the minus buttons appear next to each field that lets the user add/remove the fields. Optionally an setting array can be passed. |
|
349 | + * <h5>Repeatable Fields Setting Array</h5> |
|
350 | + * <ul> |
|
351 | + * <li>**max** - the allowed maximum number of fields to be repeated.</li> |
|
352 | + * <li>**min** - the allowed minimum number of fields to be repeated.</li> |
|
353 | + * </ul> |
|
354 | + * </li> |
|
355 | + * <li>**sortable** - [3.0.0+] (optional, boolean) whether the fields should be sortable. If it yields true, the fields will be enclosed in a draggable box. |
|
356 | + * <li>**attributes** - [3.0.0+] (optional, array) holds key-value pairs representing the attribute and its property. Note that some field types have specific keys in the first dimensions. e.g. `array( 'class' => 'my_custom_class_selector', 'style' => 'background-color:#777', 'size' => 20, )` Every field holds the following nested attribute definition arrays. |
|
357 | + * <ul> |
|
358 | + * <li>**fieldrow** - the `td` tag element containing the field output.</li> |
|
359 | + * <li>**fieldset** - the `fieldset` tag element containing the field output.</li> |
|
360 | + * <li>**fields** - the `div` tag element containing the sub-fields and the main field.</li> |
|
361 | + * <li>**field** - the `div` tag element containing each field.</li> |
|
362 | + * </ul> |
|
363 | + * </li> |
|
364 | + * <li>**show_title_column** - [3.0.0+] (optional, boolean) If true, the field title column will be omitted from the output.</li> |
|
365 | + * <li>**hidden** - [3.0.0+] (optional, boolean) If true, the entire field row output will be invisible with the inline style attribute of `style="display:none"`.</li> |
|
366 | + * <li>**save** - [3.6.0+] (optional, boolean) If `false`, the field value will not be saved. Default: `true`</li> |
|
367 | + * <li>**content** - (optional, string) [3.6.1+] a custom section output.</li> |
|
368 | + * </ul> |
|
369 | + * |
|
370 | + * <h4>Field Type Specific Arguments</h4> |
|
371 | + * <p>Each field type uses specific array arguments.</p> |
|
372 | + * <ul> |
|
373 | + * <li>**text** - a text input field which allows the user to type text.</li> |
|
374 | + * <li>**password** - a password input field which allows the user to type text.</li> |
|
375 | + * <li>**number, range** - HTML5 input field types. Some browsers do not support these.</li> |
|
376 | + * <li>**textarea** - a textarea input field. The following array keys are supported. |
|
377 | + * <ul> |
|
378 | + * <li>**rich** - [2.1.2+] (optional, array) to make it a rich text editor pass a non-empty value. It accept a setting array of the <code>_WP_Editors</code> class defined in the core. |
|
379 | + * For more information, see the argument section of <a href="http://codex.wordpress.org/Function_Reference/wp_editor" target="_blank">this page</a>. |
|
380 | + * </li> |
|
381 | + * </ul> |
|
382 | + * </li> |
|
383 | + * <li>**radio** - a radio button input field.</li> |
|
384 | + * <li>**checkbox** - a check box input field.</li> |
|
385 | + * <ul> |
|
386 | + * <li>**select_all_button** - [3.3.0+] (optional, array) pass `true` to enable the `Select All` button. To set a custom label, set the text such as `__( 'Check All', 'test-domain' )`. Default: `true`.</li> |
|
387 | + * <li>**select_none_button** - [3.3.0+] (optional, array) pass `true` to enable the `Select None` button. To set a custom label, set the text such as `__( 'Check All', 'test-domain' )`. Default: `true`.</li> |
|
388 | + * </ul> |
|
389 | + * <li>**select** - a drop-down input field. |
|
390 | + * <ul> |
|
391 | + * <li>**is_multiple** - (optional, boolean) if this is set to true, the `multiple` attribute will be inserted into the field input tag, which enables the multiple selections for the user.</li> |
|
392 | + * </ul> |
|
393 | + * </li> |
|
394 | + * <li>**size** - a size input field. This is a combination of number and select fields. |
|
395 | + * <ul> |
|
396 | + * <li> |
|
397 | + * **units** - (optional, array) defines the units to show. e.g. `array( 'px' => 'px', '%' => '%', 'em' => 'em' )` |
|
398 | + * Default: `array( 'px' => 'px', '%' => '%', 'em' => 'em', 'ex' => 'ex', 'in' => 'in', 'cm' => 'cm', 'mm' => 'mm', 'pt' => 'pt', 'pc' => 'pc' )` |
|
399 | + * </li> |
|
400 | + * <li>**is_multiple** - (optional, boolean) if this is set to true, the `multiple` attribute will be inserted into the field input tag, which enables the multiple selections for the user.</li> |
|
401 | + * <li>**attributes** - [3.0.0+] (optional, array) The attributes array of this field type has four initial keys: size, unit, optgroup, and option and they have a regular attribute array in each.</li> |
|
402 | + * </ul> |
|
403 | + * </li> |
|
404 | + * <li>**hidden** - a hidden input field.</li> |
|
405 | + * <li>**file** - a file upload input field.</li> |
|
406 | + * <li>**submit** - a submit button input field. |
|
407 | + * <ul> |
|
408 | + * <li>**href** - (optional, string) the url(s) linked to the submit button.</li> |
|
409 | + * <li>**redirect_url** - (optional, string) the url(s) redirected to after submitting the input form.</li> |
|
410 | + * <li>**reset** - [2.1.2+] (optional, boolean|string|array) the option key to delete. Set 1 for the entire option. [3.5.3+] In order to reset a particular field that belongs to a section, set an array representing the dimensional keys such as `array( 'my_sectio_id', 'my_field_id' )`.</li> |
|
411 | + * <li>**email** - [3.3.0+] (optional, array) Coming soon... |
|
412 | + * <ul> |
|
413 | + * <li>**to** - (string|array) the email address to send the email to. For multiple email addressed, set comma delimited items.</li> |
|
414 | + * <li>**subject** - (string|array) the email title.</li> |
|
415 | + * <li>**message** - (string|array) the email body text.</li> |
|
416 | + * <li>**attachments** - (string|array) the file path.</li> |
|
417 | + * <li>**name** - (string|array) the sender name.</li> |
|
418 | + * <li>**from** - (string|array) the sender email.</li> |
|
419 | + * <li>**is_html** - (boolean|array) indicates whether the message should be sent as an html or plain text.</li> |
|
420 | + * </ul> |
|
421 | + * </li> |
|
422 | + * </ul> |
|
423 | + * </li> |
|
424 | + * <li>**import** - an import input field. This is a custom file and submit field. |
|
425 | + * <ul> |
|
426 | + * <li>**option_key** - (optional, string) the option table key to save the importing data.</li> |
|
427 | + * <li>**format** - (optional, string) the import format. json, or array is supported. Default: array</li> |
|
428 | + * <li>**is_merge** - (optional, boolean) [2.0.5+] determines whether the imported data should be merged with the existing options.</li> |
|
429 | + * </ul> |
|
430 | + * </li> |
|
431 | + * <li>**export** - an export input field. This is a custom submit field. |
|
432 | + * <ul> |
|
433 | + * <li>**file_name** - (optional, string) the file name to download.</li> |
|
434 | + * <li>**format** - (optional, string) the format type. array, json, or text is supported. Default: array.</li> |
|
435 | + * <li>**data** - (optional, string|array|object ) the data to export.</li> |
|
436 | + * </ul> |
|
437 | + * </li> |
|
438 | + * <li>**image** - an image input field. This is a custom text field with an attached JavaScript script. |
|
439 | + * <ul> |
|
440 | + * <li>**show_preview** - (optional, boolean) if this is set to false, the image preview will be disabled.</li> |
|
441 | + * <li>**attributes_to_store** - [2.1.3+] (optional, array) the array of the attribute names of the image to save. If this is set, the field will be an array with the specified attributes. The supported attributes are, 'title', 'alt', 'width', 'height', 'caption', 'id', 'align', and 'link'. Note that for external URLs, ID will not be captured. e.g. `'attributes_to_store' => array( 'id', 'caption', 'description' )`</li> |
|
442 | + * <li>**allow_external_source** - [2.1.3+] (optional, boolean) whether external URL can be set via the uploader.</li> |
|
443 | + * <li>**attributes** - [3.0.0+] (optional, array) The attributes array of this field type has three keys: input, button, and preview and they have a regular attribute array in each.</li> |
|
444 | + * </ul> |
|
445 | + * </li> |
|
446 | + * <li>**media** - [2.1.3+] a media input field. This is a custom text field with an attached JavaScript script. |
|
447 | + * <ul> |
|
448 | + * <li>**attributes_to_store** - [2.1.3+] (optional, array) the array of the attribute names of the image to save. If this is set, the field will be an array with the specified attributes. The supported attributes are, 'id', 'caption', and 'description'. Note that for external URLs, ID will not be captured. e.g. `'attributes_to_store' => array( 'id', 'caption', 'description' )`</li> |
|
449 | + * <li>**allow_external_source** - [2.1.3+] (optional, boolean) whether external URL can be set via the uploader.</li> |
|
450 | + * </ul> |
|
451 | + * </li> |
|
452 | + * <li>**color** - a color picker input field. This is a custom text field with a JavaScript script.</li> |
|
453 | + * <li>**taxonomy** - a taxonomy check list. This is a set of check boxes listing a specified taxonomy. This does not accept to create multiple fields by passing an array of labels. |
|
454 | + * <ul> |
|
455 | + * <li>**taxonomy_slugs** - (optional, array) the taxonomy slug to list.</li> |
|
456 | + * <li>**max_width** - (optional, string) the inline style property value of `max-width` of this element. Include the unit such as px, %. Default: 100%</li> |
|
457 | + * <li>**height** - (optional, string) the inline style property value of `height` of this element. Include the unit such as px, %. Default: 250px</li> |
|
458 | + * <li>**select_all_button** - [3.3.0+] (optional, array) pass `true` to enable the `Select All` button. To set a custom label, set the text such as `__( 'Check All', 'test-domain' )`. Default: `true`.</li> |
|
459 | + * <li>**select_none_button** - [3.3.0+] (optional, array) pass `true` to enable the `Select None` button. To set a custom label, set the text such as `__( 'Check All', 'test-domain' )`. Default: `true`.</li> |
|
460 | + * <li>**label_no_term_found** - [3.3.2+] (optional, string) The label to display when no term is found. Default: `No Term Found`.</li> |
|
461 | + * <li>**label_list_title** - [3.3.2+] (optional, string) The heading title string for a term list. Default: `''`. Insert an HTML custom string right before the list starts.</li> |
|
462 | + * <li>**query** - [3.3.2+] (optional, array) the query array to search terms. For more details, see the argument of the [get_terms()](http://codex.wordpress.org/Function_Reference/get_terms#Parameters) function. |
|
463 | + * <ul> |
|
464 | + * <li>child_of - (integer) The parent term ID. All the descendant terms such as child's child term will be listed. default: `0`</li> |
|
465 | + * <li>parent - (integer) The direct parent term ID. Only the first level children will be listed. default: ``</li> |
|
466 | + * <li>orderby - (string) The type of how the term list should be ordered by. Either `ID`, `term_id`, or `name` can be accepted. Default: `name`.</li> |
|
467 | + * <li>order - (string) The order of the list. `ASC` or `DESC`. Default: `ASC`.</li> |
|
468 | + * <li>hide_empty - (boolean) whether to show the terms with no post associated. Default: `false`.</li> |
|
469 | + * <li>hierarchical - (boolean) whether to show the terms as a hierarchical tree. Default: `true`</li> |
|
470 | + * <li>number - (integer) The maximum number of the terms to show. 0 for no limit. Default: `0`.</li> |
|
471 | + * <li>pad_counts - (boolean) whether to sum up the post counts with the child post counts. Default: `false`</li> |
|
472 | + * <li>exclude - (string|array) Comma separated term IDs or an array to exclude from the list. for example `1` will remove the 'Uncategorized' category from the list. </li> |
|
473 | + * <li>exclude_tree - (integer) For more details see [get_terms()](http://codex.wordpress.org/Function_Reference/get_terms#Parameters)..</li> |
|
474 | + * <li>include - (string|array) Comma separated term IDs to include in the list.</li> |
|
475 | + * <li>fields - (string) Default: `all`. For more details see [get_terms()](http://codex.wordpress.org/Function_Reference/get_terms#Parameters).</li> |
|
476 | + * <li>slug - (string) Default: ``. For more details see [get_terms()](http://codex.wordpress.org/Function_Reference/get_terms#Parameters).</li> |
|
477 | + * <li>get - (string) Default ``. For more details see [get_terms()](http://codex.wordpress.org/Function_Reference/get_terms#Parameters).</li> |
|
478 | + * <li>name__like - (string) Default ``. For more details see [get_terms()](http://codex.wordpress.org/Function_Reference/get_terms#Parameters).</li> |
|
479 | + * <li>description__like - (string) Default ``. For more details see [get_terms()](http://codex.wordpress.org/Function_Reference/get_terms#Parameters).</li> |
|
480 | + * <li>offset - (integer) Default ``. For more details see [get_terms()](http://codex.wordpress.org/Function_Reference/get_terms#Parameters).</li> |
|
481 | + * <li>search - (string) The search keyword to get the term with. Default ``.</li> |
|
482 | + * <li>cache_domain - (string) Default:`core`. For more details see [get_terms()](http://codex.wordpress.org/Function_Reference/get_terms#Parameters).</li> |
|
483 | + * </ul> |
|
484 | + * </li> |
|
485 | + * <li>**queries** - [3.3.2+] (optional, array) Allows to set a query argument for each taxonomy. The array key must be the taxonomy slug and the value is the query argument array.</li> |
|
486 | + * </ul> |
|
487 | + * <h4>Example</h4> |
|
488 | + * <pre><code>array( |
|
489 | + * 'field_id' => 'taxonomy_custom_queries', |
|
490 | + * 'title' => __( 'Custom Taxonomy Queries', 'admin-page-framework-demo' ), |
|
491 | + * 'type' => 'taxonomy', |
|
492 | + * 'description' => |
|
493 | + * array( |
|
494 | + * __( 'With the <code>query</code> argument array, you can customize how the terms should be retrieved.', 'admin-page-framework-demo' ), |
|
495 | + * sprintf( __( 'For the structure and the array key specifications, refer to the parameter section of the <a href="%1$s" target="_blank">get_term()</a> function.', 'admin-page-framework-demo' ), 'http://codex.wordpress.org/Function_Reference/get_terms#Parameters' ), |
|
496 | + * ), |
|
497 | + * |
|
498 | + * // (required) Determines which taxonomies should be listed |
|
499 | + * 'taxonomy_slugs' => $aTaxnomies = get_taxonomies( '', 'names' ), |
|
500 | + * |
|
501 | + * // (optional) This defines the default query argument. For the structure and supported arguments, see http://codex.wordpress.org/Function_Reference/get_terms#Parameters |
|
502 | + * 'query' => array( |
|
503 | + * 'depth' => 2, |
|
504 | + * 'orderby' => 'term_id', // accepts 'ID', 'term_id', or 'name' |
|
505 | + * 'order' => 'DESC', |
|
506 | + * // 'exclude' => '1', // removes the 'Uncategorized' category. |
|
507 | + * // 'search' => 'PHP', // the search keyward |
|
508 | + * // 'parent' => 9, // only show terms whose direct parent ID is 9. |
|
509 | + * // 'child_of' => 8, // only show child terms of the term ID of 8. |
|
510 | + * ), |
|
511 | + * // (optional) This allows to set a query argument for each taxonomy. |
|
512 | + * // Note that each element will be merged with the above default 'query' argument array. |
|
513 | + * // So unset keys here will be overridden by the default argument array above. |
|
514 | + * 'queries' => array( |
|
515 | + * // taxonomy slug => query argument array |
|
516 | + * 'category' => array( |
|
517 | + * 'depth' => 2, |
|
518 | + * 'orderby' => 'term_id', |
|
519 | + * 'order' => 'DESC', |
|
520 | + * 'exclude' => array( 1 ), |
|
521 | + * ), |
|
522 | + * 'post_tag' => array( |
|
523 | + * 'orderby' => 'name', |
|
524 | + * 'order' => 'ASC', |
|
525 | + * // 'include' => array( 4, ), // term ids |
|
526 | + * ), |
|
527 | + * ), |
|
528 | + * ), |
|
529 | + * </code></pre> |
|
530 | + * </li> |
|
531 | + * <li>**posttype** - a post-type check list. This is a set of check boxes listing post type slugs. |
|
532 | + * <ul> |
|
533 | + * <li>**slugs_to_remove** - (optional, array) the post type slugs not to be listed. e.g.`array( 'revision', 'attachment', 'nav_menu_item' )`</li> |
|
534 | + * <li>**select_all_button** - [3.3.0+] (optional, array) pass `true` to enable the `Select All` button. To set a custom label, set the text such as `__( 'Check All', 'test-domain' )`. Default: `true`.</li> |
|
535 | + * <li>**select_none_button** - [3.3.0+] (optional, array) pass `true` to enable the `Select None` button. To set a custom label, set the text such as `__( 'Check All', 'test-domain' )`. Default: `true`.</li> |
|
536 | + * </ul> |
|
537 | + * </li> |
|
538 | + * <li>**system** - [3.3.0+] a custom textara field that displays system information. |
|
539 | + * <ul> |
|
540 | + * <li>**data** - (optional, array) an associative array ta that holds the data to display.</li> |
|
541 | + * <li>**print_type** - [3.3.6+] (optional, integer) Indicates how the data array should be displayed. 1: readable array representation. 2. the output of the print_r() function. Default: `1`.</li> |
|
542 | + * </ul> |
|
543 | + * </li> |
|
544 | + * </ul> |
|
545 | 545 | */ |
546 | 546 | public function addSettingField( $asFieldset ) { |
547 | 547 | if ( method_exists( $this->oForm, 'addField' ) ) { |
@@ -626,28 +626,28 @@ discard block |
||
626 | 626 | } |
627 | 627 | |
628 | 628 | /** |
629 | - * Sets the given message to be displayed in the next page load. |
|
630 | - * |
|
631 | - * This is used to inform users about the submitted input data, such as "Updated successfully." or "Problem occurred." etc. |
|
632 | - * and normally used in validation callback methods. |
|
633 | - * |
|
634 | - * <h4>Example</h4> |
|
635 | - * ` |
|
636 | - * if ( ! $bVerified ) { |
|
637 | - * $this->setFieldErrors( $aErrors ); |
|
638 | - * $this->setSettingNotice( 'There was an error in your input.' ); |
|
639 | - * return $aOldPageOptions; |
|
640 | - * } |
|
641 | - * ` |
|
642 | - * |
|
643 | - * @since 3.0.4 |
|
644 | - * @access public |
|
645 | - * @param string $sMessage the text message to be displayed. |
|
646 | - * @param string $sType (optional) the type of the message, either "error" or "updated" is used. |
|
647 | - * @param array $asAttributes (optional) the tag attribute array applied to the message container HTML element. If a string is given, it is used as the ID attribute value. |
|
648 | - * @param boolean $bOverride (optional) If true, only one message will be shown in the next page load. false: do not override when there is a message of the same id. true: override the previous one. |
|
649 | - * @return void |
|
650 | - */ |
|
629 | + * Sets the given message to be displayed in the next page load. |
|
630 | + * |
|
631 | + * This is used to inform users about the submitted input data, such as "Updated successfully." or "Problem occurred." etc. |
|
632 | + * and normally used in validation callback methods. |
|
633 | + * |
|
634 | + * <h4>Example</h4> |
|
635 | + * ` |
|
636 | + * if ( ! $bVerified ) { |
|
637 | + * $this->setFieldErrors( $aErrors ); |
|
638 | + * $this->setSettingNotice( 'There was an error in your input.' ); |
|
639 | + * return $aOldPageOptions; |
|
640 | + * } |
|
641 | + * ` |
|
642 | + * |
|
643 | + * @since 3.0.4 |
|
644 | + * @access public |
|
645 | + * @param string $sMessage the text message to be displayed. |
|
646 | + * @param string $sType (optional) the type of the message, either "error" or "updated" is used. |
|
647 | + * @param array $asAttributes (optional) the tag attribute array applied to the message container HTML element. If a string is given, it is used as the ID attribute value. |
|
648 | + * @param boolean $bOverride (optional) If true, only one message will be shown in the next page load. false: do not override when there is a message of the same id. true: override the previous one. |
|
649 | + * @return void |
|
650 | + */ |
|
651 | 651 | public function setSettingNotice( $sMessage, $sType='error', $asAttributes=array(), $bOverride=true ) { |
652 | 652 | $this->oForm->setSubmitNotice( |
653 | 653 | $sMessage, |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * @return array|string |
44 | 44 | * @since DEVVER |
45 | 45 | */ |
46 | - public function getMessage( $sKey='' ) { |
|
46 | + public function getMessage( $sKey = '' ) { |
|
47 | 47 | return $this->oMsg->get( $sKey ); |
48 | 48 | } |
49 | 49 | |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | * @return array The array holing the queued items. |
64 | 64 | * @internal |
65 | 65 | */ |
66 | - public function enqueueStyles( $aSRCs, $_vArg2=null ) {} |
|
66 | + public function enqueueStyles( $aSRCs, $_vArg2 = null ) {} |
|
67 | 67 | |
68 | 68 | /** |
69 | 69 | * Enqueues a style of the given source. |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | * @return string The style handle ID. If the passed url is not a valid url string, an empty string will be returned. |
84 | 84 | * @internal |
85 | 85 | */ |
86 | - public function enqueueStyle( $sSRC, $_vArg2=null ) {} |
|
86 | + public function enqueueStyle( $sSRC, $_vArg2 = null ) {} |
|
87 | 87 | |
88 | 88 | /** |
89 | 89 | * Enqueues scripts by the given sources. |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | * @return array The array holding the queued items. |
105 | 105 | * @internal |
106 | 106 | */ |
107 | - public function enqueueScripts( $aSRCs, $_vArg2=null ) {} |
|
107 | + public function enqueueScripts( $aSRCs, $_vArg2 = null ) {} |
|
108 | 108 | /** |
109 | 109 | * Enqueues a script by the given source. |
110 | 110 | * |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | * @return string The script handle ID. If the passed url is not a valid url string, an empty string will be returned. |
137 | 137 | * @internal |
138 | 138 | */ |
139 | - public function enqueueScript( $sSRC, $_vArg2=null ) {} |
|
139 | + public function enqueueScript( $sSRC, $_vArg2 = null ) {} |
|
140 | 140 | |
141 | 141 | /* |
142 | 142 | * Help Pane |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | * @since 2.1.0 |
155 | 155 | * @remark This method just adds the given text into the class property. The actual registration will be performed with the `replyToRegisterHelpTabTextForMetaBox()` method. |
156 | 156 | */ |
157 | - public function addHelpText( $sHTMLContent, $sHTMLSidebarContent="" ) { |
|
157 | + public function addHelpText( $sHTMLContent, $sHTMLSidebarContent = "" ) { |
|
158 | 158 | if ( method_exists( $this->oHelpPane, '_addHelpText' ) ) { |
159 | 159 | $this->oHelpPane->_addHelpText( $sHTMLContent, $sHTMLSidebarContent ); |
160 | 160 | } |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | */ |
191 | 191 | public function addSettingSections( /* $aSection1, $aSection2=null, $_and_more=null */ ) { |
192 | 192 | |
193 | - foreach( func_get_args() as $_asSectionset ) { |
|
193 | + foreach ( func_get_args() as $_asSectionset ) { |
|
194 | 194 | $this->addSettingSection( $_asSectionset ); |
195 | 195 | } |
196 | 196 | |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | */ |
262 | 262 | public function addSettingSection( $aSectionset ) { |
263 | 263 | |
264 | - if ( ! is_array( $aSectionset ) ) { |
|
264 | + if ( !is_array( $aSectionset ) ) { |
|
265 | 265 | return; |
266 | 266 | } |
267 | 267 | |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | * @return void |
295 | 295 | */ |
296 | 296 | public function addSettingFields( /* $aField1, $aField2=null, $_and_more=null */ ) { |
297 | - foreach( func_get_args() as $_aFieldset ) { |
|
297 | + foreach ( func_get_args() as $_aFieldset ) { |
|
298 | 298 | $this->addSettingField( $_aFieldset ); |
299 | 299 | } |
300 | 300 | } |
@@ -671,7 +671,7 @@ discard block |
||
671 | 671 | * @param boolean $bOverride (optional) If true, only one message will be shown in the next page load. false: do not override when there is a message of the same id. true: override the previous one. |
672 | 672 | * @return void |
673 | 673 | */ |
674 | - public function setSettingNotice( $sMessage, $sType='error', $asAttributes=array(), $bOverride=true ) { |
|
674 | + public function setSettingNotice( $sMessage, $sType = 'error', $asAttributes = array(), $bOverride = true ) { |
|
675 | 675 | $this->oForm->setSubmitNotice( |
676 | 676 | $sMessage, |
677 | 677 | $sType, |
@@ -690,7 +690,7 @@ discard block |
||
690 | 690 | * @param string $sType If empty, the method will check if a message exists in all types. Otherwise, it checks the existence of a message of the specified type. |
691 | 691 | * @return boolean True if a setting notice is set; otherwise, false. |
692 | 692 | */ |
693 | - public function hasSettingNotice( $sType='' ) { |
|
693 | + public function hasSettingNotice( $sType = '' ) { |
|
694 | 694 | return $this->oForm->hasSubmitNotice( $sType ); |
695 | 695 | } |
696 | 696 |
@@ -77,6 +77,8 @@ |
||
77 | 77 | } |
78 | 78 | /** |
79 | 79 | * @since 3.6.0 |
80 | + * @param boolean $abCollapsible |
|
81 | + * @param string $sTitle |
|
80 | 82 | * @return array |
81 | 83 | */ |
82 | 84 | private function _getArguments( $abCollapsible, $sTitle, array $aSection ) { |
@@ -114,7 +114,7 @@ |
||
114 | 114 | */ |
115 | 115 | private function _getToggleAllButtonArgument( $sToggleAll, array $aSection ) { |
116 | 116 | |
117 | - if ( ! $aSection[ 'repeatable' ] ) { |
|
117 | + if ( ! $aSection[ 'repeatable' ] ) { |
|
118 | 118 | return $sToggleAll; |
119 | 119 | } |
120 | 120 |
@@ -23,12 +23,12 @@ discard block |
||
23 | 23 | * @since 3.6.0 Moved from `AdminPageFramework_FormDefinition`. |
24 | 24 | */ |
25 | 25 | static public $aStructure = array( |
26 | - 'title' => null, // (string) the section title will be assigned by default in the section formatting method. |
|
27 | - 'is_collapsed' => true, // (boolean) whether it is already collapsed or expanded |
|
28 | - 'toggle_all_button' => null, // (boolean|string|array) the position of where to display the toggle-all button that toggles the folding state of all collapsible sections. Accepts the following values. 'top-right', 'top-left', 'bottom-right', 'bottom-left'. If true is passed, the default 'top-right' will be used. To not to display, do not set any or pass `false` or `null`. |
|
29 | - 'collapse_others_on_expand' => true, // (boolean) whether the other collapsible sections should be folded when the section is unfolded. |
|
30 | - 'container' => 'sections', // (string) the container element that collapsible styling gets applied to. Either 'sections' or 'section' is accepted. |
|
31 | - 'type' => 'box', // DEVVER+ (string) supported types 'box', 'button' Default: `box`. The `button` type is only supported when the `container` argument is `section`. |
|
26 | + 'title' => null, // (string) the section title will be assigned by default in the section formatting method. |
|
27 | + 'is_collapsed' => true, // (boolean) whether it is already collapsed or expanded |
|
28 | + 'toggle_all_button' => null, // (boolean|string|array) the position of where to display the toggle-all button that toggles the folding state of all collapsible sections. Accepts the following values. 'top-right', 'top-left', 'bottom-right', 'bottom-left'. If true is passed, the default 'top-right' will be used. To not to display, do not set any or pass `false` or `null`. |
|
29 | + 'collapse_others_on_expand' => true, // (boolean) whether the other collapsible sections should be folded when the section is unfolded. |
|
30 | + 'container' => 'sections', // (string) the container element that collapsible styling gets applied to. Either 'sections' or 'section' is accepted. |
|
31 | + 'type' => 'box', // DEVVER+ (string) supported types 'box', 'button' Default: `box`. The `button` type is only supported when the `container` argument is `section`. |
|
32 | 32 | ); |
33 | 33 | |
34 | 34 | public $abCollapsible = false; |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | * @remark The framework will not pass this parameter when formatting a section definition array. |
42 | 42 | * It will be passed when the framework is rendering a form table to generate collapsible elements. |
43 | 43 | */ |
44 | - public $aSection = array(); |
|
44 | + public $aSection = array(); |
|
45 | 45 | |
46 | 46 | /** |
47 | 47 | * Sets up properties. |
@@ -84,14 +84,14 @@ discard block |
||
84 | 84 | |
85 | 85 | $_aCollapsible = $this->getAsArray( $this->abCollapsible ) + array( |
86 | 86 | 'title' => $sTitle, |
87 | - ) + self::$aStructure; |
|
87 | + ) + self::$aStructure; |
|
88 | 88 | |
89 | 89 | $_aCollapsible[ 'toggle_all_button' ] = implode( |
90 | 90 | ',', |
91 | 91 | $this->getAsArray( $_aCollapsible[ 'toggle_all_button' ] ) |
92 | 92 | ); |
93 | 93 | |
94 | - if ( ! empty( $aSection ) ) { |
|
94 | + if ( !empty( $aSection ) ) { |
|
95 | 95 | $_aCollapsible[ 'toggle_all_button' ] = $this->_getToggleAllButtonArgument( |
96 | 96 | $_aCollapsible[ 'toggle_all_button' ], |
97 | 97 | $aSection |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | */ |
116 | 116 | private function _getToggleAllButtonArgument( $sToggleAll, array $aSection ) { |
117 | 117 | |
118 | - if ( ! $aSection[ 'repeatable' ] ) { |
|
118 | + if ( !$aSection[ 'repeatable' ] ) { |
|
119 | 119 | return $sToggleAll; |
120 | 120 | } |
121 | 121 | |
@@ -125,13 +125,13 @@ discard block |
||
125 | 125 | } |
126 | 126 | |
127 | 127 | // Disable the toggle all button for middle sub-sections in repeatable sections. |
128 | - if ( ! $aSection[ '_is_first_index' ] && ! $aSection[ '_is_last_index' ] ) { |
|
128 | + if ( !$aSection[ '_is_first_index' ] && !$aSection[ '_is_last_index' ] ) { |
|
129 | 129 | return 0; |
130 | 130 | } |
131 | 131 | |
132 | 132 | $_aToggleAll = $this->getAOrB( |
133 | - true === $sToggleAll || 1 === $sToggleAll, // evaluate |
|
134 | - array( 'top-right', 'bottom-right' ), // if true |
|
133 | + true === $sToggleAll || 1 === $sToggleAll, // evaluate |
|
134 | + array( 'top-right', 'bottom-right' ), // if true |
|
135 | 135 | explode( ',', $sToggleAll ) // if false |
136 | 136 | ); |
137 | 137 | $_aToggleAll = $this->getAOrB( |
@@ -98,6 +98,7 @@ discard block |
||
98 | 98 | * @since DEVVER Moved from `AdminPageFramework_FormDefinition`. Changed the name from `formatFields()`. |
99 | 99 | * Added the `$aSectionsets` parameter. |
100 | 100 | * @retuen array |
101 | + * @param string $sCapability |
|
101 | 102 | */ |
102 | 103 | private function _getFieldsetsFormatted( array $aFieldsets, array $aSectionsets, $sCapability ) { |
103 | 104 | |
@@ -271,6 +272,7 @@ discard block |
||
271 | 272 | * |
272 | 273 | * @since 3.0.0 |
273 | 274 | * @since DEVVER Moved from `AdminPageFramework_FormDefinition`. Changed the name from `formatField()`. |
275 | + * @param integer $iCountOfElements |
|
274 | 276 | * @return array|void An array of formatted field definition array. If required keys are not set, nothing will be returned. |
275 | 277 | */ |
276 | 278 | private function _getFieldsetFormatted( $aFieldset, $aSectionsets, $sCapability, $iCountOfElements, $iSubSectionIndex, $bIsSectionRepeatable, $oCallerObject ) { |
@@ -102,10 +102,10 @@ discard block |
||
102 | 102 | private function _getFieldsetsFormatted( array $aFieldsets, array $aSectionsets, $sCapability ) { |
103 | 103 | |
104 | 104 | $_aNewFieldsets = array(); |
105 | - foreach( $aFieldsets as $_sSectionPath => $_aItems ) { |
|
105 | + foreach ( $aFieldsets as $_sSectionPath => $_aItems ) { |
|
106 | 106 | |
107 | 107 | // If the section is not set, skip. |
108 | - if ( ! isset( $aSectionsets[ $_sSectionPath ] ) ) { |
|
108 | + if ( !isset( $aSectionsets[ $_sSectionPath ] ) ) { |
|
109 | 109 | continue; |
110 | 110 | } |
111 | 111 | |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | $_aItems, |
115 | 115 | $this->getElement( // 3.6.0+ Get the section's capability |
116 | 116 | $aSectionsets, |
117 | - array( $_sSectionPath, 'capability', ), |
|
117 | + array( $_sSectionPath, 'capability',), |
|
118 | 118 | $sCapability |
119 | 119 | ), |
120 | 120 | $aSectionsets |
@@ -175,16 +175,16 @@ discard block |
||
175 | 175 | */ |
176 | 176 | private function _getNormalFieldsetsFormatted( $aItems, $sCapability, $aSectionsets, $_abSectionRepeatable ) { |
177 | 177 | |
178 | - $_aNewItems = array(); |
|
179 | - foreach( $aItems as $_sFieldID => $_aFieldset ) { |
|
178 | + $_aNewItems = array(); |
|
179 | + foreach ( $aItems as $_sFieldID => $_aFieldset ) { |
|
180 | 180 | |
181 | 181 | // Insert the formatted field definition array. The fields count is needed to set each order value. |
182 | - $_aFieldset = $this->_getFieldsetFormatted( |
|
182 | + $_aFieldset = $this->_getFieldsetFormatted( |
|
183 | 183 | $_aFieldset, |
184 | 184 | $aSectionsets, |
185 | 185 | $sCapability, |
186 | 186 | count( $_aNewItems ), // count of elements - zero based |
187 | - null, // sub-section index |
|
187 | + null, // sub-section index |
|
188 | 188 | $_abSectionRepeatable, |
189 | 189 | $this->oCallerForm |
190 | 190 | ); |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | * @return boolean |
204 | 204 | */ |
205 | 205 | private function _isSubSections( $aItems, $_abSectionRepeatable ) { |
206 | - if ( ! empty( $_abSectionRepeatable ) ) { |
|
206 | + if ( !empty( $_abSectionRepeatable ) ) { |
|
207 | 207 | return true; |
208 | 208 | } |
209 | 209 | return ( boolean ) count( $this->getIntegerKeyElements( $aItems ) ); |
@@ -214,9 +214,9 @@ discard block |
||
214 | 214 | private function _getSubSectionsFormatted( $aItems, $sCapability, $aSectionsets, $_abSectionRepeatable ) { |
215 | 215 | |
216 | 216 | $_aNewFieldset = array(); |
217 | - foreach( $this->numerizeElements( $aItems ) as $_iSubSectionIndex => $_aFieldsets ) { |
|
217 | + foreach ( $this->numerizeElements( $aItems ) as $_iSubSectionIndex => $_aFieldsets ) { |
|
218 | 218 | |
219 | - foreach( $_aFieldsets as $_aFieldset ) { |
|
219 | + foreach ( $_aFieldsets as $_aFieldset ) { |
|
220 | 220 | $_iCountElement = count( $this->getElementAsArray( $_aNewFieldset, $_iSubSectionIndex ) ); |
221 | 221 | $_aFieldset = $this->_getFieldsetFormatted( |
222 | 222 | $_aFieldset, |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | if ( empty( $_aFieldset ) ) { |
231 | 231 | continue; |
232 | 232 | } |
233 | - $_aNewFieldset[ $_iSubSectionIndex ][ $_aFieldset['field_id'] ] = $_aFieldset; |
|
233 | + $_aNewFieldset[ $_iSubSectionIndex ][ $_aFieldset[ 'field_id' ] ] = $_aFieldset; |
|
234 | 234 | } |
235 | 235 | uasort( $_aNewFieldset[ $_iSubSectionIndex ], array( $this, 'sortArrayByKey' ) ); |
236 | 236 | |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | } |
258 | 258 | |
259 | 259 | $_aSortedFields = array(); |
260 | - foreach( $aSectionsets as $_sSectionPath => $_aSecitonset ) { |
|
260 | + foreach ( $aSectionsets as $_sSectionPath => $_aSecitonset ) { |
|
261 | 261 | if ( isset( $aFieldsets[ $_sSectionPath ] ) ) { |
262 | 262 | $_aSortedFields[ $_sSectionPath ] = $aFieldsets[ $_sSectionPath ]; |
263 | 263 | } |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | */ |
276 | 276 | private function _getFieldsetFormatted( $aFieldset, $aSectionsets, $sCapability, $iCountOfElements, $iSubSectionIndex, $bIsSectionRepeatable, $oCallerObject ) { |
277 | 277 | |
278 | - if ( ! isset( $aFieldset[ 'field_id' ], $aFieldset[ 'type' ] ) ) { |
|
278 | + if ( !isset( $aFieldset[ 'field_id' ], $aFieldset[ 'type' ] ) ) { |
|
279 | 279 | return; |
280 | 280 | } |
281 | 281 |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | foreach( $aFieldsets as $_sSectionPath => $_aItems ) { |
106 | 106 | |
107 | 107 | // If the section is not set, skip. |
108 | - if ( ! isset( $aSectionsets[ $_sSectionPath ] ) ) { |
|
108 | + if ( ! isset( $aSectionsets[ $_sSectionPath ] ) ) { |
|
109 | 109 | continue; |
110 | 110 | } |
111 | 111 | |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | } |
258 | 258 | |
259 | 259 | $_aSortedFields = array(); |
260 | - foreach( $aSectionsets as $_sSectionPath => $_aSecitonset ) { |
|
260 | + foreach( $aSectionsets as $_sSectionPath => $_aSecitonset ) { |
|
261 | 261 | if ( isset( $aFieldsets[ $_sSectionPath ] ) ) { |
262 | 262 | $_aSortedFields[ $_sSectionPath ] = $aFieldsets[ $_sSectionPath ]; |
263 | 263 | } |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | */ |
276 | 276 | private function _getFieldsetFormatted( $aFieldset, $aSectionsets, $sCapability, $iCountOfElements, $iSubSectionIndex, $bIsSectionRepeatable, $oCallerObject ) { |
277 | 277 | |
278 | - if ( ! isset( $aFieldset[ 'field_id' ], $aFieldset[ 'type' ] ) ) { |
|
278 | + if ( ! isset( $aFieldset[ 'field_id' ], $aFieldset[ 'type' ] ) ) { |
|
279 | 279 | return; |
280 | 280 | } |
281 | 281 |
@@ -30,7 +30,6 @@ |
||
30 | 30 | * Returns the field container attribute array. |
31 | 31 | * |
32 | 32 | * @remark Formatting each sub-field should be performed prior to callign this method. |
33 | - * @param array $aField The (sub-)field definition array. This should have been formatted already. |
|
34 | 33 | * @return array The generated field container attribute array. |
35 | 34 | * @internal |
36 | 35 | * @since 3.5.3 |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | * |
25 | 25 | * @since 3.6.0 |
26 | 26 | */ |
27 | - public $sContext = 'field'; |
|
27 | + public $sContext = 'field'; |
|
28 | 28 | |
29 | 29 | /** |
30 | 30 | * Returns the field container attribute array. |
@@ -41,10 +41,10 @@ discard block |
||
41 | 41 | |
42 | 42 | return array( |
43 | 43 | 'id' => $this->aArguments[ '_field_container_id' ], |
44 | - 'data-type' => $this->aArguments[ 'type' ], // referred by the repeatable field JavaScript script. |
|
44 | + 'data-type' => $this->aArguments[ 'type' ], // referred by the repeatable field JavaScript script. |
|
45 | 45 | // @deprecated 3.6.0 |
46 | 46 | // 'data-id_model' => $this->aArguments[ '_fields_container_id_model' ], // 3.3.1+ |
47 | - 'class' => "admin-page-framework-field admin-page-framework-field-" . $this->aArguments[ 'type' ] |
|
47 | + 'class' => "admin-page-framework-field admin-page-framework-field-".$this->aArguments[ 'type' ] |
|
48 | 48 | . $this->getAOrB( |
49 | 49 | $this->aArguments[ 'attributes' ][ 'disabled' ], |
50 | 50 | ' disabled', |
@@ -60,6 +60,7 @@ |
||
60 | 60 | * |
61 | 61 | * @since 3.1.0 |
62 | 62 | * @since DEVVER Moved from `AdminPageFramework_Form_View___Fieldset`. |
63 | + * @param string $sHeadingMessage |
|
63 | 64 | * @return string The error string message. An empty value if not found. |
64 | 65 | */ |
65 | 66 | private function _getFieldError( $aErrors, $aSectionPath, $aFieldPath, $sHeadingMessage ) { |
@@ -65,7 +65,7 @@ |
||
65 | 65 | private function _getFieldError( $aErrors, $aSectionPath, $aFieldPath, $sHeadingMessage ) { |
66 | 66 | |
67 | 67 | // If this field has a section and the error element is set |
68 | - $_aErrorPath = array_merge( $aSectionPath, $aFieldPath ); |
|
68 | + $_aErrorPath = array_merge( $aSectionPath, $aFieldPath ); |
|
69 | 69 | if ( $this->_hasFieldError( $aErrors, $_aErrorPath ) ) { |
70 | 70 | return "<span class='field-error'>* " |
71 | 71 | . $sHeadingMessage |
@@ -176,6 +176,7 @@ discard block |
||
176 | 176 | * Returns the repeatable fields script. |
177 | 177 | * |
178 | 178 | * @since 2.1.3 |
179 | + * @param string $sFieldsContainerID |
|
179 | 180 | */ |
180 | 181 | protected function _getRepeaterFieldEnablerScript( $sFieldsContainerID, $iFieldCount, $aSettings ) { |
181 | 182 | |
@@ -222,6 +223,7 @@ discard block |
||
222 | 223 | * Returns the sortable fields script. |
223 | 224 | * |
224 | 225 | * @since 3.0.0 |
226 | + * @param string $sFieldsContainerID |
|
225 | 227 | */ |
226 | 228 | protected function _getSortableFieldEnablerScript( $sFieldsContainerID ) { |
227 | 229 |
@@ -189,7 +189,7 @@ |
||
189 | 189 | $_sButtons = |
190 | 190 | "<div class='admin-page-framework-repeatable-field-buttons' {$_sSettingsAttributes} >" |
191 | 191 | . "<a class='repeatable-field-remove-button button-secondary repeatable-field-button button button-small {$_sDashiconMinus}' href='#' title='{$_sRemove}' {$_sVisibility} data-id='{$sFieldsContainerID}'>" |
192 | - . ( $_bDashiconSupported ? '' : '-' ) |
|
192 | + . ( $_bDashiconSupported ? '' : '-' ) |
|
193 | 193 | . "</a>" |
194 | 194 | . "<a class='repeatable-field-add-button button-secondary repeatable-field-button button button-small {$_sDashiconPlus}' href='#' title='{$_sAdd}' data-id='{$sFieldsContainerID}'>" |
195 | 195 | . ( $_bDashiconSupported ? '' : '+' ) |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | self::$_bIsLoadedSScripts_Widget = true; |
160 | 160 | } |
161 | 161 | |
162 | - if ( self::$_bIsLoadedSScripts ) { |
|
162 | + if ( self::$_bIsLoadedSScripts ) { |
|
163 | 163 | return; |
164 | 164 | } |
165 | 165 | self::$_bIsLoadedSScripts = true; |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | * |
224 | 224 | * @since 3.0.0 |
225 | 225 | */ |
226 | - protected function _getSortableFieldEnablerScript( $sFieldsContainerID ) { |
|
226 | + protected function _getSortableFieldEnablerScript( $sFieldsContainerID ) { |
|
227 | 227 | |
228 | 228 | $_sScript = <<<JAVASCRIPTS |
229 | 229 | jQuery( document ).ready( function() { |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * @param object $oMsg An object storing the system messages. |
69 | 69 | * @param array $aCallbacks An array storing the form-field specific callbacks. |
70 | 70 | */ |
71 | - public function __construct( &$aField, $aOptions, $aErrors, &$aFieldTypeDefinitions, &$oMsg, array $aCallbacks=array() ) { |
|
71 | + public function __construct( &$aField, $aOptions, $aErrors, &$aFieldTypeDefinitions, &$oMsg, array $aCallbacks = array() ) { |
|
72 | 72 | |
73 | 73 | // @todo Investigate why the first parameter is passed by reference. |
74 | 74 | |
@@ -79,13 +79,13 @@ discard block |
||
79 | 79 | $this->aErrors = $this->getAsArray( $aErrors ); |
80 | 80 | $this->oMsg = $oMsg; |
81 | 81 | $this->aCallbacks = $aCallbacks + array( |
82 | - 'hfID' => null, // the input id attribute |
|
83 | - 'hfTagID' => null, // the fieldset/field row container id attribute |
|
84 | - 'hfName' => null, // the input name attribute |
|
85 | - 'hfNameFlat' => null, // the flat input name attribute |
|
82 | + 'hfID' => null, // the input id attribute |
|
83 | + 'hfTagID' => null, // the fieldset/field row container id attribute |
|
84 | + 'hfName' => null, // the input name attribute |
|
85 | + 'hfNameFlat' => null, // the flat input name attribute |
|
86 | 86 | 'hfInputName' => null, |
87 | 87 | 'hfInputNameFlat' => null, |
88 | - 'hfClass' => null, // the class attribute |
|
88 | + 'hfClass' => null, // the class attribute |
|
89 | 89 | ); |
90 | 90 | |
91 | 91 | // 2. Load necessary JavaScript scripts. |
@@ -152,9 +152,9 @@ discard block |
||
152 | 152 | * @since 3.2.0 Added the `$sFieldsType` parameter. |
153 | 153 | * @internal |
154 | 154 | */ |
155 | - private function _loadScripts( $sStructureType='' ) { |
|
155 | + private function _loadScripts( $sStructureType = '' ) { |
|
156 | 156 | |
157 | - if ( 'widget' === $sStructureType && ! self::$_bIsLoadedSScripts_Widget ) { |
|
157 | + if ( 'widget' === $sStructureType && !self::$_bIsLoadedSScripts_Widget ) { |
|
158 | 158 | new AdminPageFramework_Form_View___Script_Widget; |
159 | 159 | self::$_bIsLoadedSScripts_Widget = true; |
160 | 160 | } |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | $_sRemove = $this->oMsg->get( 'remove' ); |
184 | 184 | $_sVisibility = $iFieldCount <= 1 ? " style='visibility: hidden;'" : ""; |
185 | 185 | $_sSettingsAttributes = $this->generateDataAttributes( ( array ) $aSettings ); |
186 | - $_bDashiconSupported = false; // version_compare( $GLOBALS['wp_version'], '3.8', '>=' ); |
|
186 | + $_bDashiconSupported = false; // version_compare( $GLOBALS['wp_version'], '3.8', '>=' ); |
|
187 | 187 | $_sDashiconPlus = $_bDashiconSupported ? 'dashicons dashicons-plus' : ''; |
188 | 188 | $_sDashiconMinus = $_bDashiconSupported ? 'dashicons dashicons-minus' : ''; |
189 | 189 | $_sButtons = |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | . "</a>" |
197 | 197 | . "</div>"; |
198 | 198 | $_aJSArray = json_encode( $aSettings ); |
199 | - $_sButtonsHTML = '"' . $_sButtons . '"'; |
|
199 | + $_sButtonsHTML = '"'.$_sButtons.'"'; |
|
200 | 200 | $_sScript = <<<JAVASCRIPTS |
201 | 201 | jQuery( document ).ready( function() { |
202 | 202 | var _nodePositionIndicators = jQuery( '#{$sFieldsContainerID} .admin-page-framework-field .repeatable-field-buttons' ); |
@@ -23,7 +23,6 @@ |
||
23 | 23 | * @internal |
24 | 24 | * @since 3.5.3 |
25 | 25 | * @since 3.6.0 Moved from `AdminPageFramework_FormDefinition`. |
26 | - * @param array $aFieldset a field definition array. |
|
27 | 26 | * @return boolean |
28 | 27 | */ |
29 | 28 | protected function _isSectionSet() { |