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
:: Create new Virtual Host for WAMP SERVER | |
:: IMPORTANT!!! Run this script as Administrator | |
:: IMPORTANT!!! Make sure that variable vhosts_path is configured properly | |
@ECHO OFF | |
:: Path to the Apache VHosts file | |
SET vhosts_path=D:\work\wamp\bin\apache\apache2.4.9\conf\extra\httpd-vhosts.conf | |
:: Path to the WWW Directory | |
SET www_path=D:\work\wamp\www | |
SET www_path_unix=D:/work/wamp/www |
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 wp_options SET option_value = replace(option_value, 'http://OLDDOMAIN', 'http://NEWDOMAIN') WHERE option_name = 'home' OR option_name = 'siteurl'; | |
UPDATE wp_posts SET guid = replace(guid, 'http://OLDDOMAIN','http://NEWDOMAIN'); | |
UPDATE wp_posts SET post_content = replace(post_content, 'http://OLDDOMAIN', 'http://NEWDOMAIN'); |
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 | |
/** | |
* Simple logger for WordPress plugins | |
* Author: Max Kostinevich | |
* Author URI: https://maxkostinevich.com | |
* Version: 1.0.0 | |
* License: MIT | |
* 2015 (c) Max Kostinevich | |
*/ |
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 | |
/* | |
* Convert multi-line string to UL-list | |
* 1. Explode the multi-line string ($string) into array by the new line symbol ("\n") | |
* 2. Convert the array back into the string using "implode" function and append the ul and li tags. | |
*/ | |
function str_to_list($str){ | |
return '<ul><li>' .implode('</li><li>', explode("\n", $str)). '</li></ul>'; | |
} |
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
/** | |
* Create Image from any friendly format | |
* | |
* Return: Image Resource | |
*/ | |
function imageCreateFromAny($filepath) { | |
$type = exif_imagetype($filepath); // [] if you don't have exif you could use getImageSize() | |
$allowedTypes = array( | |
1, // [] gif | |
2, // [] jpg |
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 readURL(input) { | |
if (input.files && input.files[0]) { | |
var reader = new FileReader(); | |
reader.onload = function (e) { | |
$('#blah').attr('src', e.target.result); | |
} | |
reader.readAsDataURL(input.files[0]); |
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 | |
// RESTRICT ACCESS TO WP-ADMIN DASHBOARD | |
function restrict_admin_access(){ | |
if( !current_user_can( 'edit_posts' ) ) { | |
wp_redirect( home_url() ); | |
die(); | |
} | |
} | |
add_action( 'admin_init', restrict_admin_access, 1 ); | |
?> |
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 | |
/* Get user IP Address */ | |
function getUserIP() { | |
$IPAddress = ''; | |
if ($_SERVER['HTTP_CLIENT_IP']) | |
$IPAddress = $_SERVER['HTTP_CLIENT_IP']; | |
else if($_SERVER['HTTP_X_FORWARDED_FOR']) | |
$IPAddress = $_SERVER['HTTP_X_FORWARDED_FOR']; | |
else if($_SERVER['HTTP_X_FORWARDED']) | |
$IPAddress = $_SERVER['HTTP_X_FORWARDED']; |
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
# Force HTTPS for the main domain | |
# Replace DOMAIN.COM with your domain name | |
RewriteEngine On | |
RewriteCond %{HTTPS} off | |
# Only redirect to https if the main domain (not subdomain) is matched | |
# case-insensitively in HTTP_HOST | |
RewriteCond %{HTTP_HOST} ^DOMAINNAME\.COM$ [NC] | |
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] | |
#Disable force HTTPS for subdomains |
NewerOlder