Stud.IP  4.0
 All Data Structures Namespaces Files Functions Variables Groups
OpenGraphURL Class Reference
Inheritance diagram for OpenGraphURL:
SimpleORMap

Public Member Functions

 __construct ($id=null)
 
 setValue ($field, $value)
 
 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 findOneByURL ($url)
 
- Static Public Member Functions inherited from SimpleORMap
static tableScheme ($db_table)
 
static expireTableScheme ()
 
static exists ($id)
 
static countBySql ($sql= '1', $params=[])
 
static create ($data)
 
static buildExisting ($data)
 
static import ($data)
 
static findBySQL ($sql, $params=[])
 
static findOneBySQL ($where, $params=[])
 
static findThru ($foreign_key_value, $options)
 
static findEachBySQL ($callable, $sql, $params=[])
 
static findMany ($pks=[], $order= '', $order_params=[])
 
static findEachMany ($callable, $pks=[], $order= '', $order_params=[])
 
static findAndMapBySQL ($callable, $where, $params=[])
 
static findAndMapMany ($callable, $pks=[], $order= '', $order_params=[])
 
static deleteBySQL ($where, $params=[])
 
static toObject ($id_or_object)
 
static __callStatic ($name, $arguments)
 

Data Fields

const EXPIRES_DURATION = 86400
 
- Data Fields inherited from SimpleORMap
const ID_SEPARATOR = '_'
 

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)
 
 cbAutoIncrementColumn ($type)
 
 cbAutoKeyCreation ()
 
 cbNotificationMapper ($cb_type)
 
 cbAfterInitialize ($cb_type)
 
 setSerializedValue ($field, $value)
 
 setI18nValue ($field, $value)
 

Static Protected Member Functions

static configure ($config=[])
 
- Static Protected Member Functions inherited from SimpleORMap
static db_table ()
 
static db_fields ()
 
static pk ()
 
static default_values ()
 
static serialized_fields ()
 
static alias_fields ()
 
static i18n_fields ()
 
static additional_fields ()
 
static has_many ()
 
static has_one ()
 
static belongs_to ()
 
static has_and_belongs_to_many ()
 
static registered_callbacks ()
 
static known_slots ()
 
static notification_map ()
 
static getter_setter_map ()
 
static configure ($config=[])
 
static config ($key)
 
static registerCallback ($types, $cb)
 
static unregisterCallback ($types, $cb)
 

Additional Inherited Members

- Static Public Attributes inherited from SimpleORMap
static $schemes = null
 
- Protected Attributes inherited from SimpleORMap
 $content = []
 
 $content_db = []
 
 $is_new = true
 
 $is_deleted = false
 
 $relations = []
 
 $additional_data = []
 
- Static Protected Attributes inherited from SimpleORMap
static $config = []
 
static $reserved_slots = ['value','newid','iterator','tablemetadata', 'relationvalue','wherequery','relationoptions','data','new','id']
 
static $performs_batch_operation = false
 

Constructor & Destructor Documentation

__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

static configure (   $config = [])
staticprotected

Configures this model.

Parameters
Array$configConfiguration array
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.

static findOneByURL (   $url)
static

Specialized findOneByURL function that uses the hash to find the appropriate record instead.

Parameters
string$urlURL to find record for
Returns
mixed instance of OpenGraphURL if available, null otherwise
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
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), ...)
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), ...)
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), ...)
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.
setValue (   $field,
  $value 
)

Sets value of a column. Overwritten so that the hash is also set when the url is set.

Parameters
string$field
string$value
Returns
string
See Also
SimpleORMap::setValue
store ( )

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

Returns
int Number of updated records

Field Documentation

const EXPIRES_DURATION = 86400

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