本文整理汇总了PHP中str_repeat函数的典型用法代码示例。如果您正苦于以下问题:PHP str_repeat函数的具体用法?PHP str_repeat怎么用?PHP str_repeat使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了str_repeat函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: start_el
function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0)
{
$indent = $depth ? str_repeat("\t", $depth) : '';
$classes = empty($item->classes) ? array() : (array) $item->classes;
$classes[] = 'menu-item-' . $item->ID;
$class_names = join(' ', apply_filters('nav_menu_css_class', array_filter($classes), $item, $args, $depth));
/**
* Change WP's default classes to match Foundation's required classes
*/
$class_names = str_replace(array('menu-item-has-children'), array('has-submenu'), $class_names);
// ==========================
$class_names = $class_names ? ' class="' . esc_attr($class_names) . '"' : '';
$id = apply_filters('nav_menu_item_id', 'menu-item-' . $item->ID, $item, $args, $depth);
$id = $id ? ' id="' . esc_attr($id) . '"' : '';
$output .= $indent . '<li' . $id . $class_names . '>';
$atts = array();
$atts['title'] = !empty($item->attr_title) ? $item->attr_title : '';
$atts['target'] = !empty($item->target) ? $item->target : '';
$atts['rel'] = !empty($item->xfn) ? $item->xfn : '';
$atts['href'] = !empty($item->url) ? $item->url : '';
$atts = apply_filters('nav_menu_link_attributes', $atts, $item, $args, $depth);
$attributes = '';
foreach ($atts as $attr => $value) {
if (!empty($value)) {
$value = 'href' === $attr ? esc_url($value) : esc_attr($value);
$attributes .= ' ' . $attr . '="' . $value . '"';
}
}
$item_output = $args->before;
$item_output .= '<a' . $attributes . '>';
$item_output .= $args->link_before . apply_filters('the_title', $item->title, $item->ID) . $args->link_after;
$item_output .= '</a>';
$item_output .= $args->after;
$output .= apply_filters('walker_nav_menu_start_el', $item_output, $item, $depth, $args);
}
开发者ID:andrewcroce,项目名称:TPL,代码行数:35,代码来源:offcanvas-walker.class.php
示例2: _str_pad
/**
* utf8::str_pad
*
* @package Core
* @author Kohana Team
* @copyright (c) 2007 Kohana Team
* @copyright (c) 2005 Harry Fuecks
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
*/
function _str_pad($str, $final_str_length, $pad_str = ' ', $pad_type = STR_PAD_RIGHT)
{
if (utf8::is_ascii($str) and utf8::is_ascii($pad_str)) {
return str_pad($str, $final_str_length, $pad_str, $pad_type);
}
$str_length = utf8::strlen($str);
if ($final_str_length <= 0 or $final_str_length <= $str_length) {
return $str;
}
$pad_str_length = utf8::strlen($pad_str);
$pad_length = $final_str_length - $str_length;
if ($pad_type == STR_PAD_RIGHT) {
$repeat = ceil($pad_length / $pad_str_length);
return utf8::substr($str . str_repeat($pad_str, $repeat), 0, $final_str_length);
}
if ($pad_type == STR_PAD_LEFT) {
$repeat = ceil($pad_length / $pad_str_length);
return utf8::substr(str_repeat($pad_str, $repeat), 0, floor($pad_length)) . $str;
}
if ($pad_type == STR_PAD_BOTH) {
$pad_length /= 2;
$pad_length_left = floor($pad_length);
$pad_length_right = ceil($pad_length);
$repeat_left = ceil($pad_length_left / $pad_str_length);
$repeat_right = ceil($pad_length_right / $pad_str_length);
$pad_left = utf8::substr(str_repeat($pad_str, $repeat_left), 0, $pad_length_left);
$pad_right = utf8::substr(str_repeat($pad_str, $repeat_right), 0, $pad_length_left);
return $pad_left . $str . $pad_right;
}
trigger_error('utf8::str_pad: Unknown padding type (' . $type . ')', E_USER_ERROR);
}
开发者ID:Toushi,项目名称:flow,代码行数:40,代码来源:str_pad.php
示例3: execute
public function execute(PhutilArgumentParser $args)
{
$console = PhutilConsole::getConsole();
$ids = $args->getArg('id');
if (!$ids) {
throw new PhutilArgumentUsageException(pht("Use the '%s' flag to specify one or more SMS messages to show.", '--id'));
}
$messages = id(new PhabricatorSMS())->loadAllWhere('id IN (%Ld)', $ids);
if ($ids) {
$ids = array_fuse($ids);
$missing = array_diff_key($ids, $messages);
if ($missing) {
throw new PhutilArgumentUsageException(pht('Some specified SMS messages do not exist: %s', implode(', ', array_keys($missing))));
}
}
$last_key = last_key($messages);
foreach ($messages as $message_key => $message) {
$info = array();
$info[] = pht('PROPERTIES');
$info[] = pht('ID: %d', $message->getID());
$info[] = pht('Status: %s', $message->getSendStatus());
$info[] = pht('To: %s', $message->getToNumber());
$info[] = pht('From: %s', $message->getFromNumber());
$info[] = null;
$info[] = pht('BODY');
$info[] = $message->getBody();
$info[] = null;
$console->writeOut('%s', implode("\n", $info));
if ($message_key != $last_key) {
$console->writeOut("\n%s\n\n", str_repeat('-', 80));
}
}
}
开发者ID:pugong,项目名称:phabricator,代码行数:33,代码来源:PhabricatorSMSManagementShowOutboundWorkflow.php
示例4: testTooLargeMegaBytes
public function testTooLargeMegaBytes()
{
fwrite($this->file, str_repeat('0', 1400000));
$constraint = new File(array('maxSize' => '1M', 'maxSizeMessage' => 'myMessage'));
$this->context->expects($this->once())->method('addViolation')->with('myMessage', array('{{ limit }}' => '1 MB', '{{ size }}' => '1.4 MB', '{{ file }}' => $this->path));
$this->validator->validate($this->getFile($this->path), $constraint);
}
开发者ID:nashadalam,项目名称:symfony,代码行数:7,代码来源:FileValidatorTest.php
示例5: hikashopSubscriptionType
function hikashopSubscriptionType()
{
if (!HIKASHOP_PHP5) {
$acl =& JFactory::getACL();
} else {
$acl = JFactory::getACL();
}
if (!HIKASHOP_J16) {
$this->groups = $acl->get_group_children_tree(null, 'USERS', false);
} else {
$db = JFactory::getDBO();
$db->setQuery('SELECT a.*, a.title as text, a.id as value FROM #__usergroups AS a ORDER BY a.lft ASC');
$this->groups = $db->loadObjectList('id');
foreach ($this->groups as $id => $group) {
if (isset($this->groups[$group->parent_id])) {
$this->groups[$id]->level = intval(@$this->groups[$group->parent_id]->level) + 1;
$this->groups[$id]->text = str_repeat('- - ', $this->groups[$id]->level) . $this->groups[$id]->text;
}
}
}
$this->choice = array();
$this->choice[] = JHTML::_('select.option', 'none', JText::_('HIKA_NONE'));
$this->choice[] = JHTML::_('select.option', 'special', JText::_('HIKA_CUSTOM'));
$js = "function updateSubscription(map){\r\n\t\t\tchoice = document.adminForm['choice_'+map];\r\n\t\t\tchoiceValue = 'special';\r\n\t\t\tfor (var i=0; i < choice.length; i++){\r\n\t\t\t\tif (choice[i].checked){\r\n\t\t\t\t\tchoiceValue = choice[i].value;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\thiddenVar = document.getElementById('hidden_'+map);\r\n\t\t\tif(choiceValue != 'special'){\r\n\t\t\t\thiddenVar.value = choiceValue;\r\n\t\t\t\tif(hiddenVar.value == 'none') hiddenVar.value = '';\r\n\t\t\t\tdocument.getElementById('div_'+map).style.display = 'none';\r\n\t\t\t}else{\r\n\t\t\t\tdocument.getElementById('div_'+map).style.display = '';\r\n\t\t\t\tspecialVar = eval('document.adminForm.special_'+map);\r\n\t\t\t\tfinalValue = '';\r\n\t\t\t\tfor (var i=0; i < specialVar.length; i++){\r\n\t\t\t\t\tif (specialVar[i].checked){\r\n\t\t\t\t\t\tfinalValue += specialVar[i].value;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\thiddenVar.value = finalValue;\r\n\t\t\t}\r\n\t\t}";
if (!HIKASHOP_PHP5) {
$doc =& JFactory::getDocument();
} else {
$doc = JFactory::getDocument();
}
$doc->addScriptDeclaration($js);
}
开发者ID:q0821,项目名称:esportshop,代码行数:31,代码来源:subscription.php
示例6: tearDownAfterClass
public static function tearDownAfterClass()
{
if (!self::$timing) {
echo "\n";
return;
}
$class = get_called_class();
echo "Timing results : {$class}\n";
$s = sprintf("%40s %6s %9s %9s %4s\n", 'name', 'count', 'total', 'avg', '% best');
echo str_repeat('=', strlen($s)) . "\n";
echo $s;
echo str_repeat('-', strlen($s)) . "\n";
array_walk(self::$timing, function (&$value, $key) {
$value['avg'] = round($value['total'] / $value['count'] * 1000000, 3);
});
usort(self::$timing, function ($a, $b) {
$at = $a['avg'];
$bt = $b['avg'];
return $at === $bt ? 0 : ($at < $bt ? -1 : 1);
});
$best = self::$timing[0]['avg'];
foreach (self::$timing as $timing) {
printf("%40s %6d %7.3fms %7.3fus %4.1f%%\n", $timing['name'], $timing['count'], round($timing['total'] * 1000, 3), $timing['avg'], round($timing['avg'] / $best * 100, 3));
}
echo str_repeat('-', strlen($s)) . "\n\n";
printf("\nTiming compensated for avg overhead for: timeIt of %.3fus and startTimer/endTimer of %.3fus per invocation\n\n", self::$timeItOverhead * 1000000, self::$startEndOverhead * 1000000);
parent::tearDownAfterClass();
}
开发者ID:mean-cj,项目名称:laravel-translation-manager,代码行数:28,代码来源:TranslationManagerTestCase.php
示例7: ss_hide_mail
function ss_hide_mail($email)
{
$mail_segments = explode("@", $email);
$half = (int) strlen($mail_segments[0]) / 2;
$mail_segments[0] = str_repeat("*", $half) . substr($mail_segments[0], $half);
return implode("@", $mail_segments);
}
开发者ID:seriusokhatsky,项目名称:envato-api,代码行数:7,代码来源:envato-api-functions.php
示例8: getDirectory
function getDirectory($path = '.', $level = 0)
{
$ignore = array('cgi-bin', '.', '..');
// Directories to ignore when listing output. Many hosts
// will deny PHP access to the cgi-bin.
$dh = @opendir($path);
// Open the directory to the handle $dh
while (false !== ($file = readdir($dh))) {
// Loop through the directory
if (!in_array($file, $ignore)) {
// Check that this file is not to be ignored
str_repeat(' ', $level * 4);
// Just to add spacing to the list, to better
// show the directory tree.
if (is_dir("{$path}/{$file}")) {
// Its a directory, so we need to keep reading down...
echo "{$path}/{$file};";
getDirectory("{$path}/{$file}", $level + 1);
// Re-call this same function but on a new directory.
// this is what makes function recursive.
} else {
echo "{$path}/{$file};";
// Just print out the filename
}
}
}
closedir($dh);
// Close the directory handle
}
开发者ID:rogermelich,项目名称:consultesLdap,代码行数:29,代码来源:uploadPhotos.php
示例9: createRow
protected function createRow($items, $aData = array(), $level = 1)
{
if ($items->count()) {
foreach ($items as $itm) {
$getter = 'get' . $this->getValueField();
$aResultTmp = array('Value' => call_user_func(array($itm, $getter)), 'Name' => $this->getTextFormat());
$aRs = array();
if (preg_match_all("/:(.*):/iU", $aResultTmp['Name'], $aRs)) {
foreach ($aRs[1] as $k => $val) {
$value = $itm;
if (strpos($val, "-") !== false) {
$xVal = explode("-", $val);
foreach ($xVal as $_val) {
$sGetter = 'get' . $_val;
$value = call_user_func(array($value, $sGetter));
}
} else {
$sGetter = 'get' . $val;
$value = call_user_func(array($value, $sGetter));
}
$aResultTmp['Name'] = str_replace($aRs[0][$k], $value, $aResultTmp['Name']);
}
}
if ($this->getIsTree() && $level > 1) {
$aResultTmp['Name'] = str_repeat(" |-- ", $level - 1) . $aResultTmp['Name'];
}
$aData[] = $aResultTmp;
if ($itm->hasChilds()) {
$aData = $this->createRow($itm->getChilds(), $aData, $level + 1);
}
}
}
return $aData;
}
开发者ID:ruxon,项目名称:module-ruxon,代码行数:34,代码来源:RuxonFormViewListColumn.class.php
示例10: replace
/**
* 替换屏蔽字
*/
public function replace()
{
$content = trim(urldecode($this->input['banword']));
$symbol = trim(urldecode($this->input['symbol']));
if (empty($content)) {
$this->errorOutput(OBJECT_NULL);
}
$data = $this->banword($content);
if ($data) {
$replace = array();
$find = array();
foreach ($data as $v) {
if (!empty($symbol) && $symbol != '*') {
$replace[] = $symbol;
} else {
if (!empty($v['banwd'])) {
$replace[] = $v['banwd'];
} else {
$replace[] = str_repeat('*', mb_strlen($v['banname'], 'utf-8'));
}
}
$find[] = $v['banname'];
}
$content = str_replace($find, $replace, $content);
}
$this->addItem($content);
$this->output();
}
开发者ID:h3len,项目名称:Project,代码行数:31,代码来源:banword.php
示例11: start_el
/**
* Create the markup to start an element.
*
* @see Walker::start_el() for description of parameters.
*
* @param string $output Passed by reference. Used to append additional
* content.
* @param object $item Menu item data object.
* @param int $depth Depth of menu item. Used for padding.
* @param object $args See {@Walker::start_el()}.
* @param int $id See {@Walker::start_el()}.
*/
public function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0)
{
global $_nav_menu_placeholder;
$_nav_menu_placeholder = 0 > $_nav_menu_placeholder ? intval($_nav_menu_placeholder) - 1 : -1;
$possible_object_id = isset($item->post_type) && 'nav_menu_item' == $item->post_type ? $item->object_id : $_nav_menu_placeholder;
$possible_db_id = !empty($item->ID) && 0 < $possible_object_id ? (int) $item->ID : 0;
$indent = $depth ? str_repeat("\t", $depth) : '';
$output .= $indent . '<li>';
$output .= '<label class="menu-item-title">';
$output .= '<input type="checkbox" class="menu-item-checkbox';
if (property_exists($item, 'label')) {
$title = $item->label;
}
$output .= '" name="menu-item[' . $possible_object_id . '][menu-item-object-id]" value="' . esc_attr($item->object_id) . '" /> ';
$output .= isset($title) ? esc_html($title) : esc_html($item->title);
$output .= '</label>';
if (empty($item->url)) {
$item->url = $item->guid;
}
if (!in_array(array('umnm-menu', 'umnm-' . $item->post_excerpt . '-nav'), $item->classes)) {
$item->classes[] = 'umnm-menu';
$item->classes[] = 'umnm-' . $item->post_excerpt . '-nav';
}
// Menu item hidden fields
$output .= '<input type="hidden" class="menu-item-db-id" name="menu-item[' . $possible_object_id . '][menu-item-db-id]" value="' . $possible_db_id . '" />';
$output .= '<input type="hidden" class="menu-item-object" name="menu-item[' . $possible_object_id . '][menu-item-object]" value="' . esc_attr($item->object) . '" />';
$output .= '<input type="hidden" class="menu-item-parent-id" name="menu-item[' . $possible_object_id . '][menu-item-parent-id]" value="' . esc_attr($item->menu_item_parent) . '" />';
$output .= '<input type="hidden" class="menu-item-type" name="menu-item[' . $possible_object_id . '][menu-item-type]" value="custom" />';
$output .= '<input type="hidden" class="menu-item-title" name="menu-item[' . $possible_object_id . '][menu-item-title]" value="' . esc_attr($item->title) . '" />';
$output .= '<input type="hidden" class="menu-item-url" name="menu-item[' . $possible_object_id . '][menu-item-url]" value="' . esc_attr($item->url) . '" />';
$output .= '<input type="hidden" class="menu-item-target" name="menu-item[' . $possible_object_id . '][menu-item-target]" value="' . esc_attr($item->target) . '" />';
$output .= '<input type="hidden" class="menu-item-attr_title" name="menu-item[' . $possible_object_id . '][menu-item-attr_title]" value="' . esc_attr($item->attr_title) . '" />';
$output .= '<input type="hidden" class="menu-item-classes" name="menu-item[' . $possible_object_id . '][menu-item-classes]" value="' . esc_attr(implode(' ', $item->classes)) . '" />';
$output .= '<input type="hidden" class="menu-item-xfn" name="menu-item[' . $possible_object_id . '][menu-item-xfn]" value="' . esc_attr($item->xfn) . '" />';
}
开发者ID:wpdelighter,项目名称:ultimate-member-navigation-menu,代码行数:47,代码来源:class-umnm-walker-nav-menu-checklist.php
示例12: profileOut
function profileOut($functionname)
{
global $wgDebugFunctionEntry;
if ($wgDebugFunctionEntry) {
$this->debug(str_repeat(' ', count($this->mWorkStack) - 1) . 'Exiting ' . $functionname . "\n");
}
list($ofname, , $ortime, $octime) = array_pop($this->mWorkStack);
if (!$ofname) {
$this->debug("Profiling error: {$functionname}\n");
} else {
if ($functionname == 'close') {
$message = "Profile section ended by close(): {$ofname}";
$functionname = $ofname;
$this->debug("{$message}\n");
$this->mCollated[$message] = $this->errorEntry;
} elseif ($ofname != $functionname) {
$message = "Profiling error: in({$ofname}), out({$functionname})";
$this->debug("{$message}\n");
$this->mCollated[$message] = $this->errorEntry;
}
$entry =& $this->mCollated[$functionname];
$elapsedcpu = $this->getTime('cpu') - $octime;
$elapsedreal = $this->getTime() - $ortime;
if (!is_array($entry)) {
$entry = $this->zeroEntry;
$this->mCollated[$functionname] =& $entry;
}
$entry['cpu'] += $elapsedcpu;
$entry['cpu_sq'] += $elapsedcpu * $elapsedcpu;
$entry['real'] += $elapsedreal;
$entry['real_sq'] += $elapsedreal * $elapsedreal;
$entry['count']++;
}
}
开发者ID:seedbank,项目名称:old-repo,代码行数:34,代码来源:ProfilerSimple.php
示例13: registerFatalHandler
public function registerFatalHandler($level = null, $reservedMemorySize = 20)
{
register_shutdown_function(array($this, 'handleFatalError'));
$this->reservedMemory = str_repeat(' ', 1024 * $reservedMemorySize);
$this->fatalLevel = $level;
$this->hasFatalErrorHandler = true;
}
开发者ID:acrobat,项目名称:monolog,代码行数:7,代码来源:ErrorHandler.php
示例14: writePadding
private function writePadding($data)
{
$padding = strlen($data) % 4;
if ($padding) {
return str_repeat("ª", 4 - $padding);
}
}
开发者ID:nakashu,项目名称:symfony,代码行数:7,代码来源:IcuResFileDumper.php
示例15: start_el
/**
* start_el function.
*
* @access public
* @param mixed &$output
* @param mixed $item
* @param int $depth (default: 0)
* @param array $args (default: array())
* @param int $id (default: 0)
* @return void
*/
function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0)
{
$indent = $depth ? str_repeat("\t", $depth) : '';
$li_attributes = '';
$class_names = $value = '';
$classes = empty($item->classes) ? array() : (array) $item->classes;
$classes[] = $args->has_children ? 'dropdown' : '';
$classes[] = $item->current || $item->current_item_ancestor ? 'active' : '';
$classes[] = 'menu-item-' . $item->ID;
$class_names = join(' ', apply_filters('nav_menu_css_class', array_filter($classes), $item, $args));
$class_names = ' class="' . esc_attr($class_names) . '"';
$id = apply_filters('nav_menu_item_id', 'menu-item-' . $item->ID, $item, $args);
$id = strlen($id) ? ' id="' . esc_attr($id) . '"' : '';
$output .= $indent . '<li' . $id . $value . $class_names . $li_attributes . '>';
$attributes = !empty($item->attr_title) ? ' title="' . esc_attr($item->attr_title) . '"' : '';
$attributes .= !empty($item->target) ? ' target="' . esc_attr($item->target) . '"' : '';
$attributes .= !empty($item->xfn) ? ' rel="' . esc_attr($item->xfn) . '"' : '';
$attributes .= !empty($item->url) ? ' href="' . esc_attr($item->url) . '"' : '';
$attributes .= $args->has_children ? ' class="dropdown-toggle" data-toggle="dropdown"' : '';
$item_output = $args->before;
$item_output .= '<a' . $attributes . '>';
$item_output .= $args->link_before . apply_filters('the_title', $item->title, $item->ID) . $args->link_after;
$item_output .= $args->has_children ? ' <b class="caret"></b></a>' : '</a>';
$item_output .= $args->after;
$output .= apply_filters('walker_nav_menu_start_el', $item_output, $item, $depth, $args);
}
开发者ID:quinntron,项目名称:greendot,代码行数:37,代码来源:class-Upbootwp_Walker_Nav_Menu.php
示例16: _get_select
function _get_select()
{
$exclude = array();
$wlk = $this->_tree_walk_preorder($this->node);
while (!$wlk['recset']->EOF) {
$row = $wlk['recset']->fields;
$exclude[$row['id']] = 'yes';
$wlk['recset']->MoveNext();
}
$mySelect = new CHAW_select($this->key);
$node = $this->_tree_get_group_root_node($this->usergroup);
$attributes = array('name');
$wlk = $this->_tree_walk_preorder($node);
while ($curr = $this->_tree_walk_next($wlk)) {
$level = $this->_tree_walk_level($wlk);
$spaces = str_repeat('--', $level - 1);
$att = reset($attributes);
while ($att) {
if ($level == 0) {
$mySelect->add_option('(seleziona cartella)', $wlk['row']['id']);
} elseif ($wlk['row']['file'] == '' && !isset($exclude[$wlk['row']['id']])) {
$mySelect->add_option($spaces . $wlk['row'][$att], $wlk['row']['id']);
}
$att = next($attributes);
}
}
return $mySelect;
}
开发者ID:umbecr,项目名称:camilaframework,代码行数:28,代码来源:fm_exclude_current_dir_listbox.php
示例17: getSummary
public function getSummary()
{
$pageTitle = '<h2>' . mt('monitoring', 'Monitoring Backend', 'setup.page.title') . '</h2>';
$backendDescription = '<p>' . sprintf(mt('monitoring', 'Icinga Web 2 will retrieve information from your monitoring environment' . ' using a backend called "%s" and the specified resource below:'), $this->data['backendConfig']['name']) . '</p>';
if ($this->data['resourceConfig']['type'] === 'db') {
$resourceTitle = '<h3>' . mt('monitoring', 'Database Resource') . '</h3>';
$resourceHtml = '' . '<table>' . '<tbody>' . '<tr>' . '<td><strong>' . t('Resource Name') . '</strong></td>' . '<td>' . $this->data['resourceConfig']['name'] . '</td>' . '</tr>' . '<tr>' . '<td><strong>' . t('Database Type') . '</strong></td>' . '<td>' . $this->data['resourceConfig']['db'] . '</td>' . '</tr>' . '<tr>' . '<td><strong>' . t('Host') . '</strong></td>' . '<td>' . $this->data['resourceConfig']['host'] . '</td>' . '</tr>' . '<tr>' . '<td><strong>' . t('Port') . '</strong></td>' . '<td>' . $this->data['resourceConfig']['port'] . '</td>' . '</tr>' . '<tr>' . '<td><strong>' . t('Database Name') . '</strong></td>' . '<td>' . $this->data['resourceConfig']['dbname'] . '</td>' . '</tr>' . '<tr>' . '<td><strong>' . t('Username') . '</strong></td>' . '<td>' . $this->data['resourceConfig']['username'] . '</td>' . '</tr>' . '<tr>' . '<td><strong>' . t('Password') . '</strong></td>' . '<td>' . str_repeat('*', strlen($this->data['resourceConfig']['password'])) . '</td>' . '</tr>';
if (isset($this->data['resourceConfig']['ssl_key']) && $this->data['resourceConfig']['ssl_key']) {
$resourceHtml .= '' . '<tr>' . '<td><strong>' . t('SSL Key') . '</strong></td>' . '<td>' . $this->data['resourceConfig']['ssl_key'] . '</td>' . '</tr>';
}
if (isset($this->data['resourceConfig']['ssl_cert']) && $this->data['resourceConfig']['ssl_cert']) {
$resourceHtml .= '' . '<tr>' . '<td><strong>' . t('SSL Cert') . '</strong></td>' . '<td>' . $this->data['resourceConfig']['ssl_cert'] . '</td>' . '</tr>';
}
if (isset($this->data['resourceConfig']['ssl_ca']) && $this->data['resourceConfig']['ssl_ca']) {
$resourceHtml .= '' . '<tr>' . '<td><strong>' . t('CA') . '</strong></td>' . '<td>' . $this->data['resourceConfig']['ssl_ca'] . '</td>' . '</tr>';
}
if (isset($this->data['resourceConfig']['ssl_capath']) && $this->data['resourceConfig']['ssl_capath']) {
$resourceHtml .= '' . '<tr>' . '<td><strong>' . t('CA Path') . '</strong></td>' . '<td>' . $this->data['resourceConfig']['ssl_capath'] . '</td>' . '</tr>';
}
if (isset($this->data['resourceConfig']['ssl_cipher']) && $this->data['resourceConfig']['ssl_cipher']) {
$resourceHtml .= '' . '<tr>' . '<td><strong>' . t('Cipher') . '</strong></td>' . '<td>' . $this->data['resourceConfig']['ssl_cipher'] . '</td>' . '</tr>';
}
$resourceHtml .= '' . '</tbody>' . '</table>';
} else {
// $this->data['resourceConfig']['type'] === 'livestatus'
$resourceTitle = '<h3>' . mt('monitoring', 'Livestatus Resource') . '</h3>';
$resourceHtml = '' . '<table>' . '<tbody>' . '<tr>' . '<td><strong>' . t('Resource Name') . '</strong></td>' . '<td>' . $this->data['resourceConfig']['name'] . '</td>' . '</tr>' . '<tr>' . '<td><strong>' . t('Socket') . '</strong></td>' . '<td>' . $this->data['resourceConfig']['socket'] . '</td>' . '</tr>' . '</tbody>' . '</table>';
}
return $pageTitle . '<div class="topic">' . $backendDescription . $resourceTitle . $resourceHtml . '</div>';
}
开发者ID:0svald,项目名称:icingaweb2,代码行数:30,代码来源:BackendStep.php
示例18: execute
public function execute(CommandSender $sender, $currentAlias, array $args)
{
if (!$this->testPermission($sender)) {
return true;
}
if (count($args) === 0) {
$output = "This server is running " . $sender->getServer()->getName() . " version " . $sender->getServer()->getPocketMineVersion() . " 「" . $sender->getServer()->getCodename() . "」 (Implementing API version " . $sender->getServer()->getApiVersion() . " for Minecraft: PE " . $sender->getServer()->getVersion() . " protocol version " . Info::CURRENT_PROTOCOL . ")";
if (\pocketmine\GIT_COMMIT !== str_repeat("00", 20)) {
$output .= " [git " . \pocketmine\GIT_COMMIT . "]";
}
$sender->sendMessage($output);
} else {
$pluginName = implode(" ", $args);
$exactPlugin = $sender->getServer()->getPluginManager()->getPlugin($pluginName);
if ($exactPlugin instanceof Plugin) {
$this->describeToSender($exactPlugin, $sender);
return true;
}
$found = false;
$pluginName = strtolower($pluginName);
foreach ($sender->getServer()->getPluginManager()->getPlugins() as $plugin) {
if (stripos($plugin->getName(), $pluginName) !== false) {
$this->describeToSender($plugin, $sender);
$found = true;
}
}
if (!$found) {
$sender->sendMessage("This server is not running any plugin by that name.\nUse /plugins to get a list of plugins.");
}
}
return true;
}
开发者ID:boybook,项目名称:PocketMine-MP,代码行数:32,代码来源:VersionCommand.php
示例19: DumpWorkflow
public static function DumpWorkflow($workflowId)
{
global $DB;
$workflowId = trim($workflowId);
if (strlen($workflowId) <= 0) {
throw new Exception("workflowId");
}
$dbResult = $DB->Query("SELECT ID, TYPE, MODIFIED, ACTION_NAME, ACTION_TITLE, EXECUTION_STATUS, EXECUTION_RESULT, ACTION_NOTE, MODIFIED_BY " . "FROM b_bp_tracking " . "WHERE WORKFLOW_ID = '" . $DB->ForSql($workflowId) . "' " . "ORDER BY ID ");
$r = array();
$level = 0;
while ($arResult = $dbResult->GetNext()) {
if ($arResult["TYPE"] == CBPTrackingType::CloseActivity) {
$level--;
$arResult["PREFIX"] = str_repeat(" ", $level > 0 ? $level : 0);
$arResult["LEVEL"] = $level;
} elseif ($arResult["TYPE"] == CBPTrackingType::ExecuteActivity) {
$arResult["PREFIX"] = str_repeat(" ", $level > 0 ? $level : 0);
$arResult["LEVEL"] = $level;
$level++;
} else {
$arResult["PREFIX"] = str_repeat(" ", $level > 0 ? $level : 0);
$arResult["LEVEL"] = $level;
}
$r[] = $arResult;
}
return $r;
}
开发者ID:k-kalashnikov,项目名称:geekcon.local,代码行数:27,代码来源:trackingservice.php
示例20: _build_belongs
protected function _build_belongs($number = 0)
{
// Initial tabs
$tabs = str_repeat(TT, $number);
$prefix = 'o';
// Export array
$belongs = array();
foreach ($this->_foreigns as $db_column => $foreign) {
$alias = $this->_camelize($foreign['table']);
$belongs[$prefix . $alias] = array('model' => $alias, 'foreign_key' => $db_column);
}
ob_start();
var_export($belongs);
$html = ob_get_clean();
// Add return
$html = 'protected $_belongs_to = ' . $html;
// 'array (' to 'array('
$html = preg_replace('/array \\(/', 'array(', $html);
// Remove EOL from subarray start
$html = preg_replace('/=> \\n /', '=> ', $html);
// Replace ' ' with \t
$html = preg_replace('/ /', TT, $html);
// Add initial tabs
$html = preg_replace('/^(.*)$/m', $tabs . '$1', $html);
return $html . ';';
//echo '<pre>'.$html;
//die();
}
开发者ID:stecj,项目名称:sime,代码行数:28,代码来源:Scaffold.php
注:本文中的str_repeat函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论