|
| addPageMetaInfo ($iId, $mixedImage=false) |
|
| metaParse ($iId, $s) |
|
| metaAddAuto ($iId, $aContentInfo, $CNF, $sFormDisplay) |
|
| metaAdd ($iId, $s) |
|
| keywordsIsEnabled () |
|
| keywordsAdd ($iId, $s) |
|
| keywordsAddOne ($iId, $s, $bDeletePreviousKeywords=true) |
|
| keywordsAddAuto ($iId, $aContentInfo, $CNF, $sFormDisplay) |
|
| metaFields ($aContentInfo, $CNF, $sFormDisplay, $bHtmlOnly=false) |
|
| keywordsParse ($iId, $s) |
|
| keywordsParseOne ($iId, $s) |
|
| keywordsGet ($iId) |
|
| keywordsSetSearchCondition ($oSearchResult, $sKeyword, $iCmtsSystemId=0) |
|
| keywordsGetAsSQLPart ($sContentTable, $sContentField, $sKeyword) |
|
| locationsIsEnabled () |
|
| locationsAdd ($iId, $sLatitude, $sLongitude, $sCountryCode, $sState, $sCity, $sZip='', $sStreet='', $sStreetNumber='') |
|
| locationsAddFromForm ($iId, $sPrefix='', $oForm=null) |
|
| locationsString ($iId, $bHTML=true, $aParams=array()) |
|
| locationsStringFromArray ($aLocation, $bHTML=true, $aParams=array()) |
|
| locationsSetSearchCondition ($oSearchResult, $sCountry=false, $sState=false, $sCity=false, $sZip=false) |
|
| locationsGetAsSQLPart ($sContentTable, $sContentField, $sCountry=false, $sState=false, $sCity=false, $sZip=false, $aBounds=array()) |
|
| locationGet ($iId, $sPrefix='') |
|
| mentionsIsEnabled () |
|
| mentionsAdd ($iId, $s) |
|
| mentionsAddAuto ($iId, $aContentInfo, $CNF, $sFormDisplay) |
|
| mentionsParse ($iId, $s) |
|
| mentionsGet ($iId) |
|
| mentionsSetSearchCondition ($oSearchResult, $iProfileId, $iCmtsSystemId=0) |
|
| onDeleteContent ($iId) |
|
Meta-tags for different content. It can handle #keywords, @mentions, locations and meta image for the content.
Keywords are parsed after content add and edit and added to the database, later when content is displayed #keywords are highlighted as links to the search page with all content with this keyword, also keywords are displayed as meta info in page header.
Location info upon content adding/editing is displayed as custom field, it detects current user location and attach location as hidden form fields. When content is displayed location can be shown as clickable links to search page where results are other items from same location, also location is displayed as meta info in page header as latutude and longitude.
Content image can be added as meta info using this class as well.
Add new meta-tags object.
To add new meta-tags object insert new record into sys_objects_metatags
table:
- object: name of the meta-tags object, in the format: vendor prefix, underscore, module prefix, underscore, internal identifier or nothing
- table_keywords: table name to store keywords, leave empty to disable keywords
- table_locations: table name to store locations, leave empty to disable locations
- table_mentions: table name to store mentions, leave empty to disable mentions
- override_class_name: class name to override
- override_class_file: class file path to override
To simplify operations with metatags in modules which are derived from some 'base' modules, specify it in module config class in 'CNF' array:
- FIELDS_WITH_KEYWORDS: array or comma separated list of field names with keywords support, or 'auto' to automatically use all 'textarea' fields
- OBJECT_METATAGS: metatags object name
Location
Upon content 'add' and 'edit' form submit, call BxDolMetatags::locationsAddFromForm
$oMetatags->locationsAddFromForm($iContentId);
Upon 'edit' form display call BxDolMetatags::locationGet to fill-in location form input, for example:
$aSpecificValues = $oMetatags->locationGet($iContentId);
$oForm->initChecker($aContentInfo, $aSpecificValues);
To display location call BxDolMetatags::locationsString:
echo $oMetatags->locationsString($iContentId)
Upon page display call BxDolMetatags::addPageMetaInfo to add location (and all other, including content image) meta information to the page header:
$o->addPageMetaInfo($iContentId, array('id' => $iFileId, 'object' => 'storage_object_name'));
Form object must have location field, usual name for this field is 'location' (this name is used as $sPrefix in some functions), type is 'custom', also form object must be derived from BxBaseModGeneralFormEntry class, which has custom field declaration.
#keyword
Upon content 'add' and 'edit' form submit, call BxDolMetatags::keywordsAdd
$oMetatags->keywordsAdd($iContentId, $aContentInfo['text_field_with_hash_tags']);
Before displaying the text with hashtags call BxDolMetatags::keywordsParse to highlight keywords:
$sText = $oMetatags->keywordsParse($iContentId, $sText);
Upon page display call BxDolMetatags::addPageMetaInfo to add keywords (and all other, including content image) meta information to the page header.
To be able to search by tags metatgs object must be specified in *SearchResult class as 'object_metatags' in 'aCurrent' array.
@mention
Upon content 'add' and 'edit' form submit, call BxDolMetatags::mentionsAdd
$oMetatags->mentionsAdd($iContentId, $aContentInfo['text_field_with_mentions']);
Before displaying the text with mentions call BxDolMetatags::mentionsParse:
$sText = $oMetatags->mentionsParse($iContentId, $sText);
Upon page display call BxDolMetatags::addPageMetaInfo to add all available meta info to the page meta into where possible, however it doesn't adding anyting for mentions for now.
To be able to search by mentions object must be specified in *SearchResult class as 'object_metatags' in 'aCurrent' array.
Add @mention, #keyword using one call
Upon content 'add' and 'edit' form submit, call BxDolMetatags::metaAdd
$oMetatags->metaAdd($iContentId, $aContentInfo['text_field']);
or call BxDolMetatags::metaAddAuto, it autodetects fields with metainfo:
$oMetatags->metaAddAuto($iContentId, $aContentInfo, $CNF, $CNF['OBJECT_FORM_ENTRY_DISPLAY_ADD']);
Before displaying the text with different metainfo call BxDolMetatags::metaParse:
$sText = $oMetatags->metaParse($iContentId, $sText);
Upon page display call BxDolMetatags::addPageMetaInfo to add all available meta info to the page meta into where possible.
Content deletion
When content is deleted associated meta data can be deleted by calling BxDolMetatags::onDeleteContent:
$oMetatags->onDeleteContent($iContentId);