Tag Archives: php

How to make WordPress Plugin step by step

by in on

WordPress is the one of the best platform for blogging. You can easily customize it according to you or your client’s requirement. WordPress provides you to creating it’s Plugin facility for easily customization without changing the Core part of WordPress. So in this post we are talking about the make WordPress plugin.

Important things for your Plugin are:

  • Choose a unique name for your WordPress plugin if possible.
  • Create the PHP file with the name gain from your WordPress Plugin name.

Random password generator with php

by in on

In this post we are just creating a PHP function that provide us a random password string. This Password string is the combination of small and capital alphabets and digits, that help us to generate random password string. To generate the random password we are using here mt_rand() a PHP function. We can also use rand(), because both the functions provide the random strings but mt_rand() providing four time better random string then rand() function.

Base64 encoding format for images

by in , on

Today we are taking about the new base64 encoding format for displaying the image or a collection of images. If you have the images with large size then it will take more time to load on the page, base64 encoding provide you the string which will contain all the image data, and load in minimum time on the page. Actually base64_encode() represent the binary data into into an ASCII string format. As you see google also uses the string format for the images to prevent from the server load. You will use this base64 encoded string in ‘img’ tag something like this:

Creating zip file archives in php

by in on

In this post we are talking about to creating zip file in PHP. It’s very simple to create zip file, similar to creating in desktop. There is one more logic behind to creating zip file, if you want give some stuff for download to your users, then you have to upload completely zip file in your server then provide the download link over it.

But with the use of this function you just have to give the files that you want to store in zip and the name of the zip file that you want to create, yes you will create a single zip file with the collection of files. As you see in the below codes i have created a simple form and with the use of check-box i have given the choice for the files that you want to add in the zip file, and then all the rest work depending on the PHP.

Short a string without cutting words

by in on

I develop this function to short the string without cutting the words. As we now that PHP’s substr() function only provide the part of the string, substr() function provide the string between the two parameters, start from and end to.

So I need a function that provide the string arround the given starting from and end to range. Below given function provide the arround complete word from the string. This function check the nearest space into the string and provide the nearest word without cutting. If you guys have a better alternative then please feel free to share the codes in the comment section.

Access Cross Domain feeds with PHP

by in , , on

Now easy to access and display cross domain feeds with php. With the use of DOMDocument() class we can easy access the feeds. In this given example I have fetched only the title and the link from the feeds. First of all start with the path from where you want to access the feeds, make sure that your path will be full with the complete URL, like I have mentioned on the given example. Then simply access the Tag of that feed/xml file with the member function getElementsByTagName(), and follow the code :