Exemplo n.º 1
0
/**
 * Register all files found in $dir as classes
 * Need to be named MyClass.php
 *
 * @param string $dir The dir to look in
 *
 * @return void
 * @since 1.8.0
 */
function elgg_register_classes($dir)
{
    $classes = elgg_get_file_list($dir, array(), array(), array('.php'));
    foreach ($classes as $class) {
        elgg_register_class(basename($class, '.php'), $class);
    }
}
Exemplo n.º 2
0
/**
 * Register all files found in $dir as classes
 * Need to be named MyClass.php
 *
 * @param string $dir The dir to look in
 *
 * @return true
 * @since 1.8.0
 */
function elgg_register_classes($dir)
{
    $classes = elgg_get_file_list($dir, array(), array(), array('.php'));
    if (!$classes) {
        return false;
    }
    foreach ($classes as $class) {
        elgg_register_class(basename($class, '.php'), $class);
    }
    return true;
}
/**
 * Returns all php files in a directory.
 *
 * @deprecated 1.7 Use elgg_get_file_list() instead
 *
 * @param string $directory  Directory to look in
 * @param array  $exceptions Array of extensions (with .!) to ignore
 * @param array  $list       A list files to include in the return
 *
 * @return array
 */
function get_library_files($directory, $exceptions = array(), $list = array())
{
    elgg_deprecated_notice('get_library_files() deprecated by elgg_get_file_list()', 1.7);
    return elgg_get_file_list($directory, $exceptions, $list, array('.php'));
}
Exemplo n.º 4
0
<?php

$svc = \hypeJunction\Scraper\ScraperService::getInstance();
$site = elgg_get_site_entity();
$dataroot = elgg_get_config('dataroot');
$dir = new \Elgg\EntityDirLocator($site->guid);
$paths = elgg_get_file_list($dataroot . $dir . 'scraper_cache/resources/');
$count = count($paths);
echo elgg_view('output/longtext', ['value' => elgg_echo('admin:upgrades:scraper:move_to_db:description')]);
echo elgg_view('admin/upgrades/view', ['count' => $count, 'action' => 'action/upgrade/scraper/move_to_db']);
Exemplo n.º 5
0
 /**
  * Reload all translations from all registered paths.
  *
  * This is only called by functions which need to know all possible translations.
  *
  * @todo Better on demand loading based on language_paths array
  *
  * @return void
  */
 function reloadAllTranslations()
 {
     static $LANG_RELOAD_ALL_RUN;
     if ($LANG_RELOAD_ALL_RUN) {
         return;
     }
     if ($GLOBALS['_ELGG']->i18n_loaded_from_cache) {
         $cache = elgg_get_system_cache();
         $cache_dir = $cache->getVariable("cache_path");
         $filenames = elgg_get_file_list($cache_dir, array(), array(), array(".lang"));
         foreach ($filenames as $filename) {
             // Look for files matching for example 'en.lang', 'cmn.lang' or 'pt_br.lang'.
             // Note that this regex is just for the system cache. The original language
             // files are allowed to have uppercase letters (e.g. pt_BR.php).
             if (preg_match('/(([a-z]{2,3})(_[a-z]{2})?)\\.lang$/', $filename, $matches)) {
                 $language = $matches[1];
                 $data = elgg_load_system_cache("{$language}.lang");
                 if ($data) {
                     $this->addTranslation($language, unserialize($data));
                 }
             }
         }
     } else {
         foreach ($GLOBALS['_ELGG']->language_paths as $path => $dummy) {
             $this->registerTranslations($path, true);
         }
     }
     $LANG_RELOAD_ALL_RUN = true;
 }
Exemplo n.º 6
0
<?php

// read the languages directory to get a list of existing translations
$language_files = elgg_get_file_list(elgg_get_plugins_path() . "rename_friends/languages/", array(), array(), array('.php'));
$translations = array();
foreach ($language_files as $language) {
    $translations[] = basename($language, '.php');
}
system_message("numero de traducciones");
if (count($translations) == 0) {
    echo "<h1>" . elgg_echo('rename_friends:missing:language:file') . "</h1>";
} else {
    echo "<h1>" . elgg_echo('rename_friends:settings') . "</h1>";
    for ($i = 0; $i < count($translations); $i++) {
        $singular = elgg_get_plugin_setting($translations[$i] . 'singular', 'rename_friends');
        $plural = elgg_get_plugin_setting($translations[$i] . 'plural', 'rename_friends');
        $verb = elgg_get_plugin_setting($translations[$i] . 'verb', 'rename_friends');
        //set defaults if nothing has been set yet
        if (empty($singular)) {
            $singular = elgg_echo('friend');
        }
        if (empty($plural)) {
            $plural = elgg_echo('friends');
        }
        if (empty($verb)) {
            $verb = elgg_echo('friends');
        }
        $language = elgg_echo('rename_friends:language');
        $html = "<div class=\"rename_friends_language_edit\"><br/>";
        $html .= "{$language}: <b>{$translations[$i]}</b>";
        $html .= "<table><tr><td>&nbsp;</td></tr><tr><td>";
Exemplo n.º 7
0
$name = $argv[1];
if (strlen($name) > 24) {
    elgg_create_upgrade_show_usage('Upgrade names cannot be longer than 24 characters.');
}
require_once '../../../version.php';
require_once '../elgglib.php';
$upgrade_path = dirname(__FILE__);
$upgrade_name = strtolower($name);
$upgrade_name = str_replace(array(' ', '-'), '_', $upgrade_name);
$upgrade_release = str_replace(array(' ', '-'), '_', $release);
$time = time();
$upgrade_rnd = substr(md5($time), 0, 16);
$upgrade_date = date('Ymd', $time);
// determine the inc count
$upgrade_inc = 0;
$files = elgg_get_file_list($upgrade_path);
sort($files);
foreach ($files as $filename) {
    $filename = basename($filename);
    $date = (int) substr($filename, 0, 8);
    $inc = (int) substr($filename, 8, 2);
    if ($upgrade_date == $date) {
        if ($inc >= $upgrade_inc) {
            $upgrade_inc = $inc + 1;
        }
    }
}
// zero-pad
// if there are more than 10 upgrades in a day, someone needs talking to.
if ($upgrade_inc < 10) {
    $upgrade_inc = "0{$upgrade_inc}";
Exemplo n.º 8
0
/**
 * Get the list of css files of the actual icon library
 *
 * @return array	An array containing the names of each css file.
*/
function deyan_get_iconlib_css($iconlib) {
	$dir = deyan_get_iconlib_dir($iconlib) . "css/";
	$icons = elgg_get_file_list($dir, '', '', '.php');
	
	foreach ($icons as $iconcss) {
		$iconcss = str_replace('.php', '', $iconcss);
		$iconcss = str_replace($dir, '', $iconcss);
		
		$css[] = $iconcss; 
		
	}
	 	
	 	
	return $css;
}
Exemplo n.º 9
0
/**
 * Reload all translations from all registered paths.
 *
 * This is only called by functions which need to know all possible translations.
 *
 * @todo Better on demand loading based on language_paths array
 *
 * @return void
 */
function reload_all_translations()
{
    global $CONFIG;
    static $LANG_RELOAD_ALL_RUN;
    if ($LANG_RELOAD_ALL_RUN) {
        return;
    }
    if ($CONFIG->i18n_loaded_from_cache) {
        $cache = elgg_get_system_cache();
        $cache_dir = $cache->getVariable("cache_path");
        $filenames = elgg_get_file_list($cache_dir, array(), array(), array(".lang"));
        foreach ($filenames as $filename) {
            if (preg_match('/([a-z]+)\\.[^.]+$/', $filename, $matches)) {
                $language = $matches[1];
                $data = elgg_load_system_cache("{$language}.lang");
                if ($data) {
                    add_translation($language, unserialize($data));
                }
            }
        }
    } else {
        foreach ($CONFIG->language_paths as $path => $dummy) {
            register_translations($path, true);
        }
    }
    $LANG_RELOAD_ALL_RUN = true;
}