public function bind($array, $ignore = '', $prefix = null) { global $_CB_framework; $bind = parent::bind($array, $ignore, $prefix); if ($bind) { $plugin = cbblogsClass::getPlugin(); $myId = $_CB_framework->myId(); $isModerator = Application::MyUser()->isGlobalModerator(); $this->set('created_by', (int) Get::get($array, 'user', $this->get('created_by', $myId)), GetterInterface::INT); $this->set('title', Get::get($array, 'title', $this->get('title')), GetterInterface::STRING); $this->set('introtext', Get::get($array, 'blog_intro', $this->get('introtext'), GetterInterface::HTML)); $this->set('fulltext', Get::get($array, 'blog_full', $this->get('fulltext'), GetterInterface::HTML)); if ($plugin->params->get('blog_category_config', 1) || $isModerator) { $this->set('catid', (int) Get::get($array, 'category', $this->get('catid', $plugin->params->get('blog_k2_category_default', null)), GetterInterface::INT)); } else { $this->set('catid', (int) $this->get('catid', $plugin->params->get('blog_k2_category_default', null))); } if (!$plugin->params->get('blog_approval', 0) && $plugin->params->get('blog_published_config', 1) || $isModerator) { $this->set('published', (int) Get::get($array, 'published', $this->get('published', $plugin->params->get('blog_published_default', 1)), GetterInterface::INT)); } else { $this->set('published', (int) $this->get('published', $plugin->params->get('blog_approval', 0) ? 0 : $plugin->params->get('blog_published_default', 1))); } if ($plugin->params->get('blog_access_config', 1) || $isModerator) { $this->set('access', (int) Get::get($array, 'access', $this->get('access', $plugin->params->get('blog_access_default', 1)), GetterInterface::INT)); } else { $this->set('access', (int) $this->get('access', $plugin->params->get('blog_access_default', 1))); } $this->set('ordering', (int) $this->get('ordering', 1)); $this->map(); } return $bind; }
public function bind( $array, $ignore = '', $prefix = null ) { global $_CB_framework; $bind = parent::bind( $array, $ignore, $prefix ); if ( $bind ) { $plugin = cbconsultationsClass::getPlugin(); $myId = $_CB_framework->myId(); $isModerator = Application::MyUser()->isGlobalModerator(); $this->set( 'user', (int) Get::get( $array, 'user', $this->get( 'user', $myId ), GetterInterface::INT ) ); $this->set( 'title', Get::get( $array, 'title', $this->get( 'title' ), GetterInterface::STRING ) ); $this->set( 'consultation_intro', Get::get( $array, 'consultation_intro', $this->get( 'consultation_intro' ), GetterInterface::HTML ) ); $this->set( 'consultation_full', Get::get( $array, 'consultation_full', $this->get( 'consultation_full' ), GetterInterface::HTML ) ); $this->set( 'category', ( ( $plugin->params->get( 'consultation_category_config', 1 ) || $isModerator ) ? Get::get( $array, 'category', $this->get( 'category' ), GetterInterface::STRING ) : $this->get( 'category', $plugin->params->get( 'consultation_int_category_default', 'General' ) ) ) ); $this->set( 'published', (int) ( ( ( ! $plugin->params->get( 'consultation_approval', 0 ) ) || $isModerator ) ? Get::get( $array, 'published', $this->get( 'published' ), GetterInterface::INT ) : $this->get( 'published', $plugin->params->get( 'consultation_approval', 0 ) ) ) ); $this->set( 'access', (int) ( ( $plugin->params->get( 'consultation_access_config', 1 ) || $isModerator ) ? Get::get( $array, 'access', $this->get( 'access' ), GetterInterface::INT ) : $this->get( 'access', $plugin->params->get( 'consultation_access_default', 1 ) ) ) ); $this->set( 'ordering', (int) $this->get( 'ordering', 1 ) ); } return $bind; }
/** * Copy the named array or object content into this object as vars * only existing vars of object are filled. * When undefined in array, object variables are kept. * * WARNING: DOES addslashes / escape BY DEFAULT * * Can be overridden or overloaded. * * @param array|object $array The input array or object * @param string $ignore Fields to ignore * @param string $prefix Prefix for the array keys * @return boolean TRUE: ok, FALSE: error on array binding */ public function bind( $array, $ignore = '', $prefix = null ) { $bind = parent::bind( $array, $ignore, $prefix ); if ( $bind ) { // Set the ignore variable up like bind does encase this bind call was told to ignore field values: $ignore = ' ' . $ignore . ' '; // Bind was successful; lets try and bind our private variable containing field values: $k = '_fieldvalues'; // Use the same behavior as a normal bind excluding the _ ignore check for consistency: if ( strpos( $ignore, ' ' . $k . ' ') === false ) { $ak = $prefix . $k; if ( is_array( $array ) && isset( $array[$ak] ) ) { $this->$k = $array[$ak]; } elseif ( isset( $array->$ak ) ) { $this->$k = $array->$ak; } } } return $bind; }
public function bind( $array, $ignore = '', $prefix = null ) { global $_CB_framework; $bind = parent::bind( $array, $ignore, $prefix ); if ( $bind ) { $plugin = cbhangoutClass::getPlugin(); $myId = $_CB_framework->myId(); $isModerator = Application::MyUser()->isGlobalModerator(); $this->set( 'created_by', (int) Get::get( $array, 'user', $this->get( 'created_by', $myId ) ), GetterInterface::INT ); $this->set( 'title', Get::get( $array, 'title', $this->get( 'title' ), GetterInterface::STRING ) ); $this->set( 'introtext', Get::get( $array, 'hangout_intro', $this->get( 'introtext' ), GetterInterface::HTML ) ); $this->set( 'fulltext', Get::get( $array, 'hangout_full', $this->get( 'fulltext' ), GetterInterface::HTML ) ); $this->set( 'catid', (int) ( ( $plugin->params->get( 'hangout_category_config', 1 ) || $isModerator ) ? Get::get( $array, 'category', $this->get( 'catid' ), GetterInterface::INT ) : $this->get( 'catid', $plugin->params->get( 'hangout_j_category_default', null ) ) ) ); $this->set( 'state', (int) ( ( ( ! $plugin->params->get( 'hangout_approval', 0 ) ) || $isModerator ) ? Get::get( $array, 'published', $this->get( 'state' ), GetterInterface::INT ) : $this->get( 'state', ( $isModerator || ( ! $plugin->params->get( 'hangout_approval', 0 ) ) ? 1 : 0 ) ) ) ); $this->set( 'access', (int) ( ( $plugin->params->get( 'hangout_access_config', 1 ) || $isModerator ) ? Get::get( $array, 'access', $this->get( 'access' ), GetterInterface::INT ) : $this->get( 'access', $plugin->params->get( 'hangout_access_default', 1 ) ) ) ); $this->set( 'ordering', (int) $this->get( 'ordering', 1 ) ); $this->map(); } return $bind; }