[Tikiwiki-cvs/svn] SF.net SVN: tikiwiki:[39067] trunk
Revision: 39067
http://tikiwiki.svn.sourceforge.net/tikiwiki/?rev=39067&view=rev
Author: robertplummer
Date: 2011-12-01 22:08:58 +0000 (Thu, 01 Dec 2011)
Log Message:
-----------
[FIX] Just a bunch of fixes to get the reciprical linking working. Finally works nice!
Modified Paths:
--------------
trunk/lib/core/Feed/Abstract.php
trunk/lib/core/Feed/Html.php
trunk/lib/core/Feed/Remote/Abstract.php
trunk/lib/core/Feed/Remote/Html.php
trunk/lib/core/Feed/Remote/TextBacklink.php
trunk/lib/core/Feed/TextBacklink/Contribution.php
trunk/lib/core/Feed/TextBacklink.php
trunk/tiki-feed.php
Added Paths:
-----------
trunk/lib/core/Feed/Remote/TextBacklink/
trunk/lib/core/Feed/Remote/TextBacklink/Contribution.php
Modified: trunk/lib/core/Feed/Abstract.php
===================================================================
--- trunk/lib/core/Feed/Abstract.php 2011-12-01 17:37:15 UTC (rev 39066)
+++ trunk/lib/core/Feed/Abstract.php 2011-12-01 22:08:58 UTC (rev 39067)
<at> <at> -90,12 +90,14 <at> <at>
public function feed()
{
+ global $tikilib;
$feed = json_decode($this->getCache());
return array(
'version' => '1.0',
'encoding' => 'UTF-8',
'feed' => $feed,
+ 'origin' => $tikilib->tikiUrl() . 'tiki-feed.php'
);
}
}
\ No newline at end of file
Modified: trunk/lib/core/Feed/Html.php
===================================================================
--- trunk/lib/core/Feed/Html.php 2011-12-01 17:37:15 UTC (rev 39066)
+++ trunk/lib/core/Feed/Html.php 2011-12-01 22:08:58 UTC (rev 39067)
<at> <at> -8,7 +8,7 <at> <at>
class Feed_Html extends Feed_Abstract
{
var $lastModif = 0;
- var $type = "html";
+ var $type = "feed_html";
public function updateCache()
{
Modified: trunk/lib/core/Feed/Remote/Abstract.php
===================================================================
--- trunk/lib/core/Feed/Remote/Abstract.php 2011-12-01 17:37:15 UTC (rev 39066)
+++ trunk/lib/core/Feed/Remote/Abstract.php 2011-12-01 22:08:58 UTC (rev 39067)
<at> <at> -38,7 +38,7 <at> <at>
public function __construct($feedUrl = "")
{
$this->feedUrl = $feedUrl;
- $this->feedName = $this->siteName() . "_remote_" . $this->type;
+ $this->feedName = $this->siteName() . "_" . $this->type;
}
public function replace()
<at> <at> -54,6 +54,12 <at> <at>
}
}
+ public function origin()
+ {
+ $contents = json_decode($this->getContents());
+ return $contents->origin;
+ }
+
public function listArchives()
{
$archives = array();
<at> <at> -105,8 +111,12 <at> <at>
return $this;
}
- private function getContents()
+ public function getContents($fromFile = false)
{
+ if ($fromFile == true) {
+ $this->contents = FileGallery_File::filename($this->feedName)->data();
+ }
+
if (!empty($this->contents)) {
return $this->contents;
} else {
<at> <at> -123,11 +133,11 <at> <at>
$contents = json_decode($this->getContents());
- if (!empty($contents->feed->entry) && $contents->feed->type == $this->type)
- {
+ //if (!empty($contents->feed->entry) && $contents->feed->type == $this->type)
+ //{
$this->items = $contents->feed->entry;
$this->replace();
- }
+ //}
return $this->items;
}
Modified: trunk/lib/core/Feed/Remote/Html.php
===================================================================
--- trunk/lib/core/Feed/Remote/Html.php 2011-12-01 17:37:15 UTC (rev 39066)
+++ trunk/lib/core/Feed/Remote/Html.php 2011-12-01 22:08:58 UTC (rev 39067)
<at> <at> -10,5 +10,5 <at> <at>
*/
class Feed_Remote_Html extends Feed_Remote_Abstract
{
- var $type = "html";
+ var $type = "feed_remote_html";
}
\ No newline at end of file
Added: trunk/lib/core/Feed/Remote/TextBacklink/Contribution.php
===================================================================
--- trunk/lib/core/Feed/Remote/TextBacklink/Contribution.php (rev 0)
+++ trunk/lib/core/Feed/Remote/TextBacklink/Contribution.php 2011-12-01 22:08:58 UTC (rev 39067)
<at> <at> -0,0 +1,38 <at> <at>
+<?php
+// (c) Copyright 2002-2011 by authors of the Tiki Wiki CMS Groupware Project
+//
+// All Rights Reserved. See copyright.txt for details and a complete list of authors.
+// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
+// $Id$
+
+Class Feed_Remote_TextBacklink_Contribution
+{
+ static function sendItem($url, $page, $name, $data)
+ {
+ global $tikilib, $feedItem, $caching;
+
+ $pageInfo = $tikilib->get_page_info($page);
+ $client = new Zend_Http_Client($url);
+
+ $client->setParameterGet('type', "textlink");
+ $client->setParameterGet('contribution', json_encode(array(
+ 'version' => '1.0',
+ 'encoding' => 'UTF-8',
+ 'feed' => array(
+ 'type' => 'textlink',
+ 'date' => $pageInfo['lastModif'],
+ 'entry'=> array(array(
+ 'page'=> $page,
+ 'name'=> $name,
+ 'description'=> $data,
+ 'date' => $pageInfo['lastModif'],
+ 'href' => $tikilib->tikiUrl() . '?page=' . $page
+ ))
+ ),
+ )));
+
+ $response = $client->request();
+
+ return $response->getBody();
+ }
+}
Modified: trunk/lib/core/Feed/Remote/TextBacklink.php
===================================================================
--- trunk/lib/core/Feed/Remote/TextBacklink.php 2011-12-01 17:37:15 UTC (rev 39066)
+++ trunk/lib/core/Feed/Remote/TextBacklink.php 2011-12-01 22:08:58 UTC (rev 39067)
<at> <at> -7,7 +7,7 <at> <at>
class Feed_Remote_TextBacklink extends Feed_Remote_Abstract
{
- var $type = "textbacklink";
+ var $type = "feed_remote_textbacklink";
static function url($feedUrl = "http://localhost/")
{
Modified: trunk/lib/core/Feed/TextBacklink/Contribution.php
===================================================================
--- trunk/lib/core/Feed/TextBacklink/Contribution.php 2011-12-01 17:37:15 UTC (rev 39066)
+++ trunk/lib/core/Feed/TextBacklink/Contribution.php 2011-12-01 22:08:58 UTC (rev 39067)
<at> <at> -7,41 +7,26 <at> <at>
Class Feed_TextBacklink_Contribution extends Feed_Remote_Abstract
{
- var $type = "textbacklink_contribution";
+ var $type = "feed_textbacklink_contribution";
- static function url($feedUrl)
+ static function url($feedUrl = "http://localhost/")
{
$me = new self($feedUrl);
- $me->contents = $contents;
return $me;
}
- public function sendItem($page, $name, $data)
+ static function local()
{
- global $tikilib, $feedItem, $caching;
-
- $pageInfo = $tikilib->get_page_info($page);
- $client = new Zend_Http_Client($this->feedUrl);
-
- $client->setParameterGet('type', "textbacklink_contribution");
- $client->setParameterGet('contribution', json_encode(array(
- 'version' => '1.0',
- 'encoding' => 'UTF-8',
- 'feed' => array(
- 'type' => 'textbacklink_contribution',
- 'date' => $pageInfo['lastModif'],
- 'entry'=> array(
- 'page'=> $page,
- 'name'=> $name,
- 'description'=> $data,
- 'date' => $pageInfo['lastModif'],
- 'href' => "http://localhost" . dirname($_SERVER["REQUEST_URI"]) . '/' .
TikiLib::lib("wiki")->url_for_operation_on_a_page("tiki-index.php", $pageInfo['pageName'])
- )
- ),
- )));
-
- $response = $client->request();
-
- return $response->getBody();
+ global $tikilib;
+ $me = self::url($tikilib->tikiUrl());
+ return $me;
}
+
+ static function getContributedItems()
+ {
+ global $tikilib;
+ $me = self::url($tikilib->tikiUrl());
+ $me->getContents(true);
+ return json_decode($me->getContents());
+ }
}
Modified: trunk/lib/core/Feed/TextBacklink.php
===================================================================
--- trunk/lib/core/Feed/TextBacklink.php 2011-12-01 17:37:15 UTC (rev 39066)
+++ trunk/lib/core/Feed/TextBacklink.php 2011-12-01 22:08:58 UTC (rev 39067)
<at> <at> -7,14 +7,20 <at> <at>
Class Feed_TextBacklink extends Feed_Abstract
{
- var $type = "textbacklink";
+ var $type = "feed_textbacklink";
+ static function url($feedUrl = "http://localhost/")
+ {
+ $me = new self($feedUrl);
+ return $me;
+ }
+
public function updateCache()
{
- global $feedItem, $caching;
+ global $tikilib, $feedItem, $caching;
$this->clearCache();
- $site = $this->siteName();
+ $site = $tikilib->tikiUrl();
$caching = true; //this variable is used to block recursive parse_data below
Modified: trunk/tiki-feed.php
===================================================================
--- trunk/tiki-feed.php 2011-12-01 17:37:15 UTC (rev 39066)
+++ trunk/tiki-feed.php 2011-12-01 22:08:58 UTC (rev 39067)
<at> <at> -38,10 +38,10 <at> <at>
$feed = new Feed_TextBacklink();
print_r(json_encode($feed->feed()));
-} else if ($_REQUEST['type'] == "textbacklink_contribution" &&
!empty($_REQUEST['contribution'])) {
+} else if ($_REQUEST['type'] == "textlink" && !empty($_REQUEST['contribution'])) {
$contribution = json_decode($_REQUEST['contribution']);
- Feed_TextBacklink_Contribution::url($contribution->feed->entry->href)
+ Feed_TextBacklink_Contribution::local()
->setContents($_REQUEST['contribution'])
->replace();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open
Source development site.
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure
contains a definitive record of customers, application performance,
security threats, fraudulent activity, and more. Splunk takes this
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d