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


PHP strpos函数代码示例

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


在下文中一共展示了strpos函数的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: __construct

 /**
  * @param mixed $in
  */
 public function __construct($in = null)
 {
     $fields = array('to', 'cc', 'bcc', 'message', 'body', 'subject');
     if (is_string($in)) {
         if (($pos = strpos($in, '?')) !== false) {
             parse_str(substr($in, $pos + 1), $this->args);
             $this->args['to'] = substr($in, 0, $pos);
         } else {
             $this->args['to'] = $in;
         }
     } elseif ($in instanceof Horde_Variables) {
         foreach ($fields as $val) {
             if (isset($in->{$val})) {
                 $this->args[$val] = $in->{$val};
             }
         }
     } elseif (is_array($in)) {
         $this->args = $in;
     }
     if (isset($this->args['to']) && strpos($this->args['to'], 'mailto:') === 0) {
         $mailto = @parse_url($this->args['to']);
         if (is_array($mailto)) {
             $this->args['to'] = isset($mailto['path']) ? $mailto['path'] : '';
             if (!empty($mailto['query'])) {
                 parse_str($mailto['query'], $vals);
                 foreach ($fields as $val) {
                     if (isset($vals[$val])) {
                         $this->args[$val] = $vals[$val];
                     }
                 }
             }
         }
     }
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:37,代码来源:Link.php

示例3: inet6_expand

/**
 * Expand an IPv6 Address
 *
 * This will take an IPv6 address written in short form and expand it to include all zeros. 
 *
 * @param  string  $addr A valid IPv6 address
 * @return string  The expanded notation IPv6 address
 */
function inet6_expand($addr)
{
    /* Check if there are segments missing, insert if necessary */
    if (strpos($addr, '::') !== false) {
        $part = explode('::', $addr);
        $part[0] = explode(':', $part[0]);
        $part[1] = explode(':', $part[1]);
        $missing = array();
        for ($i = 0; $i < 8 - (count($part[0]) + count($part[1])); $i++) {
            array_push($missing, '0000');
        }
        $missing = array_merge($part[0], $missing);
        $part = array_merge($missing, $part[1]);
    } else {
        $part = explode(":", $addr);
    }
    // if .. else
    /* Pad each segment until it has 4 digits */
    foreach ($part as &$p) {
        while (strlen($p) < 4) {
            $p = '0' . $p;
        }
    }
    // foreach
    unset($p);
    /* Join segments */
    $result = implode(':', $part);
    /* Quick check to make sure the length is as expected */
    if (strlen($result) == 39) {
        return $result;
    } else {
        return false;
    }
    // if .. else
}
开发者ID:samburney,项目名称:pdns-backend-phpautoreverse,代码行数:43,代码来源:ipv6_functions.php

示例4: onls

 function onls()
 {
     $logdir = UC_ROOT . 'data/logs/';
     $dir = opendir($logdir);
     $logs = $loglist = array();
     while ($entry = readdir($dir)) {
         if (is_file($logdir . $entry) && strpos($entry, '.php') !== FALSE) {
             $logs = array_merge($logs, file($logdir . $entry));
         }
     }
     closedir($dir);
     $logs = array_reverse($logs);
     foreach ($logs as $k => $v) {
         if (count($v = explode("\t", $v)) > 1) {
             $v[3] = $this->date($v[3]);
             $v[4] = $this->lang[$v[4]];
             $loglist[$k] = $v;
         }
     }
     $page = max(1, intval($_GET['page']));
     $start = ($page - 1) * UC_PPP;
     $num = count($loglist);
     $multipage = $this->page($num, UC_PPP, $page, 'admin.php?m=log&a=ls');
     $loglist = array_slice($loglist, $start, UC_PPP);
     $this->view->assign('loglist', $loglist);
     $this->view->assign('multipage', $multipage);
     $this->view->display('admin_log');
 }
开发者ID:tang86,项目名称:discuz-utf8,代码行数:28,代码来源:log.php

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

示例6: executeConsole

 public function executeConsole(AgaviRequestDataHolder $request_data)
 {
     $migration_description = $request_data->getParameter('description');
     $migration_timestamp = date('YmdHis');
     $migration_slug = StringToolkit::asSnakeCase(trim($request_data->getParameter('name', 'default')));
     $migration_name = StringToolkit::asStudlyCaps($migration_slug);
     $migration_dir = $this->getAttribute('migration_dir');
     // Bit of a hack to build namespace
     if (!preg_match('#.+/app/(?:modules|migration)/(\\w+_?)(?:$|/.+)#', $migration_dir, $matches)) {
         throw new RuntimeError(sprintf('Could not find namespace info in path %s', $migration_dir));
     }
     $namespace_parts = explode('_', $matches[1]);
     if (count($namespace_parts) == 1) {
         // @todo app migration - introduce a project root namespace setting
         $namespace_parts = ['Your', 'Application'];
     }
     // And a hack to determine the technology namespace
     $target = $request_data->getParameter('target');
     if (strpos($target, 'event_source')) {
         $technology = 'CouchDb';
     } elseif (strpos($target, 'view_store')) {
         $technology = 'Elasticsearch';
     } else {
         $technology = 'RabbitMq';
     }
     $migration_filepath = sprintf('%1$s%2$s%3$s_%4$s%2$s%4$s.php', $migration_dir, DIRECTORY_SEPARATOR, $migration_timestamp, $migration_slug);
     $twig_renderer = TwigRenderer::create(['template_paths' => [__DIR__]]);
     $twig_renderer->renderToFile($technology . 'Migration.tpl.twig', $migration_filepath, ['name' => $migration_name, 'timestamp' => $migration_timestamp, 'description' => $migration_description, 'folder' => $migration_dir, 'filepath' => $migration_filepath, 'vendor_prefix' => $namespace_parts[0], 'package_prefix' => $namespace_parts[1], 'technology' => $technology, 'project_prefix' => AgaviConfig::get('core.project_prefix')]);
     return $this->cliMessage('-> migration template was created here:' . PHP_EOL . $migration_filepath . PHP_EOL);
 }
开发者ID:honeybee,项目名称:honeybee-agavi-cmf-vendor,代码行数:30,代码来源:CreateSuccessView.class.php

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

示例8: quoteFromDir

 function quoteFromDir($dir)
 {
     $amount = 0;
     $index = 0;
     if ($handle = opendir($dir)) {
         while (false !== ($file = readdir($handle))) {
             if (strpos($file, ".dat") != false) {
                 $len = strlen($file);
                 if (substr($file, $len - 4) == ".dat") {
                     $number = $this->getNumberOfQuotes($dir . "/" . $file);
                     $amount += $number;
                     $quotes[$index] = $amount;
                     $files[$index] = $file;
                     $index++;
                 }
             }
         }
         srand((double) microtime() * 1000000);
         $index = rand(0, $amount);
         $i = 0;
         while ($quotes[$i] < $index) {
             $i++;
         }
         return $this->getRandomQuote($dir . "/" . $files[$i]);
     }
     return -1;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:27,代码来源:fortune.php

示例9: __call

 public function __call($s_method_name, $arr_arguments)
 {
     if (!method_exists($this, $s_method_name)) {
         // если еще не имлементировали
         $s_match = "";
         $s_method_prefix = '';
         $s_method_base = '';
         $arr_matches = array();
         $bSucc = preg_match("/[A-Z_]/", $s_method_name, $arr_matches);
         if ($bSucc) {
             $s_match = $arr_matches[0];
             $i_match = strpos($s_method_name, $s_match);
             $s_method_prefix = substr($s_method_name, 0, $i_match) . "/";
             $s_method_base = substr($s_method_name, 0, $i_match + ($s_match === "_" ? 1 : 0));
         }
         $s_class_enter = "__" . $s_method_name;
         // метод, общий для всех режимов
         if (!class_exists($s_class_enter)) {
             $s_entermethod_lib = "methods/" . $s_method_prefix . "__" . $s_method_name . ".lib.php";
             $this->__loadLib($s_entermethod_lib);
             $this->__implement($s_class_enter);
         }
         $s_class_mode = "__" . $s_method_name . "_";
         // метод, выбираемый в зависимости от режима
         if (!class_exists($s_class_mode)) {
             $s_modemethod_lib = "methods/" . $s_method_prefix . "__" . $s_method_name . "_" . cmsController::getInstance()->getCurrentMode() . ".lib.php";
             $this->__loadLib($s_modemethod_lib);
             $this->__implement($s_class_mode);
         }
     }
     return parent::__call($s_method_name, $arr_arguments);
 }
开发者ID:tomoonshine,项目名称:postsms,代码行数:32,代码来源:class+из+content.php

示例10: set

 public function set($var, $value = null)
 {
     // parse variable name
     extract($this->_parse($var));
     if (!empty($name)) {
         // set default hash to method
         if ($hash == 'default') {
             $hash = 'method';
         }
         // set a array value ?
         if (strpos($name, '.') !== false) {
             $parts = explode('.', $name);
             $name = array_shift($parts);
             $array =& $this->_call(array($this->_class, 'getVar'), array($name, array(), $hash, 'array'));
             $val =& $array;
             foreach ($parts as $i => $part) {
                 if (!isset($array[$part])) {
                     $array[$part] = array();
                 }
                 if (isset($parts[$i + 1])) {
                     $array =& $array[$part];
                 } else {
                     $array[$part] = $value;
                 }
             }
             $value = $val;
         }
         $this->_call(array($this->_class, 'setVar'), array($name, $value, $hash));
     }
     return $this;
 }
开发者ID:NavaINT1876,项目名称:ccustoms,代码行数:31,代码来源:request.php

示例11: registerScript

 /**
  * @param $name
  * @param array $params
  * @return string
  */
 public function registerScript($name, $params)
 {
     $out = '';
     if (!isset($this->modx->loadedjscripts[$name])) {
         $src = $params['src'];
         $remote = strpos($src, "http") !== false;
         if (!$remote) {
             $src = $this->modx->config['site_url'] . $src;
             if (!$this->fs->checkFile($params['src'])) {
                 $this->modx->logEvent(0, 3, 'Cannot load ' . $src, 'Assets helper');
                 return false;
             }
         }
         $type = isset($params['type']) ? $params['type'] : end(explode('.', $src));
         if ($type == 'js') {
             $out = '<script type="text/javascript" src="' . $src . '"></script>';
         } else {
             $out = '<link rel="stylesheet" type="text/css" href="' . $src . '">';
         }
         $this->modx->loadedjscripts[$name] = $params;
     } else {
         $out = false;
     }
     return $out;
 }
开发者ID:AgelxNash,项目名称:modx.evo.custom,代码行数:30,代码来源:Assets.php

示例12: convertToDatabaseValue

 /**
  * @param mixed            $value
  * @param AbstractPlatform $platform
  *
  * @return string
  * @throws \InvalidArgumentException
  */
 public function convertToDatabaseValue($value, AbstractPlatform $platform)
 {
     if (empty($value)) {
         return '';
     }
     if ($value instanceof \stdClass) {
         $value = get_object_vars($value);
     }
     if (!is_array($value)) {
         throw new \InvalidArgumentException("Hstore value must be off array or \\stdClass.");
     }
     $hstoreString = '';
     foreach ($value as $k => $v) {
         if (!is_string($v) && !is_numeric($v) && !is_bool($v)) {
             throw new \InvalidArgumentException("Cannot save 'nested arrays' into hstore.");
         }
         $v = trim($v);
         if (!is_numeric($v) && false !== strpos($v, ' ')) {
             $v = sprintf('"%s"', $v);
         }
         $hstoreString .= "{$k} => {$v}," . "\n";
     }
     $hstoreString = substr(trim($hstoreString), 0, -1) . "\n";
     return $hstoreString;
 }
开发者ID:epoplive,项目名称:EasyBib_DoctrineTypes,代码行数:32,代码来源:Hstore.php

示例13: CreateVideoGallery

 function CreateVideoGallery()
 {
     $InsVideoGallery = '';
     for ($z = 0; $z < count($this->_prodvideos); $z++) {
         if ($this->_prodvideos[$z]['videotype'] == 1 && $this->_prodvideos[$z]['isdownloaded'] == 2) {
             $filename = $this->_prodvideos[$z]['systemvideofile'];
         } else {
             $filename = $this->_prodvideos[$z]['videofile'];
         }
         if (strpos($filename, 'http://') !== false) {
             $VideoLink = $filename;
         } else {
             $VideoLink = $GLOBALS['ShopPath'] . '/' . GetConfig('InstallVideoDirectory') . '/' . $filename;
         }
         $InsVideoGallery .= '<tr>
                                     <td>
                                         <a style="color:#CCCCCC"  href="javascript:loadInsVideo(\'' . $VideoLink . '\');" title="Video ' . ($z + 1) . '">  
                                             Video' . ($z + 1) . '
                                         </a>
                                     </td>
                                 </tr>';
         if ($z == 0) {
             //$FirstInsVideo = $GLOBALS['ShopPath'].'/'.GetConfig('InstallVideoDirectory').'/'.$filename;
             $FirstInsVideo = $VideoLink;
             $GLOBALS['FirstInsVideo'] = 'loadInsVideo(\'' . $FirstInsVideo . '\')';
         }
     }
     $GLOBALS['InsVideoGallery'] = $InsVideoGallery;
     //
 }
开发者ID:nirvana-info,项目名称:old_bak,代码行数:30,代码来源:class.installvideo.php

示例14: createCommand

 public function createCommand(TaskInfo $taskInfo)
 {
     $task = new Command($taskInfo->getName());
     $task->setDescription($taskInfo->getDescription());
     $task->setHelp($taskInfo->getHelp());
     $args = $taskInfo->getArguments();
     foreach ($args as $name => $val) {
         $description = $taskInfo->getArgumentDescription($name);
         if ($val === TaskInfo::PARAM_IS_REQUIRED) {
             $task->addArgument($name, InputArgument::REQUIRED, $description);
         } elseif (is_array($val)) {
             $task->addArgument($name, InputArgument::IS_ARRAY, $description, $val);
         } else {
             $task->addArgument($name, InputArgument::OPTIONAL, $description, $val);
         }
     }
     $opts = $taskInfo->getOptions();
     foreach ($opts as $name => $val) {
         $description = $taskInfo->getOptionDescription($name);
         $fullName = $name;
         $shortcut = '';
         if (strpos($name, '|')) {
             list($fullName, $shortcut) = explode('|', $name, 2);
         }
         if (is_bool($val)) {
             $task->addOption($fullName, $shortcut, InputOption::VALUE_NONE, $description);
         } else {
             $task->addOption($fullName, $shortcut, InputOption::VALUE_OPTIONAL, $description, $val);
         }
     }
     return $task;
 }
开发者ID:stefanhuber,项目名称:Robo,代码行数:32,代码来源:Application.php

示例15: getService

 /**
  * Factory method to return a preconfigured Zend_Service_StrikeIron_*
  * instance.
  *
  * @param  null|string  $options  Service options
  * @return object       Zend_Service_StrikeIron_* instance
  * @throws Zend_Service_StrikeIron_Exception
  */
 public function getService($options = array())
 {
     $class = isset($options['class']) ? $options['class'] : 'Base';
     unset($options['class']);
     if (strpos($class, '_') === false) {
         $class = "Zend_Service_StrikeIron_{$class}";
     }
     try {
         if (!class_exists($class)) {
             // require_once 'Zend/Loader.php';
             @Zend_Loader::loadClass($class);
         }
         if (!class_exists($class, false)) {
             throw new Exception('Class file not found');
         }
     } catch (Exception $e) {
         $msg = "Service '{$class}' could not be loaded: " . $e->getMessage();
         /**
          * @see Zend_Service_StrikeIron_Exception
          */
         // require_once 'Zend/Service/StrikeIron/Exception.php';
         throw new Zend_Service_StrikeIron_Exception($msg, $e->getCode(), $e);
     }
     // instantiate and return the service
     $service = new $class(array_merge($this->_options, $options));
     return $service;
 }
开发者ID:netvlies,项目名称:zf,代码行数:35,代码来源:StrikeIron.php


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