Created
July 28, 2012 04:50
-
-
Save davist11/3191839 to your computer and use it in GitHub Desktop.
Sample Plugin for DCEERs Presentation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); | |
/** | |
* ExpressionEngine - by EllisLab | |
* | |
* @package ExpressionEngine | |
* @author ExpressionEngine Dev Team | |
* @copyright Copyright (c) 2003 - 2011, EllisLab, Inc. | |
* @license http://expressionengine.com/user_guide/license.html | |
* @link http://expressionengine.com | |
* @since Version 2.0 | |
* @filesource | |
*/ | |
// ------------------------------------------------------------------------ | |
/** | |
* VL Client Plugin | |
* | |
* @package ExpressionEngine | |
* @subpackage Addons | |
* @category Plugin | |
* @author Viget | |
* @link http://viget.com | |
*/ | |
$plugin_info = array( | |
'pi_name' => 'VL Client', | |
'pi_version' => '1.0', | |
'pi_author' => 'Viget', | |
'pi_author_url' => 'http://viget.com', | |
'pi_description'=> 'Utility plugin for demo', | |
'pi_usage' => Vl_client::usage() | |
); | |
class Vl_client { | |
public $return_data; | |
/** | |
* Constructor | |
*/ | |
public function __construct() | |
{ | |
$this->EE =& get_instance(); | |
} | |
/** | |
* Just encode a string | |
*/ | |
public function url_encode() | |
{ | |
$tagdata = $this->EE->TMPL->tagdata; | |
return urlencode(trim($tagdata)); | |
} | |
/** | |
* Get the number of entries from a channel | |
*/ | |
public function entry_count() | |
{ | |
$channel_id = $this->EE->TMPL->fetch_param('channel_id', NULL); | |
if($channel_id) { | |
$query = $this->EE->db->select('total_entries') | |
->from('channels') | |
->where('channel_id', $channel_id) | |
->get(); | |
if ($query->num_rows() > 0) { | |
$row = $query->row(); | |
$query->free_result(); | |
return $row->total_entries; | |
} | |
} | |
} | |
// ---------------------------------------------------------------- | |
/** | |
* Plugin Usage | |
*/ | |
public static function usage() | |
{ | |
ob_start(); | |
?> | |
Since you did not provide instructions on the form, make sure to put plugin documentation here. | |
<?php | |
$buffer = ob_get_contents(); | |
ob_end_clean(); | |
return $buffer; | |
} | |
} | |
/* End of file pi.vl_client.php */ | |
/* Location: /system/expressionengine/third_party/vl_client/pi.vl_client.php */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment