HEX
Server: Apache
System: Linux uyu7574470001-7d78c9ff74-xfpwm 4.19.91-21.al7.x86_64 #1 SMP Wed Sep 2 19:47:49 CST 2020 x86_64
User: ()
PHP: 7.4.16
Disabled: chmod,exec,system,passthru,shell_exec,escapeshellarg,escapeshellcmd,proc_close,proc_open,ini_alter,dl,popen,pcntl_exec,socket_accept,socket_bind,socket_clear_error,socket_close,socket_connect,socket_create_listen,socket_create_pair,socket_create,socket_get_option,socket_getpeername,socket_getsockname,socket_last_error,socket_listen,socket_read,socket_recv,socket_recvfrom,socket_select,socket_send,socket_sendto,socket_set_block,socket_set_nonblock,socket_set_option,socket_shutdown,socket_strerror,socket_write,stream_socket_client,stream_socket_server,pfsockopen,disk_total_space,disk_free_space,chown,diskfreespace,getrusage,get_current_user,getmyuid,getmypid,dl,leak,listen,chgrp,link,symlink,dlopen,proc_nice,proc_get_stats,proc_terminate,shell_exec,sh2_exec,posix_getpwuid,posix_getgrgid,posix_kill,ini_restore,mkfifo,dbmopen,dbase_open,filepro,filepro_rowcount,posix_mkfifo,putenv,sleep,fsockopen
Upload Files
File: /usr/home/uyu7574470001/htdocs/wp-content/plugins/super-progressive-web-apps/public/manifest.php
<?php
/**
 * Manifest related functions of SuperPWA
 *
 * @since 1.0
 * 
 * @function	superpwa_manifest()						Manifest filename, absolute path and link
 * @function	superpwa_generate_manifest()			Generate and write manifest
 * @function	superpwa_add_manifest_to_wp_head()		Add manifest to header (wp_head)
 * @function	superpwa_register_service_worker()		Register service worker in the footer (wp_footer)
 * @function	superpwa_delete_manifest()				Delete manifest
 * @function 	superpwa_get_pwa_icons()				Get PWA Icons
 * @function	superpwa_get_scope()					Get navigation scope of PWA
 * @function	superpwa_get_orientation()				Get orientation of PWA
 * @function	superpwa_get_display()					Get display of PWA
 */

// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) exit;

/**
 * Returns the Manifest filename.
 *
 * @since 2.0
 *
 * @return string
 */
function superpwa_get_manifest_filename() {
	return 'superpwa-manifest' . superpwa_multisite_filename_postfix() . '.json';
}

/**
 * Manifest filename, absolute path and link
 *
 * For Multisite compatibility. Used to be constants defined in superpwa.php
 * On a multisite, each sub-site needs a different manifest file.
 *
 * @uses  superpwa_get_manifest_filename()
 *
 * @param $arg    filename for manifest filename (replaces SUPERPWA_MANIFEST_FILENAME)
 *                abs for absolute path to manifest (replaces SUPERPWA_MANIFEST_ABS)
 *                src for link to manifest (replaces SUPERPWA_MANIFEST_SRC). Default value
 *
 * @return String filename, absolute path or link to manifest.
 *
 * @since 1.6
 * @since 2.0 src uses home_url instead of network_site_url since manifest is no longer in the root folder.
 */
function superpwa_manifest( $arg = 'src' ) {

	$manifest_filename = superpwa_get_manifest_filename();

	switch ( $arg ) {
		// TODO: Case `filename` can be deprecated in favor of @see superpwa_get_manifest_filename().
		// Name of Manifest file
		case 'filename':
			return $manifest_filename;
			break;

		/**
		* Absolute path to manifest. 
		* 
		* Note: @since 2.0 manifest is no longer a physical file and absolute path doesn't make sense. 
		* Also using home_url instead of network_site_url in "src" in 2.0 changes the apparent location of the file. 
		* However, absolute path is preserved at the "old" location, so that phyiscal files can be deleted when upgrading from pre-2.0 versions.
		* 
		* Since static files are being used in conditions where dynamic files are not possible, this path 
		* pointing to the root folder of WordPress is still useful. 
		*/
		case 'abs':
			$filepath = trailingslashit( ABSPATH ) . $manifest_filename;
			if(!file_exists($filepath)){
				$filepath = trailingslashit( get_home_path() ). $manifest_filename;
			}
			return $filepath;
			break;

		// Link to manifest
		case 'src':
		default:
		
			// Get Settings
			$superpwa_settings = superpwa_get_settings();
			
			/**
			 * For static file, return site_url and network_site_url
			 * 
			 * Static files are generated in the root directory. 
			 * The site_url template tag retrieves the site url for the 
			 * current site (where the WordPress core files reside).
			 */
			if ( $superpwa_settings['is_static_manifest'] === 1 ) {
				return trailingslashit( network_site_url() ) . $manifest_filename;
			}
			
			// For dynamic files, return the home_url
			return home_url( '/' ) . $manifest_filename;
			
			break;
	}
}

/**
 * Returns the Manifest template.
 *
 * @author Maria Daniel Deepak <daniel@danieldeepak.com>
 *
 * @return array
 * 
 * @since 2.0 Replaces superpwa_generate_manifest()
 * @since 2.0 Added display
 */
function superpwa_manifest_template() {
	
	// Get Settings
	$superpwa_settings = superpwa_get_settings();

	$manifest               = array();
	$manifest['name']       = $superpwa_settings['app_name'];
	$manifest['short_name'] = $superpwa_settings['app_short_name'];

	// Description
	if ( isset( $superpwa_settings['description'] ) && ! empty( $superpwa_settings['description'] ) ) {
		$manifest['description'] = $superpwa_settings['description'];
	}

	$manifest['icons']            = superpwa_get_pwa_icons();
	$screenshots=superpwa_get_pwa_screenshots();
	if($screenshots)
	{
		$manifest['screenshots']      = $screenshots;
	}
	$manifest['background_color'] = $superpwa_settings['background_color'];
	$manifest['theme_color']      = $superpwa_settings['theme_color'];
	$manifest['display']          = superpwa_get_display();
	$manifest['dir']          	  = superpwa_get_text_dir();
	$manifest['orientation']      = superpwa_get_orientation();
	$manifest['start_url']        = strlen( superpwa_get_start_url( true ) )>2?user_trailingslashit(superpwa_get_start_url( true )) : superpwa_get_start_url( true );
	if(isset($superpwa_settings['app_category']) && !empty($superpwa_settings['app_category']))
	{
		$manifest['categories']       = [$superpwa_settings['app_category']];
	}
	$manifest['scope']            = strlen(superpwa_get_scope())>2? user_trailingslashit(superpwa_get_scope()) : superpwa_get_scope();

	// if(isset($settings['shortcut_url']) && $settings['shortcut_url']!=0){
		$shortcut_url = !empty($superpwa_settings['shortcut_url']) ? get_permalink( $superpwa_settings['shortcut_url'] ) : '';
		$shortcut_url = superpwa_httpsify( $shortcut_url );
		// AMP URL
		if ( superpwa_is_amp() !== false && isset( $settings['start_url_amp'] ) && $superpwa_settings['start_url_amp'] == 1 ) {
			$shortcut_url = trailingslashit( $shortcut_url ) . superpwa_is_amp();
		}
		if(function_exists('superpwa_utm_tracking_for_start_url')){
			$shortcut_url = superpwa_utm_tracking_for_start_url($shortcut_url);
		}


		$manifest['shortcuts'] = array(
									array(
										'name'=>$superpwa_settings['app_short_name'],
										'url'=>user_trailingslashit( parse_url( trailingslashit( $shortcut_url ), PHP_URL_PATH ) ),
									)
								);
		

		if ( isset( $superpwa_settings['description'] ) && ! empty( $superpwa_settings['description'] ) ) {
			$manifest['shortcuts'][0]['description'] = $superpwa_settings['description'];
		}

		if ( isset( $superpwa_settings['icon'] ) && ! empty( $superpwa_settings['icon'] ) ) {
			$manifest['shortcuts'][0]['icons'] = array(array('src'=>$superpwa_settings['icon'], 'sizes'=>'192x192'));
		}

		$related_applications = array();
		if (isset($superpwa_settings['related_applications']) && $superpwa_settings['related_applications']) {
			$related_applications[] = array('id' =>$superpwa_settings['related_applications'],
						'platform' => 'play',
						'url' => 'https://play.google.com/store/apps/details?id='.$superpwa_settings['related_applications'] );
		}
		if (isset($superpwa_settings['related_applications_ios']) && $superpwa_settings['related_applications_ios']) {
			$related_applications[] = array('id' =>$superpwa_settings['related_applications_ios'],
						'platform' => 'itunes',
						'url' => 'https://apps.apple.com/app/'.$superpwa_settings['related_applications_ios'] );
		}

		if (count($related_applications) > 0) {
			$manifest['related_applications']       = $related_applications;
		}

	// }

	/**
	 * Values that go in to Manifest JSON.
	 *
	 * The Web app manifest is a simple JSON file that tells the browser about your web application.
	 *
	 * @param array $manifest
	 */
	return apply_filters( 'superpwa_manifest', $manifest );
}

/**
 * Generate and write manifest into WordPress root folder
 * 
 * Starting with 2.0, files are only generated if dynamic files are not possible. 
 * Some webserver configurations does not load WordPress and attempts to server files directly
 * from the server. This returns 404 when files do not exist physically. 
 *
 * @return (boolean) true on success, false on failure.
 * 
 * @author Arun Basil Lal
 * @author Maria Daniel Deepak <daniel@danieldeepak.com>
 *
 * @since 1.0
 * @since 1.3 Added support for 512x512 icon.
 * @since 1.4 Added orientation and scope.
 * @since 1.5 Added gcm_sender_id
 * @since 1.6 Added description
 * @since 1.8 Removed gcm_sender_id and introduced filter superpwa_manifest. gcm_sender_id is added in /3rd-party/onesignal.php
 * @since 2.0 Deprecated since Manifest is generated on the fly {@see superpwa_generate_sw_and_manifest_on_fly()}.
 * @since 2.0.1 No longer deprecated since physical files are now generated in certain cases. See funtion description. 
 */
function superpwa_generate_manifest() {
	
	// Delete manifest if it exists.
	superpwa_delete_manifest();
	
	// Get Settings
	$superpwa_settings = superpwa_get_settings();
	
	// Return true if dynamic file returns a 200 response.
	if ( superpwa_file_exists( home_url( '/' ) . superpwa_get_manifest_filename() ) && defined( 'WP_CACHE' ) && ! WP_CACHE ) {
		
		// set file status as dynamic file in database.
		$superpwa_settings['is_static_manifest'] = 0;
		
		// Write settings back to database.
		update_option( 'superpwa_settings', $superpwa_settings );
		
		return true;
	}
	
	// Write the manfiest to disk.
	if ( superpwa_put_contents( superpwa_manifest( 'abs' ), json_encode( superpwa_manifest_template() ) ) ) {
		
		// set file status as satic file in database.
		$superpwa_settings['is_static_manifest'] = 1;
		
		// Write settings back to database.
		update_option( 'superpwa_settings', $superpwa_settings );
		
		return true;
	}
	
	return false;
}

/**
 * Add manifest to header (wp_head)
 *
 * @since 1.0
 * @since 1.8 Introduced filter superpwa_wp_head_tags
 * @since 1.9 Introduced filter superpwa_add_theme_color
 */
function superpwa_add_manifest_to_wp_head() {
	
	$tags  = '<!-- Manifest added by SuperPWA - Progressive Web Apps Plugin For WordPress -->' . PHP_EOL; 
	$tags .= '<link rel="manifest" href="'. parse_url( superpwa_manifest( 'src' ), PHP_URL_PATH ) . '">' . PHP_EOL;
	$tags .= '<link rel="prefetch" href="'. parse_url( superpwa_manifest( 'src' ), PHP_URL_PATH ) . '">' . PHP_EOL;
	// Get Settings
	$superpwa_settings = superpwa_get_settings();
	// theme-color meta tag 
	if ( apply_filters( 'superpwa_add_theme_color', true ) ) {
		
		$tags .= '<meta name="theme-color" content="'. $superpwa_settings['theme_color'] .'">' . PHP_EOL;
	}
	
	$tags  = apply_filters( 'superpwa_wp_head_tags', $tags );
	
	$tags .= '<!-- / SuperPWA.com -->' . PHP_EOL; 
	
	echo $tags;
}
$show_manifest_icon = 0;
$current_page_url = home_url( $_SERVER['REQUEST_URI'] );
if(!empty($superpwa_settings['excluded_urls'])){
	$excluded_urls = explode(",", $superpwa_settings['excluded_urls']);
	if(!empty($excluded_urls)){
		foreach($excluded_urls as $excluded_page_url) {
			if(trim($excluded_page_url) == trim($current_page_url)){
				$show_manifest_icon = 1;
			}
		}
	}
}
if($show_manifest_icon == 0){
	add_action( 'wp_head', 'superpwa_add_manifest_to_wp_head', 0 );
}

/**
 * Delete manifest
 *
 * @return (boolean) true on success, false on failure
 * 
 * @author Arun Basil Lal
 *
 * @since 1.0
 */
function superpwa_delete_manifest() {
	return superpwa_delete( superpwa_manifest( 'abs' ) );
}

/**
 * Get PWA Icons
 *
 * @return	array	An array of icons to be used as the application icons and splash screen icons
 *
 * @author Jose Varghese
 * @since	1.3
 * @since	2.1.1 Added support for Maskable Icons
 *
 */
