Skip to content

Commit

Permalink
getRedirectPluginId method added
Browse files Browse the repository at this point in the history
getRedirectPluginId to get the system redirect plugin id for quicker action
  • Loading branch information
shamsbd71 committed Jun 25, 2015
1 parent 08866bf commit 8b7812a
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions administrator/components/com_redirect/helpers/redirect.php
Expand Up @@ -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
Expand Down

0 comments on commit 8b7812a

Please sign in to comment.