Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bringing Composer to Q2A #887

Open
wants to merge 13 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@
ehthumbs.db
Thumbs.db
.idea/
/nbproject/private/
/nbproject/private/
vendor/
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ before_script:

script:
# PHP_CodeSniffer
- php phpcs.phar --report=emacs --extensions=php --standard=qa-tests/phpcs/ruleset.xml .
- php phpcs.phar --report=emacs --extensions=php --standard=qa-tests/phpcs/ruleset.xml index.php qa-src/ qa-include/ qa-external-example/qa-external-users.php
- php phpcs.phar --report=emacs --extensions=php --standard=qa-tests/phpcs/ruleset-strict.xml qa-src/
# PHPUnit
- php phpunit.phar --bootstrap qa-tests/autoload.php qa-tests
Expand All @@ -37,4 +37,3 @@ cache:

git:
depth: 5

42 changes: 42 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"name": "q2a/question2answer",
"description": "Question2Answer is a free and open source platform for Q&A sites, running on PHP/MySQL.",
"type": "project",
"license": "GPL-2.0",
"homepage": "https://www.question2answer.org/",
"authors": [
{
"name": "Gideon Greenspan",
"homepage": "http://www.gidgreen.com/"
}
],
"require": {
"phpmailer/phpmailer": "^5.2",
"ircmaxell/password-compat": "^1.0",
"htmlawed/htmlawed": "^1.1"
},
"require-dev": {
"phpunit/phpunit": "^5.7",
"squizlabs/php_codesniffer": "^3.5"
},
"scripts": {
"test": [
"@phpunit",
"@phpcs"
],
"phpcs": [
"@phpcs-loose",
"@phpcs-strict"
],
"phpunit": "phpunit --bootstrap qa-tests/autoload.php ./qa-tests/",
"phpcs-loose": "phpcs -p --report=emacs --extensions=php --standard=./qa-tests/phpcs/ruleset.xml index.php qa-src/ qa-include/ qa-external-example/qa-external-users.php",
"phpcs-strict": "phpcs -p --report=emacs --extensions=php --standard=./qa-tests/phpcs/ruleset-strict.xml qa-src/"
},
"scripts-descriptions": {
"test": "Runs all the tests",
"phpcs": "Checks that the code conforms to the Q2A coding standard",
"phpcs-loose": "Checks that the code conforms to the Q2A loose coding standard",
"phpcs-strict": "Checks that the code conforms to the Q2A strict coding standard",
"phpunit": "Runs the PHPUnit tests"
}
}
12 changes: 5 additions & 7 deletions qa-include/qa-base.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
define('QA_BUILD_DATE', '2020-07-15');


/**
* Load the Composer autoloader
*/
include(dirname(__FILE__) . '/../vendor/autoload.php');

/**
* Autoloads some Q2A classes so it's possible to use them without adding a require_once first. From
* version 1.9 onwards we follow PSR-4. Classes are stored in qa-src/ which maps to the 'Q2A' namespace.
Expand Down Expand Up @@ -199,15 +204,10 @@ function qa_initialize_constants_1()
}
}

require_once QA_INCLUDE_DIR . 'vendor/PHPMailer/PHPMailerAutoload.php';

// Polyfills

// 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';
}

// http://php.net/manual/en/function.hash-equals.php#115635
if (!function_exists('hash_equals')) {
Expand Down Expand Up @@ -1013,8 +1013,6 @@ function qa_sanitize_html($html, $linksnewwindow = false, $storage = false)
{
if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }

require_once 'vendor/htmLawed.php';

global $qa_sanitize_html_newwindow;

$qa_sanitize_html_newwindow = $linksnewwindow;
Expand Down
39 changes: 0 additions & 39 deletions qa-include/vendor/PHPMailer/PHPMailerAutoload.php

This file was deleted.

Loading