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


PHP indent函数代码示例

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


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

示例1: append_configs

function append_configs($conf_arr, $system_arr)
{
    //准备配置数据
    $setings_str = '';
    foreach ($conf_arr as $key => $item) {
        $setings_str .= "var {$key} = " . indent(json_encode($item)) . ";\n\n";
    }
    $system_str = 'var system = ' . indent(json_encode($system_arr)) . ";\n\n";
    //查找模板
    $append_arr = [];
    foreach (glob(__DIR__ . '/modules/*_template.js') as $filename) {
        if (!preg_match('~/modules/(\\w+)_template\\.js$~', $filename, $matches)) {
            continue;
        }
        $base_name = $matches[1];
        $append_arr[] = [$filename, __DIR__ . '/' . $base_name . '.js'];
    }
    //替换模板中的标签
    foreach ($append_arr as $item) {
        $src_settings_js = $item[0];
        $settings_js = $item[1];
        $src_settings_content = file_get_contents($src_settings_js);
        $new_content = preg_replace('/\\/\\*CONFIGS_POSITION\\*\\//i', $setings_str, $src_settings_content);
        $new_content = preg_replace('/\\/\\*SYSTEM_CONFIGS\\*\\//i', $system_str, $new_content);
        file_put_contents($settings_js, $new_content);
    }
}
开发者ID:sdgdsffdsfff,项目名称:html-sensor,代码行数:27,代码来源:event.php

示例2: genSelect

/**
 * 生成select下拉框
 * @param  string $name    下拉框的name
 * @param  array  $list    下拉框的可选项
 * @param  int    $seleced 默认项
 * @param  string $class   css类
 * @return string
 */
function genSelect($name, array $list, $selected = 0, $class = '')
{
    $html = "<select name='{$name}' class='{$class}'>";
    $i = 0;
    foreach ($list as $text => $value) {
        $html .= indent() . "<option value='{$value}' ";
        if ($i == $selected) {
            $html .= " selected='selected' ";
        }
        $html .= ">{$text}</option>";
        $i++;
    }
    $html .= "</select>";
    return $html;
}
开发者ID:def1984,项目名称:genedealer,代码行数:23,代码来源:helper.php

示例3: convert_xml

function convert_xml($file)
{
    ($old = simplexml_load_file($file)) || die("Unable to Load MIDI XML File: {$file}\n");
    // Create the file with default values
    $new = simplexml_load_string("<MixxxMIDIPreset schemaVersion=\"1\" mixxxVersion=\"1.7.0+\">\n      <info>\n        <name>{$file}</name>\n        <author>Auto-converted by madjesta's PHP script</author>\n        <description>Auto-conversion of the file {$file}</description>\n      </info>\n      <controller id=\"" . fileToControllerName($file) . "\" port=\"\">\n      </controller>\n    </MixxxMIDIPreset>\n    ");
    // Add Controls to Controller Node
    $controls = $new->controller->addChild("controls");
    // get the control children
    $oldControls = $old->children();
    // Here we perfom the actual conversion and moving of the values to the
    // new file.
    foreach ($oldControls->children() as $oldControl) {
        $control = $controls->addChild("control");
        foreach ($oldControl->children() as $k => $v) {
            if ($k == "options") {
                $options = $control->addChild("options");
                foreach ($v as $ko => $vo) {
                    $options->addChild($ko, $vo);
                }
                continue;
            }
            if (($k == "midino" || $k == "midichan") && !preg_match('/0x\\d*/', $v)) {
                $v = sprintf("0x%02x", (int) $v);
            }
            $control->addChild($k, $v);
        }
    }
    if (isset($old->lights)) {
        // Add outputs to the new XML file
        $outputs = $new->controller->addChild("outputs");
        $lights = $old->lights->children();
        foreach ($lights as $light) {
            $output = $outputs->addChild("output");
            foreach ($light as $k => $v) {
                $output->addChild($k, $v);
            }
        }
    }
    return indent($new);
}
开发者ID:nola-radar,项目名称:mixxx,代码行数:40,代码来源:convertToXMLSchemaV1.php

示例4: run_files

function run_files($file)
{
    if (is_link($file)) {
        return;
    }
    if (is_dir($file . '/.')) {
        $dh = opendir($file);
        $files = array();
        while (false !== ($f = readdir($dh))) {
            if ($f[0] != '.') {
                $files[] = $file . '/' . $f;
            }
        }
        closedir($dh);
        foreach ($files as $f) {
            run_files($f);
        }
    } else {
        if (preg_match('/\\.php$/', $file)) {
            indent($file);
        }
    }
}
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:23,代码来源:batch_indent.php

示例5: mysql_connect

$dbnaam = "koffientnl";
$fout = "fout: openen database is mislukt";
$db = mysql_connect($host, $username, $password) or die($fout);
mysql_select_db($dbnaam, $db) or die($fout);
//query voor het ophalen van de gegevens uit de mysql server
$query = mysql_query('SELECT * FROM `plukroute`');
//opbouwen begin van de json
$json = '{ "type":"ok",';
//Dit geeft aan of er eventueel een fout zit in de gegevens van de json, op dit moment niet dynamisch
$json = $json . '"fotos": [';
//hierin worden de foto objecten genest
$i = 0;
while ($row = mysql_fetch_assoc($query)) {
    if ($i != 0) {
        $json = $json . ",";
        //na de eerste keer wordt er een komma geplaatst voor het object
    } else {
        $i = 1;
        //eerste keer de komma overslaan
    }
    $json = $json . '{';
    $json = $json . '"name":"' . 'http://www.koffient.nl/plukroute/image/' . $row['name'] . '.jpeg",';
    $json = $json . '"id":"' . $row['id'] . '",';
    $json = $json . '"longitude":"' . $row['longitude'] . '",';
    $json = $json . '"latitude":"' . $row['latitude'] . '",';
    $json = $json . '"soort":"' . $row['soort'] . '"}';
}
$json = $json . ']}';
//afsluiting van de json
echo indent($json);
开发者ID:eeeric,项目名称:plukroutegit,代码行数:30,代码来源:pics.php

示例6: stringify

function stringify($response, $format)
{
    if ($format == "xml") {
        @header('Content-type: application/xml');
        return XMLSerializer::generateValidXmlFromArray($response);
    } else {
        @header('Content-type: application/json');
        return indent(json_encode($response));
    }
}
开发者ID:khanab85,项目名称:NabliRecommender,代码行数:10,代码来源:index.php

示例7: foreach

							<tr>
								<td align="right">Identifier:</td>
								<td><input type="text" name="identifier" value="<?php 
        print $account->identifier;
        ?>
" /></td>

							</tr>
							<tr>
								<td align="right" valign="top">Contact:</td>
								<td>
									<select name="contactid">
<?php 
        $contact->rebuild_cache();
        foreach ($contact->contacts as $contactid => $name) {
            print indent(10) . '<option value="' . $contactid . '"';
            if ($contactid == $account->contactid) {
                print ' selected="selected"';
            }
            print '>' . $name . '</option>' . "\n";
        }
        ?>
									</select>
								</td>
							</tr>
							<tr>
								<td><a href="manage.php?what=account&type=overview&accountid=<?php 
        print $account->accountid;
        ?>
">Cancel</a></td>
								<td align="right"><input type="submit" value=" Save &raquo; " /></td>
开发者ID:carriercomm,项目名称:billing-automation,代码行数:31,代码来源:edit.php

示例8: export_property

function export_property($ret)
{
    if (!is_array($ret)) {
        return var_export($ret, true);
    }
    $code = '';
    foreach ($ret as $key => $value) {
        $code .= var_export($key, true) . ' => ' . export_property($value) . ",\n";
    }
    return "array(\n" . indent($code) . ")";
}
开发者ID:adridev,项目名称:php-amqplib,代码行数:11,代码来源:parser.php

示例9: array

                        } else {
                            $sortdirection = "desc";
                        }
                        $sort = array($_GET['sort-by'] => array("order" => $sortdirection));
                        //order by clause
                        $query->setSort($sort);
                    }
                    $query->setFrom($_GET['from'])->setLimit($_GET['size']);
                    if (isset($_GET['debug'])) {
                        echo '<pre>';
                        print_r($query);
                        echo '</pre>';
                    }
                    // Configure and execute the search
                    // Create the search object and inject the client
                    $resultSet = $searchThrough->search($query);
                    $data = array();
                    foreach ($resultSet as $result) {
                        $itemdata = $result->getData();
                        $itemdata['id'] = $result->getId();
                        $data[] = $itemdata;
                    }
                    $response = array();
                    $response['data'] = $data;
                    $response['total'] = $resultSet->getTotalHits();
                }
                break;
        }
        echo indent(json_encode($response));
    }
}
开发者ID:spicymaya,项目名称:news-app,代码行数:31,代码来源:esSetup.php

示例10: get_indents_for_variables

if (!isset($page_variables['layout'])) {
    $htmlwarrior->layout = 'default';
} else {
    $htmlwarrior->layout = $page_variables['layout'];
}
// Get full layout path
$layout_path = $htmlwarrior->config['basepath'] . '/' . $htmlwarrior->runtime['site_dir'] . $htmlwarrior->config["path_templates_layouts"] . '/' . $htmlwarrior->layout . '.tpl';
// Get all variables indents so we can indent the content right
// We're after the $yield variable indent now
$variable_indents = get_indents_for_variables(file_get_contents($layout_path));
// set variables
// should these be added to layout template object (which we don't have yet)
foreach ($page_variables as $key => $var) {
    $smarty->assign($key, $var);
}
$yield = indent(remove_variables($page_content), $variable_indents['yield']);
$yield = ltrim($yield);
$smarty->assign('yield', $yield);
unset($yield);
// add access log; must be after frontpage so we don't log that
if ($htmlwarrior->config['log']) {
    add_access_log(array('site_dir' => $htmlwarrior->runtime['site_dir'], 'url' => $_SERVER['REQUEST_URI']));
}
//require_once('filelist.php');
ob_start('callback');
if ($page_variables['layout'] === false) {
    $layout_path = $htmlwarrior->config['code_path'] . $htmlwarrior->config['path_templates_layouts'] . '/' . 'empty.tpl';
}
$smarty->display($layout_path);
$htmlwarrior->config['devmode'] = false;
$content = $smarty->fetch($layout_path);
开发者ID:hkirsman,项目名称:html-warrior,代码行数:31,代码来源:index.php

示例11: _PHP_FUNC_htmlblock

function _PHP_FUNC_htmlblock($obj)
{
    $name = _LISP_get_string($obj, 1, 1);
    $params = $obj[2];
    $ret = "<{$name}";
    $have_line_breaks = false;
    foreach ($params as $param) {
        $thename[] = $tmp1 = substr($param[0], 4);
        $namelen = max($namelen, strlen($tmp1));
        $thevalue[] = $tmp = htmlspecialchars(substr(_LISP_evalobject($param[1]), 4));
        if (strstr($tmp, chr(10))) {
            $have_line_breaks = true;
        }
    }
    if ($have_line_breaks) {
        $paramindent = strlen($ret);
        for ($item = 0; $item < sizeof($thename); $item++) {
            if ($item != 0) {
                $ret .= "\n" . str_repeat(' ', $paramindent);
            }
            $ret .= ' ' . str_pad($thename[$item], $namelen + 1) . "= \"";
            if (strstr($thevalue[$item], chr(10))) {
                $the_indent = last_line_length($ret);
                $valuelinestmp = split("\n", $thevalue[$item]);
                foreach ($valuelinestmp as $valueline) {
                    if ($valueline != ' ') {
                        $valuelines[] = $valueline;
                    }
                }
                $ret .= $valuelines[0] . "\n";
                // first line just goes on..
                for ($i = 1; $i < sizeof($valuelines); $i++) {
                    if ($valuelines[$i] != '') {
                        $ret .= str_repeat(' ', $the_indent) . $valuelines[$i];
                        if ($i < sizeof($valuelines) - 1) {
                            $ret .= "\n";
                        }
                    }
                }
                $ret .= "\"";
            } else {
                $ret .= "{$thevalue[$item]}\"";
            }
        }
        $ret .= ">";
    } else {
        for ($item = 0; $item < sizeof($thename); $item++) {
            $ret .= " {$thename[$item]}=\"{$thevalue[$item]}\"";
        }
        $ret .= ">";
    }
    for ($i = 3; $i < sizeof($obj); $i++) {
        $block .= _LISP_princ(_LISP_evalobject($obj[$i]));
        if ($i < sizeof($obj) - 1) {
            $block .= "\n";
        }
    }
    //$ret is now "<[tag] [params...]>\n"
    $outblock = indent($block);
    $ret .= "{$outblock}\n</{$name}>\n";
    return "str:{$ret}";
}
开发者ID:CharlieDancey,项目名称:THP,代码行数:62,代码来源:thp.php

