Skip to content

Commit 794fc75

Browse files
committed
Merge pull request #89 from Automattic/use-is-callable
Use `is_callable` vs `function_exists`
2 parents c07be05 + b91261a commit 794fc75

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

ad-code-manager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -962,7 +962,7 @@ public function get_matching_ad_code( $tag_id ) {
962962

963963
// Don't run the conditional if the conditional function doesn't exist or
964964
// isn't in our whitelist
965-
if ( !function_exists( $cond_func ) || !in_array( $cond_func, $this->whitelisted_conditionals ) )
965+
if ( !is_callable( $cond_func ) || !in_array( $cond_func, $this->whitelisted_conditionals ) )
966966
continue;
967967

968968
// Run our conditional and use any arguments that were passed

common/lib/acm-wp-list-table.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,8 @@ function column_id( $item ) {
224224
$column_id = 'acm-column[' . $slug . ']';
225225
$output .= '<label for="' . esc_attr( $column_id ) . '">' . esc_html( $slug ) . '</label>';
226226
// Support for select dropdowns
227-
$ad_code_args = $ad_code_manager->current_provider->ad_code_args;
228-
$ad_code_arg = array_shift( wp_filter_object_list( $ad_code_args, array( 'key' => $slug ) ) );
227+
$ad_code_args = wp_filter_object_list( $ad_code_manager->current_provider->ad_code_args, array( 'key' => $slug ) );
228+
$ad_code_arg = array_shift( $ad_code_args );
229229
if ( isset( $ad_code_arg['type'] ) && 'select' == $ad_code_arg['type'] ) {
230230
$output .= '<select name="' . esc_attr( $column_id ) . '">';
231231
foreach ( $ad_code_arg['options'] as $key => $label ) {

0 commit comments

Comments
 (0)