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


PHP Plugin::init方法代码示例

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


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

示例1: init

 function init()
 {
     parent::init();
     $this->esoTalk->addToHead("<style type='text/css'>.emoticon {width:16px; height:16px; background:url({$this->emoticonDir}emoticons.png); background-repeat:no-repeat}</style>");
     // Add the formatter
     $this->esoTalk->formatter->addFormatter("emoticons", "Formatter_Emoticons");
 }
开发者ID:bk-amahi,项目名称:esoTalk,代码行数:7,代码来源:plugin.php

示例2: init

 function init()
 {
     parent::init();
     // Add the hooks
     if ($this->esoTalk->action == "conversation") {
         $this->esoTalk->controller->addHook("formatForDisplay", array($this, "formatWordfilterForDisplay"));
     }
 }
开发者ID:jgknight,项目名称:Wordfilter-OLD,代码行数:8,代码来源:plugin.php

示例3: init

 function init()
 {
     parent::init();
     // Add the hooks
     if ($this->esoTalk->action == "join") {
         $this->esoTalk->controller->addHook("beforeAddMember", array($this, "addAccountField"));
         $this->esoTalk->controller->addHook("afterAddMember", array($this, "logInUser"));
     }
 }
开发者ID:jgknight,项目名称:AutoValidate-OLD,代码行数:9,代码来源:plugin.php

示例4: test_current_snapshot_uuid

 /**
  * Tests current_snapshot_uuid().
  *
  * @see current_snapshot_uuid()
  */
 public function test_current_snapshot_uuid()
 {
     global $customize_snapshots_plugin;
     $this->assertNull(current_snapshot_uuid());
     $uuid = '65aee1ff-af47-47df-9e14-9c69b3017cd3';
     $_REQUEST['customize_snapshot_uuid'] = $uuid;
     $customize_snapshots_plugin = new Plugin();
     $customize_snapshots_plugin->init();
     $this->assertEquals($uuid, current_snapshot_uuid());
 }
开发者ID:xwp,项目名称:wp-customize-snapshots,代码行数:15,代码来源:test-customize-snapshots.php

示例5: __construct

 public function __construct()
 {
     global $config;
     session_start();
     $config['PLUGIN_PATH'] = __ROOTDIR__ . '/plugins/';
     $this->config = $config;
     $this->model = self::initModel($this->config);
     $this->cache = self::initCache($this->config);
     $this->init();
     Plugin::init('Admin', $config);
     $langCon = Lang::langCon();
     $this->config = array_merge((array) $config, (array) $langCon);
 }
开发者ID:JamesKid,项目名称:teach,代码行数:13,代码来源:commonModel.class.php

示例6: unset

 /**
  * Test updating a snapshot when the user does not have the customize_publish capability.
  *
  * @covers \CustomizeSnapshots\Customize_Snapshot_Manager::handle_update_snapshot_request()
  */
 function test_ajax_update_snapshot_ok_for_draft_and_pending_but_not_future()
 {
     unset($GLOBALS['wp_customize']);
     remove_all_actions('wp_ajax_' . Customize_Snapshot_Manager::AJAX_ACTION);
     $post_type_obj = get_post_type_object(Post_Type::SLUG);
     $setting_key = 'anyonecanedit';
     add_filter('user_has_cap', function ($allcaps, $caps, $args) {
         $allcaps['customize'] = true;
         if (!empty($allcaps['edit_posts']) && !empty($args) && 'customize' === $args[0]) {
             $allcaps = array_merge($allcaps, array_fill_keys($caps, true));
         }
         return $allcaps;
     }, 10, 3);
     $tomorrow = date('Y-m-d H:i:s', time() + 86400);
     $this->set_current_user('contributor');
     $this->assertFalse(current_user_can($post_type_obj->cap->publish_posts));
     $post_vars = array('action' => Customize_Snapshot_Manager::AJAX_ACTION, 'nonce' => wp_create_nonce(Customize_Snapshot_Manager::AJAX_ACTION), 'customize_snapshot_uuid' => self::UUID, 'customized' => wp_json_encode(array($setting_key => 'Hello')), 'publish_date' => $tomorrow);
     $this->plugin = new Plugin();
     $this->plugin->init();
     $this->add_setting();
     // Draft pass.
     $post_vars['status'] = 'draft';
     $this->set_input_vars($post_vars);
     $this->make_ajax_call(Customize_Snapshot_Manager::AJAX_ACTION);
     $response = json_decode($this->_last_response, true);
     $this->_last_response = '';
     $this->assertTrue($response['success']);
     // Pending pass.
     $post_vars['status'] = 'pending';
     $this->set_input_vars($post_vars);
     $this->make_ajax_call(Customize_Snapshot_Manager::AJAX_ACTION);
     $response = json_decode($this->_last_response, true);
     $this->_last_response = '';
     $this->assertTrue($response['success']);
     // Future fail.
     $post_vars['status'] = 'future';
     $this->set_input_vars($post_vars);
     $this->make_ajax_call(Customize_Snapshot_Manager::AJAX_ACTION);
     $response = json_decode($this->_last_response, true);
     $expected_results = array('success' => false, 'data' => 'customize_not_allowed');
     $this->assertSame($expected_results, $response);
 }
