[HOME]

Path : /home/hermanostamargo/ftp/administracion/
Upload :
Current File : /home/hermanostamargo/ftp/administracion/funciones.php

<?php
//URL amigable
setlocale(LC_ALL, 'en_US.UTF8');
function toAscii($str, $replace=array(), $delimiter='-') {
  if( !empty($replace) ) {
    $str = str_replace((array)$replace, ' ', $str);
  }

  $clean = iconv('UTF-8', 'ASCII//TRANSLIT', $str);
  $clean = preg_replace("/[^a-zA-Z0-9\/_|+ -]/", '', $clean);
  $clean = strtolower(trim($clean, '-'));
  $clean = preg_replace("/[\/_|+ -]+/", $delimiter, $clean);

  return $clean;
}
//toAscii($row['titulo'], "'");

// lĂ­mite de palabras
function wordlimit($string, $length = 10, $ellipsis = "...")
{
	$words = explode(' ', $string);
	if (count($words) > $length)
	{
			return implode(' ', array_slice($words, 0, $length)) ."". $ellipsis;
	}
	else
	{		
			return $string;
	}
}

//borramos el atributo style
function borra_style($cadena) {
	$borra_style = preg_replace("/style=\"(.+?)\"/", '', $cadena); 
	return $borra_style;
}

//para AMP
// Licensed under a CC0 1.0 Universal (CC0 1.0) Public Domain Dedication
// http://creativecommons.org/publicdomain/zero/1.0/
function ampify($html) {
    // Replace img, audio, and video elements with amp custom elements
    $html = str_ireplace(
        array('<img','<video','/video>','<audio','/audio>'),
        array('<amp-img','<amp-video','/amp-video>','<amp-audio','/amp-audio>'),
        $html
    );


    // Add closing tags to amp-img custom element
    $html = preg_replace('/<amp-img(.*?)>/', '<amp-img$1></amp-img>',$html);
    // Whitelist of HTML tags allowed by AMP
    $html = strip_tags($html,'<h1><h2><h3><h4><h5><h6><a><p><ul><ol><li><blockquote><q><cite><ins><del><strong><em><code><pre><svg><table><thead><tbody><tfoot><th><tr><td><dl><dt><dd><article><section><header><footer><aside><figure><time><abbr><div><span><hr><small><br><amp-img><amp-audio><amp-video><amp-ad><amp-anim><amp-carousel><amp-fit-rext><amp-image-lightbox><amp-instagram><amp-lightbox><amp-twitter><amp-youtube>');
    return $html;
}


//para las NEWS
$tabla = "bisionnews";
$suscripciones = "bisionsuscripciones";
$familias = "bisionfamilias";
$provincias= "bisionprovincias";
$cp= "bisioncp";
$edad = "bisionedad";

?>