Skip to content

Instantly share code, notes, and snippets.

View joelmiguelvalente's full-sized avatar
😎

Miguel92 joelmiguelvalente

😎
View GitHub Profile
<?php
/**
* Smarty plugin
*
* @package Smarty
* @subpackage PluginsModifierCompiler
*/
/**
* Smarty unescape modifier plugin
@joelmiguelvalente
joelmiguelvalente / modifier.unescape.php
Created October 23, 2019 19:32
Este es para Smarty 2
<?php
function smarty_modifier_unescape($str = '') {
$arr = array(
"&lt;" => "<",
"&gt;" => ">",
"&quot;" => '"',
"&amp;" => "&",
"&#92;" => chr(92),
"&#39" => chr(39),
@joelmiguelvalente
joelmiguelvalente / timthumb.php
Last active October 31, 2019 18:37
Para reducir el tamaño de la imagen
<?php
/**
* TimThumb by Ben Gillbanks and Mark Maunder
* Based on work done by Tim McDaniels and Darren Hoyt
* http://code.google.com/p/timthumb/
*
* GNU General Public License, version 2
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Examples and documentation available on the project homepage
@joelmiguelvalente
joelmiguelvalente / Openssl.md
Last active November 9, 2019 14:06
Seguridad OPENSSL [encrypy & decrypt]

/* PARA AGREGAR EN EL HEADER.PHP, SOLO SI USA SMARTY */

define('COD', '/* TIPO DE SEGURIDAD */'); 
define('KEY', '/* LLAVE DE SEGURIDAD DESEADA O PASSWORD */');


/* OpenSSL Encrypt */
function smarty_modifier_openssl_encrypt($string, $cod = COD, $key = KEY){
	return openssl_encrypt($string, $cod, $key);
}
/**
* Plugins globales que utilizará el script.
* Los plugins: (fueron obtenidos desde https://locutus.io/php/)
* # Empty
* # Htmlspecialchars_decode
* # Number_format
* # Base64_encode
*/
empty = n => {let e,r,t;const f=[undefined,null,!1,0,"","0"];for(r=0,t=f.length;r<t;r++)if(n===f[r])return!0;if("object"==typeof n){for(e in n)if(n.hasOwnProperty(e))return!1;return!0}return!1}
htmlspecialchars_decode = (e,E) => {let T=0,_=0,t=!1;void 0===E&&(E=2),e=e.toString().replace(/&lt;/g,"<").replace(/&gt;/g,">");const c={ENT_NOQUOTES:0,ENT_HTML_QUOTE_SINGLE:1,ENT_HTML_QUOTE_DOUBLE:2,ENT_COMPAT:2,ENT_QUOTES:3,ENT_IGNORE:4};if(0===E&&(t=!0),"number"!=typeof E){for(E=[].concat(E),_=0;_<E.length;_++)0===c[E[_]]?t=!0:c[E[_]]&&(T|=c[E[_]]);E=T}return E&c.ENT_HTML_QUOTE_SINGLE&&(e=e.replace(/&#0*39;/g,"'")),t||(e=e.replace(/&quot;/g,'"')),e=e.replace(/&amp;/g,"&")}
/**
* jscolor - JavaScript Color Picker
*
* @link http://jscolor.com
* @license For open source use: GPLv3
* For commercial use: JSColor Commercial License
* @author Jan Odvarko
* @version 2.0.5
*
* See usage examples at http://jscolor.com/examples/
/* Jcrop.min.js v2.0.4 - Copyright 2008-2015 Tapmodo Interactive LLC */
!function(a){"use strict";var b=function(c,d){var e=navigator.userAgent.toLowerCase();this.opt=a.extend({},b.defaults,d||{}),this.container=a(c),this.opt.is_msie=/msie/.test(e),this.opt.is_ie_lt9=/msie [1-8]\./.test(e),this.container.addClass(this.opt.css_container),this.ui={},this.state=null,this.ui.multi=[],this.ui.selection=null,this.filter={},this.init(),this.setOptions(d),this.applySizeConstraints(),this.container.trigger("cropinit",this),this.opt.is_ie_lt9&&(this.opt.dragEventTarget=document.body)};a.extend(b,{component:{},filter:{},stage:{},registerComponent:function(a,c){b.component[a]=c},registerFilter:function(a,c){b.filter[a]=c},registerStageType:function(a,c){b.stage[a]=c},attach:function(b,c){var d=new a.Jcrop(b,c);return d},imgCopy:function(a){var b=new Image;return b.src=a.src,b},imageClone:function(c){return a.Jcrop.supportsCanvas?b.canvasClone(c):b.imgCopy(c)},canvasClone:function(b){var c=document.createElement("canvas")
/* TableDnD plug-in for JQuery */
!function(t,e,a,n){var i="touchstart mousedown",r="touchmove mousemove",l="touchend mouseup";t(a).ready(function(){function e(t){for(var e={},a=t.match(/([^;:]+)/g)||[];a.length;)e[a.shift()]=a.shift().trim();return e}t("table").each(function(){"dnd"===t(this).data("table")&&t(this).tableDnD({onDragStyle:t(this).data("ondragstyle")&&e(t(this).data("ondragstyle"))||null,onDropStyle:t(this).data("ondropstyle")&&e(t(this).data("ondropstyle"))||null,onDragClass:void 0===t(this).data("ondragclass")?"tDnD_whileDrag":t(this).data("ondragclass"),onDrop:t(this).data("ondrop")&&new Function("table","row",t(this).data("ondrop")),onDragStart:t(this).data("ondragstart")&&new Function("table","row",t(this).data("ondragstart")),onDragStop:t(this).data("ondragstop")&&new Function("table","row",t(this).data("ondragstop")),scrollAmount:t(this).data("scrollamount")||5,sensitivity:t(this).data("sensitivity")||10,hierarchyLevel:t(this).data("hierarchylevel")||0,indentArtifact:t(this).data("indent
/*! modernizr 3.6.0 (Custom Build) | MIT *
* https://modernizr.com/download/?-cookies-htmlimports-mediaqueries-notification-setclasses !*/
!function(e,n,t){function o(e,n){return typeof e===n}function i(){var e,n,t,i,r,s,a;for(var l in u)if(u.hasOwnProperty(l)){if(e=[],n=u[l],n.name&&(e.push(n.name.toLowerCase()),n.options&&n.options.aliases&&n.options.aliases.length))for(t=0;t<n.options.aliases.length;t++)e.push(n.options.aliases[t].toLowerCase());for(i=o(n.fn,"function")?n.fn():n.fn,r=0;r<e.length;r++)s=e[r],a=s.split("."),1===a.length?Modernizr[a[0]]=i:(!Modernizr[a[0]]||Modernizr[a[0]]instanceof Boolean||(Modernizr[a[0]]=new Boolean(Modernizr[a[0]])),Modernizr[a[0]][a[1]]=i),c.push((i?"":"no-")+a.join("-"))}}function r(e){var n=h.className,t=Modernizr._config.classPrefix||"";if(m&&(n=n.baseVal),Modernizr._config.enableJSClass){var o=new RegExp("(^|\\s)"+t+"no-js(\\s|$)");n=n.replace(o,"$1"+t+"js$2")}Modernizr._config.enableClasses&&(n+=" "+t+e.join(" "+t),m?h.className.baseVal=n:h.className=n)}function s
@joelmiguelvalente
joelmiguelvalente / config.header.php
Last active January 20, 2020 18:39
Archivo de configuración que va incluido dentro de header.php
<?php
/*
CONFIGURACIÓN PARA INCLUIR EN HEADER.PHP
* @author Miguel92
* @copyright 2020
*/
/*
* -------------------------------------------------------------------
* DEFINIMOS EL DIRECTORIO DE LA CARPETA TEMPLATES
* -------------------------------------------------------------------