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
| // Link Redirect Checker for Browser Console | |
| // Note: CORS limitations apply - this will only work fully for same-origin links | |
| (async function checkLinkRedirects() { | |
| // Configuration | |
| const DOMAIN = 'https://www.example.com'; // This is used to match against location.origin | |
| const TIMEOUT = 5000; // Request timeout in milliseconds | |
| const SELECTOR = '#some-selector a[href]'; | |
| // Color codes for console output |
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
| public function api_logout( $request ) { | |
| do_action( 'appp_logout_header' ); | |
| if( ! defined('DOING_AJAX') ) { | |
| define('DOING_AJAX', true); | |
| } | |
| wp_logout(); |
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
| function is_user_administrator(): bool { | |
| if ( function_exists( 'get_site_option' ) ) { | |
| $siteurl = get_site_option( 'siteurl' ); | |
| if ( $siteurl ) { | |
| global $wpdb; | |
| $cookie_hash = 'wordpress_logged_in_' . md5( $siteurl ); | |
| if ( ! isset( $_COOKIE[ $cookie_hash ] ) ) { | |
| return false; | |
| } |
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
| 'use strict'; | |
| const gulp = require( 'gulp' ); | |
| const sass = require( 'gulp-sass' ); | |
| const csso = require( 'gulp-csso' ); | |
| const concat = require( 'gulp-concat' ); | |
| const uglify = require( 'gulp-uglify'); | |
| const autoprefixer = require( 'gulp-autoprefixer' ); | |
| const notify = require( 'gulp-notify' ); | |
| const babel = require( 'gulp-babel' ); |
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
| #!/bin/bash | |
| FILES=$(find public_html -type f -name '*.gz') | |
| for f in $FILES | |
| do | |
| gzip -d $f | |
| # take action on each file. | |
| 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
| <?php | |
| define( 'automatic_updater_disabled', true ); | |
| define( 'wp_auto_update_core', false ); | |
| add_filter('site_transient_update_plugins', 'remove_update_notification'); | |
| function remove_update_notification($value) | |
| { | |
| unset($value->response['memberpress/memberpress.php']); |
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
| add_action( 'admin_init', 'add_theme_caps'); | |
| function add_theme_caps() { | |
| // add single role capability | |
| $role = get_role( 'administrator' ); | |
| $role->add_cap( 'manage_phrases' ); | |
| // add single user capability | |
| $user = new WP_User( 4766 ); | |
| $user->add_cap( 'manage_phrases' ); | |
| } |
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
| UPDATE `events` as EE | |
| LEFT JOIN events as EE1 | |
| ON EE.ID = EE1.ID | |
| SET EE.Year = YEAR(EE1.created), | |
| EE.Month = MONTH(EE1.created), | |
| EE.Day = DAY(EE1.created), | |
| EE.Hour = TIME(EE1.created), | |
| EE.DayOfWeek = DAYOFWEEK(EE1.created) |
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
| scrollTo (id) { | |
| window.scrollTo({ | |
| top: document.getElementById(id).offsetTop, | |
| left: 0, | |
| behavior: 'smooth' | |
| }); | |
| } | |
| // Doesn't work in IE | |
| //https://developer.mozilla.org/en-US/docs/Web/API/Window/scroll |
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
| const scrollToTop = () => { | |
| const c = document.documentElement.scrollTop || document.body.scrollTop; | |
| if (c > 0) { | |
| window.requestAnimationFrame(scrollToTop); | |
| window.scrollTo(0, c - c / 8); | |
| } | |
| }; | |
| scrollToTop(); | |
| // https://stackoverflow.com/questions/15935318/smooth-scroll-to-top |
NewerOlder