boboudreau
Forum Replies Created
-
Actually, that’s not going to be true. Simply replacing the deprecated constant for the recommended one won’t fix anything.
A mu-plugin will still not match the location of
WP_PLUGIN_DIR
. You should probably check to see if there’s a match at all before making any modification to the URL.Forum: Plugins
In reply to: [XPoster - Share to Bluesky and Mastodon] Error when using php 7Ah, nevermind. I was looking at an old version of the plugin. Looks like you fixed this in a recent release.
Forum: Plugins
In reply to: [XPoster - Share to Bluesky and Mastodon] Error when using php 7Yeah, you’re missing an entire function in your fallback logic. You haven’t defined
mb_substr_split_uncode
anywhere in your code.FWIW, you probably copied a portion of your stuff (or at least, they are doing the same things as you) from here:
https://doc.wikimedia.org/mediawiki-core/master/php/Fallback_8php_source.html.It looks like PHP 7 does not fail gracefully when using
self
outside of the context of a class, which shouldn’t be done anyways, and is probably a result of copy/pasta of this code from somewhere else, where it WAS included as part of a class.I’m making this change to my code locally, but you might want to include this diff in your next release of WPT:
@@ -293,14 +293,59 @@ if ( ! function_exists( 'mb_strlen' ) ) { } if ( ! function_exists( 'mb_substr' ) ) { + function mb_substr_split_unicode( $str, $splitPos ) { + if ( $splitPos == 0 ) { + return 0; + } + + $byteLen = strlen( $str ); + + if ( $splitPos > 0 ) { + if ( $splitPos > 256 ) { + // Optimize large string offsets by skipping ahead N bytes. + // This will cut out most of our slow time on Latin-based text, + // and 1/2 to 1/3 on East European and Asian scripts. + $bytePos = $splitPos; + while ( $bytePos < $byteLen && $str[$bytePos] >= "\x80" && $str[$bytePos] < "\xc0" ) { + ++$bytePos; + } + $charPos = mb_strlen( substr( $str, 0, $bytePos ) ); + } else { + $charPos = 0; + $bytePos = 0; + } + + while ( $charPos++ < $splitPos ) { + ++$bytePos; + // Move past any tail bytes + while ( $bytePos < $byteLen && $str[$bytePos] >= "\x80" && $str[$bytePos] < "\xc0" ) { + ++$bytePos; + } + } + } else { + $splitPosX = $splitPos + 1; + $charPos = 0; // relative to end of string; we don't care about the actual char position here + $bytePos = $byteLen; + while ( $bytePos > 0 && $charPos-- >= $splitPosX ) { + --$bytePos; + // Move past any tail bytes + while ( $bytePos > 0 && $str[$bytePos] >= "\x80" && $str[$bytePos] < "\xc0" ) { + --$bytePos; + } + } + } + + return $bytePos; + } + function mb_substr( $str, $start, $count = 'end' ) { if ( $start != 0 ) { - $split = self::mb_substr_split_unicode( $str, intval( $start ) ); + $split = mb_substr_split_unicode( $str, intval( $start ) ); $str = substr( $str, $split ); } if ( $count !== 'end' ) { - $split = self::mb_substr_split_unicode( $str, intval( $count ) ); + $split = mb_substr_split_unicode( $str, intval( $count ) ); $str = substr( $str, 0, $split ); }
Sorry for any confusion – so any child site’s home URL, as returned by the function
get_blogaddress_by_id()
will return https://basesite.com/childsitepath with the subdirectory you set the child site up with initially.The domain mapping plugin itself will still properly map https://childsite.com to the blog defined in your base site as https://basesite.com/childsitepath, so clicking the link takes you to the right place. Point being,
get_blogaddress_by_id
does not provide a mechanism (action hook, or filter) to change the URL to the domain-mapped version, or append a security string after wp-login.php.I’ve already provided a patch to WordPress, so we’ll see if that’s something everyone is comfortable with (https://core.trac.www.ads-software.com/ticket/26855). I don’t know why there are even calls to both
get_blogaddress_by_id
andget_site_url
, or why WordPress stores the site URL in two places (wp_blogs, wp_#_options).I’m using Bit51’s Better WordPress Security Plugin (now maintained by iThemes), which has a “hide backend” feature, forcing users to type in a special URL to be redirected to wp-login (with a secret key). I’d like users to go to this secret URL, or at least have the secret key appended to any link generated by WordPress.
Forum: Plugins
In reply to: [WP Super Cache] Query string URLs are not cachedHey… I just posted effectively the same thing (https://www.ads-software.com/support/topic/caching-pages-with-get-querystrings) and saw that you just posted a few hours ago.
Hopefully my post contains more details and someone will decide to take a look (or I do, just when I get some free time).