/** * Highlights broken segments of a serialized string. * * @since 1.0 * * @param array $matches Array of matched parts. * * @return string */ private static function _highlight_broken_serialized_string($matches) { $return = esc_html($matches[0]); if (strlen($matches[2]) != $matches[1]) { $return = Options_Pixie_Data_Format::wrap_with_error($return, __('Broken string segment', 'options-pixie')); } return $return; }
/** * Handler for options_pixie_column_display filter. * * @since 1.0 * * @param mixed $value * @param object $item * @param array $options * * @return string */ public function column_display($value, $item, $options = array()) { if (empty($item) || empty($options['column'])) { return $value; } switch ($options['column']) { case 'option_value': $value = $this->column_option_value($value, $item, $options); break; case 'type': $value = join(' / ', $value); if (false !== strpos($value, '!!!')) { $value = Options_Pixie_Data_Format::wrap_with_error($value, __('Broken data', 'options-pixie')); } break; } // If the value to be displayed is the same as the raw data it must be escaped before display. if (isset($item->{$options['column']}) && !empty($item->{$options['column']}) && $value === $item->{$options['column']}) { $value = esc_html($value); } return $value; }