public function testChoice()
 {
     $a = array(1, 2, 3, 4);
     $r = choice($a);
     echo $r;
     $this->assertTrue(array_search($r, $a) !== FALSE);
 }
Пример #2
0
function fake_name($name = null)
{
    if ($name != null && $name != '') {
        return new FakeName($name);
    }
    static $fake_names = array('Elten Sweet', 'Drew Clayton', 'Millson Stampes', 'Melvin Goodwin', 'Dwite Harding', 'Norton Atterton', 'Lindon Atherton', 'Brian Mitchell', 'Marsdon Holton', 'Jean Barney', 'Mina Eastoft', 'Kasandra Nottley', 'Christian Prescott', 'Riley Read', 'Corinne Southey', 'Kenzie Knotley', 'Bobby Snape', 'Berthe Smithies', 'Breana Nash', 'Jazmyne Smith', 'Normal Blackwood', 'Rawson Harrington', 'Wingate Benson', 'Forbes Spaulding', 'Raleigh Foy', 'Jack Burlingame', 'Waylon Altham', 'Herbert Royston', 'Quintin Sutton', 'Abraham Harding');
    return new FakeName(choice($fake_names));
}
Пример #3
0
function offerChoices()
{
    #----------------------------------------------------------------------
    global $chosenYears, $chosenRegionId, $chosenOrder;
    #--- Submission
    echo "<p>You can submit media <a href='media_insertion.php'>here</a></p><hr/><br/>";
    #--- Filter
    displayChoices(array(regionChoice(true), yearsChoice(true, false, false, true), choice('order', 'Sorted by', array(array('date', 'Competition Date'), array('submission', 'Insertion Date')), $chosenOrder), choiceButton(true, 'filter', 'Filter')));
}
function showChoices () {
#----------------------------------------------------------------------
  global $chosenWhat;
  displayChoices( array(
    eventChoice( false ),
    competitionChoice(),
    choice( 'what', 'What', array( array( '', 'All' ), array( 'individual', 'individual results' ), array( 'ranks', 'ranks' ), array( 'similar', 'similar results' )), $chosenWhat ),
    choiceButton( true, 'show', 'Show' )
  ));
}
function offerChoices()
{
    #----------------------------------------------------------------------
    global $chosenType, $chosenStatus, $chosenRegionId, $chosenOrder;
    displayChoices(array(regionChoice(true), choice('type', 'Type', array(array('', 'All'), array('article', 'Articles'), array('report', 'Reports'), array('multimedia', 'Multimedia')), $chosenType), choice('order', 'Sorted by', array(array('date', 'Competition Date'), array('submission', 'Submission/Insertion Date')), $chosenOrder), choice('status', 'Status', array(array('pending', 'Pending'), array('accepted', 'Accepted')), $chosenStatus), choiceButton(true, 'filter' . rand(), ' Filter ')));
}
Пример #6
0
function yes($text)
{
    return choice($text, 'yn', 'n') === 'y';
}
 public function fakeConfig($id)
 {
     $this->CI->config_model->insert(array('id' => $id, 'gateway_id' => choice(array(100, 1000, 10000))));
 }
function regionChoice($competitions)
{
    #----------------------------------------------------------------------
    global $chosenRegionId;
    $options[] = array('', 'World');
    $options[] = array('', '');
    foreach (getAllUsedContinents() as $row) {
        $options[] = array($row['id'], $row['name']);
    }
    $options[] = array('', '');
    if ($competitions) {
        foreach (getAllUsedCountriesCompetitions() as $row) {
            $options[] = array($row['id'], $row['name']);
        }
    } else {
        foreach (getAllUsedCountries() as $row) {
            $options[] = array($row['id'], $row['name']);
        }
    }
    return choice('regionId', 'Region', $options, $chosenRegionId);
}
Пример #9
0
 public function addUserInsane()
 {
     $this->addAdminGroup();
     $this->addPartnerGroup();
     $count = rand(20, 100);
     for ($i = 0; $i < $count; $i++) {
         $uid = $this->CI->user_model->insert(fake_user(1000 + $i));
         $this->CI->user_model->addUserToGroup($uid, choice(array($this->admin_group->id, $this->partner_group->id)));
     }
 }
Пример #10
0
function suggest($word)
{
    global $PREFERRED_FORMS;
    $forms = db_getArray(db_execute("select distinct formNoAccent from InflectedForm where formUtf8General = '{$word}' order by formNoAccent"));
    if (!count($forms)) {
        return $word;
    } else {
        if (count($forms) == 1) {
            return $forms[0];
        } else {
            if (array_key_exists($forms[0], $PREFERRED_FORMS)) {
                return $PREFERRED_FORMS[$forms[0]];
            } else {
                return choice($word, $forms);
            }
        }
    }
}
Пример #11
0
 /**
  * Generate a fake domain
  *
  * @author Jack
  * @date Mon Feb 23 15:38:53 2015
  */
 function fakeDomain()
 {
     static $fake_domains = array('163.com', '51.la', 'about.com', 'addthis.com', 'adobe.com', 'amazon.co.uk', 'amazon.com', 'ameblo.jp', 'aol.com', 'apple.com', 'baidu.com', 'bbc.co.uk', 'bing.com', 'blogger.com', 'blogspot.com', 'clickbank.net', 'cnn.com', 'creativecommons.org', 'dailymotion.com', 'delicious.com', 'digg.com', 'ebay.com', 'etsy.com', 'europa.eu', 'facebook.com', 'fc2.com', 'feedburner.com', 'flickr.com', 'forbes.com', 'free.fr', 'geocities.com', 'gnu.org', 'go.com', 'godaddy.com', 'goo.gl', 'google.co.jp', 'google.co.uk', 'google.com', 'google.de', 'gov.uk', 'guardian.co.uk', 'homestead.com', 'huffingtonpost.com', 'hugedomains.com', 'icio.us', 'imdb.com', 'instagram.com', 'issuu.com', 'jimdo.com', 'joomla.org', 'linkedin.com', 'livejournal.com', 'macromedia.com', 'mail.ru', 'mapquest.com', 'microsoft.com', 'miibeian.gov.cn', 'mozilla.org', 'msn.com', 'myspace.com', 'networkadvertising.org', 'nih.gov', 'nytimes.com', 'photobucket.com', 'pinterest.com', 'qq.com', 'rambler.ru', 'reddit.com', 'reuters.com', 'sina.com.cn', 'slideshare.net', 'sourceforge.net', 'statcounter.com', 'stumbleupon.com', 't.co', 'taobao.com', 'technorati.com', 'theguardian.com', 'tinyurl.com', 'tripod.com', 'tumblr.com', 'twitter.com', 'typepad.com', 'vimeo.com', 'vk.com', 'w3.org', 'washingtonpost.com', 'webs.com', 'weebly.com', 'weibo.com', 'wikipedia.org', 'wix.com', 'wordpress.com', 'wordpress.org', 'wsj.com', 'yahoo.co.jp', 'yahoo.com', 'yandex.ru', 'youtu.be', 'youtube.com');
     return choice($fake_domains);
 }
Пример #12
0
function offerChoices()
{
    #----------------------------------------------------------------------
    global $chosenShow, $chosenSingle, $chosenAverage;
    displayChoices(array(eventChoice(true), regionChoice(false), yearsChoice(true, false, true, true), choice('show', 'Show', array(array('100 Persons', '100 Persons'), array('1000 Persons', '1000 Persons'), array('All Persons', 'All Persons'), array('By Region', 'By Region'), array('100 Results', '100 Results'), array('1000 Results', '1000 Results')), $chosenShow), array(choiceButton($chosenSingle, 'single', 'Single'), choiceButton($chosenAverage, 'average', 'Average'))));
}