The Singleton Design Patterns

In the world of software engineering singleton pattern is a design pattern that restricts the instantiation of a class to one object. To make it simpler Singleton Pattern ensures that there can be once a single instance to a class. For many WordPress developers in the world these patterns are a complete no-no and they term it as “anti-pattern”. Some claim it’s an overused pattern however overuse doesn’t make it wrong. The only thing that the developers need to keep in mind is to use these patterns very judicious. For instance if you are building a helper class or library with your theme this isn’t a great concept; but in case of plugin development it can be very useful.

Singleton Design Patterns

Image Source: Stock Photo by Shutterstock

You Have Used It

No matter what the arguments against Singleton Patterns are most developers have made extensive use of it. Each time you’ve used the global keyword in WordPress for framework-wide constructs such as $wpdb and $wp_rewrite you have made use of Singleton Patters. You can argue that these objects don’t implement Singleton design pattern in the true sense but the counter argument is that the intent and purpose of your use meets the definition. The objects that we have mentioned above are instantiated only once during WordPress request-response cycle’s lifetime. Apart from this you would never call wpdb() in your themes and plugins; what you do instead is make a reference to the global $wpdb object that WordPress set up for you. What kind of design pattern would you rate that as if not Singleton Pattern?

Secondly you would never want more than one connection to your database at any given point of time as this is likely to cause memory bloat. Only one instance of database connection is active at any given point of time. This is cost effective as it will relieve you from instantiating multiple copies of objects. This is another instance where you have made use of Singleton Design Patterns.

How It Impacts WordPress Development?

As a WordPress developer you would know that there are only few ways to instantiate plugins. Let us take a look at these ways and means.

  • - One can instantiate a plugin at the bottom of the plugin file, however this often leads to an orphaned object.
  • - You can also stick the plugin in the PHP $GLOBALS collection. But this puts you in a risky zone as you could trash something that already exists or makes the collection needlessly larger.
  • - If you instantiate with each page load then the data is not persisted unless you put it into a serial order and hammer the database every single time.

All of these are good strategies but not the best. It is wiser for a developer to look for a strategy that doesn’t merely work but adds to the robustness of the project. This is where Singleton Design Patterns come into play in WordPress development.

How To Implement It?

Read More

Manipulate the Time Through Faded and Light Leak Photoshop Actions

Isn’t it a good day to play with Photoshop a little bit? Looking for simple clear guides to follow? Here they are for satisfaction of your professional ambitions. Today we will focus particularly on faded and light leak Photoshop actions. With the help of these clever tricks you will be able to transform an ordinary high quality photo into a retro style masterpiece. As you know, vintage images are ever in vogue.

Actually, light leak occurs when the light “leaks” into the camera, which makes the film overexpose. It can be characterized as a problem of old cameras. But achieving this effect artificially in Photoshop adds a really artistic touch to your image. Sometimes it is referred to as old-school, cheap camera, instagram or hipster effect.

So, what is the magic power of faded, old photos? Why do they make such deep effect on the viewer? Of course all of us have thick dusty family albums, where the most distant precious memories are stored. Vintage photos remind us about our sweet past time that will never come back, but will always warm up our souls.

Apart from emotional side, vintage photos are very cool and trendy. This fact is well known to each photographer and web developer. A great collection of faded and light leak Photoshop actions herein under will serve a good polygon for your creative experiments with time and its influence on image appearance.

* * *

Free Faded and Hazy Photoshop Action

Faded and Light Leak Photoshop Actions

* * *

24 Ultra Faded & Light Leak Photoshop Actions

Faded and Light Leak Photoshop Actions

* * *

Read More

PHP Password Hashing to Prevent Attackers

Security is one the major factors that every programmer or user of web applications that involves communication has to consider. Hacking of systems is a very common phenomenon today and thus programmers are putting various measures in place to prevent attacks from hackers. One of such measures is the use of the password hashing technique. This is a technique that involves encrypting passwords when storing them instead of storing them in the plain text form. It is a mean of secure password storage. It is very important for security as it protects the stored passwords from being read if the database is hacked or accidentally gets into the wrong hands. PHP supports password hashing to prevent attackers from gaining stored passwords from various web applications in case.

In password hashing, the user passwords in plain text are converted into hash codes before storing. A hash code is some kind of digital fingerprint of a piece of data. It is generated using a one-way algorithm. A one-way algorithm implies that it is almost impossible to perform the reverse computation using the result to obtain the original data. Hence with the hash codes it is almost impossible for anyone to obtain the original password text. Thus when passwords are stored as hashes, even if an attacker successfully compromises with part of the system and reveals the list of hash codes, he cannot manage to get the stored password.

PHP Password Hashing to Prevent Attackers

Password hashing in PHP

In PHP, password hashing is done using a number of hash algorithms. The main algorithms used for generating a hash of text are MD5, BCRYT and SHA1. These algorithms are efficient and collision rarely occurs. Collision refers to generation of the same hash code for two different texts. Pass wording hashing is performed during user registration. The same algorithm used during user registration is used during user authentication. The MD5 algorithm is implemented with the md5() function as follows:

$password =md5 ($password;

This statement creates an MD5 hash code of the password.

This function generates a 128-bit hash code out of the given password. The SHA1 is implemented in the same way using the sha1() function, and produces a 160-bit hash code. The sha1 function has lower chances of collision occurrence as than the md5 function as it produces more bit hash and the probability of collision occurrence decreases with the increase in bits. Probably you are thinking that hashing the password twice would result into a more secure password. This sounds logical but it does not work. It is something you should not try as it weakens the security of your passwords instead. It makes the hash inefficient and week as it increases the chances of collision.

As PHP has continued to evolve, these algorithms have been found less efficient and more efficient functions producing more bit hash codes are being utilized. Modern PHP is using algorithms from the SHA2 family such as the SHA256 and SHA512 which produce 256 and 512 bits hash respectively for password hashing. The functions result to better hashes with very little chance of collisions occurring. Their functions are implemented in code as follows:
Read More

Free Website Template for Wedding Site. Where Elegance Meets Style

Wedding sites are great for keeping the most precious memories of life. Besides, it’s a good opportunity to announce about the upcoming ceremony, invite guests, show the gift list and get plenty of pleasant wishes. If you’re going to start such a site, make it easily. We want to share with you a ready-made Free Website Template for Wedding Site. You don’t need any extra skills to redesign it, ‘cause it is done by professional designers with your needs in mind. This theme is perfect for wedding site, but can be easily customized according to the needs of any other online business.

This sophisticated and beautiful style is a synonym for romance. The subtle rosy colors create pleasant on the eye tone and welcome the viewers to enter the site. Thought-out navigation with drop down menu and graphic elements that easily guide through the page facilitate the work with the site. Nice slider in the top features the best moments of couple’s life and gallery is ready for presenting the photos from the wedding ceremony. The theme goes with sections where the guests can read love story of a couple and find the gift list. To see how this elegant design will look like as a real website, check out its free template live demo.

Follow the link below to get this goodie, and start a wedding site easily!

Free Website Template for Wedding Site:

Feel free to get this free website template with PSD source files. To download this theme with PSD files, visit the Free Website Template for Wedding Site download page at TemplateMonster and type an email address that you want the free template package to be delivered to (don’t forget to uncheck the newsletter subscription checkbox in case you’re already subscribed, otherwise you may not be able to download the zip file). Feel free to use this template for your business, but you cannot resell it as a template.

Download Free Website Template for Wedding Site with PSD files (49,6MB)

IMPORTANT NOTICE:TemplateMonster does not provide support services on free templates – including this one. We only provide support for the products that are being purchased from TemplateMonster. Our free templates are produced according to the latest web standards and we’ve been trying to make the process of working with them as easy as possible, so for people with minimum web development experience it should be easy to work with them. However, if you don’t have any experience, we recommend you to refer to the tutorials or community forums on how to work with platforms that each respective template is made with, or to hire someone to do the job for you.

10+1 WordPress Cron Articles – Introduction, Tips, Tutorials

The nowadays pace of life makes us act and react more actively. A great assistance here can be planning. When we know exactly what we should do, we never panic trying to trump up some action. Talking about the internet the situation is similar: especially it concerns scheduling of different tasks, because it’s impossible to spend all time 24/7 on a website.

WordPress has a wonderful solution for that and it’s called WordPress Cron. Originally Cron is a UNIX command to schedule tasks. WP-Cron concept has similar functions, however a developed and adapted for WordPress conditions. It would fit either for periodical actions (for example for emailing with a blog newsletter evry week) or for daemon process (launching process, once a certain event occurs).

I believe WP-Cron is a wonderful thing to improve your WordPress website. So, let me represent 11 articles teaching to exploit this function and to develop its effectiveness. The difficulty is from easy to hard.

* * *

Insights into WP-Cron: An Introduction to Scheduling Tasks in WordPress

* * *

How To Make The WordPress Cron Work

Read More

Dose of Inspiration: 30+ Examples of 3D Typography

Since the invention of written language typography became an important thing: just remember the art of Chinese or Japan calligraphy. Times passes, epochs follow one another: but for the typography only the form changes, not the essence. Today we improve letters most widely on the internet, typography design is one of the major sections in web design.

We got used to flat typography, like we have in books, newspapers, magazines and most websites. However, information technologies give a wonderful opportunity to widen the borders and to create volumetric font. Especially they would fit some logo inscriptions and other text of slogan character. Would you like to be inspired? I gathered 30+ 3D typography examples. Enjoy.

* * *

3D by Neil Tasker

3D Typography

* * *


3D Typography

* * *


3D Typography Read More

10 Snippets HTML5 Boilerplate Should Be Used With

HTML5 Boilerplate is a remarkable front-end HTML template. This tool is definitely a great assistant for creating websites and apps – many giants use it for their needs: Barack Obama, Google, Microsoft, Nike and other. HTML5 Boilerplate is fully responsive being exactly appropriate for the latest tendencies of mobile web growing. Also there would be no troubles with a search engine optimization – Google Analytics snippet would ease the process very much. By the way, about snippets: Google Analytics is not the only one – HTML5 Boilerplate indeed can be improved by a bunch of useful code snippets. Moreover, they come out the borders of HTML5BP – many HTML templates would fit.

So, I skip the introduction to HTML5BP basic usage, because all of that you can watch on YouTube. Going further, I’d like to present 10 snippets for HTML5 Boilerplate. Let’s start from the Google Analytics.

* * *

Google Analytics Snippet

HTML5 Boilerplate Snippets

* * *


HTML5 Boilerplate Snippets Read More

The Advantages of Using Vector Fonts

There are a great many different image options – and different file formats – available for any designer to work with, so it can be a little bit overwhelming when you have to choose which one to use, especially if you will be sending your finished work to a client.

Compatibility is certainly something to be concerned about, however, whenever you are working with graphic and images, especially text and fonts it is far more important to be concerned about just how those images are going to render.

There are two basic types of digital graphics files to choose from, vector and raster. Vector images are comprised of thousands, actually hundreds of thousands, of minute lines and curves that are put together to form an image. On the other hand, raster images are made up of a myriad of pixels. So which format is best for your particular project?

Vector Fonts Advantages Read More

7 Sliding Backgrounds Tutorials to Catch a New Trend

Full photo backgrounds were claimed to be a trend for 2013 at the beginning of the year (the prophet’s article). The forecast was true, indeed. Nevertheless it wasn’t full enough.

Recently I met a lot of websites and templates with fashionable full or large photo backgrounds, and I noticed a certain tendency: they more often contain such remarkable feature as sliding backgrounds. Yes, the large image backgrounds are sliding the same way the pics in boring mainstream banner sliders do. Sometimes the sliding mechanism for backgrounds is influenced with parallax scrolling effect, giving more motion and depth to fashionable flat designs. I think that the best explanation is a practical one, so let me show you couple examples: one and two.

Sliding backgrounds definitely look cool, don’t you think? Well, if you agree with me, my efforts are fully renumerated, because in this post I gathered for you 7 clear sliding backgrounds tutorials. Enjoy.

* * *

Fullscreen Slit Slider with jQuery and CSS3

Sliding Backgrounds Tutorials

* * *

Fullscreen Background Image Slideshow with CSS3

Sliding Backgrounds Tutorials

* * *

Read More

Hover Effect in Modern Web Design: Definition and Usability Tips

Hover effect is simply a change (of color, size, shape, image etc.) of some element while you put a mouse arrow over it. Commonly it is achieved with CSS coding. The hover effect is not cranky at all and can be used practically for any CSS element.

Hover Effect Usability

The easiest way to make the hover effect in CSS is using :hover selector, which is a CSS pseudo-class. It would take no extra efforts to put a hover selector in the code. Let’s review a background color change for a link: you just need to add this after selecting and styling a link.


Read More