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 explicitPermissionGrantedCallback($user){ | |
| if(!is_null($user)){ | |
| var_dump($user); // WP_User | |
| echo $user->user_nicename . 'has just just given permission'; | |
| }else{ | |
| // User is not logged in. | |
| } |
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
| <!DOCTYPE html> | |
| <html <?php language_attributes(); ?>> | |
| <head> | |
| <meta charset="<?php bloginfo( 'charset' ); ?>"> | |
| <meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
| ....... | |
| <?php if(@call_user_func('hasUserGivenPermissionFor', 'google-analytics')): ?> | |
| <!-- Google Analytics --> | |
| <script> |
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 | |
| $array = ['quick', 'fox']; | |
| $string = 'the quick brown fox jumps over the lazy dog'; | |
| if(in_array(1,array_map(function($e)use($string){return(strpos($string, $e)!== FALSE)?1:0;},$array))){ | |
| echo "The string contains an element in the array."; | |
| } |
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 | |
| $salary = 60000; | |
| $oneMonth = ($salary / 12); | |
| $twoMonths = ($salary / 6); | |
| $halfMonth = ($salary / 24); | |
| $monthlyCommission = 10000; |
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
| <form action="<?= admin_url('/admin-ajax.php') ?>" method="POST" enctype="multipart/form-data"> | |
| <input type="hidden" name="action" value="register"> | |
| <input type="email" name="email" value=""> | |
| <input type="password" name="password" value=""> | |
| </form> | |
| <?php if(isset($_GET['suceess'])): ?> | |
| <p>succesfil blah blah blah</p> | |
| <?php enif; ?> |
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 Event extends WP_Model{ | |
| public $postType = 'event'; | |
| public $attributes = [ | |
| 'start_date', | |
| ]; | |
| public function _finderArchive($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 | |
| $products = Product::finder('archive', [ | |
| 'page' => 1, | |
| ]); | |
| dd($products); |
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 | |
| $products = Product::all(); | |
| dd($products); |
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 | |
| Product::insert([ | |
| 'color' => 'blue', | |
| 'weight' => '100' | |
| ]); | |
| Product::insert([ | |
| 'color' => 'red', | |
| 'weight' => '100' |