[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * @package Joomla.Administrator 5 * @subpackage com_templates 6 * 7 * @copyright (C) 2008 Open Source Matters, Inc. <https://www.joomla.org> 8 * @license GNU General Public License version 2 or later; see LICENSE.txt 9 */ 10 11 defined('_JEXEC') or die; 12 13 use Joomla\CMS\Factory; 14 use Joomla\CMS\HTML\HTMLHelper; 15 use Joomla\CMS\Language\Text; 16 use Joomla\CMS\Layout\LayoutHelper; 17 use Joomla\CMS\Router\Route; 18 use Joomla\CMS\Session\Session; 19 20 HTMLHelper::_('behavior.multiselect', 'updateForm'); 21 HTMLHelper::_('bootstrap.modal'); 22 23 /** @var Joomla\CMS\WebAsset\WebAssetManager $wa */ 24 $wa = $this->document->getWebAssetManager(); 25 $input = Factory::getApplication()->input; 26 27 // Enable assets 28 $wa->useScript('form.validate') 29 ->useScript('keepalive') 30 ->useScript('diff') 31 ->useScript('com_templates.admin-template-compare') 32 ->useScript('com_templates.admin-template-toggle-switch'); 33 34 // No access if not global SuperUser 35 if (!Factory::getUser()->authorise('core.admin')) { 36 Factory::getApplication()->enqueueMessage(Text::_('JERROR_ALERTNOAUTHOR'), 'danger'); 37 } 38 39 if ($this->type == 'image') { 40 $wa->usePreset('cropperjs'); 41 } 42 43 $wa->useStyle('com_templates.admin-templates') 44 ->useScript('com_templates.admin-templates'); 45 46 if ($this->type == 'font') { 47 $wa->addInlineStyle(" 48 @font-face { 49 font-family: previewFont; 50 src: url('" . $this->font['address'] . "') 51 } 52 .font-preview { 53 font-family: previewFont !important; 54 } 55 "); 56 } 57 ?> 58 59 <div class="main-card"> 60 <?php echo HTMLHelper::_('uitab.startTabSet', 'myTab', ['active' => 'editor', 'recall' => true, 'breakpoint' => 768]); ?> 61 <?php echo HTMLHelper::_('uitab.addTab', 'myTab', 'editor', Text::_('COM_TEMPLATES_TAB_EDITOR')); ?> 62 <div class="row mt-2"> 63 <div class="col-md-8" id="conditional-section"> 64 <?php if ($this->type == 'file') : ?> 65 <p class="lead"><?php echo Text::sprintf('COM_TEMPLATES_TEMPLATE_FILENAME', '‎' . ($input->get('isMedia', 0) ? '/media/templates/' . ($this->template->client_id === 0 ? 'site' : 'administrator') . '/' . $this->template->element . str_replace('//', '/', base64_decode($this->file)) : '/' . ($this->template->client_id === 0 ? '' : 'administrator/') . 'templates/' . $this->template->element . str_replace('//', '/', base64_decode($this->file))), $this->template->element); ?></p> 66 <p class="lead path hidden"><?php echo $this->source->filename; ?></p> 67 <?php endif; ?> 68 <?php if ($this->type == 'image') : ?> 69 <p class="lead"><?php echo Text::sprintf('COM_TEMPLATES_TEMPLATE_FILENAME', '‎' . $this->image['path'], $this->template->element); ?></p> 70 <p class="lead path hidden"><?php echo $this->image['path']; ?></p> 71 <?php endif; ?> 72 <?php if ($this->type == 'font') : ?> 73 <p class="lead"><?php echo Text::sprintf('COM_TEMPLATES_TEMPLATE_FILENAME', '‎' . $this->font['rel_path'], $this->template->element); ?></p> 74 <p class="lead path hidden"><?php echo $this->font['rel_path']; ?></p> 75 <?php endif; ?> 76 </div> 77 <?php if ($this->type == 'file' && !empty($this->source->coreFile)) : ?> 78 <div class="col-md-4 text-end"> 79 <div id="toggle-buttons"> 80 <?php echo $this->form->renderField('show_core'); ?> 81 <?php echo $this->form->renderField('show_diff'); ?> 82 </div> 83 </div> 84 <?php endif; ?> 85 </div> 86 <div class="row mt-2"> 87 <div id="treeholder" class="col-md-3 tree-holder"> 88 <div class="mt-2 mb-2"> 89 <ul class="directory-tree treeselect"> 90 <li class="folder-select"> 91 <a class="folder-url" data-id="" href=""> 92 <span class="icon-folder icon-fw" aria-hidden="true"></span> 93 <?php echo ($this->template->client_id === 0 ? '/' : '/administrator/') . 'templates/' . $this->template->element; ?> 94 </a> 95 <?php echo $this->loadTemplate('tree'); ?> 96 </li> 97 </ul> 98 <?php if (count($this->mediaFiles)) : ?> 99 <ul class="directory-tree treeselect"> 100 <li class="folder-select"> 101 <a class="folder-url" data-id="" href=""> 102 <span class="icon-folder icon-fw" aria-hidden="true"></span> 103 <?php echo '/media/templates/' . ($this->template->client_id === 0 ? 'site/' : 'administrator/') . $this->template->element; ?> 104 </a> 105 <?php echo $this->loadTemplate('tree_media'); ?> 106 </li> 107 </ul> 108 <?php endif; ?> 109 </div> 110 </div> 111 <div class="col-md-9"> 112 <fieldset class="options-form"> 113 <?php if ($this->type == 'home') : ?> 114 <legend><?php echo Text::_('COM_TEMPLATES_HOME_HEADING'); ?></legend> 115 <form action="<?php echo Route::_('index.php?option=com_templates&view=template&id=' . $input->getInt('id') . '&file=' . $this->file . '&isMedia=' . $input->get('isMedia', 0)); ?>" method="post" name="adminForm" id="adminForm"> 116 <input type="hidden" name="task" value=""> 117 <?php echo HTMLHelper::_('form.token'); ?> 118 <p><?php echo Text::_('COM_TEMPLATES_HOME_TEXT'); ?></p> 119 <p> 120 <a href="https://docs.joomla.org/Special:MyLanguage/J3.x:How_to_use_the_Template_Manager" target="_blank" rel="noopener" class="btn btn-primary btn-lg"> 121 <?php echo Text::_('COM_TEMPLATES_HOME_BUTTON'); ?> 122 </a> 123 </p> 124 </form> 125 <?php elseif ($this->type == 'file') : ?> 126 <div class="row"> 127 <div class="col-md-12" id="override-pane"> 128 <?php $overrideCheck = explode(DIRECTORY_SEPARATOR, $this->source->filename); ?> 129 <?php if (!empty($this->source->coreFile)) : ?> 130 <h2><?php echo Text::_('COM_TEMPLATES_FILE_OVERRIDE_PANE'); ?></h2> 131 <?php endif; ?> 132 <form action="<?php echo Route::_('index.php?option=com_templates&view=template&id=' . $input->getInt('id') . '&file=' . $this->file . '&isMedia=' . $input->get('isMedia', 0)); ?>" method="post" name="adminForm" id="adminForm"> 133 <input type="hidden" name="isMedia" value="<?php echo $input->get('isMedia', 0); ?>"> 134 <div class="editor-border"> 135 <?php echo $this->form->getInput('source'); ?> 136 </div> 137 <input type="hidden" name="task" value="" /> 138 <?php echo HTMLHelper::_('form.token'); ?> 139 <?php echo $this->form->getInput('extension_id'); ?> 140 <?php echo $this->form->getInput('filename'); ?> 141 </form> 142 </div> 143 <?php if (!empty($this->source->coreFile)) : ?> 144 <?php $coreFileContent = file_get_contents($this->source->coreFile); ?> 145 <?php $overrideFileContent = file_get_contents($this->source->filePath); ?> 146 <div class="col-md-12" id="core-pane"> 147 <h2><?php echo Text::_('COM_TEMPLATES_FILE_CORE_PANE'); ?></h2> 148 <div class="editor-border"> 149 <?php echo $this->form->getInput('core'); ?> 150 </div> 151 </div> 152 <div class="col-md-12" id="diff-main"> 153 <h2><?php echo Text::_('COM_TEMPLATES_FILE_COMPARE_PANE'); ?></h2> 154 <div class="diff-pane"> 155 <div class="diffview d-none" id="original"><?php echo htmlspecialchars($coreFileContent, ENT_COMPAT, 'UTF-8'); ?></div> 156 <div class="diffview d-none" id="changed"><?php echo htmlspecialchars($overrideFileContent, ENT_COMPAT, 'UTF-8'); ?></div> 157 <div id="diff"></div> 158 </div> 159 </div> 160 <?php endif; ?> 161 </div> 162 <?php elseif ($this->type == 'archive') : ?> 163 <legend><?php echo Text::_('COM_TEMPLATES_FILE_CONTENT_PREVIEW'); ?></legend> 164 <form action="<?php echo Route::_('index.php?option=com_templates&view=template&id=' . $input->getInt('id') . '&file=' . $this->file . '&isMedia=' . $input->get('isMedia', 0)); ?>" method="post" name="adminForm" id="adminForm"> 165 <ul class="nav flex-column well"> 166 <?php foreach ($this->archive as $file) : ?> 167 <li> 168 <?php if (substr($file, -1) === DIRECTORY_SEPARATOR) : ?> 169 <span class="icon-folder icon-fw" aria-hidden="true"></span> <?php echo $file; ?> 170 <?php endif; ?> 171 <?php if (substr($file, -1) != DIRECTORY_SEPARATOR) : ?> 172 <span class="icon-file icon-fw" aria-hidden="true"></span> <?php echo $file; ?> 173 <?php endif; ?> 174 </li> 175 <?php endforeach; ?> 176 </ul> 177 <input type="hidden" name="task" value=""> 178 <?php echo HTMLHelper::_('form.token'); ?> 179 </form> 180 <?php elseif ($this->type == 'image') : ?> 181 <legend><?php echo $this->escape(basename($this->image['address'])); ?></legend> 182 <img id="image-crop" src="<?php echo $this->image['address'] . '?' . time(); ?>" style="max-width: 100%"> 183 <form action="<?php echo Route::_('index.php?option=com_templates&view=template&id=' . $input->getInt('id') . '&file=' . $this->file . '&isMedia=' . $input->get('isMedia', 0)); ?>" method="post" name="adminForm" id="adminForm"> 184 <fieldset class="adminform"> 185 <input type="hidden" id="x" name="x"> 186 <input type="hidden" id="y" name="y"> 187 <input type="hidden" id="h" name="h"> 188 <input type="hidden" id="w" name="w"> 189 <input type="hidden" id="imageWidth" value="<?php echo $this->image['width']; ?>"> 190 <input type="hidden" id="imageHeight" value="<?php echo $this->image['height']; ?>"> 191 <input type="hidden" name="task" value=""> 192 <?php echo HTMLHelper::_('form.token'); ?> 193 </fieldset> 194 </form> 195 <?php elseif ($this->type == 'font') : ?> 196 <div class="font-preview"> 197 <form action="<?php echo Route::_('index.php?option=com_templates&view=template&id=' . $input->getInt('id') . '&file=' . $this->file . '&isMedia=' . $input->get('isMedia', 0)); ?>" method="post" name="adminForm" id="adminForm"> 198 <fieldset class="adminform"> 199 <h1>H1. Quickly gaze at Joomla! views from HTML, CSS, JavaScript and XML</h1> 200 <h2>H2. Quickly gaze at Joomla! views from HTML, CSS, JavaScript and XML</h2> 201 <h3>H3. Quickly gaze at Joomla! views from HTML, CSS, JavaScript and XML</h3> 202 <h4>H4. Quickly gaze at Joomla! views from HTML, CSS, JavaScript and XML</h4> 203 <h5>H5. Quickly gaze at Joomla! views from HTML, CSS, JavaScript and XML</h5> 204 <h6>H6. Quickly gaze at Joomla! views from HTML, CSS, JavaScript and XML</h6> 205 <p><strong>Bold. Quickly gaze at Joomla! views from HTML, CSS, JavaScript and XML</strong></p> 206 <p><em>Italics. Quickly gaze at Joomla! views from HTML, CSS, JavaScript and XML</em></p> 207 <p>Unordered List</p> 208 <ul> 209 <li>Item</li> 210 <li>Item</li> 211 <li>Item<br> 212 <ul> 213 <li>Item</li> 214 <li>Item</li> 215 <li>Item<br> 216 <ul> 217 <li>Item</li> 218 <li>Item</li> 219 <li>Item</li> 220 </ul> 221 </li> 222 </ul> 223 </li> 224 </ul> 225 <p class="lead">Ordered List</p> 226 <ol> 227 <li>Item</li> 228 <li>Item</li> 229 <li>Item<br> 230 <ul> 231 <li>Item</li> 232 <li>Item</li> 233 <li>Item<br> 234 <ul> 235 <li>Item</li> 236 <li>Item</li> 237 <li>Item</li> 238 </ul> 239 </li> 240 </ul> 241 </li> 242 </ol> 243 <input type="hidden" name="task" value=""> 244 <?php echo HTMLHelper::_('form.token'); ?> 245 </fieldset> 246 </form> 247 </div> 248 <?php endif; ?> 249 </fieldset> 250 </div> 251 </div> 252 <?php echo HTMLHelper::_('uitab.endTab'); ?> 253 <?php echo HTMLHelper::_('uitab.addTab', 'myTab', 'overrides', Text::_('COM_TEMPLATES_TAB_OVERRIDES')); ?> 254 <div class="row mt-2"> 255 <div class="col-md-3"> 256 <fieldset class="options-form"> 257 <legend><?php echo Text::_('COM_TEMPLATES_OVERRIDES_MODULES'); ?></legend> 258 <ul class="list-unstyled"> 259 <?php $token = Session::getFormToken() . '=' . 1; ?> 260 <?php foreach ($this->overridesList['modules'] as $module) : ?> 261 <li> 262 <?php 263 $overrideLinkUrl = 'index.php?option=com_templates&view=template&task=template.overrides&folder=' . $module->path 264 . '&id=' . $input->getInt('id') . '&file=' . $this->file . '&isMedia=' . $input->get('isMedia', 0) . '&' . $token; 265 ?> 266 <a href="<?php echo Route::_($overrideLinkUrl); ?>"> 267 <span class="icon-copy" aria-hidden="true"></span> <?php echo $module->name; ?> 268 </a> 269 </li> 270 <?php endforeach; ?> 271 </ul> 272 </fieldset> 273 </div> 274 <div class="col-md-3"> 275 <fieldset class="options-form"> 276 <legend><?php echo Text::_('COM_TEMPLATES_OVERRIDES_COMPONENTS'); ?></legend> 277 <ul class="list-unstyled"> 278 <?php $token = Session::getFormToken() . '=' . 1; ?> 279 <?php foreach ($this->overridesList['components'] as $key => $value) : ?> 280 <li class="component-folder"> 281 <a href="#" class="component-folder-url"> 282 <span class="icon-folder icon-fw" aria-hidden="true"></span> <?php echo $key; ?> 283 </a> 284 <ul class="list-unstyled"> 285 <?php foreach ($value as $view) : ?> 286 <li> 287 <?php 288 $overrideLinkUrl = 'index.php?option=com_templates&view=template&task=template.overrides&folder=' . $view->path 289 . '&id=' . $input->getInt('id') . '&file=' . $this->file . '&isMedia=' . $input->get('isMedia', 0) . '&' . $token; 290 ?> 291 <a class="component-file-url" href="<?php echo Route::_($overrideLinkUrl); ?>"> 292 <span class="icon-copy" aria-hidden="true"></span> <?php echo $view->name; ?> 293 </a> 294 </li> 295 <?php endforeach; ?> 296 </ul> 297 </li> 298 <?php endforeach; ?> 299 </ul> 300 </fieldset> 301 </div> 302 <div class="col-md-3"> 303 <fieldset class="options-form"> 304 <legend><?php echo Text::_('COM_TEMPLATES_OVERRIDES_PLUGINS'); ?></legend> 305 <ul class="list-unstyled"> 306 <?php $token = Session::getFormToken() . '=' . 1; ?> 307 <?php foreach ($this->overridesList['plugins'] as $key => $group) : ?> 308 <li class="plugin-folder"> 309 <a href="#" class="plugin-folder-url"> 310 <span class="icon-folder icon-fw" aria-hidden="true"></span> <?php echo $key; ?> 311 </a> 312 <ul class="list-unstyled"> 313 <?php foreach ($group as $plugin) : ?> 314 <li> 315 <?php 316 $overrideLinkUrl = 'index.php?option=com_templates&view=template&task=template.overrides&folder=' . $plugin->path 317 . '&id=' . $input->getInt('id') . '&file=' . $this->file . '&isMedia=' . $input->get('isMedia', 0) . '&' . $token; 318 ?> 319 <a class="plugin-file-url" href="<?php echo Route::_($overrideLinkUrl); ?>"> 320 <span class="icon-copy" aria-hidden="true"></span> <?php echo $plugin->name; ?> 321 </a> 322 </li> 323 <?php endforeach; ?> 324 </ul> 325 </li> 326 <?php endforeach; ?> 327 </ul> 328 </fieldset> 329 </div> 330 <div class="col-md-3"> 331 <fieldset class="options-form"> 332 <legend><?php echo Text::_('COM_TEMPLATES_OVERRIDES_LAYOUTS'); ?></legend> 333 <ul class="list-unstyled"> 334 <?php $token = Session::getFormToken() . '=' . 1; ?> 335 <?php foreach ($this->overridesList['layouts'] as $key => $value) : ?> 336 <li class="layout-folder"> 337 <a href="#" class="layout-folder-url"> 338 <span class="icon-folder icon-fw" aria-hidden="true"></span> <?php echo $key; ?> 339 </a> 340 <ul class="list-unstyled"> 341 <?php foreach ($value as $layout) : ?> 342 <li> 343 <?php 344 $overrideLinkUrl = 'index.php?option=com_templates&view=template&task=template.overrides&folder=' . $layout->path 345 . '&id=' . $input->getInt('id') . '&file=' . $this->file . '&' . $token . '&isMedia=' . $input->get('isMedia', 0); 346 ?> 347 <a href="<?php echo Route::_($overrideLinkUrl); ?>"> 348 <span class="icon-copy" aria-hidden="true"></span> <?php echo $layout->name; ?> 349 </a> 350 </li> 351 <?php endforeach; ?> 352 </ul> 353 </li> 354 <?php endforeach; ?> 355 </ul> 356 </fieldset> 357 </div> 358 </div> 359 <?php echo HTMLHelper::_('uitab.endTab'); ?> 360 361 <?php if ($this->pluginState) : ?> 362 <?php echo HTMLHelper::_('uitab.addTab', 'myTab', 'files', Text::_('COM_TEMPLATES_TAB_UPDATED_FILES')); ?> 363 <?php echo $this->loadTemplate('updated_files'); ?> 364 <?php echo HTMLHelper::_('uitab.endTab'); ?> 365 <?php endif; ?> 366 367 <?php echo HTMLHelper::_('uitab.addTab', 'myTab', 'description', Text::_('COM_TEMPLATES_TAB_DESCRIPTION')); ?> 368 <div class="row mt-2"> 369 <div class="col-12"> 370 <?php echo $this->loadTemplate('description'); ?> 371 </div> 372 </div> 373 <?php echo HTMLHelper::_('uitab.endTab'); ?> 374 375 <?php echo HTMLHelper::_('uitab.endTabSet'); ?> 376 377 <?php // Collapse Modal 378 $taskName = isset($this->template->xmldata->inheritable) && (string) $this->template->xmldata->inheritable === '1' ? 'child' : 'copy'; 379 $copyModalData = array( 380 'selector' => $taskName . 'Modal', 381 'params' => array( 382 'title' => Text::_('COM_TEMPLATES_TEMPLATE_' . strtoupper($taskName)), 383 'footer' => $this->loadTemplate('modal_' . $taskName . '_footer') 384 ), 385 'body' => $this->loadTemplate('modal_' . $taskName . '_body') 386 ); 387 ?> 388 <form action="<?php echo Route::_('index.php?option=com_templates&task=template.' . $taskName . '&id=' . $input->getInt('id') . '&file=' . $this->file); ?>" method="post"> 389 <?php echo LayoutHelper::render('libraries.html.bootstrap.modal.main', $copyModalData); ?> 390 <?php echo HTMLHelper::_('form.token'); ?> 391 </form> 392 <?php if ($this->type != 'home') : ?> 393 <?php // Rename Modal 394 $renameModalData = array( 395 'selector' => 'renameModal', 396 'params' => array( 397 'title' => Text::sprintf('COM_TEMPLATES_RENAME_FILE', str_replace('//', '/', $this->fileName)), 398 'footer' => $this->loadTemplate('modal_rename_footer') 399 ), 400 'body' => $this->loadTemplate('modal_rename_body') 401 ); 402 ?> 403 <form action="<?php echo Route::_('index.php?option=com_templates&task=template.renameFile&id=' . $input->getInt('id') . '&file=' . $this->file . '&isMedia=' . $input->get('isMedia', 0)); ?>" method="post"> 404 <?php echo LayoutHelper::render('libraries.html.bootstrap.modal.main', $renameModalData); ?> 405 <?php echo HTMLHelper::_('form.token'); ?> 406 </form> 407 <?php endif; ?> 408 <?php if ($this->type != 'home') : ?> 409 <?php // Delete Modal 410 $deleteModalData = array( 411 'selector' => 'deleteModal', 412 'params' => array( 413 'title' => Text::_('COM_TEMPLATES_ARE_YOU_SURE'), 414 'footer' => $this->loadTemplate('modal_delete_footer') 415 ), 416 'body' => $this->loadTemplate('modal_delete_body') 417 ); 418 ?> 419 <?php echo LayoutHelper::render('libraries.html.bootstrap.modal.main', $deleteModalData); ?> 420 <?php endif; ?> 421 <?php // File Modal 422 $fileModalData = array( 423 'selector' => 'fileModal', 424 'params' => array( 425 'title' => Text::_('COM_TEMPLATES_NEW_FILE_HEADER'), 426 'footer' => $this->loadTemplate('modal_file_footer'), 427 'height' => '400px', 428 'width' => '800px', 429 'bodyHeight' => 70, 430 'modalWidth' => 80, 431 ), 432 'body' => $this->loadTemplate('modal_file_body') 433 ); 434 ?> 435 <?php echo LayoutHelper::render('libraries.html.bootstrap.modal.main', $fileModalData); ?> 436 <?php // Folder Modal 437 $folderModalData = array( 438 'selector' => 'folderModal', 439 'params' => array( 440 'title' => Text::_('COM_TEMPLATES_MANAGE_FOLDERS'), 441 'footer' => $this->loadTemplate('modal_folder_footer'), 442 'height' => '400px', 443 'width' => '800px', 444 'bodyHeight' => 70, 445 'modalWidth' => 80, 446 ), 447 'body' => $this->loadTemplate('modal_folder_body') 448 ); 449 ?> 450 <?php echo LayoutHelper::render('libraries.html.bootstrap.modal.main', $folderModalData); ?> 451 <?php if ($this->type == 'image') : ?> 452 <?php // Resize Modal 453 $resizeModalData = array( 454 'selector' => 'resizeModal', 455 'params' => array( 456 'title' => Text::_('COM_TEMPLATES_RESIZE_IMAGE'), 457 'footer' => $this->loadTemplate('modal_resize_footer') 458 ), 459 'body' => $this->loadTemplate('modal_resize_body') 460 ); 461 ?> 462 <form action="<?php echo Route::_('index.php?option=com_templates&task=template.resizeImage&id=' . $input->getInt('id') . '&file=' . $this->file . '&isMedia=' . $input->get('isMedia', 0)); ?>" method="post"> 463 <?php echo LayoutHelper::render('libraries.html.bootstrap.modal.main', $resizeModalData); ?> 464 <?php echo HTMLHelper::_('form.token'); ?> 465 </form> 466 <?php endif; ?> 467 </div>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Sep 7 05:41:13 2022 | Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer |