当前位置: 首页>>代码示例>>PHP>>正文


PHP Ak::randomString方法代码示例

本文整理汇总了PHP中Ak::randomString方法的典型用法代码示例。如果您正苦于以下问题:PHP Ak::randomString方法的具体用法?PHP Ak::randomString怎么用?PHP Ak::randomString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Ak的用法示例。


在下文中一共展示了Ak::randomString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setImage

 public function setImage($image_path)
 {
     $this->Image = new AkImage($image_path);
     $this->Image->transform('resize', array('size' => '24x24'));
     $this->_tmp_file = AK_TMP_DIR . DS . '__AkImageColorScheme_' . Ak::randomString(32) . '.jpg';
     $this->Image->save($this->_tmp_file);
 }
开发者ID:bermi,项目名称:akelos,代码行数:7,代码来源:color_scheme.php

示例2: Test_of_encrypt_decrypt

 public function Test_of_encrypt_decrypt()
 {
     $original = "Este es el texto que quiero encriptar";
     $this->assertEqual(Ak::decrypt(Ak::encrypt($original)), $original);
     $key = Ak::randomString(20);
     $file = file_get_contents(__FILE__);
     $ecripted = Ak::encrypt($file, $key);
     $this->assertEqual(Ak::decrypt($ecripted, $key), $file);
 }
开发者ID:bermi,项目名称:akelos,代码行数:9,代码来源:support_functions.php

示例3: trace

 /**
  * Trace helper function for development purposes
  *
  * @access public
  * @static
  * @param    string    $text    Helper text
  * @param    string    $line    Helper line
  * @param    string    $file    Helper file
  * @return echoes result to screen
  */
 static function trace($text = null, $line = null, $file = null, $method = null, $escape_html_entities = true)
 {
     static $counter = 0;
     if (AK_PRODUCTION_MODE) {
         return;
     }
     $html_entities_function = $escape_html_entities ? 'htmlentities' : 'trim';
     list($default_file, $default_line, $default_method) = self::getLastFileAndLineAndMethod();
     $default_method = is_bool($text) || empty($text) ? 'var_dump' : $default_method;
     $line = is_null($line) ? $default_line : $line;
     $file = is_null($file) ? $default_file : $file;
     $method = is_null($method) ? $default_method : $method;
     if (AK_CLI) {
         $text = self::dump($text, 'print_r');
     } elseif (!empty($text) && !is_scalar($text)) {
         $rand = Ak::randomString();
         $formatted = '';
         $methods = array('print_r', 'var_dump', 'var_export');
         foreach ($methods as $method) {
             $pre_style = 'display:none;';
             if (defined('AK_TRACE_DUMP_METHOD')) {
                 if (AK_TRACE_DUMP_METHOD == $method) {
                     $pre_style = '';
                 }
             } elseif ($method == 'print_r') {
                 $pre_style = '';
             }
             $element_id = $method . '_' . $rand;
             $formatted .= "<div style='margin:10px;'><a href='javascript:void(0);' onclick='e_{$element_id} = document.getElementById(\"{$element_id}\"); e_{$element_id}.style.display = (e_{$element_id}.style.display == \"none\"?\"block\":\"none\");' title='Set the constant AK_TRACE_DUMP_METHOD to your favourite default method'>{$method}</a><br />" . '<pre style="' . $pre_style . '" id="' . $element_id . '">' . $html_entities_function(self::dump($text, $method)) . '</pre></div>';
         }
         $text = $formatted;
     } elseif (is_bool($text) || empty($text)) {
         $text = '<pre style="margin:10px;">' . $html_entities_function(self::dump($text, $default_method)) . '</pre>';
     } elseif (is_scalar($text)) {
         $text = '<pre style="margin:10px;">' . $html_entities_function($text) . '</pre>';
     }
     if (!isset($text)) {
         $counter++;
         $text = '';
     } else {
         $text = AK_CLI ? '---> ' . $text : $text;
     }
     $include_file_and_line = strlen(trim($file . $line)) > 0;
     if ($include_file_and_line) {
         echo AK_CLI ? "----------------\n{$file} ({$line}):\n {$text}\n----------------\n" : "<div style='background-color:#fff;margin:10px;color:#000;font-family:sans-serif;border:3px solid #fc0;font-size:12px;'><div style='background-color:#ffc;padding:10px;color:#000;font-family:sans-serif;'>{$file} <span style='font-weight:bold'>{$line}</span></div>" . $text . "</div>\n";
     } else {
         echo AK_CLI ? "----------------\n {$text}\n----------------\n" : "<div style='background-color:#fff;margin:10px;color:#000;font-family:sans-serif;border:1px solid #ccc;font-size:12px;'>" . $text . "</div>\n";
     }
 }
