Skip to content

Instantly share code, notes, and snippets.

@coolbung
Created June 30, 2015 07:57
Show Gist options
  • Save coolbung/5eb9413821787214ff66 to your computer and use it in GitHub Desktop.
Save coolbung/5eb9413821787214ff66 to your computer and use it in GitHub Desktop.
Version suport for com_api
<?php
/**
* @package API plugins
* @copyright Copyright (C) 2009 2014 Techjoomla, Tekdi Technologies Pvt. Ltd. All rights reserved.
* @license GNU GPLv2 <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
* @link http://www.techjoomla.com
*/
defined('_JEXEC') or die( 'Restricted access' );
jimport('joomla.plugin.plugin');
class plgAPIUsers extends ApiPlugin
{
public function __construct(&$subject, $config = array())
{
parent::__construct($subject, $config = array());
$version = JFactory::getApplication()->input->get('version', 0, 'FLOAT');
if ($version > 0 && JFolder::exists(dirname(__FILE__).'/versions/'.$version))
ApiResource::addIncludePath(dirname(__FILE__).'/versions/'.$version);
else
ApiResource::addIncludePath(dirname(__FILE__).'/users');
// Set the login resource to be public
$this->setResourceAccess('login', 'public');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment