[popoon-dev] Misc. minor patches
Chris Murphy
chrismurf at gmail.com
Tue Nov 22 08:01:51 CET 2005
I've attached a svn diff for xmlfile.php that now supports optionally
substituting entities and resolving external entities as suggested.
if there is a map:parameter named "resolveExternals" or
"substituteEntities" set to "true", it will react accordingly. This
patch supercedes my previous patch for xmlfile.
As you said, sitemap is cached (and I don't have a clue how to make
that optional since params don't really make sense) so hopefully this
will take care of the lag concern.
Let me know how the xsl patch goes; whether it conflicts at all. I'm
excited because we just switched over our whole site to popoon; once
we get these changes resolved we'll be back in business without Tomcat
(which makes our IT department very happy).
Best,
Chris
On 11/21/05, Chris Murphy <chrismurf at gmail.com> wrote:
> Sounds good - what's the most appropriate way to make it optional?
> I'm willing to code it up, just not sure what the best way is.
> - c
>
> On 11/21/05, Christian Stocker <christian.stocker at bitflux.ch> wrote:
> >
> >
> > On 21.11.2005 9:05 Uhr, Chris Murphy wrote:
> > > Hello,
> > > I've attached an SVN diff with changes for three files.
> > >
> > > XML File Generator - xmlfile.php
> > > - this patch enables the use of entities in 'generated' XML files.
> > > Previously, they would not get resolved at all. This is really
> > > helpful for enabling things like understanding HTML entities.
> > >
> > > Sitemap functions - Sitemap.php
> > > - this patch enables the use of entities in the sitemap. Previously
> > > they would not get resolved. This is really helpful for setting some
> > > constants at the top of the XML sitemap, such as base URL's and the
> > > like.
> >
> > Maybe make it optional? It actually slows down the parsing, if you don't
> > need it (and did not set XML catalogs correctly).
> >
> > It's no big deal for Sitemap.php, as this is cached anyway for later
> > reuseal..
> >
> >
> > > Sitemap transform - sitemap2php.xsl
> > > - this patch changes the output PHP for a parsed sitemap in a very
> > > minor way - it tests to ensure that returned matches are in fact
> > > "False" rather than that they are 'equivalent' to false. Previously
> > > it was (I think) impossible to match the null string - ^$ - because a
> > > single match of a null string counts as 'false' in php. This just
> > > makes things a little more formal by ensuring it is actually 'false'.
> >
> > I have to test that with our applications to see, if it doesn't break
> > anything (if it does, the app is wrong, but nevertheless..)
> >
> > chregu
> > >
> > > Best,
> > > Chris
> > >
> > > Apologies for not attaching previously.
> > >
> > >
> > > ------------------------------------------------------------------------
> > >
> > > Index: components/generators/xmlfile.php
> > > ===================================================================
> > > --- components/generators/xmlfile.php (revision 5895)
> > > +++ components/generators/xmlfile.php (working copy)
> > > @@ -63,6 +63,8 @@
> > > function DomStart(&$xml)
> > > {
> > > $xml = new DomDocument();
> > > + $xml->resolveExternals = true;
> > > + $xml->substituteEntities = true;
> > > $src = $this->getAttrib("src");
> > > if (! $xml->load($src)) {
> > > if (!file_exists($src) ) {
> > > Index: sitemap.php
> > > ===================================================================
> > > --- sitemap.php (revision 5895)
> > > +++ sitemap.php (working copy)
> > > @@ -369,6 +369,8 @@
> > > //check if we have domxml/xslt
> > >
> > > $xslDom = new DomDocument();
> > > + $xslDom->resolveExternals = true;
> > > + $xslDom->substituteEntities = true;
> > > $xslDom->load($this->sm2php_xsl_dir."/".$this->sm2php_xsl);
> > > if (!class_exists("XsltProcessor")) {
> > > return popoon::raiseError("Popoon doesn't run without XSLT support in PHP.",POPOON_ERROR_FATAL,__FIL E__,__LINE__);
> > > @@ -381,6 +383,8 @@
> > > $xslincludes = new XsltProcessor();
> > > $xslincludes->importStylesheet($xslincludesDom);
> > > $sm = new DomDocument();
> > > + $sm->resolveExternals = true;
> > > + $sm->substituteEntities = true;
> > > if (! $sm->load($sitemapRealPath)) {
> > > if (!file_exists($sitemapRealPath)) {
> > > throw new PopoonFileNotFoundException($sitemapRealPath);
> > > Index: sitemap/sitemap2php.xsl
> > > ===================================================================
> > > --- sitemap/sitemap2php.xsl (revision 5895)
> > > +++ sitemap/sitemap2php.xsl (working copy)
> > > @@ -273,7 +273,7 @@
> > > <xsl:with-param name="prefix">matcher</xsl:with-param>
> > > </xsl:call-template>
> > >
> > > - if ($matcher->match("<xsl:value-of select="@pattern"/>"))
> > > + if ($matcher->match("<xsl:value-of select="@pattern"/>") !== False)
> > > {
> > > <xsl:apply-templates/>
> > > }
> > >
> > >
> > > ------------------------------------------------------------------------
> > >
> > > _______________________________________________
> > > popoon-dev mailing list
> > > popoon-dev at lists.bitflux.ch
> > > http://lists.bitflux.ch/cgi-bin/listinfo/popoon-dev
> >
> > --
> > christian stocker | Bitflux GmbH | schoeneggstrasse 5 | ch-8004 zurich
> > phone +41 44 240 56 70 | mobile +41 76 561 88 60 | fax +41 1 240 56 71
> > http://www.bitflux.ch | christian.stocker at bitflux.ch | GPG 0x5CE1DECB
> >
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: xmlfile.diff
Type: text/x-patch
Size: 683 bytes
Desc: not available
Url : http://lists.bitflux.ch/pipermail/popoon-dev/attachments/20051122/536e5986/xmlfile-0001.bin
More information about the popoon-dev
mailing list