示例#1
0
 /**
  * Removes these overrides from the overrides config
  * so we can go back to whatever defaults we need. Not
  * being used as far as I know yet, but it could come
  * in handy soon...
  *
  * @param  array  $settings
  * @return void
  */
 public function remove(array $settings)
 {
     $overrides = array_merge_values(require $this->overridesFile);
     foreach ($settings as $setting) {
         unset($overrides[$setting]);
     }
     $contents = $this->varExport($overrides);
     $this->files->put($this->overridesFile, $contents);
 }
示例#2
0
 function array_merge_values($items, $overrides)
 {
     foreach ($overrides as $key => $value) {
         if (!is_array($value)) {
             $items[$key] = $value;
         } else {
             $items[$key] = array_key_exists($key, $items) ? $items[$key] : array();
             $items[$key] = array_merge_values($items[$key], $value);
         }
     }
     return $items;
 }
 public function test_array_merge_values()
 {
     $array1 = array("a", "b", "c");
     $array2 = array("x", "y", "z");
     $array3 = array(1, 2, 3);
     $array4 = array("a", "b", "c", "d", "e");
     $expectedResult12 = array("ax", "by", "cz");
     $expectedResult13 = array("a1", "b2", "c3");
     $expectedResult14 = false;
     $this->assertEquals($expectedResult12, array_merge_values($array1, $array2));
     $this->assertEquals($expectedResult13, array_merge_values($array1, $array3));
     $this->assertEquals($expectedResult14, array_merge_values($array1, $array4));
 }
示例#4
0
    }
    //$_SESSION['OCS']["forcedRequest"]=$sql;
    $sql['SQL'] .= $and_where . " " . $info_name_soft['table'] . "." . $info_name_soft['field'] . " like '%s'";
    array_push($sql['ARG'], $protectedPost['onglet'] . "%");
    if (isset($protectedPost['NAME_RESTRICT']) and $protectedPost['NAME_RESTRICT'] != "") {
        $sql['SQL'] .= " and " . $info_name_soft['table'] . "." . $info_name_soft['field'] . " like '%s' ";
        array_push($sql['ARG'], "%" . $protectedPost['NAME_RESTRICT'] . "%");
        //$_SESSION['OCS']["forcedRequest"].=$and_where."name like '%".$protectedPost['NAME_RESTRICT']."%'" ;
    }
}
if (isset($sql)) {
    $sql['SQL'] .= " group by " . $field_name_soft;
    //	$_SESSION['OCS']["forcedRequest"].=" group by name";
    if ($sql_fin['SQL'] != '') {
        $sql['SQL'] .= $sql_fin['SQL'];
        $sql['ARG'] = array_merge_values($sql['ARG'], $sql_fin['ARG']);
        //	$_SESSION['OCS']["forcedRequest"].=$sql_fin;
    }
    $list_fields = array('name' => 'name', 'nbre' => 'nb');
    $default_fields = $list_fields;
    $list_col_cant_del = $default_fields;
    $tab_options['LIEN_LBL']['nbre'] = 'index.php?' . PAG_INDEX . '=' . $pages_refs['ms_multi_search'] . '&prov=allsoft&value=';
    $tab_options['LIEN_CHAMP']['nbre'] = 'id';
    $tab_options['LBL']['name'] = $l->g(847);
    $tab_options['LBL']['nbre'] = $l->g(1120);
    $tab_options['ARG_SQL'] = $sql['ARG'];
    $result_exist = tab_req($table_name, $list_fields, $default_fields, $list_col_cant_del, $sql['SQL'], $form_name, 80, $tab_options);
}
echo "<br><div class='mvt_bordure'>";
echo "<b>" . $l->g(735) . "</b><br><br>";
echo $l->g(382) . ": " . show_modif($protectedPost['NAME_RESTRICT'], 'NAME_RESTRICT', 0);
示例#5
0
 /**
  * create a new config overrides
  *
  * @param array $items
  * @param array $overrides
  */
 public function __construct(array $items = array(), array $overrides = array())
 {
     $this->items = array_merge_values($items, $overrides);
 }
示例#6
0
 public function testarray_merge_values()
 {
     //execute the method and test if it returns expected values
     //try with two different length arrays
     $tempArray1 = array('v1', 'v2', 'v3');
     $tempArray2 = array('v4', 'v5');
     $actual = array_merge_values($tempArray1, $tempArray2);
     $this->assertFalse($actual);
     //try with same length arrays.
     $tempArray1 = array('v1', 'v2', 'v3');
     $tempArray2 = array('v4', 'v5', 'v6');
     $expected = array('v1v4', 'v2v5', 'v3v6');
     $actual = array_merge_values($tempArray1, $tempArray2);
     $this->assertSame($expected, $actual);
 }