当前位置: 首页>>代码示例>>PHP>>正文


PHP arsort函数代码示例

本文整理汇总了PHP中arsort函数的典型用法代码示例。如果您正苦于以下问题:PHP arsort函数的具体用法?PHP arsort怎么用?PHP arsort使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了arsort函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getTopFive

function getTopFive($uid)
{
    $db = new DB();
    //Create an array of all companies in format [companyname => companyid]
    $sql = "SELECT company_id, Name FROM Companies";
    $compresults = $db->execute($sql);
    $allcompanies = [];
    $compavg = [];
    while ($row = $compresults->fetch_assoc()) {
        $allcompanies[$row['Name']] = $row['company_id'];
    }
    //Find the user's priority selection
    $usrsql = "SELECT priority FROM People WHERE person_id = {$uid}";
    $usrresults = $db->execute($usrsql);
    $usrresults = $usrresults->fetch_assoc();
    $priority = $usrresults['priority'];
    //get the average rating of each company in the prioritized category and store in an array
    foreach ($allcompanies as $key => $value) {
        //hey guess what SQL can calculate column averages for you
        $avgsql = "SELECT AVG({$priority}) FROM Reviews WHERE company_id = {$value}";
        $avgresults = $db->execute($avgsql);
        $avgresults = $avgresults->fetch_assoc();
        $compavg[$key] = implode(".", $avgresults);
    }
    //sort finished array high to low and grab the top 5
    arsort($compavg);
    $topfive = array_slice($compavg, 0, 5);
    return $topfive;
}
开发者ID:caityd1d,项目名称:team-synergy,代码行数:29,代码来源:top5.php

示例2: array_sort2

function array_sort2($arr, $keys, $type = 'asc')
{
    if (empty($arr)) {
        return false;
    }
    $keysvalue = $new_array = array();
    foreach ($arr as $k => $v) {
        $keysvalue[$k] = $v[$keys];
    }
    if ($type == 'asc') {
        asort($keysvalue);
    } else {
        arsort($keysvalue);
    }
    reset($keysvalue);
    $count = count($keysvalue);
    foreach ($keysvalue as $k => $v) {
        if ($type == 'asc') {
            $new_array[$k] = $arr[$k];
        } else {
            $new_array[$count - 1 - $k] = $arr[$k];
        }
    }
    return $new_array;
}
开发者ID:shfeat,项目名称:php_libs,代码行数:25,代码来源:array.func.php

示例3: generateTagCloud

 private function generateTagCloud($tags, $resize = true, $min_font_size = 9, $max_font_size = 25, $font_weight)
 {
     if ($resize == true) {
         arsort($tags);
         $max_qty = max(array_values($tags));
         $min_qty = min(array_values($tags));
         $spread = $max_qty - $min_qty;
         if ($spread == 0) {
             $spread = 1;
         }
         $step = ((int) $max_font_size - (int) $min_font_size) / $spread;
         $cloud = array();
         foreach ($tags as $key => $value) {
             $size = rand((int) $min_font_size, (int) $max_font_size);
             $cloud[] = '<a href="' . $this->url->link('product/search', 'tag=' . $value) . '" style="text-decoration:none;font-size:' . $size . 'px;font-weight:' . $font_weight . ';" title="">' . $value . '</a> ';
         }
     } else {
         foreach ($tags as $key => $value) {
             $cloud[] = '<a href="' . $this->url->link('product/search', 'tag=' . $value) . '" style="text-decoration:none;" title="">' . $value . '</a> ';
         }
     }
     $tagcloud = '';
     shuffle($cloud);
     for ($x = 0; $x < count($cloud); $x++) {
         $tagcloud .= $cloud[$x];
     }
     return $tagcloud;
 }
开发者ID:rootcave,项目名称:9livesprints-web,代码行数:28,代码来源:boss_tagcloud.php

