From 8b7812a6da9f1c44e95f8fba22b65c0c133f1e6f Mon Sep 17 00:00:00 2001 From: Abu-Huraira Date: Thu, 25 Jun 2015 16:34:56 +0600 Subject: [PATCH] getRedirectPluginId method added getRedirectPluginId to get the system redirect plugin id for quicker action --- .../com_redirect/helpers/redirect.php | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/administrator/components/com_redirect/helpers/redirect.php b/administrator/components/com_redirect/helpers/redirect.php index 5373a97bf65ef..0ac79accd6290 100644 --- a/administrator/components/com_redirect/helpers/redirect.php +++ b/administrator/components/com_redirect/helpers/redirect.php @@ -100,6 +100,35 @@ public static function isEnabled() return $result; } + + /** + * get the redirect system plugin id to use for direct access + * + * @return int + * + * @since 3.4 + */ + public static function getRedirectPluginId() + { + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select($db->quoteName('extension_id')) + ->from('#__extensions') + ->where($db->quoteName('folder') . ' = ' . $db->quote('system')) + ->where($db->quoteName('element') . ' = ' . $db->quote('redirect')); + $db->setQuery($query); + + try + { + $result = (int) $db->loadResult(); + } + catch (RuntimeException $e) + { + JError::raiseWarning(500, $e->getMessage()); + } + + return $result; + } /** * Checks whether the option "Collect URLs" is enabled for the output message