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
class MyProxyHttpOverride extends HttpOverrides { | |
@override | |
HttpClient createHttpClient(SecurityContext context) { | |
return super.createHttpClient(context) | |
..findProxy = (uri) { | |
return "PROXY localhost:8888;"; | |
} | |
..badCertificateCallback = | |
(X509Certificate cert, String host, int port) => true; | |
} |
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
import UIKit | |
extension UIColor { | |
convenience init(hex: String, alpha: CGFloat = 1) { | |
assert(hex[hex.startIndex] == "#", "Expected hex string of format #RRGGBB") | |
let scanner = Scanner(string: hex) | |
scanner.scanLocation = 1 // skip # | |
var rgb: UInt32 = 0 |
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 main(){ | |
$this->zajlib->variable->my_posts = WpPost::fetch(); | |
// Now let's filter the list by some type for example (the parameter is a regular WpQuery string, see: https://codex.wordpress.org/Class_Reference/WP_Query ) | |
$this->zajlib->variable->my_posts->query([ 'cat' => 4 ]); | |
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
<!-- For arrays you can use the numeric key or associative key to reference a specific element --> | |
{{array|keyvalue:3}} | |
{{array|keyvalue:'array_key'}} | |
<!-- For any objects you can use the property name --> | |
{{user|keyvalue:'email'}} is the same as {{user.email}} | |
<!-- As always, you can chain filters --> | |
{{user|keyvalue:'data'|keyvalue:'email'}} is the same as {{user.data.email}} |
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 __load(){ | |
// Set langauge | |
$this->zajlib->lang->auto(); | |
// Set my variation to formal (you must do this _before_ you load any language files) | |
$this->zajlib->lang->set_variation('formal'); | |
// WARNING! This will only apply to this particular controller! See the site/index.php config setup for a site-wide change. | |
// Load my language file | |
$this->zajlib->lang->load('formfields'); |
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 | |
//.... | |
/** | |
* Custom validation logic. | |
* @param Form $form The form object that is currently being validated. | |
* @param array $data The array of form data sent. | |
* @return boolean Return false if you want to skip the plugin-level validation. | |
**/ | |
public function __validate($form, $data){ |
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> | |
requirejs(["system/js/ui/popup-campaign"], function(PopupCampaign){ | |
// Create a popup campaign | |
var campaign = new PopupCampaign({ | |
url: '/my/popupcampaign/show/', // The controller that displays the popup HTML (in ofw.alert) | |
selector: '#mypopup', // OR you can use this instead of url to simple removeClass('hide') on the popup campaign div | |
timeDelay: 25000, // 25 seconds delay before the popup is shown. You should use localStorage for the start time, so that the timer is preserved across page views. | |
cookieName: 'popupcampaign', // Optional, defaults to 'popupcampaign' - The name of the cookie (or localstorage key?) that stores the number of times this user has seen this item. Only needed if you have several per page. | |
cookieExpiryDays: 90, // Optional, defaults to 90 - The number of days after which the cookie / localstorage expires. |
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="row"> | |
<div class="col-md-12"> | |
<!-- Will display only the first column. --> | |
{% contentpagesections 1 %} | |
</div> | |
</div> | |
<div class="row"> | |
<div class="col-md-6"> | |
<!-- Will display only the second column's first section. --> | |
{% contentpagesections 2 1 %} |
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="row"> | |
<div class="col-md-8"> | |
<!-- Will display only the first column. --> | |
{% contentpagesections 1 %} | |
</div> | |
<div class="col-md-4"> | |
<!-- Will display only the second column. --> | |
{% contentpagesections 2 %} | |
</div> | |
</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
<input type="text" name="{{content.contentpagesection.nameprefix|add:'[textcontent]'}}" value="{{content.contentpagesection.data.textcontent|escape}}"> |