示例4: classify

 public function classify($string)
 {
     if ($this->total_samples === 0) {
         return array();
     }
     $tokens = $this->tokenizer->tokenize($string);
     $total_score = 0;
     $scores = array();
     foreach ($this->subjects as $subject => $subject_data) {
         $subject_data['prior_value'] = log($subject_data['count_samples'] / $this->total_samples);
         $this->subjects[$subject] = $subject_data;
         $scores[$subject] = 0;
         foreach ($tokens as $token) {
             $count = isset($this->tokens[$token][$subject]) ? $this->tokens[$token][$subject] : 0;
             $scores[$subject] += log(($count + 1) / ($subject_data['count_tokens'] + $this->total_tokens));
         }
         $scores[$subject] = $subject_data['prior_value'] + $scores[$subject];
         $total_score += $scores[$subject];
     }
     $min = min($scores);
     $sum = 0;
     foreach ($scores as $subject => $score) {
         $scores[$subject] = exp($score - $min);
         $sum += $scores[$subject];
     }
     $total = 1 / $sum;
     foreach ($scores as $subject => $score) {
         $scores[$subject] = $score * $total;
     }
     arsort($scores);
     $max = max($scores);
     $maxs = array_search(max($scores), $scores);
     return $maxs;
 }
开发者ID:nhunght,项目名称:mork_SmartOSC,代码行数:34,代码来源:Classifier.php

示例5: getUserLang

 public function getUserLang()
 {
     $langs = array();
     if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
         preg_match_all('/([a-z]{1,8}(-[a-z]{1,8})?)\\s*(;\\s*q\\s*=\\s*(1|0\\.[0-9]+))?/i', $_SERVER['HTTP_ACCEPT_LANGUAGE'], $lang_parse);
         if (count($lang_parse[1])) {
             $langs = array_combine($lang_parse[1], $lang_parse[4]);
             $tmp = array();
             foreach ($langs as $lang => $val) {
                 if (MULTILINGUAL_EXTENDED == true) {
                     if (strlen($lang) == 5) {
                         $lang = substr($lang, 0, 2) . '-' . strtoupper(substr($lang, 3, 2));
                         $tmp[$lang] = $val;
                     }
                 } else {
                     $lang = substr($lang, 0, 2);
                     $tmp[$lang] = $val;
                 }
                 if ($val === '') {
                     $tmp[$lang] = 1;
                 }
             }
             $langs = $tmp;
             arsort($langs, SORT_NUMERIC);
         }
     }
     return current(array_keys($langs));
 }
开发者ID:sarrimaxime,项目名称:web-base,代码行数:28,代码来源:Router.php

示例6: getOrigins

    private function getOrigins($dateBetween)
    {
        $directLink = $this->l('Direct link');
        $sql = 'SELECT http_referer
				FROM ' . _DB_PREFIX_ . 'connections
				WHERE 1
					' . Shop::addSqlRestriction() . '
					AND date_add BETWEEN ' . $dateBetween;
        $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->query($sql);
        $websites = array($directLink => 0);
        while ($row = Db::getInstance(_PS_USE_SQL_SLAVE_)->nextRow($result)) {
            if (!isset($row['http_referer']) || empty($row['http_referer'])) {
                ++$websites[$directLink];
            } else {
                $website = preg_replace('/^www./', '', parse_url($row['http_referer'], PHP_URL_HOST));
                if (!isset($websites[$website])) {
                    $websites[$website] = 1;
                } else {
                    ++$websites[$website];
                }
            }
        }
        arsort($websites);
        return $websites;
    }
开发者ID:ortegon000,项目名称:tienda,代码行数:25,代码来源:statsorigin.php

示例7: Pinyin

 public function Pinyin($_String, $_Code = 'UTF8')
 {
     //GBK页面可改为gb2312,其他随意填写为UTF8
     $_DataKey = "a|ai|an|ang|ao|ba|bai|ban|bang|bao|bei|ben|beng|bi|bian|biao|bie|bin|bing|bo|bu|ca|cai|can|cang|cao|ce|ceng|cha" . "|chai|chan|chang|chao|che|chen|cheng|chi|chong|chou|chu|chuai|chuan|chuang|chui|chun|chuo|ci|cong|cou|cu|" . "cuan|cui|cun|cuo|da|dai|dan|dang|dao|de|deng|di|dian|diao|die|ding|diu|dong|dou|du|duan|dui|dun|duo|e|en|er" . "|fa|fan|fang|fei|fen|feng|fo|fou|fu|ga|gai|gan|gang|gao|ge|gei|gen|geng|gong|gou|gu|gua|guai|guan|guang|gui" . "|gun|guo|ha|hai|han|hang|hao|he|hei|hen|heng|hong|hou|hu|hua|huai|huan|huang|hui|hun|huo|ji|jia|jian|jiang" . "|jiao|jie|jin|jing|jiong|jiu|ju|juan|jue|jun|ka|kai|kan|kang|kao|ke|ken|keng|kong|kou|ku|kua|kuai|kuan|kuang" . "|kui|kun|kuo|la|lai|lan|lang|lao|le|lei|leng|li|lia|lian|liang|liao|lie|lin|ling|liu|long|lou|lu|lv|luan|lue" . "|lun|luo|ma|mai|man|mang|mao|me|mei|men|meng|mi|mian|miao|mie|min|ming|miu|mo|mou|mu|na|nai|nan|nang|nao|ne" . "|nei|nen|neng|ni|nian|niang|niao|nie|nin|ning|niu|nong|nu|nv|nuan|nue|nuo|o|ou|pa|pai|pan|pang|pao|pei|pen" . "|peng|pi|pian|piao|pie|pin|ping|po|pu|qi|qia|qian|qiang|qiao|qie|qin|qing|qiong|qiu|qu|quan|que|qun|ran|rang" . "|rao|re|ren|reng|ri|rong|rou|ru|ruan|rui|run|ruo|sa|sai|san|sang|sao|se|sen|seng|sha|shai|shan|shang|shao|" . "she|shen|sheng|shi|shou|shu|shua|shuai|shuan|shuang|shui|shun|shuo|si|song|sou|su|suan|sui|sun|suo|ta|tai|" . "tan|tang|tao|te|teng|ti|tian|tiao|tie|ting|tong|tou|tu|tuan|tui|tun|tuo|wa|wai|wan|wang|wei|wen|weng|wo|wu" . "|xi|xia|xian|xiang|xiao|xie|xin|xing|xiong|xiu|xu|xuan|xue|xun|ya|yan|yang|yao|ye|yi|yin|ying|yo|yong|you" . "|yu|yuan|yue|yun|za|zai|zan|zang|zao|ze|zei|zen|zeng|zha|zhai|zhan|zhang|zhao|zhe|zhen|zheng|zhi|zhong|" . "zhou|zhu|zhua|zhuai|zhuan|zhuang|zhui|zhun|zhuo|zi|zong|zou|zu|zuan|zui|zun|zuo";
     $_DataValue = "-20319|-20317|-20304|-20295|-20292|-20283|-20265|-20257|-20242|-20230|-20051|-20036|-20032|-20026|-20002|-19990" . "|-19986|-19982|-19976|-19805|-19784|-19775|-19774|-19763|-19756|-19751|-19746|-19741|-19739|-19728|-19725" . "|-19715|-19540|-19531|-19525|-19515|-19500|-19484|-19479|-19467|-19289|-19288|-19281|-19275|-19270|-19263" . "|-19261|-19249|-19243|-19242|-19238|-19235|-19227|-19224|-19218|-19212|-19038|-19023|-19018|-19006|-19003" . "|-18996|-18977|-18961|-18952|-18783|-18774|-18773|-18763|-18756|-18741|-18735|-18731|-18722|-18710|-18697" . "|-18696|-18526|-18518|-18501|-18490|-18478|-18463|-18448|-18447|-18446|-18239|-18237|-18231|-18220|-18211" . "|-18201|-18184|-18183|-18181|-18012|-17997|-17988|-17970|-17964|-17961|-17950|-17947|-17931|-17928|-17922" . "|-17759|-17752|-17733|-17730|-17721|-17703|-17701|-17697|-17692|-17683|-17676|-17496|-17487|-17482|-17468" . "|-17454|-17433|-17427|-17417|-17202|-17185|-16983|-16970|-16942|-16915|-16733|-16708|-16706|-16689|-16664" . "|-16657|-16647|-16474|-16470|-16465|-16459|-16452|-16448|-16433|-16429|-16427|-16423|-16419|-16412|-16407" . "|-16403|-16401|-16393|-16220|-16216|-16212|-16205|-16202|-16187|-16180|-16171|-16169|-16158|-16155|-15959" . "|-15958|-15944|-15933|-15920|-15915|-15903|-15889|-15878|-15707|-15701|-15681|-15667|-15661|-15659|-15652" . "|-15640|-15631|-15625|-15454|-15448|-15436|-15435|-15419|-15416|-15408|-15394|-15385|-15377|-15375|-15369" . "|-15363|-15362|-15183|-15180|-15165|-15158|-15153|-15150|-15149|-15144|-15143|-15141|-15140|-15139|-15128" . "|-15121|-15119|-15117|-15110|-15109|-14941|-14937|-14933|-14930|-14929|-14928|-14926|-14922|-14921|-14914" . "|-14908|-14902|-14894|-14889|-14882|-14873|-14871|-14857|-14678|-14674|-14670|-14668|-14663|-14654|-14645" . "|-14630|-14594|-14429|-14407|-14399|-14384|-14379|-14368|-14355|-14353|-14345|-14170|-14159|-14151|-14149" . "|-14145|-14140|-14137|-14135|-14125|-14123|-14122|-14112|-14109|-14099|-14097|-14094|-14092|-14090|-14087" . "|-14083|-13917|-13914|-13910|-13907|-13906|-13905|-13896|-13894|-13878|-13870|-13859|-13847|-13831|-13658" . "|-13611|-13601|-13406|-13404|-13400|-13398|-13395|-13391|-13387|-13383|-13367|-13359|-13356|-13343|-13340" . "|-13329|-13326|-13318|-13147|-13138|-13120|-13107|-13096|-13095|-13091|-13076|-13068|-13063|-13060|-12888" . "|-12875|-12871|-12860|-12858|-12852|-12849|-12838|-12831|-12829|-12812|-12802|-12607|-12597|-12594|-12585" . "|-12556|-12359|-12346|-12320|-12300|-12120|-12099|-12089|-12074|-12067|-12058|-12039|-11867|-11861|-11847" . "|-11831|-11798|-11781|-11604|-11589|-11536|-11358|-11340|-11339|-11324|-11303|-11097|-11077|-11067|-11055" . "|-11052|-11045|-11041|-11038|-11024|-11020|-11019|-11018|-11014|-10838|-10832|-10815|-10800|-10790|-10780" . "|-10764|-10587|-10544|-10533|-10519|-10331|-10329|-10328|-10322|-10315|-10309|-10307|-10296|-10281|-10274" . "|-10270|-10262|-10260|-10256|-10254";
     $_TDataKey = explode('|', $_DataKey);
     $_TDataValue = explode('|', $_DataValue);
     $_Data = array_combine($_TDataKey, $_TDataValue);
     arsort($_Data);
     reset($_Data);
     if ($_Code != 'gb2312') {
         $_String = $this->_U2_Utf8_Gb($_String);
     }
     $_Res = '';
     for ($i = 0; $i < strlen($_String); $i++) {
         $_P = ord(substr($_String, $i, 1));
         if ($_P > 160) {
             $_Q = ord(substr($_String, ++$i, 1));
             $_P = $_P * 256 + $_Q - 65536;
         }
         $_Res .= $this->_Pinyin($_P, $_Data);
     }
     return str_replace("_", '', $_Res);
     // return preg_replace("/[^a-z0-9]*/", '', $_Res);
 }
开发者ID:terrydeng,项目名称:beimeibang1205,代码行数:25,代码来源:PinYinModel.class.php

示例8: get_possible_ids_ordered

 /**
  * Array of best matched post_ids. Better matches have a lower index!
  *
  * @return int[]
  */
 public function get_possible_ids_ordered()
 {
     $pages_with_name = $this->data;
     $slugs = $this->slugs;
     $parent_slugs = array_slice($slugs, 0, -1);
     foreach ($this->data as $key => $page) {
         if ($page->parent_name) {
             $slug_pos = array_keys($slugs, $page->post_name, true);
             $par_slug_pos = array_keys($slugs, $page->parent_name, true);
             if ((bool) $par_slug_pos !== false && (bool) $slug_pos !== false) {
                 $remove = true;
                 foreach ($slug_pos as $child_slug_pos) {
                     if (in_array($child_slug_pos - 1, $par_slug_pos)) {
                         $remove = false;
                         break;
                     }
                 }
                 if ($remove === true) {
                     unset($pages_with_name[$key]);
                 }
             }
         }
     }
     $possible_ids = array();
     foreach ($pages_with_name as $key => $page) {
         $correct_slug = end($slugs);
         if ($page->post_name === $correct_slug) {
             $possible_ids[$page->ID] = $this->calculate_score($parent_slugs, $pages_with_name, $page);
         }
     }
     arsort($possible_ids);
     return array_keys($possible_ids);
 }
开发者ID:SayenkoDesign,项目名称:ividf,代码行数:38,代码来源:class-wpml-score-hierarchy.php

示例9: executeShow

 public function executeShow(sfWebRequest $request)
 {
     $this->question = $this->getRoute()->getObject();
     // ログイン者の回答済み内容
     $yourAnswer = Doctrine::getTable('VoteAnswer')->findOneByMemberIdAndVoteQuestionId($this->getUser()->getMemberId(), $this->question->getId());
     if ($yourAnswer || $this->question->getMemberId() == $this->getUser()->getMemberId()) {
         // 結果出力のためのデータ集計
         $answers = Doctrine::getTable('VoteAnswer')->findByVoteQuestionId($this->question->getId());
         $options = Doctrine::getTable('VoteQuestionOption')->findByVoteQuestionId($this->question->getId());
         $this->options = $options->toKeyValueArray('id', 'body');
         $this->answerTotal = array();
         $this->total = 0;
         foreach ($answers as $answer) {
             $this->total++;
             if (isset($this->answerTotal[$answer->getVoteQuestionOptionId()])) {
                 $this->answerTotal[$answer->getVoteQuestionOptionId()]++;
             } else {
                 $this->answerTotal[$answer->getVoteQuestionOptionId()] = 1;
             }
         }
         arsort($this->answerTotal);
     } else {
         // 回答済みでないかつ作成者でないときフォームオブジェクト作成
         $voteAnswer = new VoteAnswer();
         $voteAnswer->setVoteQuestion($this->question);
         $voteAnswer->setMember($this->getUser()->getMember());
         $this->form = new VoteAnswerForm($voteAnswer);
     }
 }
开发者ID:kawahara,项目名称:opVotePlugin,代码行数:29,代码来源:opVotePluginVoteActions.class.php

示例10: loadValues

 /**
  * @throws Exception\InvalidEnumerationValueException
  * @throws Exception\InvalidEnumerationDefinitionException
  * @internal param string $class
  */
 protected static function loadValues()
 {
     $class = get_called_class();
     if (isset(static::$enumConstants[$class])) {
         return;
     }
     $reflection = new \ReflectionClass($class);
     $constants = $reflection->getConstants();
     $defaultValue = NULL;
     if (isset($constants['__default'])) {
         $defaultValue = $constants['__default'];
         unset($constants['__default']);
     }
     if (empty($constants)) {
         throw new Exception\InvalidEnumerationValueException(sprintf('No enumeration constants defined for "%s"', $class), 1381512807);
     }
     foreach ($constants as $constant => $value) {
         if (!is_int($value) && !is_string($value)) {
             throw new Exception\InvalidEnumerationDefinitionException(sprintf('Constant value must be of type integer or string; constant=%s; type=%s', $constant, is_object($value) ? get_class($value) : gettype($value)), 1381512797);
         }
     }
     $constantValueCounts = array_count_values($constants);
     arsort($constantValueCounts, SORT_NUMERIC);
     $constantValueCount = current($constantValueCounts);
     $constant = key($constantValueCounts);
     if ($constantValueCount > 1) {
         throw new Exception\InvalidEnumerationDefinitionException(sprintf('Constant value is not unique; constant=%s; value=%s; enum=%s', $constant, $constantValueCount, $class), 1381512859);
     }
     if ($defaultValue !== NULL) {
         $constants['__default'] = $defaultValue;
     }
     static::$enumConstants[$class] = $constants;
 }
开发者ID:plan2net,项目名称:TYPO3.CMS,代码行数:38,代码来源:Enumeration.php

示例11: format_interval

 /**
  * Formats any number of seconds into a readable string
  *
  * @param int Seconds to format
  * @param int Number of divisors to return, ie (3) gives '1 Year, 3 Days, 9 Hours' whereas (2) gives '1 Year, 3 Days'
  * @param string Seperator to use between divisors
  * @param array Set of Name => Seconds pairs to use as divisors, ie array('Year' => 31536000)
  * @return string Formatted interval
  */
 public function format_interval($seconds, $precision = -1, $separator = ', ', $divisors = NULL)
 {
     // Default set of divisors to use
     if (!isset($divisors)) {
         $divisors = array('Year' => 31536000, 'Month' => 2628000, 'Day' => 86400, 'Hour' => 3600, 'Minute' => 60, 'Second' => 1);
     }
     arsort($divisors);
     // Iterate over each divisor
     foreach ($divisors as $name => $divisor) {
         // If there is at least 1 of thie divisor's time period
         if ($value = floor($seconds / $divisor)) {
             // Add the formatted value - divisor pair to the output array.
             // Omits the plural for a singular value.
             if ($value == 1) {
                 $out[] = "{$value} {$name}";
             } else {
                 $out[] = "{$value} {$name}s";
             }
             // Stop looping if we've hit the precision limit
             if (--$precision == 0) {
                 break;
             }
         }
         // Strip this divisor from the total seconds
         $seconds %= $divisor;
     }
     // Join the value - divisor pairs with $separator between each element
     return implode($separator, $out);
 }
开发者ID:hemantshekhawat,项目名称:Snippets,代码行数:38,代码来源:format_interval.php

示例12: searchNGram

 public static function searchNGram($cuv)
 {
     $leng = mb_strlen($cuv);
     $hash = NGram::searchLexemIds($cuv);
     if (empty($hash)) {
         return array();
     }
     arsort($hash);
     $max = current($hash);
     $lexIds = array_keys($hash, $max);
     $results = array();
     foreach ($lexIds as $id) {
         $lexem = Model::factory('Lexem')->where('id', $id)->where_gte('charLength', $leng - self::$LENGTH_DIF)->where_lte('charLength', $leng + self::$LENGTH_DIF)->find_one();
         if ($lexem) {
             $results[] = $lexem;
             if (count($results) == self::$MAX_RESULTS) {
                 break;
             }
         }
     }
     // Sort the lexems by their Levenshtein distance from $cuv
     $distances = array();
     foreach ($results as $lexem) {
         $distances[] = Levenshtein::dist($cuv, $lexem->formNoAccent);
     }
     array_multisort($distances, $results);
     return $results;
 }
开发者ID:Jobava,项目名称:mirror-dexonline,代码行数:28,代码来源:NGram.php

示例13: populyar_post_by_visits

 public function populyar_post_by_visits()
 {
     $post = new Post();
     $posts = $post->order_by('time_created', 'desc');
     $posts = $posts->get();
     $res = $this->like('page', 'blog/post/', 'after')->get();
     $sluge = array();
     foreach ($res->all as $key => $value) {
         $post = explode('/', $value->page);
         if ($post[1] == 'post') {
             if (array_key_exists($post[2], $sluge)) {
                 $sluge[$post[2]]++;
             } else {
                 $sluge[$post[2]] = 1;
             }
         }
     }
     foreach ($posts->all as $post_key => $post_value) {
         if (!array_key_exists($post_value->slug, $sluge)) {
             $sluge[$post_value->slug] = 0;
         }
     }
     arsort($sluge);
     return $sluge;
 }
开发者ID:hyrmedia,项目名称:builderengine,代码行数:25,代码来源:Visits.php

示例14: __construct

 public function __construct($lang = "")
 {
     if (\file_exists(\pocketmine\PATH . "src/pocketmine/lang/Installer/" . $lang . ".ini")) {
         $this->lang = $lang;
         $this->langfile = \pocketmine\PATH . "src/pocketmine/lang/Installer/" . $lang . ".ini";
     } else {
         $files = [];
         foreach (new \DirectoryIterator(\pocketmine\PATH . "src/pocketmine/lang/Installer/") as $file) {
             if ($file->getExtension() === "ini" and \substr($file->getFilename(), 0, 2) === $lang) {
                 $files[$file->getFilename()] = $file->getSize();
             }
         }
         if (\count($files) > 0) {
             \arsort($files);
             \reset($files);
             $l = \key($files);
             $l = \substr($l, 0, -4);
             $this->lang = isset(self::$languages[$l]) ? $l : $lang;
             $this->langfile = \pocketmine\PATH . "src/pocketmine/lang/Installer/" . $l . ".ini";
         } else {
             $this->lang = "en";
             $this->langfile = \pocketmine\PATH . "src/pocketmine/lang/Installer/en.ini";
         }
     }
     $this->loadLang(\pocketmine\PATH . "src/pocketmine/lang/Installer/en.ini", "en");
     if ($this->lang !== "en") {
         $this->loadLang($this->langfile, $this->lang);
     }
 }
开发者ID:xpyctum,项目名称:PocketMinePlusPlus,代码行数:29,代码来源:InstallerLang.php

示例15: getEquipment

    /**
     * @return array Get list of browser "plugins" (javascript, media player, etc.)
     */
    private function getEquipment()
    {
        $sql = 'SELECT DISTINCT g.*
				FROM `' . _DB_PREFIX_ . 'connections` c 
				LEFT JOIN `' . _DB_PREFIX_ . 'guest` g ON g.`id_guest` = c.`id_guest`
				WHERE c.`date_add` BETWEEN ' . ModuleGraph::getDateBetween() . '
					' . Shop::addSqlRestriction(false, 'c');
        $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->query($sql);
        $calcArray = array('jsOK' => 0, 'jsKO' => 0, 'javaOK' => 0, 'javaKO' => 0, 'wmpOK' => 0, 'wmpKO' => 0, 'qtOK' => 0, 'qtKO' => 0, 'realOK' => 0, 'realKO' => 0, 'flashOK' => 0, 'flashKO' => 0, 'directorOK' => 0, 'directorKO' => 0);
        while ($row = Db::getInstance(_PS_USE_SQL_SLAVE_)->nextRow($result)) {
            if (!$row['javascript']) {
                ++$calcArray['jsKO'];
                continue;
            }
            ++$calcArray['jsOK'];
            $row['windows_media'] ? ++$calcArray['wmpOK'] : ++$calcArray['wmpKO'];
            $row['real_player'] ? ++$calcArray['realOK'] : ++$calcArray['realKO'];
            $row['adobe_flash'] ? ++$calcArray['flashOK'] : ++$calcArray['flashKO'];
            $row['adobe_director'] ? ++$calcArray['directorOK'] : ++$calcArray['directorKO'];
            $row['sun_java'] ? ++$calcArray['javaOK'] : ++$calcArray['javaKO'];
            $row['apple_quicktime'] ? ++$calcArray['qtOK'] : ++$calcArray['qtKO'];
        }
        if (!$calcArray['jsOK']) {
            return false;
        }
        $equip = array('Windows Media Player' => $calcArray['wmpOK'] / ($calcArray['wmpOK'] + $calcArray['wmpKO']), 'Real Player' => $calcArray['realOK'] / ($calcArray['realOK'] + $calcArray['realKO']), 'Apple Quicktime' => $calcArray['qtOK'] / ($calcArray['qtOK'] + $calcArray['qtKO']), 'Sun Java' => $calcArray['javaOK'] / ($calcArray['javaOK'] + $calcArray['javaKO']), 'Adobe Flash' => $calcArray['flashOK'] / ($calcArray['flashOK'] + $calcArray['flashKO']), 'Adobe Shockwave' => $calcArray['directorOK'] / ($calcArray['directorOK'] + $calcArray['directorKO']));
        arsort($equip);
        return $equip;
    }
开发者ID:jicheng17,项目名称:vipinsg,代码行数:32,代码来源:statsequipment.php


注:本文中的arsort函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。