/** * Returns an implementation based on data from the POST * @return FBMLImplementation * @param string $s_context generally this would be $_POST['fb_mockajax_context'] * @param string $h_context generally this would be $_POST['fb_mockajax_context_hash'] */ function fbml_mock_ajax_get_impl($s_context, $h_context) { // null means get the latest implementation version $context = FBMLContext::unmarshall_($s_context, $h_context); // The user has presumably triggered this event so we can do // all sort of things like show iframes and do autoplay, etc. $flavor = $context->_flavor; $flavor->_fbml_env['user_triggered'] = true; $flavor->_fbml_env['image_cache'] = null; $flavor->_fbml_env['ajax_triggered'] = true; // This is only applicable to a mock-ajax call from a dialog box, // and if the return fbml contains dialog-response. if ($flavor->check('dialog_response')) { $flavor->_fbml_env['is_dialog_response'] = true; } return new FBJSEnabledFacebookImplementation($flavor); }
/** * Adds the current context to this implementations set of contexts * @return string Hashed context identifier */ public function add_context($flavor = null) { list($m_context, $h_context) = FBMLContext::marshall_($flavor ? $flavor : $this->_flavor); $this->_contexts[$h_context] = $m_context; return $h_context; }
/** * Creates a context and marshalls it * @param array $fbml_env * @param FBMLFlavor $flavor * @return string Marshalled context */ public static function marshall_($flavor) { $context = new FBMLContext($flavor); return array($context->marshall(), $context->hash()); }