本文整理汇总了PHP中FB::getLocale方法的典型用法代码示例。如果您正苦于以下问题:PHP FB::getLocale方法的具体用法?PHP FB::getLocale怎么用?PHP FB::getLocale使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FB
的用法示例。
在下文中一共展示了FB::getLocale方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
/**
* HTML XMLNS tag (required)
*
* @param array of options
* @example $this->Facebook->init();
* @return string of scriptBlock for FB.init() or error
*/
public function init($options = array())
{
$locale = FB::getLocale();
if (!Configure::read('Facebook.appId')) {
$application = Configure::read('Application');
if ($application) {
$details = sprintf('Application %s (id %s) does not have an app_id - use the settings tab in nodescamp to link this site to a facebook application', $application['name'], $application['id']);
} else {
$details = 'This request is not associated with an application, the facebook application id cannot be determined automatically';
}
throw new CakeException('No Facebook configuration detected.' . $details);
}
$defaults = array('status' => true, 'cookie' => true, 'xfbml' => true, 'autoResize' => true, 'jQuery' => true);
extract(array_merge($defaults, (array) Configure::read('Application.Facebook'), $options));
$appId = Configure::read('Facebook.appId');
$session = $this->Session->read('FB.Session');
$init = '<div id="fb-root"></div>';
$init .= $this->Html->scriptBlock("\n\t\t\twindow.fbAsyncInit = function() {\n\t\t\t\tFB.init({\n\t\t\t\t\tappId\t\t: " . json_encode($appId) . ",\n\t\t\t\t\tchannelUrl\t: \"" . Router::url('/channel.html', true) . "\",\n\t\t\t\t\tsession\t\t: " . json_encode($session) . ",\n\t\t\t\t\tstatus\t\t: " . json_encode($status) . ",\n\t\t\t\t\tcookie\t\t: " . json_encode($cookie) . ",\n\t\t\t\t\txfbml\t\t: " . json_encode($xfbml) . ",\n\t\t\t\t\toauth\t\t: true // Enable OAuth 2.0\n\t\t\t\t});\n\n\t\t\t\t// Resize the canvas to get rid of scroll bars\n\t\t\t\tif (" . json_encode($autoResize) . ") {\n\t\t\t\t\tFB.Canvas.setAutoGrow();\n\t\t\t\t}\n\n\t\t\t\t// Register jQuery event\n\t\t\t\tif (" . json_encode($jQuery) . " && jQuery) {\n\t\t\t\t\tjQuery(document).trigger('fbAsyncInit');\n\t\t\t\t}\n\t\t\t};\n\n\t\t\t(function() {\n\t\t\t\tvar e = document.createElement('script');\n\t\t\t\te.src = document.location.protocol + '//connect.facebook.net/" . $locale . "/all.js';\n\t\t\t\te.async = true;\n\t\t\t\tdocument.getElementById('fb-root').appendChild(e);\n\t\t\t}());\n\t\t\t", $options);
return $init;
}