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 | |
/** | |
* Insert an element before certain array key of an associative array. | |
* If no key is found,the element will be inserted at the end | |
* | |
* @since 1.0.0 | |
* | |
* @param array $origin The original array where the element will be inserted | |
* @param mixed $element The element to insert |
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
# fix EOL error for multiple environments for text files | |
*.* text eol=lf | |
# set image and fonts as binary | |
*.png binary | |
*.jpg binary | |
*.gif binary | |
*.pdf binary | |
*.eps binary | |
*.zip binary |
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 BuildPhar | |
{ | |
private $_sourceDirectory = null; | |
private $_stubFile = null; | |
private $_outputDirectory = null; | |
private $_pharFileName = 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
<?php | |
# Enable WP_DEBUG mode, logging to the /wp-content/debug.log file , without displaying on screen errors and warnings | |
define('WP_DEBUG', true); | |
define( 'WP_DEBUG_LOG', true ); | |
define( 'WP_DEBUG_DISPLAY', false ); | |
@ini_set( 'display_errors', 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
(function( $ ) { | |
'use strict'; | |
// DOM ready | |
$(function() { | |
}); | |
// Window loaded | |
$(window).on("load",function(){ |
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 | |
/** | |
* @since 1.0.0 | |
* | |
* @param $plugin_name | |
*/ | |
public static function activate($plugin_name) { | |
# Initialize variables |
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
/** Get a value from the Query params */ | |
function otkGetQueryParam(name, url = window.location.href) { | |
let objectURL = new URL( url ); | |
let searchParams = new URLSearchParams( objectURL.search ); | |
return searchParams.get(name); | |
} | |
/** Set a value to the Query params */ | |
function otkSetQueryParam(name, url = window.location) { | |
const urlObj = new URL(url); |
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 | |
# After enquequing the JS add this localization to add the nonce and other variables | |
$params = [ | |
'action' => 'your_action', | |
'wp_nonce' => wp_create_nonce( 'wp_ajax_nonce' ), | |
'error' => __('There was an error with the Ajax call. Please try again later'), | |
]; | |
wp_localize_script( 'custom_ajax_params', 'wp_globals', $params ); |
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 add the text dynamically, use a class (overlay-title) in the h2 to catch the object and modify h2::before for "overlay-title-shadow" | |
(function( $ ) { | |
'use strict'; | |
// Window loaded | |
$(window).on("load",function(){ | |
const postTitleObj = $( '.overlay-title h2' ); | |
if( 0 < postTitleObj.length ) { | |
postTitleObj.before( '<div class="overlay-title-shadow">' + postTitleObj.html() + '</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
<?php | |
spl_autoload_register(function($required_file) { | |
# Transform file name from class based to file based | |
$fixed_name = strtolower( str_ireplace( '_', '-', $required_file ) ); | |
$file_path = explode( '\\', $fixed_name ); | |
$last_index = count( $file_path ) - 1; | |
$file_name = "class-{$file_path[$last_index]}.php"; | |
# Get fully qualified path |
OlderNewer