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
pragma solidity ^0.4.6; | |
contract Helper { | |
function lowercaseString(string self) internal constant returns (string) { | |
bytes memory a = bytes(self); | |
for (uint i = 0; i < a.length; i++) { | |
if (uint8(a[i]) >= 0x41 && uint8(a[i]) <= 0x5A) { | |
a[i] = byte(uint8(a[i]) + 0x20); | |
} | |
} |
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 | |
/** | |
* Register new endpoint to use inside My Account page. | |
* | |
* @see https://developer.wordpress.org/reference/functions/add_rewrite_endpoint/ | |
*/ | |
function my_custom_endpoints() { | |
add_rewrite_endpoint( 'webinars', EP_ROOT | EP_PAGES ); | |
} |
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 | |
add_action( 'shutdown', function() { | |
foreach( $GLOBALS['wp_actions'] as $action => $count ) { | |
printf( '%s (%d) <br/>' . PHP_EOL, $action, $count ); | |
} | |
}); |
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
for upload in `mysql -u root database_name -e "select meta_value from wp_postmeta where meta_key='_wp_attached_file';" | grep 2016`; \ | |
do echo $upload; \ | |
wget "https://url.net/wp-content/uploads/$upload" -P `dirname $upload`; \ | |
done |
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
@mixin vertical-align($position: relative) { | |
position: $position; | |
top: 50%; | |
-webkit-transform: translateY(-50%); | |
-ms-transform: translateY(-50%); | |
transform: translateY(-50%); | |
} |
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
//Load/Enqueue the twitter widgets.js | |
window.twttr.ready(function (twttr) { | |
// At this point the widget.js file had been loaded. | |
// We can now make use of the twttr events | |
twttr.events.bind('rendered', function (event) { | |
// At this point the tweet as been fully loaded | |
// and rendered and you we can proceed with our Javascript | |
window.console.log("Created widget", event.target.id); | |
}); | |
}); |
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 | |
//Categories hooks | |
add_action( 'edit_category_form_fields', [ $this, 'coresales_category_custom_fields' ] ); | |
add_action( 'category_add_form_fields', [ | |
$this, | |
'coresales_category_custom_fields' | |
] ); //@see https://developer.wordpress.org/reference/hooks/taxonomy_add_form_fields/ | |
add_action( 'create_category', [ $this, 'coresales_category_save' ] ); | |
add_action( 'edit_category', [ $this, 'coresales_category_save' ] ); |
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
/* global jQuery, wp */ | |
/** | |
* To enqueue in admin: | |
* $template_dir = get_template_directory_uri(); | |
* //Enqueue necessary scripts for using WP JS media library | |
* wp_enqueue_media(); | |
* //Custom JS for admin | |
* wp_enqueue_script( 'coresales-admin-scripts', $template_dir . '/javascripts/coresales_media_admin.min.js', array( 'jquery' ), 1.0, true ); | |
*/ |
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
//Setting Ajax handlers | |
add_action( 'wp_ajax_nopriv_get_author_info', array( $this, 'bps_get_author_info_cb' ) ); | |
add_action( 'wp_ajax_get_author_info', array( $this, 'bps_get_author_info_cb' ) ); | |
/** | |
* Function used to get author info for popup on article | |
*/ | |
public function bps_get_author_info_cb() { | |
global $coauthors_plus; | |
//Checking nonce |
NewerOlder