コード例 #1
0
ファイル: functions.php プロジェクト: jprice/EHCP
/**
 * Inserts an option block in the main SM options page
 *
 */
function demo_option_link_do()
{
    global $optpage_blocks;
    sq_change_text_domain('demo');
    $optpage_blocks[] = array('name' => _("Demo"), 'url' => sqm_baseuri() . 'plugins/demo/demo.php', 'desc' => _("This is where you would describe what your plugin does."), 'js' => FALSE);
    sq_change_text_domain('squirrelmail');
}
コード例 #2
0
ファイル: functions.php プロジェクト: teammember8/roundcube
/**
 * Validate a requested POP3 server address
 *
 * Blocked server addresses are configured in config.php
 * (see config_example.php for more details)
 *
 * @param int $requested_address The server address given by the user
 *
 * @return string An error string is returned if the server
 *                address is not allowable, otherwise an
 *                empty string is returned.
 *
 */
function validate_mail_fetch_server_address($requested_address)
{
    global $mail_fetch_block_server_pattern;
    if (empty($mail_fetch_block_server_pattern)) {
        $mail_fetch_block_server_pattern = '/(^10\\.)|(^192\\.)|(^127\\.)|(^localhost)/';
    }
    if ($mail_fetch_block_server_pattern == 'UNRESTRICTED') {
        return '';
    }
    if (preg_match($mail_fetch_block_server_pattern, $requested_address)) {
        sq_change_text_domain('mail_fetch');
        $error = _("Sorry, that server address is not allowed");
        sq_change_text_domain('squirrelmail');
        return $error;
    }
    return '';
}
コード例 #3
0
ファイル: functions.php プロジェクト: jprice/EHCP
/**
 * Validate Plugin Setup Utility
 *
 * Checks a plugin to see if the user has installed it 
 * correctly by checking for the existence of the given
 * files (all relative from the plugin's directory)
 *
 * @param string $pluginName The name of the plugin as
 *                           it is known to SquirrelMail, 
 *                           that is, it is the name
 *                           of the plugin directory.
 * @param array $configFiles An array of any files that the
 *                           user should have set up for 
 *                           this plugin, for example:
 *                             array('config.php') 
 *                           or: 
 *                             array('data/config.php', 'data/admins.php')
 *                           where all files will be 
 *                           referenced from the plugin's
 *                           main directory.
 *                           It is also possible to give a 
 *                           full/direct path to a 
 *                           configuration file by placing 
 *                           a forward slash at the 
 *                           beginning of the file:
 *                             array('/var/lib/squirrelmail/config/myplugin.conf')
 * @param boolean $return_errors When true, any errors encountered
 *                               will cause this function to return
 *                               either FALSE or a string describing
 *                               the error; otherwise, errors are
 *                               handled herein by showing an error 
 *                               to the user and exiting (OPTIONAL; 
 *                               default is FALSE).
 *
 * @return mixed If no errors are found, TRUE is returned; if an error
 *               was found and $return_errors is TRUE, either FALSE or 
 *               a string describing the error is returned.  If $return_errors
 *               is FALSE and an error is found, this function will never
 *               return.
 *
 */
function check_plugin_setup($pluginName, $configFiles, $return_errors = FALSE)
{
    global $compatibility_disable_config_check;
    if ($compatibility_disable_config_check) {
        return;
    }
    global $compatibility_sm_path;
    // check one at a time...
    //
    foreach ($configFiles as $configFile) {
        if (strpos($configFile, '/') === 0) {
            $plugin_path = $configFile;
        } else {
            $plugin_path = $compatibility_sm_path . 'plugins/' . $pluginName . '/' . $configFile;
        }
        if (!file_exists($plugin_path)) {
            //if ($return_errors) return FALSE;
            sq_change_text_domain('compatibility');
            if ($return_errors) {
                $error_msg = sprintf(_("The file %s is missing from plugin %s."), '&quot;<strong>' . $configFile . '</strong>&quot;', '&quot;<strong>' . $pluginName . '</strong>&quot;');
                sq_change_text_domain('squirrelmail');
                return $error_msg;
            }
            $error_msg = _("Administrative error:") . '<br />' . sprintf(_("The plugin %s has not been set up correctly."), '&quot;<strong>' . $pluginName . '</strong>&quot;') . '<br />' . sprintf(_("The file %s is missing."), '&quot;<strong>' . $configFile . '</strong>&quot;') . '<br />' . _("Please read the README or INSTALL files that came with the plugin.");
            sq_change_text_domain('squirrelmail');
            include_once $compatibility_sm_path . 'functions/display_messages.php';
            global $color;
            plain_error_message($error_msg, $color);
            exit;
        }
    }
    return TRUE;
}
コード例 #4
0
ファイル: ngettext.php プロジェクト: teammember8/roundcube
 * This page tests the ngettext() function.
 *
 * @copyright 2006-2016 The SquirrelMail Project Team
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 * @version $Id$
 * @package plugins
 * @subpackage test
 */
include_once '../../include/init.php';
global $oTemplate, $color;
displayPageHeader($color, '');
sq_change_text_domain('test');
// NOTE: Not bothering to "templatize" the following output, since
//       this plugin is merely an administrative (and not user-facing)
//       tool.  If this is really important to you, please help by
//       submitting the work to the team.
?>
<strong>ngettext Test Strings:</strong>

<p>The results of this test depend on your current language (translation) selection (see Options ==> Display Preferences) and the corresponding translation strings in locale/xx/LC_MESSAGES/test.mo</p>

<pre>

<?php 
for ($i = -10; $i <= 250; $i++) {
    echo sprintf(ngettext("%s squirrel is on the tree.", "%s squirrels are on the tree.", $i), $i);
    echo "\n";
}
echo "</pre>";
sq_change_text_domain('squirrelmail');
$oTemplate->display('footer.tpl');