This file contains 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 | |
$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... |
This file contains 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
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 |
This file contains 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 | |
$url = "https://example.com/"; | |
$url = preg_replace('/^https?:\/\//', '', $url); | |
// output: example.com/ | |
?> |
This file contains 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 | |
/** | |
* Template Name: RSS - Recently Updated | |
*/ | |
$args = array( | |
'post_type' => 'post', | |
'post_status' => 'publish', | |
'orderby' => 'modified', | |
'order' => 'DESC', |
This file contains 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 | |
session_start(); | |
// ***************************************** // | |
// ********** DECLARE VARIABLES ********** // | |
// ***************************************** // | |
$username = 'username'; | |
$password = 'password'; |
This file contains 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 | |
// 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; | |
?> |
This file contains 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 | |
/* @ http://stackoverflow.com/a/12628971 */ | |
function isValidUrl($url){ | |
// first do some quick sanity checks: | |
if(!$url || !is_string($url)){ | |
return false; | |
} | |
// quick check url is roughly a valid http request: ( http://blah/... ) | |
if( ! preg_match('/^http(s)?:\/\/[a-z0-9-]+(.[a-z0-9-]+)*(:[0-9]+)?(\/.*)?$/i', $url) ){ | |
return false; |
This file contains 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 | |
$oldname = "index.html"; | |
$newname = "index.php"; | |
// checking if file exist or not. | |
if ( file_exists($oldname) && ( (!file_exists($newname))|| is_writable($newname) ) ) { | |
$renameResult = rename($oldname, $newname); | |
die($oldname . " renamed to " . $newname); | |
} else { | |
die('nothing to rename.'); |
This file contains 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 | |
/* @ http://stackoverflow.com/a/12628971 */ | |
function getHttpResponseCode_using_getheaders($url, $followredirects = true){ | |
// returns string responsecode, or false if no responsecode found in headers (or url does not exist) | |
// NOTE: could potentially take up to 0-30 seconds , blocking further code execution (more or less depending on connection, target site, and local timeout settings)) | |
// if $followredirects == false: return the FIRST known httpcode (ignore redirects) | |
// if $followredirects == true : return the LAST known httpcode (when redirected) | |
if(! $url || ! is_string($url)){ | |
return false; |
This file contains 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 | |
/* | |
1) Create a CSV File with Before and After SKUs. | |
- In the first column, list your current SKUs and in the second column list the new SKUs. | |
- Do not include headings in your CSV file. | |
- Be sure this file is saved as a CSV file in the UTF-8 or ANSI encoding. You might run into problems with this if you create the file using Excel. | |
2) Upload the CSV file to the var/export directory on your Magento server so that it’s path is /var/export/sku2sku.csv. | |
3) Run the Script | |
+ If you run into the following error, don’t worry too much. Just re-run the script and see if more SKUs get updated. | |
- Cannot retrieve products from Magento: SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction |
OlderNewer