生成待发生的验证码

@return string
498474
protected function verifyCode()
    {
        $repeatIfValid = config('laravel-sms.verifyCode.repeatIfValid',
            config('laravel-sms.code.repeatIfValid', false));
        if ($repeatIfValid) {
            $state = $this->retrieveState();
            if (!(empty($state)) && $state['deadline'] >= time() + 60) {
                return $state['code'];
            }
        }

        return self::generateCode();
    }
690657
public function generate()
    {
        $result = '';

        $table  = $this->buildTable();
        $select = $this->buildSelectFields();
        $where  = $this->buildWhere();
        $having = $this->buildHaving();
        $join   = $this->buildJoin();
        $limit  = $this->buildLimit();
        $group  = $this->buildGroup();
        $union  = $this->buildUnion();
        $order  = $this->buildOrder();

        $result .= 'SELECT '.$select.' FROM '.$table;
        if ($join != '') {
            $result .= ' '.$join;
        }
        if ($where != '') {
            $result .= ' '.$where;
        }
        if ($group != '') {
            $result .= ' '.$group;
        }
        if ($order != '') {
            $result .= ' '.$order;
        }
        if ($limit != '') {
            $result .= ' '.$limit;
        }
        if ($having != '') {
            $result .= ' '.$having;
        }
        if ($union != '') {
            $result = '('.$result.')'.$union;
        }

        if ($this->isForUpdate()) {
            $result .= ' FOR UPDATE';
        }

        return $result;
    }
835016
public function generate()
    {
        return sprintf(
            '<%s %s>%s</%s>%s',
            $this->tag,
            parent::generate(),
            $this->label,
            $this->tag,
            PHP_EOL
        );
    }
303822
public function generate()
    {
        $code = '';

        if ($this->type !== null) {
            $code .= $this->type . ' ';
        }

        if ($this->passByReference === true) {
            $code .= '&';
        }

        $code .= '$' . $this->name;

        if ($this->defaultValue !== null) {
            if ($this->isDefaultValueConstant() === true) {
                $code .= ' = ' . $this->getDefaultValueConstantName();
            } else {
                $this->defaultValue->setOutputMode(ValueGenerator::OUTPUT_SINGLE_LINE);
                $code .= ' = ' . $this->defaultValue;
            }
        }

        return $code;
    }
866496
public function generate()
    {
        $this->fill();
        $content = [];
        foreach ($this->_cells as $item) {
            $content[] = $item->generate();
        }
        //return implode('', $content);
        return Html::tag('div', implode('', $content), $this->htmlOptions);
    }
530814
protected function genNonce() {
		$chars = '1234567890abcdefghijklmnopqrstuvwxyz';
		$rnd_string = '';
		$num_chars = strlen($chars);
		$size = mt_rand(41, 59);
		for($i=0; $i<$size; $i++) {
			$rnd_string .= $chars[mt_rand(0, $num_chars - 1)];
		}
		return $rnd_string;
	}
1256341
public function generate()
	{
		if (TL_MODE === 'BE') {
			return parent::generate();
		}

		$classes = array('rs-column');
		$parentKey = ($this->arrData['ptable'] ?: 'tl_article') . '__' . $this->arrData['pid'];

		if (isset($GLOBALS['TL_RS_COLUMNS'][$parentKey]) && $GLOBALS['TL_RS_COLUMNS'][$parentKey]['active']) {

			$GLOBALS['TL_RS_COLUMNS'][$parentKey]['active'] = false;
			$GLOBALS['TL_RS_COLUMNS'][$parentKey]['count']++;

			$count = $GLOBALS['TL_RS_COLUMNS'][$parentKey]['count'];
			foreach ($GLOBALS['TL_RS_COLUMNS'][$parentKey]['config'] as $name => $media) {
				$classes = array_merge($classes, $media[($count - 1) % count($media)]);
				if ($count - 1 < count($media)) {
					$classes[] = '-' . $name . '-first-row';
				}
			}

		}
		else {
			trigger_error('Missing column wrapper start element before column start element ID ' . $this->id . '.', E_USER_WARNING);
		}

		if (!is_array($this->cssID)) {
			$this->cssID = array('', '');
		}
		$this->arrData['cssID'][1] .= ' ' . implode(' ', $classes);

		return parent::generate();
	}
1229523
public function generate()
	{
		$title         = $this->getTitle();
		$description   = $this->getDescription();
		$keywords      = $this->getKeywords();
		$miscellaneous = $this->getMiscellaneous();
		$canonical     = $this->getCanonical();

		$html[] = '<title>'.$title.'</title>'.PHP_EOL;

		if (! is_null($description)) {
			$html[] = '<meta name="description" content="'.$description.'">';
		}

		if (! is_null($keywords)) {
			$html[] = '<meta name="keywords" content="'.$keywords.'">';
		}

		if (! is_null($miscellaneous)) {
			foreach ($miscellaneous as $name => $content) {
				$html[] = '<meta name="'.$name.'" content="'.$content.'">';
			}
		}

		if (! is_null($canonical)) {
			$currentUrl = $this->request->fullUrl();

			if ($canonical != $currentUrl) {
				$html[] = PHP_EOL.'<link rel="canonical" href="'.$canonical.'">';
			}
		}

		return implode(PHP_EOL, $html);
	}
1018289
public function generate()
	{
		$arrOptions = array();
		$strClass = 'tl_select';
		$strStyle = '<style>.group-result {padding-top: 5px !important; line-height: 20px !important;}';
		$count = 1;

		if ($this->multiple)
		{
			$this->strName .= '[]';
			$strClass = 'tl_mselect';
		}

		// Add an empty option (XHTML) if there are none
		if (empty($this->arrOptions))
		{
			$this->arrOptions = array(array('value'=>'', 'label'=>'-'));
		}
		
		foreach ($this->arrOptions as $strKey=>$arrOption)
		{
			if (isset($arrOption['value']))
			{
				$arrOptions[] = sprintf('<option value="%s"%s>%s</option>',
										 \StringUtil::specialchars($arrOption['value']),
										 $this->isSelected($arrOption),
										 $arrOption['label']);

				if (isset($GLOBALS['TL_CTB_IMG'][$arrOptgroup['value']]))
				{
					$objImage = \FilesModel::findByUuid($GLOBALS['TL_CTB_IMG'][$arrOptgroup['value']]);
				}
				
				if ($objImage === null)
				{
					$strStyle .= '#ctrl_type_chzn_o_'.$count.' {position: relative; padding-left: 90px; line-height: 41px;}#ctrl_type_chzn_o_'.$count++.'::before {content: ""; position: absolute; left: 20px; top:2px; width: 60px; height: 40px; border: 1px solid #ccc; background: #eee; background-size: 60px 40px;}';
				}
				else
				{
					$strStyle .= '#ctrl_type_chzn_o_'.$count.' {position: relative; padding-left: 90px; line-height: 41px;}#ctrl_type_chzn_o_'.$count++.'::before {content: ""; position: absolute; left: 20px; top:2px; width: 60px; height: 40px; border: 1px solid #ccc; background: #eee url('.$objImage->path.'); background-size: 60px 40px;}';
				}
			}
			else
			{
				$arrOptgroups = array();

				foreach ($arrOption as $arrOptgroup)
				{
					$arrOptgroups[] = sprintf('<option value="%s"%s>%s</option>',
											   \StringUtil::specialchars($arrOptgroup['value']),
											   $this->isSelected($arrOptgroup),
											   $arrOptgroup['label']);

					if (isset($GLOBALS['TL_CTB_IMG'][$arrOptgroup['value']]))
					{
						$objImage = \FilesModel::findByUuid($GLOBALS['TL_CTB_IMG'][$arrOptgroup['value']]);
					}

					if ($objImage === null)
					{
						$strStyle .= '#ctrl_type_chzn_o_'.$count.' {position: relative; padding-left: 90px; line-height: 41px;}#ctrl_type_chzn_o_'.$count++.'::before {content: ""; position: absolute; left: 20px; top:2px; width: 60px; height: 40px; border: 1px solid #ccc; background: #eee; background-size: 60px 40px;}';
					}
					else
					{
						$strStyle .= '#ctrl_type_chzn_o_'.$count.' {position: relative; padding-left: 90px; line-height: 41px;}#ctrl_type_chzn_o_'.$count++.'::before {content: ""; position: absolute; left: 20px; top:2px; width: 60px; height: 40px; border: 1px solid #ccc; background: #eee url('.$objImage->path.'); background-size: 60px 40px;}';
					}

				}

				$arrOptions[] = sprintf('<optgroup label="&nbsp;%s">%s</optgroup>', \StringUtil::specialchars($strKey), implode('', $arrOptgroups));
				$count++;
			}
		}

		// Chosen
		if ($this->chosen)
		{
			$strClass .= ' tl_chosen';
		}


		$strStyle .= '</style>';
	
		return sprintf('%s<select name="%s" id="ctrl_%s" class="%s%s"%s onfocus="Backend.getScrollOffset()">%s</select>%s',
						($this->multiple ? '<input type="hidden" name="'. rtrim($this->strName, '[]') .'" value="">' : ''),
						$this->strName,
						$this->strId,
						$strClass,
						(($this->strClass != '') ? ' ' . $this->strClass : ''),
						$this->getAttributes(),
						implode('', $arrOptions),
						$strStyle);
	}
