/** * Get a migration path by name * * @param string $name * @return string */ public static function path($name, $time = null) { if (is_null($time)) { $time = time(); } $namespace = null; if (strpos($name, '::') !== false) { list($namespace, $name) = explode('::', $name); } $name = explode('/', $name); foreach ($name as $key => $value) { $name[$key] = \CCStr::clean_url($value, '_'); } $name = implode('/', $name); return \CCPath::get(($namespace ? $namespace . '::' : '') . $name . '_' . $time, \ClanCats::directory('migration'), '.sql'); }
/** * Add a replacement param * * @param string $key * @param string $value * * @return void */ public static function param($key, $value) { static::$params[$key] = CCStr::clean_url($value); }
/** * test clean url strings */ public function testCleanUrl() { $this->assertEquals(CCStr::clean_url('<>Hellö World!</>'), 'helloe-world'); $this->assertEquals(CCStr::clean_url('-- s-a- -as/&EDö__ $'), 's-a-as-edoe'); $this->assertEquals(CCStr::clean_url(' - Ich bin nüscht such: Ideal!'), 'ich-bin-nuescht-such-ideal'); $this->assertEquals(CCStr::clean_url('Tom&Jerry'), 'tom-jerry'); }
/** * Send the mail * * @param CCMail $mail The mail object. * @return void * * @throws Mail\Exception */ public function send(CCMail $mail) { $data = $mail->export_data(); $filename = 'mails/' . date('Y-m') . '/' . date('d') . '/' . date("H-i-s") . '-' . \CCStr::clean_url($data['subject']) . '.log'; \CCFile::append(\CCStorage::path($filename), \CCJson::encode($data, true)); }
<?php /* *--------------------------------------------------------------- * Database configuration *--------------------------------------------------------------- */ return array('main' => array('db' => 'db_' . CCStr::clean_url(App::name(), '_'), 'driver' => 'mysql', 'host' => '127.0.0.1', 'user' => 'root', 'pass' => '', 'charset' => 'utf8'));