Skip to content
This repository
Browse code

Merge pull request #89 from Automattic/use-is-callable

Use `is_callable` vs `function_exists`
  • Loading branch information...
commit 794fc75e231ca4fab6945a4f4b863f540197a830 2 parents c07be05 + b91261a
Justin Sternberg jtsternberg authored

Showing 2 changed files with 3 additions and 3 deletions. Show diff stats Hide diff stats

  1. +1 1  ad-code-manager.php
  2. +2 2 common/lib/acm-wp-list-table.php
2  ad-code-manager.php
@@ -962,7 +962,7 @@ public function get_matching_ad_code( $tag_id ) {
962 962
963 963 // Don't run the conditional if the conditional function doesn't exist or
964 964 // 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 ) )
966 966 continue;
967 967
968 968 // Run our conditional and use any arguments that were passed
4 common/lib/acm-wp-list-table.php
@@ -224,8 +224,8 @@ function column_id( $item ) {
224 224 $column_id = 'acm-column[' . $slug . ']';
225 225 $output .= '<label for="' . esc_attr( $column_id ) . '">' . esc_html( $slug ) . '</label>';
226 226 // 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 );
229 229 if ( isset( $ad_code_arg['type'] ) && 'select' == $ad_code_arg['type'] ) {
230 230 $output .= '<select name="' . esc_attr( $column_id ) . '">';
231 231 foreach ( $ad_code_arg['options'] as $key => $label ) {

0 comments on commit 794fc75

Please sign in to comment.
Something went wrong with that request. Please try again.