Пример #1
0
 /**
  * @depends test_is_expandable_exists
  */
 public function test_is_expandable_likes_array_with_nested_arrays_of_arrays()
 {
     $input = array("numbers" => array("one" => 1, "two" => 2, "three" => 3), "letters" => array("one" => array("A", "a"), "two" => array("B", "b"), "three" => array("C", "c")));
     $result = Options_Pixie_Data_Format::is_expandable($input);
     $this->assertTrue($result);
 }
 /**
  * Builds row actions for the option_value column.
  *
  * @since 1.0
  *
  * @param array  $actions
  * @param object $item
  * @param array  $options
  *
  * @return string|void
  */
 public function column_option_value_row_actions($actions, $item, $options)
 {
     global $mode;
     $chars = 100;
     if ('list' == $mode && strlen(trim($item->option_value)) > $chars) {
         if (!isset($options['collapsed']) || true === $options['collapsed']) {
             $value = $this->column_option_value($item->option_value, $item, $options);
             if ($item->option_value !== $value) {
                 $actions = array('expand' => '<a href="#" class="truncate collapsed">' . _x('Expand', 'Show more data', 'options-pixie') . '</a>');
             }
         } else {
             $actions = array('collapse' => '<a href="#" class="truncate expanded">' . _x('Collapse', 'Show less data', 'options-pixie') . '</a>');
         }
     } elseif ('excerpt' == $mode && Options_Pixie_Data_Format::is_expandable($item->option_value)) {
         $actions = array('expand_all' => '<a href="#" class="expand-all">' . _x('Expand All', 'Show all collapsed array data', 'options-pixie') . '</a>', 'collapse_all' => '<a href="#" class="collapse-all">' . _x('Collapse All', 'Collapse and hide all array data', 'options-pixie') . '</a>');
     }
     return $actions;
 }