Skip to content

Instantly share code, notes, and snippets.

@Alexander-Pop
Alexander-Pop / form_key_checks.txt
Last active February 1, 2019 16:50 — forked from drobinson/form_key_checks.txt
Magento - form key validation #magento
List (and command that generated it) of places that form key validation has been added in 1.13.1
Controllers that have added form key validation:
$ git grep --files-with-matches "this->_validateFormKey())" <core_sources_update_commit_hash>
<core_sources_update_commit_hash>:app/code/core/Enterprise/Checkout/controllers/CartController.php
<core_sources_update_commit_hash>:app/code/core/Enterprise/GiftRegistry/controllers/IndexController.php
<core_sources_update_commit_hash>:app/code/core/Enterprise/GiftRegistry/controllers/ViewController.php
<core_sources_update_commit_hash>:app/code/core/Enterprise/Reward/controllers/CustomerController.php
<core_sources_update_commit_hash>:app/code/core/Enterprise/Wishlist/controllers/SearchController.php
<core_sources_update_commit_hash>:app/code/core/Mage/Catalog/controllers/Product/CompareController.php
@Alexander-Pop
Alexander-Pop / curl-download-extract-zip.php
Last active February 23, 2022 18:45 — forked from thagxt/dl-ex.php
Download & Extract .zip with cURL #php #curl #file #zip
<?php
$url = "https://wordpress.org/latest.zip";
$zipFile = "wordpress.zip"; // Local Zip File Path
$zipResource = fopen($zipFile, "w");
// Get The Zip File From Server
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FAILONERROR, true);
curl_setopt($ch, CURLOPT_HEADER, 0);
@Alexander-Pop
Alexander-Pop / magento2-get-product-info.php
Last active September 5, 2019 15:59 — forked from thagxt/get-product-info.php
[get Product URL, Name and ID] get Product URL, get Product Name and get Product ID #magento2
<?php
// get current page URL
$URL = $this->getUrl('*/*/*', ['_current' => true, '_use_rewrite' => true]);
// get current product name & ID
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$product = $objectManager->get('Magento\Framework\Registry')->registry('current_product'); //get current product
$id = $product->getId();
$title = $product->getName();
@Alexander-Pop
Alexander-Pop / mage2-multiweb-subdir.md
Last active September 5, 2019 16:00 — forked from thagxt/mage2-multiweb-subdir.md
[Magento 2 multiple websites] Magento 2 multiple websites in sub directories #magento2

Set up Magento 2 multiple websites in sub directories

  1. Go to Admin > Stores > All Stores
  2. Click > Create Web Site
  3. In the Name field, enter store name.
    • e.g. Japan
  4. In the Code field, enter a unique string without spaces and > Save Web Site
    • e.g. super_jp
  5. Create Store
  6. Create Store View
@Alexander-Pop
Alexander-Pop / strip-https
Last active February 1, 2019 16:53 — forked from thagxt/strip-https
Remove both http:// & https:// from URL #php
<?php
$url = "https://example.com/";
$url = preg_replace('/^https?:\/\//', '', $url);
// output: example.com/
?>
@Alexander-Pop
Alexander-Pop / recently-updated-feed.php
Last active February 1, 2019 16:53 — forked from thagxt/recently-updated-feed.php
Custom RSS feed for WordPress with the latest updated posts. #feed #wp
<?php
/**
* Template Name: RSS - Recently Updated
*/
$args = array(
'post_type' => 'post',
'post_status' => 'publish',
'orderby' => 'modified',
'order' => 'DESC',
@Alexander-Pop
Alexander-Pop / login.php
Last active February 1, 2019 16:54 — forked from thagxt/login.php
simple PHP login without a database #php #form
<?php
session_start();
// ***************************************** //
// ********** DECLARE VARIABLES ********** //
// ***************************************** //
$username = 'username';
$password = 'password';
@Alexander-Pop
Alexander-Pop / home.php
Last active February 1, 2019 16:54 — forked from thagxt/home.php
Limit WordPress' the_excerpt to the first full stop / period #wp
<?php
// Limit WordPress' the_excerpt to the first full stop / period
$strings = preg_split('/(\.|!|\?)\s/', strip_tags($post->post_content), 2, PREG_SPLIT_DELIM_CAPTURE);
$excerpt = apply_filters('the_excerpt', $strings[0] . $strings[1]);
echo $excerpt;
?>
@Alexander-Pop
Alexander-Pop / functions.php
Last active June 28, 2019 14:10 — forked from thagxt/functions.php
WP - Function to add a class to all your "POST" images in WordPress and get them ready for lazyload. #wp
<?php
function lazyload_filter_content($content) {
global $post; // getting The whole post objects
$content = $post->post_content;
if( is_singular() && is_main_query() ) {
//Renaming images for lazy loader!!!
@Alexander-Pop
Alexander-Pop / csv-as-html-table.php
Created June 28, 2017 22:10 — forked from thagxt/csv-as-html-table.php
Display CSV file as HTML Table with first 2 columns clickable
<?php
$file = "releases.csv"; // your csv file name
$directory = $_SERVER['DOCUMENT_ROOT']."/var/releases/".$file; // path to file
$row = 1; // horizontal
if (($handle = fopen($directory, "r")) !== FALSE) {
echo '<table id="releases-calendar">';
while (($data = fgetcsv($handle, 1000, ";")) !== FALSE) { // change ";" if your csv delimiter is different...