ucfirst() static public method

An UTF-8 safe version of ucfirst()
static public ucfirst ( $str ) : string
return string
Esempio n. 1
0
 public function send()
 {
     if (c::get('email.disabled')) {
         return array('status' => 'error', 'msg' => l::get('email.disabled', 'Email has been disabled'));
     }
     if (!v::email($this->extractAddress($this->options['from']))) {
         return array('status' => 'error', 'msg' => l::get('email.error.invalid.sender', 'Invalid sender'));
     }
     if (!v::email($this->extractAddress($this->options['to']))) {
         return array('status' => 'error', 'msg' => l::get('email.error.invalid.recipient', 'Invalid recipient'));
     }
     if (!v::email($this->extractAddress($this->options['replyto']))) {
         return array('status' => 'error', 'msg' => l::get('email.error.invalid.replyto', 'Invalid Reply-To Address'));
     }
     if (str::length($this->options['subject']) == 0) {
         return array('status' => 'error', 'msg' => l::get('email.error.invalid.subject', 'The subject is missing'));
     }
     $method = 'sendWith' . str::ucfirst($this->options['use']);
     if (!method_exists(__CLASS__, $method)) {
         return array('status' => 'error', 'msg' => l::get('email.error.invalid.mailer', 'This email service is not supported'));
     }
     return $this->{$method}();
 }
Esempio n. 2
0
}
/**
 * Json adapter
 */
data::$adapters['json'] = array('extension' => 'json', 'encode' => function ($data) {
    return json_encode($data);
}, 'decode' => function ($string) {
    return json_decode($string, true);
});
/**
 * Kirby data adapter
 */
data::$adapters['kd'] = array('extension' => array('md', 'txt'), 'encode' => function ($data) {
    $result = array();
    foreach ($data as $key => $value) {
        $key = str::ucfirst(str::slug($key));
        if (empty($key) or is_null($value)) {
            continue;
        }
        // escape accidental dividers within a field
        $value = preg_replace('!(\\n|^)----(.*?\\R*)!', "\$1\\----\$2", $value);
        // multi-line content
        if (preg_match('!\\R!', $value, $matches)) {
            $result[$key] = $key . ": \n\n" . trim($value);
            // single-line content
        } else {
            $result[$key] = $key . ': ' . trim($value);
        }
    }
    return implode("\n\n----\n\n", $result);
}, 'decode' => function ($string) {
Esempio n. 3
0
        ecco(trim($variant->description()) != '', $variant->description()->kirbytext()->bidi());
        ?>
								</div>

								<?php 
        if ($variant->hasOptions) {
            ?>
									<select dir="auto" class="uk-width-1-1" name="option">
										<?php 
            foreach (str::split($variant->options()) as $option) {
                ?>
											<option value="<?php 
                echo str::slug($option);
                ?>
"><?php 
                echo str::ucfirst($option);
                ?>
</option>
										<?php 
            }
            ?>
									</select>
								<?php 
        }
        ?>

								<button <?php 
        e(inStock($variant), '', 'disabled');
        ?>
 class="uk-button uk-button-primary uk-width-1-1" type="submit" property="offers" typeof="Offer">
									<?php 
Esempio n. 4
0
 public function testUcfirst()
 {
     $string = str::lower($this->sample);
     $this->assertEquals('Super äwesøme string', str::ucfirst($string));
 }
Esempio n. 5
0
    ?>
    
  </div>

  <?php 
} else {
    ?>
  

  <div class="info">
    <dl>
      <?php 
    foreach (data::siteData() as $key => $value) {
        ?>
      <dt><?php 
        echo str::ucfirst($key);
        ?>
</dt>
      <dd><?php 
        echo empty($value) ? '&nbsp;' : html($value);
        ?>
</dd>
      <?php 
    }
    ?>
        
    </dl>
  </div>

  <?php 
}
Esempio n. 6
0
 function label($var)
 {
     return '<label>' . str::ucfirst($var) . '</label>';
 }
Esempio n. 7
0
 static function templateName($name = false)
 {
     global $page;
     $template = $name ? $name : $page->template();
     $settings = settings::load($template);
     return $settings ? a::get($settings, 'title', str::ucfirst($template)) : str::ucfirst($template);
 }
Esempio n. 8
0
 function label($var, $field)
 {
     $text = self::multilangtext($var, $field['name']);
     $required = $field['required'] == true ? '<span class="required">*</span>' : '';
     $lang = c::get('lang.support') ? '<small>' . c::get('lang.current') . '</small>' : '';
     return '<label>' . str::ucfirst($text) . $lang . $required . '</label>';
 }
Esempio n. 9
0
 function label($var, $field)
 {
     $required = $field['required'] == true ? '<span class="required">*</span>' : '';
     return '<label>' . str::ucfirst($var) . $required . '</label>';
 }
Esempio n. 10
0
data::$adapters['json'] = array('extension' => 'json', 'encode' => function ($data) {
    return json_encode($data);
}, 'decode' => function ($string) {
    return json_decode($string, true);
});
/**
 * Kirby data adapter
 */
data::$adapters['kd'] = array('extension' => array('md', 'txt'), 'encode' => function ($data) {
    $divider = "\n----\n";
    $result = null;
    $break = null;
    $keys = array();
    foreach ($data as $key => $value) {
        $key = str::slug($key);
        $key = str::ucfirst(str_replace('-', '_', $key));
        if (in_array($key, $keys) || empty($key)) {
            continue;
        }
        $keys[] = $key;
        $result .= $break . $key . ': ' . trim($value);
        $break = $divider;
    }
    return $result;
}, 'decode' => function ($string) {
    // remove BOM
    $string = str_replace(BOM, '', $string);
    // explode all fields by the line separator
    $fields = explode("\n----", $string);
    // start the data array
    $data = array();