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
global $wpdb; | |
$taxonomy_name = 'taxonomy_name_goes_here'; | |
$wpdb->query( | |
"DELETE FROM {$wpdb->terms} AS t | |
WHERE t.term_id IN ( | |
SELECT tt.term_id FROM {$wpdb->term_taxonomy} AS tt | |
WHERE tt.taxonomy = '{$taxonomy_name}' | |
)" |
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
# To use this script create a parent directory and two directorys inside it (src & github). Place this file in the parent directory. | |
# Place your source code in the 'src' directory. When you want to publish, run this script to copy all source files to the github directory and replace sensitive data. | |
# This way you can run sensitive data in your working copy and the Github version is stripped of sensitive data. | |
# Be sure to update this snippet to include your find and replace variables. | |
import shutil | |
import os | |
def copy_src_to_github(src, github): | |
if not os.path.exists(src): | |
print(f"Source directory {src} does not exist.") |
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
global $wpdb; | |
/** | |
* Get todays date and the last post date to compare | |
*/ | |
$query_date = date( 'Y-m-d' ); | |
$last_date = $wpdb->get_var( "SELECT DATE(MAX(post_date)) FROM {$wpdb->posts} WHERE post_status = 'publish' AND post_type = 'post' LIMIT 1" ); | |
// Check if the last post is from today or not | |
if ( $last_date != $query_date ) { |
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 SymmetricEncryption { | |
private $cipher; | |
public function __construct($cipher = 'aes-256-cbc') { | |
$this->cipher = $cipher; | |
} |
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
add_action('wo_set_access_token', 'check_user_before_auth'); | |
function check_user_before_auth( $info ) { | |
if ( ! isset( $info['user_id'] ) ) { | |
return; | |
} | |
$user_id = $info['user_id']; | |
// Do query to checl the |
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
/** | |
* Breakdown of the RSSI return for AT+CSQ command. The return from the command gives a value that needs to be | |
* converted in many instances. | |
* | |
* @link https://m2msupport.net/m2msupport/atcsq-signal-quality/ | |
*/ | |
$values = array( | |
'2' => array( | |
'dB' => '-109', | |
'condition' => 'Marginal' |
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
{ | |
"issuer": "https://wordpress.site", | |
"authorization_endpoint": "http://wordpress.site/oauth/authorize/", | |
"token_endpoint": "http://wordpress.site/oauth/token/", | |
"userinfo_endpoint": "http://wordpress.site/oauth/me/", | |
"end_session_endpoint": "http://wordpress.site/oauth/destroy/", | |
"jwks_uri": "http://wordpress.site/.well-known/keys/", | |
"revocation_endpoint": "http://wordpress.site/oauth/revoke/", | |
"introspection_endpoint": "http://wordpress.site/oauth/introspection/", | |
"registration_endpoint": null, |
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
/** | |
* UPDATES AN ACCESS TOKEN'S EXPIRE TIME BY X AMOUNT OF TIME WHEN SUCCESSFULLY USED FOR AUTHENTICATION | |
* | |
* NOTE: This will override any token settings used within the plugin but does allow for active tokens to | |
* stay active instead of expiring. This is useful for auto deauthentication tht is traditionally handled on the | |
* client side. | |
*/ | |
add_action( 'wo_endpoint_user_authenticated', 'wp_oauth_successful_authentication_action' ); | |
function wp_oauth_successful_authentication_action( $token ) { | |
//$current_expires = $token[0]['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
/*************************************************** | |
Titanium Cache Module | |
Modified By: Justin Greer | |
https://justin-greer.com | |
Original Author: Joe Maffia | |
http://about.me/joemaffia | |
A cache module to be used for Titanium app. http://www.appcelerator.com/ |
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
/** | |
* Remove all OAuth access tokens when a user logs out of the WordPress | |
* @param $user_id | |
*/ | |
function wo_example_destroy_authorizations( $user_id ) { | |
global $wpdb; | |
$wpdb->delete( "{$wpdb->prefix}oauth_access_tokens", array( "user_id" => $user_id ) ); | |
$wpdb->delete( "{$wpdb->prefix}oauth_refresh_tokens", array( "user_id" => $user_id ) ); | |
} |
NewerOlder