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
sudo chmod 0755 /var/www | |
sudo chmod 0755 /var/www/html | |
sudo chmod 0640 /var/www/html/wp-config.php | |
sudo chown -R www-data:www-data /var/www/html | |
sudo find /var/www/html -type d -exec chmod 0755 {} \; | |
sudo find /var/www/html -type f -exec chmod 0644 {} \; | |
sudo find /var/www/html/wp-content/plugins -type f -name "*" -not -name "*.o" -exec sh -c ' | |
case "$(head -n 1 "$1")" in | |
?ELF*) exit 0;; | |
MZ*) exit 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
#!/bin/bash | |
files=() | |
for home in /home/*; do | |
if [[ -d "${home}/public_html" ]]; then | |
if [[ -f "${home}/public_html/wp-config.php" ]]; then | |
files+=("${home}/public_html/wp-config.php") | |
fi | |
for folder in ${home}/public_html/*; do |
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 | |
sudo apt-get install -y xvfb | |
sudo apt-get install -y wkhtmltopdf | |
sudo apt-get install -y pdftk |
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 | |
function replace_scripts_with_src( $html ) { | |
$html = preg_replace( '`\<script\b[^\x3e]*\bsrc\b[\x00-\x20\x7f]*\=[\x00-\x20\x7f]*(?:[\x22](?:[^\x22]*)[\x22]|[\x27](?:[^\x27]*)[\x27]|[^\x20\x3e]*)[^\x3c]*(?:(?!\<\/script\>)\<[^\x3c]*)*\<\/script\>`i', '', $html ); | |
return $html; | |
} | |
$old_html = file_get_contents( 'https://www.facebook.com' ); | |
$new_html = replace_scripts_with_src( $old_html ); |
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 | |
function remove_scripts_with_src( $html ) { | |
$use_errors = libxml_use_internal_errors( true ); | |
$dom = new \DOMDocument(); | |
$dom->loadHTML( $html ); | |
$scripts = $dom->getElementsByTagName( 'script' ); | |
for ( $i = $scripts->length - 1; $i >= 0; $i-- ) { | |
if ( !( $item = $scripts->item( $i ) ) ) { | |
continue; |
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 | |
function count_chars_delimiter( string $str, string $delimiter = ',' ) { | |
$arr = []; | |
foreach ( array_filter( array_map( 'trim', explode( $delimiter, $str ) ), function( $v ) { return ( $v !== '' ); } ) as $value ) { | |
$arr[$value] = isset( $arr[$value] ) ? $arr[$value] : 0; | |
$arr[$value]++; | |
} | |
return $arr; | |
} |
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
<IfModule mod_php5.c> | |
php_value memory_limit 512M | |
</IfModule> | |
<IfModule mod_php7.c> | |
php_value memory_limit 512M | |
</IfModule> |
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 | |
function ipadd( $ip, $add ) { | |
if ( ( $long = ip2long( $ip ) ) === false ) { | |
return false; | |
} | |
return long2ip( $long + $add ); | |
} | |
$old_ip = '198.162.0.2'; |
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
<script type="text/javascript"> | |
function hasTouchEvent() { | |
try { | |
document.createEvent("TouchEvent"); | |
return true; | |
} catch(e) { | |
return false; | |
} | |
} | |
if (hasTouchEvent()) { |
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 | |
function my_prefix_jpeg_quality( $quality, $context ) { | |
return 90; | |
} | |
add_filter( 'jpeg_quality', 'my_prefix_jpeg_quality', 10, 2 ); | |
?> |
NewerOlder