Exemplo n.º 1
0
 function get($option)
 {
     switch ($option) {
         case 'application_id':
             return 'glotpress';
             break;
         case 'application_uri':
             return bb_get_uri(null, null, BB_URI_CONTEXT_NONE);
             break;
         case 'cron_uri':
             return '';
             break;
         case 'cron_check':
             return '';
             break;
         case 'charset':
             return 'UTF-8';
             break;
         case 'wp_http_version':
             return 'GlotPress/' . gp_get_option('version');
             break;
         case 'hash_function_name':
             return 'gp_hash';
             break;
         default:
             return gp_get_option(BP_Options::prefix() . $option);
             break;
     }
 }
Exemplo n.º 2
0
function gp_scripts_default(&$scripts)
{
    $scripts->base_url = gp_url('js');
    $scripts->default_version = gp_get_option('version');
    $scripts->add('jquery', '/jquery/jquery.js', array(), '1.3.2-min');
    $scripts->add('jquery-ui-core', '/jquery/ui.core.js', array('jquery'), '1.7.2');
    $scripts->add('jquery-ui-tabs', '/jquery/ui.tabs.js', array('jquery-ui-core'), '1.7.2');
    $scripts->add('jquery-ui-tabs', '/jquery/ui.tabs.js', array('jquery-ui-core'), '1.7.2');
    $scripts->add('jquery-ui-selectable', '/jquery/ui.selectable.js', array('jquery-ui-core'), '1.7.2');
    $scripts->add('common', '/common.js', array('jquery'));
    $scripts->add('editor', '/editor.js', array('common'));
    $scripts->add('translations-page', '/translations-page.js', array('common'));
}
Exemplo n.º 3
0
function gp_scripts_default(&$scripts)
{
    $scripts->base_url = gp_url_base('js');
    $scripts->default_version = gp_get_option('version');
    $bump = '20150430';
    $scripts->add('jquery', '/jquery/jquery.js', array(), '1.11');
    $scripts->add('jquery-ui', '/jquery/jquery-ui.js', array('jquery'), '1.10.4');
    $scripts->add('jquery-ui-autocomplete', null, array('jquery-ui'), '1.10.4');
    $scripts->add('jquery-ui-selectable', null, array('jquery-ui'), '1.10.4');
    $scripts->add('jquery-ui-tabs', null, array('jquery-ui'), '1.10.4');
    $scripts->add('tablesorter', '/jquery.tablesorter.min.js', array('jquery'), '1.10.4');
    $scripts->add('common', '/common.js', array('jquery'), $bump);
    $scripts->add('editor', '/editor.js', array('common'), $bump);
    $scripts->add('glossary', '/glossary.js', array('common'), $bump);
    $scripts->add('translations-page', '/translations-page.js', array('common'), $bump);
    $scripts->add('mass-create-sets-page', '/mass-create-sets-page.js', array('common'), $bump);
}
 public static function get($option)
 {
     switch ($option) {
         case 'application_id':
             return 'glotpress';
         case 'application_uri':
             return gp_url();
         case 'cron_uri':
             return '';
         case 'cron_check':
             return '';
         case 'charset':
             return 'UTF-8';
         case 'wp_http_version':
             return 'GlotPress/' . gp_get_option('version');
         case 'hash_function_name':
             return 'gp_hash';
         default:
             return gp_get_option(BP_Options::prefix() . $option);
     }
 }
Exemplo n.º 5
0
 public function print_exported_file($project, $locale, $translation_set, $entries)
 {
     $po = new $this->class();
     // TODO: add more meta data in the project: language team, report URL
     $po->set_header('PO-Revision-Date', GP::$translation->last_modified($translation_set) . '+0000');
     $po->set_header('MIME-Version', '1.0');
     $po->set_header('Content-Type', 'text/plain; charset=UTF-8');
     $po->set_header('Content-Transfer-Encoding', '8bit');
     $po->set_header('Plural-Forms', "nplurals={$locale->nplurals}; plural={$locale->plural_expression};");
     $po->set_header('X-Generator', 'GlotPress/' . gp_get_option('version'));
     // force export only current translations
     $filters = array();
     $filters['status'] = 'current';
     foreach ($entries as $entry) {
         $po->add_entry($entry);
     }
     $po->set_header('Project-Id-Version', $project->name);
     // TODO: include parent project's names in the comment
     $po->comments_before_headers .= "Translation of {$project->name} in {$locale->english_name}\n";
     $po->comments_before_headers .= "This file is distributed under the same license as the {$project->name} package.\n";
     return $po->export();
 }
Exemplo n.º 6
0
 function export_as_po()
 {
     if (!isset($this->project) || !$this->project) {
         $this->project = GP::$project->get($this->project_id);
     }
     // TODO: rename locale column to locale_slug and use freely $this->locale as the locale object
     $locale = GP_Locales::by_slug($this->locale);
     $po = new PO();
     // TODO: add more meta data in the project: language team, report URL
     // TODO: last updated for a translation set
     $po->set_header('PO-Revision-Date', gmdate('Y-m-d H:i:s+0000'));
     $po->set_header('MIME-Version', '1.0');
     $po->set_header('Content-Type', 'text/plain; charset=UTF-8');
     $po->set_header('Content-Transfer-Encoding', '8bit');
     $po->set_header('Plural-Forms', "nplurals={$locale->nplurals}; plural={$locale->plural_expression};");
     $po->set_header('X-Generator', 'GlotPress/' . gp_get_option('version'));
     $entries = GP::$translation->for_translation($this->project, $this, 'no-limit', array('status' => 'current'));
     foreach ($entries as $entry) {
         $po->add_entry($entry);
     }
     $po->set_header('Project-Id-Version', $this->project->name);
     return $po->export();
 }
Exemplo n.º 7
0
/**
 * Echoes the requested bbPress option by calling gp_get_option()
 *
 * @param string The option to be echoed
 * @return void
 */
function gp_option($option)
{
    echo apply_filters('gp_option_' . $option, gp_get_option($option));
}
Exemplo n.º 8
0
</head>

<body <?php 
body_class();
?>
>
	<script type="text/javascript">document.body.className = document.body.className.replace('no-js','js');</script>

	<header class="gp-bar clearfix">
		<h1>
			<a href="<?php 
echo gp_url('/');
?>
" rel="home">
				<?php 
echo gp_get_option('title');
?>
			</a>
		</h1>

		<nav id="main-navigation" role="navigation">
			<?php 
echo gp_nav_menu();
?>
		</nav>

		<nav id="side-navigation">
			<?php 
echo gp_nav_menu('side');
?>
		</nav>
Exemplo n.º 9
0
<?php

/**
 * Landing point for GlotPress installation
 */
define('GP_INSTALLING', true);
require_once 'gp-load.php';
require_once BACKPRESS_PATH . 'class.bp-sql-schema-parser.php';
require_once GP_PATH . GP_INC . 'install-upgrade.php';
require_once GP_PATH . GP_INC . 'schema.php';
$show_htaccess_instructions = false;
$action = 'upgrade';
if (gp_get_option('gp_db_version') <= gp_get_option_from_db('gp_db_version') && !isset($_GET['force'])) {
    $success_message = __('You already have the latest version, no need to upgrade!');
} else {
    if (gp_is_installed()) {
        $success_message = __('GlotPress was successully upgraded!');
        $errors = gp_upgrade();
        $show_htaccess_instructions = !gp_set_htaccess() && empty($errors);
    } else {
        if (defined('CUSTOM_USER_TABLE')) {
            $errors = gp_install();
            $success_message = __('GlotPress was successully installed!');
            if (!$errors) {
                gp_create_initial_contents();
            }
            $show_htaccess_instructions = !gp_set_htaccess() && empty($errors);
            $action = 'installed';
        } else {
            if (isset($_POST['user_name'], $_POST['user_name'], $_POST['admin_password'], $_POST['admin_password2'], $_POST['admin_email'])) {
                $user_name = trim(stripslashes_deep($_POST['user_name']));
Exemplo n.º 10
0
function gp_update_db_version()
{
    gp_update_option('gp_db_version', gp_get_option('gp_db_version'));
}
Exemplo n.º 11
0
function _gp_get_salt($constants, $option = false)
{
    if (!is_array($constants)) {
        $constants = array($constants);
    }
    foreach ($constants as $constant) {
        if (defined($constant)) {
            return constant($constant);
        }
    }
    if (!defined('GP_INSTALLING') || !GP_INSTALLING) {
        if (!$option) {
            $option = strtolower($constants[0]);
        }
        $salt = gp_get_option($option);
        if (empty($salt)) {
            $salt = gp_generate_password();
            gp_update_option($option, $salt);
        }
        return $salt;
    }
    return '';
}
Exemplo n.º 12
0
function gp_url_base()
{
    return gp_get_option('url');
}
Exemplo n.º 13
0
function gp_url_base_root()
{
    $url_from_db = gp_get_option('url');
    return gp_const_get('GP_BASE_URL', $url_from_db ? $url_from_db : guess_uri());
}