Current File : //var/www/tusveterinarios/wp-content/plugins/updraftplus/includes/class-manipulation-functions.php
<?php

if (!defined('ABSPATH')) die('No direct access.');

/**
 * Here live manipulation functions that just transform input into output and do not perform any other activities
 */
class UpdraftPlus_Manipulation_Functions {

	/**
	 * Replace last occurence
	 *
	 * @param  String  $search         The value being searched for, otherwise known as the needle
	 * @param  String  $replace        The replacement value that replaces found search values
	 * @param  String  $subject        The string or array being searched and replaced on, otherwise known as the haystack
	 * @param  Boolean $case_sensitive Whether the replacement should be case sensitive or not
	 *
	 * @return String
	 */
	public static function str_lreplace($search, $replace, $subject, $case_sensitive = true) {
		$pos = $case_sensitive ? strrpos($subject, $search) : strripos($subject, $search);
		if (false !== $pos) $subject = substr_replace($subject, $replace, $pos, strlen($search));
		return $subject;
	}
	
	/**
	 * Replace the first, and only the first, instance within a string
	 *
	 * @param String $needle   - the search term
	 * @param String $replace  - the replacement term
	 * @param String $haystack - the string to replace within
	 *
	 * @return String - the filtered string
	 */
	public static function str_replace_once($needle, $replace, $haystack) {
		$pos = strpos($haystack, $needle);
		return (false !== $pos) ? substr_replace($haystack, $replace, $pos, strlen($needle)) : $haystack;
	}

	/**
	 * Remove slashes that precede a comma or the end of the string
	 *
	 * @param String $string - input string
	 *
	 * @return String - the altered string
	 */
	public static function strip_dirslash($string) {
		return preg_replace('#/+(,|$)#', '$1', $string);
	}

	/**
	 * Remove slashes from a string or array of strings.
	 *
	 * The function wp_unslash() is WP 3.6+, so therefore we have a compatibility method here
	 *
	 * @param String|Array $value String or array of strings to unslash.
	 * @return String|Array Unslashed $value
	 */
	public static function wp_unslash($value) {
		return function_exists('wp_unslash') ? wp_unslash($value) : stripslashes_deep($value);
	}
	
	/**
	 * Parse a filename into components
	 *
	 * @param String $filename - the filename
	 *
	 * @return Array|Boolean - the parsed values, or false if parsing failed
	 */
	public static function parse_filename($filename) {
		if (preg_match('/^backup_([\-0-9]{10})-([0-9]{4})_.*_([0-9a-f]{12})-([\-a-z]+)([0-9]+)?+\.(zip|gz|gz\.crypt)$/i', $filename, $matches)) {
			return array(
				'date' => strtotime($matches[1].' '.$matches[2]),
				'nonce' => $matches[3],
				'type' => $matches[4],
				'index' => (empty($matches[5]) ? 0 : $matches[5]-1),
				'extension' => $matches[6]
			);
		} else {
			return false;
		}
	}
	
	/**
	 * Convert a number of bytes into a suitable textual string
	 *
	 * @param Integer $size - the number of bytes
	 *
	 * @return String - the resulting textual string
	 */
	public static function convert_numeric_size_to_text($size) {
		if ($size > 1073741824) {
			return round($size / 1073741824, 1).' GB';
		} elseif ($size > 1048576) {
			return round($size / 1048576, 1).' MB';
		} elseif ($size > 1024) {
			return round($size / 1024, 1).' KB';
		} else {
			return round($size, 1).' B';
		}
	}

	/**
	 * Add backquotes to tables and db-names in SQL queries. Taken from phpMyAdmin.
	 *
	 * @param  string $a_name - the table name
	 * @return string - the quoted table name
	 */
	public static function backquote($a_name) {
		if (!empty($a_name) && '*' != $a_name) {
			if (is_array($a_name)) {
				$result = array();
				foreach ($a_name as $key => $val) {
					$result[$key] = '`'.$val.'`';
				}
				return $result;
			} else {
				return '`'.$a_name.'`';
			}
		} else {
			return $a_name;
		}
	}
	
	/**
	 * Remove empty (according to empty()) members of an array
	 *
	 * @param Array $list - input array
	 * @return Array - pruned array
	 */
	public static function remove_empties($list) {
		if (!is_array($list)) return $list;
		foreach ($list as $ind => $entry) {
			if (empty($entry)) unset($list[$ind]);
		}
		return $list;
	}

	/**
	 * Sort restoration entities
	 *
	 * @param String $a - first entity
	 * @param String $b - second entity
	 *
	 * @return Integer - sort result
	 */
	public static function sort_restoration_entities($a, $b) {
		if ($a == $b) return 0;
		// Put the database first
		// Put wpcore after plugins/uploads/themes (needed for restores of foreign all-in-one formats)
		if ('db' == $a || 'wpcore' == $b) return -1;
		if ('db' == $b || 'wpcore' == $a) return 1;
		// After wpcore, next last is others
		if ('others' == $b) return -1;
		if ('others' == $a) return 1;
		// And then uploads - this is only because we want to make sure uploads is after plugins, so that we know before we get to the uploads whether the version of UD which might have to unpack them can do this new-style or not.
		if ('uploads' == $b) return -1;
		if ('uploads' == $a) return 1;
		return strcmp($a, $b);
	}
	
	/**
	 * This options filter removes ABSPATH off the front of updraft_dir, if it is given absolutely and contained within it
	 *
	 * @param  String $updraft_dir Directory
	 * @return String
	 */
	public static function prune_updraft_dir_prefix($updraft_dir) {
		if ('/' == substr($updraft_dir, 0, 1) || "\\" == substr($updraft_dir, 0, 1) || preg_match('/^[a-zA-Z]:/', $updraft_dir)) {
			$wcd = trailingslashit(WP_CONTENT_DIR);
			if (strpos($updraft_dir, $wcd) === 0) {
				$updraft_dir = substr($updraft_dir, strlen($wcd));
			}
		}
		return $updraft_dir;
	}
	
	public static function get_mime_type_from_filename($filename, $allow_gzip = true) {
		if ('.zip' == substr($filename, -4, 4)) {
			return 'application/zip';
		} elseif ('.tar' == substr($filename, -4, 4)) {
			return 'application/x-tar';
		} elseif ('.tar.gz' == substr($filename, -7, 7)) {
			return 'application/x-tgz';
		} elseif ('.tar.bz2' == substr($filename, -8, 8)) {
			return 'application/x-bzip-compressed-tar';
		} elseif ($allow_gzip && '.gz' == substr($filename, -3, 3)) {
			// When we sent application/x-gzip as a content-type header to the browser, we found a case where the server compressed it a second time (since observed several times)
			return 'application/x-gzip';
		} else {
			return 'application/octet-stream';
		}
	}
	
	/**
	 * Filter the value to ensure it is between 1 and 9999
	 *
	 * @param Integer $input
	 *
	 * @return Integer
	 */
	public static function retain_range($input) {
		$input = (int) $input;
		return ($input > 0) ? min($input, 9999) : 1;
	}

