/** * Sets some dynamic values * * @since 1.0.0 * * @param array $fieldValues * @param bool $bydb whether being set by db or not * @param string $timezone timezone_string */ protected function __construct($fieldValues = NULL, $bydb = FALSE, $timezone = NULL) { if (!isset($fieldValues['PER_full_name'])) { $fname = isset($fieldValues['PER_fname']) ? $fieldValues['PER_fname'] . ' ' : ''; $lname = isset($fieldValues['PER_lname']) ? $fieldValues['PER_lname'] : ''; $fieldValues['PER_full_name'] = $fname . $lname; } if (!isset($fieldValues['PER_slug'])) { $fieldValues['PER_slug'] = sanitize_title($fieldValues['PER_full_name']); } if (!isset($fieldValues['PER_short_bio']) && isset($fieldValues['PER_bio'])) { $fieldValues['PER_short_bio'] = substr($fieldValues['PER_bio'], 0, 50); } parent::__construct($fieldValues, $bydb, $timezone); }
/** * Sets some dynamic defaults * @param array $fieldValues * @param bool $bydb * @param string $timezone */ protected function __construct($fieldValues = NULL, $bydb = FALSE, $timezone = NULL) { if (!isset($fieldValues['ATT_full_name'])) { $fname = isset($fieldValues['ATT_fname']) ? $fieldValues['ATT_fname'] . ' ' : ''; $lname = isset($fieldValues['ATT_lname']) ? $fieldValues['ATT_lname'] : ''; $fieldValues['ATT_full_name'] = $fname . $lname; } if (!isset($fieldValues['ATT_slug'])) { // $fieldValues['ATT_slug'] = sanitize_key(wp_generate_password(20)); $fieldValues['ATT_slug'] = sanitize_title($fieldValues['ATT_full_name']); } if (!isset($fieldValues['ATT_short_bio']) && isset($fieldValues['ATT_bio'])) { $fieldValues['ATT_short_bio'] = substr($fieldValues['ATT_bio'], 0, 50); } parent::__construct($fieldValues, $bydb, $timezone); }