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


PHP elgg_get_plugin_from_id函数代码示例

本文整理汇总了PHP中elgg_get_plugin_from_id函数的典型用法代码示例。如果您正苦于以下问题:PHP elgg_get_plugin_from_id函数的具体用法?PHP elgg_get_plugin_from_id怎么用?PHP elgg_get_plugin_from_id使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: au_cas_auth_authenticate

/**
 * 
 * @param array $credentials
 * @return unknown_type
 */
function au_cas_auth_authenticate($credentials)
{
    // do a redirect to the cas URL
    $config = elgg_get_plugin_from_id(PLUGIN_ID);
    send_to_cas($config, $credentials);
    return false;
}
开发者ID:AU-Landing-Project,项目名称:au_cas_auth,代码行数:12,代码来源:start.php

示例2: __construct

 /**
  * Loads the plugin by GUID or path.
  *
  * @warning Unlike other ElggEntity objects, you cannot null instantiate
  *          ElggPlugin. You must point it to an actual plugin GUID or location.
  *
  * @param mixed $plugin The GUID of the ElggPlugin object or the path of
  *                      the plugin to load.
  */
 public function __construct($plugin)
 {
     if (!$plugin) {
         throw new PluginException(elgg_echo('PluginException:NullInstantiated'));
     }
     // ElggEntity can be instantiated with a guid or an object.
     // @todo plugins w/id 12345
     if (is_numeric($plugin) || is_object($plugin)) {
         parent::__construct($plugin);
         $this->path = elgg_get_plugins_path() . $this->getID();
     } else {
         $plugin_path = elgg_get_plugins_path();
         // not a full path, so assume an id
         // use the default path
         if (strpos($plugin, $plugin_path) !== 0) {
             $plugin = $plugin_path . $plugin;
         }
         // path checking is done in the package
         $plugin = sanitise_filepath($plugin);
         $this->path = $plugin;
         $path_parts = explode('/', rtrim($plugin, '/'));
         $plugin_id = array_pop($path_parts);
         $this->pluginID = $plugin_id;
         // check if we're loading an existing plugin
         $existing_plugin = elgg_get_plugin_from_id($this->pluginID);
         $existing_guid = null;
         if ($existing_plugin) {
             $existing_guid = $existing_plugin->guid;
         }
         // load the rest of the plugin
         parent::__construct($existing_guid);
     }
 }
开发者ID:nachopavon,项目名称:Elgg,代码行数:42,代码来源:ElggPlugin.php

示例3: handle

 /**
  * {@inheritdoc}
  */
 protected function handle()
 {
     $plugins = elgg_get_plugins('inactive');
     if (empty($plugins)) {
         system_message('All plugins are active');
         return;
     }
     $ids = array_map(function (ElggPlugin $plugin) {
         return $plugin->getID();
     }, $plugins);
     $ids = array_values($ids);
     if ($this->option('all')) {
         $activate_ids = $ids;
     } else {
         $helper = $this->getHelper('question');
         $question = new ChoiceQuestion('Please select plugins you would like to activate (comma-separated list of indexes)', $ids);
         $question->setMultiselect(true);
         $activate_ids = $helper->ask($this->input, $this->output, $question);
     }
     if (empty($activate_ids)) {
         throw new \RuntimeException('You must select at least one plugin');
     }
     $plugins = [];
     foreach ($activate_ids as $plugin_id) {
         $plugins[] = elgg_get_plugin_from_id($plugin_id);
     }
     do {
         $additional_plugins_activated = false;
         foreach ($plugins as $key => $plugin) {
             if ($plugin->isActive()) {
                 unset($plugins[$key]);
                 continue;
             }
             if (!$plugin->activate()) {
                 // plugin could not be activated in this loop, maybe in the next loop
                 continue;
             }
             $ids = array('cannot_start' . $plugin->getID(), 'invalid_and_deactivated_' . $plugin->getID());
             foreach ($ids as $id) {
                 elgg_delete_admin_notice($id);
             }
             // mark that something has changed in this loop
             $additional_plugins_activated = true;
             unset($plugins[$key]);
             system_message("Plugin {$plugin->getFriendlyName()} has been activated");
         }
         if (!$additional_plugins_activated) {
             // no updates in this pass, break the loop
             break;
         }
     } while (count($plugins) > 0);
     if (count($plugins) > 0) {
         foreach ($plugins as $plugin) {
             $msg = $plugin->getError();
             $string = $msg ? 'admin:plugins:activate:no_with_msg' : 'admin:plugins:activate:no';
             register_error(elgg_echo($string, array($plugin->getFriendlyName())));
         }
     }
     elgg_flush_caches();
 }
开发者ID:hypejunction,项目名称:elgg-cli,代码行数:63,代码来源:PluginsActivateCommand.php

示例4: __construct

 /**
  * Creates a new plugin from path
  *
  * @note Internal: also supports database objects
  *
  * @warning Unlike other \ElggEntity objects, you cannot null instantiate
  *          \ElggPlugin. You must provide the path to the plugin directory.
  *
  * @param string $path The absolute path of the plugin
  *
  * @throws PluginException
  */
 public function __construct($path)
 {
     if (!$path) {
         throw new \PluginException("ElggPlugin cannot be null instantiated. You must pass a full path.");
     }
     if (is_object($path)) {
         // database object
         parent::__construct($path);
         $this->path = _elgg_services()->config->getPluginsPath() . $this->getID();
         _elgg_cache_plugin_by_id($this);
         return;
     }
     if (is_numeric($path)) {
         // guid
         // @todo plugins with directory names of '12345'
         throw new \InvalidArgumentException('$path cannot be a GUID');
     }
     $this->initializeAttributes();
     // path checking is done in the package
     $path = sanitise_filepath($path);
     $this->path = $path;
     $path_parts = explode('/', rtrim($path, '/'));
     $plugin_id = array_pop($path_parts);
     $this->title = $plugin_id;
     // check if we're loading an existing plugin
     $existing_plugin = elgg_get_plugin_from_id($plugin_id);
     if ($existing_plugin) {
         $this->load($existing_plugin->guid);
     }
     _elgg_cache_plugin_by_id($this);
 }
开发者ID:elgg,项目名称:elgg,代码行数:43,代码来源:ElggPlugin.php

示例5: recaptcha_check_form

/**
 * @param $hook
 * @param $type
 * @param $returnvalue
 * @param $params
 *
 * @return bool
 *
 * function called when the below plugin trigger is initiated
 * @see /engine/lib/actions.php
 * @see elgg_trigger_plugin_hook('action', $action, null, $event_result);
 *
 * this hook is triggered for the action = "register"
 * this hooks is called before the default "register" action handler at /actions/register.php
 * checks if recaptcha is valid - if not register an error
 */
function recaptcha_check_form($hook, $type, $returnvalue, $params)
{
    // retain entered form values and re-populate form fields if validation error
    elgg_make_sticky_form('register');
    /*-- check if the 'Use Recaptcha for user registration' Plugin setting is enabled --*/
    //fetch the plugin settings
    $plugin_entity = elgg_get_plugin_from_id('recaptcha');
    $plugin_settings = $plugin_entity->getAllSettings();
    if (array_key_exists('recaptcha_verified', $_SESSION) && $_SESSION['recaptcha_verified'] == 1) {
        //do nothing
    } else {
        if ($plugin_settings['require_recaptcha'] == 'on') {
            //if the setting is enabled
            // include the recaptcha lib
            require_once 'lib/recaptchalib.php';
            // check the recaptcha
            $resp = recaptcha_check_answer($plugin_settings['recaptcha_private_key'], $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]);
            if (!$resp->is_valid) {
                register_error(elgg_echo('recaptcha:human_verification_failed'));
                forward(REFERER);
            } else {
                /* note that the user has successfully passed the captcha
                 * in case the form submission fails due to other factors, we do not want to
                 * ask the user to fill in the captcha details again
                 * so we store it in a session variable and destroy it after the form is successfully submitted
                 */
                $_SESSION['recaptcha_verified'] = 1;
            }
        }
    }
    return true;
}
开发者ID:naveensnayak,项目名称:recaptcha,代码行数:48,代码来源:start.php

示例6: factory

 public static function factory()
 {
     if (null === self::$instance) {
         $plugin = elgg_get_plugin_from_id('hypeDropzone');
         self::$instance = new self($plugin);
     }
     return self::$instance;
 }
开发者ID:royalterra,项目名称:hypeDropzone,代码行数:8,代码来源:Plugin.php

示例7: hypeInbox

/**
 * Plugin container
 * 
 * @return \hypeJunction\Inbox\Plugin
 * @access private since 6.0
 */
function hypeInbox()
{
    static $instance;
    if (null === $instance) {
        $plugin = elgg_get_plugin_from_id('hypeInbox');
        $instance = new \hypeJunction\Inbox\Plugin($plugin);
    }
    return $instance;
}
开发者ID:hypejunction,项目名称:hypeinbox,代码行数:15,代码来源:autoloader.php

示例8: is_allowed_type

function is_allowed_type($entity)
{
    $plugin = elgg_get_plugin_from_id('favourites');
    $allowed_object_subtypes_array = explode(', ', $plugin->allowed_object_subtypes);
    foreach ($allowed_object_subtypes_array as $sub_type) {
        if (elgg_instanceof($entity, 'object', $sub_type)) {
            return true;
        }
    }
    return true;
}
开发者ID:epsylon,项目名称:Hydra-dev,代码行数:11,代码来源:start.php

示例9: poll_get_plugin_setting

/**
 * Get a plugin setting
 *
 * @param string $setting the name of the setting to get
 *
 * @return mixed
 */
function poll_get_plugin_setting($setting)
{
    static $settings;
    if (!isset($settings)) {
        $defaults = ['enable_site' => 'no', 'enable_group' => 'no', 'group_create' => 'members', 'close_date_required' => 'no', 'vote_change_allowed' => 'yes'];
        $plugin = elgg_get_plugin_from_id('poll');
        $plugin_settings = $plugin->getAllSettings();
        $settings = array_merge($defaults, $plugin_settings);
    }
    return elgg_extract($setting, $settings);
}
开发者ID:coldtrick,项目名称:poll,代码行数:18,代码来源:functions.php

示例10: livewire_init

function livewire_init()
{
    $action_path = dirname(__FILE__) . '/actions';
    $plugin = elgg_get_plugin_from_id('livewire');
    elgg_register_action("livewire/add", "{$action_path}/add.php");
    elgg_extend_view('js/elgg', 'js/livewire/update');
    elgg_register_widget_type('livewire', elgg_echo('ONGARDE Live'), elgg_echo('Display the wire'), "index,dashboard", true);
    elgg_unregister_page_handler('activity', 'elgg_river_page_handler');
    elgg_register_page_handler('activity', 'livewire_river_page_handler');
    if (elgg_is_logged_in() && elgg_get_context() == 'activity') {
        elgg_extend_view('page/layouts/content/header', 'page/elements/riverwire', 1);
    }
}
开发者ID:amcfarlane1251,项目名称:ongarde,代码行数:13,代码来源:start.php

示例11: user_sort_get_sort_options

/**
 * Returns as list of sort options
 * @return array
 */
function user_sort_get_sort_options()
{
    $fields = array();
    $plugin = elgg_get_plugin_from_id('user_sort');
    $settings = $plugin->getAllSettings();
    foreach ($settings as $k => $val) {
        if (!$val) {
            continue;
        }
        list($sort, $option) = explode('::', $k);
        if ($sort && in_array(strtolower($option), array('asc', 'desc'))) {
            $fields[] = $k;
        }
    }
    return elgg_trigger_plugin_hook('sort_fields', 'user', null, $fields);
}
开发者ID:hypeJunction,项目名称:Elgg-user_sort,代码行数:20,代码来源:start.php

示例12: custom_notify_init