开发者ID:xwp,项目名称:wp-customize-snapshots,代码行数:47,代码来源:test-class-ajax-customize-snapshot-manager.php

示例7: __construct

 public function __construct()
 {
     global $config;
     @session_start();
     if (!file_exists('data/install.lock')) {
         $this->redirect(__ROOT__ . '/install/');
     }
     $config['PLUGIN_PATH'] = __ROOTDIR__ . '/plugins/';
     $this->config = $config;
     $this->model = self::initModel($this->config);
     $this->init();
     Plugin::init();
     $langCon = Lang::langCon();
     $this->config = array_merge((array) $config, (array) $langCon);
     if ($config['LANG_OPEN']) {
         define('__INDEX__', __APP__ . '/' . __LANG__);
     } else {
         define('__INDEX__', __APP__);
     }
 }
开发者ID:JamesKid,项目名称:teach,代码行数:20,代码来源:commonMod.class.php

示例8: __construct

 public function __construct()
 {
     global $config;
     $session_name = session_name();
     if (!isset($_COOKIE[$session_name])) {
         foreach ($_COOKIE as $key => $val) {
             $key = strtoupper($key);
             if (strpos($key, $session_name)) {
                 session_id($_COOKIE[$key]);
             }
         }
     }
     @session_start();
     $config['PLUGIN_PATH'] = __ROOTDIR__ . '/plugins/';
     $this->config = $config;
     $this->model = self::initModel($this->config);
     $this->init();
     $this->check_login();
     Plugin::init('Admin', $config);
     $langCon = Lang::langCon();
     $this->config = array_merge((array) $config, (array) $langCon);
 }
开发者ID:JamesKid,项目名称:teach,代码行数:22,代码来源:commonMod.class.php

