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
image: jakzal/phpqa:alpine | |
cache: | |
paths: | |
- vendor/ | |
stages: | |
- Code Quality | |
coding-standards: |
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/sh | |
today=$(date +"%Y-%m-%d") | |
path=$(date +"%Y/%m/%d") | |
rm -rf ./backups | |
mkdir ./backups | |
tar --exclude='./public_html/cgi-bin' --exclude='*.zip' --exclude='./public_html/wp-content/cache' -zcvf ./backups/$today.tar.gz ./public_html > /dev/null | |
./wp db export --add-drop-table --path=./public_html/ - | gzip > "./backups/$today.sql.gz" | |
curl --user "user:pass" -T "./backups/$today.tar.gz" "https://domain.com/remote.php/webdav/folder/$path/domain-$today.tar.gz" |
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_block_gutenberg( $content, $blockname ) { | |
$blockname = str_replace('/', '\/',preg_quote($blockname)); | |
return preg_replace('/\<\!\-\- ' . $blockname . '[^)]+\/' . $blockname . ' \-\-\>/', '', $content); | |
} | |
// Based on this ticket https://wordpress.org/support/topic/strip-table-of-content-from-excerpt/ | |
// There is a block that we don't want on excerpt automatically generated, | |
// Automatic excerpt cut the content and this can generate a broken content |
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 | |
// Based on https://wordpress.org/support/topic/how-to-change-minified-css-file-name/ | |
// Get all the files, read them, concat them, get a md5 hash, cut at 10 and generate a new filename | |
// Why? | |
// W3TC generate the hashname based on the filenames so not invalidate the cache if there are changes | |
add_filter('w3tc_minify_urls_for_minification_to_minify_filename', 'w3tc_filename_filter', 20, 3); | |
function w3tc_filename_filter($minify_filename, $files, $type ){ | |
$path_parts = pathinfo( $minify_filename ); | |
$content = ''; |
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
#!/usr/bin/env bash | |
function extract() { | |
echo "Estraggo $1.rar" | |
unrar e "./$1.rar" \*.txt \*.wav './clips-mitads/' -o+ | |
} | |
if [ ! -d './clips-mitads' ]; then | |
mkdir './clips-mitads' | |
fi |
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
class VVVScripts < Vagrant.plugin(2, :command) | |
def self.synopsis | |
"Execute script from /config/homebin/" | |
end | |
def execute | |
with_target_vms(nil, single_target: true) do |vm| | |
@env.ui.output "#{$yellow}Executing #{$red}#{ARGV[1]}#{$creset}\n" | |
vm.action(:ssh_run, ssh_run_command: "/srv/config/homebin/#{ARGV[1]}" ) | |
end |
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 | |
/** | |
* Plugin Name: Alert Last Login | |
* Plugin URI: | |
* Description: | |
* Version: 1.0.0 | |
* Author: Codeat | |
* Author URI: http://codeat.it | |
* License: GPL-2.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 | |
add_filter('rest_authentication_errors', function ($result) { | |
if (!empty($result)) { | |
return $result; | |
} | |
$access = is_user_logged_in(); | |
if ( !$access ) { | |
if ( !isset($_GET['iwantthem']) || isset($_GET['iwantthem']) && $_GET['iwantthem'] !== 'yes' ) { |
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 | |
mysql --user='[users]' --password='[psw]' --database='[db]' --execute="UPDATE user SET verification_token = NULL WHERE user.verification_token IS NOT NULL;" |
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
#!/usr/bin/env bash | |
cd /opt/mozita/ | |
cd ./mozitaantispam_bot/ | |
git fetch --all | |
if [[ $(git rev-list HEAD...origin/master --count) -ne 0 ]]; then | |
pkill -f antispam_mozita.py | |
git stash | |
git pull |