├── javascript └── upload_example │ ├── logo_header.gif │ ├── index.htm │ └── webtoolkitsha1.js ├── PHPKit └── SSUtil │ ├── api_config.php │ ├── example.php │ ├── README.txt │ ├── SSUtil.php │ └── class.rss.php ├── README └── playerAPI ├── index.html └── swfobject.js /javascript/upload_example/logo_header.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slideshare/SlideshareAPIExamples/HEAD/javascript/upload_example/logo_header.gif -------------------------------------------------------------------------------- /PHPKit/SSUtil/api_config.php: -------------------------------------------------------------------------------- 1 | '; 5 | $secret=''; 6 | 7 | // Do not change this 8 | $apiurl='http://www.slideshare.net/api/1/'; 9 | 10 | ?> -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | Wrappers and examples for how to use the Slideshare API 2 | 3 | The directory PHPKit contains a PHP wrapper for the Slideshare API named SSUtil. 4 | 5 | The directory javascript contains examples in Javascript. 6 | It contains an example of how to upload content using javascript and PHP. 7 | 8 | The directory playerAPI contains examples of how to use our Javascript Player API to control the player using Javascript. 9 | -------------------------------------------------------------------------------- /PHPKit/SSUtil/example.php: -------------------------------------------------------------------------------- 1 | count_slideUser('variable_orr')."
"; 7 | echo '# of slides in the web 2.0 group - '.$apiobj->count_slideGroup('web-20')."
"; 8 | echo '# of slides tagged as marketing - '.$apiobj->count_slideTag('marketing')."
"; 9 | 10 | print_r($apiobj->get_slideUser('variable_orr',0,50)); 11 | print_r($apiobj->get_slideInfo(47236)); 12 | 13 | //RSS utility functions 14 | $apiobj->get_RSS('http://www.slideshare.net/rss/latest');*/ 15 | echo $apiobj->make_RSS('Test feed','Test description','12',$apiobj->get_slideUser('variable_orr',0,50)); 16 | 17 | ?> -------------------------------------------------------------------------------- /PHPKit/SSUtil/README.txt: -------------------------------------------------------------------------------- 1 | This is the SlideShare PHP API, and this contains the following files: 2 | 3 | api_config.php - The API configuration file 4 | example.php - The API usage example file 5 | SSUtil.php - The API Class code which you have to include in your code 6 | class.rss.php - This is a RSS generation helper file 7 | rss.xml - Sample generated RSS feed file 8 | 9 | To start using this you need to obtain an API key from SlideShare. That key has to be put in the api_config file. 10 | i.e. 11 | 12 | $key=''; 13 | $secret=''; 14 | 15 | in api_config.php 16 | 17 | In this following section we see all the function calls: 18 | 19 | count_slideUser(Username) - This returns the total number of slideshows the user has uploaded. 20 | count_slideTag(Tag) - This returns the total number of slidehshows with the given tag. 21 | count_slideGroup(Group) - This returns the total number of slideshows found in the given group on slideshare 22 | get_slideInfo(slideID) - This returns the information about the slide with the given slideID in an associative array. This will contain the title, description, thumbnail, and other meta information about the slideshow. 23 | get_slideUser(Username,offset=0,limit=0) - This will return 'limit' number of the user's slideshows from a given 'offset' from the start. This system enables the developer to make an efficient pagination system. 24 | get_slideTag(Tag,offset=0,limit=0) - This will return 'limit' number of a given tag's slideshows from a given 'offset' from the start. This system enables the developer to make an efficient pagination system. 25 | get_slideGroup(Groupname,offset=0,limit=0) - This will return 'limit' number of the group's slideshows from a given 'offset' from the start. This system enables the developer to make an efficient pagination system. 26 | 27 | get_RSS(url) - This allows you to extract any Slideshare RSS and convert that into an associative array easily. 28 | make_RSS(title,description,date,slides,feed location,feed filename) - Want to generate your own Slideshare feed. This enables you to push in an array of slideshows (with the same associative format which get_slideInfo returns) and generate an RSS file. -------------------------------------------------------------------------------- /javascript/upload_example/index.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 26 | 27 | 28 | Slideshare Logo 29 |

30 |

31 | This is a sample web-page to test the Slideshare upload API. Please enter your API Key, Shared secret and your Slideshare Credentials to post a slideshow to Slideshare. Feel free to modify and use this code in your own web applications. Do not share your API keys with anyone to prevent abuse from your Slideshare account. 32 |

33 |

On success, you will get the Slideshow ID of the slideshow you uploaded to Slideshare. If things go wrong (ex. you do not provide valide credentials etc), an appropriate error code will be returned. More documentation can be found on http://www.slideshare.net/developers/documentation. For more support, post a message on the Slideshare Developers Forum or e-mail to api@slideshare.net

34 |

Thanks to Web Toolkit for the Javascript Snippet which calculates SHA1 hash required in the upload.

35 |
36 | Slideshare API Key (api_key):
37 | 38 |

39 | Slideshare Shared Secret:
40 | 41 |

42 | 43 | 44 | Slideshare username (username):


45 | Slideshare password (password):


46 | Slideshow Title (slideshow_title):


47 | Slideshow Source File (slideshow_srcfile):


48 | 49 |
50 | 51 | -------------------------------------------------------------------------------- /playerAPI/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | SlideShare Player API Example 4 | 5 | 36 | 37 | 38 |
39 | You need Flash player 8+ and JavaScript enabled to view this video. 40 |
41 |
42 | 43 | 44 | 45 | 46 | 47 | 48 |
49 | 50 | 51 | -------------------------------------------------------------------------------- /javascript/upload_example/webtoolkitsha1.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Secure Hash Algorithm (SHA1) 4 | * http://www.webtoolkit.info/ 5 | * 6 | **/ 7 | 8 | function SHA1 (msg) { 9 | 10 | function rotate_left(n,s) { 11 | var t4 = ( n<>>(32-s)); 12 | return t4; 13 | }; 14 | 15 | function lsb_hex(val) { 16 | var str=""; 17 | var i; 18 | var vh; 19 | var vl; 20 | 21 | for( i=0; i<=6; i+=2 ) { 22 | vh = (val>>>(i*4+4))&0x0f; 23 | vl = (val>>>(i*4))&0x0f; 24 | str += vh.toString(16) + vl.toString(16); 25 | } 26 | return str; 27 | }; 28 | 29 | function cvt_hex(val) { 30 | var str=""; 31 | var i; 32 | var v; 33 | 34 | for( i=7; i>=0; i-- ) { 35 | v = (val>>>(i*4))&0x0f; 36 | str += v.toString(16); 37 | } 38 | return str; 39 | }; 40 | 41 | 42 | function Utf8Encode(string) { 43 | string = string.replace(/\r\n/g,"\n"); 44 | var utftext = ""; 45 | 46 | for (var n = 0; n < string.length; n++) { 47 | 48 | var c = string.charCodeAt(n); 49 | 50 | if (c < 128) { 51 | utftext += String.fromCharCode(c); 52 | } 53 | else if((c > 127) && (c < 2048)) { 54 | utftext += String.fromCharCode((c >> 6) | 192); 55 | utftext += String.fromCharCode((c & 63) | 128); 56 | } 57 | else { 58 | utftext += String.fromCharCode((c >> 12) | 224); 59 | utftext += String.fromCharCode(((c >> 6) & 63) | 128); 60 | utftext += String.fromCharCode((c & 63) | 128); 61 | } 62 | 63 | } 64 | 65 | return utftext; 66 | }; 67 | 68 | var blockstart; 69 | var i, j; 70 | var W = new Array(80); 71 | var H0 = 0x67452301; 72 | var H1 = 0xEFCDAB89; 73 | var H2 = 0x98BADCFE; 74 | var H3 = 0x10325476; 75 | var H4 = 0xC3D2E1F0; 76 | var A, B, C, D, E; 77 | var temp; 78 | 79 | msg = Utf8Encode(msg); 80 | 81 | var msg_len = msg.length; 82 | 83 | var word_array = new Array(); 84 | for( i=0; i>>29 ); 112 | word_array.push( (msg_len<<3)&0x0ffffffff ); 113 | 114 | 115 | for ( blockstart=0; blockstart$val) { 19 | if(strtoupper($key) == "SLIDESHARESERVICEERROR") { 20 | $finarr[0]["Error"]="true"; 21 | $finarr[0]["Message"]=$values[$tags["MESSAGE"][0]]["value"]; 22 | return $finarr; 23 | } 24 | if ((strtolower($key) != "slideshow") && (strtolower($key) != "slideshows") && (strtolower($key) != "slideshowdeleted") && (strtolower($key) != "slideshowuploaded") && (strtolower($key) != "tags") && (strtolower($key) != "group") && (strtolower($key) != "name") && (strtolower($key) != "count") && (strtolower($key) != "user")) { 25 | for($i = 0;$i < count($val);$i++) { 26 | $finarr[$i][$key]=$values[$val[$i]]["value"]; 27 | } 28 | } 29 | else { 30 | continue; 31 | } 32 | } 33 | return $finarr; 34 | } 35 | private function RSStoArray($feed) { 36 | $parser = xml_parser_create(); 37 | xml_parse_into_struct($parser, $feed, $values, $tags); 38 | xml_parser_free($parser); 39 | $count=1; 40 | foreach($tags as $key=>$val) { 41 | if((strtolower($key)=='title')&&(strtolower($key)=='link')&&(strtolower($key)=='pubDate')&&(strtolower($key)=='description')) { 42 | for($i = 1;$i < count($val);$i++) { 43 | $data[$i-1][$key]=$values[$val[$i-1]]["value"]; 44 | } 45 | } else if((strtolower($key)!='rss')&&(strtolower($key)!='channel')&&(strtolower($key)!='item')&&(strtolower($key)!='slideshare:meta')) { 46 | if(strtolower(substr($key,0,10))=="slideshare") 47 | $key=substr($key,11); 48 | for($i = 0;$i < count($val);$i++) { 49 | $data[$i][$key]=$values[$val[$i]]["value"]; 50 | } 51 | } 52 | } 53 | return $data; 54 | } 55 | public function SSUtil() { 56 | $this->key=$GLOBALS['key']; 57 | $this->secret=$GLOBALS['secret']; 58 | $this->apiurl=$GLOBALS['apiurl']; 59 | } 60 | private function get_data($call,$params) { 61 | $ts=time(); 62 | $hash=sha1($this->secret.$ts); 63 | try { 64 | $res=file_get_contents($this->apiurl.$call."?api_key=$this->key&ts=$ts&hash=$hash".$params); 65 | } catch (Exception $e) { 66 | // Log the exception and return $res as blank 67 | } 68 | return utf8_encode($res); 69 | } 70 | /* Get all the slide information in a simple array */ 71 | public function get_slideInfo($id) { 72 | $data=$this->XMLtoArray($this->get_data("get_slideshow","&slideshow_id=$id")); 73 | return $data[0]; 74 | } 75 | public function count_slideUser($user) { 76 | $xml=new SimpleXMLElement($this->get_data("get_slideshow_by_user","&username_for=$user&offset=0&limit=1")); 77 | return $xml->count; 78 | } 79 | /* Get all the user's slide information in a simple multi-dimensional array */ 80 | public function get_slideUser($user,$offset=0,$limit=0) { 81 | return $this->XMLtoArray($this->get_data("get_slideshow_by_user","&username_for=$user&offset=$offset&limit=$limit")); 82 | } 83 | public function count_slideTag($tag) { 84 | $xml=new SimpleXMLElement($this->get_data("get_slideshow_by_tag","&tag=$tag&offset=0&limit=1")); 85 | return $xml->count; 86 | } 87 | /* Get all the tags's slide information in a simple multi-dimensional array */ 88 | public function get_slideTag($tag,$offset=0,$limit=0) { 89 | return $this->XMLtoArray($this->get_data("get_slideshow_by_tag","&tag=$tag&offset=$offset&limit=$limit")); 90 | } 91 | public function count_slideGroup($group) { 92 | $xml=new SimpleXMLElement($this->get_data("get_slideshow_from_group","&group_name=$group&offset=0&limit=1")); 93 | return $xml->count; 94 | } 95 | /* Get all the group's slide information in a simple multi-dimensional array */ 96 | public function get_slideGroup($group,$offset=0,$limit=0) { 97 | return $this->XMLtoArray($this->get_data("get_slideshow_from_group","&group_name=$group&offset=$offset&limit=$limit")); 98 | } 99 | /* pull any slideshare feed and retrieve that in a multi-dimensional array */ 100 | public function get_RSS($feed) { 101 | try { 102 | $res=file_get_contents($feed); 103 | } catch (Exception $e) { 104 | // Log the exception and return $res as blank 105 | } 106 | $feedxml=utf8_encode($res); 107 | return $this->RSStoArray($feedxml); 108 | } 109 | /* Generate your own slideshow RSS enter a multi-dimensional slide */ 110 | public function make_RSS($title,$description,$date,$slides,$location='.',$filename='rss') { 111 | $rss = new rss('utf-8'); 112 | $rss->channel($title, 'http://www.slideshare.net', $description); 113 | $rss->language('en-us'); 114 | $rss->copyright('Copyright by SlideShare 2006'); 115 | $rss->managingEditor('support.slideshare@gmail.com'); 116 | $rss->startRSS($location,$filename); 117 | 118 | for($i = 0; $i < count($slides); $i++){ 119 | $rss->itemTitle($slides[$i]['TITLE']); 120 | $rss->itemLink($slides[$i]['PERMALINK']); 121 | $rss->itemDescription( 122 | ' 124 |

125 | '.$slides[$i]['DESCRIPTION'].' 126 |

127 | ]]>' 128 | ); 129 | $rss->itemGuid($slides[$i]['PERMALINK'],true); 130 | $rss->itemComments($slides[$i]['PERMALINK']); 131 | $rss->itemSource('Slideshare', 'http://www.slideshare.net'); 132 | $rss->addItem(); 133 | } 134 | $rss->RSSdone(); 135 | } 136 | } 137 | 138 | ?> -------------------------------------------------------------------------------- /playerAPI/swfobject.js: -------------------------------------------------------------------------------- 1 | /* SWFObject v2.2 2 | is released under the MIT License 3 | */ 4 | var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y0){for(var af=0;af0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad'}}aa.outerHTML='"+af+"";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;abgenerator = 'SlideShare API library'; 59 | $this->docs = 'http://developer.slideshare.net'; 60 | if(!empty($encoding)){ $this->encoding = $encoding; } 61 | } 62 | 63 | function channel($title, $link, $description){ 64 | $this->title = $title; 65 | $this->link = $link; 66 | $this->description = $description; 67 | } 68 | 69 | function language($language){ $this->language = $language; } 70 | 71 | function copyright($copyright){ $this->copyright = $copyright; } 72 | 73 | function managingEditor($managingEditor){ $this->managingEditor = $managingEditor; } 74 | 75 | function webMaster($webMaster){ $this->webMaster = $webMaster; } 76 | 77 | function pubDate($pubDate){ $this->pubDate = $pubDate; } 78 | 79 | function lastBuildDate($lastBuildDate){ $this->lastBuildDate = $lastBuildDate; } 80 | 81 | function category($category, $domain = ''){ 82 | $this->category .= $this->s(2) . 'category .= ' domain="' . $domain . '"'; } 84 | $this->category .= '>' . $category . '' . "\n"; 85 | } 86 | 87 | function cloud($domain, $port, $path, $registerProcedure, $protocol){ 88 | $this->cloud .= $this->s(2) . ''; 89 | } 90 | 91 | function ttl($ttl){ $this->ttl = $ttl; } 92 | 93 | function image($url, $title, $link, $width = '', $height = '', $description = ''){ 94 | $this->image = $this->s(2) . '' . "\n"; 95 | $this->image .= $this->s(3) . '' . $url . '' . "\n"; 96 | $this->image .= $this->s(3) . '' . $title . '' . "\n"; 97 | $this->image .= $this->s(3) . '' . $link . '' . "\n"; 98 | if($width != ''){ $this->s(3) . '' . $width . '' . "\n"; } 99 | if($height != ''){ $this->s(3) . '' . $height . '' . "\n"; } 100 | if($description != ''){ $this->s(3) . '' . $description . '' . "\n"; } 101 | $this->image .= $this->s(2) . '' . "\n"; 102 | } 103 | 104 | function textInput($title, $description, $name, $link){ 105 | $this->textInput = $this->s(2) . '' . "\n"; 106 | $this->textInput .= $this->s(3) . '' . $title . '' . "\n"; 107 | $this->textInput .= $this->s(3) . '' . $description . '' . "\n"; 108 | $this->textInput .= $this->s(3) . '' . $name . '' . "\n"; 109 | $this->textInput .= $this->s(3) . '' . $link . '' . "\n"; 110 | $this->textInput .= $this->s(2) . '' . "\n"; 111 | } 112 | 113 | function skipHours(){ 114 | $this->skipHours = array(); 115 | $args = func_get_args(); 116 | $this->skipHours = array_values($args); 117 | } 118 | 119 | function skipDays(){ 120 | $this->skipDays = array(); 121 | $args = func_get_args(); 122 | $this->skipDays = array_values($args); 123 | } 124 | 125 | function startRSS($path = '.', $filename = 'rss'){ 126 | $this->path = $path; 127 | $this->filename = $filename; 128 | $this->rss = 'encoding)){ $this->rss .= ' encoding="' . $this->encoding . '"'; } 130 | $this->rss .= '?>' . "\n"; 131 | $this->rss .= '' . "\n"; 132 | $this->rss .= $this->s(1) . '' . "\n"; 133 | $this->rss .= $this->s(2) . '' . $this->title . '' . "\n"; 134 | $this->rss .= $this->s(2) . '' . $this->link . '' . "\n"; 135 | $this->rss .= $this->s(2) . '' . $this->description . '' . "\n"; 136 | if(!empty($this->language)){ $this->rss .= $this->s(2) . '' . $this->language . '' . "\n"; } 137 | if(!empty($this->copyright)){ $this->rss .= $this->s(2) . '' . $this->copyright . '' . "\n"; } 138 | if(!empty($this->managingEditor)){ $this->rss .= $this->s(2) . '' . $this->managingEditor . '' . "\n"; } 139 | if(!empty($this->webMaster)){ $this->rss .= $this->s(2) . '' . $this->webMaster . '' . "\n"; } 140 | if(!empty($this->pubDate)){ $this->rss .= $this->s(2) . '' . $this->pubDate . '' . "\n"; } 141 | if(!empty($this->lastBuildDate)){ $this->rss .= $this->s(2) . '' . $this->lastBuildDate . '' . "\n"; } 142 | if(!empty($this->category)){ $this->rss .= $this->category; } 143 | $this->rss .= $this->s(2) . '' . $this->generator . '' . "\n"; 144 | $this->rss .= $this->s(2) . '' . $this->docs . '' . "\n"; 145 | if(!empty($this->cloud)){ $this->rss .= $this->cloud; } 146 | if(!empty($this->ttl)){ $this->rss .= $this->s(2) . '' . $this->ttl . '' . "\n"; } 147 | if(!empty($this->image)){ $this->rss .= $this->image; } 148 | if(!empty($this->textInput)){ $this->rss .= $this->textInput; } 149 | if(count($this->skipHours) > 0){ 150 | $this->rss .= $this->s(2) . '' . "\n"; 151 | for($i = 0; $i < count($this->skipHours); $i++){ 152 | $this->rss .= $this->s(3) . '' . $this->skipHours[$i] . '' . "\n"; 153 | } 154 | $this->rss .= $this->s(2) . '' . "\n"; 155 | } 156 | if(count($this->skipDays) > 0){ 157 | $this->rss .= $this->s(2) . '' . "\n"; 158 | for($i = 0; $i < count($this->skipDays); $i++){ 159 | $this->rss .= $this->s(3) . '' . $this->skipHours[$i] . '' . "\n"; 160 | } 161 | $this->rss .= $this->s(2) . '' . "\n"; 162 | } 163 | } 164 | 165 | function itemTitle($title){ $this->itemTitle = $title; } 166 | 167 | function itemLink($link){ $this->itemLink = $link; } 168 | 169 | function itemDescription($description){ $this->itemDescription = $description; } 170 | 171 | function itemAuthor($author){ $this->itemAuthor = $author; } 172 | 173 | function itemCategory($category, $domain = ''){ 174 | $this->itemCategory .= $this->s(3) . 'itemCategory .= ' domain="' . $domain . '"'; } 176 | $this->itemCategory .= '>' . $category . '' . "\n"; 177 | } 178 | 179 | function itemComments($comments){ $this->itemComments = $comments; } 180 | 181 | function itemEnclosure($enclosure){ $this->itemEnclosure = $enclosure; } 182 | 183 | function itemGuid($guid, $isPermaLink = ''){ 184 | $this->itemGuid = $this->s(3) . 'itemGuid .= ' isPermaLink="' . $isPermaLink . '"'; } 186 | $this->itemGuid .= '>' . $guid . '' . "\n"; 187 | } 188 | 189 | function itemPubDate($pubDate){ $this->itemPubDate = $pubDate; } 190 | 191 | function itemSource($source, $url){ 192 | $this->itemSource = $this->s(3) . '' . $source . '' . "\n"; 193 | } 194 | 195 | function addItem(){ 196 | $this->rss .= $this->s(2) . '' . "\n"; 197 | if(!empty($this->itemTitle)){ $this->rss .= $this->s(3) . '' . $this->itemTitle . '' . "\n"; } 198 | if(!empty($this->itemLink)){ $this->rss .= $this->s(3) . '' . $this->itemLink . '' . "\n"; } 199 | if(!empty($this->itemDescription)){ $this->rss .= $this->s(3) . '' . $this->itemDescription . '' . "\n"; } 200 | if(!empty($this->itemAuthor)){ $this->rss .= $this->s(3) . '' . $this->itemAuthor . '' . "\n"; } 201 | if(!empty($this->itemCategory)){ $this->rss .= $this->itemCategory; } 202 | if(!empty($this->itemComments)){ $this->rss .= $this->s(3) . '' . $this->itemComments . '' . "\n"; } 203 | if(!empty($this->itemEnclosure)){ $this->rss .= $this->s(3) . '' . $this->itemEnclosure . '' . "\n"; } 204 | if(!empty($this->itemGuid)){ $this->rss .= $this->itemGuid; } 205 | if(!empty($this->itemPubDate)){ $this->rss .= $this->s(3) . '' . $this->itemPubDate . '' . "\n"; } 206 | if(!empty($this->itemSource)){ $this->rss .= $this->itemSource; } 207 | $this->rss .= $this->s(2) . '' . "\n"; 208 | 209 | $this->itemTitle = ''; 210 | $this->itemLink = ''; 211 | $this->itemDescription = ''; 212 | $this->itemAuthor = ''; 213 | $this->itemCategory = ''; 214 | $this->itemComments = ''; 215 | $this->itemEnclosure = ''; 216 | $this->itemGuid = ''; 217 | $this->itemPubDate = ''; 218 | $this->itemSource = ''; 219 | } 220 | 221 | function RSSdone(){ 222 | $this->rss .= $this->s(1) . '' . "\n"; 223 | $this->rss .= ''; 224 | 225 | $handle = fopen($this->path . '/'. $this->filename . '.xml', "w"); 226 | fwrite($handle, $this->rss); 227 | fclose($handle); 228 | } 229 | 230 | function clearRSS(){ 231 | $this->title = ''; 232 | $this->link = ''; 233 | $this->description = ''; 234 | $this->language = ''; 235 | $this->copyright = ''; 236 | $this->managingEditor = ''; 237 | $this->webMaster = ''; 238 | $this->pubDate = ''; 239 | $this->lastBuildDate = ''; 240 | $this->category = ''; 241 | $this->cloud = ''; 242 | $this->ttl = ''; 243 | $this->skipHours = array(); 244 | $this->skipDays = array(); 245 | } 246 | 247 | function s($space){ 248 | $s = ''; 249 | for($i = 0; $i < $space; $i++){ $s .= ' '; } 250 | return $s; 251 | } 252 | 253 | } 254 | 255 | ?> --------------------------------------------------------------------------------