• 28-02-2017, 20:49:49
    #1
    Aşağıda verdiğim kodlarda hata alıyorum. Tam olarak php bilgim olmadığı için hatanın nerede olduğunu bulamıyorum. Bu konuda yardımcı olabilir misiniz?

    Eklentiyi yüklediğim zaman hatayı aldığım satır:

    define("YOUTUBE_TARGET", "<iframe width=\"".YOUTUBE_WIDTH."\" height=\"".YOUTUBE_HEIGHT."\" src=\"https://www.youtube.com/embed/###URL###\" frameborder="\0\" allowfullscreen></iframe>");
    Kodların tamamı aşağıdadır:

    <?php
    define("YOUTUBE_WIDTH", 720);
    define("YOUTUBE_HEIGHT", 480);
    define("YOUTUBE_REGEXP", "/\[youtube ([[:print:]]+)\]/");
    define("YOUTUBE_TARGET", "<iframe width=\"".YOUTUBE_WIDTH."\" height=\"".YOUTUBE_HEIGHT."\" src=\"https://www.youtube.com/embed/###URL###\" frameborder="\0\" allowfullscreen></iframe>");
    
    function youtube_plugin_callback($match)
    {
    	$output = YOUTUBE_TARGET;
    	$output = str_replace("###URL###", $match[1], $output);
    	return ($output);
    }
    
    function youtube_plugin($content)
    {
    	return (preg_replace_callback(YOUTUBE_REGEXP, 'youtube_plugin_callback', $content));
    }
    
    add_filter('the_content', 'youtube_plugin');
    add_filter('comment_text', 'youtube_plugin');
    
    ?>
  • 01-03-2017, 00:55:10
    #2
    <?php 
    define("YOUTUBE_WIDTH", 720); 
    define("YOUTUBE_HEIGHT", 480); 
    define("YOUTUBE_REGEXP", "/\[youtube ([[:print:]]+)\]/"); 
    define("YOUTUBE_TARGET", "<iframe width=\"".YOUTUBE_WIDTH."\" height=\"".YOUTUBE_HEIGHT."\" src="https://www.youtube.com/embed/###URL###\" frameborder="\0\" allowfullscreen></iframe>"); 
    
    function youtube_plugin_callback($match) 
    { 
        $output = YOUTUBE_TARGET; 
        $output = str_replace("###URL###", $match[1], $output); 
        return ($output); 
    } 
    
    function youtube_plugin($content) 
    { 
        return (preg_replace_callback(YOUTUBE_REGEXP, 'youtube_plugin_callback', $content)); 
    } 
    
    add_filter('the_content', 'youtube_plugin'); 
    add_filter('comment_text', 'youtube_plugin'); 
    
    ?>