当前位置: 首页>>代码示例>>PHP>>正文


PHP Plugins::instance方法代码示例

本文整理汇总了PHP中Plugins::instance方法的典型用法代码示例。如果您正苦于以下问题:PHP Plugins::instance方法的具体用法?PHP Plugins::instance怎么用?PHP Plugins::instance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Plugins的用法示例。


在下文中一共展示了Plugins::instance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 public function __construct()
 {
     $this->_ci = get_instance();
     // Codeigniter instance
     self::$instance = $this;
     // Instance of this class
     $this->_ci->load->driver('cache', array('adapter' => 'apc', 'backup' => 'file'));
     $this->_ci->load->helper('directory');
     $this->_ci->load->helper('file');
     // Set the plugins directory if not already set
     if (is_null($this->plugins_dir)) {
         $this->plugins_dir = FCPATH . "plugins/";
     }
     $this->find_plugins();
     // Find all plugins
     $this->get_activated_plugins();
     // Get all activated plugins
     $this->get_plugin_infos();
     // Gets information about all plugins and stores it
     $this->include_plugins();
     // Include plugins
     self::$messages = "";
     // Clear messages
     self::$errors = "";
     // Clear errors
 }
开发者ID:Apeplazas,项目名称:plazadelatecnologia,代码行数:26,代码来源:Plugins.php

示例2: init

	static function init() {
		$base_hooks_dir = ROOT . "/hooks" ;
		if (is_dir($base_hooks_dir)) {
			$handle = opendir($base_hooks_dir);
			while ($file = readdir($handle)) {
				if (is_file("$base_hooks_dir/$file") && substr($file, -4) == '.php') {
					include_once "$base_hooks_dir/$file";
				}
			}
			closedir($handle);
		}
		
		foreach ( Plugins::instance()->getActive() as $plugin ){
			/* @var $plugin Plugin  */
			$plugin_hooks_dir = $plugin->getHooksPath();
			if (is_dir($plugin_hooks_dir)) {
				$handle = opendir($plugin_hooks_dir);
				while ($file = readdir($handle)) {
					if (is_file("$plugin_hooks_dir/$file") && substr($file, -4) == '.php') {
						include_once "$plugin_hooks_dir/$file";
					}
				}
				$plugin->getSystemName() ;
				closedir($handle);
			}
		}
	}
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:27,代码来源:Hook.class.php

示例3: __construct

 /**
 * Constructor
 * 
 * @param mixed $params
 * @return Plugins
 */
 public function __construct($params = array())
 {
     $this->_ci      = get_instance(); // Codeigniter instance
     self::$instance = $this;          // Instance of this class
     
     $this->_ci->load->database();
     $this->_ci->load->helper('directory');
     $this->_ci->load->helper('file');
     $this->_ci->load->helper('url');
     
     // Set the plugins directory if passed via paramater
     if (array_key_exists('plugins_dir', $params))
     {
     	$this->set_plugin_dir($params['plugins_dir']);
     }
     else // else set to default value
     {
     	$this->set_plugin_dir(FCPATH . "plugins");
     }
     
     // Remove index.php string on the plugins directory if any
     $this->plugins_dir = str_replace("index.php", "", $this->plugins_dir);      
             
     $this->find_plugins();          // Find all plugins
     $this->get_activated_plugins(); // Get all activated plugins
     $this->get_plugin_infos();      // Gets information about all plugins and stores it
     $this->include_plugins();       // Include plugins
     
     self::$messages = ""; // Clear messages
     self::$errors   = ""; // Clear errors                      
 }
开发者ID:Nakei,项目名称:FoOlSlide,代码行数:37,代码来源:Plugins.php

示例4: __construct

 public function __construct($params = array())
 {
     $this->_ci = get_instance();
     // Codeigniter instance
     self::$instance = $this;
     // Instance of this class
     // Driver library only available on CI 2.0+
     if (CI_VERSION >= 2.0) {
         $this->_ci->load->driver('cache', array('adapter' => 'apc', 'backup' => 'file'));
     }
     $this->_ci->load->database();
     $this->_ci->load->helper('directory');
     $this->_ci->load->helper('file');
     // Set the plugins directory if passed via paramater
     if (array_key_exists('plugins_dir', $params)) {
         $this->set_plugin_dir($params['plugins_dir']);
     } else {
         $this->set_plugin_dir(FCPATH . "plugins/");
     }
     // Remove index.php string on the plugins directory if any
     $this->plugins_dir = str_replace("index.php", "", $this->plugins_dir);
     $this->find_plugins();
     // Find all plugins
     $this->get_activated_plugins();
     // Get all activated plugins
     $this->get_plugin_infos();
     // Gets information about all plugins and stores it
     $this->include_plugins();
     // Include plugins
     self::$messages = "";
     // Clear messages
     self::$errors = "";
     // Clear errors
 }
开发者ID:sugengstiki,项目名称:Kalkun,代码行数:34,代码来源:Plugins.php

示例5: getInstance

 public static function getInstance()
 {
     if (null === self::$instance) {
         self::$instance = new self();
     }
     return self::$instance;
 }
开发者ID:pixelproduction,项目名称:PixelManagerCMS,代码行数:7,代码来源:Plugins.php

示例6: getPlugin

	/**
	 * @return Plugin 
	 */
	function getPlugin() {
		if (is_null($this->plugin) ) {
			if ($pid = $this->getPluginId()){
				$this->plugin = Plugins::instance()->findById($pid);
			}
		}
		return $this->plugin ;
	}
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:11,代码来源:Widget.class.php

示例7: delete_mails_from_server

function delete_mails_from_server() {
	if (Plugins::instance()->isActivePlugin('mail')) {
		try {
			_log("Checking mail accounts to delete mails from server...");
			$count = MailUtilities::deleteMailsFromServerAllAccounts();
			_log("Deleted $count mails from server...");
		} catch (Exception $e) {
			_log("Error deleting mails from server: " . $e->getMessage());
		}
	}
}
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:11,代码来源:cron_functions.php

示例8: action_deactivate

 public function action_deactivate()
 {
     $plugin = $this->request->param('plugin');
     $msg = array('title' => 'Deactivation');
     if (array_key_exists($plugin, Plugins::$plugins_pool)) {
         $plug = Plugins::instance()->load_plugin($plugin);
         if (Plugins::$manager->is_active($plugin) == false) {
             $msg['class'] = 'alert-warning';
             $msg['content'] = $plug->info['name'] . ' is not active';
         } else {
             if (Plugins::$manager->deactivate($plugin)) {
                 $msg['class'] = 'alert-success';
                 $msg['content'] = $plug->info['name'] . ' was successfully deactivated.';
             } else {
                 $msg['class'] = 'alert-warning';
                 $msg['content'] = 'There was an error deactivating ' . $plug->info['name'];
             }
         }
     } else {
         $msg['class'] = 'alert-danger';
         $msg['content'] = $plugin . ' does not seem to exist.';
     }
     $this->action_index($msg);
 }
开发者ID:vheissu,项目名称:kohana-plugin-system,代码行数:24,代码来源:Plugins.php

示例9: manager

	/**
	 * Return manager instance
	 *
	 * @access protected
	 * @param void
	 * @return Plugins 
	 */
	function manager() {
		if (! ($this->manager instanceof Plugins))
			$this->manager = Plugins::instance ();
		return $this->manager;
	} // manager
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:12,代码来源:BasePlugin.class.php

示例10: array

    		$icons[] = array(
    			'ico' => 'ico-large-upgrade',
    			'url' => get_url('administration', 'upgrade'),
    			'name' => lang('upgrade'),
    			'extra' => '',
    		);
    	}*/
    if (!defined('ALLOW_CONFIGURING_CRON') || ALLOW_CONFIGURING_CRON) {
        $icons[] = array('ico' => 'ico-large-cron', 'url' => get_url('administration', 'cron_events'), 'name' => lang('cron events'), 'extra' => '');
    }
    $icons[] = array('ico' => 'ico-large-tabs', 'url' => get_url('administration', 'tabs'), 'name' => lang('tabs'), 'extra' => '');
}
if (can_manage_dimension_members(logged_user())) {
    $icons[] = array('ico' => 'ico-large-workspace', 'url' => get_url('administration', 'edit_members'), 'name' => lang('dimensions'), 'extra' => '');
}
if (can_manage_security(logged_user()) && Plugins::instance()->isActivePlugin('income')) {
    $icons[] = array('ico' => 'ico-large-invoice', 'url' => get_url('income', 'administration'), 'name' => lang('income'), 'extra' => '');
}
if (defined("PLUGIN_MANAGER") && PLUGIN_MANAGER && can_manage_plugins(logged_user())) {
    $icons[] = array('ico' => 'ico-large-plugins', 'url' => get_url('plugin', 'index'), 'name' => lang('plugins'), 'extra' => '');
}
Hook::fire('render_administration_icons', null, $icons);
if (count($icons > 0)) {
}
?>
<div class="coInputHeader">

  <div class="coInputHeaderUpperRow">
	<div class="coInputTitle">
		<?php 
echo lang('administration');
开发者ID:abhinay100,项目名称:feng_app,代码行数:31,代码来源:index.php

