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 | |
Abstract Class WP_Model implements JsonSerializable{ | |
... | |
public function isFilterProperty($attribute){ | |
return ( | |
( | |
isset($this->filter) && | |
in_array($attribute, $this->filter) && | |
method_exists($this, ('_filter'. ucfirst($attribute))) |
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 Product extends WP_Model{ | |
... | |
public $filter = [ | |
'weight' => 'intval' | |
]; | |
} | |
$product = Product::insert([ | |
'weight' => '250', | |
]); |
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 | |
function isAssoc($array){ | |
return count(array_filter(array_keys($array), 'is_string')) > 0; | |
} | |
$indexed = [ | |
'apple', | |
'pear', | |
'grape' |
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 Product extends WP_Model{ | |
... | |
public $filter = [ | |
'weight' | |
]; | |
public function _filterWeight($value){ | |
return intval($value); |
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
<h3>You have a new contact from enquirey!</h3><br> | |
<p> | |
<strong>Time:</strong><?= $time ?> | |
</p> | |
<p> | |
<strong>Name:</strong><?= $name ?> | |
</p> |
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 | |
require 'ContactFormAction.php'; |
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 | |
/* | |
Template Name: Contact Page | |
*/ | |
?> | |
<form action="<?= ContactFormAction::url() ?>" method="post" enctype="multipart/form-data"> | |
<input type="hidden" name="from_action" value="<?= ContactFormAction::getActionName() ?>"> | |
<input type="text" name="full_name"><br /> |
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 | |
$email = (new WP_Mail) | |
->to([ | |
'[email protected]', | |
'[email protected]', | |
]) | |
->cc('[email protected]') | |
->bcc([ | |
'[email protected]', |
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
<h1>Hello {{name}},</h1> | |
<p>I have found a great class from a developer in {{location}}.</p> | |
<a href="{{link}}">Check it out on GitHub</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
<?php | |
$email = WP_Mail::init() | |
->to('[email protected]') | |
->subject('WP_Mail is great!') | |
->attach(ABSPATH . 'wp-content/uploads/2018/6/image.png') | |
->template(get_template_directory() .'/emails/demo.php', [ | |
'name' => 'Anthony Budd', | |
'location' => 'London', | |
'skills' => [ |