Skip to content

Commit 930aa31

Browse files
author
qinxuanwu
committed
Merge branch 'hotfix/h-1.1.6-CompatiblePHP'
2 parents cb76299 + 127452f commit 930aa31

33 files changed

+119
-0
lines changed

src/Bootstrap.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
/**
88
* Rbacp module bootstrap class.
99
*/
10+
use function \myzero1\rbacp\components\CompatiblePHP\PHP8\{strlen,trim,ltrim,rtrim,strpos,str_replace,implode,htmlspecialchars};
11+
1012
class Bootstrap implements BootstrapInterface
1113
{
1214
/**
@@ -24,6 +26,8 @@ class Bootstrap implements BootstrapInterface
2426
*/
2527
public function bootstrap($app)
2628
{
29+
require __DIR__ . '/components/CompatiblePHP/PHP8/functions.php';
30+
2731
$this->addConfig($app);
2832
$this->addTranslations($app);
2933
$this->addBehaviors($app);

src/Module.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
/**
1010
* captcha module definition class
1111
*/
12+
use function \myzero1\rbacp\components\CompatiblePHP\PHP8\{strlen,trim,ltrim,rtrim,strpos,str_replace,implode,htmlspecialchars};
13+
1214
class Module extends \yii\base\Module
1315
{
1416
public $theme = 'adminlteiframe'; // adminlteiframe,adminlte

src/assets/RbacpAsset.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
* Main asset for the `adminlte` theming
99
*/
1010

11+
use function \myzero1\rbacp\components\CompatiblePHP\PHP8\{strlen,trim,ltrim,rtrim,strpos,str_replace,implode,htmlspecialchars};
12+
1113
class RbacpAsset extends AssetBundle
1214
{
1315
public $sourcePath = '@vendor/myzero1/yii2-rbacp/src/assets';

src/behaviors/GlobalAccessBehavior.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
* Class GlobalAccessBehavior
99
* @package common\behaviors
1010
*/
11+
use function \myzero1\rbacp\components\CompatiblePHP\PHP8\{strlen,trim,ltrim,rtrim,strpos,str_replace,implode,htmlspecialchars};
12+
1113
class GlobalAccessBehavior extends Behavior
1214
{
1315
/**
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<?php
2+
namespace myzero1\rbacp\components\CompatiblePHP\PHP8;
3+
4+
// use function \myzero1\rbacp\components\CompatiblePHP\PHP8\{strlen,trim,ltrim,rtrim,strpos,str_replace,implode,htmlspecialchars};
5+
6+
function strlen($string) {
7+
$string=(string)$string;
8+
return \strlen($string);
9+
}
10+
function trim($string, string $characters = " \n\r\t\v\0") {
11+
$string=(string)$string;
12+
return \trim($string,$characters);
13+
}
14+
function ltrim($string, string $characters = " \n\r\t\v\0") {
15+
$string=(string)$string;
16+
return \ltrim($string,$characters);
17+
}
18+
function rtrim($string, string $characters = " \n\r\t\v\0") {
19+
$string=(string)$string;
20+
return \rtrim($string,$characters);
21+
}
22+
function strpos( $haystack, $needle, int $offset = 0) {
23+
$haystack=(string)$haystack;
24+
$needle=(string)$needle;
25+
return \strpos($haystack,$needle,$offset);
26+
}
27+
function str_replace( $search,$replace,$subject) {
28+
if (!in_array(gettype($search),['array','string '])) {
29+
$search=(string)$search;
30+
}
31+
if (!in_array(gettype($replace),['array','string '])) {
32+
$replace=(string)$replace;
33+
}
34+
if (!in_array(gettype($subject),['array','string '])) {
35+
$subject=(string)$subject;
36+
}
37+
38+
return \str_replace($search,$replace,$subject);
39+
}
40+
41+
function implode($separator, $array) {
42+
if(is_array($separator)){
43+
return \implode($array,$separator);
44+
} else {
45+
return \implode($separator,$array);
46+
}
47+
48+
}
49+
50+
function htmlspecialchars($separator, $array) {
51+
$separator=(string)$separator;
52+
return \htmlspecialchars($separator, $array);
53+
}

src/components/Rbac.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
*
1010
* @package myzero1\rbacp\components
1111
*/
12+
use function \myzero1\rbacp\components\CompatiblePHP\PHP8\{strlen,trim,ltrim,rtrim,strpos,str_replace,implode,htmlspecialchars};
13+
1214
class Rbac extends \yii\base\Component
1315
{
1416
/**

src/components/Rbacp.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
*
99
* @package myzero1\rbacp\components
1010
*/
11+
use function \myzero1\rbacp\components\CompatiblePHP\PHP8\{strlen,trim,ltrim,rtrim,strpos,str_replace,implode,htmlspecialchars};
12+
1113
class Rbacp extends \yii\base\Component
1214
{
1315
/**

src/components/libs/BaseHtml.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
* @author Qiang Xue <[email protected]>
2323
* @since 2.0
2424
*/
25+
use function \myzero1\rbacp\components\CompatiblePHP\PHP8\{strlen,trim,ltrim,rtrim,strpos,str_replace,implode,htmlspecialchars};
26+
2527
class BaseHtml
2628
{
2729
/**

src/components/libs/GridView.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@
4646
* @author Qiang Xue <[email protected]>
4747
* @since 2.0
4848
*/
49+
use function \myzero1\rbacp\components\CompatiblePHP\PHP8\{strlen,trim,ltrim,rtrim,strpos,str_replace,implode,htmlspecialchars};
50+
4951
class GridView extends BaseListView
5052
{
5153
const FILTER_POS_HEADER = 'header';

src/components/validators/NoSpecialStrValidator.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
*
1515
*
1616
*/
17+
use function \myzero1\rbacp\components\CompatiblePHP\PHP8\{strlen,trim,ltrim,rtrim,strpos,str_replace,implode,htmlspecialchars};
18+
1719
class NoSpecialStrValidator extends Validator
1820
{
1921
/**

src/controllers/DefaultController.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
/**
88
* Default controller for the `captcha` module
99
*/
10+
use function \myzero1\rbacp\components\CompatiblePHP\PHP8\{strlen,trim,ltrim,rtrim,strpos,str_replace,implode,htmlspecialchars};
11+
1012
class DefaultController extends Controller
1113
{
1214
/**

src/controllers/RbacpPolicyController.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
/**
1313
* RbacpPolicyController implements the CRUD actions for RbacpPolicy model.
1414
*/
15+
use function \myzero1\rbacp\components\CompatiblePHP\PHP8\{strlen,trim,ltrim,rtrim,strpos,str_replace,implode,htmlspecialchars};
16+
1517
class RbacpPolicyController extends Controller
1618
{
1719
/**

src/controllers/RbacpPrivilegeController.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
/**
1313
* RbacpPrivilegeController implements the CRUD actions for RbacpPrivilege model.
1414
*/
15+
use function \myzero1\rbacp\components\CompatiblePHP\PHP8\{strlen,trim,ltrim,rtrim,strpos,str_replace,implode,htmlspecialchars};
16+
1517
class RbacpPrivilegeController extends Controller
1618
{
1719
/**

src/controllers/RbacpRoleController.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
/**
1414
* RbacpRoleController implements the CRUD actions for RbacpRole model.
1515
*/
16+
use function \myzero1\rbacp\components\CompatiblePHP\PHP8\{strlen,trim,ltrim,rtrim,strpos,str_replace,implode,htmlspecialchars};
17+
1618
class RbacpRoleController extends Controller
1719
{
1820
/**

src/controllers/RbacpRolePrivilegeController.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
/**
1313
* RbacpRolePrivilegeController implements the CRUD actions for RbacpRolePrivilege model.
1414
*/
15+
use function \myzero1\rbacp\components\CompatiblePHP\PHP8\{strlen,trim,ltrim,rtrim,strpos,str_replace,implode,htmlspecialchars};
16+
1517
class RbacpRolePrivilegeController extends Controller
1618
{
1719
/**

src/controllers/RbacpUserViewController.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
/**
1616
* RbacpUserViewController implements the CRUD actions for RbacpUserView model.
1717
*/
18+
use function \myzero1\rbacp\components\CompatiblePHP\PHP8\{strlen,trim,ltrim,rtrim,strpos,str_replace,implode,htmlspecialchars};
19+
1820
class RbacpUserViewController extends Controller
1921
{
2022
/**

src/helper/Helper.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
* @author qinxuanwu
88
*
99
*/
10+
use function \myzero1\rbacp\components\CompatiblePHP\PHP8\{strlen,trim,ltrim,rtrim,strpos,str_replace,implode,htmlspecialchars};
11+
1012
class Helper {
1113
/**
1214
* Get the module's name of rbacp.

src/migrations/m171129_120101_rbacp_policy.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
use yii\db\Schema;
44

5+
use function \myzero1\rbacp\components\CompatiblePHP\PHP8\{strlen,trim,ltrim,rtrim,strpos,str_replace,implode,htmlspecialchars};
6+
57
class m171129_120101_rbacp_policy extends \yii\db\Migration
68
{
79
public function up()

src/migrations/m171129_120101_rbacp_privilege.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
use yii\db\Schema;
44

5+
use function \myzero1\rbacp\components\CompatiblePHP\PHP8\{strlen,trim,ltrim,rtrim,strpos,str_replace,implode,htmlspecialchars};
6+
57
class m171129_120101_rbacp_privilege extends \yii\db\Migration
68
{
79
public function up()

src/migrations/m171129_120101_rbacp_role.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
use yii\db\Schema;
44

5+
use function \myzero1\rbacp\components\CompatiblePHP\PHP8\{strlen,trim,ltrim,rtrim,strpos,str_replace,implode,htmlspecialchars};
6+
57
class m171129_120101_rbacp_role extends \yii\db\Migration
68
{
79
public function up()

src/migrations/m171129_120101_rbacp_userv_role.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
use yii\db\Schema;
44

5+
use function \myzero1\rbacp\components\CompatiblePHP\PHP8\{strlen,trim,ltrim,rtrim,strpos,str_replace,implode,htmlspecialchars};
6+
57
class m171129_120101_rbacp_userv_role extends \yii\db\Migration
68
{
79
public function up()

src/migrations/m171129_120101_user.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
use yii\db\Schema;
44

5+
use function \myzero1\rbacp\components\CompatiblePHP\PHP8\{strlen,trim,ltrim,rtrim,strpos,str_replace,implode,htmlspecialchars};
6+
57
class m171129_120101_user extends \yii\db\Migration
68
{
79
public function up()

src/models/RbacpActiveRecord.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
* Setting the default vaules
1414
*
1515
*/
16+
use function \myzero1\rbacp\components\CompatiblePHP\PHP8\{strlen,trim,ltrim,rtrim,strpos,str_replace,implode,htmlspecialchars};
17+
1618
class RbacpActiveRecord extends \yii\db\ActiveRecord
1719
{
1820
/**

src/models/RbacpPolicy.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
* @property integer $scope
1919
* @property integer $type
2020
*/
21+
use function \myzero1\rbacp\components\CompatiblePHP\PHP8\{strlen,trim,ltrim,rtrim,strpos,str_replace,implode,htmlspecialchars};
22+
2123
class RbacpPolicy extends RbacpActiveRecord
2224
{
2325
/**

src/models/RbacpPolicySearch.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
/**
1111
* RbacpPolicySearch represents the model behind the search form about `custom_components\modules\myzero1\rbacp\models\RbacpPolicy`.
1212
*/
13+
use function \myzero1\rbacp\components\CompatiblePHP\PHP8\{strlen,trim,ltrim,rtrim,strpos,str_replace,implode,htmlspecialchars};
14+
1315
class RbacpPolicySearch extends RbacpPolicy
1416
{
1517
/**

src/models/RbacpPrivilege.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
* @property integer $created
1616
* @property integer $updated
1717
*/
18+
use function \myzero1\rbacp\components\CompatiblePHP\PHP8\{strlen,trim,ltrim,rtrim,strpos,str_replace,implode,htmlspecialchars};
19+
1820
class RbacpPrivilege extends RbacpActiveRecord
1921
{
2022
/**

src/models/RbacpPrivilegeSearch.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
/**
1111
* RbacpPrivilegeSearch represents the model behind the search form about `custom_components\modules\myzero1\rbacp\models\RbacpPrivilege`.
1212
*/
13+
use function \myzero1\rbacp\components\CompatiblePHP\PHP8\{strlen,trim,ltrim,rtrim,strpos,str_replace,implode,htmlspecialchars};
14+
1315
class RbacpPrivilegeSearch extends RbacpPrivilege
1416
{
1517
/**

src/models/RbacpRole.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
* @property integer $updated
2222
* @property integer $author
2323
*/
24+
use function \myzero1\rbacp\components\CompatiblePHP\PHP8\{strlen,trim,ltrim,rtrim,strpos,str_replace,implode,htmlspecialchars};
25+
2426
class RbacpRole extends RbacpActiveRecord
2527
{
2628
public $rbacp_privilege_ids;

src/models/RbacpRolePrivilege.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
* @property integer $created
1717
* @property integer $updated
1818
*/
19+
use function \myzero1\rbacp\components\CompatiblePHP\PHP8\{strlen,trim,ltrim,rtrim,strpos,str_replace,implode,htmlspecialchars};
20+
1921
class RbacpRolePrivilege extends RbacpActiveRecord
2022
{
2123
// public $rbacp_user_view;

src/models/RbacpUserView.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
* @property string $last_ip
2626
* @property integer $last_time
2727
*/
28+
use function \myzero1\rbacp\components\CompatiblePHP\PHP8\{strlen,trim,ltrim,rtrim,strpos,str_replace,implode,htmlspecialchars};
29+
2830
class RbacpUserView extends RbacpActiveRecord
2931
{
3032
const STATUS_ACTIVE = 10;

src/models/RbacpUserViewSearch.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
/**
1111
* RbacpUserViewSearch represents the model behind the search form about `custom_components\modules\myzero1\rbacp\models\RbacpUserView`.
1212
*/
13+
use function \myzero1\rbacp\components\CompatiblePHP\PHP8\{strlen,trim,ltrim,rtrim,strpos,str_replace,implode,htmlspecialchars};
14+
1315
class RbacpUserViewSearch extends RbacpUserView
1416
{
1517
public $role_name;

src/models/RbacpUservRole.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
* @property integer $role_id
1111
* @property integer $userv_id
1212
*/
13+
use function \myzero1\rbacp\components\CompatiblePHP\PHP8\{strlen,trim,ltrim,rtrim,strpos,str_replace,implode,htmlspecialchars};
14+
1315
class RbacpUservRole extends \yii\db\ActiveRecord
1416
{
1517
/**

src/models/UserView.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
/**
99
* Login form
1010
*/
11+
use function \myzero1\rbacp\components\CompatiblePHP\PHP8\{strlen,trim,ltrim,rtrim,strpos,str_replace,implode,htmlspecialchars};
12+
1113
class UserView extends Model
1214
{
1315
public $createDefaultTable;

0 commit comments

Comments
 (0)