This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function mssql_real_escape_string($data) { | |
$data = stripslashes(trim($data)); | |
$data = strip_tags($data); | |
if ( !isset($data) or empty($data) ) return ''; | |
if ( is_numeric($data) ) return $data; | |
$non_displayables = array( | |
'/%0[0-8bcef]/', // url encoded 00-08, 11, 12, 14, 15 | |
'/%1[0-9a-f]/', // url encoded 16-31 | |
'/[\x00-\x08]/', // 00-08 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function cssjs_nocache($url){ | |
global $baseHref, $basePath; | |
return $baseHref . $url . '?' . @filemtime($basePath . $url); | |
} | |
/* | |
como usar: | |
<link href="<?php echo cssjs_nocache('/lib/bootstrap/css/bootstrap.min.css'); ?>" rel="stylesheet"> | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function getError(){ | |
require_once "/PHPMailer/class.phpmailer.php"; | |
$erro = "Prezado programador, | |
ocorreu um erro interno em nosso sistema: | |
ArquivoSelf = " . $_SERVER['PHP_SELF'] . " |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* as chaves são geradas por um MD5() | |
*/ | |
define(VAR_HERE, "75cb5a1be17e7d5715266888fe3845a3c6a9"); | |
/** | |
* FUNCAO PARA CRIPTOGRAFAR URL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//AutoLoader do Composer | |
$loader = require __DIR__.'/vendor/autoload.php'; | |
//vamos adicionar nossas classes ao AutoLoader | |
$loader->add('DoctrineNaPratica', __DIR__.'/src'); | |
use Doctrine\ORM\Tools\Setup; | |
use Doctrine\ORM\EntityManager; | |
use Doctrine\ORM\Mapping\Driver\AnnotationDriver; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// cli-config.php | |
require_once 'bootstrap.php'; | |
$helperSet = new \Symfony\Component\Console\Helper\HelperSet(array( | |
'db' => new \Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper($entityManager->getConnection()), | |
'em' => new \Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper($entityManager) | |
)); | |
return $helperSet; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Camada - Controller | |
* Diretório Pai - lib | |
* Arquivo - Application.php | |
**/ | |
/** | |
* Essa função garante que todas as classes | |
* da pasta lib serão carregadas automaticamente |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Controlador que deverá ser chamado quando não for | |
* especificado nenhum outro | |
* | |
* @package Exemplo simples com MVC | |
* @author DigitalDev | |
* @version 0.1.1 | |
* | |
* Camada - Controladores ou Controllers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Essa classe é responsável por renderizar os arquivos HTML | |
* | |
* @package Exemplo simples com MVC | |
* @author DigitalDev | |
* @version 0.1.1 | |
* | |
* Diretório Pai - lib | |
* Arquivo - View.php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<snippet> | |
<content><![CDATA[public function get${1/(.*)/\u$1/}() | |
{ | |
return \$this->${1:$SELECTION}; | |
} | |
public function set${1/(.*)/\u$1/}(\$$1) | |
{ | |
return \$this->$1 = \$$1; | |
} |
OlderNewer