function superpwa_get_pwa_icons() {
	
	// Get settings
	$superpwa_settings = superpwa_get_settings();
	
	// Application icon
	$icons_array[] = array(
							'src' 	=> $superpwa_settings['icon'],
							'sizes'	=> '192x192', // must be 192x192. Todo: use getimagesize($settings['icon'])[0].'x'.getimagesize($settings['icon'])[1] in the future
							'type'	=> 'image/png', // must be image/png. Todo: use getimagesize($settings['icon'])['mime']
							'purpose'=> 'any', // any maskable to support adaptive icons
						);
	$icons_array[] = array(
							'src' 	=> $superpwa_settings['icon'],
							'sizes'	=> '192x192', // must be 192x192. Todo: use getimagesize($settings['icon'])[0].'x'.getimagesize($settings['icon'])[1] in the future
							'type'	=> 'image/png', // must be image/png. Todo: use getimagesize($settings['icon'])['mime']
							'purpose'=> 'maskable', // any maskable to support adaptive icons
						);
	
	// Splash screen icon - Added since 1.3
	if ( @$superpwa_settings['splash_icon'] != '' ) {
		
		$icons_array[] = array(
							'src' 	=> $superpwa_settings['splash_icon'],
							'sizes'	=> '512x512', // must be 512x512.
							'type'	=> 'image/png', // must be image/png
							'purpose'=> 'any',
						);
		$icons_array[] = array(
							'src' 	=> $superpwa_settings['splash_icon'],
							'sizes'	=> '512x512', // must be 512x512.
							'type'	=> 'image/png', // must be image/png
							'purpose'=> 'maskable',
						);
	}

	if ( @$superpwa_settings['monochrome_icon'] != '' ) {
		
		$icons_array[] = array(
							'src' 	=> $superpwa_settings['monochrome_icon'],
							'sizes'	=> '512x512', // must be 512x512.
							'type'	=> 'image/png', // must be image/png
							'purpose'=> 'monochrome',
						);
	}
	
	return $icons_array;
}

/**
 * Get PWA Screenshot
 *
 * @return	array	An array of images to be used as the screenshot
 *
 * @since	 2.2.8
 *
 */
function superpwa_get_pwa_screenshots() {
	
	// Get settings
	$superpwa_settings = superpwa_get_settings();

	// Screenshots - Added since 2.2.8

	$screenshot_array=null;

	if ( @$superpwa_settings['screenshots'] != '' ) {
		
		$tmp_arr=explode(',',$superpwa_settings['screenshots']);

		foreach($tmp_arr as $item){
			$screenshot_array[] = array(
				'src' 	=> $item,
			//	'sizes'	=> '472x1024', // must be 472x1024.
				'type'	=> 'image/png', // must be image/png
				
			);
		}
	}
	
	return $screenshot_array;
}

/**
 * Get navigation scope of PWA
 *
 * @return	string	Relative path to the folder where WordPress is installed. Same folder as manifest and wp-config.php
 * @since	1.4
 */
function superpwa_get_scope() {
	return parse_url( trailingslashit( superpwa_get_bloginfo( 'sw' ) ), PHP_URL_PATH );
}

/**
 * Get orientation of PWA
 *
 * @return	string	Orientation of PWA as set in the plugin settings. 
 * @since	1.4
 */
function superpwa_get_orientation() {
	
	// Get Settings
	$superpwa_settings = superpwa_get_settings();
	
	$orientation = isset( $superpwa_settings['orientation'] ) ? $superpwa_settings['orientation'] : 0;
	
	switch ( $orientation ) {
		
		case 0:
			return 'any';
			break;
			
		case 1:
			return 'portrait';
			break;
			
		case 2:
			return 'landscape';
			break;
			
		default: 
			return 'any';
	}
}

/**
 * Get display of PWA
 *
 * @return (string) Display of PWA as set in the plugin settings.
 * 
 * @author Jose Varghese
 * 
 * @since 2.0
 */
function superpwa_get_display() {
	
	// Get Settings
	$superpwa_settings = superpwa_get_settings();
	
	$display = isset( $superpwa_settings['display'] ) ? $superpwa_settings['display'] : 1;
	
	switch ( $display ) {
		
		case 0:
			return 'fullscreen';
			break;
			
		case 1:
			return 'standalone';
			break;
			
		case 2:
			return 'minimal-ui';
			break;

		case 3:
			return 'browser';
			break;
			
		default: 
			return 'standalone';
	}
}


/**
 * Get display of PWA
 *
 * @return (string) Display of PWA as set in the plugin settings.
 * 
 * @author Jose Varghese
 * 
 * @since 2.0
 */
function superpwa_get_text_dir() {
	
	// Get Settings
	$superpwa_settings = superpwa_get_settings();
	
	$display = isset( $superpwa_settings['text_dir'] ) ? $superpwa_settings['text_dir'] : 0;
	
	switch ( $display ) {
		
		case 0:
			return 'ltr';
			break;
			
		case 1:
			return 'rtl';
			break;
			
		default: 
			return 'ltr';
	}
}