/** * Provides contents for each item's type column. * * @since 1.0 * * @see WP_List_Table::::single_row_columns() * * @param array $item A singular item (one full row's worth of data). * * @return string Text to be placed inside the column <td>. */ public function column_type($item) { // This is a derived column based on the contents of the option_value. $value = Options_Pixie_Data_Format::get_data_types($item->option_value); $output = apply_filters('options_pixie_column_display', $value, $item, array('column' => 'type')); $row_actions = apply_filters('options_pixie_column_row_actions', array(), $item, array('column' => 'type')); $row_actions = apply_filters('options_pixie_format_row_actions', $row_actions); return $output . $row_actions; }
/** * Checks whether data contains a serialized value, including if base64 encoded. * * @param string $data * * @return bool */ public static function contains_serialized($data) { if (!empty($data) && in_array('S', Options_Pixie_Data_Format::get_data_types($data))) { return true; } return false; }
/** * @depends test_get_data_types_exists */ public function test_get_data_types_with_broken_serialized() { $input = 'a:1:{s:1:"two";s:2:"four";}'; $result = Options_Pixie_Data_Format::get_data_types($input); $this->assertContains('S', $result, 'contains S'); $this->assertContains('!!!', $result, 'contains !!!'); }