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


PHP JDatabaseDriver::q方法代码示例

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


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

示例1: test__callQuote

	/**
	 * Test for the JDatabaseDriver::__call method.
	 *
	 * @return  void
	 *
	 * @since   12.1
	 */
	public function test__callQuote()
	{
		$this->assertThat(
			$this->db->q('foo'),
			$this->equalTo($this->db->quote('foo')),
			'Tests the q alias of quote.'
		);
	}
开发者ID:realityking,项目名称:joomla-platform,代码行数:15,代码来源:JDatabaseDriverTest.php

示例2: save

 /**
  * Method to provide a shortcut to binding, checking and storing a FOFTable
  * instance to the database table.  The method will check a row in once the
  * data has been stored and if an ordering filter is present will attempt to
  * reorder the table rows based on the filter.  The ordering filter is an instance
  * property name.  The rows that will be reordered are those whose value matches
  * the FOFTable instance for the property specified.
  *
  * @param   mixed   $src             An associative array or object to bind to the FOFTable instance.
  * @param   string  $orderingFilter  Filter for the order updating
  * @param   mixed   $ignore          An optional array or space separated list of properties
  *                                   to ignore while binding.
  *
  * @return  boolean  True on success.
  */
 public function save($src, $orderingFilter = '', $ignore = '')
 {
     // Attempt to bind the source to the instance.
     if (!$this->bind($src, $ignore)) {
         return false;
     }
     // Run any sanity checks on the instance and verify that it is ready for storage.
     if (!$this->check()) {
         return false;
     }
     // Attempt to store the properties to the database table.
     if (!$this->store()) {
         return false;
     }
     // Attempt to check the row in, just in case it was checked out.
     if (!$this->checkin()) {
         return false;
     }
     // If an ordering filter is set, attempt reorder the rows in the table based on the filter and value.
     if ($orderingFilter) {
         $filterValue = $this->{$orderingFilter};
         $this->reorder($orderingFilter ? $this->_db->qn($orderingFilter) . ' = ' . $this->_db->q($filterValue) : '');
     }
     // Set the error to empty and return true.
     $this->setError('');
     return true;
 }
开发者ID:deenison,项目名称:joomla-cms,代码行数:42,代码来源:table.php

示例3: getTypeId

 /**
  * Retrieves the UCM type ID
  *
  * @param   string  $alias  The string of the type alias
  *
  * @return  integer  The ID of the requested type
  *
  * @since   3.1
  */
 public function getTypeId($alias = null)
 {
     if (!$alias) {
         $alias = $this->alias;
     }
     $query = $this->db->getQuery(true);
     $query->select('ct.type_id');
     $query->from($this->db->quoteName('#__content_types', 'ct'));
     $query->where($this->db->quoteName('ct.type_alias') . ' = ' . $this->db->q($alias));
     $this->db->setQuery($query);
     $id = $this->db->loadResult();
     return $id;
 }
开发者ID:GitIPFire,项目名称:Homeworks,代码行数:22,代码来源:type.php

示例4: getOriginalCollation

 /**
  * Get the the collation for a given table
  *
  * @param   Registry        $params
  * @param   JDatabaseDriver $db
  * @param   string          $tableName
  *
  * @return string
  */
 protected function getOriginalCollation($params, $db, $tableName)
 {
     if (!empty($tableName)) {
         $db->setQuery('SHOW TABLE STATUS LIKE ' . $db->q($tableName));
         $info = $db->loadObject();
         $origCollation = is_object($info) ? $info->Collation : $params->get('collation', 'none');
     } else {
         $origCollation = $params->get('collation', 'none');
     }
     return $origCollation;
 }
开发者ID:jfquestiaux,项目名称:fabrik,代码行数:20,代码来源:list.php

示例5: onContentAfterTitle


//.........这里部分代码省略.........
         $categories = [$selectedCategories];
     }
     // If we aren't in a defined category, exit
     if (!in_array($currentCategory, $categories)) {
         // If we made it this far, we probably deleted the text object; reset it
         if (!isset($article->text)) {
             $article->text = $article->introtext;
         }
         return;
     }
     // Create the article slug
     $article->slug = $article->alias ? $article->id . ':' . $article->alias : $article->id;
     // Build the URL for the plugins to use - the site URL should only be the scheme and host segments, JRoute will take care of the rest
     $siteURL = JUri::getInstance()->toString(['scheme', 'host', 'port']);
     $itemURL = $siteURL . JRoute::_(ContentHelperRoute::getArticleRoute($article->slug, $article->catid));
     // Check if we have an intro text image (Priority: fulltext image, intro image, content image, category image)
     $images = json_decode($article->images);
     if (isset($images->image_fulltext) && !empty($images->image_fulltext)) {
         $imageOg = $images->image_fulltext;
     } elseif (isset($images->image_intro) && !empty($images->image_intro)) {
         $imageOg = $images->image_intro;
     } else {
         // Get the content and merge in the template; first see if $article->text is defined
         if (!isset($article->text)) {
             $article->text = $article->introtext;
         }
         // Always run this preg_match as the results are also used in the layout
         $pattern = "/<img[^>]*src\\=['\"]?(([^>]*)(jpg|gif|JPG|png|jpeg))['\"]?/";
         preg_match($pattern, $article->text, $matches);
         $imageOg = isset($matches[1]) ? $matches[1] : '';
         // Check for category image
         if (empty($imageOg)) {
             // We get the article mostly from content plugin, so we need to do a query and can't do a join..
             $query = $this->db->getQuery(true);
             $query->select('params')->from($this->db->quoteName('#__categories'))->where($this->db->quoteName('id') . ' = ' . $this->db->q($article->catid));
             $this->db->setQuery($query);
             $result = $this->db->loadResult();
             if ($result) {
                 $categoryParams = json_decode($result);
                 if (isset($categoryParams->image) && !empty($categoryParams->image)) {
                     $imageOg = $categoryParams->image;
                 }
             }
         }
     }
     // Make sure the image has an absolute URL
     if (!empty($imageOg)) {
         // If the image isn't prefixed with http then assume it's relative and put the site URL in front
         if (strpos($imageOg, 'http') !== 0) {
             $imageOg = substr(JUri::root(), 0, -1) . (substr($imageOg, 0, 1) !== '/' ? '/' : '') . $imageOg;
         }
     }
     /*
      * Add template metadata per the context
      */
     // The metadata in this check should only be applied on a single article view
     if ($context === 'com_content.article') {
         if (!empty($imageOg)) {
             if (!$document->getMetaData('og:image')) {
                 $document->setMetaData('og:image', $imageOg, 'property');
             }
             if (!$document->getMetaData('twitter:image')) {
                 $document->setMetaData('twitter:image', $imageOg);
             }
         }
         $description = !empty($article->metadesc) ? $article->metadesc : $article->introtext;
开发者ID:joomla-projects,项目名称:plg_content_joomlarrssb,代码行数:67,代码来源:joomlarrssb.php


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