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


PHP stringToArray函数代码示例

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


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

示例1: formatValue

 /**
  * Formata o valor
  * @param mixed $value
  * @param string $type
  * @param boolean $formatar
  * @return mixed
  */
 function formatValue($value, $type, $formatar)
 {
     switch (strtolower($type)) {
         case 'data':
         case 'dt':
         case 'date':
             $value = Date::data((string) $value);
             return $formatar ? Date::formatData($value) : $value;
             break;
         case 'timestamp':
         case 'datatime':
             $value = Date::timestamp((string) $value);
             return $formatar ? Date::formatDataTime($value) : $value;
             break;
         case 'real':
             return $formatar ? Number::real($value) : Number::float($value, 2);
         case 'hide':
             return $formatar ? null : $value;
             break;
         case 'array':
             return $formatar ? stringToArray($value) : arrayToString($value);
             break;
         default:
             return $value;
     }
 }
开发者ID:jhonlennon,项目名称:estrutura-mvc,代码行数:33,代码来源:ValueObject.class.php

示例2: checkNumber

function checkNumber($n, $maxNumber)
{
    if (isMax(stringToArray($n), $maxNumber)) {
        echo "\n\nnot possible and max is {$n}\n\n";
    } else {
        $n++;
        $new = stringToArray($n);
        sort($new);
        if ($new == $compairNumber) {
            echo "\n\nThe next number is {$n}\n\n";
        } else {
            checkNumber($n, $maxNumber);
        }
    }
}
开发者ID:sprov03,项目名称:Codeup-Web-Exercises,代码行数:15,代码来源:five.php

示例3: mostOftenCharacter

function mostOftenCharacter($string)
{
    $myArray = stringToArray($string);
    $resultArray = array();
    $k = 0;
    $counts = array_count_values($myArray);
    foreach ($myArray as $value) {
        $maxRepeat = $counts[$myArray[$k]];
        $resultArray[0] = $counts[$myArray[0]];
        if ($resultArray[0] < $counts[$myArray[$k]]) {
            $resultArray[0] = $myArray[$k];
            $resultArray[1] = $counts[$myArray[$k]];
        } else {
            $resultArray[0] = $myArray[0];
            $resultArray[1] = $counts[$myArray[0]];
        }
        $k++;
    }
    return $resultArray;
}
开发者ID:glinskiwieslaw,项目名称:ZadaniaDodatkowePHP_katas-2016-01-21,代码行数:20,代码来源:najczestrza_litera.php

示例4: _getPage

 function _getPage($userId, $params, $cacheSetting)
 {
     if (!$cacheSetting) {
         # MVC initalization script
         if (!defined('DS')) {
             define('DS', DIRECTORY_SEPARATOR);
         }
         require 'components' . DS . 'com_jreviews' . DS . 'jreviews' . DS . 'framework.php';
     }
     Configure::write('Libraries.disableJS', array('jquery'));
     # Populate $params array with module settings
     $eParams['page'] = 1;
     $eParams['user'] = $userId;
     $eParams['module'] = stringToArray($params->_raw);
     $eParams['module']['community'] = true;
     $eParams['module_id'] = 'plugin_myfavorites' . $userId;
     $eParams['page'] = 1;
     $eParams['data']['module'] = true;
     $eParams['data']['controller'] = 'community_listings';
     $eParams['data']['action'] = 'favorites';
     $eParams['data']['module_limit'] = $params->get('limit', 10);
     $Dispatcher = new S2Dispatcher('jreviews', true, false);
     return $Dispatcher->dispatch($eParams);
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:24,代码来源:jreviews_myfavorites.php

示例5: getFieldsArray


//.........这里部分代码省略.........
             $query = "SELECT Listing.contentid AS element_id," . implode(',', $fieldNames) . "\n FROM #__jreviews_content AS Listing" . "\n WHERE Listing.contentid IN (" . $element_ids . ")";
             $this->_db->setQuery($query);
             $fieldValues = $this->_db->loadObjectList('element_id');
             break;
         case 'review':
             $query = "SELECT Review.reviewid AS element_id," . implode(',', $fieldNames) . "\n FROM #__jreviews_review_fields AS Review" . "\n WHERE Review.reviewid IN (" . $element_ids . ")";
             $this->_db->setQuery($query);
             $fieldValues = $this->_db->loadObjectList('element_id');
             break;
     }
     # Now for each option field add array of selected value,text,images
     $elementFields = array();
     if (!empty($fieldValues)) {
         foreach ($fieldValues as $fieldValue) {
             $fieldValue = (array) $fieldValue;
             foreach ($fieldValue as $key => $value) {
                 if ($key != 'element_id' && $value != '' && isset($rows[$key])) {
                     !in_array($rows[$key]->{'Field.type'}, array('textarea', 'code')) and $value = htmlspecialchars($value, ENT_QUOTES, 'UTF-8');
                     if ($rows[$key]->{'Field.type'} != 'date' || $rows[$key]->{'Field.type'} == 'date' && $value != NULL_DATE) {
                         $elementFields[$fieldValue['element_id']]['field_id'] = $fieldRows[$key]['Field.field_id'];
                         if (!in_array($rows[$key]->{'Field.type'}, $optionFields)) {
                             $elementFields[$fieldValue['element_id']][$key]['Field.text'][] = $value;
                             $elementFields[$fieldValue['element_id']][$key]['Field.value'][] = $value;
                             $elementFields[$fieldValue['element_id']][$key]['Field.image'][] = '';
                         } elseif (in_array($rows[$key]->{'Field.type'}, $optionFields)) {
                             $fieldOptions = $this->fieldOptions[$rows[$key]->{'Field.field_id'}];
                             $selOptions = explode('*', $value);
                             foreach ($selOptions as $selOption) {
                                 if (isset($fieldOptions[$selOption])) {
                                     $elementFields[$fieldValue['element_id']][$key]['Field.value'][] = $fieldOptions[$selOption]->value;
                                     $elementFields[$fieldValue['element_id']][$key]['Field.text'][] = $fieldOptions[$selOption]->text;
                                     $elementFields[$fieldValue['element_id']][$key]['Field.image'][] = $fieldOptions[$selOption]->image;
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     // Reformat array so array keys match element ids
     foreach ($elementFields as $key => $elementField) {
         $element_id = $key;
         $field_id = $elementField['field_id'];
         unset($elementField['field_id']);
         $field_name = key($elementField);
         foreach ($elementField as $field_name => $field_options) {
             //FieldGroups array
             $fields[$element_id][$fieldRows[$field_name]['Group.name']]['Group']['group_id'] = $fieldRows[$field_name]['Field.group_id'];
             $fields[$element_id][$fieldRows[$field_name]['Group.name']]['Group']['title'] = $fieldRows[$field_name]['Group.title'];
             $fields[$element_id][$fieldRows[$field_name]['Group.name']]['Group']['name'] = $fieldRows[$field_name]['Group.name'];
             $fields[$element_id][$fieldRows[$field_name]['Group.name']]['Group']['show_title'] = $fieldRows[$field_name]['Group.showTitle'];
             $fields[$element_id][$fieldRows[$field_name]['Group.name']]['Fields'][$fieldRows[$field_name]['Field.name']]['id'] = $field_id;
             $fields[$element_id][$fieldRows[$field_name]['Group.name']]['Fields'][$fieldRows[$field_name]['Field.name']]['group_id'] = $fieldRows[$field_name]['Field.group_id'];
             $fields[$element_id][$fieldRows[$field_name]['Group.name']]['Fields'][$fieldRows[$field_name]['Field.name']]['name'] = $fieldRows[$field_name]['Field.name'];
             $fields[$element_id][$fieldRows[$field_name]['Group.name']]['Fields'][$fieldRows[$field_name]['Field.name']]['type'] = $fieldRows[$field_name]['Field.type'];
             $fields[$element_id][$fieldRows[$field_name]['Group.name']]['Fields'][$fieldRows[$field_name]['Field.name']]['title'] = $fieldRows[$field_name]['Field.title'];
             $fields[$element_id][$fieldRows[$field_name]['Group.name']]['Fields'][$fieldRows[$field_name]['Field.name']]['description'] = $fieldRows[$field_name]['Field.description'];
             // Field values
             $fields[$element_id][$fieldRows[$field_name]['Group.name']]['Fields'][$fieldRows[$field_name]['Field.name']]['value'] = $field_options['Field.value'];
             $fields[$element_id][$fieldRows[$field_name]['Group.name']]['Fields'][$fieldRows[$field_name]['Field.name']]['text'] = $field_options['Field.text'];
             $fields[$element_id][$fieldRows[$field_name]['Group.name']]['Fields'][$fieldRows[$field_name]['Field.name']]['image'] = $field_options['Field.image'];
             $fields[$element_id][$fieldRows[$field_name]['Group.name']]['Fields'][$fieldRows[$field_name]['Field.name']]['properties']['show_title'] = $fieldRows[$field_name]['Field.showTitle'];
             $fields[$element_id][$fieldRows[$field_name]['Group.name']]['Fields'][$fieldRows[$field_name]['Field.name']]['properties']['location'] = $fieldRows[$field_name]['Field.location'];
             $fields[$element_id][$fieldRows[$field_name]['Group.name']]['Fields'][$fieldRows[$field_name]['Field.name']]['properties']['contentview'] = $fieldRows[$field_name]['Field.contentView'];
             $fields[$element_id][$fieldRows[$field_name]['Group.name']]['Fields'][$fieldRows[$field_name]['Field.name']]['properties']['listview'] = $fieldRows[$field_name]['Field.listView'];
             $fields[$element_id][$fieldRows[$field_name]['Group.name']]['Fields'][$fieldRows[$field_name]['Field.name']]['properties']['compareview'] = $fieldRows[$field_name]['Field.compareView'];
             $fields[$element_id][$fieldRows[$field_name]['Group.name']]['Fields'][$fieldRows[$field_name]['Field.name']]['properties']['listsort'] = $fieldRows[$field_name]['Field.listSort'];
             $fields[$element_id][$fieldRows[$field_name]['Group.name']]['Fields'][$fieldRows[$field_name]['Field.name']]['properties']['search'] = $fieldRows[$field_name]['Field.search'];
             $fields[$element_id][$fieldRows[$field_name]['Group.name']]['Fields'][$fieldRows[$field_name]['Field.name']]['properties']['access'] = $fieldRows[$field_name]['Field.access'];
             $fields[$element_id][$fieldRows[$field_name]['Group.name']]['Fields'][$fieldRows[$field_name]['Field.name']]['properties']['access_view'] = $fieldRows[$field_name]['Field.accessView'];
             //FieldPairs associative array with field name as key and field value as value
             $field_pairs[$element_id][$fieldRows[$field_name]['Field.name']]['group_id'] = $fieldRows[$field_name]['Field.group_id'];
             $field_pairs[$element_id][$fieldRows[$field_name]['Field.name']]['group_show_title'] = $fieldRows[$field_name]['Group.showTitle'];
             $field_pairs[$element_id][$fieldRows[$field_name]['Field.name']]['group_title'] = $fieldRows[$field_name]['Group.title'];
             $field_pairs[$element_id][$fieldRows[$field_name]['Field.name']]['group_name'] = $fieldRows[$field_name]['Group.name'];
             $field_pairs[$element_id][$fieldRows[$field_name]['Field.name']]['name'] = $fieldRows[$field_name]['Field.name'];
             $field_pairs[$element_id][$fieldRows[$field_name]['Field.name']]['title'] = $fieldRows[$field_name]['Field.title'];
             $field_pairs[$element_id][$fieldRows[$field_name]['Field.name']]['value'] = $field_options['Field.value'];
             $field_pairs[$element_id][$fieldRows[$field_name]['Field.name']]['text'] = $field_options['Field.text'];
             $field_pairs[$element_id][$fieldRows[$field_name]['Field.name']]['image'] = $field_options['Field.image'];
             $field_pairs[$element_id][$fieldRows[$field_name]['Field.name']]['type'] = $fieldRows[$field_name]['Field.type'];
             $field_pairs[$element_id][$fieldRows[$field_name]['Field.name']]['properties']['show_title'] = $fieldRows[$field_name]['Field.showTitle'];
             $field_pairs[$element_id][$fieldRows[$field_name]['Field.name']]['properties']['location'] = $fieldRows[$field_name]['Field.location'];
             $field_pairs[$element_id][$fieldRows[$field_name]['Field.name']]['properties']['contentview'] = $fieldRows[$field_name]['Field.contentView'];
             $field_pairs[$element_id][$fieldRows[$field_name]['Field.name']]['properties']['listview'] = $fieldRows[$field_name]['Field.listView'];
             $field_pairs[$element_id][$fieldRows[$field_name]['Field.name']]['properties']['compareview'] = $fieldRows[$field_name]['Field.compareView'];
             $field_pairs[$element_id][$fieldRows[$field_name]['Field.name']]['properties']['listsort'] = $fieldRows[$field_name]['Field.listSort'];
             $field_pairs[$element_id][$fieldRows[$field_name]['Field.name']]['properties']['search'] = $fieldRows[$field_name]['Field.search'];
             $field_pairs[$element_id][$fieldRows[$field_name]['Field.name']]['properties']['access'] = $fieldRows[$field_name]['Field.access'];
             $field_pairs[$element_id][$fieldRows[$field_name]['Field.name']]['properties']['access_view'] = $fieldRows[$field_name]['Field.accessView'];
             $properties = stringToArray($fieldRows[$field_name]['Field.params']);
             $fields[$element_id][$fieldRows[$field_name]['Group.name']]['Fields'][$fieldRows[$field_name]['Field.name']]['properties'] = array_merge($fields[$element_id][$fieldRows[$field_name]['Group.name']]['Fields'][$fieldRows[$field_name]['Field.name']]['properties'], $properties);
             $field_pairs[$element_id][$fieldRows[$field_name]['Field.name']]['properties'] = array_merge($field_pairs[$element_id][$fieldRows[$field_name]['Field.name']]['properties'], $properties);
             //$params = explode("\n",$fieldRows[$field_name]['Field.params']);
         }
     }
     $this->custom_fields = $fields;
     $this->field_pairs = $field_pairs;
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:101,代码来源:field.php

示例6: defined

<?php

/**
 * jReviews - Reviews Extension
 * Copyright (C) 2006 ClickFWD LLC
 * This is not free software, do not distribute it.
 * For licencing information visit http://www.reviewsforjoomla.com
 * or contact sales@reviewsforjoomla.com
**/
defined('_VALID_MOS') || defined('_JEXEC') or die('Direct Access to this location is not allowed.');
# MVC initalization script
require JPATH_SITE . DS . 'components' . DS . 'com_jreviews' . DS . 'jreviews' . DS . 'framework.php';
# Populate $params array with module settings
$module_params = isset($params->_raw) ? stringToArray($params->_raw) : $params->toArray();
$moduleParams['module'] = $module_params;
$moduleParams['module_id'] = $module->id;
$moduleParams['page'] = 1;
$moduleParams['data']['module'] = true;
$moduleParams['data']['controller'] = 'module_totals';
$moduleParams['data']['action'] = 'index';
$moduleParams['token'] = cmsFramework::formIntegrityToken($moduleParams, array('module', 'module_id', 'form', 'data'), false);
$Dispatcher = new S2Dispatcher('jreviews');
echo $Dispatcher->dispatch($moduleParams);
unset($Dispatcher);
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:24,代码来源:totals.php

示例7: elseif

    } else {
        $_GET['url'] = Sanitize::getString($_GET, 'url', 'about');
    }
    /*******************************************************************
     *                         FRONT-END ROUTING
     ******************************************************************/
} elseif ($menu_id && !isset($_POST['data']['controller']) && (!$url || !isset($route['data']['controller']) || preg_match('/^menu\\//', $route['url']['url']))) {
    // If no task is passed in the url, then this is a menu item and we read the menu parameters
    $segments = array();
    $url_param = $url;
    $url = str_replace('menu', '', $url);
    $db = cmsFramework::getDB();
    $query = "SELECT * FROM #__menu WHERE id = " . $menu_id;
    $db->setQuery($query);
    $menu = end($db->loadObjectList());
    $mparams = getCmsVersion() == CMS_JOOMLA16 ? json_decode($menu->params, true) : stringToArray($menu->params);
    if (isset($mparams['action'])) {
        $action = paramsRoute((int) $mparams['action']);
        $_REQUEST['Itemid'] = $_GET['Itemid'] = $menu->id;
        // For default - home page menu
        unset($mparams['action']);
        $menu_params['data'] = $mparams;
        $filters = array('dir' => 'dirid', 'section' => 'sectionid', 'cat' => 'catid', 'criteria' => 'criteriaid');
        foreach ($filters as $key => $key2) {
            $menu_params[$key] = Sanitize::getVar($mparams, $key2);
            is_array($menu_params[$key]) and $menu_params[$key] = implode(',', $menu_params[$key]);
        }
        //        $menu_params['url'] = 'menu';
        $menu_params['data']['component_menu'] = true;
        $menu_params['data']['controller'] = $action[0];
        $menu_params['data']['action'] = $action[1];
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:31,代码来源:index.php

示例8: defined

<?php

/**
 * jReviews - Reviews Extension
 * Copyright (C) 2006 Alejandro Schmeichler
 * This is not free software, do not distribute it.
 * For licencing information visit http://www.reviewsforjoomla.com
 * or contact sales@reviewsforjoomla.com
**/
defined('_VALID_MOS') || defined('_JEXEC') or die('Direct Access to this location is not allowed.');
# MVC initalization script
if (!defined('DS')) {
    define('DS', DIRECTORY_SEPARATOR);
}
if (defined('JPATH_SITE')) {
    $root = JPATH_SITE . DS;
} else {
    global $mainframe;
    $root = $mainframe->getCfg('absolute_path') . DS;
}
require $root . 'components' . DS . 'com_jreviews' . DS . 'jreviews' . DS . 'framework.php';
# Populate $params array with module settings
$moduleParams['module'] = stringToArray($params->_raw);
$moduleParams['module_id'] = $module->id;
$moduleParams['data']['module'] = true;
$moduleParams['data']['controller'] = 'module_geomaps';
$moduleParams['data']['action'] = 'listings';
$Dispatcher = new S2Dispatcher('jreviews', false);
echo $Dispatcher->dispatch($moduleParams);
开发者ID:bizanto,项目名称:Hooked,代码行数:29,代码来源:mod_jreviews_geomaps.php

示例9: explode

$view = Sanitize::getString($_REQUEST, 'view', '');
$layout = Sanitize::getString($_REQUEST, 'layout', '');
$id = explode(':', Sanitize::getInt($_REQUEST, 'id'));
$id = $id[0];
# Plugins table
if (!defined('_PLUGIN_DIR_NAME')) {
    if (getCmsVersion() == CMS_JOOMLA15) {
        define('_PLUGIN_DIR_NAME', 'plugins');
    } else {
        define('_PLUGIN_DIR_NAME', 'mambots');
    }
}
$query = "SELECT published,params FROM #__" . _PLUGIN_DIR_NAME . " WHERE element = 'jreviews' AND folder = 'content' LIMIT 1";
$CMS->_db->setQuery($query);
$jrbot = current($CMS->_db->loadObjectList());
$params = stringToArray($jrbot->params);
$published = $jrbot->published;
if ((int) (!$published)) {
    return;
}
$frontpageOff = Sanitize::getVar($params, 'frontpage');
$blogLayoutOff = Sanitize::getVar($params, 'blog');
# Get theme, suffix and load CSS so it's not killed by the built-in cache
if (getCmsVersion() == CMS_JOOMLA10 || getCmsVersion() == CMS_MAMBO46) {
    if ($option == 'com_content' && ($task == 'category' || $task == 'section' || $blogLayoutOff && $task == 'blogsection' || $blogLayoutOff && $task == 'blogcategory') || $frontpageOff && $option == 'com_frontpage') {
        return;
    }
} elseif ($blogLayoutOff && $option == 'com_content' && ($view == 'category' || $view == 'section') && ($layout == 'blog' || $layout == 'blogfull')) {
    return;
} elseif ($frontpageOff && $view == 'frontpage') {
    return;
开发者ID:bizanto,项目名称:Hooked,代码行数:31,代码来源:jreviews.php

示例10: index

 function index()
 {
     $module_id = Sanitize::getInt($this->params, 'module_id', Sanitize::getInt($this->data, 'module_id'));
     if (!isset($this->params['module'])) {
         $this->params['module'] = array();
     }
     // For direct calls to the controller
     $listing_type_id = Sanitize::getInt($this->params, 'listingtype', false);
     # Find the correct set of params to use
     if ($this->ajaxRequest && $listing_type_id) {
         $listingType = $this->Criteria->getCriteria(array('criteria_id' => $listing_type_id));
         if (isset($listingType['ListingType']['config']['userfavorites'])) {
             $userfavoritesParams = $listingType['ListingType']['config']['userfavorites'];
             $userfavoritesParams['criteria'] = implode(',', Sanitize::getVar($userfavoritesParams, 'criteria', array()));
             $this->params['module'] = array_merge($this->params['module'], $userfavoritesParams);
         }
     } elseif ($this->ajaxRequest && empty($this->params['module']) && $module_id) {
         $query = "SELECT params FROM #__modules WHERE id = " . $module_id;
         $this->_db->setQuery($query);
         $this->params['module'] = stringToArray($this->_db->loadResult());
     }
     # Get cached vesion
     /*        if($this->_user->id === 0) 
             {    
                 $page = $this->cached($this->here);
                 if($page) {
                     return $this->ajaxRequest ? $this->ajaxResponse($page,false) : $page;
                 } 
             }  */
     srand((double) microtime() * 1000000);
     $this->params['rand'] = rand();
     isset($this->params['module']) and $this->viewSuffix = Sanitize::getString($this->params['module'], 'tmpl_suffix');
     // Read the module parameters
     $img_width = Sanitize::getInt($this->params['module'], 'img_width', 50);
     $random_mode = Sanitize::getString($this->params['module'], 'random_mode', 'Random Users');
     $favorites_mode = Sanitize::getString($this->params['module'], 'favorites_mode', 'Other users interested in {title}');
     $limit = Sanitize::getInt($this->params['module'], 'module_limit', 5);
     $total = min(50, Sanitize::getInt($this->params['module'], 'module_total', 10));
     # Get url params for current controller/action
     if (!$this->ajaxRequest) {
         $url = Sanitize::getString($_REQUEST, 'url');
         $route['url']['url'] = $url;
         $route['data'] = array();
         $route = S2Router::parse($route, true, 'jreviews');
         # Check if page is listing detail
         $detail = Sanitize::getString($route['url'], 'extension', 'com_content') == 'com_content' && isset($route['data']) && Sanitize::getString($route['data'], 'controller') == 'listings' && Sanitize::getString($route['data'], 'action') == 'detail' ? true : false;
         # Initialize variables
         $listing_id = $detail ? Sanitize::getInt($route, 'id') : Sanitize::getInt($this->params, 'id');
         $option = Sanitize::getString($this->params, 'option');
         $view = Sanitize::getString($this->params, 'view');
         $task = Sanitize::getString($this->params, 'task');
         $listing_title = '';
     } else {
         $detail = true;
         $listing_id = Sanitize::getInt($this->params, 'id');
     }
     # Article auto-detect - only for com_content
     if ($detail || 'com_content' == $option && ('article' == $view || 'view' == $task)) {
         $query = "SELECT Listing.id, Listing.title FROM #__content AS Listing WHERE Listing.id = " . $listing_id;
         $this->_db->setQuery($query);
         $listing = current($this->_db->loadObjectList());
         $listing_title = $listing->title;
     } else {
         $listing_id = null;
     }
     $profiles = $this->Community->getListingFavorites($listing_id, $this->_user->id, $this->params);
     $total = count($profiles);
     $this->set(array('profiles' => $profiles, 'listing_title' => $listing_title, 'limit' => $limit, 'total' => $total));
     $this->_completeModuleParamsArray();
     $page = $this->ajaxRequest && empty($profiles) ? '' : $this->render('modules', 'favorite_users');
     # Save cached version
     /*        if($this->_user->id ===0) {    
                 $this->cacheView('modules','userfavorites',$this->here, $page);
             }      */
     return $this->ajaxRequest ? $this->ajaxResponse($page, false) : $page;
 }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:76,代码来源:module_favorite_users_controller.php

示例11: index

 function index()
 {
     /*        if($this->_user->id === 0) 
             {
                 $this->cacheAction = Configure::read('Cache.expires');        
             }   */
     $this->EverywhereAfterFind = true;
     // Triggers the afterFind in the Observer Model
     if (!isset($this->params['module'])) {
         $this->params['module'] = array();
     }
     // For direct calls to the controller
     $module_id = Sanitize::getInt($this->params, 'module_id', Sanitize::getInt($this->data, 'module_id'));
     if (empty($this->params)) {
         $query = "SELECT params FROM #__modules WHERE id = " . $module_id;
         $this->_db->setQuery($query);
         $this->params['module'] = stringToArray($this->_db->loadResult());
     }
     $ids = $conditions = $joins = $order = array();
     # Read module parameters
     $extension = Sanitize::getString($this->params['module'], 'extension');
     $reviews_type = Sanitize::getString($this->params['module'], 'reviews_type');
     $custom_where = Sanitize::getString($this->params['module'], 'custom_where');
     $cat_id = Sanitize::getString($this->params['module'], 'category');
     $listing_id = Sanitize::getString($this->params['module'], 'listing');
     $limit = Sanitize::getInt($this->params['module'], 'module_limit', 5);
     $total = min(50, Sanitize::getInt($this->params['module'], 'module_total', 10));
     if ($extension == 'com_content') {
         $dir_id = Sanitize::getString($this->params['module'], 'dir');
         $section_id = Sanitize::getString($this->params['module'], 'section');
         $criteria_id = Sanitize::getString($this->params['module'], 'criteria');
     } else {
         $dir_id = null;
         $section_id = null;
         $criteria_id = null;
     }
     # Prevent sql injection
     $token = Sanitize::getString($this->params, 'token');
     $tokenMatch = 0 === strcmp($token, cmsFramework::formIntegrityToken($this->params, array('module', 'module_id', 'form', 'data'), false));
     isset($this->params['module']) and $this->viewSuffix = Sanitize::getString($this->params['module'], 'tmpl_suffix');
     // This parameter determines the module mode
     $sort = Sanitize::getString($this->params['module'], 'reviews_order');
     if (in_array($sort, array('random'))) {
         srand((double) microtime() * 1000000);
         $this->params['rand'] = rand();
     }
     # Category auto detect
     if (Sanitize::getInt($this->params['module'], 'cat_auto') && $extension == 'com_content') {
         $ids = CommonController::_discoverIDs($this);
         extract($ids);
     }
     $extension != '' and $conditions[] = "Review.mode = " . $this->quote($extension);
     # Set conditionals based on configuration parameters
     if ($extension == 'com_content') {
         $conditions = array_merge($conditions, array('Listing.state = 1', '( Listing.publish_up = "' . NULL_DATE . '" OR DATE(Listing.publish_up) <= DATE("' . _CURRENT_SERVER_TIME . '") )', '( Listing.publish_down = "' . NULL_DATE . '" OR DATE(Listing.publish_down) >= DATE("' . _CURRENT_SERVER_TIME . '") )'));
         if ($this->cmsVersion == CMS_JOOMLA15) {
             //                $conditions[] = 'Section.access <= ' . $this->Access->getAccessId();
             $conditions[] = 'Category.access <= ' . $this->Access->getAccessId();
             $conditions[] = 'Listing.access <= ' . $this->Access->getAccessId();
         } else {
             $conditions[] = 'Category.access IN (' . $this->Access->getAccessLevels() . ')';
             $conditions[] = 'Listing.access IN ( ' . $this->Access->getAccessLevels() . ')';
         }
         if (!empty($cat_id)) {
             if ($this->cmsVersion == CMS_JOOMLA15) {
                 $conditions[] = 'Listing.catid IN (' . cleanIntegerCommaList($cat_id) . ')';
             } else {
                 $this->Review->joins['ParentCategory'] = "LEFT JOIN #__categories AS ParentCategory ON Category.lft BETWEEN ParentCategory.lft AND ParentCategory.rgt";
                 $conditions[] = 'ParentCategory.id IN (' . cleanIntegerCommaList($cat_id) . ')';
             }
         }
         empty($cat_id) and !empty($section_id) and $conditions[] = 'Listing.sectionid IN (' . cleanIntegerCommaList($section_id) . ')';
         empty($cat_id) and !empty($dir_id) and $conditions[] = 'JreviewsCategory.dirid IN (' . cleanIntegerCommaList($dir_id) . ')';
         empty($cat_id) and !empty($criteria_id) and $conditions[] = 'JreviewsCategory.criteriaid IN (' . cleanIntegerCommaList($criteria_id) . ')';
     } else {
         if (Sanitize::getInt($this->params['module'], 'cat_auto') && isset($this->Listing) && method_exists($this->Listing, 'catUrlParam')) {
             if ($cat_id = Sanitize::getInt($this->passedArgs, $this->Listing->catUrlParam())) {
                 $conditions[] = 'JreviewsCategory.id IN (' . $cat_id . ')';
             }
         } elseif ($cat_id) {
             $conditions[] = 'JreviewsCategory.id IN (' . cleanIntegerCommaList($cat_id) . ')';
         }
     }
     $listing_id and $conditions[] = "Review.pid IN ( " . cleanIntegerCommaList($listing_id) . ")";
     $conditions[] = 'Review.published > 0';
     switch ($sort) {
         case 'latest':
             $order[] = $this->Review->processSorting('rdate');
             break;
         case 'helpful':
             $order[] = $this->Review->processSorting('helpful');
             break;
         case 'random':
             $order[] = 'RAND(' . $this->params['rand'] . ')';
             break;
         default:
             $order[] = $this->Review->processSorting('rdate');
             break;
     }
     switch ($reviews_type) {
//.........这里部分代码省略.........
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:101,代码来源:module_reviews_controller.php

示例12: fileToString

    exit;
}
if ($fileType != 'text/plain') {
    echo 'Error: file is not a plain text';
    exit;
}
$upfile = __DIR__ . "\\upload\\" . $userFile;
if (is_uploaded_file($tmpFile)) {
    if (!move_uploaded_file($tmpFile, $upfile)) {
        echo 'File uploaded, but could not move to destination directory';
        exit;
    }
}
//call user function
$str = fileToString($upfile);
$arr = stringToArray($str);
usort($arr, "sortBySourceField");
echo "<table border=1>";
foreach ($arr as $key => $value) {
    foreach ($value as $key2 => $value2) {
        echo "<tr><td>{$key2}</td>";
        echo "<td>{$value2}</td>";
    }
}
echo "</table>";
//define user's functions
function fileToString($filePatch)
{
    $handle = fopen($filePatch, 'r');
    if (!$handle) {
        echo "Error. Can't read file";
开发者ID:bvy,项目名称:cources,代码行数:31,代码来源:parser.php

示例13: parseArticleList

 private function parseArticleList($allTitles)
 {
     if (count($allTitles) < 1) {
         $this->articleList = array();
         return;
     }
     $this->articleList = array();
     foreach ($allTitles as $aID => $row) {
         $this->articleList[$aID] = $row;
         if ($row['aCateURLName'] == '_trash') {
             $this->articleList[$aID]['aCateDispName'] = bw::$conf['l']['admin:item:TrashBin'];
         } elseif ($row['aCateURLName'] == '_page') {
             $this->articleList[$aID]['aCateDispName'] = bw::$conf['l']['page:SinglePage'];
         } else {
             $this->articleList[$aID]['aCateDispName'] = bw::$cateData[$row['aCateURLName']];
         }
         $this->articleList[$aID]['aAllTags'] = stringToArray(@explode(',', $row['aTags']), 'tagValue');
         if (isset(bw::$conf['commentOpt'])) {
             if (bw::$conf['commentOpt'] == 0 || bw::$conf['commentOpt'] == 3) {
                 // If using non-built-in comment system, give an empty string instead of 0 for the attribute aComments
                 $this->articleList[$aID]['aComments'] = '';
             }
         }
     }
 }
开发者ID:bo-blog,项目名称:bw,代码行数:25,代码来源:article.inc.php

示例14: count

$size = count($query->result());
foreach ($query->result() as $row) {
    echo '{';
    echo '"id":"' . $row->tIndex . '", ';
    echo '"word":"' . $row->word . '", ';
    if ($row->WordNumer != '') {
        echo '"noWord":[' . stringToArray($row->WordNumer) . '], ';
    }
    if ($row->Symbol != '') {
        echo '"symbol":[' . stringToArray($row->Symbol) . '], ';
    }
    if ($row->IPASymbol != '') {
        echo '"iPASymbol":[' . stringToArray($row->IPASymbol) . '], ';
    }
    if ($row->unicode != '') {
        echo '"unicode":[' . stringToArray($row->unicode) . ']';
    }
    echo "}";
    if ($i < $size - 1) {
        echo ',';
    }
    echo "\n";
    $i++;
}
echo ']}';
function stringToArray($text)
{
    $i = 0;
    $array = explode(" ", $text);
    $string = "";
    $size = count($array);
开发者ID:nagyist,项目名称:NursingRecord,代码行数:31,代码来源:select_word.php

示例15: index

 function index()
 {
     /*        if($this->_user->id === 0) 
             {
                 $this->cacheAction = Configure::read('Cache.expires');        
             }*/
     // Required for ajax pagination to remember module settings
     $ids = $conditions = $joins = $order = $having = array();
     $module_id = Sanitize::getInt($this->params, 'module_id', Sanitize::getInt($this->data, 'module_id'));
     if (!isset($this->params['module'])) {
         $this->params['module'] = array();
     }
     // For direct calls to the controller
     # Find the correct set of params to use
     if ($this->ajaxRequest && Sanitize::getInt($this->params, 'listing_id')) {
         $this->params['module'] = array_merge($this->params['module'], $this->__processListingTypeWidgets($conditions));
     } elseif ($this->ajaxRequest && empty($this->params['module']) && $module_id) {
         $query = "SELECT params FROM #__modules WHERE id = " . $module_id;
         $this->_db->setQuery($query);
         $this->params['module'] = stringToArray($this->_db->loadResult());
     }
     if ($this->abort) {
         return $this->ajaxResponse('', false);
     }
     # Read module parameters
     $dir_id = Sanitize::getString($this->params['module'], 'dir');
     $section_id = Sanitize::getString($this->params['module'], 'section');
     $cat_id = Sanitize::getString($this->params['module'], 'category');
     $listing_id = Sanitize::getString($this->params['module'], 'listing');
     $created_by = Sanitize::getString($this->params['module'], 'owner');
     $criteria_id = Sanitize::getString($this->params['module'], 'criteria');
     $limit = Sanitize::getInt($this->params['module'], 'module_limit', 5);
     $total = min(50, Sanitize::getInt($this->params['module'], 'module_total', 10));
     $extension = Sanitize::getString($this->params['module'], 'extension');
     $extension = $extension != '' ? $extension : 'com_content';
     $sort = Sanitize::getString($this->params['module'], 'listing_order');
     if (in_array($sort, array('random', 'featuredrandom'))) {
         srand((double) microtime() * 1000000);
         $this->params['rand'] = rand();
     }
     # Prevent sql injection
     $token = Sanitize::getString($this->params, 'token');
     $tokenMatch = 0 === strcmp($token, cmsFramework::formIntegrityToken($this->params, array('module', 'module_id', 'form', 'data'), false));
     isset($this->params['module']) and $this->viewSuffix = Sanitize::getString($this->params['module'], 'tmpl_suffix');
     if (isset($this->Listing)) {
         $this->Listing->_user = $this->_user;
         // This parameter determines the module mode
         $custom_order = Sanitize::getString($this->params['module'], 'custom_order');
         $custom_where = Sanitize::getString($this->params['module'], 'custom_where');
         if ($extension != 'com_content' && in_array($sort, array('topratededitor', 'featuredrandom', 'rhits'))) {
             echo "You have selected the {$sort} mode which is not supported for components other than com_content. Please read the tooltips in the module parameters for more info on allowed settings.";
             return;
         }
         # Category auto detect
         if (Sanitize::getInt($this->params['module'], 'cat_auto') && $extension == 'com_content') {
             $ids = CommonController::_discoverIDs($this);
             extract($ids);
         }
         # Set conditionals based on configuration parameters
         if ($extension == 'com_content') {
             // Perform tag replacement for listing_id to allow for related listing queries
             if (Sanitize::getString($this->params, 'view') == 'article' && $custom_where != '') {
                 $curr_listing_id = Sanitize::getInt($this->params, 'id');
                 $custom_where = str_replace('{listing_id}', $curr_listing_id, $custom_where);
             }
             // Only works for core articles
             $conditions = array_merge($conditions, array('Listing.state = 1', '( Listing.publish_up = "' . NULL_DATE . '" OR DATE(Listing.publish_up) <= DATE("' . _CURRENT_SERVER_TIME . '") )', '( Listing.publish_down = "' . NULL_DATE . '" OR DATE(Listing.publish_down) >= DATE("' . _CURRENT_SERVER_TIME . '") )'));
             if ($this->cmsVersion == CMS_JOOMLA15) {
                 //                    $conditions[] = 'Section.access <= ' . $this->Access->getAccessId();
                 $conditions[] = 'Category.access <= ' . $this->Access->getAccessId();
                 $conditions[] = 'Listing.access <= ' . $this->Access->getAccessId();
             } else {
                 $conditions[] = 'Category.access IN (' . $this->Access->getAccessLevels() . ')';
                 $conditions[] = 'Listing.access IN (' . $this->Access->getAccessLevels() . ')';
             }
             // Remove unnecessary fields from model query
             $this->Listing->modelUnbind(array('Listing.fulltext AS `Listing.description`', 'Listing.metakey AS `Listing.metakey`', 'Listing.metadesc AS `Listing.metadesc`', 'User.email AS `User.email`'));
             if (!empty($cat_id)) {
                 $conditions[] = $this->cmsVersion == CMS_JOOMLA15 ? 'Listing.catid IN (' . cleanIntegerCommaList($cat_id) . ')' : 'ParentCategory.id IN (' . cleanIntegerCommaList($cat_id) . ')';
             } else {
                 unset($this->Listing->joins['ParentCategory']);
             }
             empty($cat_id) and !empty($section_id) and $conditions[] = 'Listing.sectionid IN (' . cleanIntegerCommaList($section_id) . ')';
             empty($cat_id) and !empty($dir_id) and $conditions[] = 'JreviewsCategory.dirid IN (' . cleanIntegerCommaList($dir_id) . ')';
             empty($cat_id) and !empty($criteria_id) and $conditions[] = 'JreviewsCategory.criteriaid IN (' . cleanIntegerCommaList($criteria_id) . ')';
         } else {
             if (Sanitize::getInt($this->params['module'], 'cat_auto') && method_exists($this->Listing, 'catUrlParam')) {
                 if ($cat_id = Sanitize::getInt($this->passedArgs, $this->Listing->catUrlParam())) {
                     $conditions[] = 'JreviewsCategory.id IN (' . cleanIntegerCommaList($cat_id) . ')';
                 }
             } elseif ($cat_id) {
                 $conditions[] = 'JreviewsCategory.id IN (' . cleanIntegerCommaList($cat_id) . ')';
             }
         }
         $listing_id and $conditions[] = "Listing.{$this->Listing->realKey} IN (" . cleanIntegerCommaList($listing_id) . ")";
         switch ($sort) {
             case 'random':
                 $order[] = 'RAND(' . $this->params['rand'] . ')';
                 break;
             case 'featured':
//.........这里部分代码省略.........
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:101,代码来源:module_listings_controller.php


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