/**
 * init function for the plugin
 * custom header and footer are set in Elgg Admin Menu -> Settings -> Customize Notification
 * plugin settings form defined in: views/default/plugins/custom_notify/settings.php
 * 
 * @param hook
 * @param type
 * @param retrunvalue
 * @param params 
 * 		params is an array[to, from, subject, body]
 * 
 * @return array 
 * 		returns the modified $params array 
 */
function custom_notify_init($hook, $type, $returnvalue, $params)
{
    //fetch the header and footer values if they have been set
    $plugin_obj = elgg_get_plugin_from_id('custom_notify');
    $plugin_settings = $plugin_obj->getAllSettings();
    //prepend header
    $header = trim($plugin_settings['custom_notify_header']);
    if ($header != '') {
        $params['body'] = $header . "\n\n" . $params['body'];
    }
    //append footer
    $footer = trim($plugin_settings['custom_notify_footer']);
    if ($footer != '') {
        $params['body'] = $params['body'] . "\n\n" . $footer;
    }
    return $params;
}
开发者ID:naveensnayak,项目名称:custom_notify,代码行数:31,代码来源:start.php

示例13: developers_process_settings

function developers_process_settings()
{
    $settings = elgg_get_plugin_from_id('developers')->getAllSettings();
    ini_set('display_errors', (int) (!empty($settings['display_errors'])));
    if (!empty($settings['screen_log'])) {
        // don't show in action/simplecache
        $path = substr(current_page_url(), strlen(elgg_get_site_url()));
        if (!preg_match('~^(cache|action)/~', $path)) {
            $cache = new ElggLogCache();
            elgg_set_config('log_cache', $cache);
            elgg_register_plugin_hook_handler('debug', 'log', array($cache, 'insertDump'));
            elgg_register_plugin_hook_handler('view_vars', 'page/elements/html', function ($hook, $type, $vars, $params) {
                $vars['body'] .= elgg_view('developers/log');
                return $vars;
            });
        }
    }
    if (!empty($settings['show_strings'])) {
        // Beginning and end to make sure both early-rendered and late-loaded translations get included
        elgg_register_event_handler('init', 'system', 'developers_decorate_all_translations', 1);
        elgg_register_event_handler('init', 'system', 'developers_decorate_all_translations', 1000);
    }
    if (!empty($settings['show_modules'])) {
        elgg_require_js('elgg/dev/amd_monitor');
    }
    if (!empty($settings['wrap_views'])) {
        elgg_register_plugin_hook_handler('view', 'all', 'developers_wrap_views', 600);
    }
    if (!empty($settings['log_events'])) {
        elgg_register_event_handler('all', 'all', 'developers_log_events', 1);
        elgg_register_plugin_hook_handler('all', 'all', 'developers_log_events', 1);
    }
    if (!empty($settings['show_gear']) && elgg_is_admin_logged_in() && !elgg_in_context('admin')) {
        elgg_require_js('elgg/dev/gear');
        elgg_load_js('lightbox');
        elgg_load_css('lightbox');
        elgg_register_ajax_view('developers/gear_popup');
        elgg_register_simplecache_view('elgg/dev/gear.html');
        // TODO use ::class in 2.0
        $handler = ['Elgg\\DevelopersPlugin\\Hooks', 'alterMenuSectionVars'];
        elgg_register_plugin_hook_handler('view_vars', 'navigation/menu/elements/section', $handler);
        $handler = ['Elgg\\DevelopersPlugin\\Hooks', 'alterMenuSections'];
        elgg_register_plugin_hook_handler('view', 'navigation/menu/elements/section', $handler);
    }
}
开发者ID:iXuZhang,项目名称:Project_Curia,代码行数:45,代码来源:start.php

