BP_GOPP_Image_Editor_GS::escapeshellarg( string $arg )

It’s too tiresome to have to deal with PHP’s setlocale() to avoid UTF-8 mangling so just do escaping ourselves.

Description

Parameters

$arg

(Required) Shell argument to escape.

Return

(string)

Source

File: bp-document/classes/class-bp-gopp-image-editor-gs.php

	protected static function escapeshellarg( $arg ) {
		// Note that the only things we're really going to escape, given the strict base file name check,
		// is the "WP_CONTENT_DIR/uploads" directory and the path to the Ghostscript executable.
		if ( self::is_win() ) {
			// Note bang was not zapped in versions of PHP older than about Jul 2015.
			$arg = '"' . str_replace( array( '%', '!', '"' ), ' ', $arg ) . '"'; // So will get "not found" error if any of these chars in directory path.
		} else {
			$arg = "'" . str_replace( "'", "'\\''", $arg ) . "'";
		}
		return $arg;
	}

Changelog

Changelog
Version Description
BuddyBoss 1.4.0 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.