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


PHP Plugin::activate方法代码示例

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


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

示例1: activate_plugin

 function activate_plugin($plugin)
 {
     if (!AuthUser::hasPermission('administrator')) {
         Flash::set('error', __('You do not have permission to access the requested page!'));
         redirect(get_url());
     }
     Plugin::activate($plugin);
 }
开发者ID:albertobraschi,项目名称:toad,代码行数:8,代码来源:SettingController.php

示例2: boot

 /**
  * Bootstrap the application events.
  *
  * @return void
  */
 public function boot()
 {
     \Route::any('plugins', function () {
         \Plugin::activate('clients');
         echo 'hello';
         //print_r(\Plugin::activated());
     });
 }
开发者ID:fluentkit,项目名称:plugin,代码行数:13,代码来源:PluginServiceProvider.php

示例3:

    $migration->displayWarning("***** Install process of plugin TIMELINETICKET *****");
} else {
    $migration->displayWarning("***** Update process of plugin TIMELINETICKET *****");
}
$migration->displayWarning("Current Timelineticket version: {$current_version}");
$migration->displayWarning("Version to update: " . PLUGIN_TIMELINETICKET_VERSION);
// To prevent problem of execution time
ini_set("max_execution_time", "0");
ini_set("memory_limit", "-1");
$mess = '';
if ($current_version != PLUGIN_TIMELINETICKET_VERSION and $current_version != '0') {
    $mess = "Update done.";
} else {
    if ($current_version == PLUGIN_TIMELINETICKET_VERSION) {
        $mess = "No migration needed.";
    } else {
        $mess = "installation done.";
    }
}
$plugin->getFromDBbyDir("timelineticket");
$plugin->install($plugin->fields['id']);
plugin_timelineticket_install();
$migration->displayWarning($mess);
$plugin->load("timelineticket");
$plugin->activate($plugin->fields['id']);
$plugin->load("timelineticket");
if (in_array('--optimize', $_SERVER['argv'])) {
    $migration->displayTitle("Optimizing tables");
    DBmysql::optimize_tables($migration);
    $migration->displayWarning("Optimize done.");
}
开发者ID:pluginsGLPI,项目名称:timelineticket,代码行数:31,代码来源:cli_install.php

示例4: _t

		$response['error'] = 1;
		$response['message'] = _t('관리자만이 이 기능을 사용할 수 있습니다.');
	} else {
		$response['error'] = 1;

		$pluginName = $_POST['plugin'];
		$ting = (isset($_POST['ting']) && !empty($_POST['ting'])) ? Validator::getBool($_POST['ting']) : null;

		if (!preg_match('/^[A-Za-z0-9 _-]+$/', $pluginName)) {
			$response['message'] = _t('잘못된 플러그인 이름입니다');
			func::printRespond($response);
		}

		if (!is_dir(ROOT . '/plugins/'.$pluginName)) {
			$response['message'] = _t('플러그인이 존재하지 않습니다');
			func::printRespond($response);
		}

		if (!file_exists(ROOT . '/plugins/'.$pluginName.'/index.xml')) {
			$response['message'] = _t('플러그인 정보를 찾을 수 없습니다');
			func::printRespond($response);
		}

		if (Plugin::activate($pluginName, $ting))
			$response['error'] = 0;
	}


	func::printRespond($response);
?>
开发者ID:ncloud,项目名称:bloglounge,代码行数:30,代码来源:activate.php

示例5: activate_plugin

 /**
  * Can be used to activate a plugin.
  *
  * @param string $plugin The plugin id.
  */
 public final function activate_plugin($plugin)
 {
     Plugin::activate($plugin);
     Observer::notify('plugin_after_enable', $plugin);
 }
开发者ID:sindotnet,项目名称:cona,代码行数:10,代码来源:SettingController.php

