Eklenti etkinleştirilemedi, çünkü önlenemeyen bir hataya sebep oldu.
(T_CLASS) in /........../public_html/wp-content/plugins/gabfire-widget-pack/widget-recent-tweets.php on line 1
Bunun sebebi nedir? "widget-recent-tweets.php" dosyası ise aşağıda... Eklenti sahibiyle iletişime geçtim bu hafta bakacağını söyledi. Temayı aldığım yerin destek forumuna yazdım, sunucunun php sürümünü güncelle dedi onuda yaptım hatta üstüne cpanelide güncelledim... Lütfen yardım edin.. sorun devam ediyor..
/* LATEST TWEETS WIDGET */
class gabfire_tweets extends WP_Widget {
function gabfire_tweets() {
$widget_ops = array( 'classname' => 'gabfire_tweets', 'description' => 'Display a twitter feed based off username or search parameters' );
$control_ops = array( 'width' => 250, 'height' => 350, 'id_base' => 'gabfire_tweets' );
$this->WP_Widget( 'gabfire_tweets', 'Gabfire: Twitter Widget', $widget_ops, $control_ops);
}
function widget($args, $instance) {
extract( $args );
$title = apply_filters( 'widget_title', $instance['title'] );
$tweets_base = $instance['tweets_base'];
$tweets_of = $instance['tweets_of'];
$profile_photo = $instance['profile_photo'];
$tweets_nr = $instance['tweets_nr'];
echo $before_widget;
if ( $title ) {
echo $before_title . $title . $after_title;
}
if ($instance['tweets_base'] == 'username'){
echo $this->gt_get_twitter_data($instance,'username');
} else {
echo $this->gt_get_twitter_data($instance,'hashtag');
}
echo $after_widget;
}
function update($new_instance, $old_instance) {
$instance['title'] = ( ! empty( $new_instance['title'] ) ) ? sanitize_text_field( $new_instance['title'] ) : '';
$instance['tweets_base'] = ( ! empty( $new_instance['title'] ) ) ? sanitize_text_field($new_instance['tweets_base']) : '';
$instance['tweets_of'] = ( ! empty( $new_instance['title'] ) ) ? sanitize_text_field($new_instance['tweets_of']) : '';
$instance['profile_photo'] = ( ! empty( $new_instance['title'] ) ) ? sanitize_text_field($new_instance['profile_photo']) : '';
$instance['tweets_nr'] = ( ! empty( $new_instance['title'] ) ) ? (int) sanitize_text_field($new_instance['tweets_nr']) : '';
return $new_instance;
}
function form($instance) {
$defaults = array(
'title' => 'Twitter Widget',
'tweets_base' => 'username',
'profile_photo' => 'display',
'tweets_nr' => 5,
'tweets_of' => ''
);
$instance = wp_parse_args( (array) $instance, $defaults );
?>
}
private function gt_get_twitter_data($options, $tweets_base){
global $gabfire_options; // to get the keys defined on plugin's configuration page
if ($gabfire_options['key'] == '' || $gabfire_options['secret'] == '' || $gabfire_options['token_key'] == '' || $gabfire_options['token_secret'] == '') {
return __('Twitter Authentication data is incomplete','gabfire-widget-pack');
}
if (!class_exists('Codebird')) {
require_once ('lib/codebird.php');
}
Codebird::setConsumerKey($gabfire_options['key'], $gabfire_options['secret']);
$cb = Codebird::getInstance();
$cb->setToken($gabfire_options['token_key'], $gabfire_options['token_secret']);
$cb->setReturnFormat(CODEBIRD_RETURNFORMAT_ARRAY);
$count = 0;
$target = 'target="_blank"';
$out = '';
if ($tweets_base == 'hashtag'){
$reply = get_transient('gabfire_socialmashup_widget_twitter_search_transient');
if (false === $reply){
try {
$reply = $cb->search_tweets(array(
'q'=>'#'.$options['tweets_of'],
'count'=> $options['tweets_nr']
));
} catch (Exception $e) {
return __('Error retrieving tweets','gabfire-widget-pack');
}
if (isset($reply['errors'])) {
//error_log(serialize($reply['errors']));
}
set_transient('gabfire_socialmashup_widget_twitter_transient',$reply,300);
}
if (empty($reply) or count($reply)<1) {
return __('No public tweets with' . $reply . ' hashtag','gabfire-widget-pack');
}
if (isset($reply['statuses']) && is_array($reply['statuses'])) {
foreach($reply['statuses'] as $message) {
if ($count>=$options['tweets_nr']) {
break;
}
if (!isset($message['text'])) {
continue;
}
$msg = $message['text'];
$out .= '- ';
if ($options['profile_photo'] == 'display') {
$out .= '';
}
/* Code from really simpler twitter widget */
$msg = preg_replace('/\b([a-zA-Z]+:\/\/[\w_.\-]+\.[a-zA-Z]{2,6}[\/\w\-~.?=&%#+$*!]*)\b/i',"$1", $msg);
$msg = preg_replace('/\b(?$1", $msg);
$msg = preg_replace('/\b([a-zA-Z][a-zA-Z0-9\_\.\-]*[a-zA-Z]*\@[a-zA-Z][a-zA-Z0-9\_\.\-]*[a-zA-Z]{2,6})\b/i',"$1", $msg);
$msg = preg_replace('/(^|\s)#(\w*[a-zA-Z_]+\w*)/', '\1#\2', $msg);
$msg = preg_replace('/([\.|\,|\:|\¡|\¿|\>|\{|\(]?)@{1}(\w*)([\.|\,|\:|\!|\?|\>|\}|\)]?)\s/i', "$1@$2$3 ", $msg);
$out .= $msg;
$out .= ' ';
$count++;
}
}
} elseif ($tweets_base == 'username') {
$reply = get_transient('gabfire_socialmashup_widget_twitter_username_transient');
if (false === $reply){
try {
$twitter_data = $cb->statuses_userTimeline(array(
'screen_name'=>$options['tweets_of'],
'count'=> $options['tweets_nr']
));
} catch (Exception $e) {
return __('Error retrieving tweets','gabfire-widget-pack');
}
if (isset($reply['errors'])) {
//error_log(serialize($reply['errors']));
}
set_transient('gabfire_socialmashup_widget_twitter_username_transient',$reply,300);
}
if (empty($twitter_data) or count($twitter_data)<1) {
return __('No public tweets','gabfire-widget-pack');
}
if (isset($twitter_data) && is_array($twitter_data)) {
foreach($twitter_data as $message) {
if ($count>=$options['tweets_nr']) {
break;
}
if (!isset($message['text'])) {
continue;
}
$msg = $message['text'];
$out .= '- ';
if ($options['profile_photo'] == 'display') {
$out .= '';
}
/* Code from really simpler twitter widget */
$msg = preg_replace('/\b([a-zA-Z]+:\/\/[\w_.\-]+\.[a-zA-Z]{2,6}[\/\w\-~.?=&%#+$*!]*)\b/i',"$1", $msg);
$msg = preg_replace('/\b(?$1", $msg);
$msg = preg_replace('/\b([a-zA-Z][a-zA-Z0-9\_\.\-]*[a-zA-Z]*\@[a-zA-Z][a-zA-Z0-9\_\.\-]*[a-zA-Z]{2,6})\b/i',"$1", $msg);
$msg = preg_replace('/(^|\s)#(\w*[a-zA-Z_]+\w*)/', '\1#\2', $msg);
$msg = preg_replace('/([\.|\,|\:|\¡|\¿|\>|\{|\(]?)@{1}(\w*)([\.|\,|\:|\!|\?|\>|\}|\)]?)\s/i', "$1@$2$3 ", $msg);
$out .= $msg;
$out .= ' ';
$count++;
}
}
}
$out .= '
';
return $out;
}
}
function register_gabfire_tweets() {
register_widget('gabfire_tweets');
}
add_action('widgets_init', 'register_gabfire_tweets');