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 | |
// Update image asset IDs after migrating using WP All Import Pro. | |
// Use in the WP All Import Pro Function Editor: https://www.wpallimport.com/documentation/inline-php/ | |
// Uses the Dom\HTMLElement class for PHP 8.4.0+. https://www.php.net/manual/en/class.dom-htmlelement.php#class.dom-htmlelement | |
// Code provided by Trey Mills, [email protected]. Updated to use the Dom\HTMLElement class and support UTF-8 characters. | |
function my_update_images_in_content( $import_id ) { | |
global $wpdb; | |
$imported_posts = $wpdb->get_results( "SELECT `post_id` FROM `" . $wpdb->prefix . "pmxi_posts` WHERE `import_id` = '" . $import_id . "'" ); | |
foreach ( $imported_posts as $x_post ) { |
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 | |
// Update image asset IDs after migrating using WP All Import Pro. | |
// Use in the WP All Import Pro Function Editor: https://www.wpallimport.com/documentation/inline-php/ | |
// Uses DOMDocument::loadHTML for PHP 5-8. | |
// Code provided by Trey Mills, [email protected]. Updated to support UTF-8 characters. | |
function my_update_images_in_content( $import_id ) { | |
global $wpdb; | |
$imported_posts = $wpdb->get_results( "SELECT `post_id` FROM `" . $wpdb->prefix . "pmxi_posts` WHERE `import_id` = '" . $import_id . "'" ); | |
foreach ( $imported_posts as $x_post ) { |
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
" Configuration file for vim | |
set modelines=0 " CVE-2007-2438 | |
"" Encoding | |
set encoding=utf-8 | |
set fileencoding=utf-8 | |
set fileencodings=utf-8 | |
set ttyfast | |
" Normally we use vim-extensions. If you want true vi-compatibility |
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 | |
/* | |
Had a need to go a little further than PHP's sanitize filters would get me. Basically wanted a simple white list. | |
ex: filter_var ($variable, FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_HIGH) - still leaves a bunch of caracters I don't want in my variable | |
the preg_replace below will remove anything that isn't a letter, number or minus | |
*/ | |
$clean_var = preg_replace('/[^a-z0-9-]/', '', $variable); | |
?> |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |