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

PHP strlen函数代码示例

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

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



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

示例1: procesar

 function procesar()
 {
     toba::logger_ws()->debug('Servicio Llamado: ' . $this->info['basica']['item']);
     toba::logger_ws()->set_checkpoint();
     set_error_handler('toba_logger_ws::manejador_errores_recuperables', E_ALL);
     $this->validar_componente();
     //-- Pide los datos para construir el componente, WSF no soporta entregar objetos creados
     $clave = array();
     $clave['proyecto'] = $this->info['objetos'][0]['objeto_proyecto'];
     $clave['componente'] = $this->info['objetos'][0]['objeto'];
     list($tipo, $clase, $datos) = toba_constructor::get_runtime_clase_y_datos($clave, $this->info['objetos'][0]['clase'], false);
     agregar_dir_include_path(toba_dir() . '/php/3ros/wsf');
     $opciones_extension = toba_servicio_web::_get_opciones($this->info['basica']['item'], $clase);
     $wsdl = strpos($_SERVER['REQUEST_URI'], "?wsdl") !== false;
     $sufijo = 'op__';
     $metodos = array();
     $reflexion = new ReflectionClass($clase);
     foreach ($reflexion->getMethods() as $metodo) {
         if (strpos($metodo->name, $sufijo) === 0) {
             $servicio = substr($metodo->name, strlen($sufijo));
             $prefijo = $wsdl ? '' : '_';
             $metodos[$servicio] = $prefijo . $metodo->name;
         }
     }
     $opciones = array();
     $opciones['serviceName'] = $this->info['basica']['item'];
     $opciones['classes'][$clase]['operations'] = $metodos;
     $opciones = array_merge($opciones, $opciones_extension);
     $this->log->debug("Opciones del servidor: " . var_export($opciones, true), 'toba');
     $opciones['classes'][$clase]['args'] = array($datos);
     toba::logger_ws()->set_checkpoint();
     $service = new WSService($opciones);
     $service->reply();
     $this->log->debug("Fin de servicio web", 'toba');
 }
开发者ID:emma5021,项目名称:toba,代码行数:35,代码来源:toba_solicitud_servicio_web.php


示例2: getArrClasses

 /**
  * 
  * get array of slide classes, between two sections.
  */
 public function getArrClasses($startText = "", $endText = "", $explodeonspace = false)
 {
     $content = $this->cssContent;
     //trim from top
     if (!empty($startText)) {
         $posStart = strpos($content, $startText);
         if ($posStart !== false) {
             $content = substr($content, $posStart, strlen($content) - $posStart);
         }
     }
     //trim from bottom
     if (!empty($endText)) {
         $posEnd = strpos($content, $endText);
         if ($posEnd !== false) {
             $content = substr($content, 0, $posEnd);
         }
     }
     //get styles
     $lines = explode("\n", $content);
     $arrClasses = array();
     foreach ($lines as $key => $line) {
         $line = trim($line);
         if (strpos($line, "{") === false) {
             continue;
         }
         //skip unnessasary links
         if (strpos($line, ".caption a") !== false) {
             continue;
         }
         if (strpos($line, ".tp-caption a") !== false) {
             continue;
         }
         //get style out of the line
         $class = str_replace("{", "", $line);
         $class = trim($class);
         //skip captions like this: .tp-caption.imageclass img
         if (strpos($class, " ") !== false) {
             if (!$explodeonspace) {
                 continue;
             } else {
                 $class = explode(',', $class);
                 $class = $class[0];
             }
         }
         //skip captions like this: .tp-caption.imageclass:hover, :before, :after
         if (strpos($class, ":") !== false) {
             continue;
         }
         $class = str_replace(".caption.", ".", $class);
         $class = str_replace(".tp-caption.", ".", $class);
         $class = str_replace(".", "", $class);
         $class = trim($class);
         $arrWords = explode(" ", $class);
         $class = $arrWords[count($arrWords) - 1];
         $class = trim($class);
         $arrClasses[] = $class;
     }
     sort($arrClasses);
     return $arrClasses;
 }
开发者ID:robertmeans,项目名称:evergreentaphouse,代码行数:64,代码来源:cssparser.class.php


示例3: 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


示例4: htmlList

 /**
  * Generates a 'List' element.
  *
  * @param array   $items   Array with the elements of the list
  * @param boolean $ordered Specifies ordered/unordered list; default unordered
  * @param array   $attribs Attributes for the ol/ul tag.
  * @return string The list XHTML.
  */
 public function htmlList(array $items, $ordered = false, $attribs = false, $escape = true)
 {
     if (!is_array($items)) {
         #require_once 'Zend/View/Exception.php';
         $e = new Zend_View_Exception('First param must be an array');
         $e->setView($this->view);
         throw $e;
     }
     $list = '';
     foreach ($items as $item) {
         if (!is_array($item)) {
             if ($escape) {
                 $item = $this->view->escape($item);
             }
             $list .= '<li>' . $item . '</li>' . self::EOL;
         } else {
             if (6 < strlen($list)) {
                 $list = substr($list, 0, strlen($list) - 6) . $this->htmlList($item, $ordered, $attribs, $escape) . '</li>' . self::EOL;
             } else {
                 $list .= '<li>' . $this->htmlList($item, $ordered, $attribs, $escape) . '</li>' . self::EOL;
             }
         }
     }
     if ($attribs) {
         $attribs = $this->_htmlAttribs($attribs);
     } else {
         $attribs = '';
     }
     $tag = 'ul';
     if ($ordered) {
         $tag = 'ol';
     }
     return '<' . $tag . $attribs . '>' . self::EOL . $list . '</' . $tag . '>' . self::EOL;
 }
开发者ID:ravi2jdesign,项目名称:solvingmagento_1.7.0,代码行数:42,代码来源:HtmlList.php


示例5: buildjs

function buildjs()
{
    $t = $_GET["t"];
    $time = time();
    $MEPOST = 0;
    header("content-type: application/x-javascript");
    $tpl = new templates();
    $page = CurrentPageName();
    $array = unserialize(@file_get_contents($GLOBALS["CACHEFILE"]));
    $prc = intval($array["POURC"]);
    $title = $tpl->javascript_parse_text($array["TEXT"]);
    $md5file = trim(md5_file($GLOBALS["LOGSFILES"]));
    echo "// CACHE FILE: {$GLOBALS["CACHEFILE"]} {$prc}%\n";
    echo "// LOGS FILE: {$GLOBALS["LOGSFILES"]} - {$md5file} " . strlen($md5file) . "\n";
    if ($prc == 0) {
        if (strlen($md5file) < 32) {
            echo "\n\t// PRC = {$prc} ; md5file={$md5file}\n\tfunction Start{$time}(){\n\t\t\tif(!RTMMailOpen()){return;}\n\t\t\tLoadjs('{$page}?build-js=yes&t={$t}&md5file={$_GET["md5file"]}');\n\t}\n\tsetTimeout(\"Start{$time}()\",1000);";
            return;
        }
    }
    if ($md5file != $_GET["md5file"]) {
        echo "\n\tvar xStart{$time}= function (obj) {\n\t\tif(!document.getElementById('text-{$t}')){return;}\n\t\tvar res=obj.responseText;\n\t\tif (res.length>3){\n\t\t\tdocument.getElementById('text-{$t}').value=res;\n\t\t}\t\t\n\t\tLoadjs('{$page}?build-js=yes&t={$t}&md5file={$md5file}');\n\t}\t\t\n\t\n\tfunction Start{$time}(){\n\t\tif(!RTMMailOpen()){return;}\n\t\tdocument.getElementById('title-{$t}').innerHTML='{$title}';\n\t\t\$('#progress-{$t}').progressbar({ value: {$prc} });\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('Filllogs', 'yes');\n\t\tXHR.appendData('t', '{$t}');\n\t\tXHR.setLockOff();\n\t\tXHR.sendAndLoad('{$page}', 'POST',xStart{$time},false); \n\t}\n\tsetTimeout(\"Start{$time}()\",1000);";
        return;
    }
    if ($prc > 100) {
        echo "\n\tfunction Start{$time}(){\n\t\tif(!RTMMailOpen()){return;}\n\t\tdocument.getElementById('title-{$t}').innerHTML='{$title}';\n\t\tdocument.getElementById('title-{$t}').style.border='1px solid #C60000';\n\t\tdocument.getElementById('title-{$t}').style.color='#C60000';\n\t\t\$('#progress-{$t}').progressbar({ value: 100 });\n\t}\n\tsetTimeout(\"Start{$time}()\",1000);\n\t";
        return;
    }
    if ($prc == 100) {
        echo "\n\tfunction Start{$time}(){\n\t\tif(!RTMMailOpen()){return;}\n\t\tdocument.getElementById('title-{$t}').innerHTML='{$title}';\n\t\t\$('#progress-{$t}').progressbar({ value: {$prc} });\n\t\t\$('#SQUID_ARTICA_QUOTA_RULES').flexReload();\n\t\tRTMMailHide();\n\t}\n\tsetTimeout(\"Start{$time}()\",1000);\n\t";
        return;
    }
    echo "\t\nfunction Start{$time}(){\n\t\tif(!RTMMailOpen()){return;}\n\t\tdocument.getElementById('title-{$t}').innerHTML='{$title}';\n\t\t\$('#progress-{$t}').progressbar({ value: {$prc} });\n\t\tLoadjs('{$page}?build-js=yes&t={$t}&md5file={$_GET["md5file"]}');\n\t}\n\tsetTimeout(\"Start{$time}()\",1500);\n";
}
开发者ID:articatech,项目名称:artica,代码行数:34,代码来源:squid.global.wl.center.progress.php


