('replace_media_manager', 1)) { $option = $app->input->getCmd('option', ''); $asset = $app->input->getCmd('asset', ''); // joomla media field if ($option == 'com_media' && ($asset == 'com_content' || $asset == 'com_flexicontent')) { // set converted flag $app->input->set('converted', 1); return true; } } return false; } public function onAfterRoute() { if (false == $this->isEditorEnabled()) { return false; } // merge params with component $componentParams = ComponentHelper::getParams('com_jce'); $this->params->merge($componentParams); if ($this->canRedirectMedia() && $this->isEditorEnabled()) { // redirect to file browser $this->redirectMedia(); } } /** * Process the Joomla Media Field * * @param JForm $form The form to be altered * @param mixed $data The associated data for the form * * @return bool * * @since 2.5.20 */ public function processMediaFieldForm($form, $data) { $app = Factory::getApplication(); $docType = Factory::getDocument()->getType(); // must be an html doctype if ($docType !== 'html') { return true; } // Update MediaField parameters if (strpos($form->getName(), 'com_fields.field') === 0) { $tmpData = new Registry($data); // only for JCE Media Fields! if ($tmpData->get('type', '') == 'mediajce') { $mediafield = JPATH_PLUGINS . '/system/jcepro/forms/mediajce.xml'; if (is_file($mediafield)) { if ($mediafield_xml = simplexml_load_file($mediafield)) { $form->setField($mediafield_xml); } } } } // editor not enabled if (false == $this->isEditorEnabled()) { return true; } // Get File Browser options $options = WFBrowserHelper::getMediaFieldOptions(); // not enabled if (empty($options)) { return true; } $fields = $form->getFieldset(); $form->addFieldPath(JPATH_PLUGINS . '/fields/mediajce/fields'); foreach ($fields as $field) { $type = $field->getAttribute('type'); if (!$type) { continue; } // check if field type is supported if (!in_array(strtolower($type), $this->supportedFieldTypes)) { continue; } $name = $field->getAttribute('name'); // avoid processing twice if ($form->getFieldAttribute($name, 'class') && strpos($form->getFieldAttribute($name, 'class'), 'wf-media-input') !== false) { continue; } if ($type == 'media' || $type == 'fcmedia') { // media replacement disabled, skip... if ((bool) $options['convert'] === false) { continue; } // don't convert directory only fields (Joomla 6+) if ((string) $field->types == 'directories') { continue; } $group = (string) $field->group; $form->setFieldAttribute($name, 'type', 'mediajce', $group); $form->setFieldAttribute($name, 'converted', '1', $group); // set converted attribute flag instead of class attribute (extension conflict?) $form->setFieldAttribute($name, 'data-wf-converted', '1', $group); } $this->hasMedia = true; } return true; } /** * Process custom media fields * * @param stdClass $field The field. * @param DOMElement $fieldset The fieldset parent node. * @param Form $form The form. * * @return void */ public function onCustomFieldsPrepareDom($field, \DOMElement $fieldset, Form $form) { // check if field type is supported if (!in_array(strtolower($field->type), $this->supportedFieldTypes)) { return; } // is the editor enabled? if (!$this->isEditorEnabled()) { return; } $this->hasMedia = true; // mediafields enabled? if (!WfBrowserHelper::isMediaFieldEnabled()) { $field->disabled = true; return; } $this->fieldMap[$field->name] = $field; } /** * Add data-path attribute to Media Field input elements storing the directory parameter * * @return void */ public function onBeforeRender() { if ($this->hasMedia) { $options = WfBrowserHelper::getMediaFieldOptions(); $document = Factory::getDocument(); // Include jQuery HTMLHelper::_('jquery.framework'); $document = Factory::getDocument(); $document->addScript(Uri::root(true) . '/media/plg_system_jcepro/site/js/media.min.js', array('version' => 'auto')); // load core css files $document->addStyleSheet(Uri::root(true) . '/media/com_jce/site/css/media.min.css', array('version' => 'auto')); // no options set, return if (empty($options)) { return; } foreach ($this->fieldMap as $name => $field) { if ($field->type == 'mediajce' || $field->type == 'extendedmedia') { continue; } $directory = trim((string) $field->fieldparams->get('directory', ''), '/'); // remove the local-foo: prefix if necessary and trim the path if (strpos($directory, 'local-') === 0 && ($pos = strpos($directory, ':')) !== false) { $directory = substr($directory, $pos + 1); $directory = trim($directory, '/'); } $options['mediafields'][$name] = array( 'directory' => $directory ); } $document->addScriptOptions('plg_system_jce', $options, true); } } /** * Proxy function for PlgFieldsMediaJce::onCustomFieldsPrepareDom * Allows the JCE Pro System Plugin to edit the field before it is rendered * * @param FormField $field * @param DOMElement $fieldNode * @param Form $form * @return void */ public function onWfCustomFieldsPrepareDom($field, $fieldNode, Form $form) { // is the field disabled? This value is set in the onCustomFieldsPrepareDom event based on the media options if (isset($field->disabled)) { return; } $form->addFieldPath(JPATH_PLUGINS . '/system/jcepro/fields'); // Joomla 3 requires the fieldtype to be loaded FormHelper::loadFieldType('extendedmedia', false); // Set type as extendedmedia. This is the default type for JCE Pro and includes support for a simple media field $fieldNode->setAttribute('type', 'extendedmedia'); // set extendedmedia flag if ((int) $field->fieldparams->get('extendedmedia', 0) == 1) { $fieldNode->setAttribute('data-extendedmedia', '1'); } // allow for legacy media support, which removes the Description field if ((int) $field->fieldparams->get('legacymedia', 0) == 1) { $fieldNode->setAttribute('type', 'mediajce'); } } }
The server returned a "500 - Whoops, looks like something went wrong."