CommentsController
class CommentsController extends Controller implements GroupControllerInterface mixin Main
Class CommentsController
Traits
Trait CoreLinkMethods
Static Cache Trait Adds a static (per request) cache to the object which can hold data for the time of the request (in the frontend) or a certain duration during long running processes. It works together with the global caching system and enforces a static cache clearing in case of global cache clearings as well.
Trait ObjectManager XELOS Framework
Constants
EVENT_MODEL_CREATED |
Global modules events. |
EVENT_MODEL_UPDATED |
|
EVENT_MODEL_DELETED |
|
Properties
protected array | $object_cache | Each object created by a success call of |
from ObjectManager |
protected array[] | $registry | The instantiation of a requested object can be processed only if the class of the object is registered with the class name as key and its information as array in this property. The element should have at least the class name or the relative path to "class" folder. |
from ObjectManager |
protected string | $lib_class_dir | This property contains the path to the folder served as root for all requested classes. This folder can contains other folder or classes. All requested and registered classes will be searched in this folder by concating this path with the relative path defined in the registration of the requested class. If the class is not included it will be done on the fly. |
from ObjectManager |
protected string | $lib_class_prefix | An optional possibility to pretend a prefix for all registered classes. |
from ObjectManager |
protected string | $ns_class_prefix | An optional possibility to pretend a namespace prefix for classes have no namespace yet. |
from ObjectManager |
protected bool | $factory_mode | This property effects the object cache. By default it is set to false to enable the object cache for all requested objects. If this property is set true, the object cache will be disabled. |
from ObjectManager |
protected array | $injection_objects | This is an assoc array and contains objects that will be injected into each requested object. Each containing object will be injected by the name of the key. E.g. ['mod' => $object] this would inject the property named mod with the value of $object. |
from ObjectManager |
protected bool | $auto_init | This property controls if the init method of requested objects is called by this trait or not. |
from ObjectManager |
bool | $full_module_namespace_support | from Controller | |
Config | $config | from Core | |
bool | $instance_copy_id | from Core | |
mixed | $template | from Core | |
string | $context | from Core | |
Core | $parent_context | from Core | |
int | $group_context | from Core | |
string | $group_name | from Core | |
string | $storage_path | from Core | |
protected int | $security_level | from Core | |
protected string | $security_level_mode | from Core | |
protected Link | $xf_link | from Core | |
array | $GPvars | from Core | |
MagicMethodHelper | $action | from Controller | |
Model read-only | $model | ||
MagicMethodHelper | $page | from Controller | |
UI read-only | $ui | ||
MagicMethodHelper | $collection | from Controller | |
MagicMethodHelper | $cf | from Controller | |
Controller | $mod | from Controller | |
array | $meta_info | from Controller | |
bool | $reverseOrder | Show comments in reverse order? |
Methods
Gettext Wrapper using current module context for module specific translations
No description
No description
Add CSS file from the wwwres/css folder to the page
Add JS file from the wwwres/js folder to the page
Returns the passed JSON and returns the module template directly to the view class for rendering
Attach a Link to each model in the collection
Calls dbquery() after given SQL has been converted by $XF->lib->i18n->convert_i18n_sql()
No description
No description
Deletes the models of this comments instance that is to be deleted.
Generates and returns the completed sentences for the dyn tree params field.
Not much is needed to run this instance after installation, so just the init method will be called.
No description
Used to fetch the methods from the page passed.
Get dependency without unknown group context
Placeholder method, that simply returns an empty array, in case the user chose a module, which isn't able to provide dynamic tree parameters.
No description
Get the group_security_id for this instance (optional: based on a local group_context)
Set to true if the comments module is used inside of XOI
Defines an array containing pages, which will then be returned to the group navigation form in order to display them as entries in the select field 'ref_page'.
This method will return an object without killing the whole process by triggering a fatal error You can use this method if its possible that the object is not available, e.g. due to user configurations
No description
Returns all comments for the current post
No description
No description
returns the global document index fron document_index
returns the global document id fron document_index
Constructs and returns a download link for file
No description
No description
No description
Call specific object - allows to use constructor-params (overload function) This function is primarily called from the magic GET and CALL Methods
Usage: Writing a NEW 2nd level comment on actionlog wall will trigger this function to display the form
No description
Guess the group ID by evaluating GP and CMD Vars
CommentsController initialization
No description
Get single notification by token to retrieve information before notify
Notification
Notification with Vars
DeepLink Page (will be called for unresolvable deeplinks, e.g. from hooks search or others
This is the default page which is returned when the Controller is being rendered in a template
No description
No description
No description
Print File Link (Alias Function)
Wrapper for XF->lib->link substituting modules with instance names etc.
No description
Render Module Output, this will get the template of the default page and render the template
Resolve a Link for a local dependency (a - by returning a valid template or b - by sending a http-redirect)
No description
Returns the xfs_document in the storage DMS to a ID.
Get the data... $args = array('download','myfile.txt')
Enforce Link Context based on Current Parent Instance for the local Page and CMD
Set to true if the comments module is used inside of XOI
In case of duplicate ui elements (two comment uis on the same page). You can provide additional params.
Set the ActionLOG Link for the current post
No description
No description
sets the numerical Context-ID (PrimaryKey in Instance_Registry)
Set Document Index ID of Referring Document This is required for can_read_comments() checks when there is no comment yet
Set Dep Link Context - generated URLs will be considered relative to the given parent instance
Set the form action of the comment form explicit
Add given objects to injection object list that will be inject into object by magic call. The array should consists of property name as key and object as value.
Set to which page the comment form redirects
Clears the specified cache pool from the static cache
Retrieves a value from the static cache
Returns an array of all cache keys which have been set
Returns an key/value array with all cached values from the passed pool
Checks if the passed is key has a value set
Removes the passed key
Store a value in the static cache
Stores the file in the system DMS
No description
Fetches all comments from this instance and returns the amount of them in an array format, containing the value and the raw value.
Userrights Check
Return the group_security ids the user has access to
No description
Return the group_security ids the user has the policy in
User has policy values
trait constructor This method have to be called from constructor of each class that uses this trait.
Details
in
Core at line 164
string
_(string $token, sring[] $placeholder = [])
Gettext Wrapper using current module context for module specific translations
in
ObjectManager at line 249
mixed
__call($class, $args)
Magic method.
Returns the requested object. If the object is not cached, it will be instantiated with given arguments.
This method calls xf_trait::get_object
.
in
Controller at line 65
__construct(string $instance = null)
No description
in
ObjectManager at line 231
mixed
__get($class)
Magic method.
First it checks if the requested property is defined and returns it if null. If not defined of null, it calls
xf_trait::get_object
and returns its return value.
in
ObjectManager at line 199
bool
__isset($property)
Magic method.
This method checks whether the property is defined or injected by __set
. If not
injected or defined, it will check the registry for an entry of requested property.
in
ObjectManager at line 219
__set($name, $value)
Magic method.
Sets the given value by $name
in
Core at line 2405
__toString()
No description
in
Core at line 2355
addActionLog(DocumentIndex $documentIndex, int $action_key, int $user_id = null, string $subject = null, int $target_user_id = null, array $link_params = [])
No description
in
Core at line 2323
add_actionlog(int $action_id, int|bool $user_id = false, string|bool $what = false, int|bool $target_user_id = false, array|bool $link_params = false, int|bool $post_id = false, int|bool $post_type = 0, int|bool $group_id = false)
deprecated
deprecated
No description
in
Core at line 647
final
add_class_to_registry($registry)
No description
in
Core at line 850
add_config_array(mixed $configArray, mixed $context = false)
No description
in
Controller at line 169
add_css_file(string $filename_in_css_dir, string $position = 'bottom', bool $media = false, bool $if_condition = false)
Add CSS file from the wwwres/css folder to the page
in
Controller at line 180
add_js_file(string $filename_in_js_dir, string $position = 'bottom')
Add JS file from the wwwres/js folder to the page
in
Core at line 453
bool|string|xelos_global_template
ajax_response(array|bool $json_response = false, bool|int $error_code = false, bool|xelos_global_template $template = false, bool|string $render_mode = false)
Returns the passed JSON and returns the module template directly to the view class for rendering
in
Controller at line 346
ModelCollection
attach_link(ModelCollection|Model $model_collection, string $property_name, array $link_params, bool $current_link = true)
Attach a Link to each model in the collection
in
Core at line 1835
check_download_file(mixed $path_to_file, mixed $download_params)
No description
in
Core at line 1476
clear_template()
No description
in
Core at line 713
dblquery($sql, $mode = 'fetch_assoc', $file = __FILE__, $line = __LINE__, $cache_ttl = false, $cache_group = false, $query_type = false)
Calls dbquery() after given SQL has been converted by $XF->lib->i18n->convert_i18n_sql()
in
Core at line 664
mixed
dbquery(string $sql, string $mode = 'fetch_assoc', string $file = __FILE__, int $line = __LINE__, int|bool $cache_ttl = false, int|bool $cache_group = false, string|bool $query_type = false)
No description
in
Core at line 689
array|int|false
dbquery_with_params(string $sql, array $params, string $mode = 'fetch_assoc', string $file = __FILE__, int $line = __LINE__, int|bool $cache_ttl = false, int|bool $cache_group = false, string|bool $query_type = false)
No description
at line 414
deleteGroupContext($group_id)
Deletes the models of this comments instance that is to be deleted.
in
Core at line 2626
bool
delete_file(int $id)
Deletes the file stored in the storage DMS.
If the file does not exist in the DMS, it checks the mod_storage_path if the file exists there and deletes it there.
in
Controller at line 136
MagicDocumentHelper|bool
document($document_index)
No description
in
ModulePageCollector at line 29
array
dynTreeAutocompletion(array $acceptedDyntreeParams)
Generates and returns the completed sentences for the dyn tree params field.
at line 390
mixed
ensureInitialization()
Not much is needed to run this instance after installation, so just the init method will be called.
in
Core at line 531
xelos_global_template|string
error_response(string $err_msg = 'access_denied', string $err_type = 'denied', string $render_mode = 'full')
No description
in
ModulePageCollector at line 85
array
getCommandsForPage(string $searchString, string $refPage = '')
Used to fetch the methods from the page passed.
Per default, if this method won't be overridden, this will return the methods of a page class.
in
Core at line 1378
Core|null
getDependencyInGuessGroupContext(string $dependency, string $page_id, array $cmd)
Get dependency without unknown group context
in
ModulePageCollector at line 18
array
getDynTreeParams()
Placeholder method, that simply returns an empty array, in case the user chose a module, which isn't able to provide dynamic tree parameters.
at line 244
string
getFormAction()
No description
in
Core at line 1321
int
getGroupSecurityId(int $group_context = 0)
Get the group_security_id for this instance (optional: based on a local group_context)
in
Core at line 1266
array
getHooksAsObject($hookName)
No description
at line 343
bool
getIsEmbeddedInXoi()
Set to true if the comments module is used inside of XOI
in
ModulePageCollector at line 52
array
getModulePages()
Defines an array containing pages, which will then be returned to the group navigation form in order to display them as entries in the select field 'ref_page'.
The user then is able to select one of these pages (of the selected instance).
in
ObjectManager at line 266
object|null
getObjectIfAvailable(string $class)
This method will return an object without killing the whole process by triggering a fatal error You can use this method if its possible that the object is not available, e.g. due to user configurations
in
Core at line 857
get_accessible_page($page_id, $args = array())
No description
in
Controller at line 157
mixed
get_action(string $helper)
No description
in
Core at line 2370
protected xm_system_actionlog
get_actionlog()
Return the actionlog instance
in
Core at line 2439
array
get_available_languages()
Get the configured languages for this instance
at line 284
int
get_comment_count(int|bool $group_id = false)
No description
at line 299
ModelCollection|Comment[]
get_comments(string $order = 'ASC', bool $limit = false)
Returns all comments for the current post
in
Core at line 601
mixed
get_config(string $var, mixed $context = false)
No description
in
Core at line 2414
int
get_context_id()
gets the numerical Context-ID (PrimaryKey in Instance_Registry)
at line 381
DocumentIndex|null
get_current_document_index()
No description
in
CoreLinkMethods at line 174
array|false
get_current_link(array $params = array())
No description
in
CoreLinkMethods at line 190
get_current_url()
No description
in
Core at line 2431
string
get_default_i18n()
Get the default language set for this instance
in
Core at line 346
Template
get_dep_page(bool|string $default = false, bool|string $cmd = false, bool $preserve_render_mode = false)
No description
in
Core at line 1402
array
get_deps($group_context = false)
No description
in
Core at line 2470
DocumentIndex
get_document_index(int $local_document_id, int $document_type = 0)
returns the global document index fron document_index
requires the model is registered in document_registry for being index by document_index!
in
Core at line 2452
int|false
get_document_index_id(int $local_document_id, int $document_type = 0)
returns the global document id fron document_index
requires the model is registered in document_registry for being index by document_index!
in
Core at line 2388
bool|mixed
get_dyn_config($var, bool $order_set_name = false, bool $context = false)
deprecated
deprecated
No description
in
Core at line 1753
string|bool
get_file_link(string $path_to_file, array $params = array())
Get File Link
in
Core at line 1639
mixed
get_file_url(string $path_to_file, bool $inline_disposition = true, string|bool $name = false, bool $zipOnTheFly = false, int|bool $width = false, int|bool $height = false, string|bool $resize_mode = false, bool $public_file_link = false)
Constructs and returns a download link for file
in
Core at line 1810
array
get_file_url_args(string $path_to_file, mixed $inline_disposition = true, mixed $name = false, mixed $zipOnTheFly = false)
No description
in
Core at line 412
int
get_group()
No description
in
Core at line 962
mixed
get_hook(string $original_hook_name, string $provider_instance = 'self', bool $force_new = false, bool $skip_access_check = false)
No description
in
Core at line 1105
array
get_hooks(string $local_hook_name, array|bool $limit_to_instances = false, bool $instantiate = true, mixed $parentContext = false, string $hook_class = null)
No description
in
ObjectManager at line 167
string
get_lib_class_dir()
Returns the path to class directory.
in
ObjectManager at line 177
string
get_lib_class_prefix()
Returns the defined prefix for all classes.
in
CoreLinkMethods at line 101
array|bool
get_link()
No description
in
Controller at line 124
mixed
get_model(string $model, bool $new_instance = false)
No description
in
Core at line 622
final mixed
get_object(string $class, null|array $args = null, bool $call_init = true)
Call specific object - allows to use constructor-params (overload function) This function is primarily called from the magic GET and CALL Methods
in
ObjectManager at line 187
array
get_object_cache()
Returns an array containing all objects were requested.
in
Core at line 888
xelos_global_template
get_page(string $page_id, array $args = array())
No description
in
Controller at line 394
string
get_parsed_message(string $template_name, string $section)
No description
in
Core at line 191
mixed
get_plugin(string $name)
No description
in
Core at line 210
array
get_plugins_by_prefix(string $prefix)
No description
at line 127
bool|string|Form
get_post_form(int $subject_di_id)
Usage: Writing a NEW 2nd level comment on actionlog wall will trigger this function to display the form
in
Core at line 1708
get_preview_url($path_to_file, $name = false)
No description
in
Core at line 1695
static
get_resize_hash(int $w, int $h)
Calculate Resize Hash !Is also called static
in
Core at line 437
int
get_security_level()
No description
in
Core at line 2562
SystemDMSController
get_system_dms()
Returns the default dms to store application files.
It uses the DMS configured in Expert Configuration -> GUI -> Filebrowser DMS: system config key filebrowser_dms
in
Core at line 1699
get_thumb_url($path_to_file, $name = false)
No description
in
CoreLinkMethods at line 117
string
get_url()
No description
in
Controller at line 281
VarsTemplate|bool
get_vars(string $file, string $block = null)
Get Vars Model
in
Controller at line 310
VarsTemplate
get_vars_from_text(string $text)
Create a Vars model from text
in
Controller at line 193
xelos_global_template|Template
get_view(string $view, bool|string $section = false, bool $template_auto_setup = true, bool $force_new = false)
No description
at line 319
int
guessGroupId(string $page_id, array|null $args)
Guess the group ID by evaluating GP and CMD Vars
at line 74
init()
CommentsController initialization
in
Core at line 2647
bool
isXlabsFeaturePreview()
No description
in
Core at line 790
mixed
lpquery(string $query, array $params = array(), string $file = __FILE__, int $line = __LINE__, int $cache_ttl = 0, null $cache_group = null)
No description
in
Core at line 2546
Notification
notification_info(mixed $user_id, mixed $token)
Get single notification by token to retrieve information before notify
in
Core at line 2532
notification_mark_read(mixed $user_id, string $token)
deprecated
deprecated
Mark a Notification as Read
in
Core at line 2512
notify(mixed $user_id, string $token, string $subject, string $plaintext = null, mixed $html = false, mixed $url = null, string $icon = null, string $type = 'activity')
Notification
in
Core at line 2490
notify_vars(mixed $user_id, string $token, VarsTemplate $vars, mixed $url = null, string $icon = null, string $type = 'activity')
Notification with Vars
in
Core at line 2204
string|void|xelos_global_template
page__deeplink(array $dependency_id)
DeepLink Page (will be called for unresolvable deeplinks, e.g. from hooks search or others
in
Core at line 1843
page__feed(UniversalFeedCreator $feed)
No description
in
Core at line 1854
page__file()
No description
at line 94
Template|null
page_main()
This is the default page which is returned when the Controller is being rendered in a template
in
Core at line 764
mixed
pquery(string $query, array $params = array(), string $file = __FILE__, int $line = __LINE__, int $cache_ttl = 0, null $cache_group = null)
No description
in
Core at line 704
string|string[]|null
prepareQueryWithParams(string $sql, array $params)
No description
in
Core at line 741
string
prepare_lquery($sql)
No description
in
Core at line 731
string
prepare_query(string $sql)
No description
in
Core at line 1596
string
print_context_menu($params, array $context_links, bool $current_link = false, bool $no_js_fallback = true, $onMouseOver = false)
No description
in
Core at line 1623
string
print_context_menu_with_submenu(array $entries, array $params = array())
No description
in
CoreLinkMethods at line 207
print_current_link()
No description
in
Core at line 1742
string
print_file_link(string $path_to_file, array $params = array())
Print File Link (Alias Function)
in
CoreLinkMethods at line 156
string
print_link(array $params = array())
Wrapper for XF->lib->link substituting modules with instance names etc.
Example:
$this->mod->print_link(array('label'=>$label, 'page'=>$page, 'ajax_modal'=>array('form' => 'noajax')));
$this->mod->print_link(array('label'=>$label, 'page'=>$page, 'JS-FSLoader'=>array('message' => 'loading..','autohide'=>'5000')));
in
Core at line 1718
print_preview_link($path_to_file, $params = array())
No description
at line 267
remove_comments($group_id = false)
No description
in
Core at line 389
string
render()
Render Module Output, this will get the template of the default page and render the template
in
Core at line 2291
string|false
resolve_dep_link(string $dependency, string $page_id, array $cmd)
Resolve a Link for a local dependency (a - by returning a valid template or b - by sending a http-redirect)
at line 306
array
resolve_doc_link(int $post_id, int $post_type = null)
No description
in
Core at line 2580
false|XfsDocument
retrieve_document(int $document_index_id, bool $main_document_index_id = false)
Returns the xfs_document in the storage DMS to a ID.
in
Core at line 1879
bool
send_file(array $args, bool $binary = false, bool $is_full_path = false)
Get the data... $args = array('download','myfile.txt')
Redeclare for binary downloads: function send_file($args, $binary = false) { switch($args[1]) { case 'mybinard.txt': parent::send_file($args,'mybinarycontent'); } }
in
Core at line 310
setDepLinkContext(string $localPage, string $localCmd)
Enforce Link Context based on Current Parent Instance for the local Page and CMD
at line 334
setIsEmbeddedInXoi(bool $embedded)
Set to true if the comments module is used inside of XOI
at line 85
void
setUIContext(string|null $UIContext)
In case of duplicate ui elements (two comment uis on the same page). You can provide additional params.
at line 255
set_actionlog_params(string $label, mixed $link_array, $context)
Set the ActionLOG Link for the current post
in
Core at line 567
void
set_config(string $var, mixed $value, string|bool $context = false, string|bool $subcontext = false)
No description
in
Core at line 585
void
set_config_for_session(string $var, string $value, string $context = false, string $subcontext = false)
No description
in
Core at line 2423
set_context_id(int $context_id)
sets the numerical Context-ID (PrimaryKey in Instance_Registry)
at line 374
set_current_document_index(DocumentIndex $parent_document_index)
Set Document Index ID of Referring Document This is required for can_read_comments() checks when there is no comment yet
at line 364
set_current_post(int $group_id)
deprecated
deprecated
No description
in
Core at line 326
set_dep_link_context(Core $parent, string $view, string $page, string $cmd)
Set Dep Link Context - generated URLs will be considered relative to the given parent instance
at line 237
set_form_action(string $url)
Set the form action of the comment form explicit
in
Core at line 403
void
set_group(int $group_id, string|bool $short_name = false)
No description
in
ObjectManager at line 125
set_injection_objects(array $objects)
Add given objects to injection object list that will be inject into object by magic call. The array should consists of property name as key and object as value.
in
ObjectManager at line 141
set_lib_class_dir($lib_class_dir)
Sets the directory where classes are stored.
This folder can contains other folder or classes. All requested and registered classes will be searched in this folder by concating this path with the relative path defined in the registration of the requested class. If the class is not included it will be done on the fly.
in
ObjectManager at line 156
set_lib_class_prefix($lib_class_prefix)
Sets the class name prefix.
An optional possibility to pretend a prefix for all registered classes. This prefix is only required in the class name of the requested object. The registered class name should not contains this prefix. E.g. a class called xf_foobar should be registered as foobar.
in
Controller at line 379
bool
set_message_vars($values, bool $reset = false)
No description
at line 352
set_redirect_url(string $url)
Set to which page the comment form redirects
in
Core at line 421
void
set_security_level(int $security_level)
No description
in
Core at line 1486
void
set_xf_link($xf_link)
No description
in
Core at line 936
xelos_global_template|bool
setup_check($args = array())
Check/Get Setup Page
in
StaticCacheTrait at line 121
static void
staticCacheClearAllCachePools()
No description
in
StaticCacheTrait at line 114
static void
staticCacheClearCachePool($cache_pool = 'default')
Clears the specified cache pool from the static cache
in
StaticCacheTrait at line 61
static array|string|int|bool|null
staticCacheGet($key, string $cache_pool = 'default')
Retrieves a value from the static cache
in
StaticCacheTrait at line 98
static array
staticCacheGetKeys(string $cache_pool = 'default')
Returns an array of all cache keys which have been set
in
StaticCacheTrait at line 107
static array
staticCacheGetPool($cache_pool)
Returns an key/value array with all cached values from the passed pool
in
StaticCacheTrait at line 34
static bool
staticCacheIsEnabled()
No description
in
StaticCacheTrait at line 85
static bool
staticCacheIsSet($key, string $cache_pool = 'default')
Checks if the passed is key has a value set
in
StaticCacheTrait at line 73
static
staticCacheRemove($key, string $cache_pool = 'default')
Removes the passed key
in
StaticCacheTrait at line 46
static void
staticCacheSet(string|int $key, mixed $value, string $cache_pool = 'default')
Store a value in the static cache
in
Core at line 2599
Document|false
store_file(string $path, string $storage_folder, string|bool $file_name = false, DocumentModel|bool $owner = false, DocumentModel|null $owner_document = null)
Stores the file in the system DMS
in
Controller at line 326
bool|string|Template|xelos_global_template
templateResponse(mixed $content, string $title)
No description
at line 399
usedResources($group_id)
Fetches all comments from this instance and returns the amount of them in an array format, containing the value and the raw value.
in
Core at line 1556
bool
user_has_access(string|bool $page = false, string|bool $instance_id = false, int $group_security_id = 0)
Userrights Check
in
Core at line 1578
array
user_has_access_in_groups(string $page)
Return the group_security ids the user has access to
in
Core at line 1512
bool
user_has_policy(string $policy, mixed $policy_value = '*', int|bool $target_user = false, int|bool $group_id = false, string $default_policy = 'deny')
No description
in
Core at line 1525
array
user_has_policy_in_groups(string $policy, string $policy_value = false)
Return the group_security ids the user has the policy in
in
Core at line 1538
array
user_has_policy_values(string $policy, string $treeTable = null)
User has policy values
in
ObjectManager at line 103
xelos_object_manager_init(bool $lib_class_dir, string $lib_class_prefix = '', string $ns_prefix = '')
trait constructor This method have to be called from constructor of each class that uses this trait.
It sets the defaults and all necessary properties.