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 ContactForm { | |
public function send_contact_form() { | |
$validation = new Phpr_Validation(); | |
$validation->add('name')->fn('trim')->required('Please enter your name'); | |
$validation->add('email')->fn('trim')->required('Please enter your email address')->email(false, 'Please enter a valid email address'); |
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 define('WP_CACHE', true); | |
define('DB_NAME', 'wordpress'); | |
define('DB_USER', 'root'); | |
define('DB_PASSWORD', 'password'); | |
define('DB_HOST', 'localhost'); | |
define('DB_CHARSET', 'utf8'); | |
define('DB_COLLATE', ''); |
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 Slug { | |
private function slugify($slug) | |
{ | |
// convert all dodgey foreign characters | |
$table = array( | |
'Š'=>'S', 'š'=>'s', 'Đ'=>'Dj', 'đ'=>'dj', 'Ž'=>'Z', 'ž'=>'z', 'Č'=>'C', 'č'=>'c', 'Ć'=>'C', 'ć'=>'c', | |
'À'=>'A', 'Á'=>'A', 'Â'=>'A', 'Ã'=>'A', 'Ä'=>'A', 'Å'=>'A', 'Æ'=>'A', 'Ç'=>'C', 'È'=>'E', 'É'=>'E', | |
'Ê'=>'E', 'Ë'=>'E', 'Ì'=>'I', 'Í'=>'I', 'Î'=>'I', 'Ï'=>'I', 'Ñ'=>'N', 'Ò'=>'O', 'Ó'=>'O', 'Ô'=>'O', |
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 | |
$obj = new Shop_Product(); | |
$obj->select('count(shop_order_items.id) AS "sold"'); | |
$obj->join('shop_products_categories', 'shop_products.id = shop_products_categories.shop_product_id'); | |
$obj->join('shop_order_items', 'shop_products.id = shop_order_items.shop_product_id'); | |
$obj->join('shop_orders', 'shop_order_items.shop_order_id = shop_orders.id'); | |
$best_selling = $obj->where('shop_products_categories.shop_category_id=? AND shop_orders.payment_processed IS NOT NULL', $category->id)->group('shop_products.id')->order('count(shop_order_items.id) DESC')->limit(3)->find_all(); |
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 send_contact_form() { | |
$validation = new Phpr_Validation(); | |
$validation->add('name')->fn('trim')->required('Please enter your name'); | |
$validation->add('email')->fn('trim')->required('Please enter your email address')->email(false, 'Please enter a valid email address'); | |
$validation->add('subject')->fn('trim'); | |
$validation->add('order_no')->fn('trim'); |
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.Phpr.response.popupError = window.LS.response.popupError = function(message) { | |
console.log(message); | |
} |
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 | |
public function subscribeEvents() | |
{ | |
Backend::$events->addEvent('backend:onControllerReady', $this, 'on_backend_controller_ready'); | |
} | |
public function on_backend_controller_ready($controller) | |
{ | |
$controller->list_search_fields[] = 'x_custom_column'; |
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 | |
$obj = new Shop_CurrencySettings; | |
$obj = $obj::get(); | |
$currency = $obj->sign; |
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 | |
$pattern = '/\.(icon-(?:\w+(?:-)?)+):before\s+{\s*content:\s*"(.+)";\s+}/'; | |
$subject = file_get_contents('css/font-awesome.css'); | |
preg_match_all($pattern, $subject, $matches, PREG_SET_ORDER); | |
$icons = array(); | |
echo '<ul>'; |
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 gp_empty_paragraph_fix($content) { | |
$array = array ( | |
'<p>[' => '[', | |
']</p>' => ']', | |
']<br />' => ']' | |
); | |
$content = strtr($content, $array); | |
return $content; |