summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Cohen2010-12-28 22:05:48 (GMT)
committer Dave Cohen2010-12-28 22:05:48 (GMT)
commit2cac83cb5636988dfb9d2792191255fd4fbc4040 (patch)
tree1bfde13a69404127aebbe7ef4c46a3395ab5ff60
parent006ce70b3361beb45112be7599c2545704526f74 (diff)
url option fb_canvas can now select a specific application to link to.
-rw-r--r--fb_canvas.module16
1 files changed, 12 insertions, 4 deletions
diff --git a/fb_canvas.module b/fb_canvas.module
index dc1dcc7..41e9846 100644
--- a/fb_canvas.module
+++ b/fb_canvas.module
@@ -317,18 +317,26 @@ if (!function_exists('custom_url_rewrite_outbound')) {
*
* @param $options
* If $options['fb_canvas'] == TRUE, create an absolute URL to a canvas
- * page. The URL will begin http://apps.facebook.com/...
+ * page. The URL will begin http://apps.facebook.com/... Also if
+ * $options['fb_canvas'] is an application label the url will link to that
+ * particular application.
*/
function fb_canvas_url_outbound_alter(&$path, &$options, $original_path) {
- global $_fb, $_fb_app;
- if (isset($_fb_app) && isset($_fb_app->canvas)) {
+ if (isset($options['fb_canvas']) && is_string($options['fb_canvas'])) {
+ $fb_app = fb_get_app(array('label' => $options['fb_canvas']));
+ }
+ else {
+ $fb_app = $GLOBALS['_fb_app'];
+ }
+
+ if ($fb_app && isset($fb_app->canvas)) {
if ((!isset($options['fb_url_alter']) || $options['fb_url_alter']) &&
(isset($options['fb_canvas']) && $options['fb_canvas'])) {
// Make a url starting with apps.facebook.com/...
$options['external'] = TRUE;
$options[FB_SETTINGS_CB] = FALSE; // prevent fb_url_rewrite.inc from altering.
$options['absolute'] = TRUE;
- $options['base_url'] = 'http://apps.facebook.com/' . $_fb_app->canvas;
+ $options['base_url'] = 'http://apps.facebook.com/' . $fb_app->canvas;
}
if (fb_canvas_is_iframe()) {
if (!$options['absolute']) {