Stud.IP  4.2 Revision
OpenGraphURL Class Reference
Inheritance diagram for OpenGraphURL:
Inheritance graph
Collaboration diagram for OpenGraphURL:
Collaboration graph

Public Member Functions

 __construct ($id=null)
 
 store ()
 
 fetch ()
 
 render ()
 
 getAudioFiles ()
 
 getVideoFiles ()
 
- Public Member Functions inherited from SimpleORMap
 __construct ($id=null)
 
 __clone ()
 
 getRelationOptions ($relation)
 
 getTableMetadata ()
 
 hasAutoIncrementColumn ()
 
 setId ($id)
 
 getId ()
 
 getNewId ()
 
 toArray ($only_these_fields=null)
 
 toRawArray ($only_these_fields=null)
 
 toArrayRecursive ($only_these_fields=null)
 
 getValue ($field)
 
 getRelationValue ($relation, $field)
 
 getDefaultValue ($field)
 
 setValue ($field, $value)
 
 __get ($field)
 
 __set ($field, $value)
 
 __isset ($field)
 
 offsetExists ($offset)
 
 offsetGet ($offset)
 
 offsetSet ($offset, $value)
 
 offsetUnset ($offset)
 
 getIterator ()
 
 count ()
 
 isField ($field)
 
 isAdditionalField ($field)
 
 isAliasField ($field)
 
 isI18nField ($field)
 
 setData ($data, $reset=false)
 
 isNew ()
 
 isDeleted ()
 
 setNew ($is_new)
 
 getWhereQuery ()
 
 restore ()
 
 store ()
 
 triggerChdate ()
 
 delete ()
 
 isDirty ()
 
 isFieldDirty ($field)
 
 revertValue ($field)
 
 getPristineValue ($field)
 
 initRelation ($relation)
 
 resetRelation ($relation)
 
 cleanup ()
 

Static Public Member Functions

static fromURL ($url)
 
- Static Public Member Functions inherited from SimpleORMap
static tableScheme ($db_table)
 
static expireTableScheme ()
 
static find ($id)
 
static exists ($id)
 
static countBySql ($sql=1, $params=array())
 
static create ($data)
 
static build ($data, $is_new=true)
 
static buildExisting ($data)
 
static import ($data)
 
static findBySQL ($sql, $params=array())
 
static findOneBySQL ($where, $params=array())
 
static findThru ($foreign_key_value, $options)
 
static findEachBySQL ($callable, $sql, $params=array())
 
static findMany ($pks=array(), $order='', $order_params=array())
 
static findEachMany ($callable, $pks=array(), $order='', $order_params=array())
 
static findAndMapBySQL ($callable, $where, $params=array())
 
static findAndMapMany ($callable, $pks=array(), $order='', $order_params=array())
 
static deleteBySQL ($where, $params=array())
 
static toObject ($id_or_object)
 
static __callStatic ($name, $arguments)
 

Data Fields

const EXPIRES_DURATION = 86400
 

Protected Member Functions

 getMediaFiles ($type)
 
- Protected Member Functions inherited from SimpleORMap
 _getId ($field)
 
 _setId ($field, $value)
 
 _getAdditionalValueFromRelation ($field)
 
 _setAdditionalValueFromRelation ($field, $value)
 
 _getAdditionalValue ($field)
 
 _setAdditionalValue ($field, $value)
 
 parseRelationOptions ($type, $name, $options)
 
 storeRelations ($only_these=null)
 
 deleteRelations ()
 
 initializeContent ()
 
 applyCallbacks ($type)
 
 registerCallback ($types, $cb)
 
 unregisterCallback ($types, $cb)
 
 cbAutoIncrementColumn ($type)
 
 cbAutoKeyCreation ()
 
 cbNotificationMapper ($cb_type)
 
 cbAfterInitialize ($cb_type)
 
 setSerializedValue ($field, $value)
 
 setI18nValue ($field, $value)
 
 cbI18N ($type)
 

