• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP trim函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getInput

 protected function getInput()
 {
     if (!NNFrameworkFunctions::extensionInstalled('virtuemart')) {
         return '<fieldset class="alert alert-danger">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_FILES_NOT_FOUND', JText::_('NN_VIRTUEMART')) . '</fieldset>';
     }
     $this->params = $this->element->attributes();
     $this->db = JFactory::getDBO();
     $group = $this->get('group', 'categories');
     $tables = $this->db->getTableList();
     if (!in_array($this->db->getPrefix() . 'virtuemart_' . $group, $tables)) {
         return '<fieldset class="alert alert-danger">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_TABLE_NOT_FOUND', JText::_('NN_VIRTUEMART')) . '</fieldset>';
     }
     $parameters = NNParameters::getInstance();
     $params = $parameters->getPluginParams('nnframework');
     $this->max_list_count = $params->max_list_count;
     if (!is_array($this->value)) {
         $this->value = explode(',', $this->value);
     }
     $options = $this->{'get' . $group}();
     $size = (int) $this->get('size');
     $multiple = $this->get('multiple');
     if ($group == 'categories') {
         require_once JPATH_PLUGINS . '/system/nnframework/helpers/html.php';
         return nnHtml::selectlist($options, $this->name, $this->value, $this->id, $size, $multiple);
     }
     $attr = '';
     $attr .= ' size="' . (int) $size . '"';
     $attr .= $multiple ? ' multiple="multiple"' : '';
     return JHtml::_('select.genericlist', $options, $this->name, trim($attr), 'value', 'text', $this->value, $this->id);
 }
开发者ID:WineWorld,项目名称:joomlatrialcmbg,代码行数:30,代码来源:virtuemart.php


示例2: _getSearchParam

 /**
  * Retrieve filter array
  *
  * @param Enterprise_Search_Model_Resource_Collection $collection
  * @param Mage_Catalog_Model_Resource_Eav_Attribute $attribute
  * @param string|array $value
  * @return array
  */
 protected function _getSearchParam($collection, $attribute, $value)
 {
     if (!is_string($value) && empty($value) || is_string($value) && strlen(trim($value)) == 0 || is_array($value) && isset($value['from']) && empty($value['from']) && isset($value['to']) && empty($value['to'])) {
         return array();
     }
     if (!is_array($value)) {
         $value = array($value);
     }
     $field = Mage::getResourceSingleton('enterprise_search/engine')->getSearchEngineFieldName($attribute, 'nav');
     if ($attribute->getBackendType() == 'datetime') {
         $format = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
         foreach ($value as &$val) {
             if (!is_empty_date($val)) {
                 $date = new Zend_Date($val, $format);
                 $val = $date->toString(Zend_Date::ISO_8601) . 'Z';
             }
         }
         unset($val);
     }
     if (empty($value)) {
         return array();
     } else {
         return array($field => $value);
     }
 }
开发者ID:hientruong90,项目名称:ee_14_installer,代码行数:33,代码来源:Advanced.php


示例3: getSwarmUAIndex

 /** @return object */
 public static function getSwarmUAIndex()
 {
     // Lazy-init and cache
     if (self::$swarmUaIndex === null) {
         global $swarmInstallDir;
         // Convert from array with string values
         // to an object with boolean values
         $swarmUaIndex = new stdClass();
         $rawIndex = parse_ini_file("{$swarmInstallDir}/config/useragents.ini", true);
         foreach ($rawIndex as $uaID => $uaItem) {
             if (is_array($uaItem)) {
                 $uaItem2 = $uaItem;
                 foreach ($uaItem2 as $uaDataKey => $uaDataVal) {
                     if ($uaDataKey !== "displaytitle" && $uaDataKey !== "displayicon") {
                         $uaItem[$uaDataKey] = (bool) trim($uaDataVal);
                     } else {
                         $uaItem[$uaDataKey] = trim($uaDataVal);
                     }
                 }
                 if (!isset($uaItem["displaytitle"]) || !$uaItem["displaytitle"]) {
                     throw new SwarmException("User agent `{$uaID}` is missing a displaytitle property.");
                 }
                 if (!isset($uaItem["displayicon"]) || !$uaItem["displayicon"]) {
                     throw new SwarmException("User agent `{$uaID}` is missing a displayicon property.");
                 }
                 $swarmUaIndex->{$uaID} = (object) $uaItem;
             }
         }
         self::$swarmUaIndex = $swarmUaIndex;
     }
     return self::$swarmUaIndex;
 }
开发者ID:appendto,项目名称:testswarm,代码行数:33,代码来源:BrowserInfo.php


示例4: moduleValidateConfiguration

/**	
 * Performs payment module specific configuration validation
 * 
 * @param string &$errorMessage			- error message when return result is not true
 * 
 * @return bool 						- true if configuration is valid, false otherwise
 * 
 * 
 */
function moduleValidateConfiguration(&$errorMessage)
{
    global $providerConf;
    $commomResult = commonValidateConfiguration($errorMessage);
    if (!$commomResult) {
        return false;
    }
    if (strlen(trim($providerConf['Param_sid'])) == 0) {
        $errorMessage = '\'Account number\' field is empty';
        return false;
    }
    if (!in_array($providerConf['Param_pay_method'], array('CC', 'CK'))) {
        $errorMessage = '\'Pay method\' field has incorrect value';
        return false;
    }
    if (strlen(trim($providerConf['Param_secret_word'])) == 0) {
        $errorMessage = '\'Secret word\' field is empty';
        return false;
    }
    if (strlen(trim($providerConf['Param_secret_word'])) > 16 || strpos($providerConf['Param_secret_word'], ' ') !== false) {
        $errorMessage = '\'Secret word\' field has incorrect value';
        return false;
    }
    return true;
}
开发者ID:BackupTheBerlios,项目名称:dolphin-dwbn-svn,代码行数:34,代码来源:2checkoutv2.php


示例5: apply

 /**
  * {@inheritdoc}
  */
 public function apply(DataSourceInterface $dataSource, $name, $data, array $options)
 {
     $expressionBuilder = $dataSource->getExpressionBuilder();
     if (is_array($data) && !isset($data['type'])) {
         $data['type'] = isset($options['type']) ? $options['type'] : self::TYPE_CONTAINS;
     }
     if (!is_array($data)) {
         $data = ['type' => self::TYPE_CONTAINS, 'value' => $data];
     }
     $fields = array_key_exists('fields', $options) ? $options['fields'] : [$name];
     $type = $data['type'];
     $value = array_key_exists('value', $data) ? $data['value'] : null;
     if (!in_array($type, [self::TYPE_NOT_EMPTY, self::TYPE_EMPTY], true) && '' === trim($value)) {
         return;
     }
     if (1 === count($fields)) {
         $dataSource->restrict($this->getExpression($expressionBuilder, $type, current($fields), $value));
         return;
     }
     $expressions = [];
     foreach ($fields as $field) {
         $expressions[] = $this->getExpression($expressionBuilder, $type, $field, $value);
     }
     $dataSource->restrict($expressionBuilder->orX(...$expressions));
 }
开发者ID:sylius,项目名称:grid,代码行数:28,代码来源:StringFilter.php


示例6: getstr

function getstr($string, $length, $in_slashes = 0, $out_slashes = 0, $bbcode = 0, $html = 0)
{
    global $_G;
    $string = trim($string);
    $sppos = strpos($string, chr(0) . chr(0) . chr(0));
    if ($sppos !== false) {
        $string = substr($string, 0, $sppos);
    }
    if ($in_slashes) {
        $string = dstripslashes($string);
    }
    $string = preg_replace("/\\[hide=?\\d*\\](.*?)\\[\\/hide\\]/is", '', $string);
    if ($html < 0) {
        $string = preg_replace("/(\\<[^\\<]*\\>|\r|\n|\\s|\\[.+?\\])/is", ' ', $string);
    } elseif ($html == 0) {
        $string = dhtmlspecialchars($string);
    }
    if ($length) {
        $string = cutstr($string, $length);
    }
    if ($bbcode) {
        require_once DISCUZ_ROOT . './source/class/class_bbcode.php';
        $bb =& bbcode::instance();
        $string = $bb->bbcode2html($string, $bbcode);
    }
    if ($out_slashes) {
        $string = daddslashes($string);
    }
    return trim($string);
}
开发者ID:upyun,项目名称:discuz-plugin,代码行数:30,代码来源:function_home.php


示例7: setUp

 public function setUp(PDO $pdo, $sql)
 {
     $sql = explode(';', trim($sql));
     foreach ($sql as $query) {
         $pdo->exec(trim($query));
     }
 }
开发者ID:krajewskis,项目名称:ppdo,代码行数:7,代码来源:AbstractQueryTest.php


示例8: preUpload

 /**
  * @ORM\PreFlush()
  */
 public function preUpload()
 {
     if ($this->file) {
         if ($this->file instanceof FileUpload) {
             $basename = $this->file->getSanitizedName();
             $basename = $this->suggestName($this->getFilePath(), $basename);
             $this->setName($basename);
         } else {
             $basename = trim(Strings::webalize($this->file->getBasename(), '.', FALSE), '.-');
             $basename = $this->suggestName(dirname($this->file->getPathname()), $basename);
             $this->setName($basename);
         }
         if ($this->_oldPath && $this->_oldPath !== $this->path) {
             @unlink($this->getFilePathBy($this->_oldProtected, $this->_oldPath));
         }
         if ($this->file instanceof FileUpload) {
             $this->file->move($this->getFilePath());
         } else {
             copy($this->file->getPathname(), $this->getFilePath());
         }
         return $this->file = NULL;
     }
     if (($this->_oldPath || $this->_oldProtected !== NULL) && ($this->_oldPath != $this->path || $this->_oldProtected != $this->protected)) {
         $oldFilePath = $this->getFilePathBy($this->_oldProtected !== NULL ? $this->_oldProtected : $this->protected, $this->_oldPath ?: $this->path);
         if (file_exists($oldFilePath)) {
             rename($oldFilePath, $this->getFilePath());
         }
     }
 }
开发者ID:svobodni,项目名称:web,代码行数:32,代码来源:FileEntity.php


示例9: pointorder_listOp

 /**
  * 积分兑换列表
  */
 public function pointorder_listOp()
 {
     $model_pointorder = Model('pointorder');
     //获取兑换订单状态
     $pointorderstate_arr = $model_pointorder->getPointOrderStateBySign();
     $where = array();
     //兑换单号
     $pordersn = trim($_GET['pordersn']);
     if ($pordersn) {
         $where['point_ordersn'] = array('like', "%{$pordersn}%");
     }
     //兑换会员名称
     $pbuyname = trim($_GET['pbuyname']);
     if (trim($_GET['pbuyname'])) {
         $where['point_buyername'] = array('like', "%{$pbuyname}%");
     }
     //订单状态
     if (trim($_GET['porderstate'])) {
         $where['point_orderstate'] = $pointorderstate_arr[$_GET['porderstate']][0];
     }
     //查询兑换订单列表
     $order_list = $model_pointorder->getPointOrderList($where, '*', 10, 0, 'point_orderid desc');
     //信息输出
     Tpl::output('pointorderstate_arr', $pointorderstate_arr);
     Tpl::output('order_list', $order_list);
     Tpl::output('show_page', $model_pointorder->showpage());
     Tpl::showpage('pointorder.list');
 }
开发者ID:dotku,项目名称:shopnc_cnnewyork,代码行数:31,代码来源:pointorder.php


示例10: PMA_getUploadStatus

/**
 * Returns upload status.
 *
 * This is implementation for uploadprogress extension.
 */
function PMA_getUploadStatus($id)
{
    global $SESSION_KEY;
    global $ID_KEY;
    if (trim($id) == "") {
        return;
    }
    if (!array_key_exists($id, $_SESSION[$SESSION_KEY])) {
        $_SESSION[$SESSION_KEY][$id] = array('id' => $id, 'finished' => false, 'percent' => 0, 'total' => 0, 'complete' => 0, 'plugin' => $ID_KEY);
    }
    $ret = $_SESSION[$SESSION_KEY][$id];
    if (!PMA_import_uploadprogressCheck() || $ret['finished']) {
        return $ret;
    }
    $status = uploadprogress_get_info($id);
    if ($status) {
        if ($status['bytes_uploaded'] == $status['bytes_total']) {
            $ret['finished'] = true;
        } else {
            $ret['finished'] = false;
        }
        $ret['total'] = $status['bytes_total'];
        $ret['complete'] = $status['bytes_uploaded'];
        if ($ret['total'] > 0) {
            $ret['percent'] = $ret['complete'] / $ret['total'] * 100;
        }
    } else {
        $ret = array('id' => $id, 'finished' => true, 'percent' => 100, 'total' => $ret['total'], 'complete' => $ret['total'], 'plugin' => $ID_KEY);
    }
    $_SESSION[$SESSION_KEY][$id] = $ret;
    return $ret;
}
开发者ID:dingdong2310,项目名称:g5_theme,代码行数:37,代码来源:uploadprogress.php


示例11: __construct

 public function __construct()
 {
     // if the route isn't specified, use the index controller
     $this->route = isset($_GET['route']) ? htmlspecialchars($_GET['route']) : 'index';
     $this->route = trim($this->route, '/');
     // remove trailing slashes
 }
开发者ID:jmdeldin,项目名称:missoulaadoptables,代码行数:7,代码来源:Router.php


示例12: updateNotice

 public function updateNotice($data = array())
 {
     $update = array('TITLE' => trim($data['TITLE']), 'CONTENT' => json_encode($data['CONTENT']), 'START_DATE' => trim($data['START_DATE']), 'END_DATE' => trim($data['END_DATE']), 'IS_SHOW' => trim($data['IS_SHOW']), 'UPDATE_DATE' => date('Y-m-d H:i:s'));
     $wheres = array('NOTICE_ID' => $data['NOTICE_ID']);
     $this->db->where($wheres)->update('notices', $update);
     return true;
 }
开发者ID:letmefly,项目名称:tools_script,代码行数:7,代码来源:notice_data.php


示例13: ghost_command

 public static function ghost_command($nick, $ircdata = array())
 {
     $unick = $ircdata[0];
     $password = $ircdata[1];
     // get the parameters.
     if (trim($unick) == '' || trim($password) == '') {
         services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_INVALID_SYNTAX_RE, array('help' => 'GHOST'));
         return false;
     }
     // invalid syntax
     if (!isset(core::$nicks[$unick])) {
         services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_NOT_IN_USE, array('nick' => $unick));
         return false;
         // nickname isn't in use
     }
     if ($user = services::user_exists($unick, false, array('display', 'pass', 'salt'))) {
         if ($user->pass == sha1($password . $user->salt) || core::$nicks[$nick]['ircop'] && services::user_exists($nick, true, array('display', 'identified')) !== false) {
             ircd::kill(core::$config->nickserv->nick, $unick, 'GHOST command used by ' . core::get_full_hostname($nick));
             core::alog(core::$config->nickserv->nick . ': GHOST command used on ' . $unick . ' by ' . core::get_full_hostname($nick));
         } else {
             services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_INVALID_PASSWORD);
             // password isn't correct
         }
     } else {
         services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_ISNT_REGISTERED, array('nick' => $unick));
         return false;
         // doesn't even exist..
     }
 }
开发者ID:rickihastings,项目名称:acorairc,代码行数:29,代码来源:ghost.ns.php


示例14: process

 function process($controller)
 {
     $this->_prepareFilter($controller);
     $ret = array();
     if (isset($controller->request->data)) {
         //Loop for models
         foreach ($controller->request->data as $key => $value) {
             if (isset($controller->{$key})) {
                 $columns = $controller->{$key}->getColumnTypes();
                 foreach ($value as $k => $v) {
                     if ($v != '') {
                         //Trim the value
                         $v = trim($v);
                         //Check if there are some fieldFormatting set
                         if (isset($this->fieldFormatting[$columns[$k]])) {
                             $ret[sprintf($this->fieldFormatting[$columns[$k]][0], $key . '.' . $k, $v)] = sprintf($this->fieldFormatting[$columns[$k]][1], $key . '.' . $k, $v);
                         } else {
                             $ret[$key . '.' . $k] = $v;
                         }
                     }
                 }
                 //unsetting the empty forms
                 if (count($value) == 0) {
                     unset($controller->data[$key]);
                 }
             }
         }
     }
     return $ret;
 }
开发者ID:baoyu430,项目名称:engaged,代码行数:30,代码来源:FilterComponent.php


示例15: validateString

 /**
  * validate a string
  *
  * @param mixed $str the value to evaluate as a string
  *
  * @throws \InvalidArgumentException if the submitted data can not be converted to string
  *
  * @return string
  */
 protected function validateString($str)
 {
     if (is_object($str) && method_exists($str, '__toString') || is_string($str)) {
         return trim($str);
     }
     throw new InvalidArgumentException('The data received is not OR can not be converted into a string');
 }
开发者ID:KorvinSzanto,项目名称:uri,代码行数:16,代码来源:ImmutableComponentTrait.php


示例16: installLanguage2

 function installLanguage2($f, $l, $m)
 {
     global $php;
     $patt = '/^([A-Z0-9_]+)[\\s]{0,}=[\\s]{0,}[\'"](.*)[\'"];$/';
     foreach (file($f) as $item) {
         $item = trim($item);
         if ($item != '') {
             if (preg_match($patt, $item, $match)) {
                 if (isset($php[$match[1]])) {
                     $php[$match[1]][$l] = addslashes($match[2]);
                 } else {
                     $save = array();
                     if (preg_match('/^[0-9]+$/', $value)) {
                         $save['type'] = 'int';
                     } else {
                         $save['type'] = 'text';
                     }
                     $save['key'] = $match[1];
                     $save['owner'] = $m;
                     $save[$l] = addslashes($match[2]);
                     $save['js'] = 1;
                     $php[$match[1]] = $save;
                 }
             }
         }
     }
 }
开发者ID:phannack,项目名称:GCMS,代码行数:27,代码来源:langtool.php


示例17: get_dependencies

 private function get_dependencies()
 {
     preg_match_all('/#dependency (.*)/', $this->output, $dependencies);
     foreach ($dependencies[1] as $dependency) {
         $this->dependencies[] = trim($dependency);
     }
 }
开发者ID:holsinger,项目名称:openfloor,代码行数:7,代码来源:Dependencies.php


示例18: getPublicKeyFromServer

 function getPublicKeyFromServer($server, $email)
 {
     /* refactor to 
     		$command = "gpg --keyserver ".escapeshellarg($server)." --search-keys ".escapeshellarg($email)."";
     		echo "$command\n\n";
     		
     		//execute the gnupg command
     		exec($command, $result);
     		*/
     $curl = new curl();
     // get Fingerprint
     $data = $curl->get("http://" . $server . ":11371/pks/lookup?search=" . urlencode($email) . "&op=index&fingerprint=on&exact=on");
     $data = $data['FILE'];
     preg_match_all("/<pre>([\\s\\S]*?)<\\/pre>/", $data, $matches);
     //$pub = $matches[1][1];
     preg_match_all("/<a href=\"(.*?)\">(\\w*)<\\/a>/", $matches[1][1], $matches);
     $url = $matches[1][0];
     $keyID = $matches[2][0];
     // get Public Key
     $data = $curl->get("http://" . $server . ":11371" . $url);
     $data = $data['FILE'];
     preg_match_all("/<pre>([\\s\\S]*?)<\\/pre>/", $data, $matches);
     $pub_key = trim($matches[1][0]);
     return array("keyID" => $keyID, "public_key" => $pub_key);
 }
开发者ID:baki250,项目名称:angular-io-app,代码行数:25,代码来源:class.pgp.php