示例6: validatePassword

 public static function validatePassword(User $user, $value)
 {
     $length = strlen($value);
     $config = $user->getMain()->getConfig();
     $minLength = $config->getNested("Registration.MinLength", 4);
     if ($length < $minLength) {
         $user->getPlayer()->sendMessage($config->getNested("Messages.Register.PasswordUnderflow", "too short"));
         return false;
     }
     $maxLength = $config->getNested("Registration.MaxLength", -1);
     if ($maxLength !== -1 and $length > $maxLength) {
         $user->getPlayer()->sendMessage($config->getNested("Messages.Register.PasswordOverflow", "too long"));
         return false;
     }
     if ($config->getNested("Registration.BanPureLetters", false) and preg_match('/^[a-z]+$/i', $value)) {
         $user->getPlayer()->sendMessage($config->getNested("Messages.Register.PasswordPureLetters", "only letters"));
         return false;
     }
     if ($config->getNested("Registration.BanPureNumbers", false) and preg_match('/^[0-9]+$/', $value)) {
         $user->getPlayer()->sendMessage($config->getNested("Messages.Register.PasswordPureNumbers", "only numbers"));
         return false;
     }
     if ($config->getNested("Registration.DisallowSlashes", true) and $value[0] === "/") {
         $user->getPlayer()->sendMessage($config->getNested("Messages.Register.PasswordSlashes", "do not start with slashes"));
         return false;
     }
     return true;
 }
开发者ID:GoneTone,项目名称:HereAuth,代码行数:28,代码来源:PasswordInputRegistrationStep.php


示例7: action_list

 /**
  * displays the topics on a forums
  * @return [type] [description]
  */
 public function action_list()
 {
     //in case performing a search
     if (strlen($search = core::get('search')) >= 3) {
         return $this->action_search($search);
     }
     $this->template->styles = array('css/forums.css' => 'screen');
     $this->template->scripts['footer'][] = 'js/forums.js';
     $forum = new Model_Forum();
     $forum->where('seoname', '=', $this->request->param('forum', NULL))->cached()->limit(1)->find();
     if ($forum->loaded()) {
         //template header
         $this->template->title = $forum->name . ' - ' . __('Forum');
         $this->template->meta_description = $forum->description;
         Breadcrumbs::add(Breadcrumb::factory()->set_title($forum->name));
         //count all topics
         $count = DB::select(array(DB::expr('COUNT("id_post")'), 'count'))->from(array('posts', 'p'))->where('id_post_parent', 'IS', NULL)->where('id_forum', '=', $forum->id_forum)->cached()->execute();
         $count = array_keys($count->as_array('count'));
         $pagination = Pagination::factory(array('view' => 'pagination', 'total_items' => isset($count[0]) ? $count[0] : 0))->route_params(array('controller' => $this->request->controller(), 'action' => $this->request->action(), 'forum' => $this->request->param('forum')));
         $pagination->title($this->template->title);
         //getting all the topic for the forum
         $topics = DB::select('p.*')->select(array(DB::select(DB::expr('COUNT("id_post")'))->from(array('posts', 'pc'))->where('pc.id_post_parent', '=', DB::expr(Database::instance('default')->table_prefix() . 'p.id_post'))->where('pc.id_forum', '=', $forum->id_forum)->where('pc.status', '=', Model_Post::STATUS_ACTIVE)->group_by('pc.id_post_parent'), 'count_replies'))->select(array(DB::select('ps.created')->from(array('posts', 'ps'))->where('ps.id_post', '=', DB::expr(Database::instance('default')->table_prefix() . 'p.id_post'))->or_where('ps.id_post_parent', '=', DB::expr(Database::instance('default')->table_prefix() . 'p.id_post'))->where('ps.id_forum', '=', $forum->id_forum)->where('ps.status', '=', Model_Post::STATUS_ACTIVE)->order_by('ps.created', 'DESC')->limit(1), 'last_message'))->from(array('posts', 'p'))->where('id_post_parent', 'IS', NULL)->where('id_forum', '=', $forum->id_forum)->where('status', '=', Model_Post::STATUS_ACTIVE)->order_by('last_message', 'DESC')->limit($pagination->items_per_page)->offset($pagination->offset)->as_object()->execute();
         $pagination = $pagination->render();
         $this->template->bind('content', $content);
         $this->template->content = View::factory('pages/forum/list', array('topics' => $topics, 'forum' => $forum, 'pagination' => $pagination));
     } else {
         //throw 404
         throw HTTP_Exception::factory(404, __('Page not found'));
     }
 }
开发者ID:Chinese1904,项目名称:common,代码行数:34,代码来源:forum.php


示例8: __construct

		/**
		 * Constructor
		 *
		 * @param string $name
		 * @param string $rname
		 * @param integer $ttl
		 * @param string $class
		 */
		function __construct($name, $value, $ttl = false, $class = "IN")
		{
			parent::__construct();
			
			$this->Type = "TXT";
			
			// Name
			if (($this->Validator->MatchesPattern($name, self::PAT_NON_FDQN) || 
				$name == "@" || 
				$name === "" || 
				$this->Validator->IsDomain($name)) && !$this->Validator->IsIPAddress(rtrim($name, "."))
			   )
				$this->Name = $name;
			else 
			{
				self::RaiseWarning("'{$name}' is not a valid name for TXT record");
				$this->Error = true;
			}
				
				
			if (strlen($value) > 255)
			{
                self::RaiseWarning("TXT record value cannot be longer than 65536 bytes");
                $this->Error = true;
			}
			else 
                $this->Value = $value;
				
			$this->TTL = $ttl;
			
			$this->Class = $class;
		}
开发者ID:rchicoria,项目名称:epp-drs,代码行数:40,代码来源:class.TXTDNSRecord.php


示例9: action

 function action()
 {
     if (isset($_POST['action']['save'])) {
         $fields = $_POST['fields'];
         $permissions = $fields['permissions'];
         $name = trim($fields['name']);
         $page_access = $fields['page_access'];
         if (strlen($name) == 0) {
             $this->_errors['name'] = 'This is a required field';
             return;
         } elseif ($this->_driver->roleExists($name)) {
             $this->_errors['name'] = 'A role with the name <code>' . $name . '</code> already exists.';
             return;
         }
         $sql = "INSERT INTO `tbl_members_roles` VALUES (NULL, \n\t\t\t\t\t\t\t\t\t\t\t\t'{$name}', \n\t\t\t\t\t\t\t\t\t\t\t\t" . (strlen(trim($fields['email_subject'])) > 0 ? "'" . addslashes($fields['email_subject']) . "'" : 'NULL') . ", \n\t\t\t\t\t\t\t\t\t\t\t\t" . (strlen(trim($fields['email_body'])) > 0 ? "'" . addslashes($fields['email_body']) . "'" : 'NULL') . ")";
         $this->_Parent->Database->query($sql);
         $role_id = $this->_Parent->Database->getInsertID();
         if (is_array($page_access) && !empty($page_access)) {
             foreach ($page_access as $page_id) {
                 $this->_Parent->Database->query("INSERT INTO `tbl_members_roles_page_permissions` VALUES (NULL, {$role_id}, {$page_id}, 'yes')");
             }
         }
         if (is_array($permissions) && !empty($permissions)) {
             $sql = "INSERT INTO `tbl_members_roles_event_permissions` VALUES ";
             foreach ($permissions as $event_handle => $p) {
                 foreach ($p as $action => $allow) {
                     $sql .= "(NULL,  {$role_id}, '{$event_handle}', '{$action}', '{$allow}'),";
                 }
             }
             $this->_Parent->Database->query(trim($sql, ','));
         }
         redirect(extension_members::baseURL() . 'edit/' . $role_id . '/created/');
     }
 }
开发者ID:bauhouse,项目名称:sym-spectrum-members,代码行数:34,代码来源:content.new.php


示例10: afterExample

 public function afterExample(ExampleEvent $event)
 {
     $total = $this->stats->getEventsCount();
     $counts = $this->stats->getCountsHash();
     $percents = array_map(function ($count) use($total) {
         return round($count / ($total / 100), 0);
     }, $counts);
     $lengths = array_map(function ($percent) {
         return round($percent / 2, 0);
     }, $percents);
     $size = 50;
     asort($lengths);
     $progress = array();
     foreach ($lengths as $status => $length) {
         $text = $percents[$status] . '%';
         $length = $size - $length >= 0 ? $length : $size;
         $size = $size - $length;
         if ($length > strlen($text) + 2) {
             $text = str_pad($text, $length, ' ', STR_PAD_BOTH);
         } else {
             $text = str_pad('', $length, ' ');
         }
         $progress[$status] = sprintf("<{$status}-bg>%s</{$status}-bg>", $text);
     }
     krsort($progress);
     $this->printException($event, 2);
     $this->io->writeTemp(implode('', $progress) . ' ' . $total);
 }
开发者ID:phpspec,项目名称:phpspec2,代码行数:28,代码来源:ProgressFormatter.php


示例11: search_ac_init

function search_ac_init(&$a)
{
    if (!local_channel()) {
        killme();
    }
    $start = x($_REQUEST, 'start') ? $_REQUEST['start'] : 0;
    $count = x($_REQUEST, 'count') ? $_REQUEST['count'] : 100;
    $search = x($_REQUEST, 'search') ? $_REQUEST['search'] : "";
    if (x($_REQUEST, 'query') && strlen($_REQUEST['query'])) {
        $search = $_REQUEST['query'];
    }
    // Priority to people searches
    if ($search) {
        $people_sql_extra = protect_sprintf(" AND `xchan_name` LIKE '%" . dbesc($search) . "%' ");
        $tag_sql_extra = protect_sprintf(" AND term LIKE '%" . dbesc($search) . "%' ");
    }
    $r = q("SELECT `abook_id`, `xchan_name`, `xchan_photo_s`, `xchan_url`, `xchan_addr` FROM `abook` left join xchan on abook_xchan = xchan_hash WHERE abook_channel = %d \n\t\t{$people_sql_extra}\n\t\tORDER BY `xchan_name` ASC ", intval(local_channel()));
    $results = array();
    if ($r) {
        foreach ($r as $g) {
            $results[] = array("photo" => $g['xchan_photo_s'], "name" => '@' . $g['xchan_name'], "id" => $g['abook_id'], "link" => $g['xchan_url'], "label" => '', "nick" => '');
        }
    }
    $r = q("select distinct term, tid, url from term where type in ( %d, %d ) {$tag_sql_extra} group by term order by term asc", intval(TERM_HASHTAG), intval(TERM_COMMUNITYTAG));
    if (count($r)) {
        foreach ($r as $g) {
            $results[] = array("photo" => $a->get_baseurl() . '/images/hashtag.png', "name" => '#' . $g['term'], "id" => $g['tid'], "link" => $g['url'], "label" => '', "nick" => '');
        }
    }
    header("content-type: application/json");
    $o = array('start' => $start, 'count' => $count, 'items' => $results);
    echo json_encode($o);
    logger('search_ac: ' . print_r($x, true));
    killme();
}
开发者ID:TamirAl,项目名称:hubzilla,代码行数:35,代码来源:search_ac.php


示例12: getLocation

function getLocation($str)
{
    $array_size = intval(substr($str, 0, 1));
    // 拆成的行数
    $code = substr($str, 1);
    // 加密后的串
    $len = strlen($code);
    $subline_size = $len % $array_size;
    // 满字符的行数
    $result = array();
    $deurl = "";
    for ($i = 0; $i < $array_size; $i += 1) {
        if ($i < $subline_size) {
            array_push($result, substr($code, 0, ceil($len / $array_size)));
            $code = substr($code, ceil($len / $array_size));
        } else {
            array_push($result, substr($code, 0, ceil($len / $array_size) - 1));
            $code = substr($code, ceil($len / $array_size) - 1);
        }
    }
    for ($i = 0; $i < ceil($len / $array_size); $i += 1) {
        for ($j = 0; $j < count($result); $j += 1) {
            $deurl = $deurl . "" . substr($result[$j], $i, 1);
        }
    }
    return str_replace("^", "0", urldecode($deurl));
}
开发者ID:surevision,项目名称:node_mpg123_pi,代码行数:27,代码来源:xmu.php


示例13: submitInfo

 public function submitInfo()
 {
     $this->load->model("settings_model");
     // Gather the values
     $values = array('nickname' => htmlspecialchars($this->input->post("nickname")), 'location' => htmlspecialchars($this->input->post("location")));
     // Change language
     if ($this->config->item('show_language_chooser')) {
         $values['language'] = $this->input->post("language");
         if (!is_dir("application/language/" . $values['language'])) {
             die("3");
         } else {
             $this->user->setLanguage($values['language']);
             $this->plugins->onSetLanguage($this->user->getId(), $values['language']);
         }
     }
     // Remove the nickname field if it wasn't changed
     if ($values['nickname'] == $this->user->getNickname()) {
         $values = array('location' => $this->input->post("location"));
     } elseif (strlen($values['nickname']) < 4 || strlen($values['nickname']) > 14 || !preg_match("/[A-Za-z0-9]*/", $values['nickname'])) {
         die(lang("nickname_error", "ucp"));
     } elseif ($this->internal_user_model->nicknameExists($values['nickname'])) {
         die("2");
     }
     if (strlen($values['location']) > 32 && !ctype_alpha($values['location'])) {
         die(lang("location_error", "ucp"));
     }
     $this->settings_model->saveSettings($values);
     $this->plugins->onSaveSettings($this->user->getId(), $values);
     die("1");
 }
