Skip to content

Commit 117a95d

Browse files
committed
Style: Clean code
1 parent 3d3b248 commit 117a95d

1 file changed

Lines changed: 12 additions & 16 deletions

File tree

example/taxonomy_field/APF_TaxonomyField.php

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
*
1010
*/
1111

12+
/**
13+
*
14+
*/
1215
class APF_TaxonomyField extends AdminPageFramework_TaxonomyField {
1316

1417
/*
@@ -66,32 +69,30 @@ public function setUp() {
6669
* ( optional ) modify the columns of the term listing table
6770
*/
6871
public function sortable_columns_APF_TaxonomyField( $aColumn ) { // sortable_column_{instantiated class name}
69-
7072
return array(
7173
'custom' => 'custom',
7274
)
7375
+ $aColumn;
74-
7576
}
7677

7778
public function columns_APF_TaxonomyField( $aColumn ) { // column_{instantiated class name}
78-
79-
unset( $aColumn['description'] );
79+
unset( $aColumn[ 'description' ] );
8080
return array(
81-
'cb' => $aColumn['cb'],
81+
'cb' => $aColumn[ 'cb' ],
8282
'thumbnail' => __( 'Thumbnail', 'admin-page-framework-loader' ),
83-
'custom' => __( 'Custom Column', 'admin-page-framework-loader' ),
83+
'custom' => __( 'Custom Column', 'admin-page-framework-loader' ),
8484
)
8585
+ $aColumn;
86-
8786
}
8887

8988
/*
9089
* ( optional ) output the stored option to the custom column
9190
*/
9291
public function cell_APF_TaxonomyField( $sCellHTML, $sColumnSlug, $iTermID ) { // cell_{instantiated class name}
9392

94-
if ( ! $iTermID || $sColumnSlug != 'thumbnail' ) { return $sCellHTML; }
93+
if ( ! $iTermID || $sColumnSlug != 'thumbnail' ) {
94+
return $sCellHTML;
95+
}
9596

9697
$aOptions = get_option( 'APF_TaxonomyField', array() ); // by default the class name is the option key.
9798
return isset( $aOptions[ $iTermID ][ 'image_upload' ] ) && $aOptions[ $iTermID ][ 'image_upload' ]
@@ -120,25 +121,20 @@ public function do_APF_TaxonomyField() { // do_{instantiated class name}
120121
* Customizes the sorting algorithm of a custom column.
121122
*/
122123
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' ] ) {
125125
usort( $aTerms, array( $this, '_replyToSortByCustomOptionValue' ) );
126126
}
127127
return $aTerms;
128-
129128
}
130129
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.
133131
$_sTextFieldA = AdminPageFramework::getOption( $_sClassName, array( $oTermA->term_id, 'text_field' ) );
134132
$_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' ]
136134
? strnatcmp( $_sTextFieldA, $_sTextFieldB )
137135
: strnatcmp( $_sTextFieldB, $_sTextFieldA );
138-
139136
}
140137

141-
142138
/*
143139
* ( optional ) Use this method to validate submitted option values.
144140
*/

0 commit comments

Comments
 (0)