コード例 #1
0
ファイル: TextTest.php プロジェクト: neeckeloo/AmChartsPHP
 public function testToArray()
 {
     $this->assertCount(0, $this->text->toArray());
     $this->text->setAlign(Text::ALIGN_LEFT);
     $this->assertCount(1, $this->text->toArray());
     $this->text->setFontSize(12);
     $this->assertCount(2, $this->text->toArray());
 }
コード例 #2
0
ファイル: converter.php プロジェクト: razordaze/mecha-cms
 /**
  * ====================================================================
  *  CONVERT NESTED STRING INTO ASSOCIATIVE ARRAY
  * ====================================================================
  *
  * -- CODE: -----------------------------------------------------------
  *
  *    echo Converter::toArray('key_1: Value 1
  *    key_2: Value 2
  *    key_3: Value 3');
  *
  * --------------------------------------------------------------------
  *
  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  *  Parameter | Type   | Description
  *  --------- | ------ | ----------------------------------------------
  *  $input    | string | The string of data to be converted
  *  $s        | string | Separator between data key and data value
  *  $indent   | string | Indentation of nested string data level
  *  --------- | ------ | ----------------------------------------------
  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  *
  */
 public static function toArray($input, $s = S, $indent = '    ')
 {
     return Text::toArray($input, $s, $indent);
 }
コード例 #3
0
ファイル: converter.php プロジェクト: yiannisSt/mecha-cms
 /**
  * ====================================================================
  *  CONVERT NESTED STRING INTO ASSOCIATIVE ARRAY
  * ====================================================================
  *
  * -- CODE: -----------------------------------------------------------
  *
  *    echo Converter::toArray('key_1: Value 1
  *    key_2: Value 2
  *    key_3: Value 3');
  *
  * --------------------------------------------------------------------
  *
  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  *  Parameter | Type   | Description
  *  --------- | ------ | ----------------------------------------------
  *  $input    | string | The string of data to be converted
  *  $s        | string | Separator between data key and data value
  *  $indent   | string | Indentation of nested string data level
  *  --------- | ------ | ----------------------------------------------
  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  *
  */
 public static function toArray($input, $s = S, $indent = '    ')
 {
     if (is_array($input)) {
         return $input;
     }
     if (is_object($input)) {
         return Mecha::A($input);
     }
     return Text::toArray((string) $input, $s, $indent);
 }
コード例 #4
0
ファイル: ignite.php プロジェクト: yiannisSt/mecha-cms
    Weapon::add('SHIPMENT_REGION_BOTTOM', function () {
        echo Asset::javascript(SHIELD . DS . 'widgets.js', "", 'sword/widgets.min.js');
    });
}
/**
 * Loading Plugin(s)
 * -----------------
 */
Weapon::fire('plugins_before');
foreach ($plugins = Plugin::load() as $k => $v) {
    $__ = PLUGIN . DS . $k . DS;
    if (!($language = File::exist($__ . 'languages' . DS . $config->language . DS . 'speak.txt'))) {
        $language = $__ . 'languages' . DS . 'en_US' . DS . 'speak.txt';
    }
    if (file_exists($language)) {
        Config::merge('speak', Text::toArray(File::open($language)->read(), S, '  '));
        $speak = Config::speak();
        // refresh ...
    }
    Weapon::fire(array('plugin_before', 'plugin_' . md5($k) . '_before'));
    if ($launch = File::exist($__ . 'launch.php')) {
        if (strpos(File::B($__), '__') === 0) {
            if (Guardian::happy() && $config->page_type === 'manager') {
                include $launch;
                // backend
            }
        } else {
            include $launch;
            // frontend
        }
    }
コード例 #5
0
ファイル: cargo.config.php プロジェクト: AdeHaze/mecha-cms
      <span class="grid span-4">
      <?php 
echo Form::text('charset', Guardian::wayback('charset', $config->charset), null, array('class' => 'input-block'));
?>
      </span>
    </label>
    <label class="grid-group">
      <span class="grid span-2 form-label"><?php 
echo $speak->language;
?>
</span>
      <span class="grid span-4">
      <?php 
$language = array();
foreach (glob(LANGUAGE . DS . '*', GLOB_ONLYDIR) as $folder) {
    $s = Text::toArray(File::open($folder . DS . 'speak.txt')->get('  title:'), S, '  ');
    $folder = File::B($folder);
    $language[$folder] = isset($s['__']['title']) ? $s['__']['title'] : $folder;
}
echo Form::select('language', $language, Guardian::wayback('language', $config->language), array('class' => 'select-block'));
?>
      </span>
    </label>
    <label class="grid-group">
      <span class="grid span-2 form-label"><?php 
echo $speak->manager->title_language_direction;
?>
</span>
      <span class="grid span-4">
      <?php 
echo Form::select('language_direction', array('ltr' => 'Left to Right (LTR)', 'rtl' => 'Right to Left (RTL)'), Guardian::wayback('language_direction', $config->language_direction), array('class' => 'select-block'));
コード例 #6
0
ファイル: menu.php プロジェクト: razordaze/mecha-cms
 public static function get($array = null, $type = 'ul', $depth = "", $FP = "")
 {
     // Use menu file from the cabinet if `$array` is not defined
     if (is_null($array)) {
         $FP = 'navigation:';
         $array = Text::toArray(Get::state_menu(), S, '    ');
     }
     return O_BEGIN . rtrim(self::create($array, $type, $depth, $FP, 0), NL) . O_END;
 }
コード例 #7
0
ファイル: config.php プロジェクト: razordaze/mecha-cms
    if ($path !== "") {
        array_shift($_GET);
    }
    $queries = array();
    foreach ($_GET as $k => $v) {
        $queries[] = $k . '=' . urlencode($v);
    }
    // Loading the language file(s)
    $lang = LANGUAGE . DS . 'en_US' . DS . 'speak.txt';
    $lang_a = LANGUAGE . DS . $config['language'] . DS . 'speak.txt';
    if (!file_exists($lang) && !file_exists($lang_a)) {
        Guardian::abort('Language file not found.');
    }
    $lang = file_exists($lang) ? Text::toArray(File::open($lang)->read(), S, '  ') : array();
    if ($config['language'] !== 'en_US') {
        $lang_a = file_exists($lang_a) ? Text::toArray(File::open($lang_a)->read(), S, '  ') : array();
        Mecha::extend($lang, $lang_a);
    }
    $config['url_query'] = !empty($queries) ? '?' . implode('&', $queries) : "";
    $config['offset'] = isset($s[1]) && is_numeric($s[1]) ? (int) $s[1] : 1;
    $config['page_type'] = $page;
    $config['speak'] = $lang;
    Config::set($config);
});
/**
 * =============================================================
 *  GET LANGUAGE FILE TO SPEAK
 * =============================================================
 *
 * -- CODE: ----------------------------------------------------
 *
コード例 #8
0
     $html .= '<div class="grid-group grid-group-boolean">';
     $html .= '<span class="grid span-2"></span>';
     $html .= '<span class="grid span-4">';
     $html .= Form::checkbox('fields[' . $key . '][value]', !empty($value['value']) ? $value['value'] : '1', isset($field[$key]) && !empty($field[$key]), $value['title']) . $description;
     $html .= '</span>';
     $html .= '</div>';
 } else {
     if ($type === 'o') {
         $html .= '<label class="grid-group grid-group-option">';
         $html .= '<span class="grid span-2 form-label">' . $title . '</span>';
         $html .= '<span class="grid span-4">';
         $select = isset($field[$key]) ? $field[$key] : "";
         if (isset($value['placeholder']) && !is_array($value['value'])) {
             $value['value'] = S . $value['placeholder'] . "\n" . $value['value'];
         }
         $options = is_array($value['value']) ? $value['value'] : Text::toArray($value['value'], S, '  ');
         $html .= Form::select('fields[' . $key . '][value]', $options, $select, array('class' => 'select-block'));
         $html .= '</span>';
         $html .= '</label>';
     } else {
         if ($type === 'f') {
             $v = isset($value['value']) && $value['value'] !== "" ? $value['value'] : false;
             $vv = isset($field[$key]) && $field[$key] !== "" ? $field[$key] : false;
             $has_file = $vv !== false && file_exists(SUBSTANCE . DS . $vv) && is_file(SUBSTANCE . DS . $vv);
             $html .= '<div class="grid-group grid-group-file' . ($has_file ? ' grid-group-boolean' : "") . '">';
             $html .= !$has_file ? '<span class="grid span-2 form-label">' . $title . '</span>' : '<span class="grid span-2"></span>';
             $html .= '<span class="grid span-4">';
             if (!$has_file) {
                 $html .= Form::file($key);
                 $e = strtolower(str_replace(' ', "", $v));
                 $html .= $v !== false ? Form::hidden('fields[' . $key . '][accept]', $e) . '<br><small><strong>' . $speak->accepted . ':</strong> <code>*.' . str_replace(',', '</code>, <code>*.', $e) . '</code></small>' : "";
コード例 #9
0
ファイル: config.php プロジェクト: yiannisSt/mecha-cms
    if ($path === 'feed/json' || strpos($path, 'feed/json/') === 0) {
        $page = 'json';
    }
    // Create proper query string data
    if ($path !== "") {
        array_shift($_GET);
    }
    // Loading the language file(s)
    $lang = LANGUAGE . DS . 'en_US' . DS . 'speak.txt';
    $lang_a = LANGUAGE . DS . $config['language'] . DS . 'speak.txt';
    if (!file_exists($lang) && !file_exists($lang_a)) {
        Guardian::abort('Language file not found.');
    }
    $lang = Text::toArray(File::open($lang)->read(""), S, '  ');
    if ($config['language'] !== 'en_US') {
        $lang_a = Text::toArray(File::open($lang_a)->read(""), S, '  ');
        Mecha::extend($lang, $lang_a);
    }
    $config['query'] = $config['url_query'] = HTTP::query($_GET);
    $config['offset'] = isset($s[1]) && is_numeric($s[1]) ? (int) $s[1] : 1;
    $config['page_type'] = $page;
    $config['speak'] = $lang;
    $config['is'] = array('post' => $page !== '404' && Mecha::walk(glob(POST . DS . '*', GLOB_NOSORT | GLOB_ONLYDIR))->has(POST . DS . $page), 'posts' => Mecha::walk(array('index', 'tag', 'archive', 'search', ""))->has($page), 'response' => false, 'responses' => false);
    unset($ss, $s, $lang, $lang_a);
    Config::set($config);
});
/**
 * =============================================================
 *  GET LANGUAGE FILE TO SPEAK
 * =============================================================
 *