예제 #1
0
 /**
  * Overloaded bind function to pre-process the params.
  *
  * @param    array        Named array
  * @return   null|string  null is operation was satisfactory, otherwise returns an error
  * @see      JTable:bind
  */
 public function bind($array, $ignore = '')
 {
     // for Fields group
     // Convert jform[fields_group][field] to jform[field] or JTable cannot bind data.
     // ==========================================================================================
     $data = array();
     $array = AKHelper::_('array.pivotFromTwoDimension', $array);
     // Set field['param_xxx'] to params
     // ==========================================================================================
     if (empty($array['params'])) {
         $array['params'] = AKHelper::_('array.pivotFromPrefix', 'param_', $array, JArrayHelper::getValue($array, 'params', array()));
     }
     // set params to JRegistry
     // ==========================================================================================
     if (isset($array['params']) && is_array($array['params'])) {
         $registry = new JRegistry();
         $registry->loadArray($array['params']);
         $array['params'] = (string) $registry;
     }
     // Bind the rules.
     // ==========================================================================================
     if (isset($array['rules']) && is_array($array['rules'])) {
         $rules = new JAccessRules($array['rules']);
         $this->setRules($rules);
     }
     return parent::bind($array, $ignore);
 }
예제 #2
0
	/**
	 * Overloaded bind function
	 *
	 * @param   array  $array   Named array
	 * @param   mixed  $ignore  An optional array or space separated list of properties to ignore while binding.
	 *
	 * @return  mixed  Null if operation was satisfactory, otherwise returns an error
	 *
	 * @see     JTable:bind
	 * @since   11.1
	 */
	public function bind($array, $ignore = '')
	{
		// Verify that the default home menu is not unset
		if ($this->home == '1' && $this->language == '*' && ($array['home'] == '0'))
		{
			$this->setError(JText::_('JLIB_DATABASE_ERROR_MENU_CANNOT_UNSET_DEFAULT_DEFAULT'));
			return false;
		}
		//Verify that the default home menu set to "all" languages" is not unset
		if ($this->home == '1' && $this->language == '*' && ($array['language'] != '*'))
		{
			$this->setError(JText::_('JLIB_DATABASE_ERROR_MENU_CANNOT_UNSET_DEFAULT'));
			return false;
		}

		// Verify that the default home menu is not unpublished
		if ($this->home == '1' && $this->language == '*' && $array['published'] != '1')
		{
			$this->setError(JText::_('JLIB_DATABASE_ERROR_MENU_UNPUBLISH_DEFAULT_HOME'));
			return false;
		}

		if (isset($array['params']) && is_array($array['params']))
		{
			$registry = new JRegistry();
			$registry->loadArray($array['params']);
			$array['params'] = (string) $registry;
		}

		return parent::bind($array, $ignore);
	}
예제 #3
0
 public function bind($array, $ignore = '')
 {
     if (isset($array['params']) && is_array($array['params'])) {
         $registry = new JRegistry();
         $registry->loadArray($array['params']);
         $array['params'] = (string) $registry;
     }
     return parent::bind($array, $ignore);
 }
예제 #4
0
 public function bind($array, $ignore = '')
 {
     if (isset($array['params']) && is_array($array['params'])) {
         $registry = new JRegistry();
         $registry->loadArray($array['params']);
         $array['params'] = (string) $registry;
     }
     $bind = parent::bind($array, $ignore);
     if ($this->parent_id == 0) {
         $this->Set('parent_id', $this->getRootId());
     }
     return $bind;
 }
예제 #5
0
파일: tag.php 프로젝트: eshiol/joomla-cms
 /**
  * Overloaded bind function
  *
  * @param   array  $array   Named array
  * @param   mixed  $ignore  An optional array or space separated list of properties
  * to ignore while binding.
  *
  * @return  mixed  Null if operation was satisfactory, otherwise returns an error string
  *
  * @see     JTable::bind
  * @since   3.1
  */
 public function bind($array, $ignore = '')
 {
     if (isset($array['params']) && is_array($array['params'])) {
         $registry = new Registry($array['params']);
         $array['params'] = (string) $registry;
     }
     if (isset($array['metadata']) && is_array($array['metadata'])) {
         $registry = new Registry($array['metadata']);
         $array['metadata'] = (string) $registry;
     }
     if (isset($array['urls']) && is_array($array['urls'])) {
         $registry = new Registry($array['urls']);
         $array['urls'] = (string) $registry;
     }
     if (isset($array['images']) && is_array($array['images'])) {
         $registry = new Registry($array['images']);
         $array['images'] = (string) $registry;
     }
     return parent::bind($array, $ignore);
 }
예제 #6
0
 /**
  * Method to bind an associative array or object to the JTable instance.This
  * method only binds properties that are publicly accessible and optionally
  * takes an array of properties to ignore when binding.
  *
  * @param   mixed  $src     An associative array or object to bind to the JTable instance.
  * @param   mixed  $ignore  An optional array or space separated list of properties to ignore while binding.
  *
  * @return  boolean  True on success.
  *
  * @throws  InvalidArgumentException
  */
 public function bind($src, $ignore = array())
 {
     if (isset($src['params']) && is_array($src['params'])) {
         $registry = new JRegistry();
         $registry->loadArray($src['params']);
         $src['params'] = (string) $registry;
     }
     if (isset($src['metadata']) && is_array($src['metadata'])) {
         $registry = new JRegistry();
         $registry->loadArray($src['metadata']);
         $src['metadata'] = (string) $registry;
     }
     if (isset($src['rules']) && is_array($src['rules'])) {
         $rules = new JAccessRules($src['rules']);
         $this->setRules($rules);
     }
     return parent::bind($src, $ignore);
 }
예제 #7
0
 /**
  * Overloaded bind function.
  *
  * @param   array   $array   named array
  * @param   string  $ignore  An optional array or space separated list of properties
  *                           to ignore while binding.
  *
  * @return  mixed   Null if operation was satisfactory, otherwise returns an error
  *
  * @see     JTable::bind()
  * @since   11.1
  */
 public function bind($array, $ignore = '')
 {
     if (isset($array['params']) && is_array($array['params'])) {
         $registry = new Registry($array['params']);
         $array['params'] = (string) $registry;
     }
     if (isset($array['metadata']) && is_array($array['metadata'])) {
         $registry = new Registry($array['metadata']);
         $array['metadata'] = (string) $registry;
     }
     // Bind the rules.
     if (isset($array['rules']) && is_array($array['rules'])) {
         $rules = new JAccessRules($array['rules']);
         $this->setRules($rules);
     }
     return parent::bind($array, $ignore);
 }
예제 #8
0
 /**
  * Method to bind an associative array or object to the JTable instance.
  *
  * @see JTable
  */
 public function bind($array, $ignore = '')
 {
     if (isset($array['name'])) {
         $array['name'] = str_replace(' ', '_', strtolower($array['name']));
     }
     // If this table has a column named 'options', save all param fields as JSON string in this column
     if (isset($array['options']) && is_array($array['options'])) {
         ksort($array["options"]);
         $options = array("keys" => array(), "values" => array());
         for ($i = 0; $i < count($array["options"]["keys"]); $i++) {
             if ($array["options"]["keys"][$i] != "") {
                 $options["keys"][] = $array["options"]["keys"][$i];
                 $options["values"][] = $array["options"]["values"][$i];
             }
         }
         $registry = new JRegistry();
         $registry->loadArray($options);
         $array['options'] = (string) $registry;
     }
     // If this table has a column named 'attributes', save all param fields as JSON string in this column
     if (isset($array['attributes']) && is_array($array['attributes'])) {
         ksort($array["attributes"]);
         $attributes = array("keys" => array(), "values" => array());
         for ($i = 0; $i < count($array["attributes"]["keys"]); $i++) {
             if ($array["attributes"]["keys"][$i] != "") {
                 $attributes["keys"][] = $array["attributes"]["keys"][$i];
                 $attributes["values"][] = $array["attributes"]["values"][$i];
             }
         }
         $registry = new JRegistry();
         $registry->loadArray($attributes);
         $array['attributes'] = (string) $registry;
     }
     // If this table has a column named 'params', save all param fields as JSON string in this column
     if (isset($array['params']) && is_array($array['params'])) {
         $registry = new JRegistry();
         $registry->loadArray($array['params']);
         $array['params'] = (string) $registry;
     }
     return parent::bind($array, $ignore);
 }
예제 #9
0
 /**
  * Method to bind an associative array or object to the JTable instance.This
  * method only binds properties that are publicly accessible and optionally
  * takes an array of properties to ignore when binding.
  *
  * @param   mixed  $src     An associative array or object to bind to the JTable instance.
  * @param   mixed  $ignore  An optional array or space separated list of properties to ignore while binding.
  *
  * @return  boolean  True on success.
  *
  * @link    http://docs.joomla.org/JTable/bind
  * @since   11.1
  * @throws  InvalidArgumentException
  */
 public function bind($src, $ignore = array())
 {
     if (is_object($src)) {
         $src = get_object_vars($src);
     }
     if (isset($src['params']) && is_array($src['params'])) {
         $registry = new JRegistry();
         $registry->loadArray($src['params']);
         $src['params'] = $registry->toString();
     }
     if (isset($src['plugins']) && is_array($src['plugins'])) {
         $registry = new JRegistry();
         $registry->loadArray($src['plugins']);
         $src['plugins'] = $registry->toString();
     }
     if (isset($src['rules']) && is_array($src['rules'])) {
         $rules = array();
         foreach ((array) $src['rules'] as $action => $ids) {
             $rules[$action] = array();
             foreach ($ids as $id => $p) {
                 if ($p !== '') {
                     $rules[$action][$id] = $p == '1' || $p == 'true' ? true : false;
                 }
             }
         }
         $this->setRules(new JAccessRules($rules));
     }
     return parent::bind($src, $ignore);
 }
예제 #10
0
 public function bind($array, $ignore = '')
 {
     return parent::bind($array, $ignore);
 }