示例12: expxml

 function expxml($filter = array(), $mailback = false, $translate = false)
 {
     global $ff_compath, $ff_version, $mosConfig_fileperms;
     jimport('joomla.version');
     $version = new JVersion();
     $_version = $version->getShortVersion();
     $tz = 'UTC';
     if (version_compare($_version, '3.2', '>=')) {
         $tz = new DateTimeZone(JFactory::getApplication()->getCfg('offset'));
     }
     if ($this->dying) {
         return '';
     }
     mt_srand();
     $xmlname = $ff_compath . '/exports/ffexport-' . date('YmdHis') . '-' . mt_rand(0, mt_getrandmax()) . '.xml';
     $xml = '<?xml version="1.0" encoding="utf-8" ?>' . nl() . '<FacileFormsExport type="records" version="' . $ff_version . '">' . nl() . indent(1) . '<exportdate>' . date('Y-m-d H:i:s') . '</exportdate>' . nl();
     if ($this->record_id != '') {
         $xml .= indent(1) . '<record id="' . $this->record_id . '">' . nl();
     } else {
         $xml .= indent(1) . '<record>' . nl();
     }
     $title_translated = $this->getFormTitleTranslated();
     $submitted = $this->submitted;
     if (version_compare($_version, '3.2', '>=')) {
         $date_ = JFactory::getDate($this->submitted, $tz);
         $submitted = $date_->format('Y-m-d H:i:s');
     }
     $xml .= indent(2) . '<submitted>' . $submitted . '</submitted>' . nl() . indent(2) . '<form>' . $this->form . '</form>' . nl() . indent(2) . '<title>' . htmlspecialchars($title_translated != '' ? $title_translated : $this->formrow->title, ENT_QUOTES, 'UTF-8') . '</title>' . nl() . indent(2) . '<name>' . $this->formrow->name . '</name>' . nl() . indent(2) . '<ip>' . $this->ip . '</ip>' . nl() . indent(2) . '<browser>' . htmlspecialchars($this->browser, ENT_QUOTES, 'UTF-8') . '</browser>' . nl() . indent(2) . '<opsys>' . htmlspecialchars($this->opsys, ENT_QUOTES, 'UTF-8') . '</opsys>' . nl() . indent(2) . '<provider>' . $this->provider . '</provider>' . nl() . indent(2) . '<viewed>0</viewed>' . nl() . indent(2) . '<exported>0</exported>' . nl() . indent(2) . '<archived>0</archived>' . nl();
     $processed = array();
     $xmldata = $this->xmldata;
     if ($mailback) {
         $xmldata = $this->mb_xmldata;
     }
     if (count($xmldata)) {
         foreach ($xmldata as $data) {
             if ($translate) {
                 $title_translated = '';
                 $this->getFieldTranslated('label', $data[_FF_DATA_NAME], $title_translated);
             }
             if (!in_array($data[_FF_DATA_NAME], $filter) && !in_array($data[_FF_DATA_NAME], $processed)) {
                 $xml .= indent(2) . '<subrecord>' . nl() . indent(3) . '<element>' . $data[_FF_DATA_ID] . '</element>' . nl() . indent(3) . '<name>' . $data[_FF_DATA_NAME] . '</name>' . nl() . indent(3) . '<title>' . htmlspecialchars($title_translated != '' ? $title_translated : $data[_FF_DATA_TITLE], ENT_QUOTES, 'UTF-8') . '</title>' . nl() . indent(3) . '<type>' . $data[_FF_DATA_TYPE] . '</type>' . nl() . indent(3) . '<value>' . htmlspecialchars(is_array($data[_FF_DATA_VALUE]) ? implode('|', $data[_FF_DATA_VALUE]) : $data[_FF_DATA_VALUE], ENT_QUOTES, 'UTF-8') . '</value>' . nl() . indent(2) . '</subrecord>' . nl();
                 //$processed[] = $data[_FF_DATA_NAME];
             }
         }
     }
     // foreach
     $xml .= indent(1) . '</record>' . nl() . '</FacileFormsExport>' . nl();
     JFile::makeSafe($xmlname);
     if (!JFile::write($xmlname, $xml)) {
         $this->status = _FF_STATUS_ATTACHMENT_FAILED;
     }
     // if
     return $xmlname;
 }