示例19: doDisplay

 protected function doDisplay(array $context, array $blocks = array())
 {
     $__internal_2fff3160042f23d812f76a57f2d794df9c0021a111c64efc06751bf3f7b16428 = $this->env->getExtension("native_profiler");
     $__internal_2fff3160042f23d812f76a57f2d794df9c0021a111c64efc06751bf3f7b16428->enter($__internal_2fff3160042f23d812f76a57f2d794df9c0021a111c64efc06751bf3f7b16428_prof = new Twig_Profiler_Profile($this->getTemplateName(), "template", "TwigBundle:Exception:traces_text.html.twig"));
     // line 1
     echo "<div class=\"block\">\n    <h2>\n        Stack Trace (Plain Text)&nbsp;\n        ";
     // line 4
     ob_start();
     // line 5
     echo "        <a href=\"#\" onclick=\"toggle('traces-text'); switchIcons('icon-traces-text-open', 'icon-traces-text-close'); return false;\">\n            <img class=\"toggle\" id=\"icon-traces-text-close\" alt=\"-\" src=\"data:image/gif;base64,R0lGODlhEgASAMQSANft94TG57Hb8GS44ez1+mC24IvK6ePx+Wa44dXs92+942e54o3L6W2844/M6dnu+P/+/l614P///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAABIALAAAAAASABIAQAVCoCQBTBOd6Kk4gJhGBCTPxysJb44K0qD/ER/wlxjmisZkMqBEBW5NHrMZmVKvv9hMVsO+hE0EoNAstEYGxG9heIhCADs=\" style=\"display: none\" />\n            <img class=\"toggle\" id=\"icon-traces-text-open\" alt=\"+\" src=\"data:image/gif;base64,R0lGODlhEgASAMQTANft99/v+Ga44bHb8ITG52S44dXs9+z1+uPx+YvK6WC24G+944/M6W28443L6dnu+Ge54v/+/l614P///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAABMALAAAAAASABIAQAVS4DQBTiOd6LkwgJgeUSzHSDoNaZ4PU6FLgYBA5/vFID/DbylRGiNIZu74I0h1hNsVxbNuUV4d9SsZM2EzWe1qThVzwWFOAFCQFa1RQq6DJB4iIQA7\" style=\"display: inline\" />\n        </a>\n        ";
     echo trim(preg_replace('/>\\s+</', '><', ob_get_clean()));
     // line 10
     echo "    </h2>\n\n    <div id=\"traces-text\" class=\"trace\" style=\"display: none;\">\n<pre>";
     // line 13
     $context['_parent'] = $context;
     $context['_seq'] = twig_ensure_traversable($this->getAttribute(isset($context["exception"]) ? $context["exception"] : $this->getContext($context, "exception"), "toarray", array()));
     foreach ($context['_seq'] as $context["i"] => $context["e"]) {
         // line 14
         echo "[";
         echo twig_escape_filter($this->env, $context["i"] + 1, "html", null, true);
         echo "] ";
         echo twig_escape_filter($this->env, $this->getAttribute($context["e"], "class", array()), "html", null, true);
         echo ": ";
         echo twig_escape_filter($this->env, $this->getAttribute($context["e"], "message", array()), "html", null, true);
         echo "\n";
         // line 15
         $this->loadTemplate("TwigBundle:Exception:traces.txt.twig", "TwigBundle:Exception:traces_text.html.twig", 15)->display(array("exception" => $context["e"]));
     }
     $_parent = $context['_parent'];
     unset($context['_seq'], $context['_iterated'], $context['i'], $context['e'], $context['_parent'], $context['loop']);
     $context = array_intersect_key($context, $_parent) + $_parent;
     // line 16
     echo "</pre>\n    </div>\n</div>\n";
     $__internal_2fff3160042f23d812f76a57f2d794df9c0021a111c64efc06751bf3f7b16428->leave($__internal_2fff3160042f23d812f76a57f2d794df9c0021a111c64efc06751bf3f7b16428_prof);
 }
开发者ID:antoinelanglet,项目名称:fortunes,代码行数:35,代码来源:c622f4449f839eae30100749d9028fed193e36649fffa3d6c16afda960015daa.php


示例20: index

 function index()
 {
     $path = \GCore\C::get('GCORE_ADMIN_PATH') . 'extensions' . DS . 'chronoforms' . DS;
     $files = \GCore\Libs\Folder::getFiles($path, true);
     $strings = array();
     //function to prepare strings
     $prepare = function ($str) {
         /*$path = \GCore\C::get('GCORE_FRONT_PATH');
         		if(strpos($str, $path) !== false AND strpos($str, $path) == 0){
         			return '//'.str_replace($path, '', $str);
         		}*/
         $val = !empty(\GCore\Libs\Lang::$translations[$str]) ? \GCore\Libs\Lang::$translations[$str] : '';
         return 'const ' . trim($str) . ' = "' . str_replace("\n", '\\n', $val) . '";';
     };
     foreach ($files as $file) {
         if (substr($file, -4, 4) == '.php') {
             // AND strpos($file, DS.'extensions'.DS) === TRUE){
             //$strings[] = $file;
             $file_code = file_get_contents($file);
             preg_match_all('/l_\\(("|\')([^(\\))]*?)("|\')\\)/i', $file_code, $langs);
             if (!empty($langs[2])) {
                 $strings = array_merge($strings, $langs[2]);
             }
         }
     }
     $strings = array_unique($strings);
     $strings = array_map($prepare, $strings);
     echo '<textarea rows="20" cols="80">' . implode("\n", $strings) . '</textarea>';
 }
开发者ID:ejailesb,项目名称:repo_empr,代码行数:29,代码来源:langs.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP trimAll函数代码示例发布时间:2022-05-23
下一篇:
PHP trigger_value2str函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap