This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $MF_MetaFields; //global defined to store meta ID's | |
| class MetaBox{ | |
| protected $options = array(); //for storing all options | |
| protected $id; //unique string ID for naming field | |
| protected $title; //Box Title | |
| protected $posttype; //Array (list, of, post, types) to attach to | |
| protected $context;//Optional. normal, or side | |
| protected $priority = "low";//optional |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| class MF_Query extends WP_Query{ | |
| private $page_link = "page"; | |
| function __construct(array $args){ | |
| if(!array_key_exists('posts_per_page',$args)) $args['posts_per_page'] = 10; | |
| if(array_key_exists('page_link',$args)) $this->page_link['page_link']; | |
| $args['offset'] = (isset($_GET[$this->page_link])?($_GET[$this->page_link]-1)*$args['posts_per_page']:0); | |
| parent::query($args); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| class Mf_calendar{ | |
| private $post_type = "post"; | |
| private $prefix; | |
| private $posts = array(); | |
| private $month; | |
| private $year; | |
| private $first_day; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var scripts = {}; | |
| var w3cGeo = {}; | |
| w3cGeo.api = '95b5c8ffb1d0891fe5a1eed66ce0d2d5'; | |
| var gLocalSearch = new GlocalSearch(); | |
| google.load("search", "1"); | |
| google.load("maps", "2", {"callback" : w3cGeo.mapsLoaded}); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| A collection of useful scripts | |
| */ | |
| //Collect all form data into a string | |
| $.fn.getFormData = function(){ | |
| var str = ""; | |
| var areas = $(this).find('input').not('input[type=submit]').not('input[type=button]').add($(this).find('textarea')).add($(this).find('select')); | |
| areas.each(function(i){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var APP_ID = prompt("Input your App Id"); | |
| var APP_SECRET = prompt("Input your App Secret"); | |
| $.ajax({ | |
| url: "https://graph.facebook.com/oauth/access_token?client_id="+APP_ID+"&client_secret="+APP_SECRET+"&grant_type=client_credentials", | |
| type: "GET", | |
| success: function(data){ | |
| window.location = "https://graph.facebook.com/"+APP_ID+"/accounts/test-users?installed=false&locale=en_UK&permissions=read_stream&method=post&access_token="+data.replace('access_token=',''); | |
| } | |
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| String.prototype.isCreditCard = function() | |
| { | |
| //Credit - https://sites.google.com/site/abapexamples/javascript/luhn-validation | |
| var luhnArr = [[0,2,4,6,8,1,3,5,7,9],[0,1,2,3,4,5,6,7,8,9]], sum = 0; | |
| this.replace(/\D+/g,"").replace(/[\d]/g, function(c, p, o){ | |
| sum += luhnArr[ (o.length-p)&1 ][ parseInt(c,10) ]; | |
| }); | |
| return (sum%10 === 0) && (sum > 0); | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| String.prototype.isCVV = function(){ | |
| return (this.length >= 3 && this.length <=4) && Number(this) ? true : false | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $.fn.toggleHTML = function(a,b){ | |
| //toggles two HTML values of given object, defaults to A unless equal to A | |
| $(this).html(($(this).html() == a ? b : a)); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Array.prototype.getObjectByAttribute = function(value, attribute){ | |
| var catcher = [], i = 0; | |
| while(!catcher && this[i]){ | |
| if(this[i].attribute == value){ | |
| catcher.push(this[i]); | |
| } | |
| i++; | |
| } | |
| return catcher.length == 1 ? catcher[0] : catcher.length ? catcher : false; | |
| } |
OlderNewer