Static Protected Member Functions

static configure ($config=array())
 
- Static Protected Member Functions inherited from SimpleORMap
static configure ($config=array())
 
static config ($key)
 

Additional Inherited Members

- Static Public Attributes inherited from SimpleORMap
static $schemes = null
 
- Protected Attributes inherited from SimpleORMap
 $content = array()
 
 $content_db = array()
 
 $is_new = true
 
 $is_deleted = false
 
 $db_table = ''
 
 $db_fields = null
 
 $pk = null
 
 $default_values = array()
 
 $serialized_fields = array()
 
 $alias_fields = array()
 
 $i18n_fields = array()
 
 $additional_fields = array()
 
 $relations = array()
 
 $has_many = array()
 
 $has_one = array()
 
 $belongs_to = array()
 
 $has_and_belongs_to_many = array()
 
 $registered_callbacks = array()
 
 $known_slots = array()
 
 $notification_map = array()
 
 $additional_data = array()
 
 $getter_setter_map = array()
 
- Static Protected Attributes inherited from SimpleORMap
static $config = array()
 
static $reserved_slots = array('value','newid','iterator','tablemetadata', 'relationvalue','wherequery','relationoptions','data','new','id')
 

Constructor & Destructor Documentation

◆ __construct()

__construct (   $id = null)

Constructor of the object. Provides a fallback if a url is passed instead of the usually expected numeric id in order to not break backward compatibility. But this constructor will fail miserably if a url is passed that is not in the database. This was chosen by design to encourage the correct use of an id.

Parameters
mixed$idNumeric id, existing url or null

Member Function Documentation

◆ configure()

static configure (   $config = array())
staticprotected

Configures this model.

Parameters
Array$configConfiguration array

◆ fetch()

fetch ( )

Fetches information from the url by getting the contents of the webpage, parse the webpage and extract the information from the opengraph meta-tags. If the site doesn't have any opengraph-metatags it is in fact no opengraph node and thus no data will be stored in the database. Only $url['is_opengraph'] === '0' indicates that the site is no opengraph node at all.

Todo:
The combination of FileManager::fetchURLMetadata() and the following request leads to two requests for the open graph data. This should be fixed due to performance reasons.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ fromURL()

static fromURL (   $url)
static

Create an instance of this model given url. Differs from findOneByURL insofar that it will return a new object with the given url set instead of null.

Parameters
String$urlURL to find
Returns
OpenGraphURL Either existing instance or a new instance for the given url
Here is the caller graph for this function:

◆ getAudioFiles()

getAudioFiles ( )

Returns an array with all audiofiles that are provided by the opengraph-node. Each array-entry is an array itself with the url as first parameter and the content-type (important for <audio> tags) as the second.

Returns
array(array($url, $content_type), ...)
Here is the call graph for this function:

◆ getMediaFiles()

getMediaFiles (   $type)
protected

Returns an array with all mediafiles that are provided by the opengraph-node. Each array-entry is an array itself with the url as first parameter and the content-type (important for <audio> or <video> tags) as the second.

Parameters
string$type"audio" or "video"
Returns
array(array($url, $content_type), ...)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getVideoFiles()

getVideoFiles ( )

Returns an array with all videofiles that are provided by the opengraph-node. Each array-entry is an array itself with the url as first parameter and the content-type (important for <video> tags) as the second.

Returns
array(array($url, $content_type), ...)
Here is the call graph for this function:

◆ render()

render ( )

Renders a small box with the information of the opengraph url. Used in blubber and in the forum.

Returns
string html output of the box.
Here is the call graph for this function:

◆ store()

store ( )

Stores the object and fetches the opengraph information when either the object is new or outdated.

Returns
int Number of updated records
Here is the call graph for this function:

Field Documentation

◆ EXPIRES_DURATION

const EXPIRES_DURATION = 86400

The documentation for this class was generated from the following file: