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


PHP elgg_get_data_path函数代码示例

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


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

示例1: translation_editor_plugins_boot_event

/**
 * This function is executed during the 'plugins_boot' event, before most plugins are initialized
 *
 * @return void
 */
function translation_editor_plugins_boot_event()
{
    // add the custom_keys_locations to language paths
    $custom_keys_path = elgg_get_data_path() . 'translation_editor' . DIRECTORY_SEPARATOR . 'custom_keys' . DIRECTORY_SEPARATOR;
    if (is_dir($custom_keys_path)) {
        register_translations($custom_keys_path);
    }
    // force creation of static to prevent reload of unwanted translations
    reload_all_translations();
    if (elgg_in_context('translation_editor') || elgg_in_context('settings') || elgg_in_context('admin')) {
        translation_editor_reload_all_translations();
    }
    translation_editor_load_custom_languages();
    if (!elgg_in_context('translation_editor')) {
        // remove disabled languages
        translation_editor_unregister_translations();
    }
    // load custom translations
    $user_language = get_current_language();
    $elgg_default_language = 'en';
    $load_languages = [$user_language, $elgg_default_language];
    $load_languages = array_unique($load_languages);
    $disabled_languages = translation_editor_get_disabled_languages();
    foreach ($load_languages as $language) {
        if (empty($disabled_languages) || !in_array($language, $disabled_languages)) {
            // add custom translations
            translation_editor_load_translations($language);
        }
    }
}
开发者ID:coldtrick,项目名称:translation_editor,代码行数:35,代码来源:start.php

示例2: imageCacheCleanup

 /**
  * Cleanup the cached inline images
  *
  * @param string $hook   the name of the hook
  * @param string $type   the type of the hook
  * @param mixed  $return current return value
  * @param array  $params supplied params
  *
  * @return void
  */
 public static function imageCacheCleanup($hook, $type, $return, $params)
 {
     if (empty($params) || !is_array($params)) {
         return;
     }
     $cache_dir = elgg_get_data_path() . 'html_email_handler/image_cache/';
     if (!is_dir($cache_dir)) {
         return;
     }
     $dh = opendir($cache_dir);
     if (empty($dh)) {
         return;
     }
     $max_lifetime = elgg_extract('time', $params, time()) - 24 * 60 * 60;
     while (($filename = readdir($dh)) !== false) {
         // make sure we have a file
         if (!is_file($cache_dir . $filename)) {
             continue;
         }
         $modified_time = filemtime($cache_dir . $filename);
         if ($modified_time > $max_lifetime) {
             continue;
         }
         // file is past lifetime, so cleanup
         unlink($cache_dir . $filename);
     }
     closedir($dh);
 }
开发者ID:coldtrick,项目名称:html_email_handler,代码行数:38,代码来源:Cron.php

示例3: register

 /**
  * Add a menu item to the user hover dropdown
  *
  * @param string          $hook         the name of the hook
  * @param string          $type         the type of the hook
  * @param \ElggMenuItem[] $return_value current menu items
  * @param array           $params       supplied params
  *
  * @return void|\ElggMenuItem[]
  */
 public static function register($hook, $type, $return_value, $params)
 {
     static $user_dirs;
     if (!elgg_is_admin_logged_in()) {
         return;
     }
     if (empty($params) || !is_array($params)) {
         return;
     }
     $user = elgg_extract('entity', $params);
     if (!$user instanceof \ElggUser) {
         return;
     }
     if (!isset($user_dirs)) {
         $user_dirs = [];
     }
     // save in a static for performance when viewing user listings
     if (!isset($user_dirs[$user->getGUID()])) {
         $user_dirs[$user->getGUID()] = false;
         $edl = new \Elgg\EntityDirLocator($user->getGUID());
         $path = $edl->getPath();
         if (is_dir(elgg_get_data_path() . $path)) {
             $path = substr($path, 0, -1);
             $user_dirs[$user->getGUID()] = \ElggMenuItem::factory(['name' => 'dataroot-browser', 'text' => elgg_echo('dataroot_browser:menu:user_hover'), 'href' => elgg_http_add_url_query_elements('admin/administer_utilities/dataroot_browser', ['dir' => $path]), 'is_trusted' => true, 'section' => 'admin']);
         }
     }
     if (empty($user_dirs[$user->getGUID()])) {
         return;
     }
     $return_value[] = $user_dirs[$user->getGUID()];
     return $return_value;
 }
开发者ID:coldtrick,项目名称:dataroot_browser,代码行数:42,代码来源:UserHover.php

示例4: ckeditor_extended_get_upload_path

/**
 * Returns upload path for a given user
 *
 * @param int $user_guid guid of the user
 *
 * @return string
 */
function ckeditor_extended_get_upload_path($user_guid)
{
    $bucket_size = 500;
    if (empty($user_guid)) {
        $user_guid = elgg_get_logged_in_user_guid();
    }
    if (empty($user_guid)) {
        return false;
    }
    $site_guid = elgg_get_site_entity()->getGUID();
    $lower_bound = (int) max(floor($user_guid / $bucket_size) * $bucket_size, 1);
    return elgg_get_data_path() . "ckeditor_upload/" . $site_guid . "/" . $lower_bound . "/" . $user_guid . "/";
}
开发者ID:lorea,项目名称:Hydra-dev,代码行数:20,代码来源:functions.php

示例5: elggpg_get_gpg_home

function elggpg_get_gpg_home()
{
    // try to find location of settings from environment file,
    // which means the gpg directory goes at the same level.
    $elgg_config = getenv("elgg_config");
    if ($elgg_config && is_dir(dirname($elgg_config) . "/gpg")) {
        return dirname($elgg_config) . "/gpg";
    }
    // otherwise create a gpg folder at the data folder
    // and store the keys there
    $gpg_path = elgg_get_data_path() . "gpg/";
    if (!file_exists($gpg_path)) {
        mkdir($gpg_path);
    }
    return $gpg_path;
}
开发者ID:lorea,项目名称:Hydra-dev,代码行数:16,代码来源:elggpg.php

示例6: widget_rss_init

function widget_rss_init()
{
    elgg_register_widget_type("rss", elgg_echo("widgets:rss:title"), elgg_echo("widgets:rss:description"), "groups,index,profile,dashboard", true);
    // extend CSS
    elgg_extend_view("css/elgg", "widgets/rss/css");
    // make cache directory
    if (!is_dir(elgg_get_data_path() . "/widgets/")) {
        mkdir(elgg_get_data_path() . "/widgets/");
    }
    if (!is_dir(elgg_get_data_path() . "/widgets/rss/")) {
        mkdir(elgg_get_data_path() . "/widgets/rss/");
    }
    elgg_register_library("simplepie", elgg_get_plugins_path() . "widget_manager/widgets/rss/vendors/simplepie/simplepie.inc");
    // set cache settings
    define("WIDGETS_RSS_CACHE_LOCATION", elgg_get_data_path() . "widgets/rss/");
    define("WIDGETS_RSS_CACHE_DURATION", 600);
}
开发者ID:socialweb,项目名称:PiGo,代码行数:17,代码来源:start.php

示例7: page_handler_file_takeout_download

/**
* Download the Archive ZIP to computer 
*/
function page_handler_file_takeout_download($page)
{
    $file_guid = $page[0];
    $file_name = $file_guid . '.zip';
    $file_path = elgg_get_data_path();
    if (file_exists($file_path . $file_name)) {
        $mime = "application/octet-stream";
        header("Pragma: public");
        header("Content-type: {$mime}");
        header("Content-Disposition: attachment; filename=\"{$file_name}\"");
        ob_clean();
        flush();
        readfile($file_path . $file_name);
        exit;
    } else {
        register_error(elgg_echo("file:downloadfailed"));
        forward('/file_takeout');
    }
}
开发者ID:aleph1888,项目名称:elgg_file_takeout,代码行数:22,代码来源:start.php

示例8: __construct

 /**
  * @param string             $name       The logging channel
  * @param HandlerInterface[] $handlers   Optional stack of handlers, the first one in the array is called first, etc.
  * @param callable[]         $processors Optional array of processors
  */
 public function __construct($name, array $handlers = array(), array $processors = array())
 {
     parent::__construct($name, $handlers, $processors);
     // set handler
     $elgg_log_level = _elgg_services()->logger->getLevel();
     if ($elgg_log_level == \Elgg\Logger::OFF) {
         // always log errors
         $elgg_log_level = \Elgg\Logger::ERROR;
     }
     $handler = new RotatingFileHandler(elgg_get_data_path() . 'elasticsearch/client.log', 0, $elgg_log_level);
     // create correct folder structure
     $date = date('Y/m/');
     $path = elgg_get_data_path() . "elasticsearch/{$date}";
     if (!is_dir($path)) {
         mkdir($path, 0755, true);
     }
     $handler->setFilenameFormat('{date}_{filename}', 'Y/m/d');
     $this->pushHandler($handler);
     // set logging processor
     $processor = new IntrospectionProcessor();
     $this->pushProcessor($processor);
 }
开发者ID:coldtrick,项目名称:elasticsearch,代码行数:27,代码来源:DatarootLogger.php

