php

How to update php cli in DirectAdmin

Check the current version PHP CLI version in shell From the official DirectAdmin help page ,https://help.directadmin.com/item.php?id=2094 the way to install multiple version of PHP in the machine. Set the php1_release to the version The version to set as the php1_release will be the version in CLI You may modify the /usr/local/directadmin/custombuild/options.conf Re-compile all the PHP …

How to update php cli in DirectAdmin Read More »

System error ‘[security.WindMcryptCbc.encrypt] extension ‘mcrypt’ is not loaded.’.

I don’t like error, but I have to fix the error, I note down here to do reference. I’m using CentOS 7, I think cause by upgraded from PHP 5 to PHP 7. I’m using DirectAdmin. What I found from internet The mcrypt extension has been abandonware for nearly a decade now, and was also …

System error ‘[security.WindMcryptCbc.encrypt] extension ‘mcrypt’ is not loaded.’. Read More »

Create WordPress widget template from scratch

I’ve save down the most basic widget code for WordPress, you can copy this to your plugin and modify it to start your first widget. You can save time on this tutorial to help you create wordpress widget from scratch. [code lang=”php”] <?php class example_widget extends WP_Widget { function __construct() { parent::__construct(false, $name = ‘Example …

Create WordPress widget template from scratch Read More »

Convert Text to Slug URL in PHP

Convert Text to slug URL, example: Brown & Cony’s Secret Date! will become: brown-conys-secret-date Will be nice url. [php] function slug_url($text) { // replace non letter or digits by – $text = preg_replace(‘~[^\\pL\d]+~u’, ‘-‘, $text); // trim $text = trim($text, ‘-‘); // transliterate $text = iconv(‘utf-8’, ‘us-ascii//TRANSLIT’, $text); // lowercase $text = strtolower($text); // remove …

Convert Text to Slug URL in PHP Read More »

Country Code in Array with PHP Value

Just copy and paste into your code to use the country code. [php] <?php $countries = array ( ‘AF’ => ‘Afghanistan’, ‘AX’ => ‘Aland Islands’, ‘AL’ => ‘Albania’, ‘DZ’ => ‘Algeria’, ‘AS’ => ‘American Samoa’, ‘AD’ => ‘Andorra’, ‘AO’ => ‘Angola’, ‘AI’ => ‘Anguilla’, ‘AQ’ => ‘Antarctica’, ‘AG’ => ‘Antigua And Barbuda’, ‘AR’ => ‘Argentina’, …

Country Code in Array with PHP Value Read More »