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


PHP datalist_get函数代码示例

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


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

示例1: elgg_is_admin_user

/**
 * Check if the given user has full access.
 *
 * @todo: Will always return full access if the user is an admin.
 *
 * @param int $user_guid The user to check
 *
 * @return bool
 * @since 1.7.1
 */
function elgg_is_admin_user($user_guid)
{
    global $CONFIG;
    $user_guid = (int) $user_guid;
    $current_user = elgg_get_logged_in_user_entity();
    if ($current_user && $current_user->guid == $user_guid) {
        return $current_user->isAdmin();
    }
    // cannot use magic metadata here because of recursion
    // must support the old way of getting admin from metadata
    // in order to run the upgrade to move it into the users table.
    $version = (int) datalist_get('version');
    if ($version < 2010040201) {
        $admin = elgg_get_metastring_id('admin');
        $yes = elgg_get_metastring_id('yes');
        $one = elgg_get_metastring_id('1');
        $query = "SELECT 1 FROM {$CONFIG->dbprefix}users_entity as e,\n\t\t\t{$CONFIG->dbprefix}metadata as md\n\t\t\tWHERE (\n\t\t\t\tmd.name_id = '{$admin}'\n\t\t\t\tAND md.value_id IN ('{$yes}', '{$one}')\n\t\t\t\tAND e.guid = md.entity_guid\n\t\t\t\tAND e.guid = {$user_guid}\n\t\t\t\tAND e.banned = 'no'\n\t\t\t)";
    } else {
        $query = "SELECT 1 FROM {$CONFIG->dbprefix}users_entity as e\n\t\t\tWHERE (\n\t\t\t\te.guid = {$user_guid}\n\t\t\t\tAND e.admin = 'yes'\n\t\t\t)";
    }
    // normalizing the results from get_data()
    // See #1242
    $info = get_data($query);
    if (!(is_array($info) && count($info) < 1 || $info === false)) {
        return true;
    }
    return false;
}
开发者ID:ibou77,项目名称:elgg,代码行数:38,代码来源:sessions.php

示例2: launcher

 /**
  * Launcher executes functionality on plugin init  
  * 
  * Launcher is responsible for querying the settings and running anything
  * that is demanded to run initially.
  */
 public static function launcher()
 {
     $displayerrors = get_plugin_setting('displayerrors', 'elgg_developer_tools');
     if ($displayerrors) {
         ini_set('display_errors', 1);
     }
     $errorlog = get_plugin_setting('errorlog', 'elgg_developer_tools');
     if ($errorlog) {
         ini_set('error_log', datalist_get('dataroot') . "debug.log");
     }
     $exceptionhandler = get_plugin_setting('exceptionhandler', 'elgg_developer_tools');
     if ($exceptionhandler) {
         restore_exception_handler();
     }
     $errorhandler = get_plugin_setting('errorhandler', 'elgg_developer_tools');
     if ($errorhandler) {
         restore_error_handler();
     }
     /** include firePHP if need be **/
     $firephp = get_plugin_setting('enablefirephp', 'elgg_developer_tools');
     if ($firephp) {
         require_once dirname(__FILE__) . '/firephp/FirePHP.class.php';
         require_once dirname(__FILE__) . '/firephp/fb.php';
     } else {
         require_once dirname(__FILE__) . '/FirePHPDisabled.php';
     }
     $timing = get_plugin_setting('timing', 'elgg_developer_tools');
     if ($timing) {
         register_elgg_event_handler('shutdown', 'system', 'elgg_dev_tools_shutdown_hook');
     }
     $showviews = get_plugin_setting('showviews', 'elgg_developer_tools');
     if ($showviews) {
         register_plugin_hook('display', 'view', 'elgg_dev_tools_outline_views');
     }
     $showstrings = get_plugin_setting('showstrings', 'elgg_developer_tools');
     if ($showstrings) {
         // first and last in case a plugin registers a translation in an init method
         register_elgg_event_handler('init', 'system', 'elgg_dev_clear_strings', 1000);
         register_elgg_event_handler('init', 'system', 'elgg_dev_clear_strings', 1);
     }
     $logevents = get_plugin_setting('logevents', 'elgg_developer_tools');
     if ($logevents) {
         register_plugin_hook('all', 'all', 'elgg_dev_log_events');
         register_elgg_event_handler('all', 'all', 'elgg_dev_log_events');
     }
 }
开发者ID:CashElgg,项目名称:elgg-developer-tools,代码行数:52,代码来源:ElggDevTools.php

示例3: handle

 /**
  * {@inheritdoc}
  */
 protected function handle()
 {
     $path = $this->argument('path');
     if ($path) {
         // make sure the path ends with a slash
         $path = rtrim($path, DIRECTORY_SEPARATOR);
         $path .= DIRECTORY_SEPARATOR;
         if (!is_dir($path)) {
             throw new RuntimeException("{$path} is not a valid directory");
         }
         if (datalist_set('path', $path)) {
             system_message("Root path has been changed");
         } else {
             system_message("Root path could not be changed");
         }
     }
     system_message("Current root path: " . datalist_get('path'));
 }
开发者ID:hypejunction,项目名称:elgg-cli,代码行数:21,代码来源:ConfigPathCommand.php

示例4: newsletter_upgrade_event_handler

/**
 * Do something on the 'upgrade', 'system' event (when running upgrade.php)
 *
 * @param string $event  which event was triggered
 * @param string $type   what is the type of the event
 * @param mixed  $object On what object was the event triggered
 *
 * @return void
 *
 * @see elgg_trigger_event()
 */
function newsletter_upgrade_event_handler($event, $type, $object)
{
    // amke sure the correct classes are set for our own classes
    if (!update_subtype("object", Newsletter::SUBTYPE, "Newsletter")) {
        // first time the plugin was activated
        add_subtype("object", Newsletter::SUBTYPE, "Newsletter");
    }
    if (!update_subtype("object", NewsletterSubscription::SUBTYPE, "NewsletterSubscription")) {
        // first time the plugin was activated
        add_subtype("object", NewsletterSubscription::SUBTYPE, "NewsletterSubscription");
    }
    // proccess upgrade scripts
    $upgrade_scripts = array();
    $upgrade_dir = dirname(__FILE__) . "/upgrades/";
    $fh = opendir($upgrade_dir);
    // read all available upgrade scripts
    if (!empty($fh)) {
        while (($upgrade_file = readdir($fh)) !== false) {
            if (!is_dir($upgrade_dir . $upgrade_file)) {
                $upgrade_scripts[] = $upgrade_file;
            }
        }
        closedir($fh);
    }
    if (!empty($upgrade_scripts)) {
        // get already run scripts
        $upgrades = datalist_get("processed_upgrades");
        $processed_upgrades = unserialize($upgrades);
        if (!is_array($processed_upgrades)) {
            $processed_upgrades = array();
        }
        // do we have something left
        $unprocessed = array_diff($upgrade_scripts, $processed_upgrades);
        if (!empty($unprocessed)) {
            // proccess all upgrades
            foreach ($unprocessed as $script) {
                include $upgrade_dir . $script;
                $processed_upgrades[] = $script;
            }
            // save new list
            elgg_set_processed_upgrades($processed_upgrades);
        }
    }
}
开发者ID:lorea,项目名称:Hydra-dev,代码行数:55,代码来源:events.php

示例5: subsite_manager_boot_system_plugins_event_handler

function subsite_manager_boot_system_plugins_event_handler($event, $type, $object)
{
    global $CONFIG;
    global $SUBSITE_MANAGER_PLUGINS_BOOT;
    // needs to be set for links in html head
    $viewtype = get_input('view', 'default');
    $site_guid = elgg_get_site_entity()->getGUID();
    $lastcached = datalist_get("sc_lastcached_" . $viewtype . "_" . $site_guid);
    $CONFIG->lastcache = $lastcached;
    // skip non-subsites
    if (!subsite_manager_on_subsite()) {
        return true;
    }
    $site = elgg_get_site_entity();
    $to_activate = $site->getPrivateSetting('subsite_manager_plugins_activate');
    if ($to_activate) {
        $SUBSITE_MANAGER_PLUGINS_BOOT = true;
        $site->removePrivateSetting('subsite_manager_plugins_activate');
        $to_activate = unserialize($to_activate);
        set_time_limit(0);
        elgg_generate_plugin_entities();
        $old_ia = elgg_set_ignore_access(true);
        $plugins = elgg_get_plugins('any');
        foreach ($plugins as $plugin) {
            if (in_array($plugin->getID(), $to_activate)) {
                try {
                    $plugin->activate();
                } catch (Exception $e) {
                }
            }
        }
        elgg_set_ignore_access($old_ia);
        $SUBSITE_MANAGER_PLUGINS_BOOT = false;
        elgg_register_event_handler("ready", "system", "subsite_manager_ready_system_handler", 100);
    }
}
开发者ID:pleio,项目名称:subsite_manager,代码行数:36,代码来源:system.php

示例6: version_upgrade

/**
 * Upgrades Elgg
 *
 */
function version_upgrade()
{
    $dbversion = (int) datalist_get('version');
    // Upgrade database
    db_upgrade($dbversion);
    system_message(elgg_echo('upgrade:db'));
    // Upgrade core
    if (upgrade_code($dbversion)) {
        system_message(elgg_echo('upgrade:core'));
    }
    // Update the version
    datalist_set('version', get_version());
}
开发者ID:eokyere,项目名称:elgg,代码行数:17,代码来源:version.php

示例7: login