	/**
	 * Find matching string from $str_arr1 and $str_arr2
	 *
	 * @param array   $str_arr1                  array of strings
	 * @param array   $str_arr2                  array of strings
	 * @param boolean $match_until_first_numeric only match until first numeric occurence
	 * @return string matching str which will be best for replacement
	 */
	public static function get_matching_str_from_array_elems($str_arr1, $str_arr2, $match_until_first_numeric = true) {
		$matching_str = '';
		if ($match_until_first_numeric) {
			$str_partial_arr = array();
			foreach ($str_arr1 as $str1) {
				$str1_str_length = strlen($str1);
				$temp_str1_chars = str_split($str1);
				$temp_partial_str = '';
				// The flag is for whether non-numeric character passed after numeric character occurence in str1. For ex. str1 is utf8mb4, the flag wil be true when parsing m after utf8.
				$numeric_char_pass_flag = false;
				$char_position_in_str1 = 0;
				while ($char_position_in_str1 < $str1_str_length) {
					if ($numeric_char_pass_flag && !is_numeric($temp_str1_chars[$char_position_in_str1])) {
						break;
					}
					if (is_numeric($temp_str1_chars[$char_position_in_str1])) {
						$numeric_char_pass_flag = true;
					}
					$temp_partial_str .= $temp_str1_chars[$char_position_in_str1];
					$char_position_in_str1++;
				}
				$str_partial_arr[] = $temp_partial_str;
			}
			foreach ($str_partial_arr as $str_partial) {
				if (!empty($matching_str)) {
					break;
				}
				foreach ($str_arr2 as $str2) {
					if (0 === stripos($str2, $str_partial)) {
						$matching_str = $str2;
						break;
					}
				}
			}
		} else {
			$str1_partial_first_arr = array();
			$str1_partial_first_arr = array();
			$str1_partial_start_n_middle_arr = array();
			$str1_partial_middle_n_last_arr = array();
			$str1_partial_last_arr = array();
			foreach ($str_arr1 as $str1) {
				$str1_partial_arr = explode('_', $str1);
				$str1_parts_count = count($str1_partial_arr);
				$str1_partial_first_arr[] = $str1_partial_arr[0];
				$str1_last_part_index = $str1_parts_count - 1;
				if ($str1_last_part_index > 0) {
					$str1_partial_last_arr[] = $str1_partial_arr[$str1_last_part_index];
					$str1_partial_start_n_middle_arr[] = substr($str1, 0, stripos($str1, '_'));
					$str1_partial_middle_n_last_arr[] = substr($str1, stripos($str1, '_') + 1);
				}
			}
			for ($case_no = 1; $case_no <= 5; $case_no++) {
				if (!empty($matching_str)) {
					break;
				}
				foreach ($str_arr2 as $str2) {
					switch ($case_no) {
						// Case 1: Both Start and End match
						case 1:
						$str2_partial_arr = explode('_', $str2);
						$str2_first_part = $str2_partial_arr[0];
						$str2_parts_count = count($str2_partial_arr);
						$str2_last_part_index = $str2_parts_count - 1;
						if ($str2_last_part_index > 0) {
								$str2_last_part = $str2_partial_arr[$str2_last_part_index];
						} else {
														$str2_last_part = '';
						}
						if (!empty($str2_last_part) && !empty($str1_partial_last_arr) && in_array($str2_first_part, $str1_partial_first_arr) && in_array($str2_last_part, $str1_partial_last_arr)) {
								$matching_str = $str2;
						}
							break;
						// Case 2: Start Middle Match
						case 2:
						$str2_partial_first_n_middle_parts = substr($str2, 0, stripos($str2, '_'));
						if (in_array($str2_partial_first_n_middle_parts, $str1_partial_start_n_middle_arr)) {
								$matching_str = $str2;
						}
							break;
						// Case 3: End Middle Match
						case 3:
						$str2_partial_middle_n_last_parts = stripos($str2, '_') !== false ? substr($str2, stripos($str2, '_') + 1) : '';
						if (!empty($str2_partial_middle_n_last_parts) && in_array($str2_partial_middle_n_last_parts, $str1_partial_middle_n_last_arr)) {
								$matching_str = $str2;
						}
							break;
						// Case 4: Start Match (low possibilities)
						case 4:
						$str2_partial_arr = explode('_', $str2);
						$str2_first_part = $str2_partial_arr[0];
						if (in_array($str2_first_part, $str1_partial_first_arr)) {
								$matching_str = $str2;
						}
							break;
						// Case 5: End Match (low possibilities)
						case 5:
						$str2_partial_arr = explode('_', $str2);
						$str2_parts_count = count($str2_partial_arr);
						$str2_last_part_index = $str2_parts_count - 1;
						if ($str2_last_part_index > 0) {
								$str2_last_part = $str2_partial_arr[$str2_last_part_index];
						} else {
														$str2_last_part = '';
						}
						if (!empty($str2_last_part) && in_array($str2_last_part, $str1_partial_last_arr)) {
								$matching_str = $str2;
						}
							break;
					}
					if (!empty($matching_str)) {
						break;
					}
				}
			}
		}
		return $matching_str;
	}
	
	/**
	 * Produce a normalised version of a URL, useful for comparisons. This may produce a URL that does not actually reference the same location; its purpose is only to use in comparisons of two URLs that *both* go through this function.
	 *
	 * @param String $url - the URL
	 *
	 * @return String - normalised
	 */
	public static function normalise_url($url) {
		$parsed_descrip_url = parse_url($url);
		if (is_array($parsed_descrip_url)) {
			if (preg_match('/^www\./i', $parsed_descrip_url['host'], $matches)) $parsed_descrip_url['host'] = substr($parsed_descrip_url['host'], 4);
			$normalised_descrip_url = 'http://'.strtolower($parsed_descrip_url['host']);
			if (!empty($parsed_descrip_url['port'])) $normalised_descrip_url .= ':'.$parsed_descrip_url['port'];
			if (!empty($parsed_descrip_url['path'])) $normalised_descrip_url .= untrailingslashit($parsed_descrip_url['path']);
		} else {
			$normalised_descrip_url = untrailingslashit($url);
		}
		return $normalised_descrip_url;
	}

	/**
	 * Normalize a filesystem path.
	 *
	 * On windows systems, replaces backslashes with forward slashes
	 * and forces upper-case drive letters.
	 * Allows for two leading slashes for Windows network shares, but
	 * ensures that all other duplicate slashes are reduced to a single.
	 *
	 * @param string $path Path to normalize.
	 * @return string Normalized path.
	 */
	public static function wp_normalize_path($path) {
		// wp_normalize_path is not present before WP 3.9
		if (function_exists('wp_normalize_path')) return wp_normalize_path($path);
		// Taken from WP 4.6
		$path = str_replace('\\', '/', $path);
		$path = preg_replace('|(?<=.)/+|', '/', $path);
		if (':' === substr($path, 1, 1)) {
			$path = ucfirst($path);
		}
		return $path;
	}