开发者ID:bermi,项目名称:akelos,代码行数:59,代码来源:debug.php

示例4: init

 function init()
 {
     $this->ext = empty($this->ext) ? 'doc' : strtolower(trim($this->ext, '.'));
     $this->tmp_name = Ak::randomString();
     if (empty($this->source_file)) {
         $this->source_file = AK_CACHE_DIR . DS . $this->tmp_name . '.' . $this->ext;
         Ak::file_put_contents($this->source_file, $this->source);
         $this->delete_source_file = true;
         $this->keep_destination_file = empty($this->keep_destination_file) ? empty($this->destination_file) ? false : true : $this->keep_destination_file;
     } else {
         $this->delete_source_file = false;
         $this->keep_destination_file = true;
     }
     $this->convert_to = 'txt';
     $this->destination_file_name = empty($this->destination_file_name) ? $this->tmp_name . '.' . $this->convert_to : $this->destination_file_name . (strstr($this->destination_file_name, '.') ? '' : '.' . $this->convert_to);
     $this->destination_file = empty($this->destination_file) ? AK_CACHE_DIR . DS . $this->destination_file_name : $this->destination_file;
 }
开发者ID:joeymetal,项目名称:v1,代码行数:17,代码来源:AkXdocToText.php

示例5: init

 public function init()
 {
     $this->ext = empty($this->ext) ? 'xls' : strtolower(trim($this->ext, '.'));
     $this->tmp_name = Ak::randomString();
     if (empty($this->source_file)) {
         $this->source_file = AK_TMP_DIR . DS . $this->tmp_name . '.' . $this->ext;
         Ak::file_put_contents($this->source_file, $this->source);
         $this->delete_source_file = true;
         $this->keep_destination_file = empty($this->keep_destination_file) ? empty($this->destination_file) ? false : true : $this->keep_destination_file;
     } else {
         $this->delete_source_file = false;
         $this->keep_destination_file = true;
     }
     $this->convert_to = !empty($this->convert_to) && empty($this->_file_type_codes[$this->convert_to]) ? 'csv' : (empty($this->convert_to) ? 'csv' : $this->convert_to);
     $this->destination_file_name = empty($this->destination_file_name) ? $this->tmp_name . '.' . $this->convert_to : $this->destination_file_name . (strstr($this->destination_file_name, '.') ? '' : '.' . $this->convert_to);
     $this->destination_file = empty($this->destination_file) ? AK_TMP_DIR . DS . $this->destination_file_name : $this->destination_file;
 }
开发者ID:joeymetal,项目名称:v1,代码行数:17,代码来源:AkMsExcelToMany.php

示例6: init

 function init()
 {
     if (empty($this->handler)) {
         require_once AK_VENDOR_DIR . DS . 'Excel' . DS . 'reader.php';
         $this->handler = new Spreadsheet_Excel_Reader();
         $this->handler->setRowColOffset(empty($this->first_column) ? 0 : $this->first_column);
     }
     $this->tmp_name = Ak::randomString();
     if (empty($this->source_file)) {
         $this->source_file = AK_CACHE_DIR . DS . $this->tmp_name . '.xls';
         Ak::file_put_contents($this->source_file, $this->source);
         $this->delete_source_file = true;
         $this->keep_destination_file = empty($this->keep_destination_file) ? empty($this->destination_file) ? false : true : $this->keep_destination_file;
     } else {
         $this->delete_source_file = false;
         $this->keep_destination_file = true;
     }
 }
开发者ID:joeymetal,项目名称:v1,代码行数:18,代码来源:AkExcelToArray.php

示例7: _setAssociatedMemberId

 public function _setAssociatedMemberId(&$Member)
 {
     if (empty($Member->__hasAndBelongsToManyMemberId)) {
         $Member->__hasAndBelongsToManyMemberId = Ak::randomString();
     }
     $object_id = $Member->getId();
     if (!empty($object_id)) {
         $this->associated_ids[$object_id] = $Member->__hasAndBelongsToManyMemberId;
     }
 }
开发者ID:joeymetal,项目名称:v1,代码行数:10,代码来源:AkHasAndBelongsToMany.php

示例8: _setAssociatedMemberId

 public function _setAssociatedMemberId(&$Member)
 {
     if (empty($Member->__hasManyMemberId)) {
         $Member->__hasManyMemberId = Ak::randomString();
     }
     $object_id = method_exists($Member, 'getId') ? $Member->getId() : null;
     if (!empty($object_id)) {
         $this->associated_ids[$object_id] = $Member->__hasManyMemberId;
     }
 }
