Category: PHP

CMS PHP WordPress

Buffering WordPress rendered page

if( current_user_can(‘manage_options’) ) { add_action(‘template_redirect’, ‘YOURPLUGIN_buffer_start’, 0); } function YOURPLUGIN_buffer_start() { add_action(‘shutdown’, ‘YOURPLUGIN_buffer_stop’, PHP_INT_MAX); ob_start(‘YOURPLUGIN_modify_content’); } function YOURPLUGIN_buffer_stop() { ob_end_flush(); } function YOURPLUGIN_modify_content($content) { $dom = new DomDocument(); $dom->loadHTML($content); $styles=array(); foreach ($dom->getElementsByTagName(‘link’) as $node) { if($node->hasAttribute(‘rel’) && $node->getAttribute(‘rel’)==’stylesheet’ ) { $styles[]=$node->getAttribute(“href”); } } //modify $content return serialize($styles).$content; }

PHP Yii

Yii2 installation digest

this is based on freetuts.org and the Yii forum site… Let’s start by installing Composer for Windows. Download the installer and run it. Installer will ask you to locate php.exe. If you are using xampp, browse to : C:\xampp\php\   and select the purple php file, that is php.exe. If you are using wamp, browse […]

PHP

PHP Execution Timeout Digest

Setting the PHP execution limit in php.ini max_execution_time = 600 =========== Using PHP: <?php // set the PHP timelimit to 10 minutes set_time_limit(600); ?> <?php ini_set(‘max_execution_time’,600); ?>   Override PHP execution time in .htaccess file php_value max_execution_time 600      

PHP

Webservice Digest (Soap,REST,…)

The soap and wsdl testers: soapui.org http://www.plumvoice.com/soaptester/ http://wsdlbrowser.com ============== JSON tester: http://json.parser.online.fr/beta/

PHP

PHP type comparison tables Digest

Comparisons of $x with PHP functions Expression gettype() empty() is_null() isset() boolean : if($x) $x = “”; string TRUE FALSE TRUE FALSE $x = null; NULL TRUE TRUE FALSE FALSE var $x; NULL TRUE TRUE FALSE FALSE $x is undefined NULL TRUE TRUE FALSE FALSE $x = array(); array TRUE FALSE TRUE FALSE $x = […]