598275
public function generate()
    {
        $code = array();

        $doc = $this->generateDocumentation();
        if ($doc !== null) {
            $code[] = $doc;
        }

        if ($this->isAbstract() === true) {
            $code[] = $this->generateSignature() . ';';
        } else {
            $code[] = $this->generateSignature();
            $code[] = $this->getIndentation() . $this->generateBody();
        }

        return implode($this->getLineFeed(), $code);
    }
148456
public static function generate()
    {
        if (version_compare(PHP_VERSION, '7.0.0', '<')) {
            return sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
                mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff),
                mt_rand(0, 0x0fff) | 0x4000,
                mt_rand(0, 0x3fff) | 0x8000,
                mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff)
            );
        } else {
            $uuid = bin2hex(random_bytes(18));
            $uuid[8] = $uuid[13] = $uuid[18] = $uuid[23] = '-';
            $uuid[14] = '4';

            return $uuid;
        }
    }
443561
protected function generate()
    {

        $this->password = '';

        $chars = range('a', 'z');

        $symbols = Array('*', '&', '^', '%', '$', '#', '@', '!');

        $chars = array_merge($chars, $symbols);

        //get rid of l and o as they can be confused with 1 and 0
        unset($chars[11]);
        unset($chars[14]);

        $chars = array_values($chars);

        $chars_length = count($chars);

        foreach (range(1, $this->length) as $char) {

            $char = '';

            $integer = rand(2, 9).'';
            $new_char = $chars[rand(0, $chars_length - 1)];
            if (strstr($this->password, $new_char)) {
                $char = $new_char;
            } elseif (strstr($this->password, $integer)) {
                $char = $integer;
            } else {
                $char = rand(0, 1) ? $new_char : $integer;
            }

            $this->password .= $char;
        }

        $this->password = substr_replace($this->password, array_rand($symbols), rand(0, strlen($this->password)), 1);
    }
946490
public function generate()
    {
        if (TL_MODE == 'BE') {
            $objMap = $this->Database->prepare("SELECT * FROM tl_c4g_maps WHERE id=?")
                           ->limit(1)
                           ->execute($this->c4g_map_id);
            $return = '<h1>' . $objMap->name . '<img src="bundles/con4gismaps/images/logo_con4gis-maps.png" style="float:right"></h1>';

            return $return;
        }

        return parent::generate();
    }
803998
private function createExist(): string
    {
        // 先构造子查询
        $this->createSelect();

        // 使用子查询构造存在查询
        $this->prepare = $this->db->createExist($this->prepare);
        $this->sql = $this->db->createExist($this->sql);

        $this->tables = [$this->table];
        return $this->prepare;
    }
591487
public function generate()
    {
        // Make a new key pair
        /** @var resource $private_key */
        $private_key = openssl_pkey_new([
            'private_key_bits'      => 2048,
            'private_key_type'      => OPENSSL_KEYTYPE_RSA,
            'encrypt_key'           => false,
        ]);

        // Export the key pair to a string
        $this->private_key_text = '';
        openssl_pkey_export($private_key, $this->private_key_text);

        // Get the public key
        $public_key_data       = openssl_pkey_get_details($private_key);
        $this->public_key_text = $public_key_data['key'];

        return $this;
    }
1209496
private function createQuery(): string
    {
        // 已经直接传递了SQL,Prepare与SQL相同
        $this->prepare = $this->sql;

        // 查找其中的表名
        $this->tables = $this->db->getNameFromQuery($this->sql);

        return $this->prepare;
    }
1226165
private function generateFromGeneric()
    {
        $ctypes = $this->app['config']->get('contenttypes');

        $translatables = array_filter(
            array_keys($this->translatables),
            function ($key) {
                return substr($key, 0, 21) === 'contenttypes.generic.' && substr($key, 21, 6) !== 'group.';
            }
        );

        foreach ($translatables as $key) {
            foreach ($ctypes as $ctname => $ctype) {
                $setkey = 'contenttypes.' . $ctname . '.text.' . substr($key, 21);
                $this->translation[$setkey] = isset($this->saved[$setkey]) ? $this->saved[$setkey] : '';
                if ($this->translation[$setkey] === '') {
                    $generic = Trans::__($key);
                    // If not translated, add hint
                    if ($generic !== $key) {
                        $replacement = [];
                        if (strpos($generic, '%contenttypes%') !== false) {
                            $replacement['%contenttypes%'] = $ctname;
                        } elseif (strpos($generic, '%contenttype%') !== false) {
                            $replacement['%contenttype%'] = $ctname;
                        }
                        $this->hints[$setkey] = Trans::__($key, $replacement);
                    }
                }
            }
        }
    }