Archive for the php Category

Mar 7 2014

WordPress Plugin – Menu Obfuscator

Time to time a customer complains that WordPress admin area has way more areas than the one he needs to see, and even after playing with user roles, he just keeps complaining about it.

To fix this i just created a very simple WP plugin to obfuscate WP admin menu’s user by user.

Selecting a user 


Mar 1 2012

PHP 5.4 Officially released

PHP 5.4 was officially released as a stable version. There are some new features on this PHP version, but maybe the surprisingly one is: it comes with a built-in web server for development purposes.

What’s new on PHP 5.4 (Key Features) :

  • Traits
  • Shortened Array Syntax
  • Built-in web server for development purposes


Apr 13 2011

Magento removing admin notifications – Quick tip

If you are a developer and need to login into Magento admin area, you’ll get sick of popup notifications messages all the time. Removing such messages is a straigh forward process.

Just go to System -> Configuration

Select Advanced from the bottom left column

Look for Mage_AdminNotification option, and select Disable from the drop-down.

And that’s it.

Let me know what tips do you want to see about magento.

Jan 24 2011

Zend Framework : Sending emails using Zend_Mail and Google Smtp

Sending emails using Zend_Mail component from Zend Framework is an easy as it can get task. On a recent project, i needed to configure Zend_Mail to work with Google Smtp server.

Here is a quick how to:

$settings = array('ssl'=>'ssl',
                                'auth' => 'login',
                                'username' => '[email protected]',
                                'password' => 'YOUR_PASSWORD');
                $transport = new Zend_Mail_Transport_Smtp('', $settings);
                $email_from = "YOUR_EMAIL";
                $name_from = "YOUR NAME";
                $email_to = "TO_EMAIL";
                $name_to = "TO NAME";
                $mail = new Zend_Mail ();
                $mail->setReplyTo($email_from, $name_from);
                $mail->setFrom ($email_from, $name_from);
                $mail->addTo ($email_to, $name_to);
                $mail->setSubject ('Testing email using google accounts and Zend_Mail');
                $mail->setBodyText ("Email body");

Don’t even bother to add a different email to $email_from than your Google email, because Google will override your settings by you account email.

Update: Got a tip from Bruno Pedro, Google has smtp sending limits, you can only send up to 500 emails using a Google standard account. Read the Google answer on this limiting issue, for more info.

For a more detailed look, just check out Zend_Mail component page.

Nov 4 2010

Revisiting PHP 5.3 __invoke magic method

PHP version 5.3 introduced a new magic method designed __invoke, this method is called when a script tries to call an object as a function.

The __invoke magic method

< ?php
class Car {
	public function __invoke($v) 
		echo "Just called object as function with parameter '".$v."'\n";
$c	=	new Car;
// Just to make sure we have an object
echo "I am an object of type: ".get_class($c)."\n";
// Now let's use it as a function