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

PHP xoops_substr函数代码示例

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

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



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

示例1: showcaseComponentsShow

function showcaseComponentsShow($options)
{
    include XOOPS_ROOT_PATH . "/modules/spotlight/components/showcase/config.php";
    $sp_handler =& xoops_getmodulehandler('spotlight', 'spotlight');
    $page_handler =& xoops_getmodulehandler('page', 'spotlight');
    // spotlight object
    $sp_obj = $sp_handler->get($options[0]);
    if (!is_object($sp_obj) || empty($options[0])) {
        trigger_error("spotlight is not object ", E_USER_WARNING);
    } else {
        //spotlight name
        $block['sp_name'] = $sp_obj->getVar('sp_name');
        // page list
        $criteria = new CriteriaCompo();
        $criteria->add(new Criteria('sp_id', $options[0]));
        $criteria->setLimit($config['limit']);
        $criteria->setSort($config['sort']);
        $criteria->setOrder('ASC');
        $pages = $page_handler->getAll($criteria, array('page_id', 'page_title', 'page_link', 'page_image', 'page_desc', 'published'), false);
        $myts = MyTextSanitizer::getInstance();
        foreach ($pages as $k => $v) {
            $block['news'][$k] = $v;
            $block['news'][$k]['images'] = XOOPS_UPLOAD_URL . '/spotlight/image_' . $v['page_image'];
            $block['news'][$k]['thumbs'] = XOOPS_UPLOAD_URL . '/spotlight/thumb_' . $v['page_image'];
            $page_desc = strip_tags($myts->undoHtmlSpecialChars(strip_tags($v['page_desc'])));
            $block['news'][$k]['page_desc'] = xoops_substr($page_desc, '', $config['page_desc_substr']);
            $block['news'][$k]['page_title'] = xoops_substr($v['page_title'], '', $config['page_title_substr']);
            $block['news'][$k]['published'] = formatTimestamp($v['published'], $config['timeformat']);
        }
        // component name
        $block['component'] = $sp_obj->getVar('component_name');
        return $block;
    }
}
开发者ID:yunsite,项目名称:xoopsdc,代码行数:34,代码来源:show.php


示例2: fetchSummary

 function fetchSummary($external_link_id)
 {
     //	include_once dirname(dirname(__FILE__)).'/include/common_functions.php' ;
     global $forum_id;
     $db =& Database::getInstance();
     $myts =& MyTextsanitizer::getInstance();
     $module_handler =& xoops_gethandler('module');
     $module =& $module_handler->getByDirname($this->mydirname);
     $config_handler =& xoops_gethandler('config');
     $configs = $config_handler->getConfigList($module->mid());
     $post_id = intval($external_link_id);
     $mydirname = $this->mydirname;
     if (preg_match('/[^0-9a-zA-Z_-]/', $mydirname)) {
         die('Invalid mydirname');
     }
     $xpress_prefix = preg_replace('/wordpress/', 'wp', $mydirname);
     $blog_info = $this->get_comment_blog_info($forum_id);
     // query
     $post_row = $db->fetchArray($db->query("SELECT * FROM " . $blog_info['mb_table_prefix'] . "posts WHERE ID={$post_id}"));
     if (empty($post_row)) {
         return '';
     }
     // dare to convert it irregularly
     $summary = str_replace('&', '&', htmlspecialchars(xoops_substr(strip_tags($post_row['post_content']), 0, 255), ENT_QUOTES));
     $uri = preg_replace('/\\/$/', '', $blog_info['home']);
     $uri .= '/?p=' . $post_row['ID'];
     return array('dirname' => $mydirname . $blog_info['sub_dir'], 'module_name' => $blog_info['blogname'], 'subject' => $post_row['post_title'], 'uri' => $uri, 'summary' => $summary);
 }
开发者ID:nouphet,项目名称:rata,代码行数:28,代码来源:xpressD3commentContent.class.php


示例3: fetchSummary

		function fetchSummary( $external_link_id )
		{
			require_once dirname( dirname(__FILE__) ).'/class/d3downloads.textsanitizer.php' ;

			$db =& Database::getInstance() ;
			$myts =& d3downloadsTextSanitizer::getInstance() ;

			$module_handler =& xoops_gethandler( 'module' ) ;
			$module =& $module_handler->getByDirname( $this->mydirname ) ;

			$lid = intval( $external_link_id ) ;
			$mydirname = $this->mydirname ;
			if( preg_match( '/[^0-9a-zA-Z_-]/' , $mydirname ) ) die( 'Invalid mydirname' ) ;

			$sql = "SELECT lid, cid, title, description, filters FROM ".$db->prefix( $mydirname."_downloads" )." WHERE lid='".$lid."'" ;
			$myrow = $db->fetchArray( $db->query( $sql ) ) ;
			if( empty( $myrow ) ) return '' ;

			$cid = intval( $myrow['cid'] ) ;
			$uri = XOOPS_URL.'/modules/'.$mydirname.'/index.php?page=singlefile&cid='.$cid.'&lid='.$lid ;
			$filters = $myts->makeTboxData4Show( $myrow['filters'] ) ;
			$str = strip_tags( $myts->displayTarea( strip_tags( $myrow['description'] ), 0, 1, 1, 1, 1, $filters ) ) ;
			$summary = xoops_substr( $str , 0 , 255 ) ;

			return array(
				'dirname' => $mydirname ,
				'module_name' => $module->getVar( 'name' ) ,
				'subject' => $myts->makeTboxData4Show( $myrow['title'] ) ,
				'uri' => $uri ,
				'summary' => $summary ,
			) ;
		}
开发者ID:nunoluciano,项目名称:uxcl,代码行数:32,代码来源:d3downloadsComment.class.php


示例4: fetchSummary

function fetchSummary( $external_link_id )
{
	$db =& Database::getInstance() ;
	$myts =& MyTextSanitizer::getInstance();
	
	$module_handler =& xoops_gethandler( 'module' ) ;
	$module =& $module_handler->getByDirname( $this->mydirname ) ;
	
	$entryID = intval( $external_link_id ) ;
	$mydirname = $this->mydirname ;
	if( preg_match( '/[^0-9a-zA-Z_-]/' , $mydirname ) ) die( 'Invalid mydirname' ) ;

	$content_row = $db->fetchArray( $db->query( "SELECT * FROM ".$db->prefix($mydirname."_ent")." WHERE entryID =$entryID" ) ) ;
	if( empty( $content_row ) ) return '' ;

	$categoryID = $content_row['categoryID'];
	$definition = $content_row['definition'];
	$_html = $content_row['html'];
	$_smiley = $content_row['smiley'];
	$_xcodes = $content_row['xcodes'];
	$_breaks = $content_row['breaks'];
	
	$str = strip_tags($myts->displayTarea($content_row['definition'],$_html,$_smiley,$_xcodes,$_breaks));
	$summary = xoops_substr( $str , 0 , 255 );

	$uri = XOOPS_URL.'/modules/'.$mydirname.'/entry.php?&entryID='.$entryID.'&categoryID='.$categoryID;

	return array(
		'dirname' => $mydirname ,
		'module_name' => $module->getVar( 'name' ) ,
		'subject' => $myts->makeTboxData4Show( $content_row['term'] ) ,
		'uri' => $uri,
		'summary' => $summary,
	) ;
}
开发者ID:nunoluciano,项目名称:uxcl,代码行数:35,代码来源:xwordsD3commentContent.class.php


示例5: createUploadName

 function createUploadName($folder, $filename, $trimname = false)
 {
     $workingfolder = $folder;
     if (xoops_substr($workingfolder, strlen($workingfolder) - 1, 1) != '/') {
         $workingfolder .= '/';
     }
     $ext = basename($filename);
     $ext = explode('.', $ext);
     $ext = '.' . $ext[count($ext) - 1];
     $true = true;
     while ($true) {
         $ipbits = explode(".", $_SERVER["REMOTE_ADDR"]);
         list($usec, $sec) = explode(" ", microtime());
         $usec = (int) ($usec * 65536);
         $sec = (int) $sec & 0xffff;
         if ($trimname) {
             $uid = sprintf("%06x%04x%04x", $ipbits[0] << 24 | $ipbits[1] << 16 | $ipbits[2] << 8 | $ipbits[3], $sec, $usec);
         } else {
             $uid = sprintf("%08x-%04x-%04x", $ipbits[0] << 24 | $ipbits[1] << 16 | $ipbits[2] << 8 | $ipbits[3], $sec, $usec);
         }
         if (!file_exists($workingfolder . $uid . $ext)) {
             $true = false;
         }
     }
     return $uid . $ext;
 }
开发者ID:BackupTheBerlios,项目名称:haxoo-svn,代码行数:26,代码来源:class.sfiles.php


示例6: fetchSummary

 function fetchSummary($external_link_id)
 {
     global $xoopsDB, $xoopsConfig, $xoopsUser;
     $myts =& MyTextSanitizer::getInstance();
     $module_handler =& xoops_gethandler('module');
     $module =& $module_handler->getByDirname($this->mydirname);
     $eventcomment_id = intval($external_link_id);
     $mydirname = $this->mydirname;
     if (!preg_match('/^(\\D+)(\\d*)$/', $mydirname, $regs)) {
         die('Invalid mydirname');
     }
     $mydirnumber = $regs[2] === '' ? '' : intval($regs[2]);
     $table_event = $xoopsDB->prefix("pical{$mydirnumber}_event");
     $MOD_PATH = XOOPS_ROOT_PATH . '/modules/' . $mydirname;
     if (!class_exists('piCal_xoops')) {
         require_once $MOD_PATH . '/class/piCal.php';
         require_once $MOD_PATH . '/class/piCal_xoops.php';
     }
     $cal = new piCal_xoops('', $xoopsConfig['language'], true);
     include $MOD_PATH . '/include/read_configs.php';
     $whr_categories = $cal->get_where_about_categories();
     $whr_class = $cal->get_where_about_class();
     $content_row = $xoopsDB->fetchArray($xoopsDB->query("SELECT id, summary, description FROM {$table_event} WHERE id={$eventcomment_id} AND ({$whr_categories}) AND ({$whr_class})"));
     if (empty($content_row)) {
         redirect_header(XOOPS_URL . '/user.php', 3, _NOPERM);
         exit;
     }
     $subject = $myts->makeTboxData4Show($content_row['summary']);
     //HACK by domifara
     //			$uri = XOOPS_URL.'/modules/'.$mydirname.'/index.php?action=View&amp;event_id='.$eventcomment_id;
     $uri = XOOPS_URL . '/modules/' . $mydirname . '/index.php?action=View&event_id=' . $eventcomment_id;
     $str = strip_tags($myts->displayTarea(strip_tags($content_row['description'])));
     $summary = xoops_substr($str, 0, 255);
     return array('dirname' => $mydirname, 'module_name' => $module->getVar('name'), 'subject' => $subject, 'uri' => $uri, 'summary' => $summary);
 }
开发者ID:nunoluciano,项目名称:uxcl,代码行数:35,代码来源:piCalD3commentContent.class.php


示例7: get_set4sql

 function get_set4sql($value, $col)
 {
     switch ($col['type']) {
         case 'text':
         case 'blob':
             if (get_magic_quotes_gpc()) {
                 $value = stripslashes($value);
             }
             $length = empty($col['length']) ? 65535 : intval($col['length']);
             return "`{$col['name']}`='" . addslashes(xoops_substr($value, 0, $length)) . "'";
         case 'char':
         case 'varchar':
         case 'string':
             if (get_magic_quotes_gpc()) {
                 $value = stripslashes($value);
             }
             $length = empty($col['length']) ? 255 : intval($col['length']);
             return "`{$col['name']}`='" . addslashes(xoops_substr($value, 0, $length)) . "'";
         case 'int':
         case 'integer':
             $value = intval($value);
             if (!empty($col['max'])) {
                 $value = min($value, intval($col['max']));
             }
             if (!empty($col['min'])) {
                 $value = max($value, intval($col['min']));
             }
             return "`{$col['name']}`={$value}";
     }
 }
开发者ID:BackupTheBerlios,项目名称:peakxoops-svn,代码行数:30,代码来源:d3utilities.php


示例8: fetchSummary

 function fetchSummary($external_link_id)
 {
     $myts =& MyTextsanitizer::getInstance();
     $module_handler =& xoops_gethandler('module');
     $module =& $module_handler->getByDirname($this->mydirname);
     $config_handler =& xoops_gethandler('config');
     $configs = $config_handler->getConfigList($module->mid());
     // external_link_id means $content_id
     $content_id = intval($external_link_id);
     $mydirname = $this->mydirname;
     if (preg_match('/[^0-9a-zA-Z_-]/', $mydirname)) {
         die('Invalid mydirname');
     }
     // get categoryObject and contentObject
     list($categoryObj, $contentObj) = pico_common_get_objects_from_content_id($mydirname, $content_id);
     // existence check
     if (!is_object($categoryObj) || !is_object($contentObj)) {
         return '';
     }
     // permission check
     $content_data = $contentObj->getData();
     if (empty($content_data['can_read'])) {
         return '';
     }
     // dare to convert it irregularly
     $summary = str_replace('&amp;', '&', htmlspecialchars(xoops_substr(strip_tags($content_data['body_cached']), 0, 255), ENT_QUOTES));
     return array('dirname' => $mydirname, 'module_name' => $module->getVar('name'), 'subject' => $myts->makeTboxData4Show($content_data['subject_raw'], 1, 1), 'uri' => XOOPS_URL . '/modules/' . $mydirname . '/' . pico_common_make_content_link4html($configs, $content_data), 'summary' => $summary);
 }
开发者ID:BackupTheBerlios,项目名称:peakxoops-svn,代码行数:28,代码来源:PicoD3commentContent.class.php


示例9: plzxoo_block_answers_show