// If all is present and correct, try to log in
$result = false;
if (!empty($username) && !empty($password)) {
    if ($user = authenticate($username, $password)) {
        $result = login($user, $persistent);
    }
}
// Set the system_message as appropriate
if ($result) {
    system_message(elgg_echo('loginok'));
    if ($_SESSION['last_forward_from']) {
        $forward_url = $_SESSION['last_forward_from'];
        $_SESSION['last_forward_from'] = "";
        forward($forward_url);
    } else {
        if (isadminloggedin() && !datalist_get('first_admin_login')) {
            system_message(elgg_echo('firstadminlogininstructions'));
            datalist_set('first_admin_login', time());
            forward('pg/admin/plugins');
        } else {
            if (get_input('returntoreferer')) {
                forward($_SERVER['HTTP_REFERER']);
            } else {
                forward("pg/dashboard/");
            }
        }
    }
} else {
    $error_msg = elgg_echo('loginerror');
    // figure out why the login failed
    if (!empty($username) && !empty($password)) {
开发者ID:jricher,项目名称:Elgg,代码行数:31,代码来源:login.php

示例8: init_izap_videos

/**
 * main function that register everything
 *
 * @global <type> $CONFIG
 */
function init_izap_videos()
{
    global $CONFIG;
    // render this plugin from izap-elgg-bridge now
    if (is_plugin_enabled('izap-elgg-bridge')) {
        func_init_plugin_byizap(array('plugin' => array('name' => GLOBAL_IZAP_VIDEOS_PLUGIN)));
    } else {
        register_error('This plugin needs izap-elgg-bridge');
        disable_plugin(GLOBAL_IZAP_VIDEOS_PLUGIN);
    }
    // for the first time, admin settings are not set so send admin to the setting page, to set the default settings
    if (isadminloggedin() && (int) datalist_get('izap_videos_installtime') == 0) {
        datalist_set('izap_videos_installtime', time());
        forward($CONFIG->wwwroot . 'pg/videos/adminSettings/' . get_loggedin_user()->username . '?option=settings');
    }
    // extend the views
    if (is_callable('elgg_extend_view')) {
        $extend_view = 'elgg_extend_view';
    } else {
        $extend_view = 'extend_view';
    }
    // include the main lib file
    include dirname(__FILE__) . '/lib/izapLib.php';
    // load all the required files
    izapLoadLib_izap_videos();
    // register pagehandler
    register_page_handler('videos', 'pageHandler_izap_videos');
    register_page_handler('izap_videos_files', 'pageHandler_izap_videos_files');
    // register the notification hook
    if (is_callable('register_notification_object')) {
        register_notification_object('object', 'izap_videos', elgg_echo('izap_videos:newVideoAdded'));
    }
    $period = get_plugin_setting('izap_cron_time', GLOBAL_IZAP_VIDEOS_PLUGIN);
    if (isOnserverEnabled() && is_plugin_enabled('crontrigger') && $period != 'none') {
        register_plugin_hook('cron', $period, 'izap_queue_cron');
    }
    // asking group to include the izap_videos
    if (is_callable('add_group_tool_option')) {
        add_group_tool_option('izap_videos', elgg_echo('izap_videos:group:enablevideo'), true);
    }
    // register the notification hook
    if (is_callable('register_notification_object')) {
        register_notification_object('object', 'izap_videos', elgg_echo('izap_videos:newVideoAdded'));
    }
    // skip tags from filteration
    if (is_old_elgg()) {
        //allow some tags for elgg lesser than 1.6
        $CONFIG->allowedtags['object'] = array('width' => array(), 'height' => array(), 'classid' => array(), 'codebase' => array(), 'data' => array(), 'type' => array());
        $CONFIG->allowedtags['param'] = array('name' => array(), 'value' => array());
        $CONFIG->allowedtags['embed'] = array('src' => array(), 'type' => array(), 'wmode' => array(), 'width' => array(), 'height' => array());
    } else {
        $allowed_tags = get_plugin_setting('izapHTMLawedTags', GLOBAL_IZAP_VIDEOS_PLUGIN);
        $CONFIG->htmlawed_config['elements'] = 'object, embed, param, p, img, b, i, ul, li, ol, u, a, s, blockquote, br, strong, em' . ($allowed_tags ? ', ' . $allowed_tags : '');
    }
    run_function_once('izapSetup_izap_videos');
    $extend_view('css', 'izap_videos/css/default');
    $extend_view('metatags', 'izap_videos/js/javascript');
    //$extend_view('profile/menu/links','izap_videos/menu');
    $extend_view('groups/right_column', 'izap_videos/gruopVideos', 1);
    // only if enabled by admin
    if (izapIncludeIndexWidget_izap_videos()) {
        $extend_view('index/righthandside', 'izap_videos/customindexVideos');
    }
    // only if enabled by admin
    if (izapTopBarWidget_izap_videos()) {
        $extend_view('elgg_topbar/extend', 'izap_videos/navBar');
    }
    // finally lets register the object
    register_entity_type('object', 'izap_videos');
}
开发者ID:rimpy,项目名称:izap_videos,代码行数:75,代码来源:start.php

示例9: system_log

/**
 * Log a system event related to a specific object.
 *
 * This is called by the event system and should not be called directly.
 *
 * @param object $object The object you're talking about.
 * @param string $event  The event being logged
 * @return void
 */
function system_log($object, $event)
{
    global $CONFIG;
    static $log_cache;
    static $cache_size = 0;
    if ($object instanceof Loggable) {
        /* @var ElggEntity|ElggExtender $object */
        if (datalist_get('version') < 2012012000) {
            // this is a site that doesn't have the ip_address column yet
            return;
        }
        // reset cache if it has grown too large
        if (!is_array($log_cache) || $cache_size > 500) {
            $log_cache = array();
            $cache_size = 0;
        }
        // Has loggable interface, extract the necessary information and store
        $object_id = (int) $object->getSystemLogID();
        $object_class = get_class($object);
        $object_type = $object->getType();
        $object_subtype = $object->getSubtype();
        $event = sanitise_string($event);
        $time = time();
        $ip_address = sanitize_string(_elgg_services()->request->getClientIp());
        if (!$ip_address) {
            $ip_address = '0.0.0.0';
        }
        $performed_by = elgg_get_logged_in_user_guid();
        if (isset($object->access_id)) {
            $access_id = $object->access_id;
        } else {
            $access_id = ACCESS_PUBLIC;
        }
        if (isset($object->enabled)) {
            $enabled = $object->enabled;
        } else {
            $enabled = 'yes';
        }
        if (isset($object->owner_guid)) {
            $owner_guid = $object->owner_guid;
        } else {
            $owner_guid = 0;
        }
        // Create log if we haven't already created it
        if (!isset($log_cache[$time][$object_id][$event])) {
            $query = "INSERT DELAYED into {$CONFIG->dbprefix}system_log\n\t\t\t\t(object_id, object_class, object_type, object_subtype, event,\n\t\t\t\tperformed_by_guid, owner_guid, access_id, enabled, time_created, ip_address)\n\t\t\tVALUES\n\t\t\t\t('{$object_id}','{$object_class}','{$object_type}', '{$object_subtype}', '{$event}',\n\t\t\t\t{$performed_by}, {$owner_guid}, {$access_id}, '{$enabled}', '{$time}', '{$ip_address}')";
            insert_data($query);
            $log_cache[$time][$object_id][$event] = true;
            $cache_size += 1;
        }
    }
}
开发者ID:gzachos,项目名称:elgg_ellak,代码行数:61,代码来源:system_log.php

示例10: hj_framework_decode_xhr_view_outputs

            }
        } else {
            $output = $val;
        }
    }
    return $output;
}
$output = hj_framework_decode_xhr_view_outputs($output);
$js = elgg_get_loaded_js();
$js_foot = elgg_get_loaded_js('footer');
$js = array_merge($js, $js_foot);
$css = elgg_get_loaded_css();
$resources = array('js' => array(), 'css' => array());
/** @hack	Prevent js/css from loading again if cached in default viewtype * */
$lastcached_xhr = datalist_get("simplecache_lastcached_xhr");
$lastcached_default = datalist_get("simplecache_lastcached_default");
foreach ($js as $script) {
    if (elgg_is_simplecache_enabled()) {
        $script = str_replace('cache/js/xhr', 'cache/js/default', $script);
    } else {
        $script = str_replace('view=xhr', 'view=default', $script);
    }
    $script = str_replace($lastcached_xhr, $lastcached_default, $script);
    $resources['js'][] = html_entity_decode($script);
}
foreach ($css as $link) {
    if (elgg_is_simplecache_enabled()) {
        $link = str_replace('cache/css/xhr', 'cache/css/default', $link);
    } else {
        $link = str_replace('view=xhr', 'view=default', $link);
    }
开发者ID:amcfarlane1251,项目名称:ongarde,代码行数:31,代码来源:default.php

示例11: version_upgrade

/**
 * Upgrades Elgg
 *
 */
function version_upgrade()
{
    $dbversion = (int) datalist_get('version');
    // No version number? Oh snap...this is an upgrade from a clean installation < 1.7.
    // Run all upgrades without error reporting and hope for the best.
    // See http://trac.elgg.org/elgg/ticket/1432 for more.
    $quiet = !$dbversion;
    // Upgrade database
    if (db_upgrade($dbversion, '', $quiet)) {
        system_message(elgg_echo('upgrade:db'));
    }
    // Upgrade core
    if (upgrade_code($dbversion, $quiet)) {
        system_message(elgg_echo('upgrade:core'));
    }
    // Now we trigger an event to give the option for plugins to do something
    $upgrade_details = new stdClass();
    $upgrade_details->from = $dbversion;
    $upgrade_details->to = get_version();
    trigger_elgg_event('upgrade', 'upgrade', $upgrade_details);
    // Update the version
    datalist_set('version', get_version());
}
开发者ID:ashwiniravi,项目名称:Elgg-Social-Network-Single-Sign-on-and-Web-Statistics,代码行数:27,代码来源:version.php

示例12: elgg_log

    elgg_log("Loading {$file}...");
    if (!(include_once $file)) {
        $msg = "Could not load {$file}";
        throw new InstallationException($msg);
    }
}
// include subsite manager
require_once dirname(dirname(__FILE__)) . "/mod/subsite_manager/system.php";
// Connect to database, load language files, load configuration, init session
// Plugins can't use this event because they haven't been loaded yet.
elgg_trigger_event('boot', 'system');
// needs to be set for links in html head
$viewtype = get_input('view', 'default');
$site_guid = elgg_get_site_entity()->getGUID();
// Subsite Manager - simple cache prefix
$lastcached = datalist_get("sc_lastcached_" . $viewtype . "_" . $site_guid);
$CONFIG->lastcache = $lastcached;
// Load the plugins that are active
elgg_load_plugins();
// @todo move loading plugins into a single boot function that replaces 'boot', 'system' event
// and then move this code in there.
// This validates the view type - first opportunity to do it is after plugins load.
$view_type = elgg_get_viewtype();
if (!elgg_is_valid_view_type($view_type)) {
    elgg_set_viewtype('default');
}
// @todo deprecate as plugins can use 'init', 'system' event
elgg_trigger_event('plugins_boot', 'system');
// Complete the boot process for both engine and plugins
elgg_trigger_event('init', 'system');
$CONFIG->boot_complete = true;
开发者ID:pleio,项目名称:subsite_manager,代码行数:31,代码来源:start.php

