public_html/wp-content/plugins/google-document-embedder/functions.php
/**
 * Test for valid shortcode syntax, other file errors
 *
 * @return  string Error message (if any)
 */
Test for valid shortcode syntax, other file errors
@return  string Error message (if any)
Test for valid shortcode syntax other file errors @return string Error message ( if any )
function gde_validate_file( $file = NULL, $force ) {
	$nofile = __('File not specified, check shortcode syntax', 'google-document-embedder');
	$badlink = __('Requested URL is invalid', 'google-document-embedder');
	$badtype = __('Unsupported File Type', 'google-document-embedder') . " (%e)";
	$unktype = __('Unable to determine file type from URL', 'google-document-embedder');
	$notfound = __('Error retrieving file - if necessary turn off error checking', 'google-document-embedder') . " (%e)";
	if ( ! $file ) {
		return $nofile;
	}
	$result = gde_valid_url( $file );
	if ( $result === false ) {
		return -1;
	} elseif ( $force == "1" || $force == "yes" ) {
		if ( is_array( $result ) ) {
			return $result;
		} else {
			return -1;
		}
	} elseif ( ! $result ) {
		return -1;
	} else {
		if ( isset( $result['code'] ) && $result['code'] != 200 ) {
			if ( ! gde_valid_link( $file ) ) {
				return $badlink;
			} else {
				$err = $result['code'] . ":" . $result['message'];
				$notfound = str_replace( "%e", $err, $notfound );
				return $notfound;
			}
		} else {
			if ( ! gde_valid_type( $file ) ) {
				$fn = basename( $file );
				$fnp = gde_split_filename( $fn );
				$type = $fnp[1];
				if ( $type == '' ) {
					return $unktype;
				}
				$badtype = str_replace( "%e", $type, $badtype );
				return $badtype;
			} else {
				return $result;
			}
		}
	}
}
function gde_validate_file ( $ file = NULL , $ force ) { $ nofile = __ ( 'File not specified, check shortcode syntax' , 'google-document-embedder' ) ; $ badlink = __ ( 'Requested URL is invalid' , 'google-document-embedder' ) ; $ badtype = __ ( 'Unsupported File Type' , 'google-document-embedder' ) . "  (%e) " ; $ unktype = __ ( 'Unable to determine file type from URL' , 'google-document-embedder' ) ; $ notfound = __ ( 'Error retrieving file - if necessary turn off error checking' , 'google-document-embedder' ) . "  (%e) " ; if ( ! $ file ) { return $ nofile ; } $ result = gde_valid_url ( $ file ) ; if ( $ result === false ) { return - 1 ; } elseif ( $ force == " 1 " || $ force == " yes " ) { if ( is_array ( $ result ) ) { return $ result ; } else { return - 1 ; } } elseif ( ! $ result ) { return - 1 ; } else { if ( isset ( $ result [ 'code' ] ) && $ result [ 'code' ] != 200 ) { if ( ! gde_valid_link ( $ file ) ) { return $ badlink ; } else { $ err = $ result [ 'code' ] . " : " . $ result [ 'message' ] ; $ notfound = str_replace ( " %e " , $ err , $ notfound ) ; return $ notfound ; } } else { if ( ! gde_valid_type ( $ file ) ) { $ fn = basename ( $ file ) ; $ fnp = gde_split_filename ( $ fn ) ; $ type = $ fnp [ 1 ] ; if ( $ type == '' ) { return $ unktype ; } $ badtype = str_replace ( " %e " , $ type , $ badtype ) ; return $ badtype ; } else { return $ result ; } } } }
Test for valid shortcode syntax, other file errors
 @return  string Error message (if any)
Test for valid shortcode syntax other file errors @return string Error message ( if any )
// error messages // validation skipped due to service failure // couldn't get file size due to service failure // can't validate