CMS  Version 3.9
CommentManager Class Reference

Public Member Functions

 CommentManager ()
 

Static Public Member Functions

static setDefaults ()
 
static setDefaultEmailTemplates ()
 For comment, need default template: new_comment. More...
 
static setDefaultMergeCodes ()
 Merge codes for ArticleCommentXref: comment_article_id comment_title article_title article_url. More...
 
static onInitialize ()
 
static upgradeComponent ($version)
 
static registerAdapter ($component, $parentClass, $xrefClass)
 
static deleteUser ($user)
 Respond to fired event DeleteUser. More...
 
static getAdapters ()
 
static getAdapter ()
 

Static Public Attributes

static $adapters = array()
 

Detailed Description

Definition at line 81 of file comment_manager.inc.

Member Function Documentation

◆ CommentManager()

CommentManager::CommentManager ( )

Definition at line 85 of file comment_manager.inc.

86  {
87 
88  }

◆ deleteUser()

static CommentManager::deleteUser (   $user)
static

Respond to fired event DeleteUser.

Delete any records in this component that have dependencies on user object.

Parameters
obj$user- class SiteUser or custom user class

Definition at line 171 of file comment_manager.inc.

172  {
173  $pk = $user->getPrimaryKey();
174  $user_id = $user->$pk;
175 
176  trace("Component comment is deleting objects dependent on user_id {$user_id}", 3);
177 
178  $comment = new Comment();
179  $comment->delete("WHERE user_id={$user_id}");
180 
181  return $user;
182  }
$user_id
global $user
$comment

◆ getAdapter()

static CommentManager::getAdapter ( )
static

Definition at line 193 of file comment_manager.inc.

194  {
196 
197  trace(print_r($adapters, true), 3);
198 
199  foreach($_GET as $key => $value)
200  {
201  if (array_key_exists($key, $adapters))
202  {
203  return $adapters[$key];
204  }
205  }
206  }

◆ getAdapters()

static CommentManager::getAdapters ( )
static

Definition at line 184 of file comment_manager.inc.

185  {
186  if (count(CommentManager::$adapters) == 0)
187  {
188  ComponentManager::fireEvent("RegisterCommentAdapters");
189  }
191  }
static fireEvent($event, $parameter=null, $mustBeConsumed=false)
Fire an event to all subscribers as detailed in their manifests.

◆ onInitialize()

static CommentManager::onInitialize ( )
static

Definition at line 146 of file comment_manager.inc.

147  {
148  }

◆ registerAdapter()

static CommentManager::registerAdapter (   $component,
  $parentClass,
  $xrefClass 
)
static

Definition at line 156 of file comment_manager.inc.

157  {
158  trace("Registering CommentAdapter for $component", 3);
159  $adapter = new CommentAdapter($component, $parentClass, $xrefClass);
160  $proto = $adapter->createParent();
161  CommentManager::$adapters[$proto->getPrimaryKey()] = $adapter;
162  }
$component
Definition: help.inc:38

◆ setDefaultEmailTemplates()

static CommentManager::setDefaultEmailTemplates ( )
static

For comment, need default template: new_comment.

Definition at line 119 of file comment_manager.inc.

120  {
121  global $config;
122 
123  $sitename = $config["sitename"];
124  $contact = $config["email_contact"];
125 
126  $message = "This is an automated message from the {$sitename}.<br><br>A new comment has been posted. To review and publish this comment, click the link below:<br><br>[article_comment_url]";
127  EmailTemplate::setDefaultTemplate("new_comment", $contact, "[article_title] Comment ([comment_title])", $message, "ArticleCommentXref");
128  }
static setDefaultTemplate($name, $recipients, $subject, $message, $class_name, $sender_email="")
Create a default template for emails that are sent through Fakoli components (e.g....
global $config
Definition: import.inc:4
$message
Definition: mail_to.inc:49

◆ setDefaultMergeCodes()

static CommentManager::setDefaultMergeCodes ( )
static

Merge codes for ArticleCommentXref: comment_article_id comment_title article_title article_url.

Definition at line 137 of file comment_manager.inc.

138  {
139  MergeCode::setDefaultMergeCode("comment_article_id", "Article.article_id", "ArticleCommentXref", "Comment Article ID");
140  MergeCode::setDefaultMergeCode("comment_title", "Comment.title", "ArticleCommentXref", "Comment Title");
141  MergeCode::setDefaultMergeCode("article_title", "Article.title", "ArticleCommentXref", "Article Title");
142  MergeCode::setDefaultMergeCode("article_url", "Article.getUrl", "ArticleCommentXref", "URL of article with list of comments");
143  MergeCode::setDefaultMergeCode("article_comment_url", "getUrl", "ArticleCommentXref", "URL of article with list of comments");
144  }
static setDefaultMergeCode($name, $map, $class_name, $description="")
Create a default merge codes for emails that are sent through Fakoli components (e....
Definition: merge_code.inc:58

◆ setDefaults()

static CommentManager::setDefaults ( )
static

Definition at line 90 of file comment_manager.inc.

91  {
92  Settings::setDefaultValue("comment", "allow_anonymous_commenting", false, Boolean, "", "Commenting Rules");
93  Settings::setDefaultValue("comment", "publish_automatically", true, Boolean, "", "Commenting Rules");
94  Settings::setDefaultValue("comment", "use_captcha", "Never", String, "Specify when to use a Captcha to verify the user", "Commenting Rules", "Never\nAnonymous Only\nAlways");
95 
96  Settings::setDefaultValue("comment", "enable_item_rating", false, Boolean, "Specifies whether to display the rating control", "Comment Configuration", null, 2);
97  Settings::setDefaultValue("comment", "show_subject_field", true, Boolean, "Specifies whether users can have a title as part of their comment", "Comment Configuration", null, 1);
98 
99  Settings::setDefaultValue("comment", "username_format", "Full Name", String,
100  "Specifies whether to display the full name or username (handle) of logged in commenters", "Comment Configuration", "Full Name\nUsername", 3);
101 
102  Settings::setDefaultValue("comment", "anonymous_preamble_text", "", String,
103  "Identifier of a Text Lookup item containing preamble text that appears at the top of the comment panel for anonymous users",
104  "Comment Configuration", null, 4);
105 
106  Settings::setDefaultValue("comment", "logged_in_preamble_text", "", String,
107  "Identifier of a Text Lookup item containing preamble text that appears at the top of the comment panel for logged in users",
108  "Comment Configuration", null, 5);
109 
112  }
static setDefaultMergeCodes()
Merge codes for ArticleCommentXref: comment_article_id comment_title article_title article_url.
static setDefaultEmailTemplates()
For comment, need default template: new_comment.
static setDefaultValue($component, $name, $value, $field_type="String", $annotation="", $category="", $options="", $weight=0)
Sets the default value of the given component setting.
Definition: settings.inc:174

◆ upgradeComponent()

static CommentManager::upgradeComponent (   $version)
static

Definition at line 150 of file comment_manager.inc.

151  {
152  $mgr = new CommentUpgradeManager();
153  $mgr->upgrade($version);
154  }

Member Data Documentation

◆ $adapters

CommentManager::$adapters = array()
static

Definition at line 83 of file comment_manager.inc.


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