Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Q
question2answer
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
outils
question2answer
Commits
f2e6f702
Commit
f2e6f702
authored
9 years ago
by
Scott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move polyfills to init function
Also define QA_PASSWORD_HASH for password strategy.
parent
0605eb99
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
22 deletions
+25
-22
qa-base.php
qa-include/qa-base.php
+25
-22
No files found.
qa-include/qa-base.php
View file @
f2e6f702
...
...
@@ -49,25 +49,6 @@
qa_initialize_php
();
qa_initialize_constants_1
();
/**
* JSON compatibility layer for PHP 5.1
*/
if
(
!
function_exists
(
'json_encode'
)
&&
!
function_exists
(
'json_decode'
))
{
require_once
QA_INCLUDE_DIR
.
'vendor/JSON.php'
;
function
json_encode
(
$json
)
{
$service
=
new
Services_JSON
();
return
$service
->
encode
(
$json
);
}
function
json_decode
(
$json
,
$assoc
=
false
)
{
$service
=
new
Services_JSON
(
$assoc
?
SERVICES_JSON_LOOSE_TYPE
:
0
);
return
$service
->
decode
(
$json
);
}
}
if
(
defined
(
'QA_WORDPRESS_LOAD_FILE'
))
// if relevant, load WordPress integration in global scope
require_once
QA_WORDPRESS_LOAD_FILE
;
...
...
@@ -77,9 +58,6 @@
qa_load_plugin_files
();
qa_load_override_files
();
if
(
!
qa_php_version_below
(
'5.3.7'
))
{
require_once
QA_INCLUDE_DIR
.
'vendor/password_compat.php'
;
}
require_once
QA_INCLUDE_DIR
.
'qa-db.php'
;
qa_db_allow_connect
();
...
...
@@ -199,6 +177,31 @@
if
(
!
is_readable
(
QA_WORDPRESS_LOAD_FILE
))
qa_fatal_error
(
'Could not find wp-load.php file for WordPress integration - please check QA_WORDPRESS_INTEGRATE_PATH in qa-config.php'
);
}
// Polyfills
// JSON compatibility layer for PHP 5.1
if
(
!
function_exists
(
'json_encode'
)
&&
!
function_exists
(
'json_decode'
))
{
require_once
QA_INCLUDE_DIR
.
'vendor/JSON.php'
;
function
json_encode
(
$json
)
{
$service
=
new
Services_JSON
();
return
$service
->
encode
(
$json
);
}
function
json_decode
(
$json
,
$assoc
=
false
)
{
$service
=
new
Services_JSON
(
$assoc
?
SERVICES_JSON_LOOSE_TYPE
:
0
);
return
$service
->
decode
(
$json
);
}
}
// password_hash compatibility for 5.3-5.4
define
(
'QA_PASSWORD_HASH'
,
!
qa_php_version_below
(
'5.3.7'
));
if
(
QA_PASSWORD_HASH
)
{
require_once
QA_INCLUDE_DIR
.
'vendor/password_compat.php'
;
}
}
...
...
This diff is collapsed.
Click to expand it.
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