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


PHP Strings::get方法代码示例

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


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

示例1: prepare

  public function prepare()
  {
    $params = array();
    $params['id'] = $this->get('node_id');
    $params['action'] = 'order';
    $params['rn'] = time();
    $params['popup'] = 1;

    $this->set('order_up_alt', Strings :: get('order_up'));
    $this->set('order_down_alt', Strings :: get('order_down'));

    if (!$this->get('is_first_child'))
    {
      $params['direction'] = 'up';
      $this->set('order_up_href', addUrlQueryItems($_SERVER['PHP_SELF'], $params));
    }
    else
      $this->set('order_up_href', '');

    if (!$this->get('is_last_child'))
    {
      $params['direction'] = 'down';
      $this->set('order_down_href', addUrlQueryItems($_SERVER['PHP_SELF'], $params));
    }
    else
      $this->set('order_down_href', '');

    return parent :: prepare();
  }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:29,代码来源:OrderComponent.class.php

示例2: validate

  public function validate($dataspace)
  {
    if(!$value = $dataspace->get($this->field_name))
      return;

    $tree = Limb :: toolkit()->getTree();

    if(!$tree->isNode($this->parent_node_id))
      return;

    if(!$nodes = $tree->getChildren($this->parent_node_id))
      return;

    foreach($nodes as $id => $node)
    {
      if($node['identifier'] != $value)
        continue;

      if($this->node_id == self :: UNKNOWN_NODE_ID)
      {
        $this->error(Strings :: get('error_duplicate_tree_identifier', 'error'));
        break;
      }
      elseif($id != $this->node_id)
      {
        $this->error(Strings :: get('error_duplicate_tree_identifier', 'error'));
        break;
      }
    }
  }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:30,代码来源:TreeIdentifierRule.class.php

示例3: check

  protected function check($value)
  {
    $value = "$value";

    if(!preg_match("~^[a-zA-Z]\d[a-zA-Z]\s\d[a-zA-Z]\d$~", $value))
      $this->error(Strings :: get('error_invalid_zip_format', 'error'));
  }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:7,代码来源:CanadaZipRule.class.php

示例4: validate

  public function validate($dataspace)
  {
    $value = $dataspace->get($this->field_name);

    if(!Limb :: toolkit()->getTree()->getNodeByPath($value))
      $this->error(Strings :: get('error_invalid_tree_path', 'error'));
  }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:7,代码来源:TreePathRule.class.php

示例5: testGetActions

  function testGetActions()
  {
    $j = new ActionsComponent();

    $actions = array(
      'display' => array(),
      'edit' => array(
          'JIP' => false,
          'action_name' => Strings :: get('edit'),
          'img_src' => '/shared/images/edit.gif',
      ),
      'delete' => array(
          'JIP' => true,
          'action_name' => Strings :: get('delete'),
          'img_src' => '/shared/images/rem.gif',
      ),
    );

    $j->setActions($actions);
    $j->setNodeId(100);

    $actions = $j->getActions();

    $this->assertTrue(is_array($actions));
    $this->assertEqual(count($actions), 1);

    $action = reset($actions);
    $this->assertEqual($action['action'], 'delete');

    $this->assertWantedPattern('/^\/root\?.+$/', $action['action_href']);
    $this->assertWantedPattern('/&*action=delete/', $action['action_href']);
    $this->assertWantedPattern('/&*node_id=100/', $action['action_href']);
  }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:33,代码来源:ActionsComponentTest.class.php

示例6: _validPerform

 protected function _validPerform($request, $response)
 {
     $mail_data = $this->dataspace->export();
     if (isset($mail_data['sender_name'])) {
         $sender_name = $mail_data['sender_name'];
     } else {
         $sender_name = $mail_data['sender_firstname'] . ' ' . $mail_data['sender_lastname'];
     }
     $body = sprintf(Strings::get('body_template', 'feedback'), $sender_name, $mail_data['sender_email'], $mail_data['body']);
     $body = str_replace('<br>', "\n", $body);
     $subject = $this->_getMailSubject();
     $recipient_email = $this->_getEmail();
     $mailer = $this->_getMailer();
     $headers['From'] = $mail_data['sender_email'];
     $headers['To'] = $recipient_email;
     $headers['Subject'] = $subject;
     if (!$recipient_email || !$mailer->send($recipient_email, $headers, $body)) {
         MessageBox::writeNotice(Strings::get('mail_not_sent', 'feedback'));
         $request->setStatus(Request::STATUS_FAILUER);
         return;
     }
     MessageBox::writeNotice(Strings::get('message_was_sent', 'feedback'));
     $request->setStatus(Request::STATUS_FORM_SUBMITTED);
     $response->redirect($_SERVER['PHP_SELF']);
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:25,代码来源:SendFeedbackAction.class.php

示例7: check

 protected function check($value)
 {
   if(empty($value))
     $this->error(Strings :: get('error_invalid_tree_node_id', 'error'));
   elseif(!Limb :: toolkit()->getTree()->getNode((int)$value))
     $this->error(Strings :: get('error_invalid_tree_node_id', 'error'));
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:7,代码来源:TreeNodeIdRule.class.php

示例8: redirect

  public function redirect($path)
  {
    include_once(LIMB_DIR . '/class/i18n/Strings.class.php');

    $message = Strings :: get('redirect_message');//???
    $message = str_replace('%path%', $path, $message);
    $this->response_string = "<html><head><meta http-equiv=refresh content='0;url={$path}'></head><body bgcolor=white><font color=707070><small>{$message}</small></font></body></html>";
  }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:8,代码来源:HttpResponse.class.php

示例9: validate

  public function validate($dataspace)
  {
    $value = $dataspace->get($this->field_name);

    if (!isset($value) ||  $value === '')
    {
      $this->error(Strings :: get('error_required', 'error'));
    }
  }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:9,代码来源:RequiredRule.class.php

示例10: check

 protected function check($value)
 {
   if (!is_null($this->min_len) &&  (strlen($value) < $this->min_len))
   {
     $this->error(Strings :: get('size_too_small', 'error'));
   }
   elseif (strlen($value) > $this->max_len)
   {
     $this->error(Strings :: get('size_too_big', 'error'));
   }
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:11,代码来源:SizeRangeRule.class.php

示例11: CanadaZipRule

  function testCanadaZipRuleInvalid3()
  {
    $this->validator->addRule(new CanadaZipRule('test'));

    $data = new Dataspace();
    $data->set('test', 'H2V2K1');

    $this->error_list->expectOnce('addError', array('test', Strings :: get('error_invalid_zip_format', 'error'), array()));

    $this->validator->validate($data);
    $this->assertFalse($this->validator->isValid());
  }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:12,代码来源:CanadaZipRuleTest.class.php

示例12: testTreeIdentifierRuleError

  function testTreeIdentifierRuleError()
  {
    $this->validator->addRule(new TreePathRule('test'));

    $data = new Dataspace();
    $data->set('test', '/root/document/1');

    $this->error_list->expectOnce('addError', array('test', Strings :: get('error_invalid_tree_path', 'error'), array()));

    $this->validator->validate($data);
    $this->assertFalse($this->validator->isValid());
  }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:12,代码来源:TreePathRuleTest.class.php

示例13: testUniqueUserRuleError

  function testUniqueUserRuleError()
  {
    $this->validator->addRule(new UniqueUserRule('test'));

    $data = new Dataspace();
    $data->set('test', 'vasa');

    $this->error_list->expectOnce('addError', array('test', Strings :: get('error_duplicate_user', 'error'), array()));

    $this->validator->validate($data);
    $this->assertFalse($this->validator->isValid());
  }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:12,代码来源:UniqueUserRuleTest.class.php

示例14: _validPerform

 protected function _validPerform($request, $response)
 {
     $object = Limb::toolkit()->createSiteObject('PollContainer');
     $data = $this->dataspace->export();
     $request->setStatus(Request::STATUS_FAILURE);
     if (!isset($data['answer'])) {
         MessageBox::writeNotice(Strings::get('no_answer', 'poll'));
         return;
     }
     $object->registerAnswer($data['answer']);
     $request->setStatus(Request::STATUS_FORM_SUBMITTED);
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:12,代码来源:VoteAction.class.php

示例15: check

 protected function check($value)
 {
   if (is_integer(strpos($value, '@')))
   {
     list($user, $domain) = split('@', $value, 2);
     $this->checkUser($user);
     $this->checkDomain($domain);
   }
   else
   {
     $this->error(Strings :: get('invalid_email', 'error'));
   }
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:13,代码来源:EmailRule.class.php


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