ZENDFRAMEWORK SCRIPTS
All
Helper to generate a random key
Generate a password or a random key (I use it to confirm newsletter unsubscribe) <?php //use $row->clau = $this->_helper->getHelper('Password')->generate(10, 20); class Helper_Password extends...Redirect depending on the language
We choose the best language between possible languages and between languages that the browser accepts
Usage:
$accepted = $this->_helper->getHelper('Language')->accepted();
$optimal =...
Search with Zend_Lucene and Doctrine
Extends php doctrine record for search with Zend_Lucene
Usage:
1.- Replace base model:
Ex:
replace
abstract class BaseBlacklisted extends Doctrine_Record
with
abstract class BaseBlacklisted extends...
Obfuscate php code
A class to obfuscate php code:
if (!defined('T_ML_COMMENT')) {
define('T_ML_COMMENT', T_COMMENT);
} else {
define('T_DOC_COMMENT', T_ML_COMMENT);
}
class ofusca {
var $target =...
Function to split the words of a string with invisible chars
Function to split the words of a string with invisible chars function trunk($texto) { $largomax = 10; $arrayTexto = explode(' ',$texto); $texto2=''; for($n=0;$n<count($arrayTexto);$n++) { if...Generate unique identifier for a friendly url
class Helper_Mid extends Zend_Controller_Action_Helper_Abstract { function get($seed, $table = null) { $temp = preg_replace('/[\W|_]{1,}/','-', $seed); $temp = preg_replace('/[^a-zA-Z0-9-]/', '',...A parser to convert some tags in a proper html
Pz_View_Filter_Tags is a parser to convert some tags in a proper html. Usage: $filter = new Pz_View_Filter_Tags(); $text = '[code]sample text[/code]' echo $filter->filter($text); Code: <?php class...Extract mysql date to spanish format
Extract mysql to spanish format
Usage:
$this->_helper->getHelper('Dates')->toSpanish($data);
Code:
<?php
class Helper_Dates extends Zend_Controller_Action_Helper_Abstract {
function toSpanish($fecha) {
...
1