var feedMeta = StructNew(); var appConfigStruct = getAppConfig(); var serviceURL = ""; var serviceImageData = StructNew(); var serviceImagePath = "/ADF/apps/pt_social_media/images/wordpress-32.gif"; // Get the ServiceURL default from config element if ( StructKeyExists(appConfigStruct,"wordPressServiceURL") ) serviceURL = appConfigStruct.wordPressServiceURL; // Get the ServiceImage default from config element if ( StructKeyExists(appConfigStruct,"wordPressServiceImage") AND ListFirst(appConfigStruct.wordPressServiceImage,":") EQ "CPIMAGE" ) { serviceImageData = application.ptSocialMedia.csData.decipherCPIMAGE(appConfigStruct.wordPressServiceImage); if ( StructKeyExists(serviceImageData,"ResolvedURL") AND StructKeyExists(serviceImageData.ResolvedURL,"ServerRelative") AND LEN(TRIM(serviceImageData.ResolvedURL.ServerRelative)) ) serviceImagePath = serviceImageData.ResolvedURL.ServerRelative; } // General Feed MetaData feedMeta.ServiceType = "wordpress"; feedMeta.ServiceLink = serviceURL; feedMeta.ServiceLogo = serviceImagePath; return feedMeta; var objHttp = StructNew(); var feedError = false; var feedErrorDetails = StructNew(); if ( feedError ) { objHttp['feedError'] = feedError; objHttp['errorDetails'] = feedErrorDetails; objHttp['statusCode'] = "cfhttp error"; objHttp['feedURL'] = arguments.feedURL; //Log the Error doErrorLogging("wordpress","getWordPressHTTPrequest",objHttp); } return objHttp; var feedData = StructNew(); var reData = StructNew(); var rssStruct = StructNew(); var objHttp = getWordPressHTTPrequest(TRIM(arguments.feedURL)); var safehtmltaglist = ""; var normalizeError = false; var feedErrorDetails = StructNew(); var feedError = false; if ( StructKeyExists(objHttp,"Statuscode") AND objHttp.Statuscode EQ "200 OK" ) { if ( IsXML(objHttp.fileContent) ) { feedData = objHttp.fileContent; //feedData = XmlParse(objHttp.Filecontent); //Application.ptSocialMedia.utils.doDUMP(IsXML(objHttp.fileContent),"IsXML",1); //Application.ptSocialMedia.utils.doDUMP(feedData,"feedData1",0); // Normalize the Feed in to a Struct that contains an Array of Items try { feedData = Application.ptSocialMedia.feedRSS.normalize( rss: feedData ,prefersummary: true ,synthtitle: true ,xmlbase: true ,uri: TRIM(arguments.feedURL) ,nativeParseError: false //,safehtmllist: safehtmltaglist ); } catch(Any excpt) { normalizeError = true; feedErrorDetails = cfcatch; } if ( !normalizeError AND IsStruct(feedData) AND StructKeyExists(feedData,"items") ) { reData = feedData; if ( StructKeyExists(objHttp,"statuscode") ) reData['statuscode'] = objHttp.statuscode; } else { //reData['status'] = "fail"; //reData['feed'] = StructNew(); //reData['feed']['status'] = "fail"; //reData['items'] = ArrayNew(1); //reData['items'][1] = StructNew(); //reData['items'][1]['status'] = "fail"; reData['errorDetails'] = feedErrorDetails; reData['feedError'] = "fail: normalization error"; reData['feedURL'] = arguments.feedURL; reData['fileContent'] = feedData; if ( StructKeyExists(objHttp,"statuscode") ) reData['statuscode'] = objHttp.statuscode; } } else { reData['feedError'] = "fail: XML not Returned"; reData['feedURL'] = arguments.feedURL; if ( StructKeyExists(objHttp,"Filecontent") ) reData['fileContent'] = objHttp.Filecontent; if ( StructKeyExists(objHttp,"statuscode") ) reData['statuscode'] = objHttp.statuscode; } } else { reData['feedError'] = "fail: connection error"; reData['feedURL'] = arguments.feedURL; if ( StructKeyExists(objHttp,"Filecontent") ) reData['fileContent'] = objHttp.Filecontent; if ( StructKeyExists(objHttp,"statuscode") ) reData['statuscode'] = objHttp.statuscode; } // Log the Error if reData contains a feedError Key if ( StructKeyExists(reData,"feedError") ) { //Log the Error doErrorLogging("wordpress","getWordPressFeed",reData); } return reData; //var feedURL = "http://blogs.potsdam.edu/admissions/feed/"; var feedData = StructNew(); var reData = ""; //StructNew() var appConfigStruct = getAppConfig(); var apiSuffix = ""; var chrCnt = 0; var apiURL = TRIM(arguments.blogURL); var feedURL = ""; if ( StructKeyExists(appConfigStruct,"apiWordPressFeedSuffix") ) { apiSuffix = appConfigStruct.apiWordPressFeedSuffix; // if Config value starts with a "/" then remove the "/" and the end of the blogURL if ( Left(apiSuffix,1) IS "/" ) { if ( Right(apiURL,1) EQ "/" ) { chrCnt = Len(apiURL); chrCnt = chrCnt - 1; if ( chrCnt GT 0 ) apiURL = Left(apiURL,chrCnt); } } else if ( Left(apiSuffix,1) IS "?") { // TODO: add processing for standard query string config values } // Append the Config value to the end of the Blog URL feedURL = apiURL & appConfigStruct.apiWordPressFeedSuffix; //fix any character encoding from storing URLs in the config element feedURL = application.CS.Data.FromHTML(feedURL); } if ( Len(Trim(feedURL)) ) { // Pass the generated FeedURL to the getWordPressFeed method feedData = getWordPressFeed(TRIM(feedURL)); // Are the feedData Results an Array //if ( StructKeyExists(feedData,"results") AND IsArray(feedData.results) AND ArrayLen(feedData.results) ) //reData = feedData[1].results; if ( StructKeyExists(feedData,"feed") ) { reData = feedData; } else { // Log the error doErrorLogging("wordpress","getWordPressBlogRSS",feedData); reData = StructNew(); } } // Log the error if reData is not returning the expected data types if ( !IsStruct(reData) ) { doErrorLogging("wordpress","getWordPressBlogRSS",reData); reData = StructNew(); } return reData;