PHP Class ForkAPI

This source file can be used to communicate with ForkAPI (http://api.fork-cms.be) The class is documented in the file itself. If you find any bugs help me out and report them. Reporting can be done by sending an email to php-fork-api-bugs[at]verkoyen[dot]eu. If you report a bug, make sure you give me enough information (include your code). License Copyright (c) 2010, Tijs Verkoyen. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. This software is provided by the author "as is" and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall the author be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage.
Author: Tijs Verkoyen ([email protected])
显示文件 Open project: forkcms/forkcms Class Usage Examples

Public Methods

Method Description
__construct ( string[optional] $publicKey = null, string[optional] $privateKey = null ) Default constructor
applePush ( mixed $deviceTokens, mixed $alert, int[optional] $badge = null, string[optional] $sound = null, array $extraDictionaries = null ) : array Push a notification to apple
appleRegisterDevice ( string $deviceToken ) : boolean Register a new/old Apple device within the Fork API
coreRequestKeys ( string $siteUrl, string $email ) : array Request public private key-pair
getTimeOut ( ) : integer Get the timeout that will be used
getUserAgent ( ) : string Get the useragent that will be used. Our version will be prepended to yours.
messagesGet ( ) : array Get messages from the server
microsoftPush ( mixed $channelUri, string $title, string[optional] $count = null, string[optional] $image = null, string[optional] $backTitle = null, string[optional] $backText = null, string[optional] $backImage = null, string[optional] $tile = null, string[optional] $uri = null ) : array Push a notification to microsoft
microsoftRegisterDevice ( string $channelUri ) : boolean Register a new/old Microsoft device within the Fork API
pingGetServices ( ) : array Get the ping services
setPrivateKey ( string $key ) : void Set the private key
setPublicKey ( string $key ) : void Set the public key
setTimeOut ( integer $seconds ) : void Set the timeout After this time the request will stop. You should handle any errors triggered by this.
setUserAgent ( string $userAgent ) : void Set the user-agent for you application It will be appended to ours, the result will look like: "PHP ForkAPI/ "
statisticsGetSearchEngines ( ) : array Get the search engines

Private Methods

Method Description
doCall ( string $method, array[optional] $parameters = [], bool[optional] $authenticate = true, bool[optional] $usePOST = false ) : string Make the call
getPrivateKey ( ) : string Get the private key
getPublicKey ( ) : string Get the public key

Method Details

__construct() public method

Default constructor
Deprecation:
public __construct ( string[optional] $publicKey = null, string[optional] $privateKey = null )
$publicKey string[optional]
$privateKey string[optional]

applePush() public method

Push a notification to apple
Deprecation: : no more support for the Fork-app.
public applePush ( mixed $deviceTokens, mixed $alert, int[optional] $badge = null, string[optional] $sound = null, array $extraDictionaries = null ) : array
$deviceTokens mixed The device token(s) for the receiver.
$alert mixed The message/dictonary to send.
$badge int[optional]
$sound string[optional]
$extraDictionaries array
return array The device tokens that aren't valid.

appleRegisterDevice() public method

Register a new/old Apple device within the Fork API
Deprecation: : no more support for the Fork-app.
public appleRegisterDevice ( string $deviceToken ) : boolean
$deviceToken string The device token to register.
return boolean

coreRequestKeys() public method

Request public private key-pair
public coreRequestKeys ( string $siteUrl, string $email ) : array
$siteUrl string The URL of the site.
$email string The e-mail adress of the site.
return array

getTimeOut() public method

Get the timeout that will be used
public getTimeOut ( ) : integer
return integer

getUserAgent() public method

It will look like: "PHP ForkAPI/ "
public getUserAgent ( ) : string
return string

messagesGet() public method

Get messages from the server
public messagesGet ( ) : array
return array

microsoftPush() public method

Push a notification to microsoft
Deprecation: : no more support for the Microsoft-app.
public microsoftPush ( mixed $channelUri, string $title, string[optional] $count = null, string[optional] $image = null, string[optional] $backTitle = null, string[optional] $backText = null, string[optional] $backImage = null, string[optional] $tile = null, string[optional] $uri = null ) : array
$channelUri mixed The channel URI(s) for the receiver.
$title string The title for the tile to send.
$count string[optional]
$image string[optional]
$backTitle string[optional]
$backText string[optional]
$backImage string[optional]
$tile string[optional]
$uri string[optional]
return array The device tokens that aren't valid.

microsoftRegisterDevice() public method

Register a new/old Microsoft device within the Fork API
Deprecation: : no more support for the Microsoft-app.
public microsoftRegisterDevice ( string $channelUri ) : boolean
$channelUri string The channel uri to register.
return boolean

pingGetServices() public method

Get the ping services
Deprecation:
public pingGetServices ( ) : array
return array

setPrivateKey() public method

Set the private key
Deprecation:
public setPrivateKey ( string $key ) : void
$key string The private key.
return void

setPublicKey() public method

Set the public key
Deprecation:
public setPublicKey ( string $key ) : void
$key string The public key.
return void

setTimeOut() public method

Set the timeout After this time the request will stop. You should handle any errors triggered by this.
public setTimeOut ( integer $seconds ) : void
$seconds integer The timeout in seconds.
return void

setUserAgent() public method

Set the user-agent for you application It will be appended to ours, the result will look like: "PHP ForkAPI/ "
public setUserAgent ( string $userAgent ) : void
$userAgent string Your user-agent, it should look like /.
return void

statisticsGetSearchEngines() public method

Get the search engines
public statisticsGetSearchEngines ( ) : array
return array