示例14: __construct

 /**
  * Loads the plugin by GUID or path.
  *
  * @warning Unlike other ElggEntity objects, you cannot null instantiate
  *          ElggPlugin. You must point it to an actual plugin GUID or location.
  *
  * @param mixed $plugin The GUID of the ElggPlugin object or the path of
  *                      the plugin to load.
  */
 public function __construct($plugin)
 {
     if (!$plugin) {
         throw new PluginException(elgg_echo('PluginException:NullInstantiated'));
     }
     // ElggEntity can be instantiated with a guid or an object.
     // @todo plugins w/id 12345
     if (is_numeric($plugin) || is_object($plugin)) {
         parent::__construct($plugin);
         $this->path = elgg_get_plugins_path() . $this->getID();
     } else {
         $plugin_path = elgg_get_plugins_path();
         // not a full path, so assume an id
         // use the default path
         if (strpos($plugin, $plugin_path) !== 0) {
             $plugin = $plugin_path . $plugin;
         }
         // path checking is done in the package
         $plugin = sanitise_filepath($plugin);
         $this->path = $plugin;
         $path_parts = explode('/', rtrim($plugin, '/'));
         $plugin_id = array_pop($path_parts);
         $this->pluginID = $plugin_id;
         // check if we're loading an existing plugin
         $existing_plugin = elgg_get_plugin_from_id($this->pluginID);
         $existing_guid = null;
         if ($existing_plugin) {
             $existing_guid = $existing_plugin->guid;
         }
         // load the rest of the plugin
         parent::__construct($existing_guid);
     }
     // We have to let the entity load so we can manipulate it with the API.
     // If the path is wrong or would cause an exception, catch it,
     // disable the plugin, and emit an error.
     try {
         $this->package = new ElggPluginPackage($this->path, false);
         $this->manifest = $this->package->getManifest();
     } catch (Exception $e) {
         // we always have to allow the entity to load.
         elgg_log("Failed to load {$this->guid} as a plugin. " . $e->getMessage(), 'WARNING');
         $this->errorMsg = $e->getmessage();
     }
 }
开发者ID:rasul,项目名称:Elgg,代码行数:53,代码来源:ElggPlugin.php

示例15: subsite_manager_fix_piwik_settings

function subsite_manager_fix_piwik_settings()
{
    global $SUBSITE_MANAGER_IGNORE_WRITE_ACCESS;
    if (subsite_manager_on_subsite()) {
        $site = elgg_get_site_entity();
        if ($piwik_settings = $site->phloor_analytics_piwik_settings) {
            $SUBSITE_MANAGER_IGNORE_WRITE_ACCESS = true;
            if ($site->canEdit()) {
                // log to the error log that we did something
                error_log("PIWIK saving settings for " . $site->name . " (" . $site->getGUID() . ")");
                error_log("PIWIK settings: " . $piwik_settings);
                if ($piwik_settings = json_decode($piwik_settings, true)) {
                    if (!empty($piwik_settings) && is_array($piwik_settings)) {
                        $enabled = elgg_extract("enable_tracking", $piwik_settings);
                        $piwik_url = elgg_extract("path_to_piwik", $piwik_settings);
                        $piwik_site_id = elgg_extract("site_guid", $piwik_settings);
                        if ($enabled == "true") {
                            if (!empty($piwik_url) && !empty($piwik_site_id)) {
                                // check if analytics is enabled
                                if (!elgg_is_active_plugin("analytics")) {
                                    // not active so enable
                                    if ($plugin = elgg_get_plugin_from_id("analytics")) {
                                        $plugin->activate();
                                        elgg_invalidate_simplecache();
                                        elgg_reset_system_cache();
                                    }
                                }
                                // save settings, if not exists
                                if (!elgg_get_plugin_setting("piwik_url", "analytics") && !elgg_get_plugin_setting("piwik_site_id", "analytics")) {
                                    elgg_set_plugin_setting("piwik_url", $piwik_url, "analytics");
                                    elgg_set_plugin_setting("piwik_site_id", $piwik_site_id, "analytics");
                                }
                            }
                        }
                    }
                }
                // remove the settings so we don't do this again
                unset($site->phloor_analytics_piwik_settings);
            }
            // unset write access
            $SUBSITE_MANAGER_IGNORE_WRITE_ACCESS = false;
        }
    }
}
开发者ID:pleio,项目名称:subsite_manager,代码行数:44,代码来源:runonce.php


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