示例9: __construct

 /**
  * Protected Construct
  */
 protected function __construct()
 {
     /**
      * Load core defines
      */
     Monstra::loadDefines();
     /**
      * Compress HTML with gzip
      */
     if (MONSTRA_GZIP) {
         if (!ob_start("ob_gzhandler")) {
             ob_start();
         }
     } else {
         ob_start();
     }
     /**
      * Send default header and set internal encoding
      */
     header('Content-Type: text/html; charset=UTF-8');
     function_exists('mb_language') and mb_language('uni');
     function_exists('mb_regex_encoding') and mb_regex_encoding('UTF-8');
     function_exists('mb_internal_encoding') and mb_internal_encoding('UTF-8');
     /**
      * Gets the current configuration setting of magic_quotes_gpc
      * and kill magic quotes
      */
     if (get_magic_quotes_gpc()) {
         function stripslashesGPC(&$value)
         {
             $value = stripslashes($value);
         }
         array_walk_recursive($_GET, 'stripslashesGPC');
         array_walk_recursive($_POST, 'stripslashesGPC');
         array_walk_recursive($_COOKIE, 'stripslashesGPC');
         array_walk_recursive($_REQUEST, 'stripslashesGPC');
     }
     /**
      * Set Gelato Display Errors to False for Production environment.
      */
     if (Monstra::$environment == Monstra::PRODUCTION) {
         define('GELATO_DEVELOPMENT', false);
     }
     /**
      * Define Monstra Folder for Gelato Logs
      */
     define('GELATO_LOGS_PATH', LOGS);
     /**
      * Include Gelato Library
      */
     include ROOT . DS . 'libraries' . DS . 'Gelato' . DS . 'Gelato.php';
     /**
      * Map Monstra Engine Directory
      */
     ClassLoader::directory(ROOT . DS . 'engine' . DS);
     /**
      * Map all Monstra Classes
      */
     ClassLoader::mapClasses(array('Security' => ROOT . DS . 'engine' . DS . 'Security.php', 'Uri' => ROOT . DS . 'engine' . DS . 'Uri.php', 'Site' => ROOT . DS . 'engine' . DS . 'Site.php', 'Alert' => ROOT . DS . 'engine' . DS . 'Alert.php', 'XML' => ROOT . DS . 'engine' . DS . 'Xmldb' . DS . 'XML.php', 'DB' => ROOT . DS . 'engine' . DS . 'Xmldb' . DS . 'DB.php', 'Table' => ROOT . DS . 'engine' . DS . 'Xmldb' . DS . 'Table.php', 'Plugin' => ROOT . DS . 'engine' . DS . 'Plugin' . DS . 'Plugin.php', 'Frontend' => ROOT . DS . 'engine' . DS . 'Plugin' . DS . 'Frontend.php', 'Backend' => ROOT . DS . 'engine' . DS . 'Plugin' . DS . 'Backend.php', 'Action' => ROOT . DS . 'engine' . DS . 'Plugin' . DS . 'Action.php', 'Filter' => ROOT . DS . 'engine' . DS . 'Plugin' . DS . 'Filter.php', 'View' => ROOT . DS . 'engine' . DS . 'Plugin' . DS . 'View.php', 'I18n' => ROOT . DS . 'engine' . DS . 'Plugin' . DS . 'I18n.php', 'Stylesheet' => ROOT . DS . 'engine' . DS . 'Plugin' . DS . 'Stylesheet.php', 'Javascript' => ROOT . DS . 'engine' . DS . 'Plugin' . DS . 'Javascript.php', 'Navigation' => ROOT . DS . 'engine' . DS . 'Plugin' . DS . 'Navigation.php', 'Option' => ROOT . DS . 'engine' . DS . 'Option.php', 'Shortcode' => ROOT . DS . 'engine' . DS . 'Shortcode.php', 'ORM' => ROOT . DS . 'libraries' . DS . 'Idiorm' . DS . 'ORM.php', 'PHPMailer' => ROOT . DS . 'libraries' . DS . 'PHPMailer' . DS . 'PHPMailer.php'));
     /**
      *  Start session
      */
     Session::start();
     /**
      * Init Idiorm
      */
     if (defined('MONSTRA_DB_DSN')) {
         ORM::configure(MONSTRA_DB_DSN);
         ORM::configure('username', MONSTRA_DB_USER);
         ORM::configure('password', MONSTRA_DB_PASSWORD);
         ORM::configure('driver_options', array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'));
     }
     /**
      * Auto cleanup if DEVELOPMENT environment
      */
     if (Monstra::$environment == Monstra::DEVELOPMENT) {
         Monstra::cleanTmp();
     }
     /**
      * Set Cache dir
      */
     Cache::configure('cache_dir', CACHE);
     /**
      * Init Options API module
      */
     Option::init();
     /**
      * Set default timezone
      */
     @ini_set('date.timezone', Option::get('timezone'));
     if (function_exists('date_default_timezone_set')) {
         date_default_timezone_set(Option::get('timezone'));
     } else {
         putenv('TZ=' . Option::get('timezone'));
     }
     /**
      * Sanitize URL to prevent XSS - Cross-site scripting
//.........这里部分代码省略.........
开发者ID:Repkit,项目名称:monstra,代码行数:101,代码来源:Monstra.php

示例10: plugin

 function plugin()
 {
     if ($this->method !== 'post') {
         $this->error('403', 'Forbidden');
         return;
     }
     $local = $this->input->post('local_path');
     $guid = $this->input->post('guid');
     $install_id = $this->input->post('uuid');
     $purchase = $this->input->post('purchase');
     $is_new = $this->input->post('new');
     $plugin_id = $this->input->post('id');
     $base = FCPATH . 'storage' . DIRECTORY_SEPARATOR;
     $tmp_path = $base . 'tmp';
     $remote = KOKEN_STORE_URL . '/plugins/download/' . $guid . '/for/' . $install_id . ($purchase ? '/' . $purchase : '');
     $local_zip = $tmp_path . DIRECTORY_SEPARATOR . 'update.zip';
     $updated_theme = $tmp_path . DIRECTORY_SEPARATOR . $guid;
     $current_path = $base . $local;
     if (is_dir("{$current_path}.off")) {
         delete_files("{$current_path}.off", true, 1);
     }
     if (is_dir("{$current_path}/.git")) {
         delete_files("{$current_path}/.git", true, 1);
     }
     make_child_dir($tmp_path);
     $success = false;
     $old_mask = umask(0);
     if (ENVIRONMENT === 'development' && !$is_new) {
         $success = true;
         sleep(3);
     } else {
         if ($this->_download($remote, $local_zip)) {
             $this->load->library('unzip');
             $this->unzip->extract($local_zip);
             if (file_exists($updated_theme . DIRECTORY_SEPARATOR . 'info.json') || file_exists($updated_theme . DIRECTORY_SEPARATOR . 'pulse.json') || file_exists($updated_theme . DIRECTORY_SEPARATOR . 'plugin.json')) {
                 if ($is_new || rename($current_path, "{$current_path}.off")) {
                     if (rename($updated_theme, $current_path)) {
                         // Hack for watermark update issue. Can removed this eventually (0.15.1 was when this was implemented)
                         if (file_exists("{$current_path}.off/image.png")) {
                             copy("{$current_path}.off/image.png", "{$current_path}/storage/image.png");
                         }
                         // /Hack
                         // Copy storage folder to ensure userland files survive update
                         if (is_dir("{$current_path}.off/storage")) {
                             delete_files("{$current_path}/storage", true, 1);
                             rename("{$current_path}.off/storage", "{$current_path}/storage");
                         }
                         delete_files("{$current_path}.off", true, 1);
                         $success = true;
                         if (file_exists($current_path . DIRECTORY_SEPARATOR . 'info.json')) {
                             $json = $current_path . DIRECTORY_SEPARATOR . 'info.json';
                         } else {
                             if (file_exists($current_path . DIRECTORY_SEPARATOR . 'pulse.json')) {
                                 $json = $current_path . DIRECTORY_SEPARATOR . 'pulse.json';
                             } else {
                                 $json = $current_path . DIRECTORY_SEPARATOR . 'plugin.json';
                             }
                         }
                         $json = json_decode(file_get_contents($json, true));
                     } else {
                         $json = 'Could not rename folder.';
                     }
                 } else {
                     $json = 'Could not rename old version before upgrading';
                 }
             } else {
                 $json = 'Could not download plugin ZIP.';
             }
             unlink($local_zip);
             delete_files($updated_theme, true, 1);
         }
     }
     umask($old_mask);
     if ($plugin_id) {
         $p = new Plugin();
         $p->where('id', $plugin_id)->get();
         if ($p->exists()) {
             $plugins = $this->parse_plugins();
             $plugin = $p->init($plugins);
             if ($plugin->database_fields) {
                 $db_config = Shutter::get_db_configuration();
                 $this->load->dbforge();
                 foreach ($plugin->database_fields as $table => $fields) {
                     $table = $db_config['prefix'] . $table;
                     foreach ($fields as $column => $info) {
                         if (in_array(strtolower($info['type']), array('text', 'varchar', 'longtext'))) {
                             $info['null'] = true;
                         }
                         $this->dbforge->add_column($table, array($column => $info));
                     }
                 }
                 $this->_clear_datamapper_cache();
             }
             $p->run_plugin_method('after_upgrade', $plugins);
         }
     }
     $this->_compile_plugins();
     die(json_encode(array('done' => $success, 'info' => isset($json) ? $json : array())));
 }
开发者ID:Atomox,项目名称:benhelmerphotography,代码行数:99,代码来源:update.php

示例11: testInit

 public function testInit()
 {
     $this->object->init();
     $this->assertSame(['aliases' => ['@dns' => '/dns/', '@more' => '/more'], 'modules' => ['dns' => 'dns config here'], 'components' => ['i18n' => 'i18n config here']], $this->object->getItems());
 }
开发者ID:hiqdev,项目名称:yii2-pluginmanager,代码行数:5,代码来源:PluginTest.php

示例12: test_init

 /**
  * Test that all required actions and filters are added as expected
  */
 function test_init()
 {
     Plugin::init();
     $this->do_action_validation('widgets_init', [__NAMESPACE__ . '\\Plugin', 'register_widgets']);
 }
开发者ID:godaddy,项目名称:wp-contact-widgets,代码行数:8,代码来源:test-class-plugin.php

示例13: index

 function index()
 {
     if (!$this->auth) {
         $this->error('401', 'Not authorized to perform this action.');
         return;
     }
     list($params, $id) = $this->parse_params(func_get_args());
     $plugins = $this->parse_plugins();
     $db_config = Shutter::get_db_configuration();
     switch ($this->method) {
         case 'delete':
             $p = new Plugin();
             $p->where('id', $id)->get();
             if ($p->exists()) {
                 $p->run_plugin_method('after_uninstall', $plugins);
                 $plugin = $p->init($plugins);
                 if ($plugin->database_fields) {
                     $this->load->dbforge();
                     foreach ($plugin->database_fields as $table => $fields) {
                         $table = $db_config['prefix'] . $table;
                         foreach ($fields as $column => $info) {
                             $this->dbforge->drop_column($table, $column);
                         }
                     }
                     $this->_clear_datamapper_cache();
                 }
                 $p->delete();
             }
             $this->_compile_plugins();
             exit;
             break;
         case 'post':
             $p = new Plugin();
             $p->path = $_POST['path'];
             $p->setup = $p->run_plugin_method('require_setup', $plugins) === false;
             if ($p->save()) {
                 $plugin = $p->init($plugins);
                 if ($plugin->database_fields) {
                     $this->load->dbforge();
                     foreach ($plugin->database_fields as $table => $fields) {
                         $table = $db_config['prefix'] . $table;
                         foreach ($fields as $column => $info) {
                             $this->dbforge->add_column($table, array($column => $info));
                         }
                     }
                     $this->_clear_datamapper_cache();
                 }
                 $p->run_plugin_method('after_install', $plugins);
             }
             $this->_compile_plugins();
             $this->redirect('/plugins');
             break;
         case 'put':
             unset($_POST['_method']);
             $data = serialize($_POST);
             $p = new Plugin();
             $p->where('id', $id)->get();
             $p->save_data($plugins, $_POST);
             $validate = $p->run_plugin_method('confirm_setup', $plugins, $data);
             if ($validate === true) {
                 $p->setup = 1;
                 $p->save();
                 $this->_compile_plugins();
                 exit;
             } else {
                 $this->error(400, $validate);
                 return;
             }
             break;
         default:
             $data = array('plugins' => $plugins);
             function sortByName($a, $b)
             {
                 return $a['name'] > $b['name'];
             }
             usort($data['plugins'], 'sortByName');
             $data['plugins'] = Shutter::filter('api.plugins', array($data['plugins']));
             $data['custom_sources'] = Shutter::$custom_sources;
             $this->set_response_data($data);
             break;
     }
 }
开发者ID:Atomox,项目名称:benhelmerphotography,代码行数:82,代码来源:plugins.php

示例14: array

    $_FILES = array_map(array('Toolbox', 'clean_cross_side_scripting_deep'), $_FILES);
}
// Mark if Header is loaded or not :
$HEADER_LOADED = false;
$FOOTER_LOADED = false;
if (isset($AJAX_INCLUDE)) {
    $HEADER_LOADED = true;
}
/* On startup, register all plugins configured for use. */
if (!isset($AJAX_INCLUDE) && !isset($PLUGINS_INCLUDED)) {
    // PLugin already included
    $PLUGINS_INCLUDED = 1;
    $LOADED_PLUGINS = array();
    $plugin = new Plugin();
    if (!isset($_SESSION["glpi_plugins"])) {
        $plugin->init();
    }
    if (isset($_SESSION["glpi_plugins"]) && is_array($_SESSION["glpi_plugins"])) {
        //Plugin::doHook("config");
        if (count($_SESSION["glpi_plugins"])) {
            foreach ($_SESSION["glpi_plugins"] as $name) {
                Plugin::load($name);
            }
        }
        // For plugins which require action after all plugin init
        Plugin::doHook("post_init");
    }
}
if (!isset($_SESSION["MESSAGE_AFTER_REDIRECT"])) {
    $_SESSION["MESSAGE_AFTER_REDIRECT"] = "";
}
开发者ID:gaforeror,项目名称:glpi,代码行数:31,代码来源:includes.php

示例15: array

 /**
  * @see Plugin::init()
  */
 function test_init()
 {
     $this->plugin->init();
     $this->assertInstanceOf('WP_Widget_Factory', $this->plugin->widget_factory);
     $this->assertNotFalse(has_action('wp_default_scripts', array($this->plugin, 'register_scripts')));
 }
开发者ID:BE-Webdesign,项目名称:wp-customize-widgets-plus,代码行数:9,代码来源:test-class-plugin.php


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