[EXTENSION] EFeed Extension Feed Writer Generator Extension (RSS 1.0, RSS 2.0, and ATOM 1.0)
#1
Posted 01 January 2011 - 03:19 PM
I had to make a RSS channel on my current project and didn't want to include any third party scripts that didn't have the advantages of Yii. This is why I created this Extension.
Please refer to this post for bug reports and/or suggestions.
Link to the Extension for download: http://www.yiiframew...xtension/efeed/
Hope it helps
edit: I knew it was an extension here already developed but I wanted to create something easier to use.
www.ramirezcobos.com
www.yiianswers.com
www.2amigos.us
www.getyiistrap.com
www.github.com/tonydspaniard
www.github.com/2amigos
#3
Posted 08 January 2011 - 11:41 AM
www.ramirezcobos.com
www.yiianswers.com
www.2amigos.us
www.getyiistrap.com
www.github.com/tonydspaniard
www.github.com/2amigos
#4
Posted 24 January 2011 - 04:39 AM
Oh, and this should probably be 1.1.5?
Quote
#5
Posted 24 January 2011 - 04:42 AM
Ill be using it soon and give you my feed back
Extensions:
translate modue - module to handle translations
multiActiveRecord - db selection in models
redisCache - redis cache component
mpCpanel - interact with cpanel api
mUploadify - use uploadify uploader in your application
Gustavo Salomé Silva
#6
Posted 24 January 2011 - 04:53 AM
Sarke, on 24 January 2011 - 04:39 AM, said:
Oh, and this should probably be 1.1.5?
I don't think that it wont be compatible with newest versions 1.1.5+
Thanks for the comments. The idea behind this extension was to easy the tasks of RSS feeds. I am glad it is working for you.
www.ramirezcobos.com
www.yiianswers.com
www.2amigos.us
www.getyiistrap.com
www.github.com/tonydspaniard
www.github.com/2amigos
#8
Posted 24 January 2011 - 01:05 PM
Sarke, on 24 January 2011 - 12:46 PM, said:
Thanks for pointing that out. All my extensions modified...
www.ramirezcobos.com
www.yiianswers.com
www.2amigos.us
www.getyiistrap.com
www.github.com/tonydspaniard
www.github.com/2amigos
#9
Posted 10 June 2011 - 03:25 PM
If you want to generate nested(?) tags, I found a bug in the EFeedItemAtom.php code that overwrites the existing tag... uh.. let me show you, I'm too tired to explain:
$item->addTag('georss:where',array('gml:Point'=>'test')); <- I do this
and for the code to work I had to patch the getElement function
private function getElement( EFeedTag $tag ){
$element = '';
if(in_array($tag->name,$this->CDATAEncoded))
{
$tag->attributes['type']="html";
$element .= CHtml::openTag($tag->name,$tag->attributes);
$element .= '<![CDATA['.PHP_EOL;
}else
{
$element .= CHtml::openTag($tag->name,$tag->attributes);
}
if(is_array($tag->content))
{
foreach ($tag->content as $tag => $content) //change this to $newtag, or you will overwrite your $tag
{
$tmpTag = new EFeedTag($tag, $content);//same here.. change it to $newtag
$element .= $this->getElement( $tmpTag );
}
}
else
{
$element .= (in_array($tag->name, $this->CDATAEncoded))? $tag->content : CHtml::encode($tag->content);
}
//print_r($tag);die();
$element .= (in_array($tag->name, $this->CDATAEncoded))? "]]>":"";
$element .= CHtml::closeTag($tag->name).PHP_EOL;
return $element;
}
then I can produce Atom Code like this:
<georss:where>
<gml:Point>test</gml:Point>
</georss:where>
I just tested this with one level, but I've to make it deeper.. we'll see if it works out
cheers!
#10
Posted 13 June 2011 - 04:31 AM
I have updated the file. If you don't mind i will mention your help.
Thanks again
www.ramirezcobos.com
www.yiianswers.com
www.2amigos.us
www.getyiistrap.com
www.github.com/tonydspaniard
www.github.com/2amigos
#11
Posted 20 June 2011 - 08:39 AM
To do so, you need to set and flip some bits.
diff -u "c:/Users/Maus/AppData/Local/Temp/7zO2880.tmp/EFeed.php.orig" "c:/Users/Maus/AppData/Local/Temp/7zO2880.tmp/EFeed.php"
--- c:/Users/Maus/AppData/Local/Temp/7zO2880.tmp/EFeed.php.orig 2011-06-20 15:13:57.845000000 +0200
+++ c:/Users/Maus/AppData/Local/Temp/7zO2880.tmp/EFeed.php 2011-06-20 15:31:33.785000000 +0200
@@ -260,9 +260,10 @@
$key = ($key == null)? uniqid(rand()) : $key;
$chars = md5($key);
$uuid = substr($chars,0,8) . '-';
- $uuid .= substr($chars,8,4) . '-';
- $uuid .= substr($chars,12,4) . '-';
- $uuid .= substr($chars,16,4) . '-';
+ $uuid .= substr($chars,8,4) . '-4';
+ $uuid .= substr($chars,13,3) . '-';
+ $uuid .= sprintf('%x', hexdec(substr($chars,16,2)) & 191 | 128);
+ $uuid .= substr($chars,18,2) . '-';
$uuid .= substr($chars,20,12);
return $prefix . $uuid;
Diff finished. Mon Jun 20 15:31:49 2011
Best,
-- David
#12
Posted 20 June 2011 - 12:18 PM
Thanks for your suggestion. You are right, the uuid wasn't RFC4122 compliant and I was about to refactor it with (https://github.com/L...ter/src/uuid.js) but I wouldn't mind to use yours but is it correct?
dmaus, on 20 June 2011 - 08:39 AM, said:
$key = ($key == null)? uniqid(rand()) : $key;
$chars = md5($key);
$uuid = substr($chars,0,8) . '-';
+ $uuid .= substr($chars,8,4) . '-4'; <---- Is this correct?
+ $uuid .= substr($chars,13,3) . '-';
+ $uuid .= sprintf('%x', hexdec(substr($chars,16,2)) & 191 | 128);
+ $uuid .= substr($chars,18,2) . '-';
$uuid .= substr($chars,20,12);
return $prefix . $uuid;
www.ramirezcobos.com
www.yiianswers.com
www.2amigos.us
www.getyiistrap.com
www.github.com/tonydspaniard
www.github.com/2amigos
#13
Posted 20 June 2011 - 03:08 PM
Antonio Ramirez, on 20 June 2011 - 12:18 PM, said:
Thanks for your suggestion. You are right, the uuid wasn't RFC4122 compliant and I was about to refactor it with (https://github.com/L...ter/src/uuid.js) but I wouldn't mind to use yours but is it correct?
I would say so. The Specs:
4.4. Algorithms for Creating a UUID from Truly Random or
Pseudo-Random Numbers
The version 4 UUID is meant for generating UUIDs from truly-random or
pseudo-random numbers.
The algorithm is as follows:
o Set the two most significant bits (bits 6 and 7) of the
clock_seq_hi_and_reserved to zero and one, respectively.
o Set the four most significant bits (bits 12 through 15) of the
time_hi_and_version field to the 4-bit version number from
Section 4.1.3.
o Set all the other bits to randomly (or pseudo-randomly) chosen
values.
- ( & 191 | 128 ) => (& #b1011111 | 0b1000000) => Step 1
- the literal "4" => Step 2
- md5($key) => Step 3
The very same algorithm is used in Emacs/Org mode
#14
Posted 21 June 2011 - 02:56 AM
dmaus, on 20 June 2011 - 03:08 PM, said:
4.4. Algorithms for Creating a UUID from Truly Random or
Pseudo-Random Numbers
The version 4 UUID is meant for generating UUIDs from truly-random or
pseudo-random numbers.
The algorithm is as follows:
o Set the two most significant bits (bits 6 and 7) of the
clock_seq_hi_and_reserved to zero and one, respectively.
o Set the four most significant bits (bits 12 through 15) of the
time_hi_and_version field to the 4-bit version number from
Section 4.1.3.
o Set all the other bits to randomly (or pseudo-randomly) chosen
values.
- ( & 191 | 128 ) => (& #b1011111 | 0b1000000) => Step 1
- the literal "4" => Step 2
- md5($key) => Step 3
The very same algorithm is used in Emacs/Org mode
I see, so you talking about Version 4 of UUID and that's correct:
----------
Version 4 UUIDs use a scheme relying only on random numbers. This algorithm sets the version number as well as two reserved bits. All other bits are set using a random or pseudorandom data source. Version 4 UUIDs have the form xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx where x is any hexadecimal digit and y is one of 8, 9, A, or B. e.g. f47ac10b-58cc-4372-a567-0e02b2c3d479.
----------
Thanks, will change the code asap
Cheers
www.ramirezcobos.com
www.yiianswers.com
www.2amigos.us
www.getyiistrap.com
www.github.com/tonydspaniard
www.github.com/2amigos
#15
Posted 04 July 2011 - 09:52 AM
You could use the URL "as is"
RFC 4287, 4.2.6
Quote
definition of "IRI" excludes relative references. Though the IRI
might use a dereferencable scheme, Atom Processors MUST NOT assume it
can be dereferenced.
Using the URL of the feed / the entry is a valid option according to RFC4287 and in my eyes far better than pretending that the ID is something else.
Best,
-- David
#16
Posted 05 July 2011 - 05:15 PM
dmaus, on 04 July 2011 - 09:52 AM, said:
You could use the URL "as is"
RFC 4287, 4.2.6
Using the URL of the feed / the entry is a valid option according to RFC4287 and in my eyes far better than pretending that the ID is something else.
Best,
-- David
So you are saying that this should be in place instead:
echo $this->makeNode($key,'',array('href'=>$value));
// And add the id for ATOM
echo $this->makeNode('id',$value);
I should GIT all my extensions so you all can work on to make them better... do not have much time to look at these things now
Thanks David
www.ramirezcobos.com
www.yiianswers.com
www.2amigos.us
www.getyiistrap.com
www.github.com/tonydspaniard
www.github.com/2amigos
#18
Posted 08 July 2011 - 04:24 AM
www.ramirezcobos.com
www.yiianswers.com
www.2amigos.us
www.getyiistrap.com
www.github.com/tonydspaniard
www.github.com/2amigos
#19
Posted 27 July 2011 - 02:22 AM
include(CTypedMap.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory

Help













