Last active
April 29, 2022 18:16
-
-
Save sethryder/22c4ed1b8a7b3b31090ace2cfd39fb09 to your computer and use it in GitHub Desktop.
Revisions
-
Seth Ryder revised this gist
Oct 31, 2018 . No changes.There are no files selected for viewing
-
Seth Ryder revised this gist
Oct 31, 2018 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -30,4 +30,4 @@ } file_put_contents('fixed_export_plain.txt', serialize($new_export_plain)); file_put_contents('fixed_base.txt', serialize($new_base)); -
Seth Ryder created this gist
Oct 31, 2018 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,33 @@ <?php $option_value_export_plain = file_get_contents('export_plain.txt'); $option_value_base = file_get_contents('base.txt'); $export_plain = unserialize($option_value_export_plain); $base = unserialize($option_value_base); $new_export_plain = []; foreach ($export_plain as $k => $redirect) { $new_url = preg_replace("/([0-9]{4})\/([0-9]{2})\/([0-9]{2})\//", "", $redirect['url']); $new_key = preg_replace("/([0-9]{4})\/([0-9]{2})\/([0-9]{2})\//", "", $k); $new_export_plain[$new_key] = []; $new_export_plain[$new_key]['url'] = $new_url; $new_export_plain[$new_key]['type'] = $redirect['type']; } foreach ($base as $k => $redirect) { $new_origin = preg_replace("/([0-9]{4})\/([0-9]{2})\/([0-9]{2})\//", "", $redirect['origin']); $new_url = preg_replace("/([0-9]{4})\/([0-9]{2})\/([0-9]{2})\//", "", $redirect['url']); $new_base[] = array( 'origin' => $new_origin, 'url' => $new_url, 'type' => $redirect['type'], 'format' => $redirect['format'] ); } file_put_contents('fixed_export_plain.txt', serialize($new_export_plain)); file_put_contents('fixed_export_base.txt', serialize($new_base));