Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / 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 / 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 / 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 / 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.