Skip to content

Instantly share code, notes, and snippets.

@xombra
Created April 26, 2014 01:30
Show Gist options
  • Save xombra/11309277 to your computer and use it in GitHub Desktop.
Save xombra/11309277 to your computer and use it in GitHub Desktop.
Crear Nube de TAG
global $palabras;
$GLOBALS['palabras'] = array(
' a ',' ah ', ' al ', ' alla ',' alo ',' ano ',' ante ',' anti ',' am ',' aquel ', ' aquellos ',' aquellas ',' ay ',
' asi ',
' bajo ', ' bien ',' bueno ',
' casi ',' con ', ' contra ', ' coma ', ' comer ',' como ', ' cómo ', ' cambiar ',
' da ',' dando ',' de ' , ' del ', ' dejar ',' desde ',' di ', ' dia ', 'dice',' donde ',' dijo ',' don ',
' e ', ' el ', ' ella ', ' ellas ', ' ellos ',' en ' ,' entonces ', ' entre ', ' era ',' es ', ' esa ',' ese ',
' esas ',' eso ',' esos ',' esta ', ' estan ',' estas ',' esto ',' estos ',
' fue ',' fueron ',' fuese ',' fuesen ',' fui ',' fuimos ', ' full ',
' ha ', ' habian ',' hacia ',' halla ', ' hallar ', ' hasta ', ' haya ',' hayan ',' hayamos ',' hayaron ',' hubo ',
' i ',' iban ',' idem ',' in ',' ir ',' irian ',' item ',
' ja ',' jamas ',' je ',' ji ',' juntos ',
' kill ',
' la ', ' las ', ' lanza ',' le ',' les ',' lo ', ' los ',
' mas ', ' matar ', ' me ', ' mes ',' mejor ', ' mi ',' mias ',' mios ', ' mis ',' mucho ',
' nada ',' nadie ',' ni ',' ninguno ',' no ', ' nos ',' nosotros ',' numero ',' numeros ',
' o ', ' on ',' orto ',
' para ',' paran ',' peor ', ' pm ', ' por ',' poco ',' pondra ',' pondran ',' porque ',' puede ',' pueden ',' puedes ',
' pudo ',' punto ',
' que ', ' quien ', ' quienes ',' quiere ',' quieren ',' quiero ',' quisiera ', ' quisieran ',' quisieras ',' quiso ',
' se ', ' sera ',' si ', 'sin', ' sino ',' sobre ', ' solo ',' su ', ' sus ',
' tambien ',' te ', ' the ', ' to ',' tu ',' tus ',' tuyas ', 'tuyos ',
' u ', ' un ', ' una ',' unas ',' uno ',' unos ',
' vamos ',' van ',' viene ',' vienen ',' vosotros ',' vive ',' voy ',' vuelve ',
' y ', ' ya ',' yo ',
'/', '#','&','(',')','.',',',';',':','-','*','{','}','[',']','<','>','$','%','=','@','?','!','"','+','¿',' | ',
'1','2','3','4','5','6','7','8','9','0');
function NUBE_TAGS($tags)
{ $busqueda = $GLOBALS['palabras'];
$search = array('Á', 'É', 'Í', 'Ó', 'Ú', 'á', 'é', 'í', 'ó', 'ú', 'Ü', 'ü', 'Ñ', 'ñ','&');
$replace = array('a', 'e', 'i', 'o', 'u', 'a', 'e', 'i', 'o', 'u', 'u', 'u', 'n', 'n',' ');
$tags = trim(strtolower($tags));
$html = array('&aacute;', '&eacute;', '&iacute;', '&oacute;', '&uacute;', '&ntilde;');
$str = array('a', 'e', 'i', 'o', 'u', 'u', 'u', 'n');
$tags = str_replace($html, $str, $tags);
$tags = str_replace($search, $replace, $tags);
$tags = str_replace($busqueda,' ',$tags);
$tags = preg_replace('/\s\s+/',' ', $tags );
$temp = explode(' ',$tags);
$tags = array();
$result = array_unique($temp);
sort($result);
$rnd = count($result);
$rand_keys = array_rand($result, $rnd);
for ($i=0;$i<$rnd;$i++)
{ $tags[$i] = $result[$rand_keys[$i]]; }
echo '<div class="nube"><h3>.: Nube de Tags :.</h3>';
for ($i=0;$i<$rnd;$i++)
{ srand((double)microtime()*1000000);
$ft = rand(1,4);
switch($ft){
case '1': echo '<span class="tag_nube1">'; break;
case '2': echo '<span class="tag_nube2">'; break;
case '3': echo '<span class="tag_nube3">'; break;
case '4': echo '<span class="tag_nube4">'; break;
}
echo $tags[$i].' </span>';
}
echo '</div>';
unset($tags,$result,$temp,$rand_keys,$html,$replace,$busqueda,$search,$ft,$rnd);
return;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment