aukw / phpquery

Automatically exported from code.google.com/p/phpquery
0 stars 0 forks source link

Facebook TAGS #142

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Try a facebook tags, will became <login-button>...replace <fb: ..

Original issue reported on code.google.com by admin%tr...@gtempaccount.com on 1 Feb 2010 at 9:04

GoogleCodeExporter commented 9 years ago
I solved:

createDocumentWrapper():

at start of method

$html = preg_replace("/<fb:(.*?)>(.*)<\/fb:\\1>/si","<!-- <fb:\\1>\\2</fb:\\1>
-->",$html);

markup()

at end of method (before return ;))

$markup = preg_replace("/<!-- <fb:(.*?)>(.*)<\/fb:\\1>
-->/si","<fb:\\1>\\2</fb:\\1>",$markup);

Original comment by svacan...@gmail.com on 3 Feb 2010 at 10:01

GoogleCodeExporter commented 9 years ago
preg_replace("/<!-- <fb:(.*?) (.*?)>(.*)<\/fb:\\1> -->/is","<fb:$1
$2>$3</fb:$1>",$markup);

For preserve attributes!

Original comment by svac...@gmail.com on 3 Feb 2010 at 10:40

GoogleCodeExporter commented 9 years ago
This however does not work when you use the tag inside a static html file and 
include it using ->html(''); like

facebookstuff.html has a, <fb:login-button>Login with Facebook</fb:login-button>

$retDOM = phpQuery::newDocument(file_get_contents('htmlbase.html'));
$retDOM->find('#mainFrame')->html(file_get_contents('facebookstuff.html'));
echo $retDOM->html();

you must instead..

$retDOM = phpQuery::newDocument(file_get_contents('htmlbase.html'));
$fbDOM = phpQuery::newDocument(file_get_contents('facebookstuff.html'));
$retDOM->find('#mainFrame')->html($fbDOM->html());
echo $retDOM->html();

Original comment by gravity....@gmail.com on 6 Jun 2011 at 6:42