Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions extensions/webservices/joomla/site.content.1.0.0.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?php
/**
* @package Redcore
* @subpackage Api
*
* @copyright Copyright (C) 2008 - 2021 redWEB.dk. All rights reserved.
* @license GNU General Public License version 2 or later, see LICENSE.
*/

defined('JPATH_BASE') or die;

/**
* Api Helper class for overriding default methods
*
* @package Redcore
* @subpackage Api Helper
* @since 1.8
*/
class RApiHalHelperSiteContent
{
/**
* Service for creating content.
*
* @param string $data content
*
* @return boolean True on success. False otherwise.
*/
public function save($data)
{
if (version_compare(JVERSION, '3.0', 'lt')) {
JTable::addIncludePath(JPATH_PLATFORM . 'joomla/database/table');
}

$data = (object) $data;
$article = JTable::getInstance('content');
$article->title = $data->title;
// $article->alias = JFilterOutput::stringURLSafe(time());
$article->alias = JFilterOutput::stringURLSafe($data->title);
$article->introtext = '<p>'.$data->description.'</p>';
$article->created = JFactory::getDate()->toSQL();;
$article->created_by_alias = $data->user;
$article->state = 1;
$article->access = 1;
$article->metadata = '{"page_title":"'.$data->title.'","author":"'.$data->user.'","robots":""}';
$article->language = '*';
// $article->catid = 1;

if (!$article->check()) {
throw new Exception($article->getError());
return FALSE;
}

if (!$article->store(TRUE)) {
throw new Exception($article->getError());
return FALSE;
}
}
}
56 changes: 56 additions & 0 deletions extensions/webservices/joomla/site.content.1.0.0.wsdl
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://local.test.aesirx.io:88/media/redcore/webservices/site.content.1.0.0.wsdl" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://local.test.aesirx.io:88/media/redcore/webservices/site.content.1.0.0.wsdl">
<wsdl:types>
<s:schema targetNamespace="http://local.test.aesirx.io:88/media/redcore/webservices/site.content.1.0.0.wsdl" elementFormDefault="unqualified">
<s:complexType name="ArrayOfStringType">
<s:sequence>
<s:element minOccurs="0" maxOccurs="unbounded" name="string" nillable="true" type="s:string"/>
</s:sequence>
</s:complexType>
<s:element name="create">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="data" type="s:string"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="createResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="result" type="s:boolean"/>
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
</wsdl:types>
<wsdl:service name="site.content.1.0.0">
<wsdl:documentation/>
<wsdl:port name="site.content.1.0.0_Soap" binding="tns:site.content.1.0.0">
<soap:address location="http://local.test.aesirx.io:88/administrator/index.php?webserviceClient=site&amp;webserviceVersion=1.0.0&amp;option=content&amp;api=soap"/>
</wsdl:port>
</wsdl:service>
<wsdl:message name="createRequest">
<wsdl:part name="parameters" element="tns:create"/>
</wsdl:message>
<wsdl:message name="createResponse">
<wsdl:part name="parameters" element="tns:createResponse"/>
</wsdl:message>
<wsdl:portType name="site.content.1.0.0">
<wsdl:operation name="create">
<wsdl:input message="tns:createRequest"/>
<wsdl:output message="tns:createResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="site.content.1.0.0" type="tns:site.content.1.0.0">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="create">
<soap:operation soapAction="create" type="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
</wsdl:definitions>
28 changes: 28 additions & 0 deletions extensions/webservices/joomla/site.content.1.0.0.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0"?>
<apiservice client="site">
<name>content</name>
<author/>
<copyright/>
<description/>
<config>
<name>content</name>
<version>1.0.0</version>
<authorizationAssetName>com_{webserviceName}</authorizationAssetName>
</config>
<operations>
<documentation authorizationNeeded="false" source="auto" url=""/>
<create authorizationNeeded="false" strictFields="false" authorization="" dataMode="helper" optionName="" modelClassName="" modelClassPath="" isAdminClass="false" functionName="save" functionArgs="" validateData="none" validateDataFunction="validate" tableName="">
<fields>
<field name="data" transform="string" defaultValue="" isRequiredField="false" isPrimaryField="false"/>
</fields>
<resources>
<resource displayGroup="_links" displayName="documentation" fieldFormat="{webserviceUrlPath}&amp;format=doc#{rel}" linkTitle="Documentation" linkName="{webserviceName}" hrefLang="" linkTemplated="true" linkRel="curies"/>
<resource displayGroup="_links" displayName="base" fieldFormat="/" linkTitle="Default page"/>
<resource displayGroup="_links" displayName="{webserviceName}:list" fieldFormat="{webserviceUrlPath}"/>
<resource displayGroup="_links" displayName="{webserviceName}:self" fieldFormat="{webserviceUrlPath}&amp;id={id}"/>
<resource displayName="result" fieldFormat="{result}" transform="boolean"/>
</resources>
</create>
</operations>
<complexArrays/>
</apiservice>