function addArea($index, $shape, $coords, $title = "", $href = "", $target = "", $visible = true, $linecolor = "red", $bordercolor = "white", $fillcolor = "#FFFFFFA0") { if (ini_get("safe_mode")) { if (strpos($fillcolor, "#") !== false || (strpos($fillcolor, "rgb") !== false)) { $fillcolor = str_replace("\"", "", $fillcolor); } } $this->areas[$index] = array("shape" => "{$shape}", "coords" => "{$coords}", "title" => "{$title}", "href" => "{$href}", "target" => "{$target}", "linecolor" => '"' . $linecolor . '"', "fillcolor" => '"' . $fillcolor . '"', "bordercolor" => '"' . $bordercolor . '"', "visible" => (int) $visible); }
protected function login($username, $password) { assert('is_string($username)'); assert('is_string($password)'); if ($username !== 'user' || ($password !== 'pass')) { throw new SimpleSAML_Error_Error('WRONGUSERPASS'); } return array('user' => array('user'), 'iud' => array('user_uid'), 'displayName' => array('member', 'employee')); }
/** * {@inheritDoc} */ public function setFrom(CoordinateInterface $from) { $this->from = $from; if (empty($this->to) || ($this->to->getLatitude() - $this->from->getLatitude() === 0)) { return $this; } $this->gradient = ($this->to->getLongitude() - $this->from->getLongitude()) / ($this->to->getLatitude() - $this->from->getLatitude()); $this->ordinateIntercept = $this->from->getLongitude() - $this->from->getLatitude() * $this->gradient; return $this; }
public function initOptionalRequirements() { $phpVersion = phpversion(); $this->optionalRequirements['phpVersion'] = version_compare($phpVersion, '5.3.8', 'le') || version_compare($phpVersion, '5.4.11', 'le') ? 'It is recommended that your PHP version match 5.3.8+ or 5.4.11+' : true; if (version_compare($phpVersion, '5.3.16', 'eq') || version_compare($phpVersion, '5.3.18', 'eq') || version_compare($phpVersion, '5.3.4', 'eq') || version_compare($phpVersion, '5.3.8', 'eq') || version_compare($phpVersion, '5.4.0', 'eq')) { $this->optionalRequirements['BuggyPhp'] = 'Your PHP version causes some bugs into symfony please upgrade or downgrade your version'; } $this->optionalRequirements['phpxmlExtension'] = extension_loaded('phpxml') ? true : 'Please install phpxml extension'; $this->optionalRequirements['iconvExtension'] = extension_loaded('iconv') ? true : 'Please install iconv extension'; $this->optionalRequirements['mbstringExtension'] = extension_loaded('mbstring') ? true : 'Please install mbstring extension'; $this->optionalRequirements['xmlExtension'] = extension_loaded('xml') ? true : 'Please install xml extension'; $this->optionalRequirements['intlExtension'] = extension_loaded('intl') ? true : 'Please install intl extension'; $this->optionalRequirements['apcExtension'] = extension_loaded('apc') ? true : 'Please install apc extension'; $this->optionalRequirements['apcIni'] = ini_get('apc.enabled') ? true : 'Please enable apc extension in INI file'; if (!extension_loaded('apc') && !ini_get('apc.enabled') || (!extension_loaded('apcu') && !ini_get('apc.enabled')) || !extension_loaded('opcache') && !ini_get('opcache.enable') || !extension_loaded('eaccelerator') && !ini_get('eaccelerator.enable') || !extension_loaded('xcache')) { $this->optionalRequirements['phpAccelerator'] = 'There is no PHP accelerator installed, please install one (APC recommended)'; } $this->optionalRequirements['iniShortOpenTag'] = ini_get('short_open_tag') == 'off' ? true : 'It is recommended that short_open_tag has "off" value in php.ini'; $this->optionalRequirements['iniMagicQuotesGpc'] = ini_get('magic_quotes_gpc') == 'off' ? true : 'It is recommended that magic_quotes_gpc has "off" value in php.ini'; $this->optionalRequirements['iniRegisterGlobals'] = ini_get('register_globals') == 'off' ? true : 'It is recommended that register_globals has "off" value in php.ini'; $this->optionalRequirements['iniSessionAutostart'] = ini_get('session_autostart') == 'off' ? true : 'It is recommended that session_autostart has "off" value in php.ini'; $this->optionalRequirements['pdo'] = class_exists('PDO') ? true : 'You need to install PDO for Doctrine'; }
public function setPaymentAmount($amount, $currencyCode, $valuta = NULL) { $paymentAmount = ''; // Überprüfen des Valuta if ($valuta == NULL) { $valuta = ' '; } else { if (!is_numeric($valuta) || (!(strlen($valuta) == 6))) { throw new Exception("Valuta muss ein Datum im Format JJMMTT sein!"); } } // Überprüfen des Betrages if (!(is_float($amount) || is_integer($amount))) { throw new Exception("Der übergebene Betrag muss Eine Zahl sein!"); } else { $this->paymentAmountNumeric = $amount; $amount = str_pad(number_format($amount, 2, ',', ''), 12, $this->fillChar); } // Überprüfen des Währungscodes if (!$this->isIsoCurrencyCode($currencyCode)) { throw new Exception("Übergebener ISO-Währungscode nicht bekannt!"); } $paymentAmount = $valuta . $currencyCode . $amount; if (strlen($paymentAmount) != 6 + 3 + 12) { throw new Exception("Zu setzender Vergütungsbetrag hat ungültige Länge!"); } else { $this->paymentAmount = $paymentAmount; } }
public function total_items($category = null, $active = null) { $sql = sprintf('SELECT count(*) AS total FROM %st_item i JOIN %st_category c ON c.pk_i_id = i.fk_i_category_id', DB_TABLE_PREFIX, DB_TABLE_PREFIX); $conditions = array(); if (!is_null($active)) { if ($active == 'ACTIVE' || ($active == 'INACTIVE') || ($active == 'SPAM')) { $conditions[] = "e_status = '{$active}'"; } } if (count($conditions) > 0) { $sql .= ' WHERE '; for ($i = 0; $i < count($conditions); $i++) { $sql .= $conditions[$i]; if ($i < count($conditions) - 1) { $sql .= ' AND '; } } } $total_ads = $this->conn->osc_dbFetchResult($sql); return $total_ads['total']; }
function preferred_fields() { /* Returns fields where attribute preferred is set to True or where it isn't set at all. */ $result = array(); foreach ($this->fields as $key => $value) { if (!array_key_exists("preferred", $value) || ($value->preferred != null)) { $result[$key] = $value; } } return $result; }
public function delete() { Security::demand(USER, $this->getMedlem()); $res1 = @unlink(FOTOALBUM_PATH . "/original/" . $this->id); $res2 = @unlink(FOTOALBUM_PATH . "/" . $this->id . "_liten.jpg"); $res3 = @unlink(FOTOALBUM_PATH . "/" . $this->id . "_stor.jpg"); if (true || ($res1 == true && $res2 == true && $res3 == true)) { // plocka endast bort ifrån databasen om vi lyckades plocka bort alla filer - RÄTTELSE: detta görs alltid! (möjligen tillfälligt) global $db; $db->nonquery("DELETE FROM mm_fotoalbumbild WHERE id = '" . $this->id . "'"); } }
public function old__get_html($media_id, $size = null, array $attrs = array(), $crop = false, $wp_size = 'medium') { if (is_string($size) && (!empty($size))) { $size_str = $size; } elseif (is_array($size)) { $sizes = $this->get_sizes($size); $size_str = null; $attrs['sizes'] = $sizes; } if (isset($attrs['class']) && !empty($class = $attrs['class'])) { if (is_array($class)) { $attrs['class'][] = 'img-srcset'; } else { $attrs['class'] = $class . ' img-srcset'; } } else { $attrs['class'] = 'img-srcset'; } $html = wp_get_attachment_image($media_id, $wp_size, $crop, $attrs); $html = $this->remove_hw_string($html); return $html; }
public function get_reward_from_order($order_id, $wooprice = false, $extra = true) { global $woocommerce; $order = new WC_Order($order_id); $amount = $this->get_order_amount($order); $extra_reward = 0; if (sizeof($order->get_items()) > 0) { foreach ($order->get_items() as $item) { if ((isset($item['id']) && $item['id'] > 0 || isset($item['product_id']) && $item['product_id'] > 0 || (isset($item['variation_id']) && $item['variation_id'] > 0)) && $extra) { $_product = $order->get_product_from_item($item); $no_reward = get_post_meta($_product->id, '_no_reward', true); if (!$no_reward) { $extra_reward += $this->get_product_extra_rewards($_product, $item['qty'], false); } } } } $reward = $this->get_rewards_amount($amount) + $extra_reward; if (isset($woocommerce->cart->applied_coupons) && $woocommerce->cart->applied_coupons) { foreach ($woocommerce->cart->applied_coupons as $code) { $coupon = new WC_Coupon($code); if ($coupon->is_valid() && $coupon->type == 'fixed_reward') { $reward += $coupon->amount; } else { if ($coupon->is_valid() && $coupon->type == 'percent_reward') { $reward += $coupon->amount * $reward; } } } } if (isset($order->payment_method)) { $gateway_extra = $this->calculate_payments_extras($order->payment_method, $amount); $reward += $gateway_extra; } if ($this->settings['swr_rewards_max_points'] != '' && intval($this->settings['swr_rewards_max_points']) < $reward) { $reward = $this->settings['swr_rewards_max_points']; } return $this->format_reward($reward, $wooprice); }