Commit ffdadf79 by Scott

Revert private functions to public for backwards compatibility

parent 7f8e3a71
...@@ -97,9 +97,12 @@ class qa_filter_basic ...@@ -97,9 +97,12 @@ class qa_filter_basic
// The definitions below are not part of a standard filter module, but just used within this one // The definitions below are not part of a standard filter module, but just used within this one
/** /**
* Add textual element $field to $errors if length of $input is not between $minlength and $maxlength * Add textual element $field to $errors if length of $input is not between $minlength and $maxlength.
*
* @deprecated This function will become private in Q2A 1.8. It is specific to this plugin and
* should not be used by outside code.
*/ */
private function validate_length(&$errors, $field, $input, $minlength, $maxlength) public function validate_length(&$errors, $field, $input, $minlength, $maxlength)
{ {
$length = isset($input) ? qa_strlen($input) : 0; $length = isset($input) ? qa_strlen($input) : 0;
...@@ -109,7 +112,13 @@ class qa_filter_basic ...@@ -109,7 +112,13 @@ class qa_filter_basic
$errors[$field] = qa_lang_sub('main/max_length_x', $maxlength); $errors[$field] = qa_lang_sub('main/max_length_x', $maxlength);
} }
private function validate_post_email(&$errors, $post) /**
* Wrapper function for validating a post's email address.
*
* @deprecated This function will become private in Q2A 1.8. It is specific to this plugin and
* should not be used by outside code.
*/
public function validate_post_email(&$errors, $post)
{ {
if (@$post['notify'] && strlen(@$post['email'])) { if (@$post['notify'] && strlen(@$post['email'])) {
$error=$this->filter_email($post['email'], null); $error=$this->filter_email($post['email'], null);
......
...@@ -26,74 +26,6 @@ class qa_html_theme_layer extends qa_html_theme_base ...@@ -26,74 +26,6 @@ class qa_html_theme_layer extends qa_html_theme_base
private $qa_voters_flaggers_cache=array(); private $qa_voters_flaggers_cache=array();
// Utility functions for this layer
private function queue_post_voters_flaggers($post)
{
if (!qa_user_post_permit_error('permit_view_voters_flaggers', $post)) {
$postids=array(@$post['postid'], @$post['opostid']); // opostid can be relevant for flags
foreach ($postids as $postid)
if (isset($postid) && !isset($this->qa_voters_flaggers_cache[$postid]))
$this->qa_voters_flaggers_queue[$postid]=true;
}
}
private function queue_raw_posts_voters_flaggers($posts)
{
if (is_array($posts))
foreach ($posts as $post)
if (isset($post['raw']))
$this->queue_post_voters_flaggers($post['raw']);
}
private function retrieve_queued_voters_flaggers()
{
if (count($this->qa_voters_flaggers_queue)) {
require_once QA_INCLUDE_DIR.'db/votes.php';
$postids=array_keys($this->qa_voters_flaggers_queue);
foreach ($postids as $postid)
$this->qa_voters_flaggers_cache[$postid]=array();
$newvotersflaggers=qa_db_uservoteflag_posts_get($postids);
if (QA_FINAL_EXTERNAL_USERS) {
$keyuserids=array();
foreach ($newvotersflaggers as $voterflagger)
$keyuserids[$voterflagger['userid']]=true;
$useridhandles=qa_get_public_from_userids(array_keys($keyuserids));
foreach ($newvotersflaggers as $index => $voterflagger)
$newvotersflaggers[$index]['handle']=@$useridhandles[$voterflagger['userid']];
}
foreach ($newvotersflaggers as $voterflagger)
$this->qa_voters_flaggers_cache[$voterflagger['postid']][]=$voterflagger;
$this->qa_voters_flaggers_queue=array();
}
}
private function get_post_voters_flaggers($post, $postid)
{
require_once QA_INCLUDE_DIR.'util/sort.php';
if (!isset($this->qa_voters_flaggers_cache[$postid])) {
$this->queue_post_voters_flaggers($post);
$this->retrieve_queued_voters_flaggers();
}
$votersflaggers=@$this->qa_voters_flaggers_cache[$postid];
if (isset($votersflaggers))
qa_sort_by($votersflaggers, 'handle');
return $votersflaggers;
}
// Collect up all required postids for the entire page to save DB queries - common case where whole page output // Collect up all required postids for the entire page to save DB queries - common case where whole page output
public function main() public function main()
...@@ -183,10 +115,12 @@ class qa_html_theme_layer extends qa_html_theme_base ...@@ -183,10 +115,12 @@ class qa_html_theme_layer extends qa_html_theme_base
if (isset($postid)) { if (isset($postid)) {
$votersflaggers=$this->get_post_voters_flaggers($post, $postid); $votersflaggers=$this->get_post_voters_flaggers($post, $postid);
if (isset($votersflaggers)) if (isset($votersflaggers)) {
foreach ($votersflaggers as $voterflagger) foreach ($votersflaggers as $voterflagger) {
if ($voterflagger['flag']>0) if ($voterflagger['flag']>0)
$tooltip.=(strlen($tooltip) ? ', ' : '').qa_html($voterflagger['handle']); $tooltip.=(strlen($tooltip) ? ', ' : '').qa_html($voterflagger['handle']);
}
}
} }
if (strlen($tooltip)) if (strlen($tooltip))
...@@ -197,4 +131,91 @@ class qa_html_theme_layer extends qa_html_theme_base ...@@ -197,4 +131,91 @@ class qa_html_theme_layer extends qa_html_theme_base
if (strlen($tooltip)) if (strlen($tooltip))
$this->output('</span>'); $this->output('</span>');
} }
// Utility functions for this layer
/**
* @deprecated This function will become private in Q2A 1.8. It is specific to this plugin and
* should not be used by outside code.
*/
public function queue_post_voters_flaggers($post)
{
if (!qa_user_post_permit_error('permit_view_voters_flaggers', $post)) {
$postids=array(@$post['postid'], @$post['opostid']); // opostid can be relevant for flags
foreach ($postids as $postid) {
if (isset($postid) && !isset($this->qa_voters_flaggers_cache[$postid]))
$this->qa_voters_flaggers_queue[$postid]=true;
}
}
}
/**
* @deprecated This function will become private in Q2A 1.8. It is specific to this plugin and
* should not be used by outside code.
*/
public function queue_raw_posts_voters_flaggers($posts)
{
if (is_array($posts)) {
foreach ($posts as $post) {
if (isset($post['raw']))
$this->queue_post_voters_flaggers($post['raw']);
}
}
}
/**
* @deprecated This function will become private in Q2A 1.8. It is specific to this plugin and
* should not be used by outside code.
*/
public function retrieve_queued_voters_flaggers()
{
if (count($this->qa_voters_flaggers_queue)) {
require_once QA_INCLUDE_DIR.'db/votes.php';
$postids=array_keys($this->qa_voters_flaggers_queue);
foreach ($postids as $postid)
$this->qa_voters_flaggers_cache[$postid]=array();
$newvotersflaggers=qa_db_uservoteflag_posts_get($postids);
if (QA_FINAL_EXTERNAL_USERS) {
$keyuserids=array();
foreach ($newvotersflaggers as $voterflagger)
$keyuserids[$voterflagger['userid']]=true;
$useridhandles=qa_get_public_from_userids(array_keys($keyuserids));
foreach ($newvotersflaggers as $index => $voterflagger)
$newvotersflaggers[$index]['handle']=@$useridhandles[$voterflagger['userid']];
}
foreach ($newvotersflaggers as $voterflagger)
$this->qa_voters_flaggers_cache[$voterflagger['postid']][]=$voterflagger;
$this->qa_voters_flaggers_queue=array();
}
}
/**
* @deprecated This function will become private in Q2A 1.8. It is specific to this plugin and
* should not be used by outside code.
*/
public function get_post_voters_flaggers($post, $postid)
{
require_once QA_INCLUDE_DIR.'util/sort.php';
if (!isset($this->qa_voters_flaggers_cache[$postid])) {
$this->queue_post_voters_flaggers($post);
$this->retrieve_queued_voters_flaggers();
}
$votersflaggers=@$this->qa_voters_flaggers_cache[$postid];
if (isset($votersflaggers))
qa_sort_by($votersflaggers, 'handle');
return $votersflaggers;
}
} }
...@@ -234,13 +234,21 @@ class qa_wysiwyg_editor ...@@ -234,13 +234,21 @@ class qa_wysiwyg_editor
} }
private function html_to_text($html) /**
* @deprecated This function will become private in Q2A 1.8. It is specific to this plugin and
* should not be used by outside code.
*/
public function html_to_text($html)
{ {
$viewer = qa_load_module('viewer', ''); $viewer = qa_load_module('viewer', '');
return $viewer->get_text($html, 'html', array()); return $viewer->get_text($html, 'html', array());
} }
private function bytes_to_mega_html($bytes) /**
* @deprecated This function will become private in Q2A 1.8. It is specific to this plugin and
* should not be used by outside code.
*/
public function bytes_to_mega_html($bytes)
{ {
return qa_html(number_format($bytes/1048576, 1)); return qa_html(number_format($bytes/1048576, 1));
} }
......
...@@ -271,7 +271,11 @@ class qa_xml_sitemap ...@@ -271,7 +271,11 @@ class qa_xml_sitemap
} }
private function sitemap_output($request, $priority) /**
* @deprecated This function will become private in Q2A 1.8. It is specific to this plugin and
* should not be used by outside code.
*/
public function sitemap_output($request, $priority)
{ {
echo "\t<url>\n". echo "\t<url>\n".
"\t\t<loc>".qa_xml(qa_path($request, null, qa_opt('site_url')))."</loc>\n". "\t\t<loc>".qa_xml(qa_path($request, null, qa_opt('site_url')))."</loc>\n".
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment