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


PHP JTableNested::check方法代码示例

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


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

示例1: check

 /**
  * Assert that the nested set data is valid.
  *
  * @return  boolean  True if the instance is sane and able to be stored in the database.
  *
  * @since   11.1
  */
 public function check()
 {
     try {
         parent::check();
     } catch (\Exception $e) {
         $this->setError($e->getMessage());
         return false;
     }
     $this->parent_id = (int) $this->parent_id;
     if (empty($this->rules)) {
         $this->rules = '{}';
     }
     // JTableNested does not allow parent_id = 0, override this.
     if ($this->parent_id > 0) {
         // Get the JDatabaseQuery object
         $query = $this->_db->getQuery(true)->select('COUNT(id)')->from($this->_db->quoteName($this->_tbl))->where($this->_db->quoteName('id') . ' = ' . $this->parent_id);
         $this->_db->setQuery($query);
         if ($this->_db->loadResult()) {
             return true;
         } else {
             $this->setError('Invalid Parent ID');
             return false;
         }
     }
     return true;
 }
开发者ID:Rai-Ka,项目名称:joomla-cms,代码行数:33,代码来源:asset.php

示例2: check

 /**
  * Overloaded check function
  */
 public function check()
 {
     //If there is an ordering column and this is a new row then get the next ordering value
     if (property_exists($this, 'ordering') && $this->id == 0) {
         $this->ordering = self::getNextOrder();
     }
     // Check alias
     if (empty($this->alias)) {
         $this->alias = $this->name;
     }
     $this->alias = JApplication::stringURLSafe($this->alias);
     return parent::check();
 }
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:16,代码来源:form.php

示例3: check

 /**
  * Overloaded check function
  *
  * @return  boolean  True on success
  *
  * @see     JTable::check()
  * @since   11.1
  */
 public function check()
 {
     try {
         parent::check();
     } catch (\Exception $e) {
         $this->setError($e->getMessage());
         return false;
     }
     // Check for a title.
     if (trim($this->title) == '') {
         $this->setError(JText::_('JLIB_DATABASE_ERROR_MUSTCONTAIN_A_TITLE_MENUITEM'));
         return false;
     }
     // Set correct component id to ensure proper 404 messages with separator items
     if ($this->type == "separator") {
         $this->component_id = 0;
     }
     // Check for a path.
     if (trim($this->path) == '') {
         $this->path = $this->alias;
     }
     // Check for params.
     if (trim($this->params) == '') {
         $this->params = '{}';
     }
     // Check for img.
     if (trim($this->img) == '') {
         $this->img = ' ';
     }
     // Cast the home property to an int for checking.
     $this->home = (int) $this->home;
     // Verify that a first level menu item alias is not 'component'.
     if ($this->parent_id == 1 && $this->alias == 'component') {
         $this->setError(JText::_('JLIB_DATABASE_ERROR_MENU_ROOT_ALIAS_COMPONENT'));
         return false;
     }
     // Verify that a first level menu item alias is not the name of a folder.
     jimport('joomla.filesystem.folder');
     if ($this->parent_id == 1 && in_array($this->alias, JFolder::folders(JPATH_ROOT))) {
         $this->setError(JText::sprintf('JLIB_DATABASE_ERROR_MENU_ROOT_ALIAS_FOLDER', $this->alias, $this->alias));
         return false;
     }
     // Verify that the home item a component.
     if ($this->home && $this->type != 'component') {
         $this->setError(JText::_('JLIB_DATABASE_ERROR_MENU_HOME_NOT_COMPONENT'));
         return false;
     }
     return true;
 }
开发者ID:Rai-Ka,项目名称:joomla-cms,代码行数:57,代码来源:menu.php

示例4: check

 /**
  * Checks that the object is valid and able to be stored.
  *
  * This method checks that the parent_id is non-zero and exists in the database.
  * Note that the root node (parent_id = 0) cannot be manipulated with this class.
  *
  * @return  boolean  True if all checks pass.
  */
 public function check()
 {
     $dispatcher = RFactory::getDispatcher();
     // Import plugin types
     if ($this->_eventBeforeCheck || $this->_eventAfterCheck) {
         foreach ($this->_pluginTypesToImport as $type) {
             JPluginHelper::importPlugin($type);
         }
     }
     // Trigger before check
     if ($this->_eventBeforeCheck) {
         $results = $dispatcher->trigger($this->_eventBeforeCheck, array($this));
         if (count($results) && in_array(false, $results, true)) {
             return false;
         }
     }
     // Check
     if (!parent::check()) {
         return false;
     }
     // Trigger after check
     if ($this->_eventAfterCheck) {
         $results = $dispatcher->trigger($this->_eventAfterCheck, array($this));
         if (count($results) && in_array(false, $results, true)) {
             return false;
         }
     }
     return true;
 }
开发者ID:prox91,项目名称:joomla-dev,代码行数:37,代码来源:nested.php

示例5: check

 /**
  * Overloaded check method to ensure data integrity.
  *
  * @return  boolean  True on success.
  *
  * @since   3.1
  * @throws  UnexpectedValueException
  */
 public function check()
 {
     try {
         parent::check();
     } catch (\Exception $e) {
         $this->setError($e->getMessage());
         return false;
     }
     // Check for valid name.
     if (trim($this->title) == '') {
         throw new UnexpectedValueException(sprintf('The title is empty'));
     }
     if (empty($this->alias)) {
         $this->alias = $this->title;
     }
     $this->alias = JApplicationHelper::stringURLSafe($this->alias, $this->language);
     if (trim(str_replace('-', '', $this->alias)) == '') {
         $this->alias = JFactory::getDate()->format("Y-m-d-H-i-s");
     }
     // Check the publish down date is not earlier than publish up.
     if ((int) $this->publish_down > 0 && $this->publish_down < $this->publish_up) {
         throw new UnexpectedValueException(sprintf('End publish date is before start publish date.'));
     }
     // Clean up keywords -- eliminate extra spaces between phrases
     // and cr (\r) and lf (\n) characters from string
     if (!empty($this->metakey)) {
         // Only process if not empty
         // Define array of characters to remove
         $bad_characters = array("\n", "\r", "\"", "<", ">");
         // Remove bad characters
         $after_clean = JString::str_ireplace($bad_characters, "", $this->metakey);
         // Create array using commas as delimiter
         $keys = explode(',', $after_clean);
         $clean_keys = array();
         foreach ($keys as $key) {
             if (trim($key)) {
                 // Ignore blank keywords
                 $clean_keys[] = trim($key);
             }
         }
         // Put array back together delimited by ", "
         $this->metakey = implode(", ", $clean_keys);
     }
     // Clean up description -- eliminate quotes and <> brackets
     if (!empty($this->metadesc)) {
         // Only process if not empty
         $bad_characters = array("\"", "<", ">");
         $this->metadesc = JString::str_ireplace($bad_characters, "", $this->metadesc);
     }
     // Not Null sanity check
     $date = JFactory::getDate();
     if (empty($this->params)) {
         $this->params = '{}';
     }
     if (empty($this->metadesc)) {
         $this->metadesc = '';
     }
     if (empty($this->metakey)) {
         $this->metakey = '';
     }
     if (empty($this->metadata)) {
         $this->metadata = '{}';
     }
     if (empty($this->urls)) {
         $this->urls = '{}';
     }
     if (empty($this->images)) {
         $this->images = '{}';
     }
     if (!(int) $this->checked_out_time) {
         $this->checked_out_time = $date->toSql();
     }
     if (!(int) $this->modified_time) {
         $this->modified_time = $date->toSql();
     }
     if (!(int) $this->modified_time) {
         $this->modified_time = $date->toSql();
     }
     if (!(int) $this->publish_up) {
         $this->publish_up = $date->toSql();
     }
     if (!(int) $this->publish_down) {
         $this->publish_down = $date->toSql();
     }
     return true;
 }
开发者ID:Rai-Ka,项目名称:joomla-cms,代码行数:94,代码来源:tag.php

示例6: check

 public function check()
 {
     $app = JFactory::getApplication();
     if ($app->isSite()) {
         $params = JUDirectoryHelper::getParams(null, $this->listing_id);
         $this->_comment_interval = $params->get('comment_interval', 60);
         if ($this->_comment_interval > 0) {
             $this->_comment_latest = strtotime($this->getLatestCommentTime());
         }
         $this->_comment_interval_same_listing = $params->get('comment_interval_in_same_listing', 60);
         if ($this->_comment_interval_same_listing > 0) {
             $this->_comment_latest_same_listing = strtotime($this->getLatestCommentTime($this->listing_id));
         }
     }
     if (!parent::check()) {
         $this->setError(JText::_('COM_JUDIRECTORY_COMMENT_FAILED'));
         return false;
     }
     return true;
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:20,代码来源:comment.php

示例7: check

 public function check()
 {
     $app = JFactory::getApplication();
     if ($app->isSite()) {
         $params = JUDownloadHelper::getParams(null, $this->doc_id);
         $this->_comment_interval = $params->get('comment_interval', 60);
         if ($this->_comment_interval > 0) {
             $this->_comment_latest = strtotime($this->getLatestCommentTime());
         }
         $this->_comment_interval_same_document = $params->get('comment_interval_in_same_document', 60);
         if ($this->_comment_interval_same_document > 0) {
             $this->_comment_latest_same_document = strtotime($this->getLatestCommentTime($this->doc_id));
         }
     }
     if (!parent::check()) {
         $this->setError(JText::_('COM_JUDOWNLOAD_COMMENT_FAILED'));
         return false;
     }
     return true;
 }
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:20,代码来源:comment.php

示例8: check

 /**
  * Checks that the object is valid and able to be stored.
  *
  * This method checks that the parent_id is non-zero and exists in the database.
  * Note that the root node (parent_id = 0) cannot be manipulated with this class.
  *
  * @return  boolean  True if all checks pass.
  */
 public function check()
 {
     // Before check
     if (!$this->beforeCheck()) {
         return false;
     }
     // Check
     if (!parent::check()) {
         return false;
     }
     // After check
     if (!$this->afterCheck()) {
         return false;
     }
     return true;
 }
开发者ID:prox91,项目名称:joomla-dev,代码行数:24,代码来源:nested.php

示例9: check

 /**
  * Override check function
  *
  * @return  boolean
  *
  * @see     JTable::check()
  * @since   11.1
  */
 public function check()
 {
     try {
         parent::check();
     } catch (\Exception $e) {
         $this->setError($e->getMessage());
         return false;
     }
     // Check for a title.
     if (trim($this->title) == '') {
         $this->setError(JText::_('JLIB_DATABASE_ERROR_MUSTCONTAIN_A_TITLE_CATEGORY'));
         return false;
     }
     $this->alias = trim($this->alias);
     if (empty($this->alias)) {
         $this->alias = $this->title;
     }
     $this->alias = JApplicationHelper::stringURLSafe($this->alias, $this->language);
     if (trim(str_replace('-', '', $this->alias)) == '') {
         $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s');
     }
     return true;
 }
开发者ID:Rai-Ka,项目名称:joomla-cms,代码行数:31,代码来源:category.php


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