public_html/wp-content/plugins/google-document-embedder/functions-admin.php
/**
 * Write profile from form data
 *
 * @since   2.5.0.1
 * @return  bool Whether or not action successful
 */
Write profile from form data
@since   2.5.0.1
@return  bool Whether or not action successful
Write profile from form data @since 2 . 5 . 0 . 1 @return bool Whether or not action successful
function gde_form_to_profile( $pid, $data ) {
	$profile = gde_get_profiles( $pid, false );
	$profile['tb_flags'] = "przn";
	$profile['tb_fullwin'] = "same";
	$profile['tb_fulluser'] = "no";
	$profile['tb_print'] = "no";
	$profile['vw_flags'] = "";
	$profile['link_force'] = "no";
	$profile['link_mask'] = "no";
	$profile['link_block'] = "no";
	$data['base_url'] = trailingslashit( $data['base_url'] );
	$data['default_width'] = gde_sanitize_dims( $data['default_width'] );
	$data['default_height'] = gde_sanitize_dims( $data['default_height'] );
	if ( ! $data['default_width'] ) {
		$data['default_width'] = $profile['default_width'];
	}
	if ( ! $data['default_height'] ) {
		$data['default_height'] = $profile['default_height'];
	}
	foreach ( $data as $k => $v ) {
		if ( array_key_exists( $k, $profile ) ) {
			$profile[$k] = stripslashes( $v );
		} elseif ( strstr( $k, 'gdet_' ) && ( strstr( $v, 'gdet_' ) ) ) {
			if ( $k == 'gdet_h' ) {
				$profile['tb_flags'] .= "h";
			} else {
				$profile['tb_flags'] = str_replace( str_replace( "gdet_", "", $v ), "", $profile['tb_flags'] );
			}
		} elseif ( $k == "fs_win" ) {
			$profile['tb_fullwin'] = "new";
		} elseif ( $k == "fs_user" ) {
			$profile['tb_fulluser'] = "yes";
		} elseif ( $k == "fs_print" ) {
			$profile['tb_print'] = "yes";
		} elseif ( strstr( $k, 'gdev_' ) && ( strstr( $v, 'gdev_' ) ) ) {
			$profile['vw_flags'] .= str_replace( "gdev_", "", $v );
		} elseif ( $k == "force" ) {
			$profile['link_force'] = "yes";
		} elseif ( $k == "mask" ) {
			$profile['link_mask'] = "yes";
		} elseif ( $k == "block" && gde_is_blockable( $profile ) ) {
			$profile['link_block'] = "yes";
		}
	}
	$newprofile = array( '', '', serialize( $profile ) );
	if ( gde_write_profile( $newprofile, $pid, true ) > 0 ) {
		return true;
	} else {
		return false;
	}
}
function gde_form_to_profile ( $ pid , $ data ) { $ profile = gde_get_profiles ( $ pid , false ) ; $ profile [ 'tb_flags' ] = " przn " ; $ profile [ 'tb_fullwin' ] = " same " ; $ profile [ 'tb_fulluser' ] = " no " ; $ profile [ 'tb_print' ] = " no " ; $ profile [ 'vw_flags' ] = " " ; $ profile [ 'link_force' ] = " no " ; $ profile [ 'link_mask' ] = " no " ; $ profile [ 'link_block' ] = " no " ; $ data [ 'base_url' ] = trailingslashit ( $ data [ 'base_url' ] ) ; $ data [ 'default_width' ] = gde_sanitize_dims ( $ data [ 'default_width' ] ) ; $ data [ 'default_height' ] = gde_sanitize_dims ( $ data [ 'default_height' ] ) ; if ( ! $ data [ 'default_width' ] ) { $ data [ 'default_width' ] = $ profile [ 'default_width' ] ; } if ( ! $ data [ 'default_height' ] ) { $ data [ 'default_height' ] = $ profile [ 'default_height' ] ; } foreach ( $ data as $ k => $ v ) { if ( array_key_exists ( $ k , $ profile ) ) { $ profile [ $ k ] = stripslashes ( $ v ) ; } elseif ( strstr ( $ k , 'gdet_' ) && ( strstr ( $ v , 'gdet_' ) ) ) { if ( $ k == 'gdet_h' ) { $ profile [ 'tb_flags' ] .= " h " ; } else { $ profile [ 'tb_flags' ] = str_replace ( str_replace ( " gdet_ " , " " , $ v ) , " " , $ profile [ 'tb_flags' ] ) ; } } elseif ( $ k == " fs_win " ) { $ profile [ 'tb_fullwin' ] = " new " ; } elseif ( $ k == " fs_user " ) { $ profile [ 'tb_fulluser' ] = " yes " ; } elseif ( $ k == " fs_print " ) { $ profile [ 'tb_print' ] = " yes " ; } elseif ( strstr ( $ k , 'gdev_' ) && ( strstr ( $ v , 'gdev_' ) ) ) { $ profile [ 'vw_flags' ] .= str_replace ( " gdev_ " , " " , $ v ) ; } elseif ( $ k == " force " ) { $ profile [ 'link_force' ] = " yes " ; } elseif ( $ k == " mask " ) { $ profile [ 'link_mask' ] = " yes " ; } elseif ( $ k == " block " && gde_is_blockable ( $ profile ) ) { $ profile [ 'link_block' ] = " yes " ; } } $ newprofile = array ( '' , '' , serialize ( $ profile ) ) ; if ( gde_write_profile ( $ newprofile , $ pid , true ) > 0 ) { return true ; } else { return false ; } }
Write profile from form data
 @since   2.5.0.1
 @return  bool Whether or not action successful
Write profile from form data @since 2 . 5 . 0 . 1 @return bool Whether or not action successful
// get current profile data // initialize checkbox values (values if options unchecked) // enforce trailing slash on base_url // sanitize width/height // all fields where name == profile key // toolbar checkboxes // update successful