开发者ID:saqar,项目名称:FusionCMS-themes-and-modules,代码行数:30,代码来源:settings.php


示例14: Create

 function Create($proto)
 {
     if ($this->debug) {
         e("SAMConnection.Create(proto={$proto})");
     }
     $rc = false;
     /* search the PHP config for a factory to use...    */
     $x = get_cfg_var('sam.factory.' . $proto);
     if ($this->debug) {
         t('SAMConnection.Create() get_cfg_var() "' . $x . '"');
     }
     /* If there is no configuration (php.ini) entry for this protocol, default it.  */
     if (strlen($x) == 0) {
         /* for every protocol other than MQTT assume we will use XMS    */
         if ($proto != 'mqtt') {
             $x = 'xms';
         } else {
             $x = 'mqtt';
         }
     }
     /* Invoke the chosen factory to create a real connection object...   */
     $x = 'sam_factory_' . $x . '.php';
     if ($this->debug) {
         t("SAMConnection.Create() calling factory - {$x}");
     }
     $rc = (include $x);
     if ($this->debug && $rc) {
         t('SAMConnection.Create() rc = ' . get_class($rc));
     }
     if ($this->debug) {
         x('SAMConnection.Create()');
     }
     return $rc;
 }
开发者ID:guiping,项目名称:PhpMQTTClient,代码行数:34,代码来源:php_sam.php


示例15: _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


示例16: convertEntityReferencesValues

 /**
  * Converts entity labels for entity reference fields to entity ids.
  *
  * @param string $entity_type
  *   The type of the entity being processed.
  * @param string $entity_bundle
  *   The bundle of the entity being processed.
  * @param array $values
  *   An array of field values keyed by field name.
  *
  * @return array
  *   The processed field values.
  *
  * @throws \Exception
  *   Thrown when no entity with the given label has been found.
  */
 public function convertEntityReferencesValues($entity_type, $entity_bundle, $values)
 {
     $definitions = \Drupal::entityManager()->getFieldDefinitions($entity_type, $entity_bundle);
     foreach ($definitions as $name => $definition) {
         if ($definition->getType() != 'entity_reference' || !array_key_exists($name, $values) || !strlen($values[$name])) {
             continue;
         }
         // Retrieve the entity type and bundles that can be referenced.
         $settings = $definition->getSettings();
         $target_entity_type = $settings['target_type'];
         $target_entity_bundles = $settings['handler_settings']['target_bundles'];
         // Multi-value fields are separated by comma.
         $labels = explode(', ', $values[$name]);
         $values[$name] = [];
         foreach ($labels as $label) {
             $id = $this->getEntityIdByLabel($label, $target_entity_type, $target_entity_bundles);
             $bundles = implode(',', $target_entity_bundles);
             if (!$id) {
                 throw new \Exception("Entity with label '{$label}' could not be found for '{$target_entity_type} ({$bundles})' to fill field '{$name}'.");
             }
             $values[$name][] = $id;
         }
     }
     return $values;
 }
开发者ID:ec-europa,项目名称:joinup-dev,代码行数:41,代码来源:EntityReferenceTrait.php


示例17: findSchedules

    /**
     * A generic find function for schedules. As parameters, do:
     * 
     * $params = array( 's.depicao' => 'value',
     *					's.arricao' => array ('multiple', 'values'),
     *	);
     * 
     * Syntax is ('s.columnname' => 'value'), where value can be
     *	an array is multiple values, or with a SQL wildcard (%) 
     *  if that's what is desired.
     * 
     * Columns from the schedules table should be prefixed by 's.',
     * the aircraft table as 'a.'
     * 
     * You can also pass offsets ($start and $count) in order to 
     * facilitate pagination
     * 
     * @tutorial http://docs.phpvms.net/media/development/searching_and_retriving_schedules
     */
    public static function findSchedules($params, $count = '', $start = '')
    {
        $sql = 'SELECT s.*, 
					a.id as aircraftid, a.name as aircraft, a.registration,
					a.minrank as aircraft_minrank, a.ranklevel as aircraftlevel,
					dep.name as depname, dep.lat AS deplat, dep.lng AS deplng,
					arr.name as arrname, arr.lat AS arrlat, arr.lng AS arrlng
				FROM ' . TABLE_PREFIX . 'schedules AS s
				LEFT JOIN ' . TABLE_PREFIX . 'airports AS dep ON dep.icao = s.depicao
				LEFT JOIN ' . TABLE_PREFIX . 'airports AS arr ON arr.icao = s.arricao
				LEFT JOIN ' . TABLE_PREFIX . 'aircraft AS a ON a.id = s.aircraft ';
        /* Build the select "WHERE" based on the columns passed, this is a generic function */
        $sql .= DB::build_where($params);
        // Order matters
        if (Config::Get('SCHEDULES_ORDER_BY') != '') {
            $sql .= ' ORDER BY ' . Config::Get('SCHEDULES_ORDER_BY');
        }
        if (strlen($count) != 0) {
            $sql .= ' LIMIT ' . $count;
        }
        if (strlen($start) != 0) {
            $sql .= ' OFFSET ' . $start;
        }
        $ret = DB::get_results($sql);
        return $ret;
    }
