- jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
- Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
- AngularJS - Conventions based MVC framework for HTML5 apps.
- Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
- lawnchair - Key/value store adapter for indexdb, localStorage
This file contains 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 | |
function get_image_src_or_default($attachment_id, $image_size) | |
{ | |
$image_size_info = false; | |
global $_wp_additional_image_sizes; | |
if(isset($_wp_additional_image_sizes[$image_size])) { | |
$image_size_info = $_wp_additional_image_sizes[$image_size]; | |
} | |
$img = wp_get_attachment_image_src( $attachment_id, $image_size); |
This file contains 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 BasePost extends TimberPost | |
{ | |
public function get_file($key) { | |
$id = $this->get_field($key); | |
$file_path = get_attached_file( $id ); | |
$file = new SplFileInfo($file_path); | |
try { |
This file contains 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 Twig_Extension_WP_basic_functions extends Twig_Extension | |
{ | |
/** | |
* {@inheritdoc} | |
*/ | |
public function getFunctions() | |
{ |
This file contains 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 | |
// CONFIG | |
define("DEBUG", true); | |
define("CACHE", false); | |
define("CACHE_TIME", 86400); | |
define("CACHE_GZ_HANDLER", true); | |
define("BASE_DIR", __DIR__); | |
define("CACHE_DIR", BASE_DIR.'/cache/'); | |
define("SITE_URL", 'http://' . $_SERVER['HTTP_HOST'] ); | |
// . $_SERVER['QUERY_STRING']); // In this page we don't use query string |
This file contains 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
<script type="text/javascript"> | |
(function() { | |
// IE detection | |
var device = {}; | |
device.ie8 = /MSIE 8/i.test(navigator.userAgent); | |
device.ie9 = /MSIE 9/i.test(navigator.userAgent); | |
device.ie10 = /MSIE 10/i.test(navigator.userAgent); | |
device.ie11 = /rv:11.0/i.test(navigator.userAgent); | |
for(var i in device) |
This file contains 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
(function() { | |
// Test if is touch device | |
if(typeof window.addEventListener == 'function') | |
{ | |
window.addEventListener('touchstart', function setHasTouch() { | |
document.getElementsByTagName('html')[0].className += ' is-touch-screen' | |
window.removeEventListener('touchstart', setHasTouch); | |
}, false); | |
} |
This file contains 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 | |
/** | |
* WP mu-plugin to control plugin loading | |
*/ | |
add_filter( 'option_active_plugins', function($val){ | |
if(!is_admin()) | |
{ | |
$admin_only_plugins = [ | |
'plugin1/plugin1.php', |
This file contains 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 | |
// originally by Camden Ross. Thanks | |
/* bypass wordpress are you sure you want to logout screen when logging out of an already logged out account. */ | |
function smart_logout() { | |
if (!is_user_logged_in()) { | |
$smart_redirect_to = !empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '/'; | |
wp_safe_redirect( $smart_redirect_to ); | |
exit(); | |
} else { |
This file contains 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 | |
private function get_client_ip() | |
{ | |
$ipaddress = ''; | |
if ($_SERVER['HTTP_CLIENT_IP']) | |
$ipaddress = $_SERVER['HTTP_CLIENT_IP']; | |
else if($_SERVER['HTTP_X_FORWARDED_FOR']) | |
$ipaddress = $_SERVER['HTTP_X_FORWARDED_FOR']; | |
else if($_SERVER['HTTP_X_FORWARDED']) |
NewerOlder