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; }


Yii2 installation digest

this is based on 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 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      


Webservice Digest (Soap,REST,…)

The soap and wsdl testers: ============== JSON tester:


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 = […]