View tracker.min.js
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
/* | |
Rewritten tracker.js template for self hosted Fathom with bundled trackerUrl details. | |
Use this as a template and included directly with each website you plan on tracking. | |
Add the following script tag to embed. | |
<script src="/wp-content/mu-plugins/tracker.js" data-site="ABCDEFG" defer></script> | |
See unminified version here: https://gist.github.com/austinginder/50c244e64c701e1a5a1ecd8f3719273f | |
*/ | |
window.fathom_lite=function(){var e={siteId:"",trackerUrl:"//your-tracker-domain.tld/collect"};function t(){return{isNewVisitor:!0,isNewSession:!0,pagesViewed:[],previousPageviewId:"",lastSeen:+new Date}}function n(){let e=new Date;e.setMinutes(e.getMinutes()-30);let n=function(e){for(var t=document.cookie?document.cookie.split("; "):[],n=0;n<t.length;n++){var i=t[n].split("=");if(decodeURIComponent(i[0])===e){var r=i.slice(1).join("=");return decodeURIComponent(r)}}return""}("_fathom_lite");if(!n)return t();try{n=JSON.parse(n)}catch(e){return console.error(e),t()}return n.lastSeen<+e&&(n.isNewSession |
View tracker.js
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
/* | |
Rewritten tracker.js template for self hosted Fathom with bundled trackerUrl details. | |
Use this as a template and included directly with each website you plan on tracking. | |
Add the following script tag to embed. | |
<script src="/wp-content/mu-plugins/tracker.js" data-site="ABCDEFG" defer></script> | |
See minified version here: https://gist.github.com/austinginder/b7690cdeca1a109d9edf58f07ea1f146 | |
*/ |
View load_default_keys_to_wp-config.sh
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
keys_to_add=( | |
WPCOM_API_KEY | |
GF_LICENSE_KEY | |
RECOVERY_MODE_EMAIL | |
) | |
values_to_add=( | |
wordpress_akismet_license_goes_here | |
gravity_forms_license_goes_here | |
recovery_email_address_goes_here | |
) |
View migration-captaincore-v0.9-to-v0.10-rename-dirs.php
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 | |
if ( count ( $args ) == 0 ) { | |
echo "Error: missing <captain_id> argument."; | |
return; | |
} | |
$json = $_SERVER['HOME'] . "/.captaincore-cli/config.json"; | |
$config_data = json_decode ( file_get_contents( $json ) ); | |
$system = $config_data[0]->system; |
View migration-captaincore-v0.9-to-v0.10-alpha.php
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 | |
$users = array_column( get_users ( [ 'fields' => [ 'ID' ] ] ), "ID" ); | |
$ids_accounts_json = "ids-accounts.json"; | |
$ids_sites_json = "ids-sites.json"; | |
$ids_domains_json = "ids-domains.json"; | |
$ids_processes_json = "ids-processes.json"; | |
$ids_processlogs_json = "ids-processlogs.json"; | |
// Generate empty .json if needed |
View wpengine_local_restore.sh
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
## Pull in static configs | |
source ~/.bash_anchorhost | |
function wpengine_local_restore { | |
## Prompt for dynamic configs | |
read -p $'\e[31mWP Engine snapshot url\e[0m: ' wpengine_snapshot | |
read -p $'\e[31mLocal database name (will create)\e[0m: ' db_name | |
read -p $'\e[31mProduction site url ( ex: anchor.host )\e[0m: ' siteurl_production | |
read -p $'\e[31mLocal site url ( ex: anchor.dev )\e[0m: ' siteurl_local |
View protected.php
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 | |
/* | |
* protected.php | |
* | |
* Protect uploaded files with login. | |
* | |
* @link http://wordpress.stackexchange.com/questions/37144/protect-wordpress-uploads-if-user-is-not-logged-in | |
* | |
* @author hakre <http://hakre.wordpress.com/> | |
* @license GPL-3.0+ |
View wp_engine_cli.php
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 | |
### PHP command line wrapper for WP Engine's web based WP-CLI | |
### Example command line: php wp_engine_cli.php -i wp_install_name -c "cli info" | |
# Grab options from command line | |
$options = getopt("i:c:"); | |
# Break out into variables | |
$install = $options["i"]; |
View new_admin_wordpress.sql
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
# Adds new account | |
INSERT INTO `wp_users` (`ID`, `user_login`, `user_pass`, `user_nicename`, `user_email`, `user_url`, `user_registered`, `user_activation_key`, `user_status`, `display_name`) VALUES | |
(null, 'firstlastname', 'known-password-hash', 'First Last Name', 'email@example.com', '', NOW(), '', 0, 'First Last Name'); | |
# Selects autogenerated ID | |
SET @autogenerated_id = LAST_INSERT_ID(); | |
# Setups new account as a WordPress admin | |
INSERT INTO `wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES | |
(null, @autogenerated_id, 'wp_capabilities', 'a:1:{s:13:"administrator";b:1;}'), |
View mutlisite-to-single.sql
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
# Delete all orphans user meta in WordPress | |
DELETE FROM wp_usermeta | |
WHERE NOT EXISTS ( | |
SELECT * FROM wp_users | |
WHERE wp_usermeta.user_id = wp_users.ID | |
); | |
# Remove multisite only columns in users | |
alter table wp_users drop column spam; | |
alter table wp_users drop column deleted; |
NewerOlder