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

PHP strpbrk函数代码示例

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

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



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

示例1: return_RV

 private function return_RV($str)
 {
     /*
     If the second letter is a consonant, RV is the region after the next following vowel,
     or if the first two letters are vowels, RV is the region after the next consonant, and otherwise
     (consonant-vowel case) RV is the region after the third letter. But RV is the end of the word if these positions cannot be found.
     example,
     m a c h o [ho]     o l i v a [va]     t r a b a j o [bajo]     � u r e o [eo] prezzo sprezzante
     */
     if (strlen($str) < 2) {
         return '';
     }
     //$str;
     if (in_array($str[1], $this->consonanti)) {
         $str = substr($str, 2);
         $str = strpbrk($str, implode($this->vocali));
         return substr($str, 1);
         //secondo me devo mettere 1
     } else {
         if (in_array($str[0], $this->vocali) && in_array($str[1], $this->vocali)) {
             $str = strpbrk($str, implode($this->consonanti));
             return substr($str, 1);
         } else {
             if (in_array($str[0], $this->consonanti) && in_array($str[1], $this->vocali)) {
                 return substr($str, 3);
             }
         }
     }
 }
开发者ID:hackersforcharity,项目名称:rachelpiOS,代码行数:29,代码来源:it_stem.php


示例2: checkChars

    /**
     * Checks for allowed characters
     * @see Zend\Validator\Barcode.AbstractAdapter::checkChars()
     */
    public function checkChars($value)
    {
        $first = $value[0];
        if (strpbrk($value, 'ABCD') !== false) {
            $first = $value[0];
            if (strpbrk($first, 'ABCD') === false) {
                // Missing start char
                return false;
            }

            $last = substr($value, -1, 1);
            if (strpbrk($last, 'ABCD') === false) {
                // Missing stop char
                return false;
            }

            $value = substr($value, 1, -1);
        }

        $chars             = $this->_characters;
        $this->_characters = '0123456789-$:/.+';
        $result            = parent::checkChars($value);
        $this->_characters = $chars;
        return $result;
    }
开发者ID:hhatfield,项目名称:zf2,代码行数:29,代码来源:Codabar.php


示例3: createEntityPrefix

 /**
  * @param string $field
  * @return string
  */
 public static function createEntityPrefix($field)
 {
     $fullField = $field;
     $prefix = $field[0];
     if (false !== ($pos = strpos($field, '_'))) {
         // snake_case
         do {
             $field = substr($field, $pos + 1);
             $prefix .= $field[0];
             $pos = strpos($field, '_');
         } while (false !== $pos);
     } else {
         // camelCase
         $camel = strpbrk($field, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ');
         while (0 < strlen($camel) && strlen($camel) < strlen($field)) {
             $prefix .= strtolower($camel[0]);
             $field = $camel;
             $camel = substr($camel, 1);
             $camel = strpbrk($camel, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ');
         }
     }
     $number = 0;
     do {
         $result = $prefix . '_' . $number;
         if (!isset(self::$tableWidePrefixes[$result])) {
             self::$tableWidePrefixes[$result] = $fullField;
             break;
         } elseif (self::$tableWidePrefixes[$result] === $fullField) {
             break;
         } elseif (self::$tableWidePrefixes[$result] !== $fullField) {
             $number++;
         }
     } while (true);
     return $result;
 }
开发者ID:uvoelkel,项目名称:serverside-datatables-bundle,代码行数:39,代码来源:EntityColumn.php


示例4: sendEmail

function sendEmail($nombre)
{
    $saludo = "";
    if (strpbrk($nombre)) {
        $message = "";
    }
}
开发者ID:abelzamora,项目名称:boda,代码行数:7,代码来源:insertar.php


示例5: line

 public function line($text)
 {
     $markup = '';
     $unexaminedText = $text;
     $markerPosition = 0;
     while ($excerpt = strpbrk($unexaminedText, $this->inlineMarkerList)) {
         $marker = $excerpt[0];
         $markerPosition += strpos($unexaminedText, $marker);
         $Excerpt = array('text' => $excerpt, 'context' => $text);
         foreach ($this->InlineTypes[$marker] as $inlineType) {
             $Inline = $this->{'inline' . $inlineType}($Excerpt);
             if (!isset($Inline)) {
                 continue;
             }
             if (isset($Inline['position']) and $Inline['position'] > $markerPosition) {
                 continue;
             }
             if (!isset($Inline['position'])) {
                 $Inline['position'] = $markerPosition;
             }
             $unmarkedText = substr($text, 0, $Inline['position']);
             $markup .= $this->unmarkedText($unmarkedText);
             $markup .= isset($Inline['markup']) ? $Inline['markup'] : $this->element($Inline['element']);
             $text = substr($text, $Inline['position'] + $Inline['extent']);
             $unexaminedText = $text;
             $markerPosition = 0;
             continue 2;
         }
         $unexaminedText = substr($excerpt, 1);
         $markerPosition++;
     }
     $markup .= $this->unmarkedText($text);
     return $markup;
 }
开发者ID:mefd,项目名称:common-bundle,代码行数:34,代码来源:61f1e03ef8c234260c54ef65a39851b9.php


示例6: SetUpForm

function SetUpForm($Character)
{
    WriteHeaders();
    echo "\n    <div class = \"top\">\n\t   Music - Alex Ash and Brett Akey\n\t</div>\n    <div class = \"bigpiece\">\n\t  <div class = \"leftpiece\"> \n\t    \n         <p>";
    if (strpbrk($Character, "H")) {
        echo "<form action=? method=post>";
        DisplayButton("nextPage", "Home", "WelcomePage");
        echo "</form>";
    }
    if (strpbrk($Character, "F")) {
        echo "<form action=? method=post>";
        DisplayButton("nextPage", "Find Record", "FoundRecord");
        echo "</form>";
    }
    echo "<form action=? method=post>";
    if (strpbrk($Character, "S")) {
        echo "<input type=submit name=\"nextPage\" class=\"submit\" value=\"Save\"> ";
    }
    if (strpbrk($Character, "C")) {
        echo "<form action=? method=post>";
        DisplayButton("nextPage", "Save Changes", "ChangesMade");
        echo "</form>";
    } elseif (!strpbrk($Character, "S") && !strpbrk($Character, "H")) {
        DisplayButton("nextPage", "Create Table", "CreateTable");
        DisplayButton("nextPage", "Add Record", "EnterData");
        DisplayButton("nextPage", "Modify Record", "ModifyRecord");
        DisplayButton("nextPage", "Display Data", "DisplayData");
    }
    echo " </p>\n\t  </div>\n\t  <div class = \"middlepiece\" >\t    \n\t ";
}
开发者ID:AlexA11,项目名称:Php-Asst-2,代码行数:30,代码来源:Asst2Main.php


示例7: introspect

    /**
     * Create XML definition on an AMF service class
     *
     * @param  string $serviceClass Service class name
     * @param  array $options invocation options
     * @return string XML with service class introspection
     */
    public function introspect($serviceClass, $options = array())
    {
        $this->_options = $options;

        if (strpbrk($serviceClass, '\\/<>')) {
            return $this->_returnError('Invalid service name');
        }

        // Transform com.foo.Bar into com_foo_Bar
        $serviceClass = str_replace('.' , '_', $serviceClass);

        // Introspect!
        if (!class_exists($serviceClass)) {
            require_once 'Zend/Loader.php';
            Zend_Loader::loadClass($serviceClass, $this->_getServicePath());
        }

        $serv = $this->_xml->createElement('service-description');
        $serv->setAttribute('xmlns', 'http://ns.adobe.com/flex/service-description/2008');

        $this->_types = $this->_xml->createElement('types');
        $this->_ops   = $this->_xml->createElement('operations');

        $r = Zend_Server_Reflection::reflectClass($serviceClass);
        $this->_addService($r, $this->_ops);

        $serv->appendChild($this->_types);
        $serv->appendChild($this->_ops);
        $this->_xml->appendChild($serv);

        return $this->_xml->saveXML();
    }
开发者ID:nhp,项目名称:shopware-4,代码行数:39,代码来源:Introspector.php


示例8: checkDbPassword

	protected function checkDbPassword()
	{
		/** @global CDataBase $DB */
		global $DB;
		$password = $DB->DBPassword;
		$sign = ",.#!*%$:-";
		$dit = "1234567890";
		if(trim($password) == "")
		{
			$this->addUnformattedDetailError("SECURITY_SITE_CHECKER_DB_EMPTY_PASS", CSecurityCriticalLevel::HIGHT);
		}
		else
		{
			if($password == strtolower($password))
			{
				$this->addUnformattedDetailError("SECURITY_SITE_CHECKER_DB_SAME_REGISTER_PASS", CSecurityCriticalLevel::HIGHT);
			}
			if(strpbrk($password, $sign) === false)
			{
				$this->addUnformattedDetailError("SECURITY_SITE_CHECKER_DB_NO_SIGN_PASS", CSecurityCriticalLevel::HIGHT);
			}
			if(strpbrk($password, $dit) === false)
			{
				$this->addUnformattedDetailError("SECURITY_SITE_CHECKER_DB_NO_DIT_PASS", CSecurityCriticalLevel::HIGHT);
			}
			if (strlen($password)<8)
			{
				$this->addUnformattedDetailError("SECURITY_SITE_CHECKER_DB_MIN_LEN_PASS", CSecurityCriticalLevel::HIGHT);
			}
		}
	}
开发者ID:ASDAFF,项目名称:bitrix-5,代码行数:31,代码来源:site_configuration.php


示例9: change

 public function change()
 {
     if (!isset($_SESSION['UserID'])) {
         redirect('Login/logout');
     }
     //Create new user and load its data
     $user = new User_model();
     if (!$user->loadPropertiesFromPrimaryKey($_SESSION['UserID'])) {
         redirect('Login/logout');
     }
     //If user did not load, logout the session
     if ($user->isGuest()) {
         redirect('Mainpage');
     }
     //If not a student, redirect to mainpage
     $oldpw = $this->input->post('oldpw');
     $newpw = $this->input->post('newpw');
     $newpw2 = $this->input->post('newpw2');
     if (!$user->authenticate($oldpw)) {
         $this->load->view('changePassword', array('user' => $user, 'error' => TRUE));
     } elseif ($newpw != $newpw2) {
         $this->load->view('changePassword', array('user' => $user, 'error2' => TRUE));
     } elseif (strpbrk($newpw, '!@#$%&*-+=1234567890') === FALSE || strlen($newpw) < 8) {
         $this->load->view('changePassword', array('user' => $user, 'error3' => TRUE));
     } elseif (strpbrk($newpw, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ') === FALSE || strlen($newpw) < 8) {
         $this->load->view('changePassword', array('user' => $user, 'error3' => TRUE));
     } else {
         $user->setPassword($newpw);
         $user->update();
         $this->load->view('changePassword', array('user' => $user, 'success' => TRUE));
     }
 }
开发者ID:Troutzorz,项目名称:csapp,代码行数:32,代码来源:Changepassword.php


示例10: parse

/**
 * @param string $str
 * @param string $minlength
 * @param string $maxlength
 * @param int $baseerrcode
 * @return int
 */
function parse($str, $minlength = USER_MINLENGTH, $maxlength = USER_MAXLENGTH, $baseerrcode = 0)
{
    $validchars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_.";
    if ($str == '') {
        return 1 + $baseerrcode;
    }
    $length = strlen($str);
    if ($length < $minlength) {
        return 2 + $baseerrcode;
    }
    if ($length > $maxlength) {
        return 3 + $baseerrcode;
    }
    if (strpos($str, "__") !== false || strpos($str, "..") !== false || strpos($str, "_.") !== false || strpos($str, "._") !== false) {
        return 4 + $baseerrcode;
    }
    if (strpos($str, ".") === 0 || strpos($str, "_") === 0 || strpos($str, ".") === $length - 1 || strpos($str, "_") === $length - 1) {
        return 4 + $baseerrcode;
    }
    for ($i = 0; $i < $length; $i++) {
        if (strpbrk($str[$i], $validchars) === false) {
            return 4 + $baseerrcode;
        }
    }
    return 0;
}
开发者ID:elcodedocle,项目名称:synapp,代码行数:33,代码来源:parsers.php


示例11: resolve

 /**
  * {@inheritDoc}
  */
 public function resolve($name)
 {
     if ($this->isLfiProtectionOn() && preg_match('#\\.\\.[\\\\/]#', $name)) {
         return null;
     }
     if (strpbrk($name, '[]*?') === false) {
         //skip files that don't look like globs
         return null;
     }
     foreach ($this->getPaths() as $path) {
         $joinedPath = $path . $name;
         $glob = glob($joinedPath);
         if (count($glob)) {
             // Get the mime type of the first file and assume its the same for all the rest (not ideal).
             // @todo Maybe this could be refactored into a MimeResolver
             $filePath = current($glob);
             $file = new SplFileInfo($filePath);
             $mimeType = $this->getMimeResolver()->getMimeType($file->getRealPath());
             $asset = new GlobAsset($joinedPath);
             $asset->mimetype = $mimeType;
             return $asset;
         }
     }
     return null;
 }
开发者ID:sokac,项目名称:AssetManager,代码行数:28,代码来源:GlobPathStackResolver.php


示例12: scanpassword

 function scanpassword($password)
 {
     $lower = false;
     $upper = false;
     $specialchar = false;
     $number = false;
     $possibilities = 0;
     $special = '!@#$%&*<>-_!@#$%&*<>-_';
     for ($i = 0; $i < strlen($password); $i++) {
         if (preg_match("/[a-z]/", $password[$i]) && !$lower) {
             $possibilities += 26;
             $lower = true;
         }
         if (preg_match('/[A-Z]/', $password[$i]) && !$upper) {
             $possibilities += 26;
             $upper = true;
         }
         if (preg_match('/[0-9]/', $password[$i]) && !$number) {
             $possibilities += 10;
             $number = true;
         }
         if (strpbrk($password[$i], $special) && !$specialchar) {
             $possibilities += 15;
             $specialchar = true;
         }
     }
     $product['product'] = pow($possibilities, strlen($password)) / 4000000000;
     $product['possibilities'] = $possibilities;
     $product['quantity'] = strlen($password);
     $objPeriod = new Period();
     $product['possibilities'] = $objPeriod->mountPossibilities($product);
     return $product;
 }
开发者ID:matheusasdev,项目名称:PowerKey,代码行数:33,代码来源:scan.php


示例13: extraireMots

function extraireMots($dictee, $nbcar = 5, $mot = '')
{
    $dictee = str_replace("\n", " ", $dictee);
    $tableau = explode(' ', $dictee);
    $nbmots = count($tableau);
    $dictionnaire = [];
    foreach ($tableau as $mots) {
        $mots = rtrim($mots, ',');
        $mots = rtrim($mots, '.');
        $mots = rtrim($mots, ':');
        $mots = ltrim($mots, '"');
        if (strpbrk($mots, "-") != false) {
            $motComposes = explode('-', $mots);
            if (mb_strlen($motComposes[0]) >= $nbcar) {
                $dictionnaire[] = $motComposes[0];
            }
            if (mb_strlen($motComposes[1]) >= $nbcar) {
                $dictionnaire[] = $motComposes[1];
            }
        } elseif (mb_strlen($mots) >= $nbcar) {
            $dictionnaire[] = $mots;
        }
    }
    $motPresent = in_array($mot, $dictionnaire);
    $resultat = array($nbmots, $dictionnaire, $motPresent);
    return $resultat;
}
开发者ID:simplon-renaudV,项目名称:exosFonctions,代码行数:27,代码来源:exofonctions.php


示例14: putCSV

 /**
  * @param $handle
  * @param $fields
  * @param string $delimiter
  * @param string $enclosure
  * @param bool $useArrayKey
  * @param string $escape
  */
 public static function putCSV($handle, $fields, $delimiter = ',', $enclosure = '"', $useArrayKey = false, $escape = '\\')
 {
     $first = 1;
     foreach ($fields as $key => $field) {
         if ($first == 0) {
             fwrite($handle, $delimiter);
         }
         if ($useArrayKey) {
             $f = str_replace($enclosure, $enclosure . $enclosure, $key);
         } else {
             $field = EXPORT_ENCODE_FUNCTION != "none" && function_exists(EXPORT_ENCODE_FUNCTION) ? call_user_func(EXPORT_ENCODE_FUNCTION, $field) : $field;
             $f = str_replace($enclosure, $enclosure . $enclosure, $field);
         }
         if ($enclosure != $escape) {
             $f = str_replace($escape . $enclosure, $escape, $f);
         }
         if (strpbrk($f, " \t\n\r" . $delimiter . $enclosure . $escape) || strchr($f, "")) {
             fwrite($handle, $enclosure . $f . $enclosure);
         } else {
             fwrite($handle, $f);
         }
         $first = 0;
     }
     fwrite($handle, "\n");
 }
开发者ID:arnon22,项目名称:transportcm,代码行数:33,代码来源:FileManager.php


示例15: controller

 /**
  * Map route to all public controller method
  *
  * with
  * Route::get('/prefix', 'ClassController')
  *
  * this will map
  * GET  domain.com/prefix -> ClassController::getIndex
  * POST domain.com/prefix -> ClassCOntroller::postIndex
  * PUT  domain.com/prefix -> ClassCOntroller::putIndex
  */
 public static function controller()
 {
     $arguments = func_get_args();
     $path = $arguments[0];
     $controller = end($arguments);
     $class = new \ReflectionClass($controller);
     $controllerMethods = $class->getMethods(\ReflectionMethod::IS_PUBLIC);
     $uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
     foreach ($controllerMethods as $method) {
         if (substr($method->name, 0, 2) != '__') {
             $methodName = $method->name;
             $callable = $arguments;
             $pos = strcspn($methodName, $uppercase);
             $httpMethod = substr($methodName, 0, $pos);
             $ctrlMethod = lcfirst(strpbrk($methodName, $uppercase));
             if ($ctrlMethod == 'index') {
                 $pathMethod = $path;
             } else {
                 if ($httpMethod == 'get') {
                     $pathMethod = "{$path}/{$ctrlMethod}(/:params+)";
                 } else {
                     $pathMethod = "{$path}/{$ctrlMethod}";
                 }
             }
             //put edited pattern to the top stack
             array_shift($callable);
             array_unshift($callable, $pathMethod);
             //put edited controller to the bottom stack
             array_pop($callable);
             array_push($callable, "{$controller}:{$methodName}");
             call_user_func_array(array(self::$slim, $httpMethod), $callable);
         }
     }
 }
开发者ID:thantalas,项目名称:slim-nne,代码行数:45,代码来源:RouteFacade.php


示例16: __construct

 /**
  * Class constructor.
  *
  * @param string $metadataUrl The URL of the plugin's metadata file.
  * @param string $pluginFile Fully qualified path to the main plugin file.
  * @param string $slug The plugin's 'slug'. If not specified, the filename part of $pluginFile sans '.php' will be used as the slug.
  * @param integer $checkPeriod How often to check for updates (in hours). Defaults to checking every 12 hours. Set to 0 to disable automatic update checks.
  * @param string $optionName Where to store book-keeping info about update checks. Defaults to 'external_updates-$slug'.
  * @param string $muPluginFile Optional. The plugin filename relative to the mu-plugins directory.
  */
 public function __construct($metadataUrl, $pluginFile, $slug = '', $checkPeriod = 12, $optionName = '', $muPluginFile = '')
 {
     $this->metadataUrl = $metadataUrl;
     $this->pluginAbsolutePath = $pluginFile;
     $this->pluginFile = plugin_basename($this->pluginAbsolutePath);
     $this->muPluginFile = $muPluginFile;
     $this->slug = $slug;
     $this->optionName = $optionName;
     $this->debugMode = (bool) constant('WP_DEBUG');
     //If no slug is specified, use the name of the main plugin file as the slug.
     //For example, 'my-cool-plugin/cool-plugin.php' becomes 'cool-plugin'.
     if (empty($this->slug)) {
         $this->slug = basename($this->pluginFile, '.php');
     }
     if (empty($this->optionName)) {
         $this->optionName = 'external_updates-' . $this->slug;
     }
     //Backwards compatibility: If the plugin is a mu-plugin but no $muPluginFile is specified, assume
     //it's the same as $pluginFile given that it's not in a subdirectory (WP only looks in the base dir).
     if (strpbrk($this->pluginFile, '/\\') === false && $this->isUnknownMuPlugin()) {
         $this->muPluginFile = $this->pluginFile;
     }
     $this->scheduler = $this->createScheduler($checkPeriod);
     $this->upgraderStatus = new PucUpgraderStatus_3_0();
     $this->installHooks();
 }
开发者ID:apxeonTepukc,项目名称:kalo-plugin-auto,代码行数:36,代码来源:plugin-update-checker.php


示例17: __construct

 /**
  * Class constructor.
  *
  * @param string $metadataUrl The URL of the plugin's metadata file.
  * @param string $pluginFile Fully qualified path to the main plugin file.
  * @param string $slug The plugin's 'slug'. If not specified, the filename part of $pluginFile sans '.php' will be used as the slug.
  * @param integer $checkPeriod How often to check for updates (in hours). Defaults to checking every 12 hours. Set to 0 to disable automatic update checks.
  * @param string $optionName Where to store book-keeping info about update checks. Defaults to 'external_updates-$slug'.
  * @param string $muPluginFile Optional. The plugin filename relative to the mu-plugins directory.
  */
 public function __construct($metadataUrl, $pluginFile, $slug = '', $checkPeriod = 12, $optionName = '', $muPluginFile = '')
 {
     $this->metadataUrl = $metadataUrl;
     $this->pluginAbsolutePath = $pluginFile;
     $this->pluginFile = plugin_basename($this->pluginAbsolutePath);
     $this->muPluginFile = $muPluginFile;
     $this->slug = $slug;
     $this->optionName = $optionName;
     $this->debugMode = (bool) constant('WP_DEBUG');
     //If no slug is specified, use the name of the main plugin file as the slug.
     //For example, 'my-cool-plugin/cool-plugin.php' becomes 'cool-plugin'.
     if (empty($this->slug)) {
         $this->slug = basename($this->pluginFile, '.php');
     }
     //Plugin slugs must be unique.
     $slugCheckFilter = 'puc_is_slug_in_use-' . $this->slug;
     $slugUsedBy = apply_filters($slugCheckFilter, false);
     if ($slugUsedBy) {
         $this->triggerError(sprintf('Plugin slug "%s" is already in use by %s. Slugs must be unique.', htmlentities($this->slug), htmlentities($slugUsedBy)), E_USER_ERROR);
     }
     add_filter($slugCheckFilter, array($this, 'getAbsolutePath'));
     if (empty($this->optionName)) {
         $this->optionName = 'external_updates-' . $this->slug;
     }
     //Backwards compatibility: If the plugin is a mu-plugin but no $muPluginFile is specified, assume
     //it's the same as $pluginFile given that it's not in a subdirectory (WP only looks in the base dir).
     if (strpbrk($this->pluginFile, '/\\') === false && $this->isUnknownMuPlugin()) {
         $this->muPluginFile = $this->pluginFile;
     }
     $this->scheduler = $this->createScheduler($checkPeriod);
     $this->upgraderStatus = new PucUpgraderStatus_3_1();
     $this->installHooks();
 }
开发者ID:pehaa,项目名称:pht-page-builder,代码行数:43,代码来源:plugin-update-checker.php


示例18: getCookieValue

 /**
  * Quote the cookie value if it is not already quoted and it contains
  * problematic characters.
  *
  * @param string $value Value that may or may not need to be quoted
  *
  * @return string
  */
 public static function getCookieValue($value)
 {
     if (substr($value, 0, 1) !== '"' && substr($value, -1, 1) !== '"' && strpbrk($value, ';,')) {
         $value = '"' . $value . '"';
     }
     return $value;
 }
开发者ID:piv915,项目名称:guzzle,代码行数:15,代码来源:CookieJar.php


示例19: makeButton

 function makeButton()
 {
     global $sabnzbd_ip;
     global $sabnzbd_port;
     global $sabnzbd_api;
     $sabnzbdXML = simplexml_load_file('http://' . $sabnzbd_ip . ':' . $sabnzbd_port . '/api?mode=qstatus&output=xml&apikey=' . $sabnzbd_api);
     if ($sabnzbdXML->state == 'Downloading') {
         $speed = $sabnzbdXML->speed;
         if (strpbrk($speed, 'K')) {
             // This converts the speed from KBps or MBps to Mbps
             $convertedSpeed = number_format(substr($speed, 0, strlen($speed) - 2) * 8 / 1024, 1);
         } else {
             $convertedSpeed = number_format(substr($speed, 0, strlen($speed) - 2) * 8, 0);
         }
         $icon = '<i class="icon-' . ($this->status ? 'download-alt' : 'remove') . ' icon-white"></i>';
         $txt = $this->status ? $convertedSpeed . 'Mb' : 'Offline';
     } else {
         $icon = '<i class="icon-' . ($this->status ? 'ok' : 'remove') . ' icon-white"></i>';
         $txt = $this->status ? 'Online' : 'Offline';
     }
     $btn = $this->status ? 'success' : 'warning';
     $prefix = $this->url == "" ? '<button style="width:62px" class="btn btn-xs btn-' . $btn . ' disabled">' : '<a href="' . $this->url . '" style="width:62px" class="btn btn-xs btn-' . $btn . '">';
     $suffix = $this->url == "" ? '</button>' : '</a>';
     return $prefix . $icon . " " . $txt . $suffix;
 }
开发者ID:ShakataGaNai,项目名称:Network-Status-Page,代码行数:25,代码来源:serviceSAB.class.php


示例20: display

 public function display(array $data, $template = null, $return = false)
 {
     $view = waSystem::getInstance()->getView();
     if ($template === null) {
         $template = ucfirst($this->action);
     }
     if (strpbrk($template, '/:') === false) {
         $match = array();
         preg_match("/[A-Z][^A-Z]+/", get_class($this), $match);
         $template = $this->getPluginRoot() . 'templates/actions/' . strtolower($match[0]) . "/" . $match[0] . $template . $view->getPostfix();
     }
     // assign vars
     $view->assign($data);
     if ($this->layout && $this->layout instanceof waLayout) {
         // assign result to layout
         $this->layout->setBlock('content', $view->fetch($template));
         $this->layout->display();
     } else {
         // send headers
         $this->getResponse()->sendHeaders();
         // display
         if ($return) {
             return $view->fetch($template);
         } else {
             $view->display($template);
         }
     }
 }
开发者ID:navi8602,项目名称:wa-shop-ppg,代码行数:28,代码来源:waActions.class.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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