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


PHP strlen函数代码示例

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


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


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