示例11: edit_task

 /**
  * Edit task
  *
  * @access public
  * @param void
  * @return null
  */
 function edit_task()
 {
     if (logged_user()->isGuest()) {
         flash_error(lang('no access permissions'));
         ajx_current("empty");
         return;
     }
     $this->setTemplate('add_task');
     $task = ProjectTasks::findById(get_id());
     if (!$task instanceof ProjectTask) {
         flash_error(lang('task list dnx'));
         ajx_current("empty");
         return;
     }
     // if
     if (!$task->canEdit(logged_user())) {
         flash_error(lang('no access permissions'));
         ajx_current("empty");
         return;
     }
     // if
     if (array_var($_GET, 'replace')) {
         ajx_replace(true);
     }
     $task_data = array_var($_POST, 'task');
     $time_estimate = array_var($_POST, 'hours', 0) * 60 + array_var($_POST, 'minutes', 0);
     if ($time_estimate > 0) {
         $estimatedTime = $time_estimate;
     } else {
         $estimatedTime = $task->getTimeEstimate();
     }
     if (!is_array($task_data)) {
         $this->getRepeatOptions($task, $occ, $rsel1, $rsel2, $rsel3, $rnum, $rend, $rjump);
         $dd = $task->getDueDate() instanceof DateTimeValue ? $task->getDueDate()->advance(logged_user()->getTimezone() * 3600, false) : null;
         $sd = $task->getStartDate() instanceof DateTimeValue ? $task->getStartDate()->advance(logged_user()->getTimezone() * 3600, false) : null;
         $post_dd = null;
         if (array_var($_POST, 'task_due_date')) {
             $post_dd = getDateValue(array_var($_POST, 'task_due_date'));
             if ($post_dd instanceof DateTimeValue) {
                 $duetime = getTimeValue(array_var($_POST, 'task_due_time'));
                 if (is_array($duetime)) {
                     $post_dd->setHour(array_var($duetime, 'hours'));
                     $post_dd->setMinute(array_var($duetime, 'mins'));
                     $post_dd->advance(logged_user()->getTimezone() * 3600, false);
                 }
             }
         }
         $post_st = null;
         if (array_var($_POST, 'task_start_date')) {
             $post_st = getDateValue(array_var($_POST, 'task_start_date'));
             if ($post_st instanceof DateTimeValue) {
                 $starttime = getTimeValue(array_var($_POST, 'task_start_time'));
                 if (is_array($starttime)) {
                     $post_st->setHour(array_var($starttime, 'hours'));
                     $post_st->setMinute(array_var($starttime, 'mins'));
                     $post_st->advance(logged_user()->getTimezone() * 3600, false);
                 }
             }
         }
         $task_data = array('name' => array_var($_POST, 'name', $task->getObjectName()), 'text' => array_var($_POST, 'text', $task->getText()), 'milestone_id' => array_var($_POST, 'milestone_id', $task->getMilestoneId()), 'due_date' => getDateValue($post_dd, $dd), 'start_date' => getDateValue($post_st, $sd), 'parent_id' => $task->getParentId(), 'assigned_to_contact_id' => array_var($_POST, 'assigned_to_contact_id', $task->getAssignedToContactId()), 'priority' => array_var($_POST, 'priority', $task->getPriority()), 'send_notification' => array_var($_POST, 'notify') == 'true', 'time_estimate' => $estimatedTime, 'percent_completed' => $task->getPercentCompleted(), 'forever' => $task->getRepeatForever(), 'rend' => $rend, 'rnum' => $rnum, 'rjump' => $rjump, 'rsel1' => $rsel1, 'rsel2' => $rsel2, 'rsel3' => $rsel3, 'occ' => $occ, 'repeat_by' => $task->getRepeatBy(), 'object_subtype' => array_var($_POST, "object_subtype", $task->getObjectSubtype() != 0 ? $task->getObjectSubtype() : config_option('default task co type')), 'type_content' => $task->getTypeContent(), 'multi_assignment' => $task->getColumnValue('multi_assignment', 0));
         // array
     }
     // if
     //I find all those related to the task to find out if the original
     $task_related = ProjectTasks::findByRelated($task->getObjectId());
     if (!$task_related) {
         //is not the original as the original look plus other related
         if ($task->getOriginalTaskId() != "0") {
             $task_related = ProjectTasks::findByTaskAndRelated($task->getObjectId(), $task->getOriginalTaskId());
         }
     }
     if ($task_related) {
         $pending_id = 0;
         foreach ($task_related as $t_rel) {
             if ($task->getStartDate() <= $t_rel->getStartDate() && $task->getDueDate() <= $t_rel->getDueDate() && !$t_rel->isCompleted()) {
                 $pending_id = $t_rel->getId();
                 break;
             }
         }
         tpl_assign('pending_task_id', $pending_id);
         tpl_assign('task_related', true);
     } else {
         tpl_assign('pending_task_id', 0);
         tpl_assign('task_related', false);
     }
     tpl_assign('task', $task);
     tpl_assign('task_data', $task_data);
     if (is_array(array_var($_POST, 'task'))) {
         $send_edit = false;
         if ($task->getAssignedToContactId() == array_var($task_data, 'assigned_to_contact_id')) {
             $send_edit = true;
         }
         $old_owner = $task->getAssignedTo();
//.........这里部分代码省略.........
开发者ID:rorteg,项目名称:fengoffice,代码行数:101,代码来源:TaskController.class.php

示例12: add_objects_to_member

    /**
     * Used for Drag & Drop, adds objects to a member
     * @author alvaro
     */
    function add_objects_to_member()
    {
        $ids = json_decode(array_var($_POST, 'objects'));
        $mem_id = array_var($_POST, 'member');
        if (!is_array($ids) || count($ids) == 0) {
            ajx_current("empty");
            return;
        }
        try {
            DB::beginWork();
            if ($mem_id) {
                $user_ids = array();
                $member = Members::findById($mem_id);
                $objects = array();
                $from = array();
                foreach ($ids as $oid) {
                    /* @var $obj ContentDataObject */
                    $obj = Objects::findObject($oid);
                    if ($obj instanceof ContentDataObject && $obj->canAddToMember(logged_user(), $member, active_context())) {
                        $dim_obj_type_content = DimensionObjectTypeContents::findOne(array('conditions' => array('`dimension_id`=? AND `dimension_object_type_id`=? AND `content_object_type_id`=?', $member->getDimensionId(), $member->getObjectTypeId(), $obj->getObjectTypeId())));
                        if (!$dim_obj_type_content instanceof DimensionObjectTypeContent) {
                            continue;
                        }
                        if (!$dim_obj_type_content->getIsMultiple() || array_var($_POST, 'remove_prev')) {
                            $db_res = DB::execute("SELECT group_concat(om.member_id) as old_members FROM " . TABLE_PREFIX . "object_members om INNER JOIN " . TABLE_PREFIX . "members m ON om.member_id=m.id WHERE m.dimension_id=" . $member->getDimensionId() . " AND om.object_id=" . $obj->getId());
                            $row = $db_res->fetchRow();
                            if (array_var($row, 'old_members') != "") {
                                $from[$obj->getId()] = $row['old_members'];
                            }
                            // remove from previous members
                            ObjectMembers::delete('`object_id` = ' . $obj->getId() . ' AND `member_id` IN (SELECT `m`.`id` FROM `' . TABLE_PREFIX . 'members` `m` WHERE `m`.`dimension_id` = ' . $member->getDimensionId() . ')');
                        }
                        $obj->addToMembers(array($member));
                        $obj->addToSharingTable();
                        $objects[] = $obj;
                        if (Plugins::instance()->isActivePlugin('mail') && $obj instanceof MailContent) {
                            $conversation = MailContents::getMailsFromConversation($obj);
                            foreach ($conversation as $conv_email) {
                                if (array_var($_POST, 'attachment') && $conv_email->getHasAttachments()) {
                                    MailUtilities::parseMail($conv_email->getContent(), $decoded, $parsedEmail, $warnings);
                                    $classification_data = array();
                                    for ($j = 0; $j < count(array_var($parsedEmail, "Attachments", array())); $j++) {
                                        $classification_data["att_" . $j] = true;
                                    }
                                    MailController::classifyFile($classification_data, $conv_email, $parsedEmail, array($member), array_var($_POST, 'remove_prev'), false);
                                }
                            }
                        }
                        // if object is contact ask to add default permissions in member
                        if ($obj instanceof Contact && $obj->isUser() && can_manage_security(logged_user())) {
                            $user_ids[] = $obj->getId();
                        }
                    } else {
                        throw new Exception(lang('you dont have permissions to classify object in member', $obj->getName(), $member->getName()));
                    }
                }
                // if object is contact ask to add default permissions in member
                if (can_manage_security(logged_user()) && count($user_ids) > 0 && $member->getDimension()->getDefinesPermissions()) {
                    evt_add('ask to assign default permissions', array('user_ids' => $user_ids, 'member' => array('id' => $member->getId(), 'name' => clean($member->getName())), ''));
                }
                Hook::fire('after_dragdrop_classify', $objects, $member);
                $display_name = $member->getName();
                $lang_key = count($ids) > 1 ? 'objects moved to member success' : 'object moved to member success';
                $log_datas = array();
                $actions = array();
                // add to application logs
                foreach ($objects as $obj) {
                    $actions[$obj->getId()] = array_var($from, $obj->getId()) ? ApplicationLogs::ACTION_MOVE : ApplicationLogs::ACTION_COPY;
                    $log_datas[$obj->getId()] = (array_var($from, $obj->getId()) ? "from:" . array_var($from, $obj->getId()) . ";" : "") . "to:" . $member->getId();
                }
            } else {
                if ($dim_id = array_var($_POST, 'dimension')) {
                    $dimension = Dimensions::getDimensionById($dim_id);
                    $from = array();
                    foreach ($ids as $oid) {
                        /* @var $obj ContentDataObject */
                        $obj = Objects::findObject($oid);
                        if ($obj instanceof ContentDataObject) {
                            $db_res = DB::execute("SELECT group_concat(om.member_id) as old_members FROM " . TABLE_PREFIX . "object_members om INNER JOIN " . TABLE_PREFIX . "members m ON om.member_id=m.id WHERE m.dimension_id=" . $dim_id . " AND om.object_id=" . $obj->getId());
                            $row = $db_res->fetchRow();
                            if (array_var($row, 'old_members') != "") {
                                $from[$obj->getId()] = $row['old_members'];
                            }
                            // remove from previous members
                            ObjectMembers::delete('`object_id` = ' . $obj->getId() . ' AND `member_id` IN (
							SELECT `m`.`id` FROM `' . TABLE_PREFIX . 'members` `m` WHERE `m`.`dimension_id` = ' . $dim_id . ')');
                        }
                        $obj->addToMembers(array());
                        $obj->addToSharingTable();
                        $objects[] = $obj;
                    }
                    $display_name = $dimension->getName();
                    $lang_key = count($ids) > 1 ? 'objects removed from' : 'object removed from';
                    $log_datas = array();
                    $actions = array();
                    // add to application logs
//.........这里部分代码省略.........
开发者ID:abhinay100,项目名称:feng_app,代码行数:101,代码来源:MemberController.class.php

示例13: mail_accounts

 function mail_accounts()
 {
     if (!can_manage_security(logged_user())) {
         flash_error(lang('no access permissions'));
         ajx_current("empty");
         return;
     }
     if (Plugins::instance()->isActivePlugin('mail')) {
         //$my_accounts = MailAccounts::getMailAccountsByUser(logged_user());
         $all_accounts = MailAccounts::findAll();
     }
     //tpl_assign('my_accounts', $my_accounts);
     tpl_assign('all_accounts', $all_accounts);
 }
开发者ID:abhinay100,项目名称:feng_app,代码行数:14,代码来源:AdministrationController.class.php

示例14: enable_disable_dimensions

 function enable_disable_dimensions()
 {
     ajx_current("empty");
     if (!can_manage_configuration(logged_user())) {
         flash_error(lang('no access permissions'));
         ajx_current("empty");
         return;
     }
     $dims = json_decode(array_var($_REQUEST, 'dims'), true);
     //check active dims
     $at_least_one_dim_enabled = false;
     foreach ($dims as $dim_id => $enabled) {
         if ($enabled == true) {
             $at_least_one_dim_enabled = true;
             break;
         }
     }
     if (!$at_least_one_dim_enabled) {
         flash_error(lang('at least one dimension must be selected'));
         ajx_current("empty");
         return;
     }
     $root_dids = explode(",", user_config_option('root_dimensions', null, logged_user()->getId()));
     $update_root_dimensions = false;
     $enabled_dim_vals = array();
     foreach ($dims as $dim_id => $enabled) {
         if ($enabled) {
             $enabled_dim_vals[] = $dim_id;
             if (!in_array($dim_id, $root_dids)) {
                 $root_dids[] = $dim_id;
                 $update_root_dimensions = true;
             }
             $dim = Dimensions::findById($dim_id);
             if (($dim->getCode() == 'workspaces' || $dim->getCode() == 'tags') && !Plugins::instance()->isActivePlugin('workspaces')) {
                 $plugin = Plugins::instance()->findOne(array('conditions' => "name='workspaces'"));
                 if ($plugin instanceof Plugin) {
                     $plugin->activate();
                 }
             } else {
                 if ($dim->getCode() == 'customer_project' && !Plugins::instance()->isActivePlugin('crpm')) {
                     $plugin = Plugins::instance()->findOne(array('conditions' => "name='crpm'"));
                     if ($plugin instanceof Plugin) {
                         $plugin->activate();
                     }
                 }
             }
         }
     }
     set_config_option('enabled_dimensions', implode(',', $enabled_dim_vals));
     if ($update_root_dimensions) {
         set_user_config_option('root_dimensions', implode(',', $root_dids), logged_user()->getId());
     }
     ajx_extra_data(array('ok' => '1'));
 }
开发者ID:abhinay100,项目名称:feng_app,代码行数:54,代码来源:MoreController.class.php

示例15: getTemplatePath

	/**
	 * Return path of specific template
	 *
	 * @access public
	 * @param string $template
	 * @param string $controller_name
	 * @return string
	 */
	static function getTemplatePath($template, $controller_name = null, $plugin = null ) {
		if ($plugin) {
			$template_path = ROOT."/plugins/$plugin/application/views/$controller_name/$template.php";
			return $template_path;
		}
		
		if ($plugin = Plugins::instance()->getCurrent()){
			//$template_path = ROOT."/plugins/$plugin/application/views/$controller_name/$template.php";
			$template_path = $plugin->getViewPath()."$controller_name/$template.php";
			if ( is_file($template_path) ) {
				
				return $template_path ;
			}
		}
		
		if($controller_name) {
			return APPLICATION_PATH . "/views/$controller_name/$template.php";
		} else {
			return APPLICATION_PATH . "/views/$template.php";
		} // if
	} // getTemplatePath
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:29,代码来源:Env.class.php


注:本文中的Plugins::instance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。