Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
ext.navee_static_menu.php
<?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
*/
// ------------------------------------------------------------------------
/**
* NavEE Static Menu Extension
*
* @package ExpressionEngine
* @subpackage Addons
* @category Extension
* @author TJ Fogarty
* @link http://www.emagine.ie
*/
class Navee_static_menu_ext {
public $settings = array();
public $description = 'Generate a static file for your navigation';
public $docs_url = '';
public $name = 'NavEE Static Menu';
public $settings_exist = 'y';
public $version = '1.0';
private $EE;
/**
* Constructor
*
* @param mixed Settings array or empty string if none exist.
*/
public function __construct($settings = '')
{
$this->EE =& get_instance();
$this->settings = $settings;
}
// ----------------------------------------------------------------------
/**
* Settings Form
*
* If you wish for ExpressionEngine to automatically create your settings
* page, work in this method. If you wish to have fine-grained control
* over your form, use the settings_form() and save_settings() methods
* instead, and delete this one.
*
* @see http://expressionengine.com/user_guide/development/extensions.html#settings
*/
public function settings()
{
return array(
);
}
// ----------------------------------------------------------------------
/**
* Activate Extension
*
* This function enters the extension into the exp_extensions table
*
* @see http://codeigniter.com/user_guide/database/index.html for
* more information on the db class.
*
* @return void
*/
public function activate_extension()
{
// Setup custom settings in this array.
$this->settings = array();
$data = array(
'class' => __CLASS__,
'method' => 'update_nav',
'hook' => 'navee_update_navigation_item',
'settings' => serialize($this->settings),
'version' => $this->version,
'enabled' => 'y'
);
$this->EE->db->insert('extensions', $data);
}
// ----------------------------------------------------------------------
/**
* update_nav
*
* @param
* @return
*/
public function update_nav()
{
$t = time();
$file_path = PATH_THIRD . "navee_static_menu/file.txt";
$file_handle = fopen($file_path, 'w');
fwrite($file_handle, $t . '\n');
fclose($file_handle);
}
// ----------------------------------------------------------------------
/**
* Disable Extension
*
* This method removes information from the exp_extensions table
*
* @return void
*/
function disable_extension()
{
$this->EE->db->where('class', __CLASS__);
$this->EE->db->delete('extensions');
}
// ----------------------------------------------------------------------
/**
* Update Extension
*
* This function performs any necessary db updates when the extension
* page is visited
*
* @return mixed void on update / false if none
*/
function update_extension($current = '')
{
if ($current == '' OR $current == $this->version)
{
return FALSE;
}
}
// ----------------------------------------------------------------------
}
/* End of file ext.navee_static_menu.php */
/* Location: /system/expressionengine/third_party/navee_static_menu/ext.navee_static_menu.php */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment