/** * @param array $array1 * @param array $array2 * @return array */ function array_union($array1, $array2) { $union = $array1 + $array2; return array_uniq($union); }
function cdnplus_update_url($content) { global $conf; // print "<br/>CDNPLUS IN[".$content."]"; if (!empty($conf['cdnplus_conf']['cdn_enabled'])) { $extension = get_extension(strtolower($content)); //print $extension; for ($i = 1; $i <= 5; $i++) { if (!empty($conf['cdnplus_conf']['cdn_' . $i]['extratypes'])) { $conf['cdnplus_conf']['cdn_' . $i]['filetypes'] = array_uniq(array_merge($conf['cdnplus_conf']['cdn_' . $i]['filetypes'], explode(',', $conf['cdnplus_conf']['cdn_' . $i]['extratypes']))); } if (!empty($conf['cdnplus_conf']['cdn_' . $i]['ignorefiles'])) { } if (!empty($conf['cdnplus_conf']['cdn_' . $i]['host']) && array_key_exists($extension, $conf['cdnplus_conf']['cdn_' . $i]['filetypes']) && !empty($conf['cdnplus_conf']['cdn_' . $i]['filetypes'][$extension])) { $cdnUrl = 'http://'; if (!empty($_SERVER['HTTPS']) && !empty($conf['cdnplus_conf']['cdn_' . $i]['keep_https'])) { $cdnUrl = 'https://'; } $cdnUrl = $cdnUrl . $conf['cdnplus_conf']['cdn_' . $i]['host'] . make_index_url(); $content = $cdnUrl . $content; } } } // print "<br/>CDNPLUS OUT[".embellish_url($content)."]"; return $content; }
/** * Warning: Opposed to {@see array_uniq} it doesn't preserve original keys * * @param array $list * @param callable $iterator * * @return array */ function list_uniq($list, $iterator) { return array_values(array_uniq($list, $iterator)); }