@@ -41,19 +41,19 @@ |
||
41 | 41 | protected function getField( $aField ) { |
42 | 42 | |
43 | 43 | return |
44 | - $aField['before_label'] |
|
44 | + $aField[ 'before_label' ] |
|
45 | 45 | . "<div class='admin-page-framework-input-label-container'>" |
46 | - . "<label for='{$aField['input_id']}'>" |
|
47 | - . $aField['before_input'] |
|
48 | - . ( $aField['label'] |
|
49 | - ? "<span class='admin-page-framework-input-label-string' style='min-width:" . $this->sanitizeLength( $aField['label_min_width'] ) . ";'>" . $aField['label'] . "</span>" |
|
46 | + . "<label for='{$aField[ 'input_id' ]}'>" |
|
47 | + . $aField[ 'before_input' ] |
|
48 | + . ( $aField[ 'label' ] |
|
49 | + ? "<span class='admin-page-framework-input-label-string' style='min-width:".$this->sanitizeLength( $aField[ 'label_min_width' ] ).";'>".$aField[ 'label' ]."</span>" |
|
50 | 50 | : "" |
51 | 51 | ) |
52 | - . "<input " . $this->getAttributes( $aField['attributes'] ) . " />" |
|
53 | - . $aField['after_input'] |
|
52 | + . "<input ".$this->getAttributes( $aField[ 'attributes' ] )." />" |
|
53 | + . $aField[ 'after_input' ] |
|
54 | 54 | . "</label>" |
55 | 55 | . "</div>" |
56 | - . $aField['after_label']; |
|
56 | + . $aField[ 'after_label' ]; |
|
57 | 57 | |
58 | 58 | } |
59 | 59 |
@@ -277,7 +277,7 @@ |
||
277 | 277 | ); |
278 | 278 | } |
279 | 279 | |
280 | - /** |
|
280 | + /** |
|
281 | 281 | * Extracts meta box form fields options array from the given options array of an admin page. |
282 | 282 | * |
283 | 283 | * @since 3.5.6 |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | /** |
23 | 23 | * Defines the field type slugs used for this field type. |
24 | 24 | */ |
25 | - public $aFieldTypeSlugs = array( 'image', ); |
|
25 | + public $aFieldTypeSlugs = array( 'image',); |
|
26 | 26 | |
27 | 27 | /** |
28 | 28 | * Defines the default key-values of this field type. |
@@ -31,8 +31,8 @@ discard block |
||
31 | 31 | */ |
32 | 32 | protected $aDefaultKeys = array( |
33 | 33 | 'attributes_to_store' => array(), // ( array ) This is for the image and media field type. The attributes to save besides URL. e.g. ( for the image field type ) array( 'title', 'alt', 'width', 'height', 'caption', 'id', 'align', 'link' ). |
34 | - 'show_preview' => true, // ( boolean ) Indicates whether the image preview should be displayed or not. |
|
35 | - 'allow_external_source' => true, // ( boolean ) Indicates whether the media library box has the From URL tab. |
|
34 | + 'show_preview' => true, // ( boolean ) Indicates whether the image preview should be displayed or not. |
|
35 | + 'allow_external_source' => true, // ( boolean ) Indicates whether the media library box has the From URL tab. |
|
36 | 36 | 'attributes' => array( |
37 | 37 | 'input' => array( |
38 | 38 | 'size' => 40, |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | return // $this->_getScript_CustomMediaUploaderObject() . PHP_EOL |
61 | 61 | $this->_getScript_ImageSelector( |
62 | 62 | "admin_page_framework" |
63 | - ) . PHP_EOL |
|
63 | + ).PHP_EOL |
|
64 | 64 | . $this->_getScript_RegisterCallbacks(); |
65 | 65 | } |
66 | 66 | /** |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | $_sInsertFromURL = esc_js( $this->oMsg->get( 'insert_from_url' ) ); |
184 | 184 | |
185 | 185 | // if the WordPress version is 3.4.x or below |
186 | - if ( ! function_exists( 'wp_enqueue_media' ) ) { |
|
186 | + if ( !function_exists( 'wp_enqueue_media' ) ) { |
|
187 | 187 | |
188 | 188 | return <<<JAVASCRIPTS |
189 | 189 | /** |
@@ -564,22 +564,22 @@ discard block |
||
564 | 564 | |
565 | 565 | // Output |
566 | 566 | return |
567 | - $aField['before_label'] |
|
568 | - . "<div class='admin-page-framework-input-label-container admin-page-framework-input-container {$aField['type']}-field'>" // image-field ( this will be media-field for the media field type ) |
|
569 | - . "<label for='{$aField['input_id']}'>" |
|
570 | - . $aField['before_input'] |
|
567 | + $aField[ 'before_label' ] |
|
568 | + . "<div class='admin-page-framework-input-label-container admin-page-framework-input-container {$aField[ 'type' ]}-field'>" // image-field ( this will be media-field for the media field type ) |
|
569 | + . "<label for='{$aField[ 'input_id' ]}'>" |
|
570 | + . $aField[ 'before_input' ] |
|
571 | 571 | . $this->getAOrB( |
572 | - $aField['label'] && ! $aField['repeatable'], |
|
573 | - "<span class='admin-page-framework-input-label-string' style='min-width:" . $this->sanitizeLength( $aField['label_min_width'] ) . ";'>" . $aField['label'] . "</span>", |
|
572 | + $aField[ 'label' ] && !$aField[ 'repeatable' ], |
|
573 | + "<span class='admin-page-framework-input-label-string' style='min-width:".$this->sanitizeLength( $aField[ 'label_min_width' ] ).";'>".$aField[ 'label' ]."</span>", |
|
574 | 574 | '' |
575 | 575 | ) |
576 | - . "<input " . $this->getAttributes( $this->_getImageInputAttributes( $aField, $_iCountAttributes, $_sImageURL, $_aBaseAttributes ) ) . " />" |
|
577 | - . $aField['after_input'] |
|
576 | + . "<input ".$this->getAttributes( $this->_getImageInputAttributes( $aField, $_iCountAttributes, $_sImageURL, $_aBaseAttributes ) )." />" |
|
577 | + . $aField[ 'after_input' ] |
|
578 | 578 | . "<div class='repeatable-field-buttons'></div>" // the repeatable field buttons will be replaced with this element. |
579 | 579 | . $this->getExtraInputFields( $aField ) |
580 | 580 | . "</label>" |
581 | 581 | . "</div>" |
582 | - . $aField['after_label'] |
|
582 | + . $aField[ 'after_label' ] |
|
583 | 583 | . $this->_getPreviewContainer( |
584 | 584 | $aField, |
585 | 585 | $_sImageURL, |
@@ -588,16 +588,16 @@ discard block |
||
588 | 588 | + $_aBaseAttributes |
589 | 589 | ) |
590 | 590 | . $this->_getRemoveButtonScript( |
591 | - $aField['input_id'], |
|
591 | + $aField[ 'input_id' ], |
|
592 | 592 | // Remove button atributes |
593 | 593 | $this->getElementAsArray( $aField, array( 'attributes', 'remove_button' ) ) |
594 | 594 | + $_aBaseAttributes, |
595 | - $aField['type'] // image |
|
595 | + $aField[ 'type' ] // image |
|
596 | 596 | ) |
597 | 597 | . $this->_getUploaderButtonScript( |
598 | - $aField['input_id'], |
|
599 | - $aField['repeatable'], |
|
600 | - $aField['allow_external_source'], |
|
598 | + $aField[ 'input_id' ], |
|
599 | + $aField[ 'repeatable' ], |
|
600 | + $aField[ 'allow_external_source' ], |
|
601 | 601 | // Uploader button attributes |
602 | 602 | $this->getElementAsArray( $aField, array( 'attributes', 'button' ) ) |
603 | 603 | + $_aBaseAttributes |
@@ -612,15 +612,15 @@ discard block |
||
612 | 612 | */ |
613 | 613 | private function _getBaseAttributes( array $aField ) { |
614 | 614 | |
615 | - $_aBaseAttributes = $aField['attributes'] + array( 'class' => null ); |
|
615 | + $_aBaseAttributes = $aField[ 'attributes' ] + array( 'class' => null ); |
|
616 | 616 | unset( |
617 | - $_aBaseAttributes['input'], |
|
618 | - $_aBaseAttributes['button'], |
|
619 | - $_aBaseAttributes['preview'], |
|
620 | - $_aBaseAttributes['name'], |
|
621 | - $_aBaseAttributes['value'], |
|
622 | - $_aBaseAttributes['type'], |
|
623 | - $_aBaseAttributes['remove_button'] |
|
617 | + $_aBaseAttributes[ 'input' ], |
|
618 | + $_aBaseAttributes[ 'button' ], |
|
619 | + $_aBaseAttributes[ 'preview' ], |
|
620 | + $_aBaseAttributes[ 'name' ], |
|
621 | + $_aBaseAttributes[ 'value' ], |
|
622 | + $_aBaseAttributes[ 'type' ], |
|
623 | + $_aBaseAttributes[ 'remove_button' ] |
|
624 | 624 | ); |
625 | 625 | return $_aBaseAttributes; |
626 | 626 | |
@@ -641,7 +641,7 @@ discard block |
||
641 | 641 | $_sCaptureAttribute = $this->getAOrB( $iCountAttributes, 'url', '' ); |
642 | 642 | return $_sCaptureAttribute |
643 | 643 | ? $this->getElement( $aField, array( 'attributes', 'value', $_sCaptureAttribute ), '' ) |
644 | - : $aField['attributes']['value']; |
|
644 | + : $aField[ 'attributes' ][ 'value' ]; |
|
645 | 645 | |
646 | 646 | |
647 | 647 | } |
@@ -653,15 +653,15 @@ discard block |
||
653 | 653 | private function _getImageInputAttributes( array $aField, $iCountAttributes, $sImageURL, array $aBaseAttributes ) { |
654 | 654 | |
655 | 655 | return array( |
656 | - 'name' => $aField['attributes']['name'] |
|
656 | + 'name' => $aField[ 'attributes' ][ 'name' ] |
|
657 | 657 | . $this->getAOrB( $iCountAttributes, '[url]', '' ), |
658 | 658 | 'value' => $sImageURL, |
659 | 659 | 'type' => 'text', |
660 | 660 | |
661 | 661 | // 3.4.2+ Referenced to bind an input update event to the preview updater script. |
662 | - 'data-show_preview' => $aField['show_preview'], |
|
662 | + 'data-show_preview' => $aField[ 'show_preview' ], |
|
663 | 663 | ) |
664 | - + $aField['attributes']['input'] |
|
664 | + + $aField[ 'attributes' ][ 'input' ] |
|
665 | 665 | + $aBaseAttributes; |
666 | 666 | |
667 | 667 | } |
@@ -678,14 +678,14 @@ discard block |
||
678 | 678 | protected function getExtraInputFields( array $aField ) { |
679 | 679 | |
680 | 680 | $_aOutputs = array(); |
681 | - foreach( $this->getElementAsArray( $aField, 'attributes_to_store' ) as $sAttribute ) { |
|
682 | - $_aOutputs[] = "<input " . $this->getAttributes( |
|
681 | + foreach ( $this->getElementAsArray( $aField, 'attributes_to_store' ) as $sAttribute ) { |
|
682 | + $_aOutputs[ ] = "<input ".$this->getAttributes( |
|
683 | 683 | array( |
684 | - 'id' => "{$aField['input_id']}_{$sAttribute}", |
|
684 | + 'id' => "{$aField[ 'input_id' ]}_{$sAttribute}", |
|
685 | 685 | 'type' => 'hidden', |
686 | - 'name' => "{$aField['_input_name']}[{$sAttribute}]", |
|
686 | + 'name' => "{$aField[ '_input_name' ]}[{$sAttribute}]", |
|
687 | 687 | 'disabled' => $this->getAOrB( |
688 | - isset( $aField['attributes']['disabled'] ) && $aField['attributes']['disabled'], |
|
688 | + isset( $aField[ 'attributes' ][ 'disabled' ] ) && $aField[ 'attributes' ][ 'disabled' ], |
|
689 | 689 | 'disabled', |
690 | 690 | null |
691 | 691 | ), |
@@ -695,7 +695,7 @@ discard block |
||
695 | 695 | '' |
696 | 696 | ), |
697 | 697 | ) |
698 | - ) . "/>"; |
|
698 | + )."/>"; |
|
699 | 699 | } |
700 | 700 | return implode( PHP_EOL, $_aOutputs ); |
701 | 701 | |
@@ -707,21 +707,21 @@ discard block |
||
707 | 707 | */ |
708 | 708 | protected function _getPreviewContainer( $aField, $sImageURL, $aPreviewAtrributes ) { |
709 | 709 | |
710 | - if ( ! $aField['show_preview'] ) { return ''; } |
|
710 | + if ( !$aField[ 'show_preview' ] ) { return ''; } |
|
711 | 711 | |
712 | 712 | $sImageURL = $this->getResolvedSRC( $sImageURL, true ); |
713 | 713 | return |
714 | - "<div " . $this->getAttributes( |
|
714 | + "<div ".$this->getAttributes( |
|
715 | 715 | array( |
716 | - 'id' => "image_preview_container_{$aField['input_id']}", |
|
717 | - 'class' => 'image_preview ' . $this->getElement( $aPreviewAtrributes, 'class', '' ), |
|
718 | - 'style' => $this->getAOrB( $sImageURL, '', "display: none; " ) |
|
716 | + 'id' => "image_preview_container_{$aField[ 'input_id' ]}", |
|
717 | + 'class' => 'image_preview '.$this->getElement( $aPreviewAtrributes, 'class', '' ), |
|
718 | + 'style' => $this->getAOrB( $sImageURL, '', "display: none; " ) |
|
719 | 719 | . $this->getElement( $aPreviewAtrributes, 'style', '' ), |
720 | 720 | ) + $aPreviewAtrributes |
721 | 721 | ) |
722 | 722 | . ">" |
723 | 723 | . "<img src='{$sImageURL}' " |
724 | - . "id='image_preview_{$aField['input_id']}' " |
|
724 | + . "id='image_preview_{$aField[ 'input_id' ]}' " |
|
725 | 725 | . "/>" |
726 | 726 | . "</div>"; |
727 | 727 | |
@@ -740,7 +740,7 @@ discard block |
||
740 | 740 | // Do not include the escaping character (backslash) in the heredoc variable declaration |
741 | 741 | // because the minifier script will parse it and the <<<JAVASCRIPTS and JAVASCRIPTS; parts are converted to double quotes (") |
742 | 742 | // which causes the PHP syntax error. |
743 | - $_sButtonHTML = '"' . $this->_getUploaderButtonHTML( $sInputID, $aButtonAttributes, $bRpeatable, $bExternalSource ) . '"'; |
|
743 | + $_sButtonHTML = '"'.$this->_getUploaderButtonHTML( $sInputID, $aButtonAttributes, $bRpeatable, $bExternalSource ).'"'; |
|
744 | 744 | $_sScript = <<<JAVASCRIPTS |
745 | 745 | if ( 0 === jQuery( 'a#select_image_{$sInputID}' ).length ) { |
746 | 746 | jQuery( 'input#{$sInputID}' ).after( $_sButtonHTML ); |
@@ -752,7 +752,7 @@ discard block |
||
752 | 752 | |
753 | 753 | return "<script type='text/javascript' class='admin-page-framework-image-uploader-button'>" |
754 | 754 | . $_sScript |
755 | - . "</script>". PHP_EOL; |
|
755 | + . "</script>".PHP_EOL; |
|
756 | 756 | |
757 | 757 | } |
758 | 758 | /** |
@@ -762,7 +762,7 @@ discard block |
||
762 | 762 | */ |
763 | 763 | private function _getUploaderButtonHTML( $sInputID, array $aButtonAttributes, $bRpeatable, $bExternalSource ) { |
764 | 764 | |
765 | - $_bIsLabelSet = isset( $aButtonAttributes['data-label'] ) && $aButtonAttributes['data-label']; |
|
765 | + $_bIsLabelSet = isset( $aButtonAttributes[ 'data-label' ] ) && $aButtonAttributes[ 'data-label' ]; |
|
766 | 766 | $_aAttributes = $this->_getFormattedUploadButtonAttributes( |
767 | 767 | $sInputID, |
768 | 768 | $aButtonAttributes, |
@@ -770,10 +770,10 @@ discard block |
||
770 | 770 | $bRpeatable, |
771 | 771 | $bExternalSource |
772 | 772 | ); |
773 | - return "<a " . $this->getAttributes( $_aAttributes ) . ">" |
|
773 | + return "<a ".$this->getAttributes( $_aAttributes ).">" |
|
774 | 774 | . ( $_bIsLabelSet |
775 | - ? $_aAttributes['data-label'] |
|
776 | - : ( strrpos( $_aAttributes['class'], 'dashicons' ) |
|
775 | + ? $_aAttributes[ 'data-label' ] |
|
776 | + : ( strrpos( $_aAttributes[ 'class' ], 'dashicons' ) |
|
777 | 777 | ? '' |
778 | 778 | : $this->oMsg->get( 'select_image' ) |
779 | 779 | ) |
@@ -788,7 +788,7 @@ discard block |
||
788 | 788 | */ |
789 | 789 | private function _getFormattedUploadButtonAttributes( $sInputID, array $aButtonAttributes, $_bIsLabelSet, $bRpeatable, $bExternalSource ) { |
790 | 790 | |
791 | - $_aAttributes = array( |
|
791 | + $_aAttributes = array( |
|
792 | 792 | 'id' => "select_image_{$sInputID}", |
793 | 793 | 'href' => '#', |
794 | 794 | 'data-uploader_type' => ( string ) function_exists( 'wp_enqueue_media' ), |
@@ -797,15 +797,15 @@ discard block |
||
797 | 797 | + $aButtonAttributes |
798 | 798 | + array( |
799 | 799 | 'title' => $_bIsLabelSet |
800 | - ? $aButtonAttributes['data-label'] |
|
800 | + ? $aButtonAttributes[ 'data-label' ] |
|
801 | 801 | : $this->oMsg->get( 'select_image' ), |
802 | 802 | 'data-label' => null, |
803 | 803 | ); |
804 | - $_aAttributes['class'] = $this->getClassAttribute( |
|
804 | + $_aAttributes[ 'class' ] = $this->getClassAttribute( |
|
805 | 805 | 'select_image button button-small ', |
806 | 806 | $this->getAOrB( |
807 | - trim( $aButtonAttributes['class'] ), |
|
808 | - $aButtonAttributes['class'], |
|
807 | + trim( $aButtonAttributes[ 'class' ] ), |
|
808 | + $aButtonAttributes[ 'class' ], |
|
809 | 809 | $this->getAOrB( |
810 | 810 | $_bIsLabelSet, |
811 | 811 | '', |
@@ -828,16 +828,16 @@ discard block |
||
828 | 828 | * @since 3.5.3 Aded the `$sType` parameter. |
829 | 829 | * @return string |
830 | 830 | */ |
831 | - protected function _getRemoveButtonScript( $sInputID, array $aButtonAttributes, $sType='image' ) { |
|
831 | + protected function _getRemoveButtonScript( $sInputID, array $aButtonAttributes, $sType = 'image' ) { |
|
832 | 832 | |
833 | - if ( ! function_exists( 'wp_enqueue_media' ) ) { |
|
833 | + if ( !function_exists( 'wp_enqueue_media' ) ) { |
|
834 | 834 | return ''; |
835 | 835 | } |
836 | 836 | |
837 | 837 | // Do not include the escaping character (backslash) in the heredoc variable declaration |
838 | 838 | // because the minifier script will parse it and the <<<JAVASCRIPTS and JAVASCRIPTS; parts are converted to double quotes (") |
839 | 839 | // which causes the PHP syntax error. |
840 | - $_sButtonHTML = '"' . $this->_getRemoveButtonHTMLByType( $sInputID, $aButtonAttributes, $sType ) . '"'; |
|
840 | + $_sButtonHTML = '"'.$this->_getRemoveButtonHTMLByType( $sInputID, $aButtonAttributes, $sType ).'"'; |
|
841 | 841 | $_sScript = <<<JAVASCRIPTS |
842 | 842 | if ( 0 === jQuery( 'a#remove_{$sType}_{$sInputID}' ).length ) { |
843 | 843 | jQuery( 'input#{$sInputID}' ).after( $_sButtonHTML ); |
@@ -846,7 +846,7 @@ discard block |
||
846 | 846 | |
847 | 847 | return "<script type='text/javascript' class='admin-page-framework-{$sType}-remove-button'>" |
848 | 848 | . $_sScript |
849 | - . "</script>". PHP_EOL; |
|
849 | + . "</script>".PHP_EOL; |
|
850 | 850 | |
851 | 851 | } |
852 | 852 | |
@@ -855,15 +855,15 @@ discard block |
||
855 | 855 | * @since 3.5.3 |
856 | 856 | * @return string The generated HTML remove button output. |
857 | 857 | */ |
858 | - protected function _getRemoveButtonHTMLByType( $sInputID, array $aButtonAttributes, $sType='image' ) { |
|
858 | + protected function _getRemoveButtonHTMLByType( $sInputID, array $aButtonAttributes, $sType = 'image' ) { |
|
859 | 859 | |
860 | - $_bIsLabelSet = isset( $aButtonAttributes['data-label'] ) && $aButtonAttributes['data-label']; |
|
860 | + $_bIsLabelSet = isset( $aButtonAttributes[ 'data-label' ] ) && $aButtonAttributes[ 'data-label' ]; |
|
861 | 861 | $_aAttributes = $this->_getFormattedRemoveButtonAttributesByType( $sInputID, $aButtonAttributes, $_bIsLabelSet, $sType ); |
862 | - return "<a " . $this->getAttributes( $_aAttributes ) . ">" |
|
862 | + return "<a ".$this->getAttributes( $_aAttributes ).">" |
|
863 | 863 | . ( $_bIsLabelSet |
864 | - ? $_aAttributes['data-label'] |
|
864 | + ? $_aAttributes[ 'data-label' ] |
|
865 | 865 | : $this->getAOrB( |
866 | - strrpos( $_aAttributes['class'], 'dashicons' ), |
|
866 | + strrpos( $_aAttributes[ 'class' ], 'dashicons' ), |
|
867 | 867 | '', |
868 | 868 | 'x' |
869 | 869 | ) |
@@ -877,9 +877,9 @@ discard block |
||
877 | 877 | * @since 3.5.3 |
878 | 878 | * @return array The formatted remove button attributes array. |
879 | 879 | */ |
880 | - protected function _getFormattedRemoveButtonAttributesByType( $sInputID, array $aButtonAttributes, $_bIsLabelSet, $sType='image' ) { |
|
880 | + protected function _getFormattedRemoveButtonAttributesByType( $sInputID, array $aButtonAttributes, $_bIsLabelSet, $sType = 'image' ) { |
|
881 | 881 | |
882 | - $_sOnClickFunctionName = 'removeInputValuesFor' . ucfirst( $sType ); |
|
882 | + $_sOnClickFunctionName = 'removeInputValuesFor'.ucfirst( $sType ); |
|
883 | 883 | $_aAttributes = array( |
884 | 884 | 'id' => "remove_{$sType}_{$sInputID}", |
885 | 885 | 'href' => '#', |
@@ -888,14 +888,14 @@ discard block |
||
888 | 888 | + $aButtonAttributes |
889 | 889 | + array( |
890 | 890 | 'title' => $_bIsLabelSet |
891 | - ? $aButtonAttributes['data-label'] |
|
891 | + ? $aButtonAttributes[ 'data-label' ] |
|
892 | 892 | : $this->oMsg->get( 'remove_value' ), |
893 | 893 | ); |
894 | - $_aAttributes['class'] = $this->getClassAttribute( |
|
894 | + $_aAttributes[ 'class' ] = $this->getClassAttribute( |
|
895 | 895 | "remove_value remove_{$sType} button button-small", |
896 | 896 | $this->getAOrB( |
897 | - trim( $aButtonAttributes['class'] ), |
|
898 | - $aButtonAttributes['class'], |
|
897 | + trim( $aButtonAttributes[ 'class' ] ), |
|
898 | + $aButtonAttributes[ 'class' ], |
|
899 | 899 | $this->getAOrB( |
900 | 900 | $_bIsLabelSet, |
901 | 901 | '', |
@@ -921,7 +921,7 @@ discard block |
||
921 | 921 | |
922 | 922 | $_bDashIconSupported = isset( $_bDashIconSupported ) |
923 | 923 | ? $_bDashIconSupported |
924 | - : version_compare( $GLOBALS['wp_version'], '3.8', '>=' ); |
|
924 | + : version_compare( $GLOBALS[ 'wp_version' ], '3.8', '>=' ); |
|
925 | 925 | |
926 | 926 | return $this->getAOrB( |
927 | 927 | $_bDashIconSupported, |
@@ -43,7 +43,7 @@ |
||
43 | 43 | * @since 2.1.5 |
44 | 44 | * @since 3.3.1 Changed from `_replyToGetStyles()`. |
45 | 45 | */ |
46 | - protected function getStyles() { |
|
46 | + protected function getStyles() { |
|
47 | 47 | return <<<CSSRULES |
48 | 48 | /* Text Field Type */ |
49 | 49 | .admin-page-framework-field.admin-page-framework-field-text > .admin-page-framework-input-label-container { |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | /** |
21 | 21 | * Defines the field type slugs used for this field type. |
22 | 22 | */ |
23 | - public $aFieldTypeSlugs = array( 'import', ); |
|
23 | + public $aFieldTypeSlugs = array( 'import',); |
|
24 | 24 | |
25 | 25 | /** |
26 | 26 | * Defines the default key-values of this field type. |
@@ -91,9 +91,9 @@ discard block |
||
91 | 91 | protected function getField( $aField ) { |
92 | 92 | |
93 | 93 | /* Set some required values */ |
94 | - $aField['attributes']['name'] = "__import[submit][{$aField['input_id']}]"; |
|
95 | - $aField['label'] = $aField['label'] |
|
96 | - ? $aField['label'] |
|
94 | + $aField[ 'attributes' ][ 'name' ] = "__import[submit][{$aField[ 'input_id' ]}]"; |
|
95 | + $aField[ 'label' ] = $aField[ 'label' ] |
|
96 | + ? $aField[ 'label' ] |
|
97 | 97 | : $this->oMsg->get( 'import' ); |
98 | 98 | return parent::getField( $aField ); |
99 | 99 | } |
@@ -106,13 +106,13 @@ discard block |
||
106 | 106 | * @since 3.0.0 |
107 | 107 | */ |
108 | 108 | protected function _getExtraFieldsBeforeLabel( &$aField ) { |
109 | - return "<input " . $this->getAttributes( |
|
109 | + return "<input ".$this->getAttributes( |
|
110 | 110 | array( |
111 | - 'id' => "{$aField['input_id']}_file", |
|
111 | + 'id' => "{$aField[ 'input_id' ]}_file", |
|
112 | 112 | 'type' => 'file', |
113 | - 'name' => "__import[{$aField['input_id']}]", |
|
114 | - ) + $aField['attributes']['file'] |
|
115 | - ) . " />"; |
|
113 | + 'name' => "__import[{$aField[ 'input_id' ]}]", |
|
114 | + ) + $aField[ 'attributes' ][ 'file' ] |
|
115 | + )." />"; |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | /** |
@@ -121,44 +121,44 @@ discard block |
||
121 | 121 | */ |
122 | 122 | protected function _getExtraInputFields( &$aField ) { |
123 | 123 | |
124 | - $aHiddenAttributes = array( 'type' => 'hidden', ); |
|
124 | + $aHiddenAttributes = array( 'type' => 'hidden',); |
|
125 | 125 | return |
126 | - "<input " . $this->getAttributes( |
|
126 | + "<input ".$this->getAttributes( |
|
127 | 127 | array( |
128 | - 'name' => "__import[{$aField['input_id']}][input_id]", |
|
129 | - 'value' => $aField['input_id'], |
|
128 | + 'name' => "__import[{$aField[ 'input_id' ]}][input_id]", |
|
129 | + 'value' => $aField[ 'input_id' ], |
|
130 | 130 | ) + $aHiddenAttributes |
131 | - ) . "/>" |
|
132 | - . "<input " . $this->getAttributes( |
|
131 | + )."/>" |
|
132 | + . "<input ".$this->getAttributes( |
|
133 | 133 | array( |
134 | - 'name' => "__import[{$aField['input_id']}][field_id]", |
|
135 | - 'value' => $aField['field_id'], |
|
134 | + 'name' => "__import[{$aField[ 'input_id' ]}][field_id]", |
|
135 | + 'value' => $aField[ 'field_id' ], |
|
136 | 136 | ) + $aHiddenAttributes |
137 | - ) . "/>" |
|
138 | - . "<input " . $this->getAttributes( |
|
137 | + )."/>" |
|
138 | + . "<input ".$this->getAttributes( |
|
139 | 139 | array( |
140 | - 'name' => "__import[{$aField['input_id']}][section_id]", |
|
141 | - 'value' => isset( $aField['section_id'] ) && $aField['section_id'] != '_default' ? $aField['section_id'] : '', |
|
140 | + 'name' => "__import[{$aField[ 'input_id' ]}][section_id]", |
|
141 | + 'value' => isset( $aField[ 'section_id' ] ) && $aField[ 'section_id' ] != '_default' ? $aField[ 'section_id' ] : '', |
|
142 | 142 | ) + $aHiddenAttributes |
143 | - ) . "/>" |
|
144 | - . "<input " . $this->getAttributes( |
|
143 | + )."/>" |
|
144 | + . "<input ".$this->getAttributes( |
|
145 | 145 | array( |
146 | - 'name' => "__import[{$aField['input_id']}][is_merge]", |
|
147 | - 'value' => $aField['is_merge'], |
|
146 | + 'name' => "__import[{$aField[ 'input_id' ]}][is_merge]", |
|
147 | + 'value' => $aField[ 'is_merge' ], |
|
148 | 148 | ) + $aHiddenAttributes |
149 | - ) . "/>" |
|
150 | - . "<input " . $this->getAttributes( |
|
149 | + )."/>" |
|
150 | + . "<input ".$this->getAttributes( |
|
151 | 151 | array( |
152 | - 'name' => "__import[{$aField['input_id']}][option_key]", |
|
153 | - 'value' => $aField['option_key'], |
|
152 | + 'name' => "__import[{$aField[ 'input_id' ]}][option_key]", |
|
153 | + 'value' => $aField[ 'option_key' ], |
|
154 | 154 | ) + $aHiddenAttributes |
155 | - ) . "/>" |
|
156 | - . "<input " . $this->getAttributes( |
|
155 | + )."/>" |
|
156 | + . "<input ".$this->getAttributes( |
|
157 | 157 | array( |
158 | - 'name' => "__import[{$aField['input_id']}][format]", |
|
159 | - 'value' => $aField['format'], |
|
158 | + 'name' => "__import[{$aField[ 'input_id' ]}][format]", |
|
159 | + 'value' => $aField[ 'format' ], |
|
160 | 160 | ) + $aHiddenAttributes |
161 | - ) . "/>" |
|
161 | + )."/>" |
|
162 | 162 | ; |
163 | 163 | } |
164 | 164 |
@@ -43,7 +43,7 @@ |
||
43 | 43 | * @since 2.1.5 |
44 | 44 | * @since 3.3.1 Changed from `_replyToGetStyles()`. |
45 | 45 | */ |
46 | - protected function getStyles() { |
|
46 | + protected function getStyles() { |
|
47 | 47 | return <<<CSSRULES |
48 | 48 | /* Text Field Type */ |
49 | 49 | .admin-page-framework-field.admin-page-framework-field-text > .admin-page-framework-input-label-container { |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | /** |
22 | 22 | * Defines the field type slugs used for this field type. |
23 | 23 | */ |
24 | - public $aFieldTypeSlugs = array( 'media', ); |
|
24 | + public $aFieldTypeSlugs = array( 'media',); |
|
25 | 25 | |
26 | 26 | /** |
27 | 27 | * Defines the default key-values of this field type. |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | return |
54 | 54 | $this->_getScript_MediaUploader( |
55 | 55 | "admin_page_framework" |
56 | - ) . PHP_EOL |
|
56 | + ).PHP_EOL |
|
57 | 57 | . $this->_getScript_RegisterCallbacks(); |
58 | 58 | } |
59 | 59 | |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | $_sInsertFromURL = esc_js( $this->oMsg->get( 'insert_from_url' ) ); |
149 | 149 | |
150 | 150 | // If the WordPress version is 3.4.x or below |
151 | - if ( ! function_exists( 'wp_enqueue_media' ) ) { |
|
151 | + if ( !function_exists( 'wp_enqueue_media' ) ) { |
|
152 | 152 | return <<<JAVASCRIPTS |
153 | 153 | /** |
154 | 154 | * Bind/rebinds the thickbox script the given selector element. |
@@ -388,8 +388,8 @@ discard block |
||
388 | 388 | // Do not include the escaping character (backslash) in the heredoc variable declaration |
389 | 389 | // because the minifier script will parse it and the <<<JAVASCRIPTS and JAVASCRIPTS; parts are converted to double quotes (") |
390 | 390 | // which causes the PHP syntax error. |
391 | - $_sButtonHTML = '"' . $this->_getUploaderButtonHTML_Media( $sInputID, $aButtonAttributes, $bExternalSource ) . '"'; |
|
392 | - $_sScript = <<<JAVASCRIPTS |
|
391 | + $_sButtonHTML = '"'.$this->_getUploaderButtonHTML_Media( $sInputID, $aButtonAttributes, $bExternalSource ).'"'; |
|
392 | + $_sScript = <<<JAVASCRIPTS |
|
393 | 393 | if ( jQuery( 'a#select_media_{$sInputID}' ).length == 0 ) { |
394 | 394 | jQuery( 'input#{$sInputID}' ).after( $_sButtonHTML ); |
395 | 395 | } |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | |
401 | 401 | return "<script type='text/javascript' class='admin-page-framework-media-uploader-button'>" |
402 | 402 | . $_sScript |
403 | - . "</script>". PHP_EOL; |
|
403 | + . "</script>".PHP_EOL; |
|
404 | 404 | |
405 | 405 | } |
406 | 406 | /** |
@@ -410,19 +410,19 @@ discard block |
||
410 | 410 | */ |
411 | 411 | private function _getUploaderButtonHTML_Media( $sInputID, array $aButtonAttributes, $bExternalSource ) { |
412 | 412 | |
413 | - $_bIsLabelSet = isset( $aButtonAttributes['data-label'] ) && $aButtonAttributes['data-label']; |
|
413 | + $_bIsLabelSet = isset( $aButtonAttributes[ 'data-label' ] ) && $aButtonAttributes[ 'data-label' ]; |
|
414 | 414 | $_aAttributes = $this->_getFormattedUploadButtonAttributes_Media( |
415 | 415 | $sInputID, |
416 | 416 | $aButtonAttributes, |
417 | 417 | $_bIsLabelSet, |
418 | 418 | $bExternalSource |
419 | 419 | ); |
420 | - return "<a " . $this->getAttributes( $_aAttributes ) . ">" |
|
420 | + return "<a ".$this->getAttributes( $_aAttributes ).">" |
|
421 | 421 | . $this->getAOrB( |
422 | 422 | $_bIsLabelSet, |
423 | - $_aAttributes['data-label'], |
|
423 | + $_aAttributes[ 'data-label' ], |
|
424 | 424 | $this->getAOrB( |
425 | - strrpos( $_aAttributes['class'], 'dashicons' ), |
|
425 | + strrpos( $_aAttributes[ 'class' ], 'dashicons' ), |
|
426 | 426 | '', |
427 | 427 | $this->oMsg->get( 'select_file' ) |
428 | 428 | ) |
@@ -437,26 +437,26 @@ discard block |
||
437 | 437 | */ |
438 | 438 | private function _getFormattedUploadButtonAttributes_Media( $sInputID, array $aButtonAttributes, $_bIsLabelSet, $bExternalSource ) { |
439 | 439 | |
440 | - $_aAttributes = array( |
|
440 | + $_aAttributes = array( |
|
441 | 441 | 'id' => "select_media_{$sInputID}", |
442 | 442 | 'href' => '#', |
443 | - 'data-uploader_type' => ( string ) function_exists( 'wp_enqueue_media' ), // ? 1 : 0, |
|
444 | - 'data-enable_external_source' => ( string ) ( bool ) $bExternalSource, // ? 1 : 0, |
|
443 | + 'data-uploader_type' => ( string ) function_exists( 'wp_enqueue_media' ), // ? 1 : 0, |
|
444 | + 'data-enable_external_source' => ( string ) ( bool ) $bExternalSource, // ? 1 : 0, |
|
445 | 445 | ) |
446 | 446 | + $aButtonAttributes |
447 | 447 | + array( |
448 | 448 | 'title' => $_bIsLabelSet |
449 | - ? $aButtonAttributes['data-label'] |
|
449 | + ? $aButtonAttributes[ 'data-label' ] |
|
450 | 450 | : $this->oMsg->get( 'select_file' ), |
451 | 451 | 'data-label' => null, |
452 | 452 | ); |
453 | - $_aAttributes['class'] = $this->getClassAttribute( |
|
453 | + $_aAttributes[ 'class' ] = $this->getClassAttribute( |
|
454 | 454 | 'select_media button button-small ', |
455 | 455 | $this->getAOrB( |
456 | - trim( $aButtonAttributes['class'] ), |
|
457 | - $aButtonAttributes['class'], |
|
456 | + trim( $aButtonAttributes[ 'class' ] ), |
|
457 | + $aButtonAttributes[ 'class' ], |
|
458 | 458 | $this->getAOrB( |
459 | - ! $_bIsLabelSet && version_compare( $GLOBALS['wp_version'], '3.8', '>=' ), |
|
459 | + !$_bIsLabelSet && version_compare( $GLOBALS[ 'wp_version' ], '3.8', '>=' ), |
|
460 | 460 | 'dashicons dashicons-portfolio', |
461 | 461 | '' |
462 | 462 | ) |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | /** |
21 | 21 | * Defines the field type slugs used for this field type. |
22 | 22 | */ |
23 | - public $aFieldTypeSlugs = array( 'posttype', ); |
|
23 | + public $aFieldTypeSlugs = array( 'posttype',); |
|
24 | 24 | |
25 | 25 | /** |
26 | 26 | * Defines the default key-values of this field type. |
@@ -28,19 +28,19 @@ discard block |
||
28 | 28 | * @remark $_aDefaultKeys holds shared default key-values defined in the base class. |
29 | 29 | */ |
30 | 30 | protected $aDefaultKeys = array( |
31 | - 'slugs_to_remove' => null, // the default array will be assigned in the rendering method. |
|
31 | + 'slugs_to_remove' => null, // the default array will be assigned in the rendering method. |
|
32 | 32 | /** |
33 | 33 | * Accepts query arguments. For the specification, see the arg parameter of get_post_types() function. |
34 | 34 | * See: http://codex.wordpress.org/Function_Reference/get_post_types#Parameters |
35 | 35 | */ |
36 | - 'query' => array(), // 3.2.1+ |
|
37 | - 'operator' => 'and', // 3.2.1+ either 'and' or 'or' |
|
36 | + 'query' => array(), // 3.2.1+ |
|
37 | + 'operator' => 'and', // 3.2.1+ either 'and' or 'or' |
|
38 | 38 | 'attributes' => array( |
39 | 39 | 'size' => 30, |
40 | 40 | 'maxlength' => 400, |
41 | 41 | ), |
42 | - 'select_all_button' => true, // 3.3.0+ to change the label, set the label here |
|
43 | - 'select_none_button' => true, // 3.3.0+ to change the label, set the label here |
|
42 | + 'select_all_button' => true, // 3.3.0+ to change the label, set the label here |
|
43 | + 'select_none_button' => true, // 3.3.0+ to change the label, set the label here |
|
44 | 44 | ); |
45 | 45 | protected $aDefaultRemovingPostTypeSlugs = array( |
46 | 46 | 'revision', |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | */ |
56 | 56 | protected function getStyles() { |
57 | 57 | $_sParentStyles = parent::getStyles(); |
58 | - return $_sParentStyles . <<<CSSRULES |
|
58 | + return $_sParentStyles.<<<CSSRULES |
|
59 | 59 | /* Posttype Field Type */ |
60 | 60 | .admin-page-framework-field input[type='checkbox'] { |
61 | 61 | margin-right: 0.5em; |
@@ -80,13 +80,13 @@ discard block |
||
80 | 80 | */ |
81 | 81 | protected function getField( $aField ) { |
82 | 82 | |
83 | - $this->_sCheckboxClassSelector = ''; // disable the checkbox class selector. |
|
84 | - $aField['label'] = $this->_getPostTypeArrayForChecklist( |
|
85 | - isset( $aField['slugs_to_remove'] ) |
|
86 | - ? $this->getAsArray( $aField['slugs_to_remove'] ) |
|
87 | - : $this->aDefaultRemovingPostTypeSlugs, // slugs to remove |
|
88 | - $aField['query'], |
|
89 | - $aField['operator'] |
|
83 | + $this->_sCheckboxClassSelector = ''; // disable the checkbox class selector. |
|
84 | + $aField[ 'label' ] = $this->_getPostTypeArrayForChecklist( |
|
85 | + isset( $aField[ 'slugs_to_remove' ] ) |
|
86 | + ? $this->getAsArray( $aField[ 'slugs_to_remove' ] ) |
|
87 | + : $this->aDefaultRemovingPostTypeSlugs, // slugs to remove |
|
88 | + $aField[ 'query' ], |
|
89 | + $aField[ 'operator' ] |
|
90 | 90 | ); |
91 | 91 | return parent::getField( $aField ); |
92 | 92 | |
@@ -104,11 +104,11 @@ discard block |
||
104 | 104 | * @param $sOperator array The query operator. |
105 | 105 | * @return array The array holding the elements of installed post types' labels and their slugs except the specified expluding post types. |
106 | 106 | */ |
107 | - private function _getPostTypeArrayForChecklist( $aSlugsToRemove, $asQueryArgs=array(), $sOperator='and' ) { |
|
107 | + private function _getPostTypeArrayForChecklist( $aSlugsToRemove, $asQueryArgs = array(), $sOperator = 'and' ) { |
|
108 | 108 | |
109 | 109 | $_aPostTypes = array(); |
110 | - foreach( get_post_types( $asQueryArgs, 'objects' ) as $_oPostType ) { |
|
111 | - if ( isset( $_oPostType->name, $_oPostType->label ) ) { |
|
110 | + foreach ( get_post_types( $asQueryArgs, 'objects' ) as $_oPostType ) { |
|
111 | + if ( isset( $_oPostType->name, $_oPostType->label ) ) { |
|
112 | 112 | $_aPostTypes[ $_oPostType->name ] = $_oPostType->label; |
113 | 113 | } |
114 | 114 | } |
@@ -75,11 +75,11 @@ discard block |
||
75 | 75 | */ |
76 | 76 | protected function getField( $aField ) { |
77 | 77 | |
78 | - $_aOutput = array(); |
|
79 | - foreach( $this->getAsArray( $aField['label'] ) as $_sKey => $_sLabel ) { |
|
80 | - $_aOutput[] = $this->_getEachRadioButtonOutput( $aField, $_sKey, $_sLabel ); |
|
78 | + $_aOutput = array(); |
|
79 | + foreach ( $this->getAsArray( $aField[ 'label' ] ) as $_sKey => $_sLabel ) { |
|
80 | + $_aOutput[ ] = $this->_getEachRadioButtonOutput( $aField, $_sKey, $_sLabel ); |
|
81 | 81 | } |
82 | - $_aOutput[] = $this->_getUpdateCheckedScript( $aField['input_id'] ); |
|
82 | + $_aOutput[ ] = $this->_getUpdateCheckedScript( $aField[ 'input_id' ] ); |
|
83 | 83 | return implode( PHP_EOL, $_aOutput ); |
84 | 84 | |
85 | 85 | } |
@@ -90,14 +90,14 @@ discard block |
||
90 | 90 | */ |
91 | 91 | private function _getEachRadioButtonOutput( array $aField, $sKey, $sLabel ) { |
92 | 92 | |
93 | - $_oRadio = new AdminPageFramework_Input_radio( $aField['attributes'] ); |
|
93 | + $_oRadio = new AdminPageFramework_Input_radio( $aField[ 'attributes' ] ); |
|
94 | 94 | $_oRadio->setAttributesByKey( $sKey ); |
95 | - $_oRadio->setAttribute( 'data-default', $aField['default'] ); // refered by the repeater script |
|
95 | + $_oRadio->setAttribute( 'data-default', $aField[ 'default' ] ); // refered by the repeater script |
|
96 | 96 | |
97 | 97 | // Output |
98 | 98 | return $this->getElement( $aField, array( 'before_label', $sKey ) ) |
99 | - . "<div class='admin-page-framework-input-label-container admin-page-framework-radio-label' style='min-width: " . $this->sanitizeLength( $aField['label_min_width'] ) . ";'>" |
|
100 | - . "<label " . $this->getAttributes( |
|
99 | + . "<div class='admin-page-framework-input-label-container admin-page-framework-radio-label' style='min-width: ".$this->sanitizeLength( $aField[ 'label_min_width' ] ).";'>" |
|
100 | + . "<label ".$this->getAttributes( |
|
101 | 101 | array( |
102 | 102 | 'for' => $_oRadio->getAttribute( 'id' ), |
103 | 103 | 'class' => $_oRadio->getAttribute( 'disabled' ) |
@@ -76,7 +76,7 @@ |
||
76 | 76 | protected function getField( $aField ) { |
77 | 77 | |
78 | 78 | $_aOutput = array(); |
79 | - foreach( $this->getAsArray( $aField['label'] ) as $_sKey => $_sLabel ) { |
|
79 | + foreach( $this->getAsArray( $aField['label'] ) as $_sKey => $_sLabel ) { |
|
80 | 80 | $_aOutput[] = $this->_getEachRadioButtonOutput( $aField, $_sKey, $_sLabel ); |
81 | 81 | } |
82 | 82 | $_aOutput[] = $this->_getUpdateCheckedScript( $aField['input_id'] ); |
@@ -1,11 +1,11 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Admin Page Framework |
|
4 | - * |
|
5 | - * http://en.michaeluno.jp/admin-page-framework/ |
|
6 | - * Copyright (c) 2013-2015 Michael Uno; Licensed MIT |
|
7 | - * |
|
8 | - */ |
|
3 | + * Admin Page Framework |
|
4 | + * |
|
5 | + * http://en.michaeluno.jp/admin-page-framework/ |
|
6 | + * Copyright (c) 2013-2015 Michael Uno; Licensed MIT |
|
7 | + * |
|
8 | + */ |
|
9 | 9 | |
10 | 10 | /** |
11 | 11 | * Provides methods to handle importing options. |
@@ -25,7 +25,7 @@ |
||
25 | 25 | /** |
26 | 26 | * Defines the field type slugs used for this field type. |
27 | 27 | */ |
28 | - public $aFieldTypeSlugs = array( 'section_title', ); |
|
28 | + public $aFieldTypeSlugs = array( 'section_title',); |
|
29 | 29 | |
30 | 30 | /** |
31 | 31 | * Defines the default key-values of this field type. |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | /** |
22 | 22 | * Defines the field type slugs used for this field type. |
23 | 23 | */ |
24 | - public $aFieldTypeSlugs = array( 'select', ); |
|
24 | + public $aFieldTypeSlugs = array( 'select',); |
|
25 | 25 | |
26 | 26 | /** |
27 | 27 | * Defines the default key-values of this field type. |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | 'select' => array( |
34 | 34 | 'size' => 1, |
35 | 35 | 'autofocusNew' => null, |
36 | - 'multiple' => null, // set 'multiple' for multiple selections. If 'is_multiple' is set, it takes the precedence. |
|
36 | + 'multiple' => null, // set 'multiple' for multiple selections. If 'is_multiple' is set, it takes the precedence. |
|
37 | 37 | 'required' => null, |
38 | 38 | ), |
39 | 39 | 'optgroup' => array(), |
@@ -71,21 +71,21 @@ discard block |
||
71 | 71 | */ |
72 | 72 | protected function getField( $aField ) { |
73 | 73 | |
74 | - $_oSelectInput = new AdminPageFramework_Input_select( $aField['attributes'] ); |
|
75 | - if ( $aField['is_multiple'] ) { |
|
74 | + $_oSelectInput = new AdminPageFramework_Input_select( $aField[ 'attributes' ] ); |
|
75 | + if ( $aField[ 'is_multiple' ] ) { |
|
76 | 76 | $_oSelectInput->setAttribute( array( 'select', 'multiple' ), 'multiple' ); |
77 | 77 | } |
78 | 78 | return |
79 | - $aField['before_label'] |
|
80 | - . "<div class='admin-page-framework-input-label-container admin-page-framework-select-label' style='min-width: " . $this->sanitizeLength( $aField['label_min_width'] ) . ";'>" |
|
81 | - . "<label for='{$aField['input_id']}'>" |
|
82 | - . $aField['before_input'] |
|
83 | - . $_oSelectInput->get( $aField['label'] ) |
|
84 | - . $aField['after_input'] |
|
79 | + $aField[ 'before_label' ] |
|
80 | + . "<div class='admin-page-framework-input-label-container admin-page-framework-select-label' style='min-width: ".$this->sanitizeLength( $aField[ 'label_min_width' ] ).";'>" |
|
81 | + . "<label for='{$aField[ 'input_id' ]}'>" |
|
82 | + . $aField[ 'before_input' ] |
|
83 | + . $_oSelectInput->get( $aField[ 'label' ] ) |
|
84 | + . $aField[ 'after_input' ] |
|
85 | 85 | . "<div class='repeatable-field-buttons'></div>" // the repeatable field buttons will be replaced with this element. |
86 | 86 | . "</label>" |
87 | 87 | . "</div>" |
88 | - . $aField['after_label']; |
|
88 | + . $aField[ 'after_label' ]; |
|
89 | 89 | |
90 | 90 | } |
91 | 91 |
@@ -72,7 +72,7 @@ |
||
72 | 72 | protected function getField( $aField ) { |
73 | 73 | |
74 | 74 | $_oSelectInput = new AdminPageFramework_Input_select( $aField['attributes'] ); |
75 | - if ( $aField['is_multiple'] ) { |
|
75 | + if ( $aField['is_multiple'] ) { |
|
76 | 76 | $_oSelectInput->setAttribute( array( 'select', 'multiple' ), 'multiple' ); |
77 | 77 | } |
78 | 78 | return |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | /** |
22 | 22 | * Defines the field type slugs used for this field type. |
23 | 23 | */ |
24 | - public $aFieldTypeSlugs = array( 'submit', ); |
|
24 | + public $aFieldTypeSlugs = array( 'submit',); |
|
25 | 25 | |
26 | 26 | /** |
27 | 27 | * Defines the default key-values of this field type. |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | 'redirect_url' => null, |
33 | 33 | 'href' => null, |
34 | 34 | 'reset' => null, |
35 | - 'email' => null, // [3.3.0+] string of an email address to send to or it can be an array with the following keys. |
|
35 | + 'email' => null, // [3.3.0+] string of an email address to send to or it can be an array with the following keys. |
|
36 | 36 | /* |
37 | 37 | array( |
38 | 38 | 'to' => null, // string|array The email address to send to or an array representing the key structure of the submitted form data holding the value. The first key should be the section ID and the second key is the the field ID. |
@@ -76,17 +76,17 @@ discard block |
||
76 | 76 | $_aLabelContainerAttributes = $this->_getLabelContainerAttributes( $aField ); |
77 | 77 | |
78 | 78 | return |
79 | - $aField['before_label'] |
|
80 | - . "<div " . $this->getAttributes( $_aLabelContainerAttributes ) . ">" |
|
79 | + $aField[ 'before_label' ] |
|
80 | + . "<div ".$this->getAttributes( $_aLabelContainerAttributes ).">" |
|
81 | 81 | . $this->_getExtraFieldsBeforeLabel( $aField ) // this is for the import field type that cannot place file input tag inside the label tag. |
82 | - . "<label " . $this->getAttributes( $_aLabelAttributes ) . ">" |
|
83 | - . $aField['before_input'] |
|
82 | + . "<label ".$this->getAttributes( $_aLabelAttributes ).">" |
|
83 | + . $aField[ 'before_input' ] |
|
84 | 84 | . $this->_getExtraInputFields( $aField ) |
85 | - . "<input " . $this->getAttributes( $_aInputAttributes ) . " />" // this method is defined in the base class |
|
86 | - . $aField['after_input'] |
|
85 | + . "<input ".$this->getAttributes( $_aInputAttributes )." />" // this method is defined in the base class |
|
86 | + . $aField[ 'after_input' ] |
|
87 | 87 | . "</label>" |
88 | 88 | . "</div>" |
89 | - . $aField['after_label']; |
|
89 | + . $aField[ 'after_label' ]; |
|
90 | 90 | |
91 | 91 | } |
92 | 92 | /** |
@@ -96,12 +96,12 @@ discard block |
||
96 | 96 | */ |
97 | 97 | private function _getFormatedFieldArray( array $aField ) { |
98 | 98 | |
99 | - $aField['label'] = $aField['label'] |
|
100 | - ? $aField['label'] |
|
99 | + $aField[ 'label' ] = $aField[ 'label' ] |
|
100 | + ? $aField[ 'label' ] |
|
101 | 101 | : $this->oMsg->get( 'submit' ); |
102 | 102 | |
103 | - if ( isset( $aField['attributes']['src'] ) ) { |
|
104 | - $aField['attributes']['src'] = $this->getResolvedSRC( $aField['attributes']['src'] ); |
|
103 | + if ( isset( $aField[ 'attributes' ][ 'src' ] ) ) { |
|
104 | + $aField[ 'attributes' ][ 'src' ] = $this->getResolvedSRC( $aField[ 'attributes' ][ 'src' ] ); |
|
105 | 105 | } |
106 | 106 | return $aField; |
107 | 107 | |
@@ -113,11 +113,11 @@ discard block |
||
113 | 113 | */ |
114 | 114 | private function _getLabelAttributes( array $aField, array $aInputAttributes ) { |
115 | 115 | return array( |
116 | - 'style' => $aField['label_min_width'] |
|
117 | - ? "min-width:" . $this->sanitizeLength( $aField['label_min_width'] ) . ";" |
|
116 | + 'style' => $aField[ 'label_min_width' ] |
|
117 | + ? "min-width:".$this->sanitizeLength( $aField[ 'label_min_width' ] ).";" |
|
118 | 118 | : null, |
119 | - 'for' => $aInputAttributes['id'], |
|
120 | - 'class' => $aInputAttributes['disabled'] |
|
119 | + 'for' => $aInputAttributes[ 'id' ], |
|
120 | + 'class' => $aInputAttributes[ 'disabled' ] |
|
121 | 121 | ? 'disabled' |
122 | 122 | : null, |
123 | 123 | ); |
@@ -129,8 +129,8 @@ discard block |
||
129 | 129 | */ |
130 | 130 | private function _getLabelContainerAttributes( array $aField ) { |
131 | 131 | return array( |
132 | - 'style' => $aField['label_min_width'] |
|
133 | - ? "min-width:" . $this->sanitizeLength( $aField['label_min_width'] ) . ";" |
|
132 | + 'style' => $aField[ 'label_min_width' ] |
|
133 | + ? "min-width:".$this->sanitizeLength( $aField[ 'label_min_width' ] ).";" |
|
134 | 134 | : null, |
135 | 135 | 'class' => 'admin-page-framework-input-label-container' |
136 | 136 | . ' admin-page-framework-input-button-container' |
@@ -143,14 +143,14 @@ discard block |
||
143 | 143 | * @return array The input attribute array. |
144 | 144 | */ |
145 | 145 | private function _getInputAttributes( array $aField ) { |
146 | - $_bIsImageButton = isset( $aField['attributes']['src'] ) && filter_var( $aField['attributes']['src'], FILTER_VALIDATE_URL ); |
|
146 | + $_bIsImageButton = isset( $aField[ 'attributes' ][ 'src' ] ) && filter_var( $aField[ 'attributes' ][ 'src' ], FILTER_VALIDATE_URL ); |
|
147 | 147 | $_sValue = $this->_getInputFieldValueFromLabel( $aField ); |
148 | 148 | return array( |
149 | 149 | // the type must be set because child class including export will use this method; in that case, the export type will be assigned which input tag does not support |
150 | 150 | 'type' => $_bIsImageButton ? 'image' : 'submit', |
151 | 151 | 'value' => $_sValue, |
152 | 152 | ) |
153 | - + $aField['attributes'] |
|
153 | + + $aField[ 'attributes' ] |
|
154 | 154 | + array( |
155 | 155 | 'title' => $_sValue, |
156 | 156 | 'alt' => $_bIsImageButton ? 'submit' : '', |
@@ -175,35 +175,35 @@ discard block |
||
175 | 175 | protected function _getExtraInputFields( &$aField ) { |
176 | 176 | |
177 | 177 | $_aOutput = array(); |
178 | - $_aOutput[] = $this->getHTMLTag( |
|
178 | + $_aOutput[ ] = $this->getHTMLTag( |
|
179 | 179 | 'input', |
180 | 180 | array( |
181 | 181 | 'type' => 'hidden', |
182 | - 'name' => "__submit[{$aField['input_id']}][input_id]", |
|
183 | - 'value' => $aField['input_id'], |
|
182 | + 'name' => "__submit[{$aField[ 'input_id' ]}][input_id]", |
|
183 | + 'value' => $aField[ 'input_id' ], |
|
184 | 184 | ) |
185 | 185 | ); |
186 | - $_aOutput[] = $this->getHTMLTag( |
|
186 | + $_aOutput[ ] = $this->getHTMLTag( |
|
187 | 187 | 'input', |
188 | 188 | array( |
189 | 189 | 'type' => 'hidden', |
190 | - 'name' => "__submit[{$aField['input_id']}][field_id]", |
|
191 | - 'value' => $aField['field_id'], |
|
190 | + 'name' => "__submit[{$aField[ 'input_id' ]}][field_id]", |
|
191 | + 'value' => $aField[ 'field_id' ], |
|
192 | 192 | ) |
193 | 193 | ); |
194 | - $_aOutput[] = $this->getHTMLTag( |
|
194 | + $_aOutput[ ] = $this->getHTMLTag( |
|
195 | 195 | 'input', |
196 | 196 | array( |
197 | 197 | 'type' => 'hidden', |
198 | - 'name' => "__submit[{$aField['input_id']}][name]", |
|
199 | - 'value' => $aField['_input_name_flat'], |
|
198 | + 'name' => "__submit[{$aField[ 'input_id' ]}][name]", |
|
199 | + 'value' => $aField[ '_input_name_flat' ], |
|
200 | 200 | ) |
201 | 201 | ); |
202 | - $_aOutput[] = $this->_getHiddenInput_SectionID( $aField ); |
|
203 | - $_aOutput[] = $this->_getHiddenInputByKey( $aField, 'redirect_url' ); |
|
204 | - $_aOutput[] = $this->_getHiddenInputByKey( $aField, 'href' ); |
|
205 | - $_aOutput[] = $this->_getHiddenInput_Reset( $aField ); |
|
206 | - $_aOutput[] = $this->_getHiddenInput_Email( $aField ); |
|
202 | + $_aOutput[ ] = $this->_getHiddenInput_SectionID( $aField ); |
|
203 | + $_aOutput[ ] = $this->_getHiddenInputByKey( $aField, 'redirect_url' ); |
|
204 | + $_aOutput[ ] = $this->_getHiddenInputByKey( $aField, 'href' ); |
|
205 | + $_aOutput[ ] = $this->_getHiddenInput_Reset( $aField ); |
|
206 | + $_aOutput[ ] = $this->_getHiddenInput_Email( $aField ); |
|
207 | 207 | return implode( PHP_EOL, array_filter( $_aOutput ) ); |
208 | 208 | |
209 | 209 | } |
@@ -219,9 +219,9 @@ discard block |
||
219 | 219 | 'input', |
220 | 220 | array( |
221 | 221 | 'type' => 'hidden', |
222 | - 'name' => "__submit[{$aField['input_id']}][section_id]", |
|
223 | - 'value' => isset( $aField['section_id'] ) && '_default' !== $aField['section_id'] |
|
224 | - ? $aField['section_id'] |
|
222 | + 'name' => "__submit[{$aField[ 'input_id' ]}][section_id]", |
|
223 | + 'value' => isset( $aField[ 'section_id' ] ) && '_default' !== $aField[ 'section_id' ] |
|
224 | + ? $aField[ 'section_id' ] |
|
225 | 225 | : '', |
226 | 226 | ) |
227 | 227 | ); |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | 'input', |
240 | 240 | array( |
241 | 241 | 'type' => 'hidden', |
242 | - 'name' => "__submit[{$aField['input_id']}][{$sKey}]", |
|
242 | + 'name' => "__submit[{$aField[ 'input_id' ]}][{$sKey}]", |
|
243 | 243 | 'value' => $aField[ $sKey ], |
244 | 244 | ) |
245 | 245 | ) |
@@ -253,15 +253,15 @@ discard block |
||
253 | 253 | * @return string the HTML input tag output for the 'reset' argument. |
254 | 254 | */ |
255 | 255 | private function _getHiddenInput_Reset( array $aField ) { |
256 | - if ( ! $aField['reset'] ) { |
|
256 | + if ( !$aField[ 'reset' ] ) { |
|
257 | 257 | return ''; |
258 | 258 | } |
259 | - return ! $this->_checkConfirmationDisplayed( $aField['_input_name_flat'], 'reset' ) |
|
259 | + return !$this->_checkConfirmationDisplayed( $aField[ '_input_name_flat' ], 'reset' ) |
|
260 | 260 | ? $this->getHTMLTag( |
261 | 261 | 'input', |
262 | 262 | array( |
263 | 263 | 'type' => 'hidden', |
264 | - 'name' => "__submit[{$aField['input_id']}][is_reset]", |
|
264 | + 'name' => "__submit[{$aField[ 'input_id' ]}][is_reset]", |
|
265 | 265 | 'value' => '1', |
266 | 266 | ) |
267 | 267 | ) |
@@ -269,10 +269,10 @@ discard block |
||
269 | 269 | 'input', |
270 | 270 | array( |
271 | 271 | 'type' => 'hidden', |
272 | - 'name' => "__submit[{$aField['input_id']}][reset_key]", |
|
273 | - 'value' => is_array( $aField['reset'] ) // set the option array key to delete. |
|
274 | - ? implode( '|', $aField['reset'] ) |
|
275 | - : $aField['reset'], |
|
272 | + 'name' => "__submit[{$aField[ 'input_id' ]}][reset_key]", |
|
273 | + 'value' => is_array( $aField[ 'reset' ] ) // set the option array key to delete. |
|
274 | + ? implode( '|', $aField[ 'reset' ] ) |
|
275 | + : $aField[ 'reset' ], |
|
276 | 276 | ) |
277 | 277 | ); |
278 | 278 | } |
@@ -285,19 +285,19 @@ discard block |
||
285 | 285 | */ |
286 | 286 | private function _getHiddenInput_Email( array $aField ) { |
287 | 287 | |
288 | - if ( empty( $aField['email'] ) ) { |
|
288 | + if ( empty( $aField[ 'email' ] ) ) { |
|
289 | 289 | return ''; |
290 | 290 | } |
291 | 291 | $this->setTransient( |
292 | - 'apf_em_' . md5( $aField['_input_name_flat'] . get_current_user_id() ), |
|
293 | - $aField['email'] |
|
292 | + 'apf_em_'.md5( $aField[ '_input_name_flat' ].get_current_user_id() ), |
|
293 | + $aField[ 'email' ] |
|
294 | 294 | ); |
295 | - return ! $this->_checkConfirmationDisplayed( $aField['_input_name_flat'], 'email' ) |
|
295 | + return !$this->_checkConfirmationDisplayed( $aField[ '_input_name_flat' ], 'email' ) |
|
296 | 296 | ? $this->getHTMLTag( |
297 | 297 | 'input', |
298 | 298 | array( |
299 | 299 | 'type' => 'hidden', |
300 | - 'name' => "__submit[{$aField['input_id']}][confirming_sending_email]", |
|
300 | + 'name' => "__submit[{$aField[ 'input_id' ]}][confirming_sending_email]", |
|
301 | 301 | 'value' => '1', |
302 | 302 | ) |
303 | 303 | ) |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | 'input', |
306 | 306 | array( |
307 | 307 | 'type' => 'hidden', |
308 | - 'name' => "__submit[{$aField['input_id']}][confirmed_sending_email]", |
|
308 | + 'name' => "__submit[{$aField[ 'input_id' ]}][confirmed_sending_email]", |
|
309 | 309 | 'value' => '1', |
310 | 310 | ) |
311 | 311 | ); |
@@ -315,19 +315,19 @@ discard block |
||
315 | 315 | * A helper function for the above getSubmitField() that checks if a reset confirmation message has been displayed or not when the 'reset' key is set. |
316 | 316 | * |
317 | 317 | */ |
318 | - private function _checkConfirmationDisplayed( $sFlatFieldName, $sType='reset' ) { |
|
318 | + private function _checkConfirmationDisplayed( $sFlatFieldName, $sType = 'reset' ) { |
|
319 | 319 | |
320 | - switch( $sType ) { |
|
320 | + switch ( $sType ) { |
|
321 | 321 | default: |
322 | 322 | case 'reset': // admin page framework _ reset confirmation |
323 | - $_sTransientKey = 'apf_rc_' . md5( $sFlatFieldName . get_current_user_id() ); |
|
323 | + $_sTransientKey = 'apf_rc_'.md5( $sFlatFieldName.get_current_user_id() ); |
|
324 | 324 | break; |
325 | 325 | case 'email': // admin page framework _ email confirmation |
326 | - $_sTransientKey = 'apf_ec_' . md5( $sFlatFieldName . get_current_user_id() ); |
|
326 | + $_sTransientKey = 'apf_ec_'.md5( $sFlatFieldName.get_current_user_id() ); |
|
327 | 327 | break; |
328 | 328 | } |
329 | 329 | |
330 | - $_bConfirmed = false === $this->getTransient( $_sTransientKey ) |
|
330 | + $_bConfirmed = false === $this->getTransient( $_sTransientKey ) |
|
331 | 331 | ? false |
332 | 332 | : true; |
333 | 333 | |
@@ -357,12 +357,12 @@ discard block |
||
357 | 357 | protected function _getInputFieldValueFromLabel( $aField ) { |
358 | 358 | |
359 | 359 | // If the value key is explicitly set, use it. But the empty string will be ignored. |
360 | - if ( isset( $aField['value'] ) && $aField['value'] != '' ) { return $aField['value']; } |
|
360 | + if ( isset( $aField[ 'value' ] ) && $aField[ 'value' ] != '' ) { return $aField[ 'value' ]; } |
|
361 | 361 | |
362 | - if ( isset( $aField['label'] ) ) { return $aField['label']; } |
|
362 | + if ( isset( $aField[ 'label' ] ) ) { return $aField[ 'label' ]; } |
|
363 | 363 | |
364 | 364 | // If the default value is set, |
365 | - if ( isset( $aField['default'] ) ) { return $aField['default']; } |
|
365 | + if ( isset( $aField[ 'default' ] ) ) { return $aField[ 'default' ]; } |
|
366 | 366 | |
367 | 367 | } |
368 | 368 |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | * @since 3.5.3 |
128 | 128 | * @return array The label container attribute array. |
129 | 129 | */ |
130 | - private function _getLabelContainerAttributes( array $aField ) { |
|
130 | + private function _getLabelContainerAttributes( array $aField ) { |
|
131 | 131 | return array( |
132 | 132 | 'style' => $aField['label_min_width'] |
133 | 133 | ? "min-width:" . $this->sanitizeLength( $aField['label_min_width'] ) . ";" |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | * @since 2.0.0 |
355 | 355 | * @since 2.1.5 Moved from AdminPageFramwrork_InputField. Changed the scope to protected from private. Removed the second parameter. |
356 | 356 | */ |
357 | - protected function _getInputFieldValueFromLabel( $aField ) { |
|
357 | + protected function _getInputFieldValueFromLabel( $aField ) { |
|
358 | 358 | |
359 | 359 | // If the value key is explicitly set, use it. But the empty string will be ignored. |
360 | 360 | if ( isset( $aField['value'] ) && $aField['value'] != '' ) { return $aField['value']; } |