开发者ID:Ettore495,项目名称:Ettore-Work,代码行数:54,代码来源:facileforms.process.php

示例13: indent

/** recursive function to construct the role tree ui 
 * @param $hrarray -- Hierarchial role tree array with only the roleid:: Type array
 * @param $roleout -- html string ouput of the constucted role tree ui:: Type varchar 
 * @param $role_det -- Roledetails array got from calling getAllRoleDetails():: Type array 
 * @returns $role_out -- html string ouput of the constucted role tree ui:: Type string
 *
 */
function indent($hrarray, $roleout, $role_det)
{
    global $theme, $mod_strings, $app_strings;
    $theme_path = "themes/" . $theme . "/";
    $image_path = $theme_path . "images/";
    foreach ($hrarray as $roleid => $value) {
        //retreiving the vtiger_role details
        $role_det_arr = $role_det[$roleid];
        $roleid_arr = $role_det_arr[2];
        $rolename = $role_det_arr[0];
        $roledepth = $role_det_arr[1];
        $roleout .= '<ul class="uil" id="' . $roleid . '" style="display:block;list-style-type:none;">';
        $roleout .= '<li ><table border="0" cellpadding="0" cellspacing="0" onMouseOver="fnVisible(\'layer_' . $roleid . '\')" onMouseOut="fnInVisible(\'layer_' . $roleid . '\')">';
        $roleout .= '<tr><td nowrap>';
        if (sizeof($value) > 0 && $roledepth != 0) {
            $roleout .= '<b style="font-weight:bold;margin:0;padding:0;cursor:pointer;">';
            $roleout .= '<img src="' . vtiger_imageurl('minus.gif', $theme) . '" id="img_' . $roleid . '" border="0"  alt="' . $app_strings['LBL_EXPAND_COLLAPSE'] . '" title="' . $app_strings['LBL_EXPAND_COLLAPSE'] . '" align="absmiddle" onClick="showhide(\'' . $roleid_arr . '\',\'img_' . $roleid . '\')" style="cursor:pointer;">';
        } else {
            if ($roledepth != 0) {
                $roleout .= '<img src="' . vtiger_imageurl('vtigerDevDocs.gif', $theme) . '" id="img_' . $roleid . '" border="0"  alt="' . $app_strings['LBL_EXPAND_COLLAPSE'] . '" title="' . $app_strings['LBL_EXPAND_COLLAPSE'] . '" align="absmiddle">';
            } else {
                $roleout .= '<img src="' . vtiger_imageurl('menu_root.gif', $theme) . '" id="img_' . $roleid . '" border="0"  alt="' . $app_strings['LBL_ROOT'] . '" title="' . $app_strings['LBL_ROOT'] . '" align="absmiddle">';
            }
        }
        if ($roledepth == 0) {
            $roleout .= '&nbsp;<b class="genHeaderGray">' . $rolename . '</b></td>';
            $roleout .= '<td nowrap><div id="layer_' . $roleid . '" class="drag_Element"><a href="index.php?module=Settings&action=createrole&parenttab=Settings&parent=' . $roleid . '"><img src="' . vtiger_imageurl('Rolesadd.gif', $theme) . '" align="absmiddle" border="0" alt="' . $mod_strings['LBL_ADD_ROLE'] . '" title="' . $mod_strings['LBL_ADD_ROLE'] . '"></a></div></td></tr></table>';
        } else {
            $roleout .= '&nbsp;<a href="javascript:put_child_ID(\'user_' . $roleid . '\');" class="x" id="user_' . $roleid . '">' . $rolename . '</a></td>';
            $roleout .= '<td nowrap><div id="layer_' . $roleid . '" class="drag_Element">
													<a href="index.php?module=Settings&action=createrole&parenttab=Settings&parent=' . $roleid . '"><img src="' . vtiger_imageurl('Rolesadd.gif', $theme) . '" align="absmiddle" border="0" alt="' . $mod_strings['LBL_ADD_ROLE'] . '" title="' . $mod_strings['LBL_ADD_ROLE'] . '"></a>
													<a href="index.php?module=Settings&action=createrole&roleid=' . $roleid . '&parenttab=Settings&mode=edit"><img src="' . vtiger_imageurl('RolesEdit.gif', $theme) . '" align="absmiddle" border="0" alt="' . $mod_strings['LBL_EDIT_ROLE'] . '" title="' . $mod_strings['LBL_EDIT_ROLE'] . '"></a>';
            if ($roleid != 'H1' && $roleid != 'H2') {
                $roleout .= '<a href="index.php?module=Settings&action=RoleDeleteStep1&roleid=' . $roleid . '&parenttab=Settings"><img src="' . vtiger_imageurl('RolesDelete.gif', $theme) . '" align="absmiddle" border="0" alt="' . $mod_strings['LBL_DELETE_ROLE'] . '" title="' . $mod_strings['LBL_DELETE_ROLE'] . '"></a>';
            }
            $roleout .= '<a href="javascript:;" class="small" onClick="get_parent_ID(this,\'user_' . $roleid . '\')"><img src="' . vtiger_imageurl('RolesMove.gif', $theme) . '" align="absmiddle" border="0" alt="' . $mod_strings['LBL_MOVE_ROLE'] . '" title="' . $mod_strings['LBL_MOVE_ROLE'] . '"></a>
												</div></td></tr></table>';
            //			$roleout .=	'&nbsp;<a href="index.php?module=Users&action=createrole&parenttab=Settings&parent='.$roleid.'">Add</a> | <a href="index.php?module=Users&action=createrole&roleid='.$roleid.'&parenttab=Settings&mode=edit">Edit</a> | <a href="index.php?module=Users&action=RoleDeleteStep1&roleid='.$roleid.'&parenttab=Settings">Delete</a> | <a href="index.php?module=Users&action=RoleDetailView&parenttab=Settings&roleid='.$roleid.'">View</a>';
        }
        $roleout .= '</li>';
        if (sizeof($value) > 0) {
            $roleout = indent($value, $roleout, $role_det);
        }
        $roleout .= '</ul>';
    }
    return $roleout;
}
开发者ID:casati-dolibarr,项目名称:corebos,代码行数:54,代码来源:listroles.php

示例14: eloquent

 /**
  * Create a new response of JSON'd Eloquent models.
  *
  * <code>
  *		// Create a new response instance with Eloquent models
  *		return Response::eloquent($data, 200, array('header' => 'value'));
  * </code>
  *
  * @param  Eloquenet|array  $data
  * @param  int              $status
  * @param  array            $headers
  * @return Response
  */
 public static function eloquent($data, $status = 200, $headers = array())
 {
     $headers['Content-Type'] = 'application/json';
     return new static(indent(eloquent_to_json($data)), $status, $headers);
 }
开发者ID:reith2004,项目名称:domain,代码行数:18,代码来源:response.php

示例15: footer_

/**
 * Footer content
 * 
 * @return string
 * @author Jared Lang
 **/
function footer_($tabs = 2)
{
    ob_start();
    wp_footer();
    $html = ob_get_clean();
    return indent($html, $tabs);
}
开发者ID:rolandinsh,项目名称:Pegasus-Theme,代码行数:13,代码来源:base.php


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