Warning: Invalid argument supplied for foreach()
-
This is the message I am seeing:
Warning: Invalid argument supplied for foreach() in /home/customer/www/finlightened.com/public_html/wp-content/plugins/insert-php/includes/class.execute.snippet.php on line 679
How can this be fixed? Thank you for the help.
Line 679 is this in code below: foreach ( $filters[0] as $filter ) {
/** * Check conditional execution logic for the snippet * * @param $snippet_id * * @return bool */ public function checkCondition( $snippet_id ) { // Итоговый результат условий $result = true; // Получаем сохранённые параметры условий $filters = get_post_meta( $snippet_id, WINP_Plugin::app()->getPrefix() . 'snippet_filters' ); // Если условия указаны if ( ! ( empty( $filters ) || isset( $filters[0] ) && empty( $filters[0] ) ) ) { foreach ( $filters[0] as $filter ) { $conditions = $this->getPropertyValue( $filter, 'conditions' ); // Если условия пусты, то пропускаем цикл if ( empty( $conditions ) ) { continue; } // Промежуточный результат AND условий $and_conditions = null; // Проходим по AND условиям foreach ( $conditions as $scope ) { $scope_conditions = $this->getPropertyValue( $scope, 'conditions' ); // Если условия пусты, то пропускаем цикл if ( empty( $scope_conditions ) ) { continue; } // Промежуточный результат OR условий $or_conditions = null; // Проходим по OR условиям foreach ( $scope_conditions as $condition ) { $method_name = str_replace( '-', '_', $this->getPropertyValue( $condition, 'param' ) ); $operator = $this->getPropertyValue( $condition, 'operator' ); $value = $this->getPropertyValue( $condition, 'value' ); // Получаем результат OR условий $or_conditions = is_null( $or_conditions ) ? $this->call_method( $method_name, $operator, $value ) : $or_conditions || $this->call_method( $method_name, $operator, $value ); } // Получаем результат AND условий $and_conditions = is_null( $and_conditions ) ? $or_conditions : $and_conditions && $or_conditions; } // Получаем результат блока условий $result = $this->getPropertyValue( $filter, 'type' ) == 'showif' ? $and_conditions : ! $and_conditions; } } return $result; }
The page I need help with: [log in to see the link]
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Warning: Invalid argument supplied for foreach()’ is closed to new replies.