autostatus

Sign in or create your account | Project List | Help | pwet.fr | Planet eZ Publish.fr | Bioutifoul Photos

autostatus Svn Source Tree

Root/tags/autostatus_0.1/extension/autostatus/classes/autostatussocialnetwork.php

  • Property svn:keywords set to: Id HeadURL
Source at commit HEAD created 10 months 9 days ago.
By dpobel, Added files about move to Github
1<?php
2/**
3 * $Id: autostatussocialnetwork.php 11 2009-10-30 21:54:15Z dpobel $
4 * $HeadURL: http://svn.projects.ez.no/autostatus/tags/autostatus_0.1/extension/autostatus/classes/autostatussocialnetwork.php $
5 *
6 * SOFTWARE NAME: autostatus
7 * SOFTWARE RELEASE: 0.1
8 * COPYRIGHT NOTICE: Copyright (C) 2009 Damien POBEL
9 * SOFTWARE LICENSE: GNU General Public License v2.0
10 * NOTICE: >
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of version 2.0 of the GNU General
13 * Public License as published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of version 2.0 of the GNU General
21 * Public License along with this program; if not, write to the Free
22 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
23 * MA 02110-1301, USA.
24 */
25
26abstract class autostatusSocialNetwork
27{
28    /**
29     * Indicates if include path has already been
30     * updated for Zend classes loading
31     *
32     * @static
33     * @var boolean
34     * @access public
35     */
36    static $includePathFixed = false;
37
38    /**
39     * identifier of the social network
40     *
41     * @var string
42     * @access protected
43     */
44    protected $identifier = '';
45
46    /**
47     * name of the social network
48     *
49     * @var string
50     * @access protected
51     */
52    protected $name = '';
53
54
55    /**
56     * Set the status message to $message in social network
57     * using $login and $password
58     *
59     * @param string $message
60     * @param string $login
61     * @param string $password
62     * @abstract
63     * @access public
64     * @return void
65     */
66    abstract public function update($message, $login, $password);
67
68
69    /**
70     * Check if the attribute $name exist
71     *
72     * @param mixed $name
73     * @access public
74     * @return void
75     */
76    public function hasAttribute( $name )
77    {
78        return in_array( $name, $this->attributes() );
79    }
80
81    /**
82     * Return an array of the available attribute identifiers
83     *
84     * @access public
85     * @return array
86     */
87    public function attributes()
88    {
89        return array( 'identifier', 'name' );
90    }
91
92    /**
93     * Return the attribute $name
94     *
95     * @param string $name
96     * @access public
97     * @return string|null
98     */
99    public function attribute( $name )
100    {
101        if ( $name === 'identifier' )
102        {
103            return $this->identifier;
104        }
105        else if ( $name === 'name' )
106        {
107            return $this->name;
108        }
109        else
110        {
111            eZDebug::writeError( 'Cannot find attribute ' . $name, __METHOD__ );
112            return null;
113        }
114    }
115
116    /**
117     * Fetch the social network object associated with the identifier.
118     *
119     * @param string $identifier
120     * @static
121     * @access public
122     * @return object|null
123     */
124    static public function fetchByIdentifier( $identifier )
125    {
126        $className = 'autostatus' . ucfirst( $identifier );
127        if ( !class_exists( $className ) )
128        {
129            eZDebug::writeError( 'Cannot find class ' . $className, __METHOD__ );
130            return null;
131        }
132        return new $className;
133    }
134
135    /**
136     * Change the include path so that Zend classes
137     * can be loaded.
138     *
139     * @static
140     * @access public
141     * @return void
142     */
143    static public function fixIncludePath()
144    {
145        if ( !self::$includePathFixed )
146        {
147            $includePath = get_include_path();
148            $includePath .= PATH_SEPARATOR . eZExtension::baseDirectory() . '/autostatus/classes';
149            set_include_path( $includePath );
150            self::$includePathFixed = true;
151        }
152    }
153
154}
155
156
157?>
158

Archive Download this file

Revision: HEAD