Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Q
question2answer
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
outils
question2answer
Commits
ffdadf79
Commit
ffdadf79
authored
Dec 28, 2014
by
Scott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert private functions to public for backwards compatibility
parent
7f8e3a71
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
118 additions
and
76 deletions
+118
-76
qa-filter-basic.php
qa-include/plugins/qa-filter-basic.php
+12
-3
qa-layer-voters-flaggers.php
qa-include/plugins/qa-layer-voters-flaggers.php
+91
-70
qa-wysiwyg-editor.php
qa-plugin/wysiwyg-editor/qa-wysiwyg-editor.php
+10
-2
qa-xml-sitemap.php
qa-plugin/xml-sitemap/qa-xml-sitemap.php
+5
-1
No files found.
qa-include/plugins/qa-filter-basic.php
View file @
ffdadf79
...
@@ -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.
*/
*/
p
rivate
function
validate_length
(
&
$errors
,
$field
,
$input
,
$minlength
,
$maxlength
)
p
ublic
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
);
...
...
qa-include/plugins/qa-layer-voters-flaggers.php
View file @
ffdadf79
...
@@ -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
;
}
}
}
qa-plugin/wysiwyg-editor/qa-wysiwyg-editor.php
View file @
ffdadf79
...
@@ -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
));
}
}
...
...
qa-plugin/xml-sitemap/qa-xml-sitemap.php
View file @
ffdadf79
...
@@ -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
"
.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment