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


PHP JLanguage::_方法代码示例

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


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

示例1: test_

 /**
  * @covers JLanguage::_
  */
 public function test_()
 {
     $string1 = 'delete';
     $string2 = "delete's";
     $this->assertEquals('delete', $this->object->_($string1, false), 'Line: ' . __LINE__ . ' Exact case should match when javascript safe is false ');
     $this->assertNotEquals('Delete', $this->object->_($string1, false), 'Line: ' . __LINE__ . ' Should be case sensitive when javascript safe is false');
     $this->assertEquals('delete', $this->object->_($string1, true), 'Line: ' . __LINE__ . ' Exact case match should work when javascript safe is true');
     $this->assertNotEquals('Delete', $this->object->_($string1, true), 'Line: ' . __LINE__ . ' Should be case sensitive when javascript safe is true');
     $this->assertEquals('delete\'s', $this->object->_($string2, false), 'Line: ' . __LINE__ . ' Exact case should match when javascript safe is false ');
     $this->assertNotEquals('Delete\'s', $this->object->_($string2, false), 'Line: ' . __LINE__ . ' Should be case sensitive when javascript safe is false');
     $this->assertEquals("delete\\'s", $this->object->_($string2, true), 'Line: ' . __LINE__ . ' Exact case should match when javascript safe is true, also it calls addslashes (\' => \\\') ');
     $this->assertNotEquals("Delete\\'s", $this->object->_($string2, true), 'Line: ' . __LINE__ . ' Should be case sensitive when javascript safe is true,, also it calls addslashes (\' => \\\') ');
 }
开发者ID:rvsjoen,项目名称:joomla-platform,代码行数:16,代码来源:JLanguageTest.php

示例2: addArticle

 /**
  * Create an article in a specific language
  *
  * @param   stdClass  $itemLanguage  Language Object
  * @param   int       $categoryId    The id of the category where we want to add the article
  *
  * @return  JTable Category Object
  *
  * @since   3.2
  */
 public function addArticle($itemLanguage, $categoryId)
 {
     $db = JFactory::getDbo();
     $newlanguage = new JLanguage($itemLanguage->language, false);
     $newlanguage->load('plg_editors-xtd_article', JPATH_ADMINISTRATOR, $itemLanguage->language, true);
     $title = $newlanguage->_('PLG_ARTICLE_BUTTON_ARTICLE');
     $article = JTable::getInstance('Content');
     $article->title = $title . ' (' . strtolower($itemLanguage->language) . ')';
     $article->introtext = '<p>Lorem ipsum ad his scripta blandit partiendo, eum fastidii accumsan euripidis' . ' in, eum liber hendrerit an. Qui ut wisi vocibus suscipiantur, quo dicit' . ' ridens inciderint id. Quo mundi lobortis reformidans eu, legimus senserit' . 'definiebas an eos. Eu sit tincidunt incorrupte definitionem, vis mutat' . ' affert percipit cu, eirmod consectetuer signiferumque eu per. In usu latine' . 'equidem dolores. Quo no falli viris intellegam, ut fugit veritus placerat' . 'per. Ius id vidit volumus mandamus, vide veritus democritum te nec, ei eos' . 'debet libris consulatu.</p>';
     $article->state = 1;
     $article->created = JFactory::getDate()->toSql();
     $article->created_by = $this->getAdminId();
     $article->created_by_alias = 'Joomla';
     $article->publish_up = JFactory::getDate()->toSql();
     $article->publish_down = $db->getNullDate();
     $article->version = 1;
     $article->catid = $categoryId;
     $article->metadata = '{"robots":"","author":"","rights":"","xreference":"","tags":null}';
     $article->language = $itemLanguage->language;
     $article->featured = 1;
     // Check to make sure our data is valid
     if (!$article->check()) {
         return false;
     }
     // Now store the category
     if (!$article->store(true)) {
         return false;
     }
     // Get the new item ID
     $newId = $article->get('id');
     $query = $db->getQuery(true)->insert($db->quoteName('#__content_frontpage'))->values($newId . ', 0');
     $db->setQuery($query);
     if (!$db->execute()) {
         return false;
     }
     return true;
 }
开发者ID:Tommar,项目名称:remate,代码行数:47,代码来源:languages.php

示例3: addArticle

 /**
  * Create an article in a specific language.
  *
  * @param   stdClass  $itemLanguage  Language Object.
  * @param   int       $categoryId    The id of the category where we want to add the article.
  *
  * @return  JTable Category Object
  *
  * @since   3.2
  */
 public function addArticle($itemLanguage, $categoryId)
 {
     $db = JFactory::getDbo();
     $newlanguage = new JLanguage($itemLanguage->language, false);
     $newlanguage->load('com_content.sys', JPATH_ADMINISTRATOR, $itemLanguage->language, true);
     $title = $newlanguage->_('COM_CONTENT_CONTENT_TYPE_ARTICLE');
     $article = JTable::getInstance('Content');
     $data = array('title' => $title . ' (' . strtolower($itemLanguage->language) . ')', 'introtext' => '<p>Lorem ipsum ad his scripta blandit partiendo, eum fastidii accumsan euripidis' . ' in, eum liber hendrerit an. Qui ut wisi vocibus suscipiantur, quo dicit' . ' ridens inciderint id. Quo mundi lobortis reformidans eu, legimus senserit' . 'definiebas an eos. Eu sit tincidunt incorrupte definitionem, vis mutat' . ' affert percipit cu, eirmod consectetuer signiferumque eu per. In usu latine' . 'equidem dolores. Quo no falli viris intellegam, ut fugit veritus placerat' . 'per. Ius id vidit volumus mandamus, vide veritus democritum te nec, ei eos' . 'debet libris consulatu.</p>', 'images' => json_encode(array()), 'urls' => json_encode(array()), 'state' => 1, 'created' => JFactory::getDate()->toSql(), 'created_by' => $this->getAdminId(), 'created_by_alias' => 'Joomla', 'publish_up' => JFactory::getDate()->toSql(), 'publish_down' => $db->getNullDate(), 'version' => 1, 'catid' => $categoryId, 'metadata' => '{"robots":"","author":"","rights":"","xreference":"","tags":null}', 'metakey' => '', 'metadesc' => '', 'language' => $itemLanguage->language, 'featured' => 1, 'attribs' => array(), 'rules' => array());
     // Bind the data to the table
     if (!$article->bind($data)) {
         return false;
     }
     // Check to make sure our data is valid.
     if (!$article->check()) {
         return false;
     }
     // Now store the category.
     if (!$article->store(true)) {
         return false;
     }
     // Get the new item ID.
     $newId = $article->get('id');
     $query = $db->getQuery(true)->insert($db->qn('#__content_frontpage'))->values($newId . ', 0');
     $db->setQuery($query);
     if (!$db->execute()) {
         return false;
     }
     return true;
 }
开发者ID:klas,项目名称:joomla-cms,代码行数:39,代码来源:languages.php

示例4: _install

 /**
  * Install function that is designed to handle individual clients
  *
  * @param   string   $cname     Cname @todo: not used
  * @param   string   $basePath  The base name.
  * @param   integer  $clientId  The client id.
  * @param   object   &$element  The XML element.
  *
  * @return  boolean
  *
  * @since  3.1
  */
 protected function _install($cname, $basePath, $clientId, &$element)
 {
     $this->setManifest($this->parent->getManifest());
     // Get the language name
     // Set the extensions name
     $name = JFilterInput::getInstance()->clean((string) $this->getManifest()->name, 'cmd');
     $this->set('name', $name);
     // Get the Language tag [ISO tag, eg. en-GB]
     $tag = (string) $this->getManifest()->tag;
     // Check if we found the tag - if we didn't, we may be trying to install from an older language package
     if (!$tag) {
         $this->parent->abort(JText::sprintf('JLIB_INSTALLER_ABORT', JText::_('JLIB_INSTALLER_ERROR_NO_LANGUAGE_TAG')));
         return false;
     }
     $this->set('tag', $tag);
     // Set the language installation path
     $this->parent->setPath('extension_site', $basePath . '/language/' . $tag);
     // Do we have a meta file in the file list?  In other words... is this a core language pack?
     if ($element && count($element->children())) {
         $files = $element->children();
         foreach ($files as $file) {
             if ((string) $file->attributes()->file == 'meta') {
                 $this->core = true;
                 break;
             }
         }
     }
     // If the language directory does not exist, let's create it
     $created = false;
     if (!file_exists($this->parent->getPath('extension_site'))) {
         if (!($created = JFolder::create($this->parent->getPath('extension_site')))) {
             $this->parent->abort(JText::sprintf('JLIB_INSTALLER_ABORT', JText::sprintf('JLIB_INSTALLER_ERROR_CREATE_FOLDER_FAILED', $this->parent->getPath('extension_site'))));
             return false;
         }
     } else {
         // Look for an update function or update tag
         $updateElement = $this->getManifest()->update;
         // Upgrade manually set or update tag detected
         if ($this->parent->isUpgrade() || $updateElement) {
             // Transfer control to the update function
             return $this->update();
         } elseif (!$this->parent->isOverwrite()) {
             // Overwrite is set
             // We didn't have overwrite set, find an update function or find an update tag so lets call it safe
             if (file_exists($this->parent->getPath('extension_site'))) {
                 // If the site exists say so.
                 JLog::add(JText::sprintf('JLIB_INSTALLER_ABORT', JText::sprintf('JLIB_INSTALLER_ERROR_FOLDER_IN_USE', $this->parent->getPath('extension_site'))), JLog::WARNING, 'jerror');
             } else {
                 // If the admin exists say so.
                 JLog::add(JText::sprintf('JLIB_INSTALLER_ABORT', JText::sprintf('JLIB_INSTALLER_ERROR_FOLDER_IN_USE', $this->parent->getPath('extension_administrator'))), JLog::WARNING, 'jerror');
             }
             return false;
         }
     }
     /*
      * If we created the language directory we will want to remove it if we
      * have to roll back the installation, so let's add it to the installation
      * step stack
      */
     if ($created) {
         $this->parent->pushStep(array('type' => 'folder', 'path' => $this->parent->getPath('extension_site')));
     }
     // Copy all the necessary files
     if ($this->parent->parseFiles($element) === false) {
         // Install failed, rollback changes
         $this->parent->abort();
         return false;
     }
     // Parse optional tags
     $this->parent->parseMedia($this->getManifest()->media);
     // Copy all the necessary font files to the common pdf_fonts directory
     $this->parent->setPath('extension_site', $basePath . '/language/pdf_fonts');
     $overwrite = $this->parent->setOverwrite(true);
     if ($this->parent->parseFiles($this->getManifest()->fonts) === false) {
         // Install failed, rollback changes
         $this->parent->abort();
         return false;
     }
     $this->parent->setOverwrite($overwrite);
     // Get the language description
     $description = (string) $this->getManifest()->description;
     if ($description) {
         $this->parent->set('message', JText::_($description));
     } else {
         $this->parent->set('message', '');
     }
     // Add an entry to the extension table with a whole heap of defaults
     $row = JTable::getInstance('extension');
//.........这里部分代码省略.........
开发者ID:eshiol,项目名称:joomla-cms,代码行数:101,代码来源:language.php


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