Skip to content

Add OJS 3.5 support and a configurable article count#29

Open
edersotto wants to merge 1 commit into
ajnyga:masterfrom
edersotto:ojs-3.5-support
Open

Add OJS 3.5 support and a configurable article count#29
edersotto wants to merge 1 commit into
ajnyga:masterfrom
edersotto:ojs-3.5-support

Conversation

@edersotto

Copy link
Copy Markdown

What this adds

This PR brings the Most Read block plugin to OJS 3.5, plus a small feature.

1. OJS 3.5 compatibility

  • Replace PKP\cache\CacheManager with the Illuminate\Support\Facades\Cache facade.
  • Replace APP\i18n\AppLocale / APP\core\Services usage with the PKP\facades\Locale
    facade and Repo.
  • Adjust namespaced imports accordingly.

These calls target 3.5 APIs, so the branch is meant for the 3.5.x line (it will not run
on 3.4). See the note on branching below.

2. Configurable number of articles

A new "Number of articles" (mostReadCount) setting lets journal managers choose how
many items the block shows, with validation (whole number ≥ 1). Existing behavior is
preserved when the field is left empty.

3. Template hardening

  • Escape output (|escape) and only render the block when there are results
    ({if !empty($mostRead)}).
  • Rename the block CSS class from block_developed_by to block_most_read.

4. Housekeeping

  • PSR-12 formatting on the two PHP classes.
  • New locale keys (settings.count, settings.mostReadCountInvalid,
    settings.mostReadDaysRequired) added to en and pt_BR.
  • version.xml bumped to 3.5.0.1 (copyright header unchanged).

A note on branching

The changes require 3.5 and would break 3.4 if merged straight into a 3.4 master.
If you'd prefer, I'm happy to retarget this to a stable-3_5_0 branch (or rebase it
however you cut new OJS lines) — just let me know.

Context / credit

These changes come from work done at OJSBR while adapting the
plugin for OJS 3.5 deployments. Thanks for maintaining Most Read — it's widely used in the
Brazilian OJS community. Happy to iterate on anything here.

- Update to OJS 3.5 APIs: replace CacheManager with Illuminate Cache facade,
  AppLocale/Services with the Locale facade / Repo, and adjust namespaced imports.
- New 'Number of articles' (mostReadCount) setting to control how many items the
  block shows (defaults preserved when unset).
- Harden the block template: escape output and only render when there are results;
  rename the block CSS class to block_most_read.
- PSR-12 formatting; bump version to 3.5.0.1.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@ajnyga

ajnyga commented Jul 3, 2026

Copy link
Copy Markdown
Owner

thanks for this, looked very good with a quick glance.

I am on vacation right now, but will merge this soon.

I will move 3.4 to a dedicated branch and merge this to master to match the current main release of OJS. This is how I usually do with other plugins as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants