Skip to content
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
16 changes: 8 additions & 8 deletions admin/class-h5p-content-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function __construct($plugin_slug) {
* @return string
*/
public function alter_title($page, $admin_title, $title) {
$task = filter_input(INPUT_GET, 'task', FILTER_SANITIZE_STRING);
$task = filter_input(INPUT_GET, 'task', FILTER_UNSAFE_RAW);
$id = filter_input(INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT);

// Find content title
Expand Down Expand Up @@ -176,7 +176,7 @@ private function current_user_can_view_content_results($content) {
* @since 1.1.0
*/
public function display_contents_page() {
switch (filter_input(INPUT_GET, 'task', FILTER_SANITIZE_STRING)) {
switch (filter_input(INPUT_GET, 'task', FILTER_UNSAFE_RAW)) {
case NULL:
include_once('views/contents.php');

Expand Down Expand Up @@ -872,7 +872,7 @@ private function format_time($timestamp) {
private function format_tags($tags) {
// Tags come in CSV format, create Array instead
$result = array();
$csvtags = explode(';', $tags);
$csvtags = !empty($tags)?explode(';', $tags):[];
foreach ($csvtags as $csvtag) {
if ($csvtag !== '') {
$tag = explode(',', $csvtag);
Expand Down Expand Up @@ -1087,7 +1087,7 @@ public function ajax_libraries() {
$editor = $this->get_h5peditor_instance();

// Get input
$name = filter_input(INPUT_GET, 'machineName', FILTER_SANITIZE_STRING);
$name = filter_input(INPUT_GET, 'machineName', FILTER_UNSAFE_RAW);
$major_version = filter_input(INPUT_GET, 'majorVersion', FILTER_SANITIZE_NUMBER_INT);
$minor_version = filter_input(INPUT_GET, 'minorVersion', FILTER_SANITIZE_NUMBER_INT);

Expand Down Expand Up @@ -1117,7 +1117,7 @@ public function ajax_libraries() {
* Get content type cache
*/
public function ajax_content_type_cache() {
$token = filter_input(INPUT_GET, 'token', FILTER_SANITIZE_STRING);
$token = filter_input(INPUT_GET, 'token', FILTER_UNSAFE_RAW);

$editor = $this->get_h5peditor_instance();
$editor->ajax->action(H5PEditorEndpoints::CONTENT_TYPE_CACHE, $token);
Expand All @@ -1128,7 +1128,7 @@ public function ajax_content_type_cache() {
* Get translations
*/
public function ajax_translations() {
$language = filter_input(INPUT_GET, 'language', FILTER_SANITIZE_STRING);
$language = filter_input(INPUT_GET, 'language', FILTER_UNSAFE_RAW);

$editor = $this->get_h5peditor_instance();
$editor->ajax->action(H5PEditorEndpoints::TRANSLATIONS, $language);
Expand All @@ -1141,7 +1141,7 @@ public function ajax_translations() {
* @since 1.1.0
*/
public function ajax_files() {
$token = filter_input(INPUT_GET, 'token', FILTER_SANITIZE_STRING);
$token = filter_input(INPUT_GET, 'token', FILTER_UNSAFE_RAW);
$contentId = filter_input(INPUT_POST, 'contentId', FILTER_SANITIZE_NUMBER_INT);

$editor = $this->get_h5peditor_instance();
Expand Down Expand Up @@ -1176,7 +1176,7 @@ public function ajax_content_results() {
* @since 1.14.0
*/
public function ajax_filter() {
$token = filter_input(INPUT_GET, 'token', FILTER_SANITIZE_STRING);
$token = filter_input(INPUT_GET, 'token', FILTER_UNSAFE_RAW);
$libraryParameters = filter_input(INPUT_POST, 'libraryParameters');

$editor = $this->get_h5peditor_instance();
Expand Down
4 changes: 2 additions & 2 deletions admin/class-h5p-content-query.php
Original file line number Diff line number Diff line change
Expand Up @@ -395,9 +395,9 @@ protected function order_results_by(
*
* @param array $results Array of objects to limit.
* @param int $offset Offset to start at.
* @param int $limit Number of items to return.
* @param int $limit Number of items to return. Default 10
*/
protected function limit_results( $results = array(), $offset = 0, $limit ) {
protected function limit_results( $results = array(), $offset = 0, $limit = 10 ) {
return array_slice( $results, $offset, $limit );
}
}
2 changes: 1 addition & 1 deletion admin/class-h5p-editor-wordpress-storage.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public function getLibraries($libraries = NULL) {
$library->title = $details->title;
$library->runnable = $details->runnable;
$library->restricted = $super_user ? FALSE : ($details->restricted === '1' ? TRUE : FALSE);
$library->metadataSettings = json_decode($details->metadata_settings);
$library->metadataSettings = $details->metadata_settings?json_decode($details->metadata_settings):[];
$librariesWithDetails[] = $library;
}
}
Expand Down
4 changes: 2 additions & 2 deletions admin/class-h5p-library-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function __construct($plugin_slug) {
* @return string
*/
public function alter_title($page, $admin_title, $title) {
$task = filter_input(INPUT_GET, 'task', FILTER_SANITIZE_STRING);
$task = filter_input(INPUT_GET, 'task', FILTER_UNSAFE_RAW);

// Find library title
$show = ($task === 'show');
Expand Down Expand Up @@ -111,7 +111,7 @@ private function get_library($id = NULL) {
* @since 1.1.0
*/
public function display_libraries_page() {
switch (filter_input(INPUT_GET, 'task', FILTER_SANITIZE_STRING)) {
switch (filter_input(INPUT_GET, 'task', FILTER_UNSAFE_RAW)) {
case NULL:
$this->display_libraries();
return;
Expand Down
2 changes: 1 addition & 1 deletion admin/class-h5p-plugin-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ public function display_settings_page() {
* @return string
*/
public function alter_title($admin_title, $title) {
$page = filter_input(INPUT_GET, 'page', FILTER_SANITIZE_STRING);
$page = filter_input(INPUT_GET, 'page', FILTER_UNSAFE_RAW);

switch ($page) {
case 'h5p':
Expand Down
6 changes: 6 additions & 0 deletions public/class-h5p-wordpress.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ class H5PWordPress implements H5PFrameworkInterface {
*/
private $networkSettings = array( 'content_type_cache_updated_at' );

/**
* Fix for php warning function
*
*/
public $plugin_slug;

/**
* Implements setErrorMessage
*/
Expand Down