Minor - Using spaces instead of tabs.

1.9.x
Julio Montoya 10 years ago
parent dac4cabc60
commit c0436a4544
  1. 56
      main/inc/lib/fileUpload.lib.php

@ -1616,19 +1616,19 @@ function api_replace_links_in_html($upload_path, $full_file_name) {
} }
/** /**
deprecated: use api_replace_parameter instead deprecated: use api_replace_parameter instead
Parse the buffer string provided as parameter Parse the buffer string provided as parameter
Replace the a href tags so they are displayed correctly. Replace the a href tags so they are displayed correctly.
- works for files in root and subdirectories - works for files in root and subdirectories
- replace relative hyperlinks to use showinframes.php?file= ... - replace relative hyperlinks to use showinframes.php?file= ...
- add target="_self" to all absolute hyperlinks - add target="_self" to all absolute hyperlinks
- leave local anchors untouched (e.g. #CHAPTER1) - leave local anchors untouched (e.g. #CHAPTER1)
- leave links with download.php and showinframes.php untouched - leave links with download.php and showinframes.php untouched
@author Roan Embrechts @author Roan Embrechts
@version 0.6 @version 0.6
*/ */
function api_replace_links_in_string($upload_path, $buffer) { function api_replace_links_in_string($upload_path, $buffer) {
// Search for hyperlinks // Search for hyperlinks
$matches = array(); $matches = array();
@ -1689,36 +1689,36 @@ function api_replace_links_in_string($upload_path, $buffer) {
} }
/** /**
EXPERIMENTAL - function seems to work, needs more testing EXPERIMENTAL - function seems to work, needs more testing
@param $upload_path is the path where the document is stored, like "/archive/" @param $upload_path is the path where the document is stored, like "/archive/"
if it is the root level, the function expects "/" if it is the root level, the function expects "/"
otherwise "/path/" otherwise "/path/"
This function parses all tags with $param_name parameters. This function parses all tags with $param_name parameters.
so the tags are displayed correctly. so the tags are displayed correctly.
-------------- --------------
Algorithm v1.0 Algorithm v1.0
-------------- --------------
given a string and a parameter, given a string and a parameter,
* OK find all tags in that string with the specified parameter (like href or src) * OK find all tags in that string with the specified parameter (like href or src)
* OK for every one of these tags, find the src|href|... part to edit it * OK for every one of these tags, find the src|href|... part to edit it
* OK change the src|href|... part to use download.php (or showinframes.php) * OK change the src|href|... part to use download.php (or showinframes.php)
* OK do some special stuff for hyperlinks * OK do some special stuff for hyperlinks
Exceptions Exceptions
* OK if download.php or showinframes.php is already in the tag, leave it alone * OK if download.php or showinframes.php is already in the tag, leave it alone
* OK if mailto is in the tag, leave it alone * OK if mailto is in the tag, leave it alone
* OK if the src|href param contains http://, it's absolute --> leave it alone * OK if the src|href param contains http://, it's absolute --> leave it alone
Special for hyperlinks (a href...) Special for hyperlinks (a href...)
* OK add target="_self" * OK add target="_self"
* OK use showinframes.php instead of download.php * OK use showinframes.php instead of download.php
@author Roan Embrechts @author Roan Embrechts
@version 1.1 @version 1.1
*/ */
function api_replace_parameter($upload_path, $buffer, $param_name = 'src') { function api_replace_parameter($upload_path, $buffer, $param_name = 'src') {
// Search for tags with $param_name as a parameter // Search for tags with $param_name as a parameter

Loading…
Cancel
Save