示例#1
0
文件: filter.php 项目: Acsac/CMS-RuDi
	function f_filelink(&$text){

        $phrase = 'СКАЧАТЬ';

		if (mb_strpos($text, $phrase) === false){
			return true;
		}

 		$regex = '/{('.$phrase.'=)\s*(.*?)}/i';
		$matches = array();
		preg_match_all( $regex, $text, $matches, PREG_SET_ORDER );
		foreach ($matches as $elm) {
			$elm[0] = str_replace('{', '', $elm[0]);
			$elm[0] = str_replace('}', '', $elm[0]);
			mb_parse_str( $elm[0], $args );
			$file=@$args[$phrase];
			if ($file){
				$output = getDownLoadLink($file);
			} else { $output = ''; }
			$text = str_replace('{'.$phrase.'='.$file.'}', $output, $text );
		}

		return true;

	}
示例#2
0
function f_filelink(&$text)
{
    $phrase = 'СКАЧАТЬ';
    //echo "<pre>"; var_dump($text);
    if (mb_strpos($text, $phrase) === false) {
        return true;
    }
    //$regex = '/{('.$phrase.'=)\s*(.*?)---(.*?)}/i';
    $regex = '/{(' . $phrase . '=\\s*.*?)---(.*?)}/i';
    //$regex = '/{('.$phrase.'=)\s*(.*?)}/i';
    $matches = array();
    preg_match_all($regex, $text, $matches, PREG_SET_ORDER);
    foreach ($matches as $elm) {
        //echo "<pre>"; var_dump($matches);
        /* $elm[0] = str_replace('{', '', $elm[0]);
        			$elm[0] = str_replace('}', '', $elm[0]); */
        //mb_parse_str( $elm[0], $args );
        mb_parse_str($elm[1], $args);
        $file = @$args[$phrase];
        if ($file) {
            // echo "<pre>"; var_dump($file);
            $output = getDownLoadLink($file, $elm[2]);
        } else {
            $output = '';
        }
        $text = str_replace('{' . $phrase . '=' . $file . '---' . $elm[2] . '}', $output, $text);
        /*echo "<pre>"; var_dump($elm[2]);
        		if($elm[2]){
        			$text = str_replace('{'.$phrase.'='.$file.'---'.$elm[2].'}', $output, $text );
        		}
        		else{
        			$text = str_replace('{'.$phrase.'='.$file.'}', $output, $text );
        		}*/
    }
    return true;
}