示例13: translation_editor_load_translations

function translation_editor_load_translations($current_language = "")
{
    global $CONFIG;
    if (empty($current_language)) {
        $current_language = get_current_language();
    }
    // check if update is needed
    $main_ts = datalist_get("te_last_update_" . $current_language);
    $site_ts = get_private_setting($CONFIG->site_guid, "te_last_update_" . $current_language);
    if (!empty($main_ts)) {
        if (empty($site_ts) || $main_ts > $site_ts) {
            if (translation_editor_merge_translations($current_language)) {
                set_private_setting($CONFIG->site_guid, "te_last_update_" . $current_language, time());
            }
        }
    } else {
        translation_editor_merge_translations($current_language, true);
    }
    // load translations
    if ($translations = translation_editor_read_translation($current_language, "translation_editor_merged_" . $CONFIG->site_guid)) {
        add_translation($current_language, $translations);
    }
}
开发者ID:amcfarlane1251,项目名称:ongarde,代码行数:23,代码来源:functions.php

示例14: remove_metadata

remove_metadata($site->guid, 'pluginorder');
remove_metadata($site->guid, 'enabled_plugins');
// do subsite plugin upgrade
$site_options = array("type" => "site", "subtype" => "subsite", "limit" => false, "site_guids" => false);
if ($subsites = elgg_get_entities($site_options)) {
    set_time_limit(0);
    $old_site_guid = elgg_get_config("site_guid");
    $dir = elgg_get_plugins_path();
    $physical_plugins = elgg_get_plugin_ids_in_dir($dir);
    $hidden = access_get_show_hidden_status();
    access_show_hidden_entities(true);
    $plugin_options = array('type' => 'object', 'subtype' => 'plugin', 'limit' => false);
    $enabled_plugin_options = array("metadata_name" => "enabled_plugins", "site_guids" => false, "limit" => false);
    $subsites_done = 0;
    foreach ($subsites as $subsite) {
        if (!datalist_get("plugins_done_" . $subsite->getGUID())) {
            elgg_set_config("site", $subsite);
            elgg_set_config("site_guid", $subsite->getGUID());
            // get known plugins
            $plugin_options["site_guids"] = array($subsite->getGUID());
            $known_plugins = elgg_get_entities($plugin_options);
            if (!$known_plugins) {
                $known_plugins = array();
            }
            // map paths to indexes
            $id_map = array();
            foreach ($known_plugins as $i => $plugin) {
                // if the ID is wrong, delete the plugin because we can never load it.
                $id = $plugin->getID();
                if (!$id) {
                    $plugin->delete();
开发者ID:pleio,项目名称:subsite_manager,代码行数:31,代码来源:2011010101.php

示例15: is_installed

/**
 * Returns whether or not other settings have been set
 *
 * @return true|false Whether or not the rest of the installation has been followed through with
 */
function is_installed()
{
    global $CONFIG;
    return datalist_get('installed');
}
开发者ID:eokyere,项目名称:elgg,代码行数:10,代码来源:install.php


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