Skip to content

Commit

Permalink
Merge pull request #8 from fumikito/bugfix/session-start-error
Browse files Browse the repository at this point in the history
Bugfix/session start error
  • Loading branch information
fumikito authored Mar 26, 2024
2 parents 2dbf1d4 + 439bce0 commit 71e47f9
Show file tree
Hide file tree
Showing 52 changed files with 28,188 additions and 2,635 deletions.
5 changes: 5 additions & 0 deletions .browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# https://github.com/browserslist/browserslist#readme

>= 1%
last 2 major version
not dead
23 changes: 23 additions & 0 deletions .distignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
.browserslistrc
.editorconfig
.eslintrc
.distignore
.git
.github
.gitignore
.node-version
.stylelintrc.json
.wordpress-org
.wp-env.json
node_modules
composer.lock
package-lock.json
phpcs.ruleset.xml
phpunit.xml.dist
README.md
webpack.config.js
wordpress
bin
tests
anyway-feedback.php.bak
readme.txt.bak
25 changes: 25 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# This file is for unifying the coding style for different editors and IDEs
# editorconfig.org

# WordPress Coding Standards
# https://make.wordpress.org/core/handbook/coding-standards/

root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = tab
tab_width = 4

[*.yml]
indent_style = space
indent_size = 2

[*.md]
trim_trailing_whitespace = false

[{*.txt,wp-config-sample.php}]
end_of_line = crlf
39 changes: 39 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"parser": "@babel/eslint-parser",
"env": {
"browser": true,
"jquery": true
},
"globals": {
"wp": false,
"jQuery": false,
"ga": false
},
"extends": [
"plugin:@wordpress/eslint-plugin/recommended"
],
"ignorePatterns": ["**/*/*.min.js", "**/*/js.cookie.js"],
"rules": {
"no-alert": "off",
"prettier/prettier": "off",
"object-shorthand": "off",
"jsdoc/require-jsdoc": "off",
"jsdoc/no-undefined-types": "off",
"react/react-in-jsx-scope": "off",
"react/jsx-sort-props": "off",
"jsdoc/check-tag-names": "off",
"import/order": "off",
"no-prototype-builtins": "off",
"object-curly-newline": "off",
"object-property-newline": "off",
"yoda": "off",
"strict": "off",
"@wordpress/valid-sprintf": "off",
"camelcase": "off"
},
"settings": {
"react": {
"version": "16.9.0"
}
}
}
104 changes: 104 additions & 0 deletions .github/workflows/wordpress.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: Deploy Plugin

on:
push:
branches:
- master
tags:
- '*'
pull_request:
branches:
- master

jobs:
phpcs:
uses: tarosky/workflows/.github/workflows/phpcs.yml@main
with:
version: 8.0

phplint:
uses: tarosky/workflows/.github/workflows/phplint.yml@main

assets:
name: Assets Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main

- name: Install Node
uses: actions/setup-node@v3
with:
node-version: '16'

- name: Install NPM Packages
run: npm install

- name: Check JS & CSS syntax
run: npm run lint

release:
name: Deploy WordPress.org
needs: [ phpcs, phplint, assets ]
if: contains(github.ref, 'tags/')
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@main

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.2
tools: composer
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Install Node
uses: actions/setup-node@v3
with:
node-version: '16'

- name: Build Plugin
run: |
composer install --prefer-dist --no-dev
npm install
npm run package
- name: Generate readme.txt
uses: tarosky/workflows/actions/wp-readme@main

- name: Versioning
uses: tarosky/workflows/actions/versioning@main
with:
version: ${{ github.ref }}
files: readme.txt,anyway-feedback.php

- name: Deploy to WordPress Directory
id: deploy
uses: 10up/action-wordpress-plugin-deploy@stable
with:
generate-zip: true
env:
SVN_USERNAME: ${{ secrets.WP_ORG_USERNAME }}
SVN_PASSWORD: ${{ secrets.WP_ORG_PASSWORD }}

- name: Create Release
id: create_release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false