示例9: register_error

    register_error(elgg_echo('translation_editor:action:add_custom_key:invalid_chars'));
    forward(REFERER);
}
if (elgg_language_key_exists($key, 'en')) {
    register_error(elgg_echo('translation_editor:action:add_custom_key:exists'));
    forward(REFERER);
}
// save
$custom_translations = translation_editor_get_plugin('en', 'custom_keys');
if (!empty($custom_translations)) {
    $custom_translations = $custom_translations['en'];
} else {
    $custom_translations = array();
}
$custom_translations[$key] = $translation;
$base_dir = elgg_get_data_path() . 'translation_editor' . DIRECTORY_SEPARATOR;
if (!file_exists($base_dir)) {
    mkdir($base_dir, 0755, true);
}
$location = $base_dir . 'custom_keys' . DIRECTORY_SEPARATOR;
if (!file_exists($location)) {
    mkdir($location, 0755, true);
}
$file_contents = '<?php' . PHP_EOL;
$file_contents .= 'return ';
$file_contents .= var_export($custom_translations, true);
$file_contents .= ';' . PHP_EOL;
if (file_put_contents($location . 'en.php', $file_contents)) {
    // invalidate cache
    elgg_flush_caches();
    system_message(elgg_echo('translation_editor:action:add_custom_key:success'));
开发者ID:coldtrick,项目名称:translation_editor,代码行数:31,代码来源:add_custom_key.php

示例10: elgg_view

if (empty($vars['entity']->etfootlink)) {
    $vars['entity']->etfootlink = "#ccc";
}
echo elgg_view('input/text', array('name' => 'params[etfootlink]', 'value' => $vars['entity']->etfootlink, 'class' => 'easytheme'));
echo "<br /><br /><p>[15] Footer :: link hover colour <em>(Theme default = #666)</em></p> ";
if (empty($vars['entity']->etfoothov)) {
    $vars['entity']->etfoothov = "#666";
}
echo elgg_view('input/text', array('name' => 'params[etfoothov]', 'value' => $vars['entity']->etfoothov, 'class' => 'easytheme'));
echo "<br /><br /><p>[16] Text & Buttons Colour (1) <em>(Theme default = #2f5980)</em></p> ";
if (empty($vars['entity']->etcolor1)) {
    $vars['entity']->etcolor1 = "#2f5980";
}
echo elgg_view('input/text', array('name' => 'params[etcolor1]', 'value' => $vars['entity']->etcolor1, 'class' => 'easytheme'));
echo "<br /><br /><p>[17] Text & Buttons Colour (2) <em>(Theme default = #a95e27)</em></p> ";
if (empty($vars['entity']->etcolor2)) {
    $vars['entity']->etcolor2 = "#a95e27";
}
echo elgg_view('input/text', array('name' => 'params[etcolor2]', 'value' => $vars['entity']->etcolor2, 'class' => 'easytheme'));
echo "<br /><br /><p>[18] Custom Index :: Module top bar colour <em>(Theme default = #181a2f)</em></p> ";
if (empty($vars['entity']->etmod)) {
    $vars['entity']->etmod = "#181a2f";
}
echo elgg_view('input/text', array('name' => 'params[etmod]', 'value' => $vars['entity']->etmod, 'class' => 'easytheme'));
echo "<br /><br /><p>[19] <strong> To Replace the site name with a Logo image</strong> <em>(optional)</em>:<br />~ Save your logo in 'mod/easytheme/graphics' <br /> ~ Open the file 'mod/easytheme/views/default/page/elements/header_logo.php'<br /> ~ Remove the 'h1' tags, and everything in between.<br /> ~ Replace with the code for your logo image.<br /> ~ Save the file.</p><br /><p>[20] <strong>To change the Favicon icon</strong> <em>(optional)</em>: Swap your sites icon with the elgg favicon icon in <strong>'mod/easytheme/graphics'</strong></p><br /><br /><p>[21] <strong>Site Introduction</strong> Write a short introduction to your site - <em>(This will appear at the top of the custom index page.  Be careful to copy/paste from a text file - otherwise it's easy to paste unwanted mark-up into the box.)</em></p>";
$myFile = elgg_get_data_path() . "easytheme/intro.php";
$fh = fopen($myFile, 'r');
$etintrofile = fread($fh, filesize($myFile));
fclose($fh);
echo elgg_view('input/longtext', array('name' => 'params[etintro]', 'value' => $etintrofile, 'class' => 'easytheme'));
echo "<br /><p class='et-admin-red'><strong>Now save your settings.</strong></p>";
开发者ID:amcfarlane1251,项目名称:ongarde,代码行数:31,代码来源:settings.php

示例11: elgg_get_plugin_setting

$etfootlink = elgg_get_plugin_setting('etfootlink', 'easytheme');
$etfoothov = elgg_get_plugin_setting('etfoothov', 'easytheme');
$etfoottext = elgg_get_plugin_setting('etfoottext', 'easytheme');
$etsearch = elgg_get_plugin_setting('etsearch', 'easytheme');
$etheadh = elgg_get_plugin_setting('etheadh', 'easytheme');
$etmenu = elgg_get_plugin_setting('etmenu', 'easytheme');
$etintro = elgg_get_plugin_setting('etintro', 'easytheme');
$etborder = elgg_get_plugin_setting('etborder', 'easytheme');
$etborderwidth = elgg_get_plugin_setting('etborderwidth', 'easytheme');
$etshadow = elgg_get_plugin_setting('etshadow', 'easytheme');
//this bit writes the file...
$file = elgg_get_data_path() . "easytheme/cssinc.php";
$fileHandle = fopen($file, 'w') or die("Error opening file");
$data = "body {background: {$et_bkimg};}\n\n.elgg-button-submit {\n\tcolor: white;\n\ttext-shadow: 1px 1px 0px black;\n\ttext-decoration: none;\n\tborder: 1px solid #000;\n\tbackground: {$etcolor2} url(<?php echo elgg_get_site_url(); ?>_graphics/button_graduation.png) repeat-x left 10px;\n}\n\n.elgg-button-submit:hover {\n\tborder-color: #000;\n\ttext-decoration: none;\n\tcolor: white;\n\tbackground:  {$etcolor1} url(<?php echo elgg_get_site_url(); ?>_graphics/button_graduation.png) repeat-x left 10px;\n}\n\n.elgg-breadcrumbs > li > a:hover {\n\tcolor: {$etcolor1};\n\ttext-decoration: underline;\n}\n\n.elgg-menu-site-more > li > a:hover {\n\tbackground: {$etcolor1}; \n\tcolor: white;\n}\n\n.elgg-menu-page a:hover {\n\tbackground-color: {$etcolor1}; \n\tcolor: white;\n\ttext-decoration: none;\n}\n\n.elgg-menu-owner-block li a:hover {\n\tbackground-color: {$etcolor1}; \n\tcolor: white;\n\ttext-decoration: none;\n}\n\na {\n\tcolor: {$etcolor2};\n}\n\nh1, h2, h3, h4, h5, h6 {\n\tfont-weight: bold;\n\tcolor: {$etcolor1}; \n}\n\n.elgg-heading-basic {\n\tcolor: {$etcolor1};\n\tfont-size: 1.2em;\n\tfont-weight: bold;\n}\n\n.elgg-loud {\n\tcolor: {$etcolor1}; \n}\n\n\n\n.elgg-menu-page li.elgg-state-selected > a {\n\tbackground-color: {$etcolor1}; \n\tcolor: white;\n}\n\n.elgg-heading-site, .elgg-heading-site:hover {\n\tfont-size: 2em;\n\tline-height: 1.4em;\n\tcolor: #000;\n\tfont-style: italic;\n\tfont-family: Georgia, times, serif;\n\ttext-shadow: 1px 2px 4px #333333;\n\ttext-decoration: none;\n   background: #fff;\n\tpadding: 20px;\n\tpadding-left: 15px;\n}\n\n.elgg-page-default .elgg-page-header  .elgg-inner {\n\twidth: {$etpgwidth};\n\theight: {$etheadh};\n   background: {$et_headimg};\n}\n\n.elgg-page-default {\n\twidth: {$etpgwidth};\n\tmargin: 0px auto; \n\tborder-right: {$etborderwidth} solid {$etborder};\n        background: #ffffff;\n        border-left: {$etborderwidth} solid {$etborder};\n\t-moz-box-shadow: 0 0 {$etshadow} #888;\n\t-webkit-box-shadow: 0 0 {$etshadow} #888;\n\tbox-shadow: 0 0 {$etshadow} #181a2f;\n}\n\n.elgg-heading-site, .elgg-heading-site:hover {\n\t-webkit-border-bottom-right-radius: 24px;\n\t-moz-border-bottom-right-radius: 24px;\n\tborder-bottom-right-radius: 24px;\n\topacity: 0.6;\n\t-ms-filter:\"progid:DXImageTransform.Microsoft.Alpha(Opacity=60)\";\n        filter: alpha(opacity=60);\n}\n\n.elgg-page-footer {\n\theight: {$etfooth};\n}\n\n.elgg-page-footer {\n       color: {$etfoottext}; \n       background: {$etfootbk};   \n}\n.elgg-page-footer a:link {\n\tcolor: {$etfootlink};\n}\n      \n.elgg-page-footer a:hover {\n\tcolor: {$etfoothov};\n}\n#login-dropdown {\n\tdisplay:none;\n\tposition: absolute;\n\ttop: 10px;\n\tright: 0;\n\tz-index: 100;  \n\tmargin-right: 10px;          \n}\n\n\n.elgg-menu-item-report-this{\n        margin-left: 10px;\n\tmargin-top: 5px;\n}\n\n\n\n\n.elgg-page-default {\n\tmin-width: {$etpgwidth};\n}\n\n.elgg-page-default .elgg-page-body > .elgg-inner {\n\twidth: {$etpgwidth};\n\tmargin: 0 auto;        \n\t\n}\n\n.elgg-page-default .elgg-page-footer > .elgg-inner {\n\twidth: {$etpgwidth}; \n\tmargin: 0 auto;\n\tpadding: 5px 0;\n\tborder-top: 1px solid #DEDEDE;\n\t\n}\n\n.elgg-page-header .elgg-search {\n        margin-top: {$etsearch};\n\tmargin-bottom: 2px;\n        margin-right: 5px;\n\theight: 23px;\n\tposition: absolute;\n\tright: 0;\n       \n}\n\n.elgg-menu-footer-default {\n\tfloat: right;\n\tpadding-right: 10px;\n}\n\n.elgg-menu-site-default{\n\tbackground: {$etmenu}; \n\tpadding-top: 5px; \n\twidth: 100%;\n}";
fwrite($fileHandle, $data);
fclose($fileHandle);
// close the file since we're done
if (empty($etintro)) {
} else {
    //this bit writes the file...
    $file2 = elgg_get_data_path() . "easytheme/intro.php";
    $fileHandle = fopen($file2, 'w') or die("Error opening file");
    $data = $etintro;
    fwrite($fileHandle, $data);
    fclose($fileHandle);
    elgg_unset_plugin_setting('etintro', 'easytheme');
}
elgg_invalidate_simplecache();
elgg_reset_system_cache();
system_message(elgg_echo('plugins:settings:save:ok', array($plugin_name)));
forward(REFERER);
开发者ID:amcfarlane1251,项目名称:ongarde,代码行数:31,代码来源:save.php

示例12: get_input

<?php

$file = get_input('file');
$file = sanitise_filepath($file, false);
// no file
if (empty($file)) {
    forward(REFERER);
}
$file_path = elgg_get_data_path() . $file;
// file doesn't exist or is directory
if (!file_exists($file_path) || is_dir($file_path)) {
    forward(REFERER);
}
$contents = file_get_contents($file_path);
// empty file
if (empty($contents)) {
    forward(REFERER);
}
$filename = basename($file_path);
$mimetype = 'application/octet-stream';
if (is_callable('finfo_open')) {
    $finfo = finfo_open(FILEINFO_MIME_TYPE);
    $mimetype = finfo_file($finfo, $file_path);
}
header("Pragma: public");
header("Content-type: {$mimetype}");
header("Content-Disposition: attachment; filename=\"{$filename}\"");
header("Content-Length: " . strlen($contents));
echo $contents;
exit;
开发者ID:coldtrick,项目名称:dataroot_browser,代码行数:30,代码来源:download.php

示例13: ElggFile

if (empty($icontime)) {
    return;
}
$user_guid = $user->getGUID();
$filehandler = new ElggFile();
$filehandler->owner_guid = $user_guid;
$filehandler->setFilename("profile/{$user_guid}master.jpg");
if ($filehandler->exists()) {
    $image_data = $filehandler->grabFile();
}
if (empty($image_data)) {
    return;
}
$x1 = $user->x1;
$x2 = $user->x2;
$y1 = $user->y1;
$y2 = $user->y2;
if ($x1 === null) {
    return $image_data;
}
// apply user cropping config
// create temp file for resizing
$tmpfname = tempnam(elgg_get_data_path(), 'elgg_avatar_service');
$handle = fopen($tmpfname, 'w');
fwrite($handle, $image_data);
fclose($handle);
// apply resizing
$result = get_resized_image_from_existing_file($tmpfname, 2048, 2048, true, $x1, $y1, $x2, $y2, false);
// remove temp file
unlink($tmpfname);
echo $result;
开发者ID:coldtrick,项目名称:avatar_service,代码行数:31,代码来源:profile.php

示例14: translation_editor_delete_translation

function translation_editor_delete_translation($current_language, $plugin)
{
    $result = false;
    if (!empty($current_language) && !empty($plugin)) {
        $filename = elgg_get_data_path() . "translation_editor" . DIRECTORY_SEPARATOR . $current_language . DIRECTORY_SEPARATOR . $plugin . ".json";
        if (file_exists($filename)) {
            $result = unlink($filename);
        }
    }
    return $result;
}
开发者ID:amcfarlane1251,项目名称:ongarde,代码行数:11,代码来源:functions.php

示例15: elgg_disable_simplecache

/**
 * Disables the simple cache.
 *
 * @warning Simplecache is also purged when disabled.
 *
 * @see elgg_register_simplecache_view()
 * @return void
 * @since 1.8.0
 */
function elgg_disable_simplecache()
{
    if (elgg_get_config('simplecache_enabled')) {
        datalist_set('simplecache_enabled', 0);
        elgg_set_config('simplecache_enabled', 0);
        // purge simple cache
        _elgg_rmdir(elgg_get_data_path() . "views_simplecache");
    }
}
开发者ID:nooshin-mirzadeh,项目名称:web_2.0_benchmark,代码行数:18,代码来源:cache.php


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