开发者ID:joeymetal,项目名称:v1,代码行数:10,代码来源:AkHasMany.php

示例9: uncompress

 function uncompress($compressed_data, $format = 'gzip')
 {
     $key = Ak::randomString(15);
     $compressed_file = AK_TMP_DIR . DS . 's' . $key;
     $uncompressed_file = AK_TMP_DIR . DS . 'd' . $key;
     if (Ak::file_put_contents($compressed_file, $compressed_data, array('base_path' => AK_TMP_DIR))) {
         $compressed = gzopen($compressed_file, "r");
         $uncompressed = fopen($uncompressed_file, "w");
         while (!gzeof($compressed)) {
             $string = gzread($compressed, 4096);
             fwrite($uncompressed, $string, strlen($string));
         }
         gzclose($compressed);
         fclose($uncompressed);
     } else {
         trigger_error(Ak::t('Could not write to temporary directory for generating uncompressing file using Ak::uncompress(). Please provide write access to %dirname', array('%dirname' => AK_TMP_DIR)), E_USER_ERROR);
     }
     $result = Ak::file_get_contents($uncompressed_file, array('base_path' => AK_TMP_DIR));
     return $result;
 }
开发者ID:joeymetal,项目名称:v1,代码行数:20,代码来源:Ak.php

示例10: form_authenticity_token

 public static function form_authenticity_token()
 {
     if (!isset($_SESSION['_csrf_token'])) {
         $_SESSION['_csrf_token'] = sha1(Ak::uuid() . Ak::randomString());
     }
     return $_SESSION['_csrf_token'];
 }
开发者ID:bermi,项目名称:akelos,代码行数:7,代码来源:ak_form_helper.php

示例11: test_should_create_base_path_ticket_148

 public function test_should_create_base_path_ticket_148()
 {
     $tmp_dir = AkConfig::getDir('tmp') . DS . Ak::randomString();
     $base_path = AkConfig::getDir('tmp') . 'new_dir_' . time();
     AkFileSystem::make_dir($base_path, array('base_path' => $base_path));
     $this->assertTrue(is_dir($base_path), 'Could base_path directory ' . $base_path);
     clearstatcache();
 }
开发者ID:bermi,项目名称:akelos,代码行数:8,代码来源:file_handling.php

示例12: sendDataAsStream

 /**
  * Creates a file for streaming from a file.
  * This way you might free memory usage is file is too large
  */
 function sendDataAsStream($data, $options)
 {
     $temp_file_name = tempnam(AK_TMP_DIR, Ak::randomString());
     $fp = fopen($temp_file_name, 'w');
     fwrite($fp, $data);
     fclose($fp);
     $this->sendFile($temp_file_name, $options);
 }
开发者ID:joeymetal,项目名称:v1,代码行数:12,代码来源:AkActionController.php

示例13: test_framework_config_locale_update

 function test_framework_config_locale_update()
 {
     $langs=Ak::langs();
     $translation_key=Ak::randomString(8);
     $this->assertEqual(Ak::t($translation_key),$translation_key);
     AkLocaleManager::updateLocaleFiles();
     list($locales,$core_dictionary) = AkLocaleManager::getCoreDictionary(AK_FRAMEWORK_LANGUAGE);
     $this->assertTrue(isset($core_dictionary[$translation_key]));
     
     foreach($langs as $lang) {
         list($locales,$core_dictionary) = AkLocaleManager::getCoreDictionary($lang);
         $this->assertTrue(isset($core_dictionary[$translation_key]));
     }
 }
开发者ID:joeymetal,项目名称:v1,代码行数:14,代码来源:AkLocaleManager.php

示例14: test_should_delete_nested_directories_when_include_hidden_files

 function test_should_delete_nested_directories_when_include_hidden_files()
 {
     $dir_name = AK_TMP_DIR . Ak::randomString();
     Ak::make_dir($dir_name);
     Ak::make_dir($dir_name . DS . '.hidden');
     $this->assertTrue(is_dir($dir_name), 'Could not create test directory ' . $dir_name);
     $this->assertTrue(Ak::directory_delete($dir_name));
     clearstatcache();
     $this->assertFalse(is_dir($dir_name));
 }
开发者ID:joeymetal,项目名称:v1,代码行数:10,代码来源:_Ak_file_functions.php

示例15: getBoundaryString

 public function getBoundaryString()
 {
     return md5(Ak::randomString(10) . time());
 }
开发者ID:joeymetal,项目名称:v1,代码行数:4,代码来源:AkMailComposer.php


注:本文中的Ak::randomString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。