Class Socialveo\Core\helpers\TagsHelper

InheritanceSocialveo\Core\helpers\TagsHelper

Class TagsHelper

Public Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$tags array Socialveo\Core\helpers\TagsHelper

Public Methods

Hide inherited methods

MethodDescriptionDefined By
getTag() Finds the tags by specified name and type, and increments the found rating or create a new otherwise. Socialveo\Core\helpers\TagsHelper
parse() Parses tags and replaces them at links with actual names Socialveo\Core\helpers\TagsHelper
restore() Restore tags for editing Socialveo\Core\helpers\TagsHelper
saveTagAssociations() Save TagAssociation after save tags and associated target Socialveo\Core\helpers\TagsHelper
saveTags() Parses and saves all tags from the html content. Socialveo\Core\helpers\TagsHelper
tagInputsToMarkers() Replace input[type=button] to marker format Socialveo\Core\helpers\TagsHelper
tagMarkersToInputs() Replace marker format to input[type=button] Socialveo\Core\helpers\TagsHelper

Constants

Hide inherited constants

ConstantValueDescriptionDefined By
MARKER '‌' Marker for mark/parse tags Socialveo\Core\helpers\TagsHelper

Property Details

$tags public static property
public static array $tags = [\Socialveo\Core\models\Tag::TYPE_NETWORK => '(\@)NOT_SPECIAL+\#(UUID)', \Socialveo\Core\models\Tag::TYPE_HASHTAG => '(\#)(NOT_SPECIAL_NOT_WHITESPACES+)\#NOT_SPECIAL_NOT_WHITESPACES+']

Method Details

getMentionData() protected static method

protected static array|null getMentionData ( $type )
$type string
getTag() public static method

Finds the tags by specified name and type, and increments the found rating or create a new otherwise.

public static Phalcon\Mvc\Model|Socialveo\Core\models\Tag getTag ( $name, $type, $user_id null, $network_id null )
$name string
$type string
$user_id integer

[optional]

$network_id integer

[optional]

getTags() protected static method

protected static array getTags ( $replaceId true )
$replaceId boolean

[optional]

parse() public static method

Parses tags and replaces them at links with actual names

public static string parse ( $content, &$tags = [], $escaped true, $callable null )
$content string

Previously saved content via {@link saveTags()}, html escaped

$tags array

Array to save all parsed tags by types with the relations

$escaped boolean

[optional] Whether content is html-escaped

$callable callable

[optional] Custom callable for create links

restore() public static method

Restore tags for editing

public static string restore ( $content )
$content string

Previously saved content via {@link saveTags()}

saveTagAssociations() public static method

Save TagAssociation after save tags and associated target

public static void saveTagAssociations ( $associations, $targets )
$associations Socialveo\Core\models\TagAssociation[]
$targets array

Associated array with target_type in keys and target_id in values

saveTags() public static method

Parses and saves all tags from the html content.

Input tags formats:

 mention: {MARKER}@UserName#UserUUID{MARKER}
 network: {MARKER}+NetworkName#NetworkUUID{MARKER}
 hashtag: {MARKER}#hashtag{MARKER}

public static string saveTags ( $content, &$associations = [] )
$content string

Post/comment content

$associations Socialveo\Core\models\TagAssociation[]

Created associations which must be saved after the save the target via {@link saveAssociations()}

return string

Modified content

tagInputsToMarkers() public static method

Replace input[type=button] to marker format

public static string tagInputsToMarkers ( $content )
$content string
tagMarkersToInputs() public static method

Replace marker format to input[type=button]

public static string tagMarkersToInputs ( $content )
$content string