- name: Upload release asset
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ github.workspace }}/${{ github.event.repository.name }}.zip
asset_name: ${{ github.event.repository.name }}.zip
asset_content_type: application/zip
11 changes: 10 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
.DS_Store
.svn
.svn
/vendor/
/node_modules/
/assets/css/
/assets/js/*.min.js
/assets/js/js.cookie.js
/assets/vendor/
/dist/
readme.txt
composer.lock
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

17 changes: 17 additions & 0 deletions .stylelintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"extends": [
"stylelint-config-wordpress/scss"
],
"rules": {
"value-keyword-case": [ "lower", {
"ignoreProperties": [ "font-family" ]
} ],
"color-named": null,
"number-leading-zero": null,
"rule-empty-line-before": null,
"declaration-property-unit-whitelist": null,
"selector-class-pattern": null,
"at-rule-empty-line-before": null,
"no-descending-specificity": null
}
}
Binary file added .wordpress-org/banner-772x250.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .wordpress-org/icon-128x128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .wordpress-org/icon-256x256.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
File renamed without changes
6 changes: 6 additions & 0 deletions .wp-env.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"plugins": [ "." ],
"themes": [
"https://downloads.wordpress.org/theme/twentytwenty.latest-stable.zip"
]
}
14 changes: 8 additions & 6 deletions readme.md → README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# Anyway Feedback
Contributors: Takahashi_Fumiki

Contributors: Takahashi_Fumiki,hametuha
Tags: feedback, analytics
Requires at least: 3.8
Tested up to: 4.1-alpha
Stable tag: 1.0.1
Requires at least: 5.9
Requires PHP: 7.4
Tested up to: 6.4
Stable tag: nightly

This plugin enable users to send feedback with single click. This may support you to analyze your user's opinion. Works like Facebook's help center.
This plugin enable users to send feedback with single click. This may support you to analyze your user's opinion. Works as a help center for your site.

## Description

Expand Down Expand Up @@ -60,7 +62,7 @@ There are currently 2 ways. 1st is a feedback controller which displays number o

### 1.0

* Requires PHP 5.3 and over. Name space is so cool! Template tags have backward compatibility.
* Requires PHP 5.4 and over. Name space is so cool! Template tags have backward compatibility.
* Quit using session. Vote history will be stored in Cookie.
* Refine admin screen.
* Fix some style sheet.
Expand Down
67 changes: 19 additions & 48 deletions anyway-feedback.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php
/*
Plugin Name: Anyway Feedback
Plugin URI: http://wordpress.org/extend/plugins/anyway-feedback/
Plugin URI: https://wordpress.org/extend/plugins/anyway-feedback/
Description: Help to assemble simple feedback(negative or positive) and get statics of them.
Version: 1.0.1
Version: nightly
Author: Takahashi_Fumiki
Author URI: http://takahashifumiki.com
Author URI: https://takahashifumiki.com
Text Domain: anyway-feedback
Domain Path: /language/
License: GPL2 or Later
Expand All @@ -32,46 +32,30 @@
*/

defined( 'ABSPATH' ) || die( 'Do not load directly.' );

// Register Bootstrap
add_action("plugins_loaded", '_afb_init');
add_action( 'plugins_loaded', '_afb_init' );

/**
* Bootstrap
*/
function _afb_init(){
function _afb_init() {
// Set Text Domain
load_plugin_textdomain('anyway-feedback', false, 'anyway-feedback/language');
load_plugin_textdomain( 'anyway-feedback', false, 'anyway-feedback/language' );
// Check PHP version
if( version_compare(PHP_VERSION, '5.3.0', '<') ){
if ( version_compare( PHP_VERSION, '7.2.0', '<' ) ) {
// NG. Show message.
add_action('admin_notices', '_afb_too_old');
}else{
// O.K.
spl_autoload_register('_afb_auto_load');
add_action( 'admin_notices', '_afb_too_old' );
} else {
// Load composer.
require __DIR__ . '/vendor/autoload.php';
// Load functions
require_once dirname(__FILE__).DIRECTORY_SEPARATOR.'functions.php';
require_once dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'functions.php';
// Load main instance.
call_user_func(array('AFB\\Main', 'get_instance'));
AFB\Main::get_instance();
// Load Admin instance
call_user_func(array( 'AFB\\Admin\\Screen', 'get_instance'));
}
}

/**
* Auto loader
*
* @internal
* @ignore
* @param string $class_name
*/
function _afb_auto_load($class_name){
$class_name = explode('\\', trim($class_name, '\\'));
if( 'AFB' === $class_name[0] ){
$class_name[0] = dirname(__FILE__).DIRECTORY_SEPARATOR.'app';
$path = implode(DIRECTORY_SEPARATOR, $class_name).'.php';
if( file_exists($path) ){
require_once $path;
}
AFB\Admin\Screen::get_instance();
}
}

Expand All @@ -81,24 +65,11 @@ function _afb_auto_load($class_name){
* @ignore
* @internal
*/
function _afb_too_old(){
$message = esc_html(sprintf(__('Oops, Anyway Feedback doesn\'t work. You PHP Version is %s but PHP 5.3 and over required.', 'anyway-feedback'), PHP_VERSION));
function _afb_too_old() {
// translators: %s is PHP version.
$message = esc_html( sprintf( __( 'Oops, Anyway Feedback doesn\'t work. You PHP Version is %s but PHP 7.2 and over required.', 'anyway-feedback' ), PHP_VERSION ) );
echo <<<HTML
<div class="error"><p>{$message}</p></div>
HTML;

}

/**
* Just define for translation.
*
* @ignore
* @internal
* @global Anyway_Feedback $afb
* @return void
*/
function _afb_translation() {
global $afb;
$afb->_('Oops, Anyway Feedback doesn\'t work. You PHP Version is %s but PHP 5.3 and over required.');
$afb->_( "Help to assemble simple feedback(negative or positive) and get statics of them." );
}
Loading

0 comments on commit 71e47f9

Please sign in to comment.