private static $userAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Firefox/60.0";
/**
- * Constructor sets up {@link $generate_enclosure}.
+ * Create a new Tweeper object controlling optional settings.
+ *
+ * @param bool $generate_enclosure
+ * Enables the creation of <enclosure/> elements (disabled by default).
+ * @param bool $show_usernames
+ * Enables showing the username in front of the content for multi-user
+ * sites (enabled by default). Only some stylesheets supports this
+ * functionality (twitter, instagram, pump.io).
*/
- public function __construct($generate_enclosure = FALSE) {
+ public function __construct($generate_enclosure = FALSE, $show_usernames = TRUE) {
$this->generate_enclosure = $generate_enclosure;
+ $this->show_usernames = $show_usernames;
}
/**
// element names, so remove it.
unset($data["qe"]);
+ // The "knobs" object contains elements with undefined namespaces, so
+ // remove it to silence an error message.
+ unset($data["knobs"]);
+
$json = json_encode($data);
return Tweeper::jsonToXml($json, 'instagram');
$xsltProcessor = new XSLTProcessor();
$xsltProcessor->registerPHPFunctions();
$xsltProcessor->setParameter('', 'generate-enclosure', $this->generate_enclosure);
+ $xsltProcessor->setParameter('', 'show-usernames', $this->show_usernames);
$xsltProcessor->importStylesheet($xslDoc);
return $xsltProcessor;