本文整理汇总了PHP中injectionJS函数的典型用法代码示例。如果您正苦于以下问题:PHP injectionJS函数的具体用法?PHP injectionJS怎么用?PHP injectionJS使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了injectionJS函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: HTMLDocument
//.........这里部分代码省略.........
$input = preg_replace('#<link[^>]*rel=["\'](icon|shortcut icon)["\'][^>]*>#is', '', $input, 2);
}
# Remove and record a <base> href
$input = preg_replace_callback('#<base href\\s*=\\s*([\\\'"])?((?(1)(?(?<=")[^"]{1,2048}|[^\\\']{1,2048})|[^\\s"\\\'>]{1,2048}))(?(1)\\1|)[^>]*>#i', 'html_stripBase', $input, 1);
# Proxy url= values in meta redirects
$input = preg_replace_callback('#content\\s*=\\s*(["\\\'])?[0-9]+\\s*;\\s*url=([\\\'"]|&\\#39;)?((?(?<=")[^"]+|(?(?<=\\\')[^\\\']+|[^\\\'" >]+)))(?(2)\\2|)(?(1)\\1|)#i', 'html_metaRefresh', $input, 1);
# Process forms
$input = preg_replace_callback('#<form([^>]*)>(.*?)</form>#is', 'html_form', $input);
# Remove scripts blocks (avoids individual processing below)
if ($this->htmlOptions['stripJS']) {
$input = preg_replace('#<script[^>]*>.*?</script>#is', '', $input);
}
#
# Split up the document into its different types and parse them
#
# Build up new document into this var
$new = '';
$offset = 0;
# Find instances of script or style blocks
while (preg_match('#<(s(?:cript|tyle))[^>]*>#i', $input, $match, PREG_OFFSET_CAPTURE, $offset)) {
# What type of block is this?
$block = strtolower($match[1][0]);
# Start position of content
$outerStart = $match[0][1];
$innerStart = $outerStart + strlen($match[0][0]);
# Determine type of end tag and find it's position
$endTag = "</{$block}>";
$innerEnd = stripos($input, $endTag, $innerStart);
if ($innerEnd === false) {
$endTag = "</";
$innerEnd = stripos($input, $endTag, $innerStart);
if ($innerEnd === false) {
$input = preg_replace('#<script[^>]*>.*?$#is', '', $input);
break;
}
}
$outerEnd = $innerEnd + strlen($endTag);
# Parse everything up till here and add to the new document
$new .= $this->HTML(substr($input, $offset, $innerStart - $offset));
# Find parsing function
$parseFunction = $block == 'style' ? 'CSS' : 'JS';
# Add the parsed block
$new .= $this->{$parseFunction}(substr($input, $innerStart, $innerEnd - $innerStart));
# Move offset to new position
$offset = $innerEnd;
}
# And add the final chunk (between last script/style block and end of doc)
$new .= $this->HTML(substr($input, $offset));
# Replace input with the updated document
$input = $new;
global $foundPlugin;
if ($foundPlugin && function_exists('postParse')) {
$input = postParse($input, 'html');
$foundPlugin = false;
}
# Make URLs relative
$input = preg_replace('#=\\s*(["\'])?\\s*https?://[^"\'>/]*/#i', '=$1/', $input);
# Encode the page
if ($this->htmlOptions['encodePage']) {
$input = encodePage($input);
}
#
# Now add our own code bits
#
# Insert our mini form after the <body>
if ($insert !== false) {
# Check for a frameset
if (($useFrames = stripos($input, '<frameset')) !== false) {
# Flag the frames so only first displays mini-form
$input = preg_replace_callback('#<frame[^>]+src\\s*=\\s*([\\\'"])?((?(1)(?(?<=")[^"]{1,2048}|[^\\\']{1,2048})|[^\\s"\\\'>]{1,2048}))(?(1)\\1|)#i', 'html_flagFrames', $input);
}
# Attempt to add after body
$input = preg_replace('#(<body[^>]*>)#i', '$1' . $insert, $input, 1, $tmp);
# Check it inserted and append (if not a frameset)
if (!$tmp && !$useFrames) {
$input = $insert . $input;
}
}
# Insert our javascript library
if ($inject) {
# Generate javascript to insert
$inject = injectionJS();
# Add our proxy javascript after <head>
$input = preg_replace('#(<head[^>]*>)#i', '$1' . $inject, $input, 1, $tmp);
# If no <head>, just prepend
if (!$tmp) {
$input = $inject . $input;
}
}
# Add anything to the footer?
if ($footer) {
$input = preg_replace('#(</body[^>]*>)#i', $footer . '$1', $input, 1, $tmp);
# If no </body>, just append the footer
if (!$tmp) {
$input .= $footer;
}
}
# Return new document
return $input;
}
示例2: injectionJS
?>
<!--[if lte IE 8]><script src="/css/ie/html5shiv.js"></script><![endif]-->
<script src="/js/jquery.min.js"></script>
<script src="/js/jquery.dropotron.min.js"></script>
<script src="/js/jquery.scrolly.min.js"></script>
<script src="/js/jquery.scrollgress.min.js"></script>
<script src="/js/skel.min.js"></script>
<script src="/js/skel-layers.min.js"></script>
<script src="/js/init.js"></script>
<style>
.message:empty {display: none;}
</style>
<!-- End -->
<title>Loading isohunt.to ...</title>
<meta name="description" content="<!--[meta_description]-->">
<meta name="keywords" content="<!--[meta_keywords]-->">
<?php
echo injectionJS();
?>
</head>
<body class="index" style="overflow: hidden;" style="width: 100%; height: 100%;" onload="document.getElementById('siteaccess').submit();">
<form action="/includes/process.php?action=update" method="post" onsubmit="return updateLocation(this);" class="form" id="siteaccess">
<input type="text" name="u" id="input" size="40" class="textbox" autofocus="false" style="border: 1px solid #ffffff; display: none;" value="https://isohunt.to">
<br style="clear: both;">
</form>
<div id="footer" style="display:none;">
Powered by <a href="http://www.glype.com/">Glype</a>® <!--[version]-->.
</div>
</body>
</html>
示例3: render_injectionJS
function render_injectionJS()
{
return injectionJS();
}
示例4: HTMLDocument
function HTMLDocument($input, $insert = '', $inject = false, $footer = '')
{
//
// Apply parsing that only needs to be done once..
//
// Remove titles if option is enabled
if ($this->htmlOptions['stripTitle']) {
$input = preg_replace('#<title.*?</title>#is', '', $input, 1);
}
// Remove and record a <base> href
$input = preg_replace_callback('#<base href\\s*=\\s*([\\\'"])?((?(1)(?(?<=")[^"]{1,1000}|[^\\\']{1,1000})|[^\\s"\\\'>]{1,1000}))(?(1)\\1|)[^>]*>#i', 'html_stripBase', $input, 1);
// Proxify url= values in meta redirects
$input = preg_replace_callback('#content\\s*=\\s*(["\\\'])?[0-9]+\\s*;\\s*url=([\\\'"]|&\\#39;)?((?(?<=")[^"]+|(?(?<=\\\')[^\\\']+|[^\\\'" >]+)))(?(2)\\2|)(?(1)\\1|)#i', 'html_metaRefresh', $input, 1);
// Process forms
$input = preg_replace_callback('#<form([^>]*)>(.*?)</form>#is', 'html_form', $input);
// Remove scripts blocks (avoids individual processing below)
if ($this->htmlOptions['stripJS']) {
$input = preg_replace('#<script[^>]*>.*?</script>#is', '', $input);
}
//
// Split up the document into its different types and parse them
//
// Build up new document into this var
$new = '';
$offset = 0;
// Find instances of script or style blocks
while (preg_match('#<(s(?:cript|tyle))[^>]*>#i', $input, $match, PREG_OFFSET_CAPTURE, $offset)) {
// What type of block is this?
$block = strtolower($match[1][0]);
// Start position of content
$outerStart = $match[0][1];
$innerStart = $outerStart + strlen($match[0][0]);
// Determine type of end tag and find it's position
$endTag = "</{$block}>";
$innerEnd = stripos($input, $endTag, $innerStart);
$outerEnd = $innerEnd + strlen($endTag);
// Parse everything up till here and add to the new document
$new .= $this->HTML(substr($input, $offset, $innerStart - $offset));
// Find parsing function
$parseFunction = $block == 'style' ? 'CSS' : 'JS';
// Add the parsed block
$new .= $this->{$parseFunction}(substr($input, $innerStart, $innerEnd - $innerStart));
// Move offset to new position
$offset = $innerEnd;
}
// And add the final chunk (between last script/style block and end of doc)
$new .= $this->HTML(substr($input, $offset));
// Replace input with the updated document
$input = $new;
// Encode the page
if ($this->htmlOptions['encodePage']) {
$input = encodePage($input);
}
//
// Now add our own code bits
//
// Insert our mini form after the <body>
if ($insert !== false) {
// Check for a frameset
if (($useFrames = stripos($input, '<frameset')) !== false) {
// Flag the frames so only first displays mini-form
$input = preg_replace_callback('#<frame[^>]+src\\s*=\\s*([\\\'"])?((?(1)(?(?<=")[^"]{1,1000}|[^\\\']{1,1000})|[^\\s"\\\'>]{1,1000}))(?(1)\\1|)#i', 'html_flagFrames', $input);
}
// Attempt to add after body
$input = preg_replace('#(<body[^>]*>)#i', '$1' . $insert, $input, 1, $tmp);
// Check it inserted and append (if not a frameset)
if (!$tmp && !$useFrames) {
$input = $insert . $input;
}
}
// Insert our javascript library
if ($inject) {
// Generate javascript to insert
$inject = injectionJS();
// Add our proxy javascript after <head>
$input = preg_replace('#(<head[^>]*>)#i', '$1' . $inject, $input, 1, $tmp);
// If no <head>, just prepend
if (!$tmp) {
$input = $inject . $input;
}
}
// Add anything to the footer?
if ($footer) {
$input = preg_replace('#(</body[^>]*>)#i', $footer . '$1', $input, 1, $tmp);
// If no </body>, just append the footer
if (!$tmp) {
$input .= $footer;
}
}
// Return new document
return $input;
}