本文整理汇总了PHP中String::camelize方法的典型用法代码示例。如果您正苦于以下问题:PHP String::camelize方法的具体用法?PHP String::camelize怎么用?PHP String::camelize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类String
的用法示例。
在下文中一共展示了String::camelize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initialize
function initialize(&$request)
{
parent::initialize($request);
$roleId = $request->getUserVar('roleId');
assert(is_numeric($roleId));
$this->setRoleId($roleId);
if ($request->getUserVar('title')) {
$title = $request->getUserVar('title');
} else {
$role =& new Role($roleId);
$title = $role->getRoleName();
}
// Need a unique ID for each group listbuilder
$this->setId($this->getId() . '-' . String::camelize(Locale::translate($title)));
// Basic configuration
$this->setTitle($title);
$this->setSourceTitle('manager.setup.roleName');
$this->setSourceType(LISTBUILDER_SOURCE_TYPE_TEXT);
// Free text input
$this->setListTitle('manager.setup.currentRoles');
$this->setAttributeNames(array('manager.setup.roleAbbrev'));
$this->_loadList($request);
$this->addColumn(new GridColumn('item', 'manager.setup.roleName'));
$this->addColumn(new GridColumn('attribute', 'manager.setup.roleAbbrev'));
}
示例2: log
function log($priority, $message, $file = null, $line = null, $e = null) {
$schema = "DEFAULT";
$table = "logs";
$trace = "";
if (!empty($e)) {
$trace = $e->getTraceAsString();
}
if (is_object($message)) {
$message = JSON::encode($message);
}
$now = new Date();
$log = array();
$log["priority"] = $priority;
$log["message"] = $message;
$log["trace"] = $trace;
$log["file"] = $file;
$log["line"] = $line;
$log["createdBy"] = "SYS";
$log["createdTime"] = $now;
$log["updatedBy"] = "SYS";
$log["updatedTime"] = $now;
$driver = $GLOBALS["CFG_DB"]->CON[$schema]->DRIVER;
$insert = new Insert($table, $log, $schema);
$link = DB::connect();
$success = mysql_query($insert->sql(), $link);
if (!$success) {
$result = Bean::invoke(String::camelize('_'.$driver.'_driver'), "error", array($schema));
throw new Exception("Cannot persist object. ".$result);
}
}
示例3: valueString
function valueString() {
reset($this->meta);
$values = array();
while(list(,$meta) = each($this->meta)) {
$value = Bean::get($this->value, String::camelize($meta["name"]));
$values[] = $this->escape($value, $meta["name"]);
}
return implode(', ', $values);
}
示例4: listen
function listen() {
$pathInfo = Apu::fetchPath();
$className = String::camelize("_".$pathInfo["class"]."_action");
reset($GLOBALS["CFG_ACTION"]->NS);
foreach ($GLOBALS["CFG_ACTION"]->NS as $ns) {
Apu::import($ns.'/'.$className.".php");
}
$action = new $className($pathInfo["method"]);
$action->listen();
}
示例5: delete
function delete($table, $obj, $schema = "DEFAULT") {
$driver = $GLOBALS["CFG_DB"]->CON[$schema]->DRIVER;
$objId = Bean::get($obj, "__ID__");
if (empty($objId)) {
throw new Exception("Cannot delete unpersisted object");
}
$delete = new Delete($table, $obj, $schema);
$success = DB::query($delete, $schema);
if (!$success) {
$result = Bean::invoke(String::camelize('_'.$driver.'_driver'), "error", array($schema));
throw new Exception("Cannot delete object. ".$result);
}
}
示例6: delegate
private function delegate() {
$controller = String::camelize($this->map['controller']) . 'Controller';
if (!class_exists($controller)) {
trigger_error("Route Error: The class `{$controller}` does't appear to be valid.", E_USER_ERROR);
die();
}
$klass = new $controller ($this->map);
if(!method_exists($klass, $this->map['action'])) {
trigger_error("Route Error: The method `{$this->map['action']}` does't appear to be valid.", E_USER_ERROR);
die();
}
call_user_func_array(array($klass, $this->map['action']), array());
if($klass->redirection !== true) new ActionView($klass, $this->map);
}
示例7: getRequestedOp
/**
* Retrieve the requested operation from the request
*
* NB: This can be an operation that not actually
* exists in the requested component.
*
* @param $request PKPRequest
* @return string the requested operation or an empty string
* if none can be found.
*/
function getRequestedOp(&$request)
{
if (is_null($this->_op)) {
$this->_op = '';
// Retrieve the service endpoint parts from the request.
if (is_null($rpcServiceEndpointParts = $this->_getValidatedServiceEndpointParts($request))) {
// Endpoint parts cannot be found in the request
return '';
}
// Pop off the operation part
$this->_op = String::camelize(array_pop($rpcServiceEndpointParts), CAMEL_CASE_HEAD_DOWN);
}
return $this->_op;
}
示例8: _parseVars
/**
* Parse table properties to build class methods
*
* @param string $field The field name from the current table
* @return array An array of values to build the method
*/
private function _parseVars($field)
{
$field['getMethodName'] = 'get' . String::camelize($field['Field']);
$field['setMethodName'] = 'set' . String::camelize($field['Field']);
if ($field['Key'] != '') {
$field['LoadByMethodName'] = 'loadBy' . String::camelize($field['Field']);
$field['LoadMethod'] = 'fetchAllObject';
if ($field['Key'] == 'UNI' || $field['Key'] == 'PRI' && count($this->_primaryKeys) == 1) {
$field['LoadMethod'] = 'fetchObject';
}
}
return $field;
}
示例9: escape
function escape($value, $name) {
$schema = $this->schema;
$driver = $GLOBALS["CFG_DB"]->CON[$schema]->DRIVER;
$value = Bean::invoke(String::camelize('_'.$driver.'_driver'), "escape", array($value, $name, $this->meta));
return $value;
}
示例10: getId
/**
* Returns a canonical form of the property
* name ready to be used as a property id in an
* external context (e.g. Forms or Templates).
* @return string
*/
function getId()
{
// Replace special characters in XPath-like names
// as 'person-group[@person-group-type="author"]'.
$from = array('[', ']', '@', '"', '=');
$to = array('-', '', '', '', '-');
$propertyId = trim(str_replace($from, $to, $this->getName()), '-');
$propertyId = String::camelize($propertyId);
return $propertyId;
}
示例11: query
function query($query, $schema = "DEFAULT") {
$q = "";
if ($query instanceof Query) {
$q = $query->sql();
} else {
$q = $query;
}
$link = MysqlDriver::connect($schema);
$result = mysql_query($q, $link);
$rows = array();
if ($result) {
if (is_bool($result)) {
return $result;
}
$fieldNames = array();
$camelizeNames = array();
$fieldTypes = array();
$fieldCount = mysql_num_fields($result);
for ($i = 0; $i < $fieldCount; $i++) {
$fieldNames[$i] = mysql_field_name($result, $i);
$camelizeNames[$i] = String::camelize($fieldNames[$i]);
$fieldTypes[$i] = mysql_field_type($result, $i);
}
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
$r = array();
for ($i = 0; $i < $fieldCount; $i++) {
if ($fieldTypes[$i] == "datetime") {
$r[$camelizeNames[$i]] = &new Date($row[$fieldNames[$i]]);
} else {
$r[$camelizeNames[$i]] = &$row[$fieldNames[$i]];
}
}
$r["__ID__"] = $row["id"];
$rows[] = &$r;
}
mysql_free_result($result);
return $rows;
} else {
return false;
}
}
示例12: listen
function listen() {
$this->pre();
$methodName = String::camelize("do_".$this->method);
Bean::invoke($this, $methodName);
$this->post();
}
示例13: testCamelize
public function testCamelize()
{
$this->assertEquals('CamalCaseString', String::camelize('camal-case-string'));
}
示例14: set_controller_class
function set_controller_class()
{
$name = $this->controller_name;
$namespace = '\\Leeflets\\Controller\\';
if (!$name && !$this->action) {
$this->controller_name = 'home';
$this->controller_class = $namespace . 'Home';
$this->action = 'index';
return;
}
$name = preg_replace('@[/\\-\\.]@', '_', $name);
$class = $namespace . String::camelize($name);
if (!class_exists($class)) {
$path = File::get_class_file_path($this->config, ltrim($class, '\\'));
if (!file_exists($path) || !method_exists($class, $this->action)) {
$this->controller_name = 'error';
$this->controller_class = $namespace . 'Error';
$this->action = 'e404';
return;
}
}
$this->controller_class = $class;
}
示例15: setObjProperties
/**
* Set an object properties, the object must extends Document
*
* @param Document $object The object to set properties
* @return Document The object with setted properties
*/
public function setObjProperties(Document $object)
{
foreach ($this->getValues() as $k => $v) {
$method = 'set' . ucfirst(String::camelize($k));
$object->{$method}($v);
}
return $object;
}