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


PHP parse_params函数代码示例

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


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

示例1: get_quotes

function get_quotes($params = array())
{
    if (is_string($params)) {
        $params = parse_params($params);
    }
    $params['table'] = "ez_quotes";
    return db_get($params);
}
开发者ID:pinecreativelabs,项目名称:EZ-Quotes,代码行数:8,代码来源:functions.php

示例2: get

 public function get($params = array())
 {
     if (is_string($params)) {
         $params = parse_params($params);
     }
     $table = $this->table;
     $params['table'] = $table;
     $get = $this->app->database_manager->get($params);
     return $get;
 }
开发者ID:hyrmedia,项目名称:microweber,代码行数:10,代码来源:TaxManager.php

示例3: save

 public function save($params)
 {
     $table = $this->table;
     $params = parse_params($params);
     $params['user_ip'] = MW_USER_IP;
     $params['table'] = $table;
     $save = $this->app->database_manager->save($params);
     $id = $save;
     $this->app->cache_manager->delete('log' . DIRECTORY_SEPARATOR . 'global');
     return $id;
 }
开发者ID:microweber,项目名称:microweber,代码行数:11,代码来源:LogManager.php

示例4: save

 public function save($params)
 {
     if (is_string($params)) {
         $params = parse_params($params);
     }
     if ($params == false) {
         return;
     }
     $table = $this->table;
     $params['table'] = $table;
     $save = $this->app->database_manager->save($params);
     return $save;
 }
开发者ID:hyrmedia,项目名称:microweber,代码行数:13,代码来源:Crud.php

示例5: save

 public function save($params)
 {
     if (is_string($params)) {
         $params = parse_params($params);
     }
     if ($params == false) {
         return;
     }
     if (!$this->has_permission($params)) {
         return;
     }
     $table = $this->table;
     $params['table'] = $table;
     $save = parent::save($params);
     return $save;
 }
开发者ID:microweber,项目名称:microweber,代码行数:16,代码来源:UserCrud.php

示例6: save

 public function save($data)
 {
     if (!is_array($data)) {
         $data = parse_params($data);
     }
     if (!isset($data['id'])) {
         if (!isset($data['attribute_name'])) {
             return array('error' => "You must set 'field' parameter");
         }
         if (!isset($data['attribute_value'])) {
             return array('error' => "You must set 'value' parameter");
         }
     }
     if (!isset($data['rel_type']) and isset($data['content_id'])) {
         $data['rel_type'] = 'content';
         $data['rel_id'] = $data['content_id'];
     }
     if (isset($data['attribute_name']) and isset($data['rel_id']) and isset($data['rel_type'])) {
         $is_existing_data = array();
         $is_existing_data['attribute_name'] = $data['attribute_name'];
         $is_existing_data['rel_id'] = $data['rel_id'];
         $is_existing_data['rel_type'] = $data['rel_type'];
         $is_existing_data['one'] = true;
         $is_existing = $this->get($is_existing_data);
         if (is_array($is_existing) and isset($is_existing['id'])) {
             $data['id'] = $is_existing['id'];
         }
     }
     if (isset($data['content_id'])) {
         $data['rel_id'] = intval($data['content_id']);
     }
     if (isset($data['attribute_value']) and is_array($data['attribute_value'])) {
         $data['attribute_value'] = json_encode($data['attribute_value']);
         $data['attribute_type'] = 'array';
     }
     if (!isset($data['rel_type'])) {
         $data['rel_type'] = 'content';
     }
     if (isset($data['rel_type']) and $data['rel_type'] == 'content') {
         if (isset($data['rel_id'])) {
             $data['content_id'] = $data['rel_id'];
         }
     }
     $save = parent::save($data);
     return $save;
 }
开发者ID:hyrmedia,项目名称:microweber,代码行数:46,代码来源:AttributesManager.php

示例7: link_to

function link_to($link, $text, $title, $params)
{
    $link = '<a href="' . $link . '" ';
    if ($title) {
        $link .= 'title="' . $title . '" ';
    } else {
        $link .= 'title="' . $text . '"';
    }
    if (is_array($params)) {
        foreach ($params as $param) {
            $link .= parse_params($param);
        }
    } else {
        $link .= parse_params($params);
    }
    $link .= '>' . $text . '</a>';
    return $link;
}
开发者ID:OneTimeCZ,项目名称:Tasker,代码行数:18,代码来源:BasicHelper.php

示例8: array

/**
* 		array(
			'method' => 'foo',
			'params' => array(
				'a' => null,
			),
			'is_public'=>1,
			'is_return'=>0,
			'testcase' => array(
				array('input'=>array('a'=>1), 'output'=>null),
			),
		)
*/
function main($args)
{
    if (empty($args[1])) {
        echo "filepath is require\n";
        return;
    }
    $class_path = $args[1];
    if (!file_exists($class_path)) {
        echo sprintf("path %s is not exits!\n", $class_path);
        return;
    }
    $buf = file_get_contents($class_path);
    $n = preg_match_all('/([a-z|\\s]+)function\\s+([^\\s|\\(|\\{)]+)\\s*\\(([^)]+)\\)/', $buf, $match);
    $methods = array();
    $method_empty = array('method' => '', 'params' => array(), 'is_public' => 0, 'is_return' => 0, 'is_static' => 0, 'testcase' => array());
    if ($n > 0) {
        for ($i = 0; $i < $n; $i++) {
            $row = $method_empty;
            $row['method'] = $match[2][$i];
            $row['params'] = parse_params($match[3][$i]);
            //var_dump($row);
        }
    }
}
开发者ID:wjzhangq,项目名称:testcase,代码行数:37,代码来源:parseClass.php

示例9: save

 /**
  * Generic save data function, it saves data to the database
  *
  * @param $table
  * @param $data
  * @param bool $data_to_save_options
  * @return string|int The id of the saved row.
  *
  * @example
  * <code>
  * $table = $this->table_prefix.'content';
  * $data = array();
  * $data['id'] = 0; //if 0 will create new content
  * $data['title'] = 'new title';
  * $data['content'] = '<p>Something</p>';
  * $save = save($table, $data);
  * </code>
  * @package Database
  */
 public function save($table, $data = false, $data_to_save_options = false)
 {
     if (is_array($table) and isset($table['table'])) {
         $data = $table;
         $table = $table['table'];
         unset($data['table']);
     }
     if (is_string($data)) {
         $data = parse_params($data);
     }
     if (!is_array($data)) {
         return false;
     }
     $original_data = $data;
     $is_quick = isset($original_data['quick_save']);
     $skip_cache = isset($original_data['skip_cache']);
     if (!isset($params['skip_timestamps'])) {
         if (!isset($params['id']) or isset($params['id']) and $params['id'] == 0) {
             if (!isset($params['created_at'])) {
                 $params['created_at'] = date("Y-m-d H:i:s");
             }
         }
         if (!isset($params['updated_at'])) {
             $params['updated_at'] = date("Y-m-d H:i:s");
         }
     }
     if ($is_quick == false) {
         if (isset($data['updated_at']) == false) {
             $data['updated_at'] = date("Y-m-d H:i:s");
         }
     }
     if ($skip_cache == false and isset($data_to_save_options) and !empty($data_to_save_options)) {
         if (isset($data_to_save_options['delete_cache_groups']) and !empty($data_to_save_options['delete_cache_groups'])) {
             foreach ($data_to_save_options['delete_cache_groups'] as $item) {
                 $this->app->cache_manager->delete($item);
             }
         }
     }
     $user_sid = mw()->user_manager->session_id();
     $the_user_id = mw()->user_manager->id();
     if (!isset($data['session_id']) and $user_sid) {
         $data['session_id'] = $user_sid;
     }
     if (!isset($data['id'])) {
         $data['id'] = 0;
     }
     if (isset($data['cf_temp'])) {
         $cf_temp = $data['cf_temp'];
     }
     $allow_html = false;
     $allow_scripts = false;
     if (isset($data['allow_html']) and !isset($_REQUEST['allow_html'])) {
         $allow_html = $data['allow_html'];
     }
     if (isset($data['allow_scripts']) and !isset($_REQUEST['allow_scripts'])) {
         $allow_scripts = $data['allow_scripts'];
     }
     if (isset($data['debug']) and $data['debug'] == true) {
         $dbg = 1;
         unset($data['debug']);
     } else {
         $dbg = false;
     }
     if ($dbg != false) {
         var_dump($data);
     }
     $data['user_ip'] = MW_USER_IP;
     if (isset($data['id']) == false or $data['id'] == 0) {
         $data['id'] = 0;
         $l = $this->last_id($table);
         $data['new_id'] = intval($l + 1);
         $original_data['new_id'] = $data['new_id'];
     }
     if (!isset($the_user_id)) {
         $the_user_id = 0;
     }
     if (intval($data['id']) == 0) {
         if (isset($data['created_at']) == false) {
             $data['created_at'] = date("Y-m-d H:i:s");
         }
         if ($the_user_id) {
//.........这里部分代码省略.........
开发者ID:hyrmedia,项目名称:microweber,代码行数:101,代码来源:DatabaseManager.php

示例10: get

 public function get($params)
 {
     $table = $this->tables['media'];
     if ($params != false and !is_array($params) and intval($params) > 0) {
         $params2 = array();
         $params2['rel_type'] = 'content';
         $params2['rel_id'] = intval($params);
         $params = $params2;
     } else {
         $params = parse_params($params);
     }
     if (!isset($params['rel_type']) and isset($params['for'])) {
         $params['rel_type'] = $this->app->database_manager->assoc_table_name($params['for']);
     }
     if (!isset($params['rel_type'])) {
         $params['rel_type'] = 'content';
     }
     if (!isset($params['limit'])) {
         $params['limit'] = "nolimit";
     }
     $params['table'] = $table;
     $params['order_by'] = 'position ASC';
     $data = $this->app->database_manager->get($params);
     if (media_base_url()) {
         if (!empty($data)) {
             $return = array();
             foreach ($data as $item) {
                 if (isset($item['filename']) and $item['filename'] != false) {
                     if (!stristr($item['filename'], '{SITE_URL}') and !stristr($item['filename'], '{MEDIA_URL}') and !stristr($item['filename'], '://') and !stristr($item['filename'], media_base_url())) {
                         $item['filename'] = media_base_url() . $item['filename'];
                     }
                 }
                 if (isset($item['title']) and $item['title'] != '') {
                     $item['title'] = html_entity_decode($item['title']);
                     $item['title'] = strip_tags($item['title']);
                     $item['title'] = $this->app->format->clean_html($item['title']);
                 }
                 $return[] = $item;
             }
             $data = $return;
         }
     }
     return $data;
 }
开发者ID:kamilmiesiac,项目名称:microweber,代码行数:44,代码来源:MediaManager.php

示例11: get

 public function get($table, $id = 0, $return_full = false, $field_for = false, $debug = false, $field_type = false, $for_session = false)
 {
     $params = array();
     $no_cache = false;
     $table_assoc_name = false;
     // $id = intval ( $id );
     if (is_string($table)) {
         $params = $params2 = parse_params($table);
         if (!is_array($params2) or is_array($params2) and count($params2) < 2) {
             $id = trim($id);
             $table = $this->app->database_manager->escape_string($table);
             if ($table != false) {
                 $table_assoc_name = $this->app->database_manager->assoc_table_name($table);
             } else {
                 $table_assoc_name = 'MW_ANY_TABLE';
             }
             if ($table_assoc_name == false) {
                 $table_assoc_name = $this->app->database_manager->assoc_table_name($table_assoc_name);
             }
             $params['rel_type'] = $table_assoc_name;
         } else {
             $params = $params2;
         }
     } elseif (is_array($table)) {
         $params = $table;
     }
     $params = $this->unify_params($params);
     if (!isset($table_assoc_name)) {
         if (isset($params['for'])) {
             $params['rel_type'] = $table_assoc_name = $this->app->database_manager->assoc_table_name($params['for']);
         }
     } else {
         // $params['rel_type'] = $table_assoc_name;
     }
     if (isset($params['debug'])) {
         $debug = $params['debug'];
     }
     if (isset($params['for'])) {
         if (!isset($params['rel_type']) or $params['rel_type'] == false) {
             $params['for'] = $params['rel_type'];
         }
     }
     if (isset($params['for_id'])) {
         $params['rel_id'] = $id = $this->app->database_manager->escape_string($params['for_id']);
     }
     if (isset($params['field_type'])) {
         $params['type'] = $params['field_type'];
     }
     if (isset($params['field_value'])) {
         $params['value'] = $params['field_value'];
     }
     if (isset($params['no_cache'])) {
         $no_cache = $params['no_cache'];
     }
     if (isset($params['return_full'])) {
         $return_full = $params['return_full'];
     }
     if (isset($params['is_active']) and strtolower(trim($params['is_active'])) == 'any') {
     } elseif (isset($params['is_active']) and $params['is_active'] == 0) {
         $custom_field_is_active = 0;
     } else {
         $custom_field_is_active = 1;
     }
     $table_custom_field = $this->table;
     $params['table'] = $table_custom_field;
     if (isset($custom_field_is_active)) {
         $params['is_active'] = $custom_field_is_active;
     }
     if (strval($table_assoc_name) != '') {
         if ($field_for != false) {
             $field_for = trim($field_for);
             $field_for = $this->app->database_manager->escape_string($field_for);
             $params['name'] = $field_for;
         }
         if (isset($params['rel_type']) and $params['rel_type'] == 'MW_ANY_TABLE') {
             unset($params['rel_type']);
         }
         $sidq = '';
         if (intval($id) == 0 and $for_session != false) {
             if (is_admin() != false) {
                 $sid = mw()->user_manager->session_id();
                 $params['session_id'] = $sid;
             }
         }
         if ($id != 'all' and $id != 'any') {
             $id = $this->app->database_manager->escape_string($id);
             $params['rel_id'] = $id;
         }
     }
     if (isset($params['content'])) {
         unset($params['content']);
     }
     if (!isset($params['order_by']) and !isset($params['orderby'])) {
         $params['order_by'] = 'position asc';
     }
     if (empty($params)) {
         return false;
     }
     $q = $this->app->database_manager->get($params);
     if (!empty($q)) {
//.........这里部分代码省略.........
开发者ID:microweber,项目名称:microweber,代码行数:101,代码来源:FieldsManager.php

示例12: mw_send_anonymous_server_data

function mw_send_anonymous_server_data($params)
{
    only_admin_access();
    $update_api = mw('update');
    if ($params != false) {
        $params = parse_params($params);
    }
    if (method_exists($update_api, 'send_anonymous_server_data')) {
        $iudates = $update_api->send_anonymous_server_data($params);
        return $iudates;
    } else {
        $params['site_url'] = site_url();
        $result = $update_api->call('send_anonymous_server_data', $params);
        return $result;
    }
}
开发者ID:newaltcoin,项目名称:microweber,代码行数:16,代码来源:other.php

示例13: rtrim

    }
    // true for nginx
}
$doc_path = 'http' . (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' ? 's' : '') . '://' . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['SCRIPT_NAME']), '/\\');
$base_path = MOD_REWRITE ? $doc_path : $doc_path . '/' . SCRIPT_NAME;
ini_set('session.gc_maxlifetime', 7776000);
ini_set('session.cookie_lifetime', 7776000);
session_set_cookie_params(7776000);
session_start();
//if( $_SERVER['HTTP_HOST'] == 'localhost' ) $userid = 'test';
if (isset($_SESSION['user_id'])) {
    $userid = $_SESSION['user_id'];
}
$message = '';
$api = isset($_REQUEST['api']);
$params = parse_params();
$action = $params['action'];
$bbcode = $params['bbcode'];
$title = $params['title'];
if (isset($params['id'])) {
    $scodeid = $params['id'];
}
if (isset($params['editid'])) {
    $seditid = $params['editid'];
}
$data = false;
if (isset($scodeid)) {
    $data = get_data($scodeid);
    if (!$data) {
        if ($api) {
            return_json(array('error' => 'No such code: ' . $scodeid));
开发者ID:keno-teixeira,项目名称:PHP-leaflet-wms,代码行数:31,代码来源:index.php

示例14: get

 /**
  * \Files\Api::get
  *
  *  Get an array that represents directory and files
  *
  * @package        modules
  * @subpackage    files
  * @subpackage    files\api
  * @category    files module api
  * @version 1.0
  * @since 0.320
  * @return mixed Array with files
  *
  * @param array $params = array()     the params
  * @param string $params['directory']       The directory
  * @param string $params['keyword']       If set it will seach the dir and subdirs
  */
 static function get($params)
 {
     if (is_admin() == false) {
         mw_error("Must be admin");
     }
     $params = parse_params($params);
     if (!isset($params['directory'])) {
         mw_error("You must define directory");
     } else {
         $directory = $params['directory'];
     }
     $from_search = 0;
     $arrayItems = array();
     if (isset($params['search']) and strval($params['search']) != '') {
         $from_search = 1;
         $arrayItems_search = rglob($pattern = DS . '*' . $params['search'] . '*', $flags = 0, $directory);
     } else {
         //$paths = glob($directory . DS . '*', GLOB_ONLYDIR | GLOB_NOSORT);
         //$files = glob($directory . DS . '*', 0);
         //$arrayItems_search = array_merge($paths, $files);
         if (!is_dir($directory . DS)) {
             return false;
         }
         $arrayItems_search = array();
         $myDirectory = opendir($directory . DS);
         // get each entry
         while ($entryName = readdir($myDirectory)) {
             if ($entryName != '..' and $entryName != '.') {
                 $arrayItems_search[] = $entryName;
             }
         }
         // close directory
         closedir($myDirectory);
     }
     if (!empty($arrayItems_search)) {
         if (isset($params['sort_by']) and strval($params['sort_by']) != '') {
             if (isset($params['sort_order']) and strval($params['sort_order']) != '') {
                 $ord = SORT_DESC;
                 if (strtolower($params['sort_order']) == 'asc') {
                     $ord = SORT_ASC;
                 }
                 array_multisort(array_map($params['sort_by'], $arrayItems_search), SORT_NUMERIC, $ord, $arrayItems_search);
                 //	d($arrayItems_search);
             }
         }
         //usort($myarray, create_function('$a,$b', 'return filemtime($a) - filemtime($b);'));
         $arrayItems_f = array();
         $arrayItems_d = array();
         foreach ($arrayItems_search as $file) {
             if ($from_search == 0) {
                 $file = $directory . DS . $file;
             }
             if (is_file($file)) {
                 $df = normalize_path($file, false);
                 if (!in_array($df, $arrayItems_f)) {
                     $arrayItems_f[] = $df;
                 }
             } else {
                 $df = normalize_path($file, 1);
                 if (!in_array($df, $arrayItems_d)) {
                     $arrayItems_d[] = $df;
                 }
             }
         }
         $arrayItems['files'] = $arrayItems_f;
         $arrayItems['dirs'] = $arrayItems_d;
     }
     return $arrayItems;
 }
开发者ID:MenZil-Team,项目名称:microweber,代码行数:86,代码来源:Api.php

示例15: get

 public function get($params = false)
 {
     $params = parse_params($params);
     $return = array();
     $is_sys_log = false;
     if (isset($params['id'])) {
         $is_log = substr(strtolower($params['id']), 0, 4);
         if ($is_log == 'log_') {
             $is_sys_log = 1;
             $is_log_id = str_ireplace('log_', '', $params['id']);
             $log_entr = $this->app->log_manager->get_entry_by_id($is_log_id);
             if ($log_entr != false and isset($params['one'])) {
                 return $log_entr;
             } else {
                 if ($log_entr != false) {
                     $return[] = $log_entr;
                 }
             }
         }
     }
     if (isset($params['rel'])) {
         $params['rel_type'] = $params['rel'];
     }
     if ($is_sys_log == false) {
         $table = $this->table;
         $params['table'] = $table;
         $params['order_by'] = 'id desc';
         $return = $this->app->database_manager->get($params);
     }
     return $return;
 }
开发者ID:Git-Host,项目名称:microweber,代码行数:31,代码来源:NotificationsManager.php


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