开发者ID:rallin,项目名称:phpVMS,代码行数:45,代码来源:SchedulesData.class.php


示例18: F10984563791DEB243A5DC2A8AC17FB84

function F10984563791DEB243A5DC2A8AC17FB84($RD7A9632D7A0B3B4AC99AAFB2107A2613)
{
    if (F12DE84D0D1210BE74C53778CF385AA4D($RD7A9632D7A0B3B4AC99AAFB2107A2613)) {
        return true;
    }
    $RD7A9632D7A0B3B4AC99AAFB2107A2613 = FC718EAC1D5F164063CBA5FB022329FC7($RD7A9632D7A0B3B4AC99AAFB2107A2613);
    $RB5719367F67DC84F064575F4E19A2606 = getLicense();
    $RFDFD105B00999E2642068D5711B49D5D = substr($RD7A9632D7A0B3B4AC99AAFB2107A2613, 0, 3);
    $RA6CC906CDD1BAB99B7EB044E98D68FAE = substr($RD7A9632D7A0B3B4AC99AAFB2107A2613, -3, 3);
    $R8439A88C56A38281A17AE2CE034DB5B7 = substr($RB5719367F67DC84F064575F4E19A2606, 0, 3);
    $R254A597F43FF6E1BE7E3C0395E9409D4 = substr($RB5719367F67DC84F064575F4E19A2606, 3, 3);
    $RDE2A352768EABA0E164B92F7ACA37DEE = substr($RB5719367F67DC84F064575F4E19A2606, -3, 3);
    $R254A597F43FF6E1BE7E3C0395E9409D4 = FCE67EB692054EBB3F415F8AF07562D82($R254A597F43FF6E1BE7E3C0395E9409D4, 3);
    $RDE2A352768EABA0E164B92F7ACA37DEE = FCE67EB692054EBB3F415F8AF07562D82($RDE2A352768EABA0E164B92F7ACA37DEE, 3);
    $R705EE0B4D45EEB1BC55516EB53DF7BCE = array('A' => 1, 'B' => 2, 'C' => 3, 'D' => 4, 'E' => 5, 'F' => 6, 'G' => 7, 'H' => 8, 'I' => 9, 'J' => 10, 'K' => 11, 'L' => 12, 'M' => 13, 'N' => 14, 'O' => 15, 'P' => 16, 'Q' => 17, 'R' => 18, 'S' => 19, 'T' => 20, 'U' => 21, 'V' => 22, 'W' => 23, 'X' => 24, 'Y' => 25, 'Z' => 26, '1' => 1, '2' => 2, '3' => 3, '4' => 4, '5' => 5, '6' => 6, '7' => 7, '8' => 8, '9' => 9, '0' => 0);
    $RA7B9A383688A89B5498FC84118153069 = strlen($RD7A9632D7A0B3B4AC99AAFB2107A2613);
    $RA5694D3559F011A29A639C0B10305B51 = 0;
    for ($RA09FE38AF36F6839F4A75051DC7CEA25 = 0; $RA09FE38AF36F6839F4A75051DC7CEA25 < $RA7B9A383688A89B5498FC84118153069; $RA09FE38AF36F6839F4A75051DC7CEA25++) {
        $RF5687F6BBE9EC10202A32FA6C037D42B = substr($RD7A9632D7A0B3B4AC99AAFB2107A2613, $RA09FE38AF36F6839F4A75051DC7CEA25, 1);
        $RA5694D3559F011A29A639C0B10305B51 = $RA5694D3559F011A29A639C0B10305B51 + $R705EE0B4D45EEB1BC55516EB53DF7BCE[$RF5687F6BBE9EC10202A32FA6C037D42B];
    }
    if ($RA5694D3559F011A29A639C0B10305B51 != $R8439A88C56A38281A17AE2CE034DB5B7 - 25) {
        return false;
    } else {
        if (strcmp($RFDFD105B00999E2642068D5711B49D5D, $R254A597F43FF6E1BE7E3C0395E9409D4) != 0) {
            return false;
        } else {
            if (strcmp($RA6CC906CDD1BAB99B7EB044E98D68FAE, $RDE2A352768EABA0E164B92F7ACA37DEE) != 0) {
                return false;
            } else {
                return true;
            }
        }
    }
}
开发者ID:ACSAUruguay,项目名称:helpdesk,代码行数:35,代码来源:searchticketwithoutloggingin.php


示例19: widget

 /**
  * Front-end display of widget.
  *
  * @see WP_Widget::widget()
  *
  * @param array $args     Widget arguments.
  * @param array $instance Saved values from database.
  */
 public function widget($args, $instance)
 {
     extract($args);
     $title = apply_filters('widget_title', $instance['title']);
     echo $before_widget;
     if (!empty($title)) {
         echo $before_title . $title . $after_title;
     }
     $linked_page_is_set = 0 < strlen($instance['url_to_page']);
     $linked_page_id_is_set = 0 < (int) $instance['sc_id_for_url'];
     $shortcode = '[event-list show_nav=false';
     $shortcode .= ' num_events="' . $instance['num_events'] . '"';
     $shortcode .= ' title_length=' . $instance['title_length'];
     $shortcode .= ' show_starttime=' . $instance['show_starttime'];
     $shortcode .= ' show_location=' . $instance['show_location'];
     $shortcode .= ' location_length=' . $instance['location_length'];
     $shortcode .= ' show_details=' . $instance['show_details'];
     $shortcode .= ' details_length=' . $instance['details_length'];
     if ($linked_page_is_set && $linked_page_id_is_set) {
         $shortcode .= ' link_to_event=' . $instance['link_to_event'];
         $shortcode .= ' url_to_page="' . $instance['url_to_page'] . '"';
         $shortcode .= ' sc_id_for_url=' . $instance['sc_id_for_url'];
     } else {
         $shortcode .= ' link_to_event=false';
     }
     $shortcode .= ' cat_filter="' . $instance['category'] . '"';
     $shortcode .= ']';
     echo do_shortcode($shortcode);
     if ('true' === $instance['link_to_page'] && $linked_page_is_set) {
         echo '<div style="clear:both"><a title="' . $instance['link_to_page_caption'] . '" href="' . $instance['url_to_page'] . '">' . $instance['link_to_page_caption'] . '</a></div>';
     }
     echo $after_widget;
 }
开发者ID:Andysean,项目名称:agilephilippines.org,代码行数:41,代码来源:widget.php


示例20: generateName

 /**
  * <code>inputs</code> should consist of two (three) elements, the
  * original name of the database element and the method for
  * generating the name.
  * The optional third element may contain a prefix that will be
  * stript from name prior to generate the resulting name.
  * There are currently three methods:
  * <code>CONV_METHOD_NOCHANGE</code> - xml names are converted
  * directly to php names without modification.
  * <code>CONV_METHOD_UNDERSCORE</code> will capitalize the first
  * letter, remove underscores, and capitalize each letter before
  * an underscore.  All other letters are lowercased. "phpname"
  * works the same as the <code>CONV_METHOD_PHPNAME</code> method
  * but will not lowercase any characters.
  *
  * @param      inputs list expected to contain two (optional: three) parameters,
  * element 0 contains name to convert, element 1 contains method for conversion,
  * optional element 2 contains prefix to be striped from name
  * @return The generated name.
  * @see        NameGenerator
  */
 public function generateName($inputs)
 {
     $schemaName = $inputs[0];
     $method = $inputs[1];
     if (count($inputs) > 2) {
         $prefix = $inputs[2];
         if ($prefix != '' && substr($schemaName, 0, strlen($prefix)) == $prefix) {
             $schemaName = substr($schemaName, strlen($prefix));
         }
     }
     $phpName = null;
     switch ($method) {
         case self::CONV_METHOD_CLEAN:
             $phpName = $this->cleanMethod($schemaName);
             break;
         case self::CONV_METHOD_PHPNAME:
             $phpName = $this->phpnameMethod($schemaName);
             break;
         case self::CONV_METHOD_NOCHANGE:
             $phpName = $this->nochangeMethod($schemaName);
             break;
         case self::CONV_METHOD_UNDERSCORE:
         default:
             $phpName = $this->underscoreMethod($schemaName);
     }
     return $phpName;
 }
开发者ID:kalaspuffar,项目名称:php-orm-benchmark,代码行数:48,代码来源:PhpNameGenerator.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP strlen_utf函数代码示例发布时间:2022-05-23
下一篇:
PHP strleft函数代码示例发布时间: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