Changeset 11741 for extensions/user_tags/include
- Timestamp:
- Jul 14, 2011, 4:01:17 PM (13 years ago)
- Location:
- extensions/user_tags/include
- Files:
-
- 1 added
- 1 deleted
- 4 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
extensions/user_tags/include/autoload.inc.php
r11099 r11741 20 20 // +-----------------------------------------------------------------------+ 21 21 22 if (!defined('PHPWG_ROOT_PATH')) { 23 die('Hacking attempt!'); 22 global $__t4u_autoload; 23 $__t4u_autoload['t4u_Ws'] = T4U_PLUGIN_ROOT . '/include/t4u_ws.class.php'; 24 $__t4u_autoload['t4u_Config'] = T4U_PLUGIN_ROOT . '/include/t4u_config.class.php'; 25 $__t4u_autoload['t4u_Content'] = T4U_PLUGIN_ROOT . '/include/t4u_content.class.php'; 26 27 28 if (function_exists('spl_autoload_register')) { 29 spl_autoload_register('t4u_autoload'); 30 } else { 31 function __autoload($name) { 32 t4u_autoload($name); 33 } 24 34 } 25 35 26 if (!empty($_GET['action']) && in_array($_GET['action'], array('add', 'get'))) { 27 include_once T4U_PLUGIN_ROOT . "/include/t4u_admin_action.inc.php"; 36 function t4u_autoload($name) { 37 global $__t4u_autoload; 38 39 if (!empty($__t4u_autoload[$name])) { 40 require_once $__t4u_autoload[$name]; 41 } 28 42 } 29 30 include_once T4U_PLUGIN_ROOT . "/include/t4u_content.class.php";31 32 $public_content = new t4u_Content($plugin_config);33 add_event_handler('render_element_content',34 array($public_content, 'render_element_content'),35 EVENT_HANDLER_PRIORITY_NEUTRAL,36 237 );38 ?> -
extensions/user_tags/include/constants.inc.php
r6798 r11741 26 26 define('T4U_IMGS', PHPWG_PLUGINS_PATH . basename(T4U_PLUGIN_ROOT). '/imgs'); 27 27 define('T4U_JS', PHPWG_PLUGINS_PATH . basename(T4U_PLUGIN_ROOT). '/js'); 28 define('T4U_WS', 'user_tags.tags.'); 28 29 ?> -
extensions/user_tags/include/default_values.inc.php
r11081 r11741 21 21 22 22 $default_values = array(); 23 $default_values['t4u_permission_add'] = null; 24 $default_values['t4u_permission_delete'] = null; 23 $default_values['t4u_permission_update'] = null; 25 24 ?> -
extensions/user_tags/include/t4u_config.class.php
r11081 r11741 22 22 class t4u_Config 23 23 { 24 private 25 $config = array(), 26 $plugin_dir; 24 private $config = array(); 25 protected static $instance; 27 26 28 27 public function __construct($plugin_dir, $plugin_name) { … … 35 34 36 35 if (!file_exists($this->get_config_filename())) { 36 $this->setDefaults(); 37 37 $this->save_config(); 38 38 } 39 39 } 40 41 public static function getInstance() { 42 if (!isset(self::$instance)) { 43 self::$instance = new t4u_Config(T4U_PLUGIN_ROOT, T4U_PLUGIN_NAME); 44 } 45 return self::$instance; 46 } 47 40 48 41 49 public function load_config() { … … 45 53 $this->config = $c; 46 54 } 47 $this->setDefaults();48 55 } 49 56 … … 100 107 101 108 public function getActionUrl($action, $method='POST') { 102 $url = get_root_url().'admin.php?page=plugin'; 103 $file = basename($this->plugin_dir) . '/' .'admin.php'; 104 if (strtoupper($method)=='POST') { 105 $url .= '&section='.urlencode($file); 106 $url .= '&action='.urlencode($action); 107 } else { 108 $url .= '§ion='.$file; 109 $url .= '&action='.$action; 110 } 109 $ws = get_root_url(); 110 $ws .= 'ws.php?format=json&method=user_tags.tags.list'; 111 111 112 return $url; 112 /* $url = get_root_url().'admin.php?page=plugin'; */ 113 /* $file = basename($this->plugin_dir) . '/' .'admin.php'; */ 114 /* if (strtoupper($method)=='POST') { */ 115 /* $url .= '&section='.urlencode($file); */ 116 /* $url .= '&action='.urlencode($action); */ 117 /* } else { */ 118 /* $url .= '§ion='.$file; */ 119 /* $url .= '&action='.$action; */ 120 /* } */ 121 122 return $ws; 113 123 } 114 124 -
extensions/user_tags/include/t4u_content.class.php
r11081 r11741 30 30 31 31 if (!$this->plugin_config->hasPermission('add')) { 32 return false;32 return $content; 33 33 } 34 35 load_language('plugin.lang', T4U_PLUGIN_LANG); 34 36 35 37 $template->assign('T4U_JS', T4U_JS); 36 38 $template->assign('T4U_CSS', T4U_CSS); 37 39 $template->assign('T4U_IMGS', T4U_IMGS); 38 $template->assign('T4U_ADD_SCRIPT', $this->plugin_config->getActionUrl('add', 'GET')); 39 $template->assign('T4U_GET_SCRIPT', $this->plugin_config->getActionUrl('get', 'GET')); 40 $template->assign('T4U_PERMISSION_DELETE', $this->plugin_config->hasPermission('delete')); 41 $template->assign('T4U_UPDATE_SCRIPT', get_root_url().'ws.php?format=json&method='.T4U_WS.'update'); 42 $template->assign('T4U_UPDATE_METHOD', T4U_WS.'update'); 43 $template->assign('T4U_GET_SCRIPT', get_root_url().'ws.php?format=json&method='.T4U_WS.'list'); 40 44 $template->assign('T4U_IMAGE_ID', $picture['id']); 41 45 $template->assign('T4U_REFERER', urlencode($picture['url'])); … … 51 55 52 56 $template->set_filename('add_tags', T4U_TEMPLATE.'/add_tags.tpl'); 53 $template->assign_var_from_handle('PLUGIN_PICTURE_BEFORE', 'add_tags'); 57 58 $plugin_picture_before = $template->get_template_vars('PLUGIN_PICTURE_BEFORE'); 59 $plugin_picture_before .= $template->parse('add_tags', true); 60 $template->append('PLUGIN_PICTURE_BEFORE', $plugin_picture_before); 54 61 55 62 return $content;
Note: See TracChangeset
for help on using the changeset viewer.