Exemple #1
0
        break;
    case "entries.atom":
        header("Content-Type: text/xml; charset=UTF-8");
        echo "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n";
        echo "<feed xmlns=\"http://www.w3.org/2005/Atom\">\r\n";
        echo "    <title>" . $journal->Title . "</title>\r\n";
        echo "    <subtitle><![CDATA[" . JH\Utilities::HtmlDecode($journal->Description) . "]]></subtitle>\r\n";
        echo "    <link href=\"" . System::ExpandRelativePath("~/community/members/" . $thisuser->ShortName . "/journals/" . $journal->Name . "/entries.atom") . "\" rel=\"self\" />\r\n";
        echo "    <link href=\"" . System::ExpandRelativePath("~/") . "\" />\r\n";
        echo "    <id>urn:uuid:60a76c80-d399-11d9-b91C-0003939e0af6</id>\r\n";
        echo "    <updated>" . date(DateTime::ATOM, strtotime($entry->TimestampCreated)) . "</updated>\r\n";
        foreach ($entries as $entry) {
            echo "    <entry>\r\n";
            echo "        <title>" . $entry->Title . "</title>\r\n";
            echo "        <link href=\"" . System::ExpandRelativePath("~/community/members/" . $thisuser->ShortName . "/journals/" . $journal->Name . "/entries/" . $entry->Name) . "\" />\r\n";
            // echo("        <link rel=\"alternate\" type=\"text/html\" href=\"http://example.org/2003/12/13/atom03.html\" />\r\n");
            // echo("        <link rel=\"edit\" href=\"http://example.org/2003/12/13/atom03/edit\" />
            echo "        <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id>\r\n";
            echo "        <updated>" . date(DateTime::ATOM, strtotime($entry->TimestampModified)) . "</updated>\r\n";
            echo "        <summary><![CDATA[" . JH\Utilities::HtmlDecode($entry->Content) . "]]></summary>\r\n";
            echo "        <author>\r\n";
            echo "            <name>" . $journal->Creator->LongName . "</name>\r\n";
            // echo("            <email>johndoe@example.com</email>\r\n");
            echo "        </author>\r\n";
            echo "    </entry>";
        }
        echo "</feed>";
        break;
}
?>
	
 public function ToJSON()
 {
     $json = "{";
     $json .= "\"ID\": " . $this->ID . ",";
     $json .= "\"Sender\": " . $this->Sender->ToJSON() . ",";
     $json .= "\"Receiver\": " . $this->Receiver->ToJSON() . ",";
     $json .= "\"Content\": \"" . JH\Utilities::JavaScriptEncode($this->Content) . "\",";
     $json .= "\"Timestamp\": \"" . $this->Timestamp . "\",";
     $visibility = ShoutoutMessageVisibility::ToIndex($this->Visibility);
     /*
     switch ($this->Visibility)
     {
     	case ShoutoutMessageVisibility::Hidden:
     	{
     		$visibility = "ShoutoutMessageVisibility.Hidden";
     		break;
     	}
     	case ShoutoutMessageVisibility::Friends:
     	{
     		$visibility = "ShoutoutMessageVisibility.Friends";
     		break;
     	}
     	case ShoutoutMessageVisibility::Network:
     	{
     		$visibility = "ShoutoutMessageVisibility.Network";
     		break;
     	}
     	case ShoutoutMessageVisibility::Everyone:
     	{
     		$visibility = "ShoutoutMessageVisibility.Everyone";
     		break;
     	}
     	case ShoutoutMessageVisibility::Blacklist:
     	{
     		$visibility = "ShoutoutMessageVisibility.Blacklist";
     		break;
     	}
     	case ShoutoutMessageVisibility::Whitelist:
     	{
     		$visibility = "ShoutoutMessageVisibility.Whitelist";
     		break;
     	}
     }
     */
     $json .= "\"Visibility\": " . $visibility . "";
     $json .= "}";
     return $json;
 }