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


PHP Ak::t方法代码示例

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


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

示例1: makeClassExtensible

 function makeClassExtensible($class_name_to_extend)
 {
     list($checksum, $source) = $this->_getExtensionSourceAndChecksum($class_name_to_extend);
     $merge_path = AK_TMP_DIR . DS . '.lib';
     if ($source) {
         if (preg_match_all('/[ \\n\\t]*([a-z]+)[ \\n\\t]*extends[ \\n\\t]*(' . $class_name_to_extend . ')[ \\n\\t]*[ \\n\\t]*{/i', $source, $matches)) {
             $replacements = array();
             $extended_by = array();
             foreach ($matches[2] as $k => $class_to_extend) {
                 if (empty($last_method) && class_exists($class_to_extend)) {
                     $last_method = $class_to_extend;
                 }
                 if ($class_to_extend == $last_method || !empty($extended_by[$class_to_extend]) && in_array($last_method, $extended_by[$class_to_extend])) {
                     if (!class_exists($matches[1][$k])) {
                         $replacements[trim($matches[0][$k], "\n\t {")] = $matches[1][$k] . ' extends ' . $last_method;
                         $last_method = $matches[1][$k];
                         $extended_by[$class_to_extend][] = $last_method;
                     } else {
                         trigger_error(Ak::t('The class %class is already defined and can\'t be used for extending %parent_class', array('%class' => $matches[1][$k], '%parent_class' => $class_name_to_extend)), E_NOTICE);
                     }
                 }
             }
             $source = str_replace(array_keys($replacements), array_values($replacements), $source);
         }
         $source = "{$source}<?php class Extensible{$class_name_to_extend} extends {$last_method}{} ?>";
         if (md5($source) != @md5_file($merge_path . DS . 'Extensible' . $class_name_to_extend . '.php')) {
             Ak::file_put_contents($merge_path . DS . 'Extensible' . $class_name_to_extend . '.php', $source);
             Ak::file_put_contents($merge_path . DS . 'checksums' . DS . 'Extensible' . $class_name_to_extend, $checksum);
         }
     }
     include_once $merge_path . DS . 'Extensible' . $class_name_to_extend . '.php';
 }
开发者ID:joeymetal,项目名称:v1,代码行数:32,代码来源:AkClassExtender.php

示例2: checkForCollisions

 function checkForCollisions(&$directory_structure, $base_path = AK_ADMIN_PLUGIN_FILES_DIR)
 {
     foreach ($directory_structure as $k=>$node){
         if(!empty($this->skip_all)){
             return ;
         }
         $path = str_replace(AK_ADMIN_PLUGIN_FILES_DIR, AK_BASE_DIR, $base_path.DS.$node);
         if(is_file($path)){
             $message = Ak::t('File %file exists.', array('%file'=>$path));
             $user_response = AkInstaller::promptUserVar($message."\n d (overwrite mine), i (keep mine), a (abort), O (overwrite all), K (keep all)", 'i');
             if($user_response == 'i'){
                 unset($directory_structure[$k]);
             }    elseif($user_response == 'O'){
                 return false;
             }    elseif($user_response == 'K'){
                 $directory_structure = array();
                 return false;
             }elseif($user_response != 'd'){
                 echo "\nAborting\n";
                 exit;
             }
         }elseif(is_array($node)){
             foreach ($node as $dir=>$items){
                 $path = $base_path.DS.$dir;
                 if(is_dir($path)){
                     if($this->checkForCollisions($directory_structure[$k][$dir], $path) === false){
                         $this->skip_all = true;
                         return;
                     }
                 }
             }
         }
     }
 }
开发者ID:joeymetal,项目名称:v1,代码行数:34,代码来源:admin_installer.php

示例3: hasCollisions

    function hasCollisions()
    {
        $this->collisions = array();
        $this->_preloadPaths();
        $this->actions = empty($this->actions) ? array() : (array)$this->actions;

        $files = array(
        AK_APP_DIR.DS.$this->controller_path,
        AK_TEST_DIR.DS.'functional'.DS.'app'.DS.$this->controller_path,
        AK_TEST_DIR.DS.'fixtures'.DS.'app'.DS.$this->controller_path,
        AK_TEST_DIR.DS.'fixtures'.DS.'app'.DS.'helpers'.DS.$this->underscored_controller_name."_helper.php",
        AK_HELPERS_DIR.DS.$this->underscored_controller_name."_helper.php"
        );
        
        foreach ($this->actions as $action){
            $files[] = AK_VIEWS_DIR.DS.$this->module_path.AkInflector::underscore($this->controller_name).DS.$action.'.tpl';
        }

        foreach ($files as $file_name){
            if(file_exists($file_name)){
                $this->collisions[] = Ak::t('%file_name file already exists',array('%file_name'=>$file_name));
            }
        }
        return count($this->collisions) > 0;
    }
开发者ID:joeymetal,项目名称:v1,代码行数:25,代码来源:controller_generator.php

示例4: generateModel

 function generateModel($model_name)
 {
     $model_source_code = "class " . $model_name . " extends ActiveRecord {} ";
     $has_errors = @eval($model_source_code) === false;
     if ($has_errors) {
         trigger_error(Ak::t('Could not declare the model %modelname.', array('%modelname' => $model_name)), E_USER_ERROR);
     }
 }
开发者ID:joeymetal,项目名称:v1,代码行数:8,代码来源:PHPUnit_Model_TestCase.php

示例5: Test_t

 function Test_t()
 {
     $text_to_translate = 'Hello, %name, today is %weekday';
     $vars_to_replace = array('%name' => 'Bermi', '%weekday' => 'monday');
     $this->assertEqual(Ak::t($text_to_translate), 'Hello, %name, today is %weekday', 'String with tokens but no replacement array given.');
     $this->assertEqual(Ak::t($text_to_translate), 'Hello, %name, today is %weekday', 'String with tokens but no replacement array given.');
     $this->assertEqual(Ak::t($text_to_translate, $vars_to_replace), 'Hello, Bermi, today is monday');
 }
开发者ID:joeymetal,项目名称:v1,代码行数:8,代码来源:_Ak_object_inspection.php

示例6: trigger_error

 public function &load($email_file)
 {
     if (!file_exists($email_file)) {
         trigger_error(Ak::t('Cannot find mail file at %path', array('%path' => $email_file)), E_USER_ERROR);
     }
     $Mail = new AkMail((array) AkMailParser::parse(file_get_contents($email_file)));
     return $Mail;
 }
开发者ID:bermi,项目名称:akelos,代码行数:8,代码来源:mail_base.php

示例7: hasCollisions

 public function hasCollisions()
 {
     $this->collisions = array();
     $this->destination_path = rtrim($this->destination_path, DS);
     if (is_dir($this->destination_path)) {
         $this->collisions[] = Ak::t('%path already exists', array('%path' => $this->destination_path));
     }
     return count($this->collisions) > 0;
 }
开发者ID:bermi,项目名称:hudson_job,代码行数:9,代码来源:hudson_job_generator.php

示例8: ensureSecretSecure

 /**
  * To prevent users from using something insecure like "Password" we make sure that the
  * secret they've provided is at least 30 characters in length.
  */
 private function ensureSecretSecure()
 {
     if (empty($this->options['secret'])) {
         throw new ArgumentException(Ak::t('A secret is required to generate an integrity hash for cookie session data. Use ' . 'AkConfig::setOption(\'action_controller.session\', ' . 'array("key" => "_myapp_session", "secret" => "some secret ' . 'phrase of at least %length characters")); in config/environment.php', array('%length' => self::SECRET_MIN_LENGTH)));
     }
     if (strlen($this->options['secret']) < self::SECRET_MIN_LENGTH) {
         throw new ArgumentException(Ak::t('Secret should be something secure, ' . 'like "%rand". The value you provided "%secret", ' . 'is shorter than the minimum length of %length characters', array('%length' => self::SECRET_MIN_LENGTH, '%rand' => Ak::uuid(), '%secret' => $this->options['secret'])));
     }
 }
开发者ID:bermi,项目名称:akelos,代码行数:13,代码来源:cookie_store.php

示例9: trim

 function &recognize($Map = null)
 {
     AK_ENVIRONMENT != 'setup' ? $this->_connectToDatabase() : null;
     $this->_startSession();
     $this->_enableInternationalizationSupport();
     $this->_mapRoutes($Map);
     $params = $this->getParams();
     $module_path = $module_class_peffix = '';
     if (!empty($params['module'])) {
         $module_path = trim(str_replace(array('/', '\\'), DS, Ak::sanitize_include($params['module'], 'high')), DS) . DS;
         $module_shared_model = AK_CONTROLLERS_DIR . DS . trim($module_path, DS) . '_controller.php';
         $module_class_peffix = str_replace(' ', '_', AkInflector::titleize(str_replace(DS, ' ', trim($module_path, DS)))) . '_';
     }
     $controller_file_name = AkInflector::underscore($params['controller']) . '_controller.php';
     $controller_class_name = $module_class_peffix . AkInflector::camelize($params['controller']) . 'Controller';
     $controller_path = AK_CONTROLLERS_DIR . DS . $module_path . $controller_file_name;
     include_once AK_APP_DIR . DS . 'application_controller.php';
     if (!empty($module_path) && file_exists($module_shared_model)) {
         include_once $module_shared_model;
     }
     if (!is_file($controller_path) || !(include_once $controller_path)) {
         defined('AK_LOG_EVENTS') && AK_LOG_EVENTS && $this->Logger->error('Controller ' . $controller_path . ' not found.');
         if (AK_ENVIRONMENT == 'development') {
             trigger_error(Ak::t('Could not find the file /app/controllers/<i>%controller_file_name</i> for ' . 'the controller %controller_class_name', array('%controller_file_name' => $controller_file_name, '%controller_class_name' => $controller_class_name)), E_USER_ERROR);
         } elseif (@(include AK_PUBLIC_DIR . DS . '404.php')) {
             $response = new AkTestResponse();
             $response->addHeader('Status', 404);
             return false;
             //exit;
         } else {
             //header("HTTP/1.1 404 Not Found");
             $response = new AkResponse();
             $response->addHeader('Status', 404);
             return false;
             //die('404 Not found');
         }
     }
     if (!class_exists($controller_class_name)) {
         defined('AK_LOG_EVENTS') && AK_LOG_EVENTS && $this->Logger->error('Controller ' . $controller_path . ' does not implement ' . $controller_class_name . ' class.');
         if (AK_ENVIRONMENT == 'development') {
             trigger_error(Ak::t('Controller <i>%controller_name</i> does not exist', array('%controller_name' => $controller_class_name)), E_USER_ERROR);
         } elseif (@(include AK_PUBLIC_DIR . DS . '405.php')) {
             exit;
         } else {
             $response = new AkResponse();
             $response->addHeader('Status', 405);
             return false;
             //header("HTTP/1.1 405 Method Not Allowed");
             //die('405 Method Not Allowed');
         }
     }
     $Controller =& new $controller_class_name(array('controller' => true));
     $Controller->_module_path = $module_path;
     isset($_SESSION) ? $Controller->session =& $_SESSION : null;
     return $Controller;
 }
开发者ID:joeymetal,项目名称:v1,代码行数:56,代码来源:AkTestRequest.php

示例10: setDate

 public function setDate($date = null, $validate = true)
 {
     $date = trim($date);
     $is_valid = preg_match("/^" . AK_ACTION_MAILER_RFC_2822_DATE_REGULAR_EXPRESSION . "\$/", $date);
     $date = !$is_valid ? date('r', empty($date) ? Ak::time() : (!is_numeric($date) ? strtotime($date) : $date)) : $date;
     if ($validate && !$is_valid && !preg_match("/^" . AK_ACTION_MAILER_RFC_2822_DATE_REGULAR_EXPRESSION . "\$/", $date)) {
         trigger_error(Ak::t('You need to supply a valid RFC 2822 date. You can just leave the date field blank or pass a timestamp and Akelos will automatically format the date for you'), E_USER_ERROR);
     }
     $this->date = $date;
 }
开发者ID:joeymetal,项目名称:v1,代码行数:10,代码来源:AkMailMessage.php

示例11: setAssociationId

 function setAssociationId($association_id)
 {
     $association_id = strtolower(AkInflector::underscore($association_id));
     if (isset($this->Owner->{$association_id})) {
         trigger_error(Ak::t('Could not load %association_id on %model_name because "%model_name->%association_id" attribute ' . 'is already defided and can\' be used as an association placeholder', array('%model_name' => $this->Owner->getModelName(), '%association_id' => $association_id)), E_USER_ERROR);
         return false;
     } else {
         return $association_id;
     }
 }
开发者ID:joeymetal,项目名称:v1,代码行数:10,代码来源:AkAssociation.php

示例12: hasCollisions

 function hasCollisions()
 {
     $this->collisions = array();
     foreach (array_merge(array_values($this->files), array_values($this->user_actions)) as $file_name) {
         if (file_exists($file_name)) {
             $this->collisions[] = Ak::t('%file_name file already exists', array('%file_name' => $file_name));
         }
     }
     return count($this->collisions) > 0;
 }
开发者ID:joeymetal,项目名称:v1,代码行数:10,代码来源:scaffold_generator.php

示例13: convert

 public function convert()
 {
     if (!xml_parse($this->_parser, $this->source)) {
         $this->addError(Ak::t('DBDesigner file is not well-formed.') . ' ' . xml_error_string(xml_get_error_code($this->_parser)));
     }
     foreach ($this->db_schema as $table => $create_text) {
         $this->db_schema[$table] = rtrim($create_text, ", \n");
     }
     return $this->db_schema;
 }
开发者ID:joeymetal,项目名称:v1,代码行数:10,代码来源:AkDBDesignerToAkelosDatabaseDesign.php

示例14: __construct

 public function __construct($client_driver)
 {
     $client_driver = AkInflector::underscore($client_driver);
     if (in_array($client_driver, $this->_available_drivers)) {
         $client_class_name = 'Ak' . AkInflector::camelize($client_driver) . 'Client';
         require_once AK_ACTION_PACK_DIR . DS . 'action_web_service' . DS . 'clients' . DS . $client_driver . '.php';
         $this->_Client = new $client_class_name($this);
     } else {
         trigger_error(Ak::t('Invalid Web Service driver provided. Available Drivers are: %drivers', array('%drivers' => join(', ', $this->_available_drivers))), E_USER_WARNING);
     }
 }
开发者ID:bermi,项目名称:akelos,代码行数:11,代码来源:client.php

示例15: set_db_user_and_pass

function set_db_user_and_pass(&$FrameworkSetup, &$db_user, &$db_pass, &$db_type, $defaults = true)
{
    global $options;
    $db_type = prompt_var('Database type', 'mysql', $defaults ? @$options['database'] : null);
    $db_user = prompt_var('Database user', $FrameworkSetup->suggestUserName(), $defaults ? @$options['user'] : null);
    $db_pass = prompt_var('Database password', '', $defaults ? @$options['password'] : null);
    if (!@NewADOConnection("{$db_type}://{$db_user}:{$db_pass}@localhost")) {
        echo Ak::t('Could not connect to the database' . "\n");
        set_db_user_and_pass($FrameworkSetup, $db_user, $db_pass, $db_type, false);
    }
}
开发者ID:joeymetal,项目名称:v1,代码行数:11,代码来源:configure.php


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