PHP

PHP, source code, scripts, developing, tips & hints

Simple email function for PHP

1

Simple function to send an email in PHP, and that actually works ;)

Just be aware that I added a Hook (check the PHP Hook class).
(more…)

Help Wanted: Open Classifieds 2.0.

0

Hello Friends,

Since long time a go I’ve been thinking in the future of OC and we need to move forward to grow more ;)

I think right now OC is a great product and is helping a lot of people, more than 100K downloads and thousands of sites running this software are the best indicators.

The biggest problem as development team we’ve been facing is the scalability of the code. This started as an small script with really limited functionality, that I used to learn PHP. Not best practices implemented and lot of technological debt that needs to be paid.
(more…)

PHP Hook System

9

You know the hooks for WordPress? So here you have a simple workaround to achieve a similar aproach to what WordPress does.

Usage and instuctions

//Adding action to a hoook:
Hook::add_action('unique_name_hook','some_class::hook_test');
//OR shortcut:
add_action('unique_name_hook','other_class::hello');
add_action('unique_name_hook','some_public_function');
 
//Performing all the actions for the hook
do_action('unique_name_hook');//you can use too Hook::do_action();

(more…)

PHP – Garbage Collector

0

Memory cleanup for long-running scripts.

gc_enable(); // Enable Garbage Collector
var_dump(gc_enabled()); // true
var_dump(gc_collect_cycles()); // # of elements cleaned up
gc_disable(); // Disable Garbage Collector

More info:

http://php.net/manual/en/features.gc.php

http://es.php.net/manual/en/function.gc-collect-cycles.php

Via: http://talks.php.net/show/pbc11/25

PHP Timezones selector

0

Long time a go I wrote about how to get timezones selector.

Well here there’s an improve way to get this select, with few options.

Result:

Usage:

echo get_select_timezones('TIMEZONE',date_default_timezone_get());

(more…)

PHP currying – delayed argument binding

0

To access a local variable within a callback, use currying (delayed argument binding). For example

function curry($func, $arity) { 
    return create_function('', " 
        \$args = func_get_args(); 
        if(count(\$args) >= $arity) 
            return call_user_func_array('$func', \$args); 
        \$args = var_export(\$args, 1); 
        return create_function('',' 
            \$a = func_get_args(); 
            \$z = ' . \$args . '; 
            \$a = array_merge(\$z,\$a); 
            return call_user_func_array(\'$func\', \$a); 
        '); 
    "); 
} 
 
function sum($a, $b) { 
    return $a + $b; 
} 
 
$sum = curry('sum', 2); 
$plus5 = $sum(5); 
echo $plus5(10); // 15 
 
$map = curry('array_map', 2); 
$toupper = $map('strtoupper'); 
$ary = array('haskell', 'curry',); 
print_r($toupper($ary)); // HASKELL CURRY

via http://www.sitepoint.com/forums/showthread.php?336758-example-of-a-callback-in-PHP

Or perfect for preg_replace_callback: (more…)

rir.li no image hotlinking 1.0

0

After soooo long time new release for rir.li software.

Check more info here.

Updated phpSEO class v0.3

0

Please update to this new improved file ;)

http://neo22s.com/phpseo/

PHP Code Generator (firebird, active record, activeRecord)

0

PHP Code Generator (firebird, active record, activeRecord) – http://j.mp/hSJ5Ki

REST Server (rest, router) – PHP Classes

0

REST Server (rest, router) – PHP Classes – http://j.mp/hZ6q5x

Page 1 of 1012345...10...Last »
Go to Top