|
9 | 9 | * |
10 | 10 | */ |
11 | 11 |
|
| 12 | +/** |
| 13 | + * |
| 14 | + */ |
12 | 15 | class APF_TaxonomyField extends AdminPageFramework_TaxonomyField { |
13 | 16 |
|
14 | 17 | /* |
@@ -66,32 +69,30 @@ public function setUp() { |
66 | 69 | * ( optional ) modify the columns of the term listing table |
67 | 70 | */ |
68 | 71 | public function sortable_columns_APF_TaxonomyField( $aColumn ) { // sortable_column_{instantiated class name} |
69 | | - |
70 | 72 | return array( |
71 | 73 | 'custom' => 'custom', |
72 | 74 | ) |
73 | 75 | + $aColumn; |
74 | | - |
75 | 76 | } |
76 | 77 |
|
77 | 78 | public function columns_APF_TaxonomyField( $aColumn ) { // column_{instantiated class name} |
78 | | - |
79 | | - unset( $aColumn['description'] ); |
| 79 | + unset( $aColumn[ 'description' ] ); |
80 | 80 | return array( |
81 | | - 'cb' => $aColumn['cb'], |
| 81 | + 'cb' => $aColumn[ 'cb' ], |
82 | 82 | 'thumbnail' => __( 'Thumbnail', 'admin-page-framework-loader' ), |
83 | | - 'custom' => __( 'Custom Column', 'admin-page-framework-loader' ), |
| 83 | + 'custom' => __( 'Custom Column', 'admin-page-framework-loader' ), |
84 | 84 | ) |
85 | 85 | + $aColumn; |
86 | | - |
87 | 86 | } |
88 | 87 |
|
89 | 88 | /* |
90 | 89 | * ( optional ) output the stored option to the custom column |
91 | 90 | */ |
92 | 91 | public function cell_APF_TaxonomyField( $sCellHTML, $sColumnSlug, $iTermID ) { // cell_{instantiated class name} |
93 | 92 |
|
94 | | - if ( ! $iTermID || $sColumnSlug != 'thumbnail' ) { return $sCellHTML; } |
| 93 | + if ( ! $iTermID || $sColumnSlug != 'thumbnail' ) { |
| 94 | + return $sCellHTML; |
| 95 | + } |
95 | 96 |
|
96 | 97 | $aOptions = get_option( 'APF_TaxonomyField', array() ); // by default the class name is the option key. |
97 | 98 | return isset( $aOptions[ $iTermID ][ 'image_upload' ] ) && $aOptions[ $iTermID ][ 'image_upload' ] |
@@ -120,25 +121,20 @@ public function do_APF_TaxonomyField() { // do_{instantiated class name} |
120 | 121 | * Customizes the sorting algorithm of a custom column. |
121 | 122 | */ |
122 | 123 | public function replyToSortCustomColumn( $aTerms, $aTaxonomies, $aArgs ) { |
123 | | - |
124 | | - if ( 'edit-tags.php' == $GLOBALS['pagenow'] && isset( $_GET[ 'orderby' ] ) && 'custom' == $_GET[ 'orderby' ] ) { |
| 124 | + if ( 'edit-tags.php' == $GLOBALS[ 'pagenow' ] && isset( $_GET[ 'orderby' ] ) && 'custom' == $_GET[ 'orderby' ] ) { |
125 | 125 | usort( $aTerms, array( $this, '_replyToSortByCustomOptionValue' ) ); |
126 | 126 | } |
127 | 127 | return $aTerms; |
128 | | - |
129 | 128 | } |
130 | 129 | public function _replyToSortByCustomOptionValue( $oTermA, $oTermB ) { |
131 | | - |
132 | | - $_sClassName = get_class( $this ); // the instantiated class name is the option key by default. |
| 130 | + $_sClassName = get_class( $this ); // the instantiated class name is the option key by default. |
133 | 131 | $_sTextFieldA = AdminPageFramework::getOption( $_sClassName, array( $oTermA->term_id, 'text_field' ) ); |
134 | 132 | $_sTextFieldB = AdminPageFramework::getOption( $_sClassName, array( $oTermB->term_id, 'text_field' ) ); |
135 | | - return isset( $_GET['order'] ) && 'asc' == $_GET['order'] |
| 133 | + return isset( $_GET[ 'order' ] ) && 'asc' == $_GET[ 'order' ] |
136 | 134 | ? strnatcmp( $_sTextFieldA, $_sTextFieldB ) |
137 | 135 | : strnatcmp( $_sTextFieldB, $_sTextFieldA ); |
138 | | - |
139 | 136 | } |
140 | 137 |
|
141 | | - |
142 | 138 | /* |
143 | 139 | * ( optional ) Use this method to validate submitted option values. |
144 | 140 | */ |
|
0 commit comments