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
var Body = Item.extend({ | |
// Set background pattern | |
constructor: function() { | |
// Set default image | |
this.set('pattern',1); | |
}, | |
changeCollarColour: function(colour) { | |
this.set('collarColour', colour); | |
} | |
}); |
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 sanitize ( $key ) { | |
$raw_key = $key; | |
$key = preg_replace( '/[^a-z0-9_\-]/', '', $raw_key ); | |
return $key; | |
} | |
$my_var = ‘My_String_here’; |
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 | |
/** | |
* What is this function doing? | |
*/ | |
function output_data(Array $data, $type = 'json') | |
{ | |
if ( is_array($data) ) { | |
switch($type) { |
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 | |
$test = new Shop_Product(); | |
$test->join('shop_products_categories', 'shop_products.id = shop_products_categories.shop_product_id'); | |
$test->join('shop_order_items', 'shop_products.id = shop_order_items.shop_product_id'); | |
$test = $test->where('shop_products_categories.shop_category_id=? ) GROUP BY (shop_products.id',1)->order('count(shop_order_items.id) DESC')->limit(3)->find_all(); | |
foreach ( $test as $t ) { | |
echo "<br/>".$t->name."</br>"; | |
} | |
?> |
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
<div class="entry"> | |
<h3>► Upcoming events</h3> | |
<?php | |
$upcoming = new WP_Query(array( | |
'post_type' => 'event', | |
'posts_per_page' => -1 | |
)); | |
while( $upcoming->have_posts() ): | |
$upcoming->the_post(); |
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 | |
$form = $this->beginWidget('CActiveForm', array( | |
'id' => 'customer-address', | |
'enableAjaxValidation' => true, | |
'enableClientValidation' => true, | |
'focus' => array($model, 'description'), | |
'method' => 'post', | |
'action' => $this->createUrl('CustomerApi/Addresses',array('id'=>$customerId)), | |
'htmlOptions' => array( | |
'class'=>'form uniformForm', |
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
SELECT | |
id, name, longitude, latitude | |
( | |
3959 * acos( | |
cos(radians(1.382679)) | |
* cos(radians(latitude)) | |
* cos(radians(longitude) - radians(16.523438)) | |
+ sin( radians(1.382679) ) | |
* sin( radians(latitude)) | |
) |
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
<form action="#"> | |
<input type="hidden" name="complete_url" value="<?= site_url('rma-complete') ?>" /> | |
<div class="checkout-block"> | |
<div class="fieldset"> | |
<div class="field-group"> | |
<div class="field"> | |
<label for="tdrma_rma_first_name">First name <span class="req">*</span></label> | |
<input name="tdrma_rma_first_name" id="tdrma_rma_first_name" type="text"> | |
</div> |
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 | |
/** | |
* Modify normal delete behaviour so that deletes are handled depending | |
* on if they have a column called 'deleted' or not | |
* Cascade deletes all HAS_MANY relations as well | |
* | |
* @access public | |
* @return boolean | |
*/ | |
public function beforeDelete() |
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
window.MenuSections = Backbone.Collection.extend({ | |
model: MenuSection, | |
url: 'index.php?r=MenuApi/Get', | |
// Search used for live searching | |
search: function(letters) { | |
var pattern = new RegExp(letters,"gi"); | |
var that = this; | |
this.each(function(data,i){ | |
// Loop all the items looking for the match | |
// If there isn't a match we don't want the section displayed |
NewerOlder