I'm itroducing the second sample of "parse joint".
This joint named D3pipesParseLinkhtml can fetch "publish time" and "link of the article" on the other hand, D3pipesParseSimplehtml can fetch only the "heading".
D3pipesParseLinkhtml has been already included the latest archive of d3pipes.
With the sample joint of D3pipesParseLinkhtml, you can make a pipe like this.
(Just a sample)
0 Fetching from outside snoopy (URI of the page)
10 Transfer to UTF-8 (asyoulike) The encoding of the page
20 Parsing XML linkhtml #([0-9/]{10}).*href=\"([^"]+)\"\>(.*)\</a\>#iU
30 Transfer from UTF-8 (asyoulike) Internal encoding of your site
40 Clipping into local moduledb 86400
minahito has suggested new rule for the language directory.
(language name)_(encoding) (*) all should be small letters
Do you know 'intaller attack'?
If you leave 'install' folder in the public area of the server, attacker can know your DB password, DB prefix etc.
You should know attackers know the folder of 'install' can be renamed '_install' etc.
This is certainly a mistake of the user.
But I find checking a constant '_INSTALL_CHARSET' can protects your xoops from such attacks.
I've just updated the module Protector numbered 3.03 with the feature.
If you dare to use the installer after installing Protector, remove the precheck line from your mainfile.php
I had written language constants of D3 modules can be override by putting files under XOOPS_ROOT_PATH/modules/(dirname)/langauge/ from XOOPS_TRUST_PATH/modules/(trustdirname)/language/
But I found it is hard to use. (eg. Newly appended constants can be displayed its name instead of its value)
And I think CMS should be change its language constants not only via FTP but also "control panel".
Then, I've just implemented Language constants overriding system into altsys-0.5.
- mylangadmin
A controller called by each module's admin area. (like myblocksadmin or mytplsadmin)
This controller saves user values into DB(altsys_language_constants), then makes a cache file under XOOPS_ROOT_PATH/cache/
- D3LanguageManager
A singleton class for module/core on including language constants.
This class can be used like...
require_once XOOPS_TRUST_PATH.'/libs/altsys/class/D3LanguageManager.class.php' ;
$langman =& D3LanguageManager::getInstance() ;
$langman->read( 'main.php' , $mydirname , $mytrustdirname ) ;
It is quite easy to create a joint for d3pipes.
This is a sample to get renewal announcement from HTML.
With d3pipes, all you have to do is creating a class of parse joint.
Make a class definition file under
XOOPS_TRUST_PATH/modules/d3pipes/joints/parse/
In this document, the class is named as Simplehtml.
ClassName: D3pipesParseSimplehtml
FileName: D3pipesParseSimplehtml.class.php
Just write a method of execute() in the file.
execute() of "Parse" joint gets a string and returns array of entries.
Each entry should have 4 parameters.
'heading' : heading
'pubtime' : UnixTimestamp (Set it if you can)
'link' : URI of the article (Set it if you can)
'fingerprint' : ID of the article
With the sample joint of D3pipesParseSimplehtml, you can make a pipe like this.
(The site describe each renewal annoucement in <h2>)
0 Fetching from outside snoopy (URI of the site)
10 Transfer to UTF-8 (asyoulike) The encoding of the site
20 Parsing XML simplehtml #\<h2\>([^<]*)\</h2\>#iU
30 Transfer from UTF-8 (asyoulike) Internal encoding of your site
40 Reassign defaultlink (URI of the site)
50 Clipping into local moduledb 86400