Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
TelegramBot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
TelegramBot
Commits
e7e160a7
Commit
e7e160a7
authored
Apr 15, 2016
by
CrazyRedScorp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added files via upload
parent
6a0b7b1a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
9 deletions
+7
-9
Telegram.php
src/Telegram.php
+7
-9
No files found.
src/Telegram.php
View file @
e7e160a7
...
...
@@ -252,8 +252,7 @@ class Telegram
$which
[]
=
'User'
;
foreach
(
$which
as
$auth
)
{
// $command_namespace = __NAMESPACE__ . '\\Commands\\' . $auth . 'Commands\\' . ucfirst($command) . 'Command';
$command_namespace
=
__NAMESPACE__
.
'\\Commands\\'
.
$auth
.
'Commands\\'
.
$this
->
mb_ucfirst
(
$command
)
.
'Command'
;
$command_namespace
=
__NAMESPACE__
.
'\\Commands\\'
.
$auth
.
'Commands\\'
.
$this
->
ucfirstUnicode
(
$command
)
.
'Command'
;
if
(
class_exists
(
$command_namespace
))
{
return
new
$command_namespace
(
$this
,
$this
->
update
);
}
...
...
@@ -431,8 +430,7 @@ class Telegram
*/
private
function
getCommandFromType
(
$type
)
{
// return ucfirst(str_replace('_', '', $type));
return
$this
->
mb_ucfirst
(
str_replace
(
'_'
,
''
,
$type
));
return
$this
->
ucfirstUnicode
(
str_replace
(
'_'
,
''
,
$type
));
}
/**
...
...
@@ -523,8 +521,7 @@ class Telegram
*/
protected
function
sanitizeCommand
(
$command
)
{
// return str_replace(' ', '', ucwords(str_replace('_', ' ', $command)));
return
str_replace
(
' '
,
''
,
$this
->
mb_ucwords
(
str_replace
(
'_'
,
' '
,
$command
)));
return
str_replace
(
' '
,
''
,
$this
->
ucwordsUnicode
(
str_replace
(
'_'
,
' '
,
$command
)));
}
/**
...
...
@@ -771,7 +768,8 @@ class Telegram
*
* @return string
*/
protected
function
mb_ucwords
(
$str
,
$encoding
=
'UTF-8'
)
{
protected
function
ucwordsUnicode
(
$str
,
$encoding
=
'UTF-8'
)
{
return
mb_convert_case
(
$str
,
MB_CASE_TITLE
,
$encoding
);
}
...
...
@@ -783,8 +781,8 @@ class Telegram
*
* @return string
*/
protected
function
mb_ucfirst
(
$str
,
$encoding
=
'UTF-8'
)
{
protected
function
ucfirstUnicode
(
$str
,
$encoding
=
'UTF-8'
)
{
return
mb_strtoupper
(
mb_substr
(
$str
,
0
,
1
,
$encoding
),
$encoding
)
.
mb_strtolower
(
mb_substr
(
$str
,
1
,
mb_strlen
(
$str
),
$encoding
),
$encoding
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment