BP_GOPP_Image_Editor_GS::gs_cmd_path()

Returns the path of the Ghostscript executable.

Description

Return

(false|string) Returns false if can't determine path, else path string.

Source

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

	protected static function gs_cmd_path() {
		if ( null === self::$gs_cmd_path ) {
			/**
			 * Returning a valid path will short-circuit determining the path of the Ghostscript executable.
			 * Useful if your Ghostscript installation is in a non-standard location.
			 *
			 * @since BuddyBoss 1.4.0
			 *
			 * @param string $gs_cmd_path The path to the Ghostscript executable. Default null.
			 * @param bool   $is_win      True if running on Windows.
			 */
			$shortcircuit_path = apply_filters( 'gopp_image_gs_cmd_path', self::$gs_cmd_path, self::is_win() );
			// See also if we've a cached value.
			$transient = get_transient( 'gopp_image_gs_cmd_path' );
			// Only use transient if no filtered value or they're the same.
			if ( $transient && ( ! $shortcircuit_path || $transient === $shortcircuit_path ) ) {
				self::$gs_cmd_path = $transient;
			} else {
				if ( $shortcircuit_path && self::test_gs_cmd( $shortcircuit_path ) ) {
					self::$gs_cmd_path = $shortcircuit_path;
				} else {
					if ( self::is_win() ) {
						self::$gs_cmd_path = self::gs_cmd_win();
					} else {
						self::$gs_cmd_path = self::gs_cmd_nix();
					}
				}
				if ( self::$gs_cmd_path ) {
					set_transient( 'gopp_image_gs_cmd_path', self::$gs_cmd_path, BP_GOPP_IMAGE_EDITOR_GS_TRANSIENT_EXPIRATION );
				} elseif ( $transient ) {
					delete_transient( 'gopp_image_gs_cmd_path' );
				}
			}
		}
		return self::$gs_cmd_path;
	}

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.