示例6: setUp

 protected function setUp()
 {
     global $CFG_GLPI, $DB;
     $DB = new DB();
     // Force profile in session to SuperAdmin
     $_SESSION['glpiprofiles'] = array('4' => array('entities' => 0));
     $_SESSION['glpi_plugin_fusioninventory_profile']['unmanaged'] = 'w';
     $_SESSION['glpiactiveentities'] = array(0, 1);
     $_SESSION['glpi_use_mode'] = Session::NORMAL_MODE;
     require GLPI_ROOT . "/inc/includes.php";
     $plugin = new Plugin();
     $DB->connect();
     $plugin->getFromDBbyDir("fusioninventory");
     $plugin->activate($plugin->fields['id']);
     file_put_contents(GLPI_ROOT . "/files/_log/sql-errors.log", '');
     file_put_contents(GLPI_ROOT . "/files/_log/php-errors.log", '');
     $dir = GLPI_ROOT . "/files/_files/_plugins/fusioninventory";
     if (file_exists($dir)) {
         $objects = scandir($dir);
         foreach ($objects as $object) {
             if ($object != "." && $object != "..") {
                 if (filetype($dir . "/" . $object) == "dir") {
                 } else {
                     unlink($dir . "/" . $object);
                 }
             }
         }
     }
     include_once GLPI_ROOT . "/inc/timer.class.php";
     // Security of PHP_SELF
     $_SERVER['PHP_SELF'] = Html::cleanParametersURL($_SERVER['PHP_SELF']);
     //      function glpiautoload($classname) {
     //         global $DEBUG_AUTOLOAD, $CFG_GLPI;
     //         static $notfound = array();
     //
     //         // empty classname or non concerted plugin
     //         if (empty($classname) || is_numeric($classname)) {
     //            return FALSE;
     //         }
     //
     //         $dir=GLPI_ROOT . "/inc/";
     //         //$classname="PluginExampleProfile";
     //         if ($plug=isPluginItemType($classname)) {
     //            $plugname=strtolower($plug['plugin']);
     //            $dir=GLPI_ROOT . "/plugins/$plugname/inc/";
     //            $item=strtolower($plug['class']);
     //            // Is the plugin activate ?
     //            // Command line usage of GLPI : need to do a real check plugin activation
     //            if (isCommandLine()) {
     //               $plugin = new Plugin();
     //               if (count($plugin->find("directory='$plugname' AND state=".Plugin::ACTIVATED)) == 0) {
     //                  // Plugin does not exists or not activated
     //                  return FALSE;
     //               }
     //            } else {
     //               // Standard use of GLPI
     //               if (!in_array($plugname, $_SESSION['glpi_plugins'])) {
     //                  // Plugin not activated
     //                  return FALSE;
     //               }
     //            }
     //         } else {
     //            // Is ezComponent class ?
     //            $matches = array();
     //            if (preg_match('/^ezc([A-Z][a-z]+)/', $classname, $matches)) {
     //               include_once(GLPI_EZC_BASE);
     //               ezcBase::autoload($classname);
     //               return TRUE;
     //            } else {
     //               $item=strtolower($classname);
     //            }
     //         }
     //
     //         // No errors for missing classes due to implementation
     //         if (!isset($CFG_GLPI['missingclasses'])
     //                 OR !in_array($item, $CFG_GLPI['missingclasses'])){
     //            if (file_exists("$dir$item.class.php")) {
     //               include_once ("$dir$item.class.php");
     //               if ($_SESSION['glpi_use_mode']==Session::DEBUG_MODE) {
     //                  $DEBUG_AUTOLOAD[]=$classname;
     //               }
     //
     //            } else if (!isset($notfound["$classname"])) {
     //               // trigger an error to get a backtrace, but only once (use prefix 'x' to handle empty case)
     //               //Toolbox::logInFile('debug', "file $dir$item.class.php not founded trying to load class $classname\n");
     //               trigger_error("GLPI autoload : file $dir$item.class.php not founded trying to load class '$classname'");
     //               $notfound["$classname"] = TRUE;
     //            }
     //         }
     //      }
     //
     //      spl_autoload_register('glpiautoload');
     //      restore_error_handler();
     //      error_reporting(E_ALL | E_STRICT);
     //      ini_set('display_errors', 'On');
     ini_set("memory_limit", "-1");
     ini_set("max_execution_time", "0");
 }
开发者ID:korial29,项目名称:fusioninventory-for-glpi,代码行数:98,代码来源:Common_TestCase.php

示例7: spl_autoload_register

 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
namespace dwalkr\WPAdminUtility;

/**
 * psr-4 autoloader
 * http://www.php-fig.org/psr/psr-4/
 */
spl_autoload_register(function ($class) {
    $prefix = __NAMESPACE__;
    $base_dir = dirname(__FILE__) . '/src';
    $len = strlen($prefix);
    if (strncmp($prefix, $class, $len) !== 0) {
        return;
    }
    $relative_class = substr($class, $len);
    $file = $base_dir . str_replace('\\', '/', $relative_class) . '.php';
    if (file_exists($file)) {
        require $file;
    }
});
register_activation_hook(__FILE__, function () {
    Plugin::activate();
});
add_action('plugins_loaded', function () {
    Plugin::register(plugin_dir_path(__FILE__), plugin_dir_url(__FILE__));
});
开发者ID:dwalkr,项目名称:wp-admin-utility,代码行数:31,代码来源:wp-admin-utility.php

示例8: manageTicket

 private function manageTicket($closed = true)
 {
     global $DB, $CFG_GLPI;
     $DB->connect();
     $_SESSION['glpiactive_entity'] = 0;
     $CFG_GLPI['root_doc'] = "http://127.0.0.1/fusion0.83/";
     $plugin = new Plugin();
     $plugin->getFromDBbyDir("timelineticket");
     $plugin->activate($plugin->fields['id']);
     Plugin::load("timelineticket");
     Session::loadLanguage("en_GB");
     $ticket = new Ticket();
     $group = new Group();
     $group_ticket = new Group_Ticket();
     $GLPIlog = new GLPIlogs();
     $ticket_User = new Ticket_User();
     $_SESSION['plugin_timelineticket_date'] = array();
     $group->add(array('name' => 'grtech1'));
     $group->add(array('name' => 'grtech2'));
     // * 01/
     $_SESSION["glpi_currenttime"] = date("Y-m-d H:i:s");
     $a_storedate = array('1' => $_SESSION["glpi_currenttime"]);
     $input = array();
     $input['name'] = 'Pb with the ticket';
     $input['content'] = 'I have a problem with the ticket';
     $tickets_id = $ticket->add($input);
     $GLPIlog->testSQLlogs('01/');
     $GLPIlog->testPHPlogs('01/');
     // * 02/
     sleep(2);
     // * 03/
     $_SESSION["glpi_currenttime"] = date("Y-m-d H:i:s");
     $a_storedate[3] = $_SESSION["glpi_currenttime"];
     $input = array();
     $input['id'] = $tickets_id;
     $input['_itil_assign']['_type'] = 'group';
     $input['_itil_assign']['groups_id'] = 1;
     $ticket->update($input);
     $input['_itil_assign']['_type'] = 'user';
     $input['_itil_assign']['users_id'] = 2;
     $ticket->update($input);
     $GLPIlog->testSQLlogs('03/');
     $GLPIlog->testPHPlogs('03/');
     $a_db = getAllDatasFromTable('glpi_groups_tickets');
     $a_ref = array();
     $a_ref[1] = array('id' => '1', 'tickets_id' => '1', 'groups_id' => '1', 'type' => '2');
     $this->assertEquals($a_ref, $a_db, 'May have ticket assigned to group1');
     $a_db = getAllDatasFromTable('glpi_tickets_users');
     $a_ref = array();
     $a_ref[1] = array('id' => '1', 'tickets_id' => '1', 'users_id' => '2', 'type' => '1', 'use_notification' => '1', 'alternative_email' => '');
     $a_ref[2] = array('id' => '2', 'tickets_id' => '1', 'users_id' => '2', 'type' => '2', 'use_notification' => '1', 'alternative_email' => '');
     $this->assertEquals($a_ref, $a_db, 'May have ticket assigned to user 2 (glpi)');
     // * 04/
     sleep(2);
     // * 05/
     $_SESSION["glpi_currenttime"] = date("Y-m-d H:i:s");
     $a_storedate[5] = $_SESSION["glpi_currenttime"];
     $input = array();
     $input['id'] = $tickets_id;
     $input['status'] = Ticket::WAITING;
     $ticket->update($input);
     $GLPIlog->testSQLlogs('05/');
     $GLPIlog->testPHPlogs('05/');
     $ticket->getFromDB(1);
     $this->assertEquals('waiting', $ticket->fields['status'], 'May have status waiting');
     // * 06/
     sleep(1);
     // * 07/
     $_SESSION["glpi_currenttime"] = date("Y-m-d H:i:s");
     $a_storedate[7] = $_SESSION["glpi_currenttime"];
     $input = array();
     $input['id'] = 2;
     $input['itickets_id'] = $tickets_id;
     $ticket_User->check($input['id'], 'w');
     $ticket_User->delete($input);
     $input = array();
     $input['id'] = 1;
     $input['itickets_id'] = $tickets_id;
     $group_ticket->check($input['id'], 'w');
     $group_ticket->delete($input);
     $GLPIlog->testSQLlogs('07/');
     $GLPIlog->testPHPlogs('07/');
     $a_db = getAllDatasFromTable('glpi_groups_tickets');
     $this->assertEquals(array(), $a_db, 'May have no group assigned');
     // * 08/
     sleep(1);
     // * 09/
     $_SESSION["glpi_currenttime"] = date("Y-m-d H:i:s");
     $a_storedate[9] = $_SESSION["glpi_currenttime"];
     $input = array();
     $input['id'] = $tickets_id;
     $input['_itil_assign']['_type'] = 'group';
     $input['_itil_assign']['groups_id'] = 2;
     $ticket->update($input);
     $GLPIlog->testSQLlogs('09/');
     $GLPIlog->testPHPlogs('09/');
     $a_db = getAllDatasFromTable('glpi_groups_tickets');
     $a_ref = array();
     $a_ref[2] = array('id' => '2', 'tickets_id' => '1', 'groups_id' => '2', 'type' => '2');
     $this->assertEquals($a_ref, $a_db, 'May have ticket assigned to group2');
//.........这里部分代码省略.........
开发者ID:pluginsGLPI,项目名称:timelineticket,代码行数:101,代码来源:ManageTicket.php


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