function fbml_sample_parse($fbml_from_callback, $fbml_impl) { // Preconfigure the FBML engine so it knows which FBML tags // to look for, which HTML tags require special rendering, which // tags require precaching, and so forth. $fbml_tags = $fbml_impl->get_all_fb_tag_names(); $html_special = $fbml_impl->get_special_html_tags(); $precache_tags = $fbml_impl->get_precache_tags(); $style_tags = array('style'); $style_attrs = array('style', 'imgstyle'); $rewrite_attrs = array('name', 'for', 'href', 'src', 'background', 'url', 'dynsrc', 'lowsrc', 'clickrewriteurl', 'onclick', 'onmouseover', 'onabort', 'onblur', 'ondblclick', 'onerror', 'onfocus', 'onkeydown', 'onkeypress', 'onkeyup', 'onload', 'onmousedown', 'onmouseenter', 'onmouseleave', 'onmousemove', 'onmouseout', 'onmouseover', 'onmousewheel', 'onmouseup', 'onreset', 'onresize', 'onselect', 'onsubmit', 'onunload', 'onchange'); $special_attrs = array('id'); $fbml_attrs = array_merge($style_attrs, $rewrite_attrs, $special_attrs); $fbml_schema = schema_get_schema(); fbml_complex_expand_tag_list_11($fbml_tags, $fbml_attrs, $html_special, $precache_tags, $style_tags, $style_attrs, array(), $rewrite_attrs, $special_attrs, $fbml_schema); $data = array('impl' => $fbml_impl); $rewriter = array('func' => 'fbml_rewrite_attr', 'data' => $fbml_impl); // FBOPEN:NOTE - no css sanitizer incorporated in this version. $sanitizer = array(); $parse_tree = fbml_parse_opaque_11($fbml_from_callback, true, false, false, $sanitizer, array(), $rewriter); $fbml_tree = new FBMLNode($parse_tree['root']); $fbml_tree->precache($fbml_impl); $html = $fbml_tree->render_html($fbml_impl); return $html; }
/** * Checks to make sure that a form element is OK before rendering it * @param FBMLNode $node */ public function check_form_element($node) { if (starts_with($name = $node->attr('name', ''), 'fb_')) { throw new FBMLRenderException('Names beginning with "fb_" in FORM elements are reserved for use by Facebook ("' . $name . '")'); } }