Skip to content

Instantly share code, notes, and snippets.

@NateWr
NateWr / JATS-editor-tags.md
Created September 21, 2020 10:35
JATS tags that a web-based editor deployed with PKP applications should support.

JATS Editor Tag Support

This document describes the JATS tags that should be supported by a web-based editor in PKP applications. This is a limited set of JATS tags that PKP considers valuable for writing and publishing full-text articles online using OJS.

The tags described here are those that are necessary for generating the full text of an article. It does not include tags related to frontmatter or backmatter that are not used in the article body, and which can be generated from OJS's existing metadata features.

MVP

The following tags are necessary for most of our community to be able to use the editor. The goal is to achieve parity with something like a regular HTML rich-text editor, such as TinyMCE, by supporting text, tables and images.

@NateWr
NateWr / constants.php
Created July 8, 2020 14:00
A CLI tool for OJS/OMP/OPS to get the value of application constants.
<?php
/**
* @file tools/constants.php
*
* Copyright (c) 2014-2020 Simon Fraser University
* Copyright (c) 2003-2020 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
* @class constants
@NateWr
NateWr / removeLocaleKey.php
Last active June 22, 2020 15:12
A tool for OJS|OMP|OPS to remove a locale key from every locale.
// This has been added to the main repositories for OJS, OMP and OPS. Run the following CLI command:
//
// php lib/pkp/tools/removeLocaleKey.php locale.key
@NateWr
NateWr / comment-blacklist-for-rtb.php
Last active August 6, 2019 08:04
Check new bookings for blacklisted words in comments for Restaurant Reservations
<?php
/**
* Plugin Name: Comment Blacklist for Restaurant Reservations
* Plugin URI: http://themeofthecrop.com
* Description: Check if a booking includes blacklisted words from Settings > Discussion > Comment Blacklist before accepting it.
* Version: 1.0
* Author: Theme of the Crop
* Author URI: http://themeofthecrop.com
* License: GNU General Public License v2.0 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
@NateWr
NateWr / remove-publishing-mode.php
Last active May 7, 2019 14:02
Remove the publishingMode setting from the access form for everyone except the site admin.
<?php
/**
* Remove the publishingMode setting from the access form for
* everyone except the site admin
*/
HookRegistry::register('Form::config::before', function ($hookName, $form) {
if (!defined('FORM_ACCESS') || $form->id !== FORM_ACCESS) {
return;
}
if (/* user is not an admin */) {
@NateWr
NateWr / block-publishing-mode.php
Created May 7, 2019 13:53
Block requests to change the publishingMode setting from anyone except the site admin.
<?php
/**
* Refuse requests to change the publishingMode setting from anyone
* except the site admin.
*/
HookRegistry::register('Context::validate', function($hookName, $args) {
$errors &= $args[0];
$props &=$args[2];
if (/* user is not an admin */) {
@NateWr
NateWr / js2_test.md
Last active April 27, 2019 10:05 — forked from rarmatei/js2_test.md

What is the value result in these code snippets

// 1
var writerAge = 10
var result = writerAge + 5
20
// 2
@NateWr
NateWr / GenerateMetrics.php
Last active June 22, 2020 15:14
A CLI tool to generate fake metrics data.
// This tool is now available in the main development repositories for OJS, OMP and OPS.
// Run the following command from the root directory of any application to get usage
// instructions.
//
// php lib/pkp/tools/generateTestMetrics.php
@NateWr
NateWr / date-time-template-tags-for-rtb.php
Created April 10, 2019 08:04
Add separate template tags for the date and time of the booking request.
<?php
/**
* Plugin Name: Date and Time Template Tags for Restaurant Reservations
* Plugin URI: http://themeofthecrop.com
* Description: Add separate template tags for the date and time of the booking request.
* Version: 0.0.1
* Author: Theme of the Crop
* Author URI: http://themeofthecrop.com
* License: GNU General Public License v2.0 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
@NateWr
NateWr / email-templates-for-rtb-logo-size.php
Created March 5, 2019 08:47
Use a custom logo size for the email templates addon for Restaurant Reservations.
<?php
/**
* Plugin Name: Custom Logo Size for Email Templates for Restaurant Reservations
* Plugin URI: http://themeofthecrop.com
* Description: Use a custom logo size for the email templates addon for Restaurant Reservations.
* Version: 1.0
* Author: Theme of the Crop
* Author URI: http://themeofthecrop.com
* License: GNU General Public License v2.0 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.html