PclZipUtilCopyBlock

Definition:
function PclZipUtilCopyBlock($p_src, $p_dest, $p_size, $p_mode=0)

Parameters

  • $p_src
  • $p_dest
  • $p_size
  • $p_mode

Source code

  function PclZipUtilCopyBlock($p_src, $p_dest, $p_size, $p_mode=0)

  {

    $v_result = 1;



    if ($p_mode==0)

    {

      while ($p_size != 0)

      {

        $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE);

        $v_buffer = @fread($p_src, $v_read_size);

        @fwrite($p_dest, $v_buffer, $v_read_size);

        $p_size -= $v_read_size;

      }

    }

    else if ($p_mode==1)

    {

      while ($p_size != 0)

      {

        $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE);

        $v_buffer = @gzread($p_src, $v_read_size);

        @fwrite($p_dest, $v_buffer, $v_read_size);

        $p_size -= $v_read_size;

      }

    }

    else if ($p_mode==2)

    {

      while ($p_size != 0)

      {

        $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE);

        $v_buffer = @fread($p_src, $v_read_size);

        @gzwrite($p_dest, $v_buffer, $v_read_size);

        $p_size -= $v_read_size;

      }

    }

    else if ($p_mode==3)

    {

      while ($p_size != 0)

      {

        $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE);

        $v_buffer = @gzread($p_src, $v_read_size);

        @gzwrite($p_dest, $v_buffer, $v_read_size);

        $p_size -= $v_read_size;

      }

    }



    // ----- Return

    return $v_result;

  }

2489

path_join

Definition:
function path_join( $base, $path ) {}

Join two filesystem paths together (e.g. ‘give me $path relative to $base’).
If the $path is absolute, then it the full path is returned.

Parameters

  • string $base
  • string $path

Return values

returns:The path with the base or absolute path.

Source code

function path_join( $base, $path ) {

	if ( path_is_absolute($path) )

		return $path;



	return rtrim($base, '/') . '/' . ltrim($path, '/');

}

2487

path_is_absolute

Definition:
function path_is_absolute( $path ) {}

Test if a give filesystem path is absolute (‘/foo/bar’, ‘c:\windows’).

Parameters

  • string $path: File path

Return values

returns:True if path is absolute, false is not absolute.

Source code

function path_is_absolute( $path ) {

	// this is definitive if true but fails if $path does not exist or contains a symbolic link

	if ( realpath($path) == $path )

		return true;



	if ( strlen($path) == 0 || $path[0] == '.' )

		return false;



	// windows allows absolute paths like this

	if ( preg_match('#^[a-zA-Z]:\\\\#', $path) )

		return true;



	// a path starting with / or \ is absolute; anything else is relative

	return ( $path[0] == '/' || $path[0] == '\\' );

}

2485

parse_w3cdtf

Definition:
function parse_w3cdtf ( $date_str ) {}

Parameters

  • $date_str

Source code

function parse_w3cdtf ( $date_str ) {



	# regex to match wc3dtf

	$pat = "/(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(:(\d{2}))?(?:([-+])(\d{2}):?(\d{2})|(Z))?/";



	if ( preg_match( $pat, $date_str, $match ) ) {

		list( $year, $month, $day, $hours, $minutes, $seconds) =

			array( $match[1], $match[2], $match[3], $match[4], $match[5], $match[7]);



		# calc epoch for current date assuming GMT

		$epoch = gmmktime( $hours, $minutes, $seconds, $month, $day, $year);



		$offset = 0;

		if ( $match[11] == 'Z' ) {

			# zulu time, aka GMT

		}

		else {

			list( $tz_mod, $tz_hour, $tz_min ) =

				array( $match[8], $match[9], $match[10]);



			# zero out the variables

			if ( ! $tz_hour ) { $tz_hour = 0; }

			if ( ! $tz_min ) { $tz_min = 0; }



			$offset_secs = (($tz_hour*60)+$tz_min)*60;



			# is timezone ahead of GMT?  then subtract offset

			#

			if ( $tz_mod == '+' ) {

				$offset_secs = $offset_secs * -1;

			}



			$offset = $offset_secs;

		}

		$epoch = $epoch + $offset;

		return $epoch;

	}

	else {

		return -1;

	}

}

2483

parent_post_rel_link

Definition:
function parent_post_rel_link($title = '%title') {}

Display relational link for parent item

Parameters

  • $title

Source code

function parent_post_rel_link($title = '%title') {

	echo get_parent_post_rel_link($title);

}

2481