public/wordpress/wp-content/plugins/h5p/admin/class-h5p-content-admin.php
/**
   * Display a form for adding and editing h5p content.
   *
   * @since 1.1.0
   */
Display a form for adding and editing h5p content.
Display a form for adding and editing h5p content .
public function display_new_content_page() {
    if (!get_option('h5p_has_request_user_consent', FALSE) && current_user_can('manage_options')) {
      return include_once('views/user-consent.php');
    }
    $contentExists = ($this->content !== NULL && !is_string($this->content));
    $hubIsEnabled = get_option('h5p_hub_is_enabled', TRUE);
    $plugin = H5P_Plugin::get_instance();
    $core = $plugin->get_h5p_instance('core');
    $library = $this->get_input('library', $contentExists ? H5PCore::libraryToString($this->content['library']) : 0);
    $parameters = $this->get_input('parameters', '{"params":' . ($contentExists ? $core->filterParameters($this->content) : '{}') . ',"metadata":' . json_encode((object)$this->content['metadata']) . '}');
    if (!$hubIsEnabled && !$contentExists && !$this->has_libraries()) {
      $upload = TRUE;
      $examplesHint = TRUE;
    }
    else {
      $upload = (filter_input(INPUT_POST, 'action') === 'upload');
      $examplesHint = FALSE;
    }
    $safe_text = wp_check_invalid_utf8($parameters);
    $safe_text = _wp_specialchars($safe_text, ENT_QUOTES, false, true);
    $parameters = apply_filters('attribute_escape', $safe_text, $parameters);
    $display_options = $core->getDisplayOptionsForEdit($contentExists ? $this->content['disable'] : NULL);
    include_once('views/new-content.php');
    $this->add_editor_assets($contentExists ? $this->content['id'] : NULL);
    H5P_Plugin_Admin::add_script('jquery', 'h5p-php-library/js/jquery.js');
    H5P_Plugin_Admin::add_script('disable', 'h5p-php-library/js/h5p-display-options.js');
    H5P_Plugin_Admin::add_script('toggle', 'admin/scripts/h5p-toggle.js');
    if ($contentExists) {
      new H5P_Event('content', 'edit',
          $this->content['id'],
          $this->content['title'],
          $this->content['library']['name'],
          $this->content['library']['majorVersion'] . '.' . $this->content['library']['minorVersion']);
    }
    else {
      new H5P_Event('content', 'new');
    }
  }
public function display_new_content_page ( ) { if ( ! get_option ( 'h5p_has_request_user_consent' , FALSE ) && current_user_can ( 'manage_options' ) ) { return include_once ( 'views/user-consent.php' ) ; } $ contentExists = ( $ this -> content !== NULL && ! is_string ( $ this -> content ) ) ; $ hubIsEnabled = get_option ( 'h5p_hub_is_enabled' , TRUE ) ; $ plugin = H5P_Plugin :: get_instance ( ) ; $ core = $ plugin -> get_h5p_instance ( 'core' ) ; $ library = $ this -> get_input ( 'library' , $ contentExists ? H5PCore :: libraryToString ( $ this -> content [ 'library' ] ) : 0 ) ; $ parameters = $ this -> get_input ( 'parameters' , '{"params":' . ( $ contentExists ? $ core -> filterParameters ( $ this -> content ) : '{}' ) . ',"metadata":' . json_encode ( ( object ) $ this -> content [ 'metadata' ] ) . '}' ) ; if ( ! $ hubIsEnabled && ! $ contentExists && ! $ this -> has_libraries ( ) ) { $ upload = TRUE ; $ examplesHint = TRUE ; } else { $ upload = ( filter_input ( INPUT_POST , 'action' ) === 'upload' ) ; $ examplesHint = FALSE ; } $ safe_text = wp_check_invalid_utf8 ( $ parameters ) ; $ safe_text = _wp_specialchars ( $ safe_text , ENT_QUOTES , false , true ) ; $ parameters = apply_filters ( 'attribute_escape' , $ safe_text , $ parameters ) ; $ display_options = $ core -> getDisplayOptionsForEdit ( $ contentExists ? $ this -> content [ 'disable' ] : NULL ) ; include_once ( 'views/new-content.php' ) ; $ this -> add_editor_assets ( $ contentExists ? $ this -> content [ 'id' ] : NULL ) ; H5P_Plugin_Admin :: add_script ( 'jquery' , 'h5p-php-library/js/jquery.js' ) ; H5P_Plugin_Admin :: add_script ( 'disable' , 'h5p-php-library/js/h5p-display-options.js' ) ; H5P_Plugin_Admin :: add_script ( 'toggle' , 'admin/scripts/h5p-toggle.js' ) ; if ( $ contentExists ) { new H5P_Event ( 'content' , 'edit' , $ this -> content [ 'id' ] , $ this -> content [ 'title' ] , $ this -> content [ 'library' ] [ 'name' ] , $ this -> content [ 'library' ] [ 'majorVersion' ] . '.' . $ this -> content [ 'library' ] [ 'minorVersion' ] ) ; } else { new H5P_Event ( 'content' , 'new' ) ; } }
Display a form for adding and editing h5p content.
Display a form for adding and editing h5p content .
// Get the user to enable the Hub before creating content // Prepare form // Determine upload or create // Filter/escape parameters, double escape that is... // Log editor opened