/** * Magic Method __construct assigns few information about module and instantiate parent class * @author Business Tech (www.businesstech.fr) - Contact: http://www.businesstech.fr/en/contact-us */ public function __construct() { // hack for older version than 1 4 5 1 if (is_file(dirname(__FILE__) . '/conf/common.conf.php')) { require_once dirname(__FILE__) . '/conf/common.conf.php'; } else { require_once _PS_MODULE_DIR_ . 'facebookpsconnect/conf/common.conf.php'; } require_once _FPC_PATH_LIB . 'warning_class.php'; require_once _FPC_PATH_LIB . 'module-tools_class.php'; // use case - get context if (version_compare(_PS_VERSION_, '1.5', '>')) { self::$iShopId = Context::getContext()->shop->id; } // get current lang self::$iCurrentLang = BT_FPCModuleTools::getCookieObj()->id_lang; // get current iso lang self::$sCurrentLang = BT_FPCModuleTools::getLangIso(); // get cookie obj self::$oCookie = BT_FPCModuleTools::getCookieObj(); $this->name = 'facebookpsconnect'; $this->module_key = 'ffcbc0b08d66e0afb7ed1ed27e0f1492'; $this->tab = 'social_networks'; $this->version = '1.5.5'; $this->author = 'Business Tech'; $this->need_instance = 0; parent::__construct(); $this->displayName = $this->l('Facebook PS Connect'); $this->description = $this->l('Let your customer easily log in via Facebook, Paypal, Google or Twitter'); $this->confirmUninstall = $this->l('Are you sure you want to remove it ? Your Facebook PS Connect will no longer work. Be careful, all your configuration and your data will be lost'); // stock itself obj self::$oModule = $this; // update module version $GLOBALS[_FPC_MODULE_NAME . '_CONFIGURATION'][_FPC_MODULE_NAME . '_MODULE_VERSION'] = $this->version; // set base of URI self::$sBASE_URI = $this->_path; // set title of hooks & connectors $GLOBALS[_FPC_MODULE_NAME . '_ZONE']['header']['title'] = $this->l('Header'); $GLOBALS[_FPC_MODULE_NAME . '_ZONE']['top']['title'] = $this->l('Top'); $GLOBALS[_FPC_MODULE_NAME . '_ZONE']['account']['title'] = $this->l('Customer account'); $GLOBALS[_FPC_MODULE_NAME . '_ZONE']['left']['title'] = $this->l('Left Column'); $GLOBALS[_FPC_MODULE_NAME . '_ZONE']['right']['title'] = $this->l('Right Column'); $GLOBALS[_FPC_MODULE_NAME . '_ZONE']['footer']['title'] = $this->l('Footer'); $GLOBALS[_FPC_MODULE_NAME . '_ZONE']['authentication']['title'] = $this->l('Authentication page'); $GLOBALS[_FPC_MODULE_NAME . '_CONNECTORS']['facebook']['title'] = $this->l('Facebook sign in'); $GLOBALS[_FPC_MODULE_NAME . '_CONNECTORS']['twitter']['title'] = $this->l('Twitter sign in'); $GLOBALS[_FPC_MODULE_NAME . '_CONNECTORS']['google']['title'] = $this->l('Google sign in'); $GLOBALS[_FPC_MODULE_NAME . '_CONNECTORS']['paypal']['title'] = $this->l('Paypal sign in'); if (version_compare(_PS_VERSION_, '1.6.0', '<')) { $GLOBALS[_FPC_MODULE_NAME . '_ZONE']['right']['title'] = $this->l('Right Column'); $GLOBALS[_FPC_MODULE_NAME . '_ZONE']['blockUser']['title'] = $this->l('Block Info User'); } // get configuration options BT_FPCModuleTools::getConfiguration(); // get call mode - Ajax or dynamic - used for clean headers and footer in ajax request self::$sQueryMode = Tools::getValue('sMode'); }
/** * _displayBlock() method * * @param array $aParams * @return array */ private function _displayBlock(array $aParams) { // set $aAssign = array(); // get all configured hooks if (FacebookPsConnect::$aConfiguration[_FPC_MODULE_NAME . '_DISPLAY_BLOCK'] && !empty($GLOBALS[_FPC_MODULE_NAME . '_ZONE'][$this->sHookType]['data'])) { $aAssign['sStyle'] = strtolower(_FPC_MODULE_NAME) . '_mini_button'; $aAssign['bDisplay'] = true; $aAssign['bConnectorsActive'] = self::$bConnectorsActive; $aAssign['sConnectorButtonsIncl'] = BT_FPCModuleTools::getTemplatePath(_FPC_PATH_TPL_NAME . _FPC_TPL_HOOK_PATH . _FPC_TPL_CONNECTOR_BUTTONS); $aAssign['aHookConnectors'] = $GLOBALS[_FPC_MODULE_NAME . '_ZONE'][$this->sHookType]['data']; $aAssign['aConnectors'] = $GLOBALS[_FPC_MODULE_NAME . '_CONNECTORS']; $aAssign['sPosition'] = 'blockAccount'; $aAssign['sBackUri'] = self::$sCurrentURI; $aAssign['sLinkAccount16'] = BT_FPCModuleTools::getAccountPageLink(); // customer data $aAssign['sCustomerName'] = $this->iCustomerLogged ? BT_FPCModuleTools::getCookieObj()->customer_firstname . ' ' . BT_FPCModuleTools::getCookieObj()->customer_lastname : false; $aAssign['sFirstName'] = $this->iCustomerLogged ? BT_FPCModuleTools::getCookieObj()->customer_firstname : false; $aAssign['sLastName'] = $this->iCustomerLogged ? BT_FPCModuleTools::getCookieObj()->customer_lastname : false; // customer not logged if (!empty($this->iCustomerLogged)) { $aAssign['oCart'] = BT_FPCModuleTools::getCartObj(); $aAssign['iCartQty'] = BT_FPCModuleTools::getCartObj()->nbProducts(); } } else { $aAssign['bDisplay'] = false; } return array('tpl' => _FPC_TPL_HOOK_PATH . _FPC_TPL_ACCOUNT_BLOCK, 'assign' => $aAssign); }