	/**
	 * Given a set of times, find details about the maximum
	 *
	 * @param Array	  $time_passed - a list of times passed, with numerical indexes
	 * @param Integer $upto		   - last index to consider
	 * @param Integer $first_run   - first index to consider
	 *
	 * @return Array - a list with entries, in order: maximum time, list in string format, how many run times were found
	 */
	public static function max_time_passed($time_passed, $upto, $first_run) {
		$max_time = 0;
		$timings_string = "";
		$run_times_known = 0;
		for ($i = $first_run; $i <= $upto; $i++) {
			$timings_string .= "$i:";
			if (isset($time_passed[$i])) {
				$timings_string .= round($time_passed[$i], 1).' ';
				$run_times_known++;
				if ($time_passed[$i] > $max_time) $max_time = round($time_passed[$i]);
			} else {
				$timings_string .= '? ';
			}
		}
		return array($max_time, $timings_string, $run_times_known);
	}
	
	/**
	 * Determine if a given string ends with a given substring.
	 *
	 * @param  string $haystack string
	 * @param  string $needle   substring which should be checked at the end of the string
	 * @return boolean Whether string ends with the substring or not
	 */
	public static function str_ends_with($haystack, $needle) {
		if (substr($haystack, - strlen($needle)) == $needle) return true;
		return false;
	}

	/**
	 * Returns a random string of given length.
	 *
	 * @param  string $length integer
	 * @return string random string
	 */
	public static function generate_random_string($length = 2) {
		$characters = '0123456789abcdefghijklmnopqrstuvwxyz';
		$characters_length = strlen($characters);
		$random_string = '';
		for ($i = 0; $i < $length; $i++) {
			$random_string .= $characters[rand(0, $characters_length - 1)];
		}
		return $random_string;
	}
}
¿Qué es la limpieza dental de perros? - Clínica veterinaria


Es la eliminación del sarro y la placa adherida a la superficie de los dientes mediante un equipo de ultrasonidos que garantiza la integridad de las piezas dentales a la vez que elimina en profundidad cualquier resto de suciedad.

A continuación se procede al pulido de los dientes mediante una fresa especial que elimina la placa bacteriana y devuelve a los dientes el aspecto sano que deben tener.

Una vez terminado todo el proceso, se mantiene al perro en observación hasta que se despierta de la anestesia, bajo la atenta supervisión de un veterinario.

¿Cada cuánto tiempo tengo que hacerle una limpieza dental a mi perro?

A partir de cierta edad, los perros pueden necesitar una limpieza dental anual o bianual. Depende de cada caso. En líneas generales, puede decirse que los perros de razas pequeñas suelen acumular más sarro y suelen necesitar una atención mayor en cuanto a higiene dental.


Riesgos de una mala higiene


Los riesgos más evidentes de una mala higiene dental en los perros son los siguientes:

  • Cuando la acumulación de sarro no se trata, se puede producir una inflamación y retracción de las encías que puede descalzar el diente y provocar caídas.
  • Mal aliento (halitosis).
  • Sarro perros
  • Puede ir a más
  • Las bacterias de la placa pueden trasladarse a través del torrente circulatorio a órganos vitales como el corazón ocasionando problemas de endocarditis en las válvulas. Las bacterias pueden incluso acantonarse en huesos (La osteomielitis es la infección ósea, tanto cortical como medular) provocando mucho dolor y una artritis séptica).

¿Cómo se forma el sarro?

El sarro es la calcificación de la placa dental. Los restos de alimentos, junto con las bacterias presentes en la boca, van a formar la placa bacteriana o placa dental. Si la placa no se retira, al mezclarse con la saliva y los minerales presentes en ella, reaccionará formando una costra. La placa se calcifica y se forma el sarro.

El sarro, cuando se forma, es de color blanquecino pero a medida que pasa el tiempo se va poniendo amarillo y luego marrón.

Síntomas de una pobre higiene dental
La señal más obvia de una mala salud dental canina es el mal aliento.

Sin embargo, a veces no es tan fácil de detectar
Y hay perros que no se dejan abrir la boca por su dueño. Por ejemplo…

Recientemente nos trajeron a la clínica a un perro que parpadeaba de un ojo y decía su dueño que le picaba un lado de la cara. Tenía molestias y dificultad para comer, lo que había llevado a sus dueños a comprarle comida blanda (que suele ser un poco más cara y llevar más contenido en grasa) durante medio año. Después de una exploración oftalmológica, nos dimos cuenta de que el ojo tenía una úlcera en la córnea probablemente de rascarse . Además, el canto lateral del ojo estaba inflamado. Tenía lo que en humanos llamamos flemón pero como era un perro de pelo largo, no se le notaba a simple vista. Al abrirle la boca nos llamó la atención el ver una muela llena de sarro. Le realizamos una radiografía y encontramos una fístula que llegaba hasta la parte inferior del ojo.

Le tuvimos que extraer la muela. Tras esto, el ojo se curó completamente con unos colirios y una lentilla protectora de úlcera. Afortunadamente, la úlcera no profundizó y no perforó el ojo. Ahora el perro come perfectamente a pesar de haber perdido una muela.

¿Cómo mantener la higiene dental de tu perro?
Hay varias maneras de prevenir problemas derivados de la salud dental de tu perro.

Limpiezas de dientes en casa
Es recomendable limpiar los dientes de tu perro semanal o diariamente si se puede. Existe una gran variedad de productos que se pueden utilizar:

Pastas de dientes.
Cepillos de dientes o dedales para el dedo índice, que hacen más fácil la limpieza.
Colutorios para echar en agua de bebida o directamente sobre el diente en líquido o en spray.

En la Clínica Tus Veterinarios enseñamos a nuestros clientes a tomar el hábito de limpiar los dientes de sus perros desde que son cachorros. Esto responde a nuestro compromiso con la prevención de enfermedades caninas.

Hoy en día tenemos muchos clientes que limpian los dientes todos los días a su mascota, y como resultado, se ahorran el dinero de hacer limpiezas dentales profesionales y consiguen una mejor salud de su perro.


Limpiezas dentales profesionales de perros y gatos

Recomendamos hacer una limpieza dental especializada anualmente. La realizamos con un aparato de ultrasonidos que utiliza agua para quitar el sarro. Después, procedemos a pulir los dientes con un cepillo de alta velocidad y una pasta especial. Hacemos esto para proteger el esmalte.

La frecuencia de limpiezas dentales necesaria varía mucho entre razas. En general, las razas grandes tienen buena calidad de esmalte, por lo que no necesitan hacerlo tan a menudo e incluso pueden pasarse la vida sin requerir una limpieza. Sin embargo, razas pequeñas como el Yorkshire o el Maltés, deben hacérselas todos los años desde cachorros si se quiere conservar sus piezas dentales.

Otro factor fundamental es la calidad del pienso. Algunas marcas han diseñado croquetas que limpian la superficie del diente y de la muela al masticarse.

Ultrasonido para perros

¿Se necesita anestesia para las limpiezas dentales de perros y gatos?

La limpieza dental en perros no es una técnica que pueda practicarse sin anestesia general , aunque hay veces que los propietarios no quieren anestesiar y si tiene poco sarro y el perro es muy bueno se puede intentar…… , pero no se va a poder pulir ni acceder a todas la zona de la boca …. Además los limpiadores dentales van a irrigar agua y hay riesgo de aspiración a vías respiratorias si no se realiza una anestesia correcta con intubación traqueal . En resumen , sin anestesia no se va hacer una correcta limpieza dental.

Tampoco sirve la sedación ya que necesitamos que el animal esté totalmente quieto, y el veterinario tenga un acceso completo a todas sus piezas dentales y encías.

Alimentos para la limpieza dental

Hay que tener cierto cuidado a la hora de comprar determinados alimentos porque no todos son saludables. Algunos tienen demasiado contenido graso, que en exceso puede causar problemas cardiovasculares y obesidad.

Los mejores alimentos para los dientes son aquellos que están elaborados por empresas farmacéuticas y llevan componentes químicos con tratamientos específicos para el diente del perro. Esto implica no solo limpieza a través de la acción mecánica de morder sino también un tratamiento antibacteriano para prevenir el sarro.

Conclusión

Si eres como la mayoría de dueños, por falta de tiempo , es probable que no estés prestando la suficiente atención a la limpieza dental de tu perro. Por eso te animamos a que comiences a limpiar los dientes de tu perro y consideres atender a su higiene bucal con frecuencia.

Estas simples medidas pueden conllevar a que tu perro tenga una vida más larga y mucho más saludable.

Si te resulta imposible introducir un cepillo de dientes a tu perro en la boca, pásate con él por clínica Tus Veterinarios y te explicamos cómo hacerlo.

Necesitas hacer una limpieza dental profesional a tu mascota?
Llámanos al 622575274 o contacta con nosotros

Deja un comentario

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *

¡Hola!