1010
1111namespace Joomla \Module \PrivacyStatus \Administrator \Helper ;
1212
13+ use Joomla \CMS \Application \CMSApplicationInterface ;
1314use Joomla \CMS \Component \ComponentHelper ;
1415use Joomla \CMS \Event \Privacy \CheckPrivacyPolicyPublishedEvent ;
1516use Joomla \CMS \Factory ;
1617use Joomla \CMS \Language \Multilanguage ;
1718use Joomla \CMS \Plugin \PluginHelper ;
1819use Joomla \CMS \Router \Route ;
20+ use Joomla \Database \DatabaseAwareInterface ;
21+ use Joomla \Database \DatabaseAwareTrait ;
1922
2023// phpcs:disable PSR1.Files.SideEffects
2124\defined ('_JEXEC ' ) or die;
2629 *
2730 * @since 4.0.0
2831 */
29- class PrivacyStatusHelper
32+ class PrivacyStatusHelper implements DatabaseAwareInterface
3033{
34+ use DatabaseAwareTrait;
35+
3136 /**
3237 * Get the information about the published privacy policy
3338 *
39+ * @param CMSApplicationInterface $app The application
40+ *
3441 * @return array Array containing a status of whether a privacy policy is set and a link to the policy document for editing
3542 *
36- * @since 4.0.0
43+ * @since __DEPLOY_VERSION__
3744 */
38- public static function getPrivacyPolicyInfo ( )
45+ public function getPrivacyPolicyInformation ( CMSApplicationInterface $ app )
3946 {
40- $ dispatcher = Factory:: getApplication () ->getDispatcher ();
47+ $ dispatcher = $ app ->getDispatcher ();
4148 $ policy = [
4249 'published ' => false ,
4350 'articlePublished ' => false ,
@@ -62,11 +69,14 @@ public static function getPrivacyPolicyInfo()
6269 /**
6370 * Check whether there is a menu item for the request form
6471 *
72+ * @param CMSApplicationInterface $app The application
73+ *
6574 * @return array Array containing a status of whether a menu is published for the request form and its current link
6675 *
67- * @since 4.0.0
76+ * @since __DEPLOY_VERSION__
77+ *
6878 */
69- public static function getRequestFormPublished ( )
79+ public function getRequestFormMenuStatus ( CMSApplicationInterface $ app )
7080 {
7181 $ status = [
7282 'exists ' => false ,
@@ -75,7 +85,7 @@ public static function getRequestFormPublished()
7585 ];
7686 $ lang = '' ;
7787
78- $ db = Factory:: getDbo ();
88+ $ db = $ this -> getDatabase ();
7989 $ query = $ db ->getQuery (true )
8090 ->select (
8191 [
@@ -111,15 +121,14 @@ public static function getRequestFormPublished()
111121 }
112122 }
113123
114- $ linkMode = Factory:: getApplication () ->get ('force_ssl ' , 0 ) == 2 ? Route::TLS_FORCE : Route::TLS_IGNORE ;
124+ $ linkMode = $ app ->get ('force_ssl ' , 0 ) == 2 ? Route::TLS_FORCE : Route::TLS_IGNORE ;
115125
116126 if (!$ menuItem ) {
117127 if (Multilanguage::isEnabled ()) {
118128 // Find the Itemid of the home menu item tagged to the site default language
119129 $ params = ComponentHelper::getParams ('com_languages ' );
120130 $ defaultSiteLanguage = $ params ->get ('site ' );
121131
122- $ db = Factory::getDbo ();
123132 $ query = $ db ->getQuery (true )
124133 ->select ($ db ->quoteName ('id ' ))
125134 ->from ($ db ->quoteName ('#__menu ' ))
@@ -153,17 +162,17 @@ public static function getRequestFormPublished()
153162 *
154163 * @return integer
155164 *
156- * @since 4.0.0
165+ * @since __DEPLOY_VERSION__
157166 */
158- public static function getNumberUrgentRequests ()
167+ public function getNumberOfUrgentRequests ()
159168 {
160169 // Load the parameters.
161170 $ params = ComponentHelper::getComponent ('com_privacy ' )->getParams ();
162171 $ notify = (int ) $ params ->get ('notify ' , 14 );
163172 $ now = Factory::getDate ()->toSql ();
164173 $ period = '- ' . $ notify ;
165174
166- $ db = Factory:: getDbo ();
175+ $ db = $ this -> getDatabase ();
167176 $ query = $ db ->getQuery (true );
168177 $ query ->select ('COUNT(*) ' )
169178 ->from ($ db ->quoteName ('#__privacy_requests ' ))
@@ -177,4 +186,80 @@ public static function getNumberUrgentRequests()
177186
178187 return (int ) $ db ->loadResult ();
179188 }
189+
190+ /**
191+ * Method to return database encryption details
192+ *
193+ * @return string The database encryption details
194+ *
195+ * @since __DEPLOY_VERSION__
196+ */
197+ public function getDatabaseConnectionEncryption ()
198+ {
199+ return $ this ->getDatabase ()->getConnectionEncryption ();
200+ }
201+
202+ /**
203+ * Get the information about the published privacy policy
204+ *
205+ * @return array Array containing a status of whether a privacy policy is set and a link to the policy document for editing
206+ *
207+ * @since 4.0.0
208+ *
209+ * @deprecated __DEPLOY_VERSION__ will be removed in 7.0
210+ * Use the non-static method getPrivacyPolicyInformation
211+ * Example: Factory::getApplication()->bootModule('mod_privacy_status', 'administrator')
212+ * ->getHelper('PrivacyStatusHelper')
213+ * ->getPrivacyPolicyInformation(Factory::getApplication())
214+ */
215+ public static function getPrivacyPolicyInfo ()
216+ {
217+ $ app = Factory::getApplication ();
218+
219+ return $ app ->bootModule ('mod_privacy_status ' , 'administrator ' )
220+ ->getHelper ('PrivacyStatusHelper ' )
221+ ->getPrivacyPolicyInformation ($ app );
222+ }
223+
224+ /**
225+ * Check whether there is a menu item for the request form
226+ *
227+ * @return array Array containing a status of whether a menu is published for the request form and its current link
228+ *
229+ * @since 4.0.0
230+ *
231+ * @deprecated __DEPLOY_VERSION__ will be removed in 7.0
232+ * Use the non-static method getRequestFormMenuStatus
233+ * Example: Factory::getApplication()->bootModule('mod_privacy_status', 'administrator')
234+ * ->getHelper('PrivacyStatusHelper')
235+ * ->getRequestFormMenuStatus(Factory::getApplication())
236+ */
237+ public static function getRequestFormPublished ()
238+ {
239+ $ app = Factory::getApplication ();
240+
241+ return $ app ->bootModule ('mod_privacy_status ' , 'administrator ' )
242+ ->getHelper ('PrivacyStatusHelper ' )
243+ ->getRequestFormMenuStatus ($ app );
244+ }
245+
246+ /**
247+ * Method to return number privacy requests older than X days.
248+ *
249+ * @return integer
250+ *
251+ * @since 4.0.0
252+ *
253+ * @deprecated __DEPLOY_VERSION__ will be removed in 7.0
254+ * Use the non-static method getNumberOfUrgentRequests
255+ * Example: Factory::getApplication()->bootModule('mod_privacy_status', 'administrator')
256+ * ->getHelper('PrivacyStatusHelper')
257+ * ->getNumberOfUrgentRequests()
258+ */
259+ public static function getNumberUrgentRequests ()
260+ {
261+ return Factory::getApplication ()->bootModule ('mod_privacy_status ' , 'administrator ' )
262+ ->getHelper ('PrivacyStatusHelper ' )
263+ ->getNumberOfUrgentRequests ();
264+ }
180265}
0 commit comments