protected function processAuthors($authors) { if ($authors == "Rédaction en ligne") { $this->skipAuthor = true; return; } require_once 'helpers/namecase.php'; //Some Le Soir articles use firstname name, others name,firstname. //When there are several authors, ' ;' is the separator. //Authors are in uppercase, so we need to clean case. $authors = explode('; ', $authors); $start = true; foreach ($authors as $author) { if (strpos($author, ',') !== false) { $name = explode(',', $author, 2); $author = $name[1] . ' ' . $name[0]; } $author = name_case($author); if ($start) { $this->author = name_case($author); $start = false; } else { $this->coauthors[] = name_case($author); } } }
/** * Analyses the page and extracts metadata */ function analyse() { parent::analyse(); $author = self::between('<span itemprop="author">', '</span>'); $this->author = name_case($author); $this->extractDate(); $this->site = "[[L'Avenir (Belgique)|L'Avenir]]"; }
function analyse() { parent::analyse(); //Hardcoded known info $this->site = "[[The New York Times]]"; //Gets date from pdate metatag $this->yyyy = substr($this->meta_tags['pdate'], 0, 4); $this->mm = substr($this->meta_tags['pdate'], 4, 2); $this->dd = ltrim(substr($this->meta_tags['pdate'], 6, 2), '0'); $this->unixtime = mktime(0, 0, 0, $mm, $dd, $yyyy); //Gets author //TODO: Handle the several authors case require 'helpers/namecase.php'; $author = substr($this->meta_tags['byl'], 3); $this->author = name_case($author); }
// end meter request //// // put the form array together with the stuff from the database $shipData = $shipData + $fedex_vars; // determine shipment type (either ground or express) // (this is used in the call to fedexdc.php) if ($_POST['service_type'] == 92 or $_POST['service_type'] == 90) { $ship_type = 'ship_ground'; } else { $ship_type = 'ship_express'; } //// // request shipment(s) and post data to shipping manifest for ($i = 1; $_POST['package_num'] >= $i; $i++) { // data for shipping_manifest $manifest_data = array(delivery_id => '', orders_id => $order, delivery_name => name_case($order_info['customers_name']), delivery_company => '', delivery_address_1 => $order_info['delivery_street_address'], delivery_address_2 => '', delivery_city => $order_info['delivery_city'], delivery_state => $delivery_state, delivery_postcode => $order_info['delivery_postcode'], delivery_phone => $order_info['customers_telephone'], package_weight => $weight, package_value => $order_value, oversized => $oversized, pickup_date => $corrected_date, shipping_type => $_POST['service_type'], residential => $shipData[440], cod => ''); // get the package weight/total weight and format it to one decimal place $total_weight = round($_POST['package_weight'], 1); $total_weight = sprintf("%01.1f", $total_weight); // deal with multiple packages if ($_POST['package_num'] > 1) { $shipData[116] = $_POST['package_num']; $shipData[1117] = $i; $manifest_data['multiple'] = $i; if ($i == 1) { if ($debug) { $shipData[1400] = $total_weight; $package_weight = $_POST['package_' . $i . '_weight']; $package_weight = sprintf("%01.1f", $package_weight); $shipData[1401] = $package_weight; echo SHIPMENT_REQUEST_DATA . $i . ':<br><pre>';
/** * Parses an attribute array from an LDAP read into an array with the following keys: * * full_name, first_name, last_name, nickname, cifid, student_id_hash, email, year, * loginshell, uid, building, phone, lcc. * * The given class should have the following constants defined for LDAP fields: * FULL_NAME_FIELD, FIRST_NAME_FIELD, LAST_NAME_FIELD, CIFID_FIELD, STUDENT_ID_FIELD, EMAIL_FIELD, * YEAR_FIELD, LOGINSHELL_FIELD, UID_FIELD, BUILDING_FIELD, PHONE_FIELD, LCC_FIELD * If any of them are set to null, they will be ignored. * * If a value is not provided by the LDAP read, it defaults to null. * @param array $attributes The returned array from an LDAP read operation. * @param string $class The name of the class with constant LDAP field properties defined. * @return array An asociative array in the format data_name=>value. */ public static function parse_attributes($attributes, $class) { $parsed = []; $fields = self::get_fields_table($class); foreach ($fields as $field) { $field_name = $field[0]; // Check if the value is provided, if not use null if ($field[1] != null && array_key_exists($field[1], $attributes)) { $value = $attributes[$field[1]]; if (is_array($value) && array_key_exists('count', $value)) { if ($value['count'] == 1) { $value = $value[0]; } else { unset($value['count']); } } // Properly capitalize names if (in_array($field_name, ['first_name', 'last_name'])) { $value = name_case($value); // Defined in utilities.php } $parsed[$field_name] = $value; } else { $parsed[$field_name] = null; } } return $parsed; }