log = &Log::singleton('error_log', PEAR_LOG_TYPE_SYSTEM, 'FBCONNECT'); // Set the log level $fbconnect_log_level = constant('PEAR_LOG_' . strtoupper(FBCONNECT_LOG_LEVEL)); $this->log->setMask(Log::UPTO($fbconnect_log_level)); } /** * Set Status. **/ function setStatus($slug, $state, $message) { $this->status[$slug] = array('state'=>$state,'message'=>$message); } function textdomain() { load_plugin_textdomain('fbconnect', PLUGINDIR ."/".FBCONNECT_PLUGIN_LANG); } function table_prefix() { global $wpdb; return isset($wpdb->base_prefix) ? $wpdb->base_prefix : $wpdb->prefix; } function comments_table_name() { return WPfbConnect::table_prefix() . 'comments'; } function usermeta_table_name() { return WPfbConnect::table_prefix() . 'usermeta'; } function users_table_name() { return WPfbConnect::table_prefix() . 'users'; } } endif; if (!function_exists('fbconnect_init')): function fbconnect_init() { if ($GLOBALS['fbconnect'] && is_a($GLOBALS['fbconnect'], 'WPfbConnect')) { return; } $GLOBALS['fbconnect'] = new WPfbConnect(); } endif; if (!function_exists('fbconnect_title')): function fbconnect_title($title) { if($_REQUEST['fbconnect_action']=="community"){ return __('Community', 'fbconnect')." - ".$title; }else if($_REQUEST['fbconnect_action']=="myhome"){ $userprofile = WPfbConnect_Logic::get_user(); return $userprofile->display_name." - ".$title; }else if($_REQUEST['fbconnect_action']=="invite"){ return _e('Invite your friends', 'fbconnect')." - ".$title; } return $title; } endif; /* Ver rewrite.php if (!function_exists('fbconnect_add_custom_urls')): function fbconnect_add_custom_urls() { add_rewrite_rule('(userprofile)/[/]?([0-9]*)[/]?([0-9]*)$', 'index.php?fbconnect_action=myhome&fbuserid=$matches[2]&var2=$matches[3]'); add_rewrite_tag('%fbuserid%', '[0-9]+'); add_rewrite_tag('%var2%', '[0-9]+'); } endif; */ //wp_enqueue_script( 'prototype' ); // -- Register actions and filters -- // add_filter('wp_title', 'fbconnect_title'); // runs the function in the init hook //add_action('init', 'fbconnect_add_custom_urls'); add_filter('get_comment_author_url', array('WPfbConnect_Logic', 'get_comment_author_url')); if( get_option('fb_add_post_share') ) { add_action('the_content', array( 'WPfbConnect_Interface', 'add_fbshare' ) ); } add_action( 'init', array( 'WPfbConnect','textdomain') ,1 ); // load textdomain register_activation_hook(FBCONNECT_PLUGIN_BASENAME.'/fbConnectCore.php', array('WPfbConnect_Logic', 'activate_plugin')); register_deactivation_hook(FBCONNECT_PLUGIN_BASENAME.'/fbConnectCore.php', array('WPfbConnect_Logic', 'deactivate_plugin')); add_action( 'admin_menu', array( 'WPfbConnect_Interface', 'add_admin_panels' ) ); add_filter('language_attributes', array('WPfbConnect_Logic', 'html_namespace')); add_filter('get_avatar', array('WPfbConnect_Logic', 'fb_get_avatar'),10,4); // Add hooks to handle actions in WordPress //add_action( 'wp_authenticate', array( 'WPfbConnect_Logic', 'wp_authenticate' ) ); // fbconnect loop start add_action( 'wp_logout', array( 'WPfbConnect_Logic', 'fb_logout'),1); add_action( 'init', array( 'WPfbConnect_Logic', 'wp_login_fbconnect' ),100 ); // fbconnect loop done // Comment filtering add_action( 'comment_post', array( 'WPfbConnect_Logic', 'comment_fbconnect' ), 5 ); //add_filter( 'comment_post_redirect', array( 'WPfbConnect_Logic', 'comment_post_redirect'), 0, 2); if( get_option('fb_enable_approval') ) { add_filter( 'pre_comment_approved', array('WPfbConnect_Logic', 'comment_approval')); } // include internal stylesheet add_action( 'wp_head', array( 'WPfbConnect_Interface', 'style')); add_action( 'login_head', array( 'WPfbConnect_Interface', 'style')); if( get_option('fb_enable_commentform') ) { add_action( 'comment_form', array( 'WPfbConnect_Interface', 'comment_form'), 10); } add_action( 'wp_footer', array( 'WPfbConnect_Logic', 'fbconnect_init_scripts'), 1); if(!function_exists('carga_template')): function carga_template() { if (isset($_REQUEST['fbconnect_action'])){ set_include_path( TEMPLATEPATH . PATH_SEPARATOR . dirname(__FILE__) .PATH_SEPARATOR. WP_PLUGIN_DIR.'/'.FBCONNECT_PLUGIN_BASENAME. PATH_SEPARATOR . get_include_path() ); if($_REQUEST['fbconnect_action']=="community"){ include( 'community.php'); }else if($_REQUEST['fbconnect_action']=="myhome"){ include( 'myhome.php'); }else if($_REQUEST['fbconnect_action']=="tab"){ include('fbconnect_tab.php'); }else if($_REQUEST['fbconnect_action']=="invite"){ include('invitefriends.php'); }else if($_REQUEST['fbconnect_action']=="logout"){ if(function_exists('wp_logout')): wp_logout(); endif; if(function_exists('wp_redirect')): wp_redirect( get_option('siteurl') ); endif; }else if($_REQUEST['fbconnect_action']=="fbfeed"){ include( 'fbfeed.php'); } restore_include_path(); exit; } } endif; add_action('template_redirect', 'carga_template'); /** * If the current comment was submitted with FacebookConnect, return true * useful for */ if(!function_exists('is_comment_fbconnect')): function is_comment_fbconnect() { global $comment; return ( $comment->fbconnect == 1 ); } endif; /** * If the current user registered with FacebookConnect, return true */ if(!function_exists('is_user_fbconnect')): function is_user_fbconnect($id = null) { global $current_user; $user = $current_user; if ($id != null) { $user = get_userdata($id); } if($user!=null && $user->fbconnect_userid){ return true; }else{ return false; } } endif; //MAIN WIDGET if(!function_exists('widget_FacebookConnector_init')): function widget_FacebookConnector_init() { if (!function_exists('register_sidebar_widget')) return; function widget_FacebookConnector($args) { extract($args); $options = get_option('widget_FacebookConnector'); if (!isset($options) || $options==""){ $before_title ="