Membru
- Înscris
- 28 Feb 2013
- Mesaje
- 321
- Subiect Autor
- #1
Am adaugat o noua tema prin FTP dar cand incerc sa o activez sau sa ii dau preview, imi apare aceasta eroare:
Aveti idee ce as putea face sa scap de eroare, sa pot folosi tema?
EDIT: Am reusit sa rezolv acea eroare. Dupa ce am incarcat tema cu FTP, continutul din cateva fisiere s-a schimbat. Imi apareau toate codurile php pe o singura linie, le-am editat dar acum imi apare aceasta eroare.
Asa arata continutu:
Cod:
Parse error: syntax error, unexpected '{' in /home/...../public_html/...../wp-content/themes/...../themeOptions/functions.php on line 1
EDIT: Am reusit sa rezolv acea eroare. Dupa ce am incarcat tema cu FTP, continutul din cateva fisiere s-a schimbat. Imi apareau toate codurile php pe o singura linie, le-am editat dar acum imi apare aceasta eroare.
Cod:
Parse error: syntax error, unexpected 'class' (T_CLASS) in /home/...../public_html/...../wp-content/themes/themeforest-6771881-game-addict-clan-war-gaming-theme/gameaddict/widgets/latest_twitter/latest_twitter_widget.php on line 1
Cod:
<?php
/*
Plugin Name: Latest twitter sidebar widget
Plugin URI: http://www.tacticaltechnique.com/wordpress/latest-twitter-sidebar-widget/
Description: Creates a sidebar widget that displays the latest twitter updates for any user with public tweets.
Author: Corey Salzano
Email: coreysalzano@gmail.com
Version: 0.120328
Author URI: http://www.tacticaltechnique.com/
*/
class latest_twitter_widget extends WP_Widget {
function latest_twitter_widget() {
// widget actual processes
parent::WP_Widget( /* Base ID */'latest_twitter_widget', /* Name */'Latest twitter widget', array( 'description' => __('Displays your latest twitter.com updates', 'atticus') ) );
}
function form($instance) {
// outputs the options form on admin
if ( !function_exists('quot') ){
function quot($txt){
return str_replace( "\"", """, $txt );
}
}
// format some of the options as valid html
@$username = htmlspecialchars($instance['user'], ENT_QUOTES);
@$updateCount = htmlspecialchars($instance['count'], ENT_QUOTES);
@$showTwitterIconTF = $instance['showTwitterIconTF'];
@$showProfilePicTF = $instance['showProfilePicTF'];
@$showTweetTimeTF = $instance['showTweetTimeTF'];
@$widgetTitle = stripslashes(quot($instance['widgetTitle']));
@$includeRepliesTF = $instance['includeRepliesTF'];
?>
<p>
<label for="<?php echo $this->get_field_id('user'); ?>" style="line-height:35px;display:block;"><?php _e("Twitter user: @", 'atticus') ?><input type="text" size="12" id="<?php echo $this->get_field_id('user'); ?>" name="<?php echo $this->get_field_name('user'); ?>" value="<?php echo $username; ?>" /></label>
<label for="<?php echo $this->get_field_id('count'); ?>" style="line-height:35px;display:block;"><?php _e("Show", 'atticus') ?> <input type="text" id="<?php echo $this->get_field_id('count'); ?>" size="2" name="<?php echo $this->get_field_name('count'); ?>" value="<?php echo $updateCount; ?>" /><?php _e("twitter updates", 'atticus'); ?></label>
<label for="<?php echo $this->get_field_id('widgetTitle'); ?>" style="line-height:35px;display:block;"><?php _e("Widget title:", 'atticus') ?> <input type="text" id="<?php echo $this->get_field_id('widgetTitle'); ?>" size="16" name="<?php echo $this->get_field_name('widgetTitle'); ?>" value="<?php echo $widgetTitle; ?>" /></label>
<p> </p>
<p><input type="checkbox" id="<?php echo $this->get_field_id('includeRepliesTF'); ?>" value="1" name="<?php echo $this->get_field_name('includeRepliesTF'); ?>"<?php if($includeRepliesTF){ ?> checked="checked"<?php } ?>> <label for="<?php echo $this->get_field_id('includeRepliesTF'); ?>"><?php _e("Include replies", 'atticus') ?></label></p>
<p> </p>
<p><?php _e("To style the output of the widget, modify", 'atticus') ?> <a href="<?php echo home_url(); ?>/wp-content/plugins/latest-twitter-sidebar-widget/latest_twitter_widget.css"><?php _e("this CSS stylesheet", 'atticus') ?></a>. <?php _e("You should also back this file up before updating the plugin.", 'atticus') ?></p>
</p>
<?php
}
function update($new_instance, $old_instance) {
// processes widget options to be saved
$instance = $old_instance;
$instance['user'] = esc_html($new_instance['user']);
$instance['count'] = esc_html($new_instance['count']);
$instance['widgetTitle'] = esc_html( $new_instance['widgetTitle']);
$instance['showTwitterIconTF'] = false;
$instance['showProfilePicTF'] = false;
switch( $new_instance['showIconOrPic'] ){
case "icon":
$instance['showTwitterIconTF'] = true;
break;
case "pic":
$instance['showProfilePicTF'] = true;
break;
case "none":
break;
}
if( $new_instance['showTweetTimeTF']=="1"){
$instance['showTweetTimeTF'] = true;
} else{
$instance['showTweetTimeTF'] = false;
}
if( $new_instance['includeRepliesTF']=="1"){
$instance['includeRepliesTF'] = true;
} else{
$instance['includeRepliesTF'] = false;
}
return $instance;
}
function widget($args, $instance) {
extract($args, EXTR_SKIP);
$query_arg['count'] = $instance['count'] ? $instance['count'] : 3;
$query_arg['exclude_replies'] = !($instance['includeRepliesTF']);
$query_arg['include_rts'] = false;
$query_arg['screen_name'] = $instance['user'];
$title = $instance['widgetTitle'];
if( !class_exists( 'Codebird' ) ) {
require_once( get_template_directory() . '/widgets/latest_twitter/codebird.php' );
}
Codebird::setConsumerKey( 'HblW1HW1VU6DDniet0RCw', 'BfuIlOrD2LsL9t7eeePsX4JoI2ZYBFU6hfTSdr2Uk' );
$codebird_instance = Codebird::getInstance();
$codebird_instance->setToken( '764237641-aWvmaIr8bTqvNmOJLepNdxxBsR29QoTCG7eCvfWQ', 'rn2vJYLhcNfkJjCadYus6BqewHM3N4qlly1O4O2VtS8jN' );
$codebird_instance->setReturnFormat( CODEBIRD_RETURNFORMAT_ARRAY );
try {
$latest_tweet = $codebird_instance->statuses_userTimeline( $query_arg );
}
catch( Exception $e ) {
echo 'Error retrieving tweets';
}
echo $before_widget;
echo $before_title . $title . $after_title;
foreach( $latest_tweet as $single_tweet ) {
$tweet_text = $single_tweet['text'];
$tweet_text = preg_replace( "/[^^](http:\/\/+[\S]*)/", '<a href="$0">$0</a>', $tweet_text );
$screen_name = $single_tweet['user']['screen_name'];
$user_permalink = 'http://twitter.com/#!/' . $screen_name;
$tweet_permalink = 'http://twitter.com/#!/' . $screen_name . '/status/' . $single_tweet['id_str'];
if( $tweet_text ) {
echo '<div class="latest-twitter-tweet"><i class="icon-twitter"></i> "' . $tweet_text . '"</div>';
}
}
$username = $instance['user'];
_e("<div id=\"latest-twitter-follow-link\"><a href=\"http://twitter.com/$username\">follow @$username on twitter</a></div>");
echo $after_widget;
}
}
if( !function_exists('register_latest_twitter_widget')){
add_action('widgets_init', 'register_latest_twitter_widget');
function register_latest_twitter_widget() {
register_widget('latest_twitter_widget');
}
}
if( !function_exists('latest_twitter_widget_css')){
function latest_twitter_widget_css( ){ ?>
<link rel="stylesheet" href="<?php echo get_template_directory_uri(); ?>/widgets/latest_twitter/latest_twitter_widget.css" />
<?php
}
add_action('wp_head', 'latest_twitter_widget_css');
}
?>