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 | |
namespace App\Form\Api; | |
use Symfony\Component\Form\FormInterface; | |
use Symfony\Component\Validator\ConstraintViolation; | |
trait FormValidationTrait | |
{ | |
private function getErrorsFromForm(FormInterface $form) |
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 | |
// Symfony 4 Manual Constraints. | |
// $obj is your entity object. | |
private $validator; | |
// Class ... | |
public function __constuct(ValidatorInterface $validator) |
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
cd ~ | |
sudo apt-get remove composer -y | |
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" | |
php -r "if (hash_file('sha384', 'composer-setup.php') === '48e3236262b34d30969dca3c37281b3b4bbe3221bda826ac6a9a62d6444cdb0dcd0615698a5cbe587c3f0fe57a54d8f5') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" | |
php composer-setup.php | |
php -r "unlink('composer-setup.php');" | |
sudo mv composer.phar /usr/local/bin/composer |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Var dumper Formater</title> | |
<style> | |
body { | |
font-family: "Courier New", Courier, monospace; | |
padding-bottom:50px; |
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
//Examples for: https://(www.)example.com/subFolder/yourfile.php?var=blabla#555 | |
//=================================================== | |
//========== self-defined SERVER variables ========== | |
//=================================================== | |
$_SERVER["DOCUMENT_ROOT"] 🡺 /home/user/public_html | |
$_SERVER["SERVER_ADDR"] 🡺 143.34.112.23 | |
$_SERVER["SERVER_PORT"] 🡺 80(or 443 etc..) | |
$_SERVER["REQUEST_SCHEME"] 🡺 https //like: $_SERVER["SERVER_PROTOCOL"] | |
$_SERVER['HTTP_HOST'] 🡺 example.com //like: $_SERVER["SERVER_NAME"] |
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" src="//downloads.mailchimp.com/js/signup-forms/popup/embed.js" data-dojo-config="usePlainJson: true, isDebug: false"></script> | |
<script type="text/javascript"> | |
function showNewsletter() { | |
// Replace with YOUR list values | |
require(["mojo/signup-forms/Loader"], function(L) { L.start({"baseUrl":"YOUR-BASEURL","uuid":"YOUR-UUID","lid":"YOUR-LID"}) }); | |
// Disable MCPopupClosed cookie for being able to re-open the popup | |
document.cookie = "MCPopupClosed=;path=/;expires=Thu, 01 Jan 1970 00:00:00 UTC"; | |
// Disable MCPopupSubscribed cookie for being able to re-open the popup once suscribed |
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
// Set homepage as default "Return to Shop" button URL in cart page. | |
function wc_empty_cart_redirect_url() { | |
return get_home_url(); | |
} | |
add_filter( 'woocommerce_return_to_shop_redirect', 'wc_empty_cart_redirect_url' ); |
NewerOlder