This repository was archived by the owner on Nov 20, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathext.addon.php
More file actions
81 lines (67 loc) · 1.88 KB
/
ext.addon.php
File metadata and controls
81 lines (67 loc) · 1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
require_once PATH_THIRD.'addon/config.php';
/**
*
*/
class Addon_ext
{
var $settings = array();
var $name = ADDON_NAME;
var $version = ADDON_VER;
var $description = ADDON_DESC;
var $settings_exist = 'n';
var $docs_url = ADDON_DOCS;
function __construct($settings='')
{
$this->settings = $settings;
$this->EE =& get_instance();
}
// Extension Required Methods ==================================================
function activate_extension()
{
$hooks = array(
'publish_form_channel_preferences' => 'change_status'
);
foreach ($hooks as $hook => $method)
{
$sql[] = $this->EE->db->insert_string(
'exp_extensions',
array(
'extension_id' => '',
'class' => ucfirst(get_class($this)),
'method' => $method,
'hook' => $hook,
'settings' => "",
'priority' => 10,
'version' => $this->version,
'enabled' => "y"
)
);
}
// run all sql queries
foreach ($sql as $query) { $this->EE->db->query($query); }
return TRUE;
}
function update_extension($current='')
{
if ($current == '' OR $current == $this->version)
{
return FALSE;
}
$this->EE->db->where('class', ucfirst(get_class($this)))
->update('extensions', array("version" => $this->EE->db->escape_str($this->version)));
}
function disable_extension()
{
$this->EE->db->delete("exp_extensions", array("class" => ucfirst(get_class($this))));
}
// Hook Methods ================================================================
public function change_status($channel_preferences)
{
var_dump($channel_preferences);
die();
return $channel_preferences;
}
}
/* End of file ext.addon.php */
/* Location: ./system/expressionengine/third_party/addon/ext.addon.php */