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 | |
/** | |
* Shortcode - Render Wordpress login form | |
**/ | |
add_shortcode('wp_login_form', function() { | |
if (is_user_logged_in()) { | |
} else { | |
ob_start(); |
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
// Make sure you include the plugin_wrapper as last item in config.extraPluins | |
CKEDITOR.editorConfig = function(config) { | |
config.extraPlugins = 'autosave,plugin_wrapper'; | |
// Define empty autosave object | |
config.autosave = {}; | |
} | |
// Extend instance plugins | |
CKEDITOR.plugins.add('plugin_wrapper', { |
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 | |
// Requires PHP 5.4+ | |
function getWorkingDaysFrom($start, $amtOfDays) { | |
$globalDays = 0; // a global addition to $amtOfDays (such as a minimum shipping time of 3 days across all objects) | |
$amtOfDays = $amtOfDays + $globalDays; // set base amount of days for initial range before calculations applied | |
$ignore = array('6', '7'); // days of the week to ignore (weekends are 6 & 7) in ISO-8061 | |
$holidays = array( | |
(new DateTime('first monday of january +1 year'))->format('*-m-d'), // new years day (celebrated) |
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 | |
# Idea from: https://github.com/zenseo/opencart-needless-image | |
# PHP is not good enough to run this through a large store with many images | |
# Bash cp cant hold enough arguments from file output unless its batched | |
# Rclone is the best bet: | |
# rsync -asv --dry-run --recursive --remove-source-files --checksum --files-from=some-file.txt . destination/ | |
function findImages() { | |
$tables_to_check = array( |
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
<script type="text/javascript"> | |
$(document).ready(function() { | |
$('.colorbox').colorbox({ | |
onLoad: function() { | |
history.pushState(null, document.title + ' [colorbox-active]', window.location.pathname + window.location.search + '#colorbox-active'); | |
window.onpopstate = function(event) { | |
$.colorbox.close(); | |
}; | |
}, | |
onClosed: 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
cyan=$(tput setaf 6) | |
bold=$(tput bold) | |
reset=$(tput sgr0) | |
whm-max() { | |
# Boosts WHM power for exports/imports | |
if [ -z "$1" ]; then | |
vars="3000" | |
else | |
vars=$1 |
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
## Grabbing a dispatch from CS-Cart | |
{if $smarty.request.dispatch == 'index.index'} | |
## Grabbing user group from CS-Cart | |
{$auth.usergroup_ids[2]} | |
## Admin user condition from CS-Cart | |
## $_SESSION prob isnt available, so $auth works instead | |
{if $auth.user_id && $auth.user_type == 'A'} |
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
# https://documentation.cpanel.net/display/SDK/Guide+to+Standardized+Hooks+-+The+manage_hooks+Utility | |
# To add a script to upcp schema (as a hook) | |
/usr/local/cpanel/bin/manage_hooks add script /root/src/cpanel-hooks/postupcp.sh --manual --category System --event upcp --stage post | |
# To remove a script as hook from upcp schema | |
/usr/local/cpanel/bin/manage_hooks delete script /root/src/cpanel-hooks/postupcp.sh --manual --category System --event upcp --stage post | |
# To list current hooks ( | |
/usr/local/cpanel/bin/manage_hooks list |
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
<NotepadPlus> | |
<UserLang name="Smarty-DH" ext="tpl" udlVersion="2.1"> | |
<Settings> | |
<Global caseIgnored="no" allowFoldOfComments="no" foldCompact="no" forcePureLC="0" decimalSeparator="0" /> | |
<Prefix Keywords1="no" Keywords2="no" Keywords3="yes" Keywords4="no" Keywords5="no" Keywords6="no" Keywords7="no" Keywords8="no" /> | |
</Settings> | |
<KeywordLists> | |
<Keywords name="Comments">00{* 01 02*} 03 04*</Keywords> | |
<Keywords name="Numbers, prefix1"></Keywords> | |
<Keywords name="Numbers, prefix2"></Keywords> |
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 | |
// These 3 functions are part of a more extensive module class | |
private function chkField($table, $field) { | |
$field = $this->db->query("DESC " . DB_PREFIX . $table . " '%" . $field . "%'"); | |
if ($field->row) { | |
return true; | |
} | |
NewerOlder