function plzxoo_block_answers_show($options)
{
    $max_rows = empty($options[1]) ? 5 : intval($options[1]);
    // 表示件数
    $longest_subject = empty($options[2]) ? 50 : intval($options[2]);
    // 質問名の最大長
    $single_answer_per_question = empty($options[3]) ? false : true;
    // 締め切った質問も表示するか
    $category_limit = preg_match('/^[0-9, ]+$/', @$options[4]) ? $options[4] : 0;
    // category limit
    $order_by_modified = empty($options[5]) ? false : true;
    // order by input_date(0) or modified_date(1)
    $db =& Database::getInstance();
    if ($single_answer_per_question) {
        $grp_single = 'GROUP BY a.qid';
        $select_input_date = 'MAX(a.input_date) AS max_input_date';
        $select_modified_date = 'MAX(a.modified_date) AS max_modified_date';
        $odr_1st = $order_by_modified ? 'max_modified_date DESC' : 'max_input_date DESC';
    } else {
        $grp_single = '';
        $select_input_date = 'a.input_date';
        $select_modified_date = 'a.modified_date';
        $odr_1st = $order_by_modified ? 'a.modified_date DESC' : 'a.input_date DESC';
    }
    $whr_category = $category_limit ? 'q.cid IN (' . $category_limit . ')' : '1';
    $result = $db->query("SELECT q.subject,q.qid,q.cid,c.name,q.uid,u.uname,q.size,a.uid,{$select_input_date},{$select_modified_date},a.body FROM " . $db->prefix("plzxoo_answer") . " a LEFT JOIN " . $db->prefix("plzxoo_question") . " q ON q.qid=a.qid LEFT JOIN " . $db->prefix("plzxoo_category") . " c ON q.cid=c.cid LEFT JOIN " . $db->prefix("users") . " u ON a.uid=u.uid WHERE ({$whr_category}) AND q.status IN (1,2) {$grp_single} ORDER BY {$odr_1st} LIMIT {$max_rows}");
    $ret = array('dummy' => true);
    while (list($question_subject, $qid, $cid, $category_name, $question_uid, $answer_uname, $answer_num, $answer_uid, $input_date, $modified_date, $answer_body) = $db->fetchRow($result)) {
        $ret['answers'][] = array('question_subject' => htmlspecialchars(xoops_substr($question_subject, 0, $longest_subject), ENT_QUOTES), 'qid' => intval($qid), 'cid' => intval($cid), 'input_date' => intval($input_date), 'input_date_formatted' => formatTimestamp($input_date, 'm'), 'input_date_utime' => xoops_getUserTimestamp($input_date), 'modified_date' => intval($modified_date), 'modified_date_formatted' => formatTimestamp($modified_date, 'm'), 'modified_date_utime' => xoops_getUserTimestamp($modified_date), 'category_name' => htmlspecialchars($category_name, ENT_QUOTES), 'question_uid' => intval($question_uid), 'answer_uname' => htmlspecialchars($answer_uname, ENT_QUOTES), 'answer_num' => intval($answer_num), 'answer_uid' => intval($answer_uid), 'answer_body' => intval($answer_body));
    }
    return $ret;
}
开发者ID:BackupTheBerlios,项目名称:peakxoops-svn,代码行数:32,代码来源:plzxoo_block_answers.php


示例10: assignVar

 function assignVar($key, $value)
 {
     $vars =& $this->mVars[$key];
     if (!isset($vars)) {
         return;
     }
     switch ($vars['data_type']) {
         case XOBJ_DTYPE_BOOL:
             $vars['value'] = $value ? 1 : 0;
             return;
         case XOBJ_DTYPE_INT:
             $vars['value'] = $value !== null ? (int) $value : null;
             return;
         case XOBJ_DTYPE_FLOAT:
             $vars['value'] = $value !== null ? (double) $value : null;
             return;
         case XOBJ_DTYPE_STRING:
             $len = $vars['maxlength'];
             $vars['value'] = $len !== null && strlen($value) > $len ? xoops_substr($value, 0, $len, null) : $value;
             return;
         case XOBJ_DTYPE_TEXT:
             $vars['value'] = $value;
             return;
     }
 }
开发者ID:nobunobuta,项目名称:xoopscube,代码行数:25,代码来源:object.php


示例11: fetchSummary

 function fetchSummary($external_link_id)
 {
     $db =& Database::getInstance();
     $myts =& MyTextsanitizer::getInstance();
     $module_handler =& xoops_gethandler('module');
     $module =& $module_handler->getByDirname($this->mydirname);
     $storyid = intval($external_link_id);
     $mydirname = $this->mydirname;
     if (preg_match('/[^0-9a-zA-Z_-]/', $mydirname)) {
         die('Invalid mydirname');
     }
     $mytrustdirpath = dirname(dirname(__FILE__));
     require_once dirname(dirname(__FILE__)) . '/class/bulletin.php';
     if (Bulletin::isPublishedExists($mydirname, $storyid)) {
         $article = new Bulletin($mydirname, $storyid);
         $subject4assign = $article->getVar('title');
         $summary = $article->getVar('hometext');
         if (function_exists('easiestml')) {
             $summary = easiestml($summary);
         }
         $summary4assign = htmlspecialchars(xoops_substr($this->unhtmlspecialchars(strip_tags($summary)), 0, 255), ENT_QUOTES);
     } else {
         $subject4assign = '';
         $summary4assign = '';
     }
     return array('dirname' => $mydirname, 'module_name' => $module->getVar('name'), 'subject' => $subject4assign, 'uri' => XOOPS_URL . '/modules/' . $mydirname . '/index.php?page=article&amp;storyid=' . $storyid, 'summary' => $summary4assign);
 }
开发者ID:nouphet,项目名称:rata,代码行数:27,代码来源:BulletinD3commentStory.class.php


示例12: publisher_search

/**
 * @param        $queryarray
 * @param        $andor
 * @param        $limit
 * @param        $offset
 * @param        $userid
 * @param array  $categories
 * @param int    $sortby
 * @param string $searchin
 * @param string $extra
 *
 * @return array
 */
function publisher_search($queryarray, $andor, $limit, $offset, $userid, $categories = array(), $sortby = 0, $searchin = '', $extra = '')
{
    $publisher =& PublisherPublisher::getInstance();
    $ret = array();
    if ($queryarray == '' || count($queryarray) == 0) {
        $hightlightKey = '';
    } else {
        $keywords = implode('+', $queryarray);
        $hightlightKey = '&amp;keywords=' . $keywords;
    }
    $itemsObjs =& $publisher->getHandler('item')->getItemsFromSearch($queryarray, $andor, $limit, $offset, $userid, $categories, $sortby, $searchin, $extra);
    $withCategoryPath = $publisher->getConfig('search_cat_path');
    //xoops_load("xoopslocal");
    $usersIds = array();
    foreach ($itemsObjs as $obj) {
        $item['image'] = 'assets/images/item_icon.gif';
        $item['link'] = $obj->getItemUrl();
        $item['link'] .= !empty($hightlightKey) && strpos($item['link'], '.php?') === false ? '?' . ltrim($hightlightKey, '&amp;') : $hightlightKey;
        if ($withCategoryPath) {
            $item['title'] = $obj->getCategoryPath(false) . ' > ' . $obj->getTitle();
        } else {
            $item['title'] = $obj->getTitle();
        }
        $item['time'] = $obj->getVar('datesub');
        //must go has unix timestamp
        $item['uid'] = $obj->uid();
        //"Fulltext search/highlight
        $text = $obj->getBody();
        $sanitizedText = '';
        $textLower = strtolower($text);
        $queryarray = is_array($queryarray) ? $queryarray : array($queryarray);
        if ($queryarray[0] != '' && count($queryarray) > 0) {
            foreach ($queryarray as $query) {
                $pos = strpos($textLower, strtolower($query));
                //xoops_local("strpos", $textLower, strtolower($query));
                $start = max($pos - 100, 0);
                $length = strlen($query) + 200;
                //xoops_local("strlen", $query) + 200;
                $context = $obj->highlight(xoops_substr($text, $start, $length, ' [...]'), $query);
                $sanitizedText .= '<p>[...] ' . $context . '</p>';
            }
        }
        //End of highlight
        $item['text'] = $sanitizedText;
        $item['author'] = $obj->author_alias();
        $item['datesub'] = $obj->getDatesub($publisher->getConfig('format_date'));
        $usersIds[$obj->uid()] = $obj->uid();
        $ret[] = $item;
        unset($item, $sanitizedText);
    }
    xoops_load('XoopsUserUtility');
    $usersNames = XoopsUserUtility::getUnameFromIds($usersIds, $publisher->getConfig('format_realname'), true);
    foreach ($ret as $key => $item) {
        if ($item['author'] == '') {
            $ret[$key]['author'] = isset($usersNames[$item['uid']]) ? $usersNames[$item['uid']] : '';
        }
    }
    unset($usersNames, $usersIds);
    return $ret;
}
开发者ID:trabisdementia,项目名称:publisher,代码行数:73,代码来源:search.inc.php


示例13: assignVar

 function assignVar($key, $value)
 {
     $vars =& $this->mVars[$key];
     if (!isset($vars)) {
         return;
     }
     switch ($vars['data_type']) {
         case XOBJ_DTYPE_BOOL:
             $vars['value'] = $value ? 1 : 0;
             break;
         case XOBJ_DTYPE_INT:
             $vars['value'] = $value !== null ? intval($value) : null;
             break;
         case XOBJ_DTYPE_FLOAT:
             $vars['value'] = $value !== null ? floatval($value) : null;
             break;
         case XOBJ_DTYPE_STRING:
             if ($vars['maxlength'] !== null && strlen($value) > $vars['maxlength']) {
                 $vars['value'] = xoops_substr($value, 0, $vars['maxlength'], null);
             } else {
                 $vars['value'] = $value;
             }
             break;
         case XOBJ_DTYPE_TEXT:
             $vars['value'] = $value;
             break;
     }
 }
开发者ID:nouphet,项目名称:rata,代码行数:28,代码来源:object.php


示例14: fetchSummary

 function fetchSummary($external_link_id)
 {
     $db =& Database::getInstance();
     $myts =& MyTextsanitizer::getInstance();
     $module_handler =& xoops_gethandler('module');
     $module =& $module_handler->getByDirname($this->mydirname);
     $aid = intval($external_link_id);
     $mydirname = $this->mydirname;
     if (preg_match('/[^0-9a-zA-Z_-]/', $mydirname)) {
         die('Invalid mydirname');
     }
     // language constants
     @(include XOOPS_ROOT_PATH . '/modules/' . $mydirname . '/language/' . @$GLOBALS['xoopsConfig']['language'] . '/main.php');
     if (!defined('_MD_PLZXOO_LANG_QUESTION')) {
         @(include XOOPS_ROOT_PATH . '/modules/' . $mydirname . '/language/english/main.php');
     }
     // query
     $myrow = $db->fetchArray($db->query("SELECT a.uid AS answer_uid,a.body AS answer_body,a.comment,q.subject,q.uid AS question_uid,q.body AS question_body,q.qid FROM " . $db->prefix("plzxoo_answer") . " a LEFT JOIN " . $db->prefix("plzxoo_question") . " q ON a.qid=q.qid WHERE aid={$aid}"));
     $comment = array('dirname' => $mydirname, 'module_name' => $module->getVar('name'), 'question' => array('id' => intval($myrow['qid']), 'uid' => intval($myrow['question_uid']), 'subject' => $myts->makeTboxData4Show($myrow['subject']), 'body' => htmlspecialchars(xoops_substr(strip_tags($myrow['question_body']), 0, 255), ENT_QUOTES)), 'answer' => array('id' => $aid, 'uid' => intval($myrow['answer_uid']), 'body' => htmlspecialchars(xoops_substr(strip_tags($myrow['answer_body']), 0, 255), ENT_QUOTES), 'comment' => htmlspecialchars(xoops_substr(strip_tags($myrow['comment']), 0, 255), ENT_QUOTES)));
     include_once XOOPS_ROOT_PATH . '/class/template.php';
     $tpl =& new XoopsTpl();
     $tpl->assign('comment', $comment);
     $ret = $tpl->fetch('db:plzxoo_d3comment_reference.html');
     return $ret;
     /*	return array(
     		'dirname' => $mydirname ,
     		'module_name' => $module->getVar( 'name' ) ,
     		'subject' => $myts->makeTboxData4Show( $myrow['subject'] ) ,
     		'uri' => XOOPS_URL.'/modules/'.$mydirname.'/index.php?action=detail&amp;qid='.intval($myrow['qid']) ,
     		'summary' => htmlspecialchars( xoops_substr( strip_tags( $myrow['body'] ) , 0 , 255 ) , ENT_QUOTES ) ,
     	) ;*/
 }
开发者ID:BackupTheBerlios,项目名称:peakxoops-svn,代码行数:32,代码来源:PlzxooD3commentAnswer.class.php


示例15: b_gnavi_d3pipes_joints

function b_gnavi_d3pipes_joints($options)
{
    global $xoopsDB;
    $mydirname = empty($options[0]) ? basename(dirname(dirname(__FILE__))) : $options[0];
    if (preg_match('/[^0-9a-zA-Z_-]/', $mydirname)) {
        die('Invalid mydirname');
    }
    require dirname(dirname(__FILE__)) . '/include/read_configs.php';
    $cat_limitation = empty($options[1]) ? 0 : 1;
    $photos_num = empty($options[2]) ? 10 : intval($options[2]);
    $show_desc = empty($options[3]) ? 0 : 1;
    $query = "ORDER BY unixtime DESC";
    $title_max_length = 255;
    // Category limitation
    if ($cat_limitation) {
        include_once XOOPS_ROOT_PATH . "/class/xoopstree.php";
        $cattree = new XoopsTree($table_cat, "cid", "pid");
        $children = $cattree->getAllChildId($cat_limitation);
        $whr_cat = "l.cid IN (";
        foreach ($children as $child) {
            $whr_cat .= "{$child},";
        }
        $whr_cat .= "{$cat_limitation})";
        for ($i = 1; $i <= 4; $i++) {
            $whr_cat .= " OR l.cid{$i} IN (";
            foreach ($children as $child) {
                $whr_cat .= "{$child},";
            }
            $whr_cat .= "{$cat_limitation})";
        }
        $whr_cat = "(" . $whr_cat . ")";
    } else {
        $whr_cat = '1';
    }
    $block = array();
    $myts =& MyTextSanitizer::getInstance();
    if ($show_desc) {
        $result = $xoopsDB->query("SELECT l.lid , l.cid , l.title , l.ext , l.res_x , l.res_y , l.submitter , l.status , l.date AS unixtime , l.hits , l.rating , l.votes , l.comments , c.title AS cat_title ,t.description ,t.arrowhtml FROM {$table_photos} l LEFT JOIN {$table_cat} c ON l.cid=c.cid LEFT JOIN {$table_text} t ON l.lid=t.lid WHERE l.status>0 AND {$whr_cat} {$query}", $photos_num, 0);
    } else {
        $result = $xoopsDB->query("SELECT l.lid , l.cid , l.title , l.ext , l.res_x , l.res_y , l.submitter , l.status , l.date AS unixtime , l.hits , l.rating , l.votes , l.comments , c.title AS cat_title FROM {$table_photos} l LEFT JOIN {$table_cat} c ON l.cid=c.cid WHERE l.status>0 AND {$whr_cat} {$query}", $photos_num, 0);
    }
    $count = 1;
    while ($photo = $xoopsDB->fetchArray($result)) {
        $photo['title'] = xoops_substr($myts->makeTboxData4Show($photo['title']), 0, $title_max_length + 3);
        $photo['cat_title'] = $myts->makeTboxData4Show($photo['cat_title']);
        $photo['date'] = formatTimestamp($photo['unixtime'], 's');
        if ($show_desc) {
            $photo['body'] = xoops_substr(strip_tags($myts->displayTarea($photo['description'], $photo['arrowhtml'], 1, 1, 1, 1, 1)), 0, 512);
        } else {
            $photo['body'] = '';
        }
        $photo['date'] = formatTimestamp($photo['unixtime'], 's');
        $block['photo'][$count++] = $photo;
    }
    $block['mod_url'] = $mod_url;
    return $block;
}
开发者ID:nouphet,项目名称:rata,代码行数:57,代码来源:d3pipes.php


示例16: _strcut

 function _strcut($text, $start, $end)
 {
     $text = $this->formatBlogText4Preview($text);
     if (strlen($text) >= $end) {
         $msg = xoops_substr($text, 0, $end - 1);
     } else {
         $msg = $text;
     }
     return $msg;
 }
开发者ID:BackupTheBerlios,项目名称:haxoo-svn,代码行数:10,代码来源:mbfunction.class.php


示例17: b_news_randomnews_show

function b_news_randomnews_show($options)
{
    include_once XOOPS_ROOT_PATH . '/modules/news/include/functions.php';
    $myts =& MyTextSanitizer::getInstance();
    $block = array();
    $block['sort'] = $options[0];
    $tmpstory = new NewsStory();
    $restricted = news_getmoduleoption('restrictindex');
    $dateformat = news_getmoduleoption('dateformat');
    $infotips = news_getmoduleoption('infotips');
    if ($dateformat == '') {
        $dateformat = 's';
    }
    if ($options[4] == 0) {
        $stories = $tmpstory->getRandomNews($options[1], 0, $restricted, 0, 1, $options[0]);
    } else {
        $topics = array_slice($options, 4);
        $stories = $tmpstory->getRandomNews($options[1], 0, $restricted, $topics, 1, $options[0]);
    }
    unset($tmpstory);
    if (count($stories) == 0) {
        return '';
    }
    foreach ($stories as $story) {
        $news = array();
        $title = $story->title();
        if (strlen($title) > $options[2]) {
            $title = xoops_substr($title, 0, $options[2] + 3);
        }
        $news['title'] = $title;
        $news['id'] = $story->storyid();
        $news['date'] = formatTimestamp($story->published(), $dateformat);
        $news['hits'] = $story->counter();
        $news['rating'] = $story->rating();
        $news['votes'] = $story->votes();
        $news['author'] = sprintf("%s %s", _POSTEDBY, $story->uname());
        $news['topic_title'] = $story->topic_title();
        $news['topic_color'] = '#' . $myts->displayTarea($story->topic_color);
        if ($options[3] > 0) {
            $html = $story->nohtml() == 1 ? 0 : 1;
            $news['teaser'] = news_truncate_tagsafe($myts->displayTarea($story->hometext, $html), $options[3] + 3);
            $news['infotips'] = '';
        } else {
            $news['teaser'] = '';
            if ($infotips > 0) {
                $news['infotips'] = ' title="' . news_make_infotips($story->hometext()) . '"';
            } else {
                $news['infotips'] = '';
            }
        }
        $block['stories'][] = $news;
    }
    $block['lang_read_more'] = _MB_READMORE;
    return $block;
}
开发者ID:BackupTheBerlios,项目名称:haxoo-svn,代码行数:55,代码来源:news_randomnews.php


示例18: fetchSummary

 function fetchSummary($external_link_id)
 {
     $db =& Database::getInstance();
     $myts =& MyTextSanitizer::getInstance();
     $module_handler =& xoops_gethandler('module');
     $module =& $module_handler->getByDirname($this->mydirname);
     $myalbum_id = intval($external_link_id);
     $mydirname = $this->mydirname;
     if (preg_match('/[^0-9a-zA-Z_-]/', $mydirname)) {
         die('Invalid mydirname');
     }
     $MOD_PATH = XOOPS_ROOT_PATH . '/modules/' . $mydirname;
     include $MOD_PATH . '/include/read_configs.php';
     $content_row = $db->fetchArray($db->query("SELECT p.lid, p.title, p.ext, p.res_x, p.res_y, t.description FROM {$table_photos} p, {$table_text} t WHERE p.lid=t.lid and p.lid={$myalbum_id}"));
     if (empty($content_row)) {
         return '';
     }
     $title = $myts->makeTboxData4Show($content_row['title']);
     $lid = intval($content_row['lid']);
     $ext = $content_row['ext'];
     $window_x = intval($content_row['res_x']);
     $window_y = intval($content_row['res_y']);
     $image_target = $photos_url . '/' . $lid . '.' . $ext;
     $photos_image = $thumbs_dir . '/' . $lid . '.' . $ext;
     $icons_image = $MOD_PATH . '/icons/' . $ext . '.gif';
     if (file_exists($photos_image)) {
         $image_url = $thumbs_url . '/' . $lid . '.' . $ext;
         $size = getimagesize($photos_image);
         if ($size) {
             $width = intval($size[0]);
             $height = intval($size[1]);
             $image_tag = "<a href=\"{$image_target}\" target=\"blank\" onClick=\"window.open('{$image_target}','','width={$window_x},height={$window_y}');return(false);\"><img src=\"{$image_url}\" width=\"{$width}\" height=\"{$height}\" alt=\"{$title}\" title=\"{$title}\" align=\"left\" /></a>";
         }
     } elseif (file_exists($icons_image)) {
         $image_url = XOOPS_URL . '/modules/' . $mydirname . '/icons/' . $ext . '.gif';
         $size = getimagesize($icons_image);
         if ($size) {
             $width = intval($size[0]);
             $height = intval($size[1]);
             $image_tag = "<a href=\"{$image_target}\" target=\"blank\"><img src=\"{$image_url}\" width=\"{$width}\" height=\"{$height}\" alt=\"{$title}\" title=\"{$title}\" align=\"left\" /></a>";
         }
     }
     $desc = '';
     if ($content_row['description']) {
         $str = strip_tags($myts->displayTarea(strip_tags($content_row['description'])));
         $desc = xoops_substr($str, 0, 255);
     }
     if ($desc && $image_tag) {
         $summary = $image_tag . $desc;
     } elseif (!$desc && $image_tag) {
         $summary = $image_tag;
     }
     return array('dirname' => $mydirname, 'module_name' => $module->getVar('name'), 'subject' => $title, 'uri' => XOOPS_URL . '/modules/' . $mydirname . '/photo.php?lid=' . $myalbum_id, 'summary' => $summary);
 }
开发者ID:nouphet,项目名称:myalbum-n,代码行数:54,代码来源:myalbumD3commentContent.class.php


示例19: smarty_modifier_mb_truncate

function smarty_modifier_mb_truncate($string, $length = 80, $etc = '...')
{
    if ($length <= 0) {
        return '';
    }
    if (!empty($string) && strlen($string) > $length) {
        return xoops_substr($string, 0, $length, $etc = '...');
    } else {
        return $string;
    }
}
开发者ID:naao,项目名称:d3diary,代码行数:11,代码来源:modifier.mb_truncate.php


示例20: reassign

 function reassign($data)
 {
     $entries = array();
     if (is_array($data)) {
         foreach ($data['recentArr'] as $item) {
             $entry = array('pubtime' => $item->getShow('published'), 'link' => XOOPS_MODULE_URL . '/chalog/?action=BlogView&id=' . $item->getShow('id'), 'headline' => $item->getShow('title'), 'description' => xoops_substr(strip_tags($item->getShow('comment')), 0, 255), 'allow_html' => true);
             $entry['fingerprint'] = $entry['link'];
             $entries[] = $entry;
         }
     }
     return $entries;
 }
开发者ID:nouphet,项目名称:rata,代码行数:12,代码来源:D3pipesBlockChaloglist.class.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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