Welcome To Snipplr
Everyone's Recent PHP Snippets Tagged php
- All /
- JavaScript /
- HTML /
- PHP /
- CSS /
- Ruby /
- Objective C
This is a static session wrapper that handles single variables and arrays. It allows setting, resetting, and deleting session variables (without destroying the session). It regenerates the session id every time a session is started to prevent sessi...
0
923
posted 12 years ago by halk
PHP
HTML Helper Function Create Any Element With Any Number Of Attributes (self-closing and container tags)
/**
* THIS FUNCTION WILL RENDER A CONTAINER OR SELF-CLOSING HTML ELEMENT.
* IT AUTO DETECTS WHAT TYPE YOU WANT
* BASED ON RATHER OR NOT YOU SET A _data KEY IN THE ARRAY OF
* ATTRIBUTES PASSED TO THE FUNCTION
*
* USING AN ASSOCIATIVE ARRA...
0
976
posted 12 years ago by halk
https://gist.github.com/4098493
(examples of use below the class code)
This class allows you to load a file of snippets that are really mini-templates copy them from your repository fill the token slots in them the with your data and render them as...
0
1007
posted 12 years ago by halk
Does not require http in the text to link. It must start with www however. Optionaly make the links popup in a new window.
0
1289
posted 12 years ago by halk
# Método setter y getter
Hace mucho tiempo usaba esta manera para tener un solo método que sea getter y setter al mismo tiempo.
0
500
posted 12 years ago by prigazzi
This function dosen't use curl, or any other libraries. Just include it in your function library and use it like this:
$Post_result = _post('http://www.yourdomain.com/your_path/post_api.php',"method=fetchJson¶ms=select * from user");
0
1003
posted 12 years ago by halk
A function to upload an image to the media library and set it as featured image of a post. It requires 2 params. The name of the upload field and of course the post ID.
This function is part of the WPelements library class available on Github. Fee...
0
1195
posted 12 years ago by krike
A usefull function to minify code or string. This is part of the WPelements library class available on Github.
Feedback / suggestions / improvements are welcome.
0
729
posted 12 years ago by krike
Want to be able to display the source code of any webpage, with line numbering? Here is a simple code snippet to do it. Just modify the url on line 2 at your convenience. Or even better, make a pretty function according to your needs.
2
944
posted 12 years ago by o0110o
If you need to get the whois information for a specific domain, why not using PHP to do it? The following function take a domain name as a parameter, and then display the whois info related to the domain.
1
923
posted 12 years ago by o0110o
In order to optimize your scripts, you may definitely want to know how many amount of RAM they use on your server. This snippet will check memory and then print initial, final and peak usages.
3
776
posted 12 years ago by o0110o
Add this to functions.php and then you can call the focus keyword anywhere you want with:
<?php wpseoFocusKW();?>
0
1040
posted 12 years ago by itsmrchris
How to insert the less preprocessor script in WordPress Websites and Blogs
0
852
posted 12 years ago by ecksteing
If you are a PHP developer, you are probably aware that you can pass an array of strings as the search strings and an array as the replacements to the str_replace function. In this example you can see how to automatically replace smiley shortcuts by...
1
580
posted 12 years ago by martijnhoogwerf
Get the text in between more text in a string. Accepts $content,$start,$end & $is_string as parameters.
1
858
posted 12 years ago by o0110o
This function will force a file to be downloaded. It accepts $_path as a parameter.
1
986
posted 12 years ago by o0110o
This function performs several checks to make sure it's getting the correct IP address.
1
1224
posted 12 years ago by o0110o
A handy function to get the contents of a file with curl. Accepts $_path as a parameter.
1
1133
posted 12 years ago by o0110o
This function will use curl to see if a file exists at the location it's provided. It accepts $_path as a parameter.
1
1313
posted 12 years ago by o0110o