<repo_name>click2tman/slmdinc.org<file_sep>/docroot/modules/custom/ocms_accessibility/src/Form/AccessibilityConfigForm.php
<?php

namespace Drupal\ocms_accessibility\Form;

use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Form\ConfigFormBase;
use Drupal\Core\Form\FormStateInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
 * A configuration form for custom accessibility settings.
 */
class AccessibilityConfigForm extends ConfigFormBase {
  /**
   * The entity type manager.
   *
   * @var \Drupal\Core\Entity\EntityTypeManagerInterface
   */
  protected $entityTypeManager;

  /**
   * {@inheritdoc}
   */
  public function __construct(ConfigFactoryInterface $config_factory, EntityTypeManagerInterface $entity_type_manager) {
    parent::__construct($config_factory);
    $this->entityTypeManager = $entity_type_manager;
  }

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container) {
    return new static(
      $container->get('config.factory'),
      $container->get('entity_type.manager')
    );
  }

  /**
   * {@inheritdoc}
   */
  public function getFormId() {
    return 'ocms_accessibility_config_form';
  }

  /**
   * {@inheritdoc}
   */
  public function buildForm(array $form, FormStateInterface $form_state) {
    $form = parent::buildForm($form, $form_state);
    $config = $this->config('ocms_accessibility.settings');

    $content_type_options = [];
    $content_types = $this->entityTypeManager
      ->getStorage('node_type')
      ->loadMultiple();

    // Content type machine/name.
    foreach ($content_types as $content) {
      $content_type_options[$content->get('type')] = $content->get('name');
    }

    // Content type options.
    $form['content_types'] = [
      '#type' => 'checkboxes',
      '#options' => $content_type_options,
      '#title' => $this->t('Content types to apply accessibility check on submit:'),
      '#default_value' => $config->get('content_types'),
    ];

    return $form;
  }

  /**
   * {@inheritdoc}
   */
  public function submitForm(array &$form, FormStateInterface $form_state) {
    $this->configFactory->getEditable('ocms_accessibility.settings')
      ->set('content_types', $form_state->getValue('content_types'))
      ->save();

    parent::submitForm($form, $form_state);
  }

  /**
   * {@inheritdoc}
   */
  protected function getEditableConfigNames() {
    return ['ocms_accessibility.settings'];
  }

}
<file_sep>/docroot/modules/custom/ocms_accessibility/js/check_compliance.js
/**
 * @file
 * Force ckeditor plugin a11ychecker to be called on form submit.
 */

(function ($, Drupal, proxyAlert) {
  // Number of checker submissions via main form submit.
  var submit_form_checking = 0;

  // Alert proxy to suppress no-issue alert on submit.
  window.alert = function() { 
    var a11ychecker_valid_msg = 'does not contain any accessibility issues';

    // Suppress alert & decrement # of editors being checked.
    if (submit_form_checking > 0 && arguments[0].indexOf(a11ychecker_valid_msg)) { 
      submit_form_checking -= 1;
      return; 
    }
    return proxyAlert.apply(this, arguments); 
  };

  Drupal.behaviors.accessibilityFormValidation = {
    attach:function (context, settings) {

      // Submit button.
      $('.submit-with-accessibility-checker', context).once("form_submit").each(function () {
        $(this).click(function(e) {
          if (!checkCompliant(this)) {
            e.preventDefault();
          }
        });
      });

      function checkCompliant(button) {
        // No checker button found or manually checked so continue submit.
        var manually_checked = $("#edit-field-confirm-508-value").is(':checked');
        var no_checker_button = $('.cke_button__a11ychecker').length == 0;
        if (manually_checked || no_checker_button) {
          return true;
        }

        // Run a11ychecker.
        submit_form_checking = $('.cke_button__a11ychecker').length;
        if (navigator.appVersion.indexOf('Edge') > -1) {
          $('.cke_button__a11ychecker').mouseup();
        } else {
          $('.cke_button__a11ychecker').click();
        }

        // Check if balloon dialog with warnings appear, otherwise continue.
        setTimeout(function() {
          if ($('.cke_balloon').prop('style')['display'] !== 'none') {
            return false;
          }
          else {
            $(button).unbind(event).click();
          }
        }, 2000);
      }
    }
  };

})(jQuery, Drupal, window.alert);
<file_sep>/docroot/modules/custom/ocms_linkchecker/src/OcmsLinkcheckerLoggingInterface.php
<?php

namespace Drupal\ocms_linkchecker;

use Drupal\Core\Logger\RfcLogLevel;

/**
 * Defines an interface for the Link logging services.
 */
interface PupLinkcheckerLoggingInterface {

  /**
   * Logs a system message based on configured security level.
   *
   * @param $type
   *   The category to which this message belongs. Can be any string, but the
   *   general practice is to use the name of the module calling watchdog().
   * @param $message
   *   The message to store in the log. Keep $message translatable
   *   by not concatenating dynamic values into it! Variables in the
   *   message should be added by using placeholder strings alongside
   *   the variables argument to declare the value of the placeholders.
   *   See t() for documentation on how $message and $variables interact.
   * @param $variables
   *   Array of variables to replace in the message on display or
   *   NULL if message is already translated or not possible to
   *   translate.
   * @param $severity
   *   The severity of the message; one of the following values as defined in
   *   @link http://www.faqs.org/rfcs/rfc3164.html RFC 3164: @endlink
   *   - RfcLogLevel::EMERGENCY: Emergency, system is unusable.
   *   - RfcLogLevel::ALERT: Alert, action must be taken immediately.
   *   - RfcLogLevel::CRITICAL: Critical conditions.
   *   - RfcLogLevel::ERROR: Error conditions.
   *   - RfcLogLevel::WARNING: Warning conditions.
   *   - RfcLogLevel::NOTICE: (default) Normal but significant conditions.
   *   - RfcLogLevel::INFO: Informational messages.
   *   - RfcLogLevel::DEBUG: Debug-level messages.
   * @param $link
   *   A link to associate with the message.
   *
   * @see watchdog_severity_levels()
   * @see watchdog()
   */
  public function logMessage($type, $message, $variables = array(), $severity = RfcLogLevel::NOTICE, $link = NULL);
}
<file_sep>/docroot/modules/custom/ocms_linkchecker/src/OcmsLinkcheckerFilteringService.php
<?php

namespace Drupal\ocms_linkchecker;

use Drupal\Core\Config\ConfigFactoryInterface;

/**
 * Implements the PupLinkcheckerFilteringInterface.
 */
class PupLinkcheckerFilteringService implements PupLinkcheckerFilteringInterface {

  /**
   * The config factory.
   *
   * @var \Drupal\Core\Config\ConfigFactoryInterface
   */
  protected $configFactory;

  /**
   * Constructs the OCMS Linkchecker Filtering Service object.
   *
   * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
   *   The factory for configuration objects.
   */
  public function __construct(ConfigFactoryInterface $config_factory) {
    $this->configFactory = $config_factory;
  }

  /**
   * {@inheritdoc}
   */
  public function checkMarkup($text, $formatId = NULL, $langcode = '') {
    $config = $this->configFactory->get('ocms_linkchecker.settings');
    $skipFilters = array_keys(array_filter($config->get('extract.filter.blacklist')));

    return check_markup($text, $formatId, $langcode, $skipFilters);
  }
}
<file_sep>/docroot/themes/custom/ocms_corporate/js/init/isotope-masonry-init.js
jQuery(document).ready(function($) {

  //Masonry Layout
  $(".grid-masonry-container").fadeIn("slow");
  $(".grid-masonry-container").imagesLoaded(function() {
    $(".grid-masonry-container").isotope({
      itemSelector: ".masonry-grid-item",
      layoutMode: "masonry"
    });
    $(".grid-masonry-container").isotope("layout");
  });

  //Masonry Layout Style 2
  $(".grid-masonry-container-style-2").fadeIn("slow");
  $(".grid-masonry-container-style-2").imagesLoaded(function() {
    $(".grid-masonry-container-style-2").isotope({
      itemSelector: ".masonry-grid-item",
      layoutMode: "fitRows"
    });
    $(".grid-masonry-container-style-2").isotope("layout");
  });

});
<file_sep>/docroot/themes/custom/ocms_corporate/js/init/flexslider-in-page-init.js
jQuery(document).ready(function($) {
  $(window).load(function() {
    if ($("#in-page-images-slider.flexslider").length>0) {
      $("#in-page-images-slider.flexslider").fadeIn("slow");
      $("#in-page-images-slider.flexslider").flexslider({
        animation: drupalSettings.ocms_corporate.flexsliderInPageInit.inPageSliderEffect, // Select your animation type, "fade" or "slide"
        prevText: "",
        nextText: "",
        pauseOnAction: false,
        useCSS: false,
        slideshow: false,
      });
    };
  });
});
<file_sep>/docroot/themes/custom/ocms_cart/js/init/owl-carousel-brands-init.js
(function ($, Drupal, drupalSettings) {
  Drupal.behaviors.mtOwlCarouselBrands = {
    attach: function (context, settings) {
      $(context).find('.mt-carousel-brands').once('mtowlCarouselBrandsInit').each(function() {
        $(this).owlCarousel({
          items: 2,
          responsive:{
            0:{
              items:2,
            },
            480:{
              items:2,
            },
            768:{
              items:3,
            },
            992:{
              items:4,
            },
            1200:{
              items:5,
            },
            1680:{
              items:5,
            }
          },
          autoplay: drupalSettings.ocms_cart.owlCarouselBrandsInit.owlBrandsAutoPlay,
          autoplayTimeout: drupalSettings.ocms_cart.owlCarouselBrandsInit.owlBrandsEffectTime,
          nav: true,
          dots: false,
          loop: true,
          navText: false
        });
      });
    }
  };
})(jQuery, Drupal, drupalSettings);
<file_sep>/docroot/modules/custom/ocms_linkchecker/src/OcmsLinkcheckerMaintenanceService.php
<?php

namespace Drupal\ocms_linkchecker;

use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Database\Connection;
use Drupal\Core\Queue\QueueFactory;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\Core\StringTranslation\TranslationInterface;

/**
 * Implements the PupLinkcheckerMaintenanceInterface.
 */
class PupLinkcheckerMaintenanceService implements PupLinkcheckerMaintenanceInterface {

  use StringTranslationTrait;

  /**
   * OCMS Linkchecker Utility Service.
   *
   * @var \Drupal\ocms_linkchecker\PupLinkcheckerUtilityInterface
   */
  protected $utilityService;

  /**
   * Drupal's database service.
   *
   * @var \Drupal\Core\Database\Connection
   */
  protected $connection;

  /**
   * Drupal's queue service.
   *
   * @var \Drupal\Core\Queue\QueueFactory
   */
  protected $queueFactory;

  /**
   * The config factory.
   *
   * @var \Drupal\Core\Config\ConfigFactoryInterface
   */
  protected $configFactory;

  /**
   * Constructs the OCMS Linkchecker Maintenance Service object.
   *
   * @param \Drupal\ocms_linkchecker\PupLinkcheckerUtilityInterface
   *   The OCMS Linkchecker Utility Service.
   * @param \Drupal\Core\Database\Connection
   *   The database connection
   * @param \Drupal\Core\Queue\QueueInterface
   *   The Queue service
   * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
   *   The factory for configuration objects.
   * @param \Drupal\Core\StringTranslation\TranslationInterface $string_translation
   *   The string translation.
   */
  public function __construct(PupLinkcheckerUtilityInterface $ocms_linkchecker_utility, Connection $database, QueueFactory $queue_factory, ConfigFactoryInterface $config_factory, TranslationInterface $string_translation) {
    $this->utilityService = $ocms_linkchecker_utility;
    $this->connection = $database;
    $this->queueFactory = $queue_factory;
    $this->configFactory = $config_factory;
    $this->stringTranslation = $string_translation;
  }

  /**
   * {@inheritdoc}
   */
  public function deleteUnreferencedLinks() {
    $linkchecker_entity = $this->connection->select('ocms_linkchecker_entity', 'le')
      ->distinct()
      ->fields('le', array('lid'));

    $this->connection->delete('ocms_linkchecker_link')
      ->condition('lid', $linkchecker_entity, 'NOT IN')
      ->execute();
  }

  /**
   * {@inheritdoc}
   */
  public function deleteUnscannedNodeLinks() {
    $nodeTypes = $this->utilityService->scanNodeTypes();
    if (!empty($nodeTypes)) {
      $subquery1 = $this->connection->select('node', 'n')
        ->fields('n', array('nid'))
        ->condition('n.type', $nodeTypes, 'NOT IN');

      $this->connection->delete('ocms_linkchecker_entity')
        ->condition('entity_id', $subquery1, 'IN')
        ->condition('entity_type', 'node')
        ->execute();

      // @todo: Remove comments link references from table.
    }
    else {
      // No active node types. Remove all items from table.
      $this->connection->delete('ocms_linkchecker_entity')
        ->condition('entity_type', 'node')
        ->execute();
      // @todo Remove comments link references from table.
    }
  }

  /**
   * {@inheritdoc}
   */
  public function checkLinks() {
    $config = $this->configFactory->get('ocms_linkchecker.settings');
    $links = $this->connection->query('SELECT lid
      FROM {ocms_linkchecker_link}
      WHERE last_checked < :nextCheck
      AND status = :checkLink
      ORDER BY last_checked, lid ASC
    ', array(
      ':nextCheck' => REQUEST_TIME - $config->get('check.interval'),
      ':checkLink' => 1
    ));
    $this->queueFactory->get('ocms_linkchecker_check_links')->createQueue();
    $queue = $this->queueFactory->get('ocms_linkchecker_check_links');
    foreach ($links as $link) {
      // We will always add the item to the queue. The QueueWorker will double
      // check whether the item is being processed again too soon on account of
      // an older item that had not made it through a previous cron run. It
      // could be too expensive to check all the items in the queue to see if
      // we should skip adding this.
      $queue->createItem($link->lid);
    }
  }

  /**
   * {@inheritdoc}
   */
  public function scanNodeType($nodeType) {
    $this->queueFactory->get('ocms_linkchecker_scan_node')->createQueue();
    $queue = $this->queueFactory->get('ocms_linkchecker_scan_node');
    $results = $this->connection->select('node', 'n')
      ->fields('n', array('nid'))
      ->condition('n.type', $nodeType)
      ->execute();
    foreach ($results as $result) {
      $queue->createItem($result->nid);
    }
    \Drupal::logger('ocms_linkchecker')
      ->notice($this->t('All nodes of type: :nodeType will be scanned for links.', array(':nodeType' => $nodeType)));
  }

  /**
   * {@inheritdoc}
   */
  public function removeNodeType($nodeType) {
    $subquery1 = $this->connection->select('node', 'n')
      ->fields('n', array('nid'))
      ->condition('n.type', $nodeType);

    $this->connection->delete('ocms_linkchecker_entity')
      ->condition('entity_id', $subquery1, 'IN')
      ->condition('entity_type', 'node')
      ->execute();
    \Drupal::logger('ocms_linkchecker')
      ->notice($this->t('Removed link references for node type: :nodeType.', array(':nodeType' => $nodeType)));
  }

}
<file_sep>/docroot/modules/custom/ocms_linkchecker/src/OcmsLinkcheckerMaintenanceInterface.php
<?php

namespace Drupal\ocms_linkchecker;

/**
 * Defines an interface for the Link maintenance services.
 */
interface PupLinkcheckerMaintenanceInterface {

  /**
   * Deletes all links without a reference.
   *
   * This is triggered via cron.
   *
   * For speed reasons and check results we keep the links for some time
   * as they may be reused by other new content.
   */
  public function deleteUnreferencedLinks();

  /**
   * Deletes links to node types that are no longer scanned.
   *
   * This is triggered via cron.
   */
  public function deleteUnscannedNodeLinks();

  /**
   * Checks links and processes the response code appropriately.
   *
   * This is triggered via cron.
   */
  public function checkLinks();

  /**
   * Scans all nodes of a given node type for links.
   *
   * This is triggered by a node type being set to scan for links.
   *
   * @param string $nodeType
   *   The machine name for the node
   */
  public function scanNodeType($nodeType);

  /**
   * Removes all link references for nodes of a given type.
   *
   * This is triggered by a node type being set to not scan for links.
   *
   * @param string $nodeType
   *   The machine name for the node
   */
  public function removeNodeType($nodeType);
}
<file_sep>/docroot/modules/custom/ocms_universal_assets/src/EventSubscriber/RemoveXFrameOptionsSubscriber.php
<?php

namespace Drupal\ocms_universal_assets\EventSubscriber;

use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
use Symfony\Component\HttpKernel\KernelEvents;

/**
 * Removes the X-Frame-Options to allow iframe embedding.
 */
class RemoveXFrameOptionsSubscriber implements EventSubscriberInterface {

  /**
   * Update response headers based on path.
   *
   * @param \Symfony\Component\HttpKernel\Event\FilterResponseEvent $event
   *   Response event.
   */
  public function updateResponseHeaders(FilterResponseEvent $event) {
    $response = $event->getResponse();
    $path = $_SERVER['REQUEST_URI'];
    if (strpos($path, '/assets/universal') === 0) {
      $response->headers->remove('X-Frame-Options');
      $response->headers->set('Access-Control-Allow-Origin', '*');
      $response->headers->set('Access-Control-Allow-Methods', 'GET');
    }
  }

  /**
   * {@inheritdoc}
   */
  public static function getSubscribedEvents() {
    $events[KernelEvents::RESPONSE][] = array('updateResponseHeaders', -10);
    return $events;
  }

}
<file_sep>/docroot/modules/custom/ocms_linkchecker/src/OcmsLinkcheckerAccessInterface.php
<?php

namespace Drupal\ocms_linkchecker;

/**
 * Defines an interface for the Link access services.
 */
interface PupLinkcheckerAccessInterface {

  /**
   * Returns block Ids with a link the current user is allowed to view.
   *
   * @param object $link
   *   An object representing the link to check.
   *
   * @return array
   *   An array of block IDs that contain the provided link and that the
   *   current user is allowed to view.
   */
  public function accessBlockIds($link);

  /**
   * Returns comment Ids with a link the current user is allowed to view.
   *
   * @param object $link
   *   An object representing the link to check.
   * @param object $commentAuthorAccount
   *   (optional) If a user account object is provided, the returned comments
   *   will additionally be restricted to only those owned by this account.
   *   Otherwise, comments owned by any user account may be returned.
   *
   * @return array
   *   An array of comment IDs that contain the provided link and that the
   *   current user is allowed to view.
   */
  public function accessCommentIds($link, $commentAuthorAccount = NULL);

  /**
   * Determines if the current user has access to view a link.
   *
   * Link URLs can contain private information (for example, usernames and
   * passwords). So this module should only display links to a user if the link
   * already appears in at least one place on the site where the user would
   * otherwise have access to see it.
   *
   * @param object $link
   *   An object representing the link to check.
   *
   * @return array
   */
  public function accessLink($link);

  /**
   * Returns node Ids with a link the current user may be allowed to view.
   *
   * Important note: For performance reasons, this function is not always
   * guaranteed to return the exact list of node IDs that the current user is
   * allowed to view. It will, however, always return an empty array if the user
   * does not have access to view *any* such nodes, thereby meeting the security
   * goals of _linkchecker_link_access() and other places that call it.
   *
   * In the case where a user has access to some of the nodes that contain the
   * link, this function may return some node IDs that the user does not have
   * access to. Therefore, use caution with its results.
   *
   * @param object $link
   *   An object representing the link to check.
   * @param object $nodeAuthorAccount
   *   (optional) If a user account object is provided, the returned nodes will
   *   additionally be restricted to only those owned by this account.
   *   Otherwise, nodes owned by any user account may be returned.
   *
   * @return array
   *   An array of node IDs that contain the provided link and that the current
   *   user may be allowed to view.
   */
  public function accessNodeIds($link, $nodeAuthorAccount = NULL);
}
<file_sep>/docroot/modules/custom/ocms_linkchecker/src/OcmsLinkcheckerParsingService.php
<?php

namespace Drupal\ocms_linkchecker;

use Drupal\Component\Utility\Unicode;
use Drupal\Component\Utility\UrlHelper;
use Drupal\Core\Entity\EntityFieldManagerInterface;
use Drupal\Core\Link;
use Drupal\Core\Url;
use Drupal\field\Entity\FieldStorageConfig;

/**
 * Implements the PupLinkcheckerParsingInterface.
 */
class PupLinkcheckerParsingService implements PupLinkcheckerParsingInterface {

  /**
   * OCMS Linkchecker Filtering Service.
   *
   * @var \Drupal\ocms_linkchecker\PupLinkcheckerFilteringInterface
   */
  protected $filteringService;

  /**
   * Drupal's entity field manager.
   *
   * @var \Drupal\Core\Entity\EntityFieldManagerInterface;
   */
  protected $entityFieldManager;

  /**
   * Constructs the OCMS Linkchecker Parsing Service object.
   *
   * @param \Drupal\ocms_linkchecker\PupLinkcheckerFilteringInterface $ocms_linkchecker_filtering_service
   *   The OCMS Linkchecker Filtering Service.
   * @param \Drupal\Core\Entity\EntityFieldManagerInterface
   *   The entity field manager
   */
  public function __construct(PupLinkcheckerFilteringInterface $ocms_linkchecker_filtering_service, EntityFieldManagerInterface $entity_field_manager) {
    $this->filteringService = $ocms_linkchecker_filtering_service;
    $this->entityFieldManager = $entity_field_manager;
  }

  /**
   * {@inheritdoc}
   */
  public function parseFields($entityType, $bundleName, $entity, $returnFieldNames = FALSE) {
    global $base_url;

    $textItems = array();
    $textItemsByField = array();

    // Create settings for _filter_url() function.
    $filter = new \stdClass();
    $filter->settings['filter_url_length'] = 72;

    // Collect the fields from this entity_type and bundle.
    foreach ($this->entityFieldManager->getFieldDefinitions($entityType, $bundleName) as $fieldName => $instance) {
      $field = FieldStorageConfig::loadByName($entityType, $fieldName);
      if (isset($field)) {
        $type = $field->get('type');
      }
      else {
        $type = '';
      }

      switch ($type) {
        // Core fields.
        case 'text_with_summary':
              $fieldValues = $entity->get($fieldName)->getValue();
              foreach ($fieldValues as $item) {
                $item += array(
                  'format' => NULL,
                  'summary' => '',
                  'value' => '',
                );
                $languageCode = $entity->language()->getId();
                $textItems[] = $textItemsByField[$fieldName][] = $this->filteringService->checkMarkup($item['value'], $item['format'], $languageCode, TRUE);
                $textItems[] = $textItemsByField[$fieldName][] = $this->filteringService->checkMarkup($item['summary'], $item['format'], $languageCode, TRUE);
              }
          break;

        // Core fields.
        case 'text':
        case 'text_long':
              $fieldValues = $entity->get($fieldName)->getValue();
              foreach ($fieldValues as $item) {
                $item += array(
                  'format' => NULL,
                  'value' => '',
                );
                $languageCode = $entity->language()->getId();
                $textItems[] = $textItemsByField[$fieldName][] = $this->filteringService->checkMarkup($item['value'], $item['format'], $languageCode, TRUE);
	      }
          break;

        case 'link':
            $fieldValues = $entity->get($fieldName)->getValue();
            foreach ($fieldValues as $item) {
              $item += array(
                'title' => '',
              );
              $languageCode = $entity->language()->getId();
              $options = UrlHelper::parse($item['uri']);
	      // Force this to look like an external URL so that ::fromUri won't
              // change it from how it's entered.
              if (!UrlHelper::isExternal($options['path'])) {
                $options['path'] = $base_url . str_replace(['entity:', 'internal:'], ['/', ''], $item['uri']);
              }
              $url = Url::fromUri($options['path'], $options);
              $textItems[] = $textItemsByField[$fieldName][] = Link::fromTextAndUrl($item['title'], $url)->toString();
            }
          break;
      }
    }

    return ($returnFieldNames) ? $textItemsByField : $textItems;
  }

  /**
   * {@inheritdoc}
   */
  public function getAbsoluteUrl($url) {
    // Parse the URL and make sure we can handle the schema.
    $uri = @parse_url($url);

    if ($uri == FALSE) {
      return NULL;
    }

    if (!isset($uri['scheme'])) {
      return NULL;
    }

    // Break if the schema is not supported.
    if (!in_array($uri['scheme'], array('http', 'https'))) {
      return NULL;
    }

    $scheme = $uri['scheme'] . '://';
    $user = isset($uri['user']) ? $uri['user'] . ($uri['pass'] ? ':' . $uri['pass'] : '') . '@' : '';
    $port = isset($uri['port']) ? $uri['port'] : 80;
    $host = $uri['host'] . ($port != 80 ? ':' . $port : '');

    // Glue the URL variables.
    $absoluteUrl = $scheme . $user . $host . '/';

    return $absoluteUrl;
  }
}
<file_sep>/docroot/modules/custom/ocms_viewfiles/src/Form/PagerForm.php
<?php
namespace Drupal\ocms_viewfiles\Form;

use Drupal\Core\Form\ConfigFormBase;
use Drupal\Core\Form\FormStateInterface;


/**
 * Configures taxonomy used for breadcrumb settings for this site.
 */
class PagerForm extends ConfigFormBase {

  /**
   * {@inheritdoc}
   */
  public function getFormId() {
    return 'ocms_viewfiles_form';
  }

  /**
   * {@inheritdoc}
   */
  protected function getEditableConfigNames() {
    return [
      'ocms_taxonomy_breadcrumb.configuration',
    ];
  }

  /**
   * {@inheritdoc}
   */
  public function buildForm(array $form, FormStateInterface $form_state) {
     $first_image=file_create_url(drupal_get_path('module', 'ocms_viewfiles') . '/css/first.png');
	 $prev_image=file_create_url(drupal_get_path('module', 'ocms_viewfiles') . '/css/prev.png');
	 $next_image=file_create_url(drupal_get_path('module', 'ocms_viewfiles') . '/css/next.png');
	 $last_image=file_create_url(drupal_get_path('module', 'ocms_viewfiles') . '/css/last.png');
     $form['text']['#markup'] ='<img src="'.$first_image.'" class="first"/><img src="'.$prev_image.'" class="prev"/>';
  
	$page_terms=array("25"=>"25","50"=>"50", "100"=>"100");
    
	$form['pagedisplay'] = array(
	  '#required'=> FALSE,
      '#type' => 'textfield',
       '#attributes' => array('class' => array('pagedisplay'), 'readonly' => 'readonly','size' => 6),
    );
    $form['text2']['#markup'] ='<img src="'.$next_image.'" class="next"/><img src="'.$last_image.'" class="last"/>';
  
	$form['amount'] = [
     '#type' => 'select',
     '#attributes' => array('class' => array('pagesize'),'width'=>'4px'),
    '#multiple' => false,
    '#options' => $page_terms,
    '#default_value' => '50',
    ];

    return $form;
  }

 
  
  /**
   * {@inheritdoc}
   */
  public function submitForm(array &$form, FormStateInterface $form_state) {
    $values = $form_state->getValues();
    //dsm ("The value on submit is ". $values['ocms_taxonomy_breadcrumb']);
    $this->config('ocms_taxonomy_breadcrumb.configuration')
      ->set('breadcrumb_taxonomy', $values['ocms_taxonomy_breadcrumb'])
      ->save();
    parent::submitForm($form, $form_state);
  }
}
<file_sep>/docroot/modules/custom/ocms_linkchecker/src/OcmsLinkcheckerUtilityInterface.php
<?php

namespace Drupal\ocms_linkchecker;

/**
 * Defines an interface for the Link utility services.
 */
interface PupLinkcheckerUtilityInterface {

  /**
   * Defines the list of allowed response codes for form input validation.
   *
   * @param int $code
   *   A numeric response code.
   *
   * @return boolean
   *   TRUE if the status code is valid, otherwise FALSE.
   */
  public function isValidResponseCode($responseCode);

  /**
   * Checks if this entity is the default revision (published).
   *
   * @param object $entity
   *   The entity object, e.g., $node.
   *
   * @return bool
   *   TRUE if the entity is the default revision, FALSE otherwise.
   */
  public function isDefaultrevision($entity);

  /**
   * Returns all the values of one-dimensional and multidimensional arrays.
   *
   * @return array
   *   Returns all the values from the input array and indexes the array numerically.
   */
  public function recurseArrayValues(array $array);

  /**
   * Determines if the link status should be checked or not.
   *
   * This checks against reserved URLS, user-selected excluded URLs and
   * the protocol.
   *
   * @return boolean
   *   Whether to be checked
   */
  public function shouldCheckLink($url);

  /**
   * Checks if the link is an internal URL or not.
   *
   * @param object $link
   *   Link object.
   *
   * @return bool
   *   TRUE if link is internal, otherwise FALSE.
   */
  public function isInternalUrl(&$link);

  /**
   * Returns information from database about a block.
   *
   * @param int $bid
   *   ID of the block to get information for.
   *
   * @return object
   *   Associative object of information stored in the database for this block.
   *   Object keys:
   *   - module: 'block' as the source of the custom blocks data.
   *   - delta: Block ID.
   *   - info: Block description.
   *   - body['value']: Block contents.
   *   - body['format']: Filter ID of the filter format for the body.
   */
  public function getBlock($bid);

  /**
   * Returns all content type enabled with link checking.
   *
   * @return array
   *   An array of node type names, keyed by the type.
   */
  public function scanNodeTypes();

  /**
   * Returns all content type enabled with comment link checking.
   *
   * @return array
   *   An array of node type names, keyed by the type.
   */
  public function scanCommentTypes();

  /**
   * Impersonates another user, see http://drupal.org/node/287292#comment-3162350.
   *
   * Each time this function is called, the active user is saved and $new_user
   * becomes the active user. Multiple calls to this function can be nested,
   * and session saving will be disabled until all impersonation attempts have
   * been reverted using linkchecker_revert_user().
   *
   * @param int|object $new_user
   *   User to impersonate, either a UID or a user object.
   *
   * @return object
   *   Current user object.
   *
   * @see linkchecker_revert_user()
   */
  public function impersonateUser($newUser = NULL);

  /**
   * Reverts to the previous user after impersonating.
   *
   * @return object
   *   Current user.
   *
   * @see linkchecker_impersonate_user()
   */
  public function revertUser();

  /**
   * Load a link object
   *
   * @param int $lid
   *   The link id
   *
   * @return object $link
   *  The fully loaded link object
   */
  public function loadLink($lid);

  /**
   * Update a link.
   *
   * The user sets the values on the Edit link settings form.
   *
   * @param object $link
   *   The fully loaded link object
   */
  public function updateLink($link);

  /**
   * Load an entity object
   *
   * @param string $entityType
   *   The entity type
   * @param int $id
   *   The entity id
   *
   * @return object $entity
   *  The fully loaded entity object
   */
  public function loadEntity($entityType, $id);
}
<file_sep>/docroot/modules/custom/ocms_media_access/src/MediaAccessPermissions.php
<?php

namespace Drupal\ocms_media_access;

use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\media_entity\Entity\MediaBundle;

/**
 * Provides granular permissions for media entity types.
 */
class MediaAccessPermissions {
  use StringTranslationTrait;

  /**
   * Returns an array of media type permissions.
   *
   * @return array
   *   The media type permissions.
   *
   * @see \Drupal\user\PermissionHandlerInterface::getPermissions()
   */
  public function mediaTypePermissions() {
    $perms = array();
    // Generate permissions for all media types.
    foreach (MediaBundle::loadMultiple() as $type) {
      $perms += $this->buildPermissions($type);
    }

    return $perms;
  }

  /**
   * Returns a list of media permissions for a given media type.
   *
   * @param \Drupal\media_entity\Entity\MediaBundle $type
   *   The media type.
   *
   * @return array
   *   An associative array of permission names and descriptions.
   */
  protected function buildPermissions(MediaBundle $type) {
    $type_id = $type->id();
    $type_params = ['%type_name' => $type->label()];

    return [
      "create $type_id media" => [
        'title' => $this->t('%type_name: Create new media', $type_params),
      ],
      "edit any $type_id media" => [
        'title' => $this->t('%type_name: Edit any media', $type_params),
      ],
      "edit own $type_id media" => [
        'title' => $this->t('%type_name: Edit own media', $type_params),
      ],
      "delete any $type_id media" => [
        'title' => $this->t('%type_name: Delete any media', $type_params),
      ],
      "delete own $type_id media" => [
        'title' => $this->t('%type_name: Delete own media', $type_params),
      ],
    ];
  }
}
<file_sep>/docroot/themes/custom/ocms_base/js/global-assets.js
/**
 * @file
 * For loading external assets such as header and footer.
 */

$(function() {
  // The base path to the asset pages.
  var baseAssetOrigin = _IRS.baseAssetOrigin;
  // The base path used in replacing relative paths.
  var baseDomain = _IRS.baseDomain;
  // Assets to prepend.
  var prependAssets = _IRS.prependAssets;
  var includeStyles = _IRS.includeStyles;
  // Available assets.
  var globalAssets = {
    header: {
      assetPath: baseAssetOrigin + '/assets/universal/header',
      assetElement: '#navbar'
    },
    footer: {
      assetPath: baseAssetOrigin + '/assets/universal/footer',
      assetElement: 'footer'
    }
  };
  var stylePaths = [
    '/themes/custom/ocms_base/css/style.min.css',
    '/core/modules/system/css/components/hidden.module.css'
  ];
  var scriptPaths = [
    // Scripts array to append.
  ];

  // Include scripts and stylesheets.
  if (includeStyles) {
    // Stylesheets.
    for (var i = 0; i < stylePaths.length; i++) {
      var styleElement = document.createElement('link');
      styleElement.type = 'text/css';
      styleElement.rel = 'stylesheet';
      styleElement.href = baseAssetOrigin + stylePaths[i];
      $('head').append(styleElement);
    }
    // Scripts.
    for (var j = 0; j < scriptPaths.length; j++) {
      var scriptElement = document.createElement('script');
      scriptElement.type = 'text/javascript';
      scriptElement.src = baseAssetOrigin + scriptPaths[j];
      $('head').append(scriptElement);
    }
  }

  // Prepend assets.
  Object.keys(prependAssets).forEach(function(asset) {
    if (globalAssets[asset]) {
      $.ajax({
        url: globalAssets[asset].assetPath
      })
        .done(function(content) {
          var element = $(content).filter(globalAssets[asset].assetElement);
          $(prependAssets[asset]).prepend(element);
          $(globalAssets[asset].assetElement + ' a[href^="/"]').attr('href', addBaseDomain);
          $(globalAssets[asset].assetElement + ' img[src^="/"]').attr('src', addBaseDomain);
        });
    }

  });

  // Add base domain to relative paths.
  function addBaseDomain(_idx, oldHref) {
    return oldHref.replace(/^\//, baseDomain + '/');
  }
});
<file_sep>/docroot/modules/custom/ocms_linkchecker/src/OcmsLinkcheckerHttpService.php
<?php

namespace Drupal\ocms_linkchecker;

use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Database\Connection;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Exception\BadResponseException;
use GuzzleHttp\Exception\ClientException;
use GuzzleHttp\Exception\ConnectException;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Exception\ServerException;
use GuzzleHttp\Exception\TooManyRedirectsException;
use GuzzleHttp\Exception\TransferException;

/**
 * Implements the PupLinkcheckerHttpInterface.
 */
class PupLinkcheckerHttpService implements PupLinkcheckerHttpInterface {

  /**
   * Drupal's database service.
   *
   * @var \Drupal\Core\Database\Connection
   */
  protected $connection;

  /**
   * The HTTP client with which to test the links.
   *
   * @var \GuzzleHttp\ClientInterface
   */
  protected $httpClient;

  /**
   * The config factory.
   *
   * @var \Drupal\Core\Config\ConfigFactoryInterface
   */
  protected $configFactory;

  /**
   * Constructs the OCMS Linkchecker Http Service object.
   *
   * @param \Drupal\Core\Database\Connection
   *   The database connection
   * @param \GuzzleHttp\ClientInterface $http_client
   *   A Guzzle client object.
   * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
   *   The factory for configuration objects.
   */
  public function __construct(Connection $database, ClientInterface $http_client, ConfigFactoryInterface $config_factory) {
    $this->connection = $database;
    $this->httpClient = $http_client;
    $this->configFactory = $config_factory;
  }

  /**
   * {@inheritdoc}
   */
  public function checkLink($link) {
    $url = $link->url;
    try {
      if ($link->method == 'GET') {
        $response = $this->httpClient
          ->get($url);
      }
      else {
        $response = $this->httpClient
          ->head($url);
      }
    }
    catch (BadResponseException $exception) {
      $response = $exception->getResponse();
      $code = '400';
      $error = 'There was a bad response exception caught.';
      \Drupal::logger('ocms_linkchecker')->notice('A bad response exception was caught for @url.', array('@url' => $url));
      watchdog_exception('ocms_linkchecker', $exception);
    }
    catch (ClientException $exception) {
      $response = $exception->getResponse();
      $code = '400';
      $error = 'There was a client exception caught.';
      \Drupal::logger('ocms_linkchecker')->notice('A client exception was caught for @url.', array('@url' => $url));
      watchdog_exception('ocms_linkchecker', $exception);
    }
    catch (ConnectException $exception) {
      $response = $exception->getResponse();
      $code = '400';
      $error = 'There was a connection exception caught.';
      \Drupal::logger('ocms_linkchecker')->notice('A connection exception was caught for @url.', array('@url' => $url));
      watchdog_exception('ocms_linkchecker', $exception);
    }
    catch (RequestException $exception) {
      $response = $exception->getResponse();
      $code = '400';
      $error = 'There was a request exception caught.';
      \Drupal::logger('ocms_linkchecker')->notice('A request exception was caught for @url.', array('@url' => $url));
      watchdog_exception('ocms_linkchecker', $exception);
    }
    catch (ServerException $exception) {
      $response = $exception->getResponse();
      $code = '400';
      $error = 'There was a server exception caught.';
      \Drupal::logger('ocms_linkchecker')->notice('A server exception was caught for @url.', array('@url' => $url));
      watchdog_exception('ocms_linkchecker', $exception);
    }
    catch (TooManyRedirectsException $exception) {
      $response = $exception->getResponse();
      $code = '400';
      $error = 'There were too many redirects.';
      \Drupal::logger('ocms_linkchecker')->notice('There were too many redirects for @url.', array('@url' => $url));
      watchdog_exception('ocms_linkchecker', $exception);
    }
    catch (\Exception $exception) {
      $response = $exception->getResponse();
      $code = '400';
      $error = 'There was an unexpected exception caught.';
      \Drupal::logger('ocms_linkchecker')->notice('An unexpected exception was caught for @url.', array('@url' => $url));
      watchdog_exception('ocms_linkchecker', $exception);
    }

    if (!empty($response)) {
      $code = $response->getStatusCode();
      $error = $response->getReasonPhrase();
    }

    $config = $this->configFactory->get('ocms_linkchecker.settings');
    $ignoreResponseCodes = preg_split('/(\r\n?|\n)/', $config->get('error.ignore_response_codes'));
    if (in_array($code, $ignoreResponseCodes)) {
      $failIncrement = -1 * $link->fail_count;
    }
    else {
      $failIncrement = 1;
    }
    $this->connection->update('ocms_linkchecker_link')
      ->condition('lid', $link->lid)
      ->fields(array(
        'code' => $code,
        'error' => $error,
        'fail_count' => 0,
        'last_checked' => time(),
      ))
      ->expression('fail_count',
        'fail_count + :failIncrement',
        array(':failIncrement' => $failIncrement))
      ->execute();
  }
}
<file_sep>/docroot/modules/custom/ocms_linkchecker/src/OcmsLinkcheckerBatchInterface.php
<?php

namespace Drupal\ocms_linkchecker;

/**
 * Defines an interface for the Link batch services.
 */
interface PupLinkcheckerBatchInterface {

// @todo: I really don't know yet whether I'm going to create a service or
//        if I'm using some type of "batch workers" as <NAME> suggested.
//        Drupal 8 still has the Batch API
// @see: https://api.drupal.org/api/drupal/core%21includes%21form.inc/group/batch/8.3.x
//       http://tylerfrankenstein.com/code/drupal-8-batch-example
//       http://valuebound.com/resources/blog/batch-process-drupal-8
//       http://www.accessadvertising.co.uk/blog/2016/07/smack-my-batch-batch-processing-drupal-8
//       https://mr.alexfinnarn.com/article/bettering-batch-api
}
<file_sep>/docroot/modules/custom/ocms_viewfiles/js/ocms_viewfiles.js
(function($) {
	Drupal.behaviors.myBehavior = {
  attach: function (context, settings) {
	$("#myTable").tablesorter(); 
	if($('#pager').length >0 ){
  
      $("#myTable").tablesorterPager({container: $("#pager")}); 
    }
	
	
	  }
};
  
})(jQuery);		
<file_sep>/docroot/modules/custom/ocms_files/src/Controller/OcmsOcmsController.php
<?php

namespace Drupal\irspup\Controller;

use Drupal\Core\Controller\ControllerBase;
use Drupal\irspup\Utility\DescriptionTemplateTrait;

/**
 * Simple controller class used to test the DescriptionTemplateTrait.
 */
class IrsPupController extends ControllerBase {
    use DescriptionTemplateTrait;

  /**
   * {@inheritdoc}
   *
   * We override this so we can see some substitutions.
   */
    protected function getModuleName() 
  {
    return 'irspup';
  }

  /**
   * This is the old non-twig version reporting out.
   *
   * 
   */
  //   public function showModuleInfo() {
    
  //   return array(
  //     '#type' => 'markup',
  //     '#markup' => '<h2>IRS OCMS Modules</h2>
  //   <div id="block-seven-content" data-block-plugin-id="system_main_block" class="block block-system block-system-main-block">
  //       <ul class="admin-list">'
  //       .'<li><a href="/admin/config/irspup/irs_file_operations"><span class="label">Static File Operations</span><div class="description">Make the most recent version of a file always retain its original filename.</div></a></li>'
  //       .'<li><a href="/admin/config/irspup/irs_sfbu"><span class="label">SFBU</span><div class="description">Static File Bulk Upload Automatically.</div></a></li>
  //         <li><a href="/admin/config/irspup/irs_customjs"><span class="label">Custom JS</span><div class="description">A module to demonstrate how to insert Javascript.</div></a></li>
  //      </ul></div>
  // </div>
  //     </div>'

  //   );

  //  }

}<file_sep>/docroot/modules/custom/ocms_linkchecker/src/OcmsLinkcheckerExtractionService.php
<?php

namespace Drupal\ocms_linkchecker;

use Drupal\Component\Utility\Html;
use Drupal\Component\Utility\UrlHelper;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Language\LanguageManagerInterface;
use Drupal\Core\Url;
use Symfony\Component\HttpFoundation\RequestStack;

/**
 * Implements the PupLinkcheckerExtractionInterface.
 */
class PupLinkcheckerExtractionService implements PupLinkcheckerExtractionInterface {

  /**
   * OCMS Linkchecker Parsing Service.
   *
   * @var \Drupal\ocms_linkchecker\PupLinkcheckerParsingInterface
   */
  protected $parsingService;

  /**
   * OCMS Linkchecker Utility Service.
   *
   * @var \Drupal\ocms_linkchecker\PupLinkcheckerUtilityInterface
   */
  protected $utilityService;

  /**
   * Drupal's language manager service.
   *
   * @var \Drupal\Core\Language\LanguageManagerInterface;
   */
  protected $languageManager;

  /**
   * The current request.
   *
   * @var \Symfony\Component\HttpFoundation\Request
   */
  protected $request;

  /**
   * The config factory.
   *
   * @var \Drupal\Core\Config\ConfigFactoryInterface
   */
  protected $configFactory;

  /**
   * Constructs the OCMS Linkchecker Extraction Service object.
   *
   * @param \Drupal\ocms_linkchecker\PupLinkcheckerParsingInterface $ocms_linkchecker_parsing
   *   The OCMS Linkchecker Parsing Service.
   * @param \Drupal\ocms_linkchecker\PupLinkcheckerUtilityInterface $ocms_linkchecker_utility
   *   The OCMS Linkchecker Utility Service.
   * @param \Drupal\Core\Language\LanguageManagerInterface $language_manager
   *   The language manager.
   * @param \Symfony\Component\HttpFoundation\RequestStack $request_stack
   *   The request stack.
   * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
   *   The factory for configuration objects.
   */
  public function __construct(PupLinkcheckerParsingInterface $ocms_linkchecker_parsing, PupLinkcheckerUtilityInterface $ocms_linkchecker_utility, LanguageManagerInterface $language_manager, RequestStack $request_stack, ConfigFactoryInterface $config_factory) {
    $this->parsingService = $ocms_linkchecker_parsing;
    $this->utilityService = $ocms_linkchecker_utility;
    $this->languageManager = $language_manager;
    $this->request = $request_stack->getCurrentRequest();
    $this->configFactory = $config_factory;
  }

  /**
   * {@inheritdoc}
   */
  public function extractContentLinks($text, $contentPath) {
    global $base_root;
    $isHttps = $this->request->isSecure();

    $config = $this->configFactory->get('ocms_linkchecker.settings');

    $htmlDom = Html::load($text);
    $urls = array();

    // Finds all hyperlinks in the content.
    if ($config->get('extract.from_a') == 1) {
      $links = $htmlDom->getElementsByTagName('a');
      foreach ($links as $link) {
        $urls[] = $link->getAttribute('href');
      }

      $links = $htmlDom->getElementsByTagName('area');
      foreach ($links as $link) {
        $urls[] = $link->getAttribute('href');
      }
    }

    // Finds all audio links in the content.
    if ($config->get('extract.from_audio') == 1) {
      $audios = $htmlDom->getElementsByTagName('audio');
      foreach ($audios as $audio) {
        $urls[] = $audio->getAttribute('src');

        // Finds source tags with links in the audio tag.
        $sources = $audio->getElementsByTagName('source');
        foreach ($sources as $source) {
          $urls[] = $source->getAttribute('src');
        }
        // Finds track tags with links in the audio tag.
        $tracks = $audio->getElementsByTagName('track');
        foreach ($tracks as $track) {
          $urls[] = $track->getAttribute('src');
        }
      }
    }

    // Finds embed tags with links in the content.
    if ($config->get('extract.from_embed') == 1) {
      $embeds = $htmlDom->getElementsByTagName('embed');
      foreach ($embeds as $embed) {
        $urls[] = $embed->getAttribute('src');
        $urls[] = $embed->getAttribute('pluginurl');
        $urls[] = $embed->getAttribute('pluginspage');
      }
    }

    // Finds iframe tags with links in the content.
    if ($config->get('extract.from_iframe') == 1) {
      $iframes = $htmlDom->getElementsByTagName('iframe');
      foreach ($iframes as $iframe) {
        $urls[] = $iframe->getAttribute('src');
      }
    }

    // Finds img tags with links in the content.
    if ($config->get('extract.from_img') == 1) {
      $imgs = $htmlDom->getElementsByTagName('img');
      foreach ($imgs as $img) {
        $urls[] = $img->getAttribute('src');
        $urls[] = $img->getAttribute('longdesc');
      }
    }

    // Finds object/param tags with links in the content.
    if ($config->get('extract.from_object') == 1) {
      $objects = $htmlDom->getElementsByTagName('object');
      foreach ($objects as $object) {
        $urls[] = $object->getAttribute('data');
        $urls[] = $object->getAttribute('codebase');

        // Finds param tags with links in the object tag.
        $params = $object->getElementsByTagName('param');
        foreach ($params as $param) {
          // @todo
          // - Try to extract links in unkown "flashvars" values
          //   (e.g., file=http://, data=http://).
          $names = array('archive', 'filename', 'href', 'movie', 'src', 'url');
          if ($param->hasAttribute('name') && in_array($param->getAttribute('name'), $names)) {
            $urls[] = $param->getAttribute('value');
          }

          $srcs = array('movie');
          if ($param->hasAttribute('src') && in_array($param->getAttribute('src'), $srcs)) {
            $urls[] = $param->getAttribute('value');
          }
        }
      }
    }

    // Finds video tags with links in the content.
    if ($config->get('extract.from_video') == 1) {
      $videos = $htmlDom->getElementsByTagName('video');
      foreach ($videos as $video) {
        $urls[] = $video->getAttribute('poster');
        $urls[] = $video->getAttribute('src');

        // Finds source tags with links in the video tag.
        $sources = $video->getElementsByTagName('source');
        foreach ($sources as $source) {
          $urls[] = $source->getAttribute('src');
        }
        // Finds track tags with links in the audio tag.
        $tracks = $video->getElementsByTagName('track');
        foreach ($tracks as $track) {
          $urls[] = $track->getAttribute('src');
        }
      }
    }

    // Remove empty values.
    $urls = array_filter($urls);
    // Remove duplicate urls.
    $urls = array_unique($urls);

    // What type of links should be checked?
    $linkcheckerCheckLinkTypes = $config->get('general.check_link_types');

    $links = array();
    foreach ($urls as $url) {
      // Decode HTML links into plain text links.
      // DOMDocument->loadHTML does not provide the RAW url from code. All html
      // entities are already decoded.
      // @todo: Try to find a way to get the raw value.
      $urlDecoded = $url;

      // Prefix protocol relative urls with a protocol to allow link checking.
      if (preg_match('!^//!', $urlDecoded)) {
        $httpProtocol = $isHttps ? 'https' : 'http';
        $urlDecoded = $httpProtocol . ':' . $urlDecoded;
      }

      // FIXME: #1149596 HACK - Encode spaces in URLs, so validation equals TRUE and link gets added.
      $urlEncoded = str_replace(' ', '%20', $urlDecoded);

      // Full qualified URLs.
      if ($linkcheckerCheckLinkTypes != 2 && UrlHelper::isValid($urlEncoded, TRUE)) {
        // Add to Array and change HTML links into plain text links.
        $links[$urlDecoded][] = $url;
      }
      // Skip mailto:, javascript:, etc.
      elseif (preg_match('/^\w[\w.+]*:/', $urlDecoded)) {
        continue;
      }
      // Local URLs. $linkchecker_check_links_types = 0 or 2
      elseif ($linkcheckerCheckLinkTypes != 1 && UrlHelper::isValid($urlEncoded, FALSE)) {
        // Get full qualified url with base path of content.
        $absoluteContentPath = $this->parsingService->getAbsoluteUrl($contentPath);

        // Absolute local URLs need to start with [/].
        if (preg_match('!^/!', $urlDecoded)) {
          // Add to Array and change HTML encoded links into plain text links.
          $links[$base_root . $urlDecoded][] = $url;
        }
        // Anchors and URL parameters like "#foo" and "?foo=bar".
        elseif (!empty($contentPath) && preg_match('!^[?#]!', $urlDecoded)) {
          // Add to Array and change HTML encoded links into plain text links.
          $links[$contentPath . $urlDecoded][] = $url;
        }
        // Relative URLs like "./foo/bar" and "../foo/bar".
        elseif (!empty($absoluteContentPath) && preg_match('!^\.{1,2}/!', $urlDecoded)) {
          // Build the URI without hostname before the URI is normalized and
          // dot-segments will be removed. The hostname is added back after the
          // normalization has completed to prevent hostname removal by the regex.
          // This logic intentionally does not implement all the rules definied in
          // RFC 3986, section 5.2.4 to show broken links and over-dot-segmented
          // URIs; e.g., http://example.com/../../foo/bar.
          // For more information, see http://drupal.org/node/832388.
          $path = substr_replace($absoluteContentPath . $urlDecoded, '', 0, strlen($base_root));

          // Remove './' segments where possible.
          $path = str_replace('/./', '/', $path);

          // Remove '../' segments where possible. Loop until all segments are
          // removed. Taken over from _drupal_build_css_path() in common.inc.
          $last = '';
          while ($path != $last) {
            $last = $path;
            $path = preg_replace('`(^|/)(?!\.\./)([^/]+)/\.\./`', '$1', $path);
          }

          // Glue the hostname and path to full-qualified URI.
          $links[$base_root . $path][] = $url;
        }
        // Relative URLs like "test.png".
        elseif (!empty($absoluteContentPath) && preg_match('!^[^/]!', $urlDecoded)) {
          $links[$absoluteContentPath . $urlDecoded][] = $url;
        }
        else {
          // @todo Are there more special cases the module need to handle?
        }
      }
    }

    return $links;
  }

  /**
   * {@inheritdoc}
   */
  public function extractNodeLinks($node, $returnFieldNames = FALSE) {
    $filter = new \stdClass();
    $filter->settings['filter_url_length'] = 72;

    // Create array of node fields to scan.
    $textItems = array();
    $textItemsByField = array();

    // Add fields typically not used for urls to the bottom. This way a link may
    // found earlier while looping over $textItemsByField below.
    $textItemsByField = array_merge($textItemsByField, $this->parsingService->parseFields('node', $node->bundle(), $node, TRUE));
    // @see: https://api.drupal.org/api/drupal/core%21modules%21filter%21filter.module/function/_filter_url/8.3.x
    $textItemsByField['title'][] = _filter_url($node->getTitle(), $filter);
    $textItems = $this->utilityService->recurseArrayValues($textItemsByField);

    // Get the absolute node path for extraction of relative links.
    if ($node->language()) {
      $path = $node->toUrl('canonical', ['absolute' => true, 'language' => $node->language()])->toString();
    }
    else {
      $path = $node->toUrl('canonical', ['absolute' => true])->toString();
    }

    // Extract all links in a node.
    $links = $this->extractContentLinks(implode(' ', $textItems), $path);

    // Return either the array of links, or an array of field names containing
    // each link, depending on what was requested.
    if (!$returnFieldNames) {
      return $links;
    }
    else {
      $fieldNames = array();
      foreach ($textItemsByField as $fieldName => $items) {
        foreach ($items as $item) {
          foreach ($links as $uri => $link) {
            // We only need to do a quick check here to see if the URL appears
            // anywhere in the text; if so, that means users with access to this
            // field will be able to see the URL (and any private data such as
            // passwords contained in it). This is sufficient for the purposes of
            // _linkchecker_link_node_ids(), where this information is used.
            foreach ($link as $originalLink) {
              if (strpos($item, $originalLink) !== FALSE) {
                $fieldNames[$uri][$fieldName] = $fieldName;
              }
              // URLs in $links have been auto-decoded by DOMDocument->loadHTML
              // and does not provide the RAW url with html special chars.
              // NOTE: htmlspecialchars() is 30% slower than str_replace().
              elseif (strpos($item, str_replace('&', '&amp;', $originalLink)) !== FALSE) {
                $fieldNames[$uri][$fieldName] = $fieldName;
              }
            }
          }
        }
      }

      return $fieldNames;
    }
  }

  /**
   * {@inheritdoc}
   */
  public function extractCommentLinks($comment, $returnFieldNames = FALSE) {
  }

  /**
   * {@inheritdoc}
   */
  public function extractBlockLinks($block, $returnFieldNames = FALSE) {
  }
}
<file_sep>/docroot/modules/custom/ocms_universal_assets/js/iframe_send_height.js
/**
 * @file
 * Send parent of iframe the updated height.
 */

(function ($) {

  Drupal.behaviors.iframeSendHeight = {
    attach:function (context, settings) {

      var pymChild = new pym.Child();

      // Delay update height to resolve cut-off footer.
      setTimeout(function() {
        pymChild.sendHeight();
      }, 400);

      // Update child height on click for dom updates like expanded content.
      $(document, context).click(function() {
        setTimeout(function() {
          pymChild.sendHeight();
        }, 400);
      });

    }
  };

})(jQuery);
<file_sep>/docroot/modules/custom/ocms_linkchecker/ocms_linkchecker.views.inc
<?php

/**
 * @file
 * Provide views data for ocms_linkchecker.module.
 */

/**
 * Implements hook_views_data().
 */
function ocms_linkchecker_views_data() {
  $data = [];
  $data['ocms_linkchecker_link']['table']['group'] = t('OCMS Linkchecker Link Table');
  $data['ocms_linkchecker_link']['table']['base'] = [
    'field' => 'lid',
    'title' => t('OCMS Linkchecker Link Table'),
    'help' => t('The Link table contains all the information for each link that will be checked'),
  ];

  $data['ocms_linkchecker_link']['lid'] = [
    'title' => t('Link ID'),
    'help' => t('A unique ID that is incremented automatically when a row is created'),
    'field' => [
      'id' => 'numeric',
    ],
    'argument' => [
      'id' => 'numeric',
    ],
    'filter' => [
      'id' => 'numeric',
    ],
    'sort' => [
      'id' => 'standard',
    ],
  ];

  $data['ocms_linkchecker_link']['url'] = [
    'title' => t('URL'),
    'help' => t('The fully qualified URL to check'),
    'field' => [
      'id' => 'standard',
    ],
    'filter' => [
      'id' => 'string',
    ],
    'sort' => [
      'id' => 'standard',
    ],
  ];

  $data['ocms_linkchecker_link']['method'] = [
    'title' => t('Method'),
    'help' => t('The method to check links (HEAD, GET)'),
    'field' => [
      'id' => 'standard',
    ],
    'filter' => [
      'id' => 'string',
    ],
    'sort' => [
      'id' => 'standard',
    ],
  ];

  $data['ocms_linkchecker_link']['code'] = [
    'title' => t('Code'),
    'help' => t('The HTTP status code returned when checking the link'),
    'field' => [
      'id' => 'standard',
    ],
    'filter' => [
      'id' => 'string',
    ],
    'sort' => [
      'id' => 'standard',
    ],
  ];

  $data['ocms_linkchecker_link']['error'] = [
    'title' => t('Error'),
    'help' => t('The message returned from the server when checking the link'),
    'field' => [
      'id' => 'standard',
    ],
  ];

  $data['ocms_linkchecker_link']['fail_count'] = [
    'title' => t('Fail Count'),
    'help' => t('The number of times this link has had a failure response'),
    'field' => [
      'id' => 'numeric',
    ],
  ];

  $data['ocms_linkchecker_link']['last_checked'] = [
    'title' => t('Last Checked'),
    'help' => t('A timestamp of when the link was last checked'),
    'field' => [
      'id' => 'date',
    ],
    'filter' => [
      'id' => 'date',
    ],
    'sort' => [
      'id' => 'date',
    ],
  ];

  $data['ocms_linkchecker_link']['status'] = [
    'title' => t('Status'),
    'help' => t('A boolean indicating whether this link should be checked'),
    'field' => [
      'id' => 'boolean',
    ],
  ];

  $data['ocms_linkchecker_entity']['table']['group'] = t('OCMS Linkchecker Entity Table');
  $data['ocms_linkchecker_entity']['table']['base'] = [
    'field' => 'entity_id',
    'title' => t('OCMS Linkchecker Entity Table'),
    'help' => t('The Entity table contains the entity IDs that reference given link IDs'),
  ];

  $data['ocms_linkchecker_entity']['entity_id'] = [
    'title' => t('ID'),
    'help' => t('The ID of the entity referencing a link'),
    'field' => [
      'id' => 'numeric',
    ],
    'argument' => [
      'id' => 'numeric',
    ],
    'filter' => [
      'id' => 'numeric',
    ],
    'sort' => [
      'id' => 'standard',
    ],
    'relationship' => [
      'base' => 'node_field_data',
      'base field' => 'nid',
      'id' => 'standard',
      'help' => t('Node being referenced'),
      'title' => t('Node'),
    ],
  ];

  $data['ocms_linkchecker_entity']['entity_type'] = [
    'title' => t('Entity Type'),
    'help' => t('The entity type that is referencing a link'),
    'field' => [
      'id' => 'standard',
    ],
    'filter' => [
      'id' => 'string',
    ],
    'sort' => [
      'id' => 'standard',
    ],
  ];

  $data['ocms_linkchecker_entity']['bundle'] = [
    'title' => t('Bundle'),
    'help' => t('The bundle that is referencing a link'),
    'field' => [
      'id' => 'standard',
    ],
    'filter' => [
      'id' => 'bundle',
    ],
    'sort' => [
      'id' => 'standard',
    ],
  ];

  $data['ocms_linkchecker_entity']['langcode'] = [
    'title' => t('Language Code'),
    'help' => t('The language code of the entity that is referencing a link'),
    'field' => [
      'id' => 'language',
    ],
    'filter' => [
      'id' => 'language',
    ],
    'sort' => [
      'id' => 'standard',
    ],
  ];

  $data['ocms_linkchecker_entity']['lid'] = [
    'title' => t('Link ID'),
    'help' => t('The link ID of the link being referenced'),
    'field' => [
      'id' => 'numeric',
    ],
    'filter' => [
      'id' => 'numeric',
    ],
    'sort' => [
      'id' => 'standard',
    ],
    'relationship' => [
      'base' => 'ocms_linkchecker_link',
      'base field' => 'lid',
      'id' => 'standard',
      'help' => t('Link referenced by this node'),
      'title' => t('Link'),
    ],
  ];

  return $data;
}
<file_sep>/docroot/modules/custom/ocms_linkchecker/src/Form/SettingsForm.php
<?php

namespace Drupal\ocms_linkchecker\Form;

use Drupal\Component\Plugin\FallbackPluginManagerInterface;
use Drupal\Core\Database\Connection;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Datetime\DateFormatterInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Form\ConfigFormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Logger\RfcLogLevel;
use Drupal\Core\Url;
use Drupal\filter\FilterPluginCollection;
use Drupal\user\Entity\User;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
 * Configures link checker settings for this site.
 */
class SettingsForm extends ConfigFormBase {

  /**
   * The module handler service.
   *
   * @var \Drupal\Core\Extension\ModuleHandlerInterface
   */
  protected $moduleHandler;

  /**
   * The plugin manager filter service.
   *
   * @var \Drupal\Component\Plugin\FallbackPluginManagerInterface
   */
  protected $pluginManagerFilter;

  /**
   * The date formatter service.
   *
   * @var \Drupal\Core\Datetime\DateFormatterInterface
   */
  protected $dateFormatter;

  /**
   * Drupal's database service.
   *
   * @var \Drupal\Core\Database\Connection
   */
  protected $connection;

  /**
   * Constructs a \Drupal\ocms_linkchecker\SettingsForm object.
   *
   * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
   *   The factory for configuration objects.
   * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
   *   The module handler.
   * @param \Drupal\Component\Plugin\FallbackPluginManagerInterface $plugin_manager_filter
   *   The plugin manager filter
   * @param \Drupal\Core\Datetime\DateFormatterInterface $date_formatter
   *   The date formatter
   * @param \Drupal\Core\Database\Connection
   *   The database connection
   */
  public function __construct(ConfigFactoryInterface $config_factory, ModuleHandlerInterface $module_handler, FallbackPluginManagerInterface $plugin_manager_filter, DateFormatterInterface $date_formatter, Connection $database) {
    parent::__construct($config_factory);
    $this->moduleHandler = $module_handler;
    $this->pluginManagerFilter = $plugin_manager_filter;
    $this->dateFormatter = $date_formatter;
    $this->connection = $database;
  }

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container) {
    return new static(
      $container->get('config.factory'),
      $container->get('module_handler'),
      $container->get('plugin.manager.filter'),
      $container->get('date.formatter'),
      $container->get('database')
    );
  }

  /**
   * {@inheritdoc}
   */
  public function getFormId() {
    return 'ocms_linkchecker_admin_form';
  }

  /**
   * {@inheritdoc}
   */
  protected function getEditableConfigNames() {
    return ['ocms_linkchecker.settings'];
  }

  /**
   * {@inheritdoc}
   */
  public function buildForm(array $form, FormStateInterface $form_state) {
    $config = $this->config('ocms_linkchecker.settings');

    $form['general'] = [
      '#type' => 'details',
      '#title' => $this->t('General settings'),
      '#description' => $this->t('Configure the <a href=":url">content types</a> that should be scanned for broken links.', [':url' => Url::fromRoute('entity.node_type.collection')->toString()]),
      '#open' => TRUE,
    ];

    $block_custom_dependencies = '<div class="admin-requirements">';
    $block_custom_dependencies .= $this->t('Requires: @module-list', [
      '@module-list' => $this->moduleHandler->moduleExists('block') ?
        $this->t('@module (<span class="admin-enabled">enabled</span>)', [
          '@module' => 'Block'
        ]) :
        $this->t('@module (<span class="admin-disabled">disabled</span>)', [
          '@module' => 'Block'
        ]),
    ]);
    $block_custom_dependencies .= '</div>';

    $form['general']['ocms_linkchecker_scan_blocks'] = [
      '#default_value' => $config->get('general.scan_blocks'),
      '#type' => 'checkbox',
      '#title' => $this->t('Scan blocks for links'),
      '#description' => $this->t('Enable this checkbox if links in blocks should be checked.') . $block_custom_dependencies,
      '#disabled' => !$this->moduleHandler->moduleExists('block'),
    ];
    $form['general']['ocms_linkchecker_check_links_types'] = [
      '#type' => 'select',
      '#title' => $this->t('What type of links should be checked?'),
      '#description' => $this->t('A fully qualified link (http://example.com/foo/bar) to a page is considered external, whereas an absolute (/foo/bar) or relative link (node/123) without a domain is considered internal.'),
      '#default_value' => $config->get('general.check_link_types'),
      '#options' => [
        '0' => $this->t('Internal and external'),
        '1' => $this->t('External only (http://example.com/foo/bar)'),
        '2' => $this->t('Internal only (node/123)'),
      ],
    ];

    $form['extract'] = [
      '#type' => 'details',
      '#title' => $this->t('Link extraction'),
      '#open' => TRUE,
    ];
    $form['extract']['ocms_linkchecker_extract_from_a'] = [
      '#default_value' => $config->get('extract.from_a'),
      '#type' => 'checkbox',
      '#title' => $this->t('Extract links in <code>&lt;a&gt;</code> and <code>&lt;area&gt;</code> tags'),
      '#description' => $this->t('Enable this checkbox if normal hyperlinks should be extracted. The anchor element defines a hyperlink, the named target destination for a hyperlink, or both. The area element defines a hot-spot region on an image, and associates it with a hypertext link.'),
    ];
    $form['extract']['ocms_linkchecker_extract_from_audio'] = [
      '#default_value' => $config->get('extract.from_audio'),
      '#type' => 'checkbox',
      '#title' => $this->t('Extract links in <code>&lt;audio&gt;</code> tags including their <code>&lt;source&gt;</code> and <code>&lt;track&gt;</code> tags'),
      '#description' => $this->t('Enable this checkbox if links in audio tags should be extracted. The audio element is used to embed audio content.'),
    ];
    $form['extract']['ocms_linkchecker_extract_from_embed'] = [
      '#default_value' => $config->get('extract.from_embed'),
      '#type' => 'checkbox',
      '#title' => $this->t('Extract links in <code>&lt;embed&gt;</code> tags'),
      '#description' => $this->t('Enable this checkbox if links in embed tags should be extracted. This is an obsolete and non-standard element that was used for embedding plugins in past and should no longer used in modern websites.'),
    ];
    $form['extract']['ocms_linkchecker_extract_from_iframe'] = [
      '#default_value' => $config->get('extract.from_iframe'),
      '#type' => 'checkbox',
      '#title' => $this->t('Extract links in <code>&lt;iframe&gt;</code> tags'),
      '#description' => $this->t('Enable this checkbox if links in iframe tags should be extracted. The iframe element is used to embed another HTML page into a page.'),
    ];
    $form['extract']['ocms_linkchecker_extract_from_img'] = [
      '#default_value' => $config->get('extract.from_img'),
      '#type' => 'checkbox',
      '#title' => $this->t('Extract links in <code>&lt;img&gt;</code> tags'),
      '#description' => $this->t('Enable this checkbox if links in image tags should be extracted. The img element is used to add images to the content.'),
    ];
    $form['extract']['ocms_linkchecker_extract_from_object'] = [
      '#default_value' => $config->get('extract.from_object'),
      '#type' => 'checkbox',
      '#title' => $this->t('Extract links in <code>&lt;object&gt;</code> and <code>&lt;param&gt;</code> tags'),
      '#description' => $this->t('Enable this checkbox if multimedia and other links in object and their param tags should be extracted. The object tag is used for flash, java, quicktime and other applets.'),
    ];
    $form['extract']['ocms_linkchecker_extract_from_video'] = [
      '#default_value' => $config->get('extract.from_video'),
      '#type' => 'checkbox',
      '#title' => $this->t('Extract links in <code>&lt;video&gt;</code> tags including their <code>&lt;source&gt;</code> and <code>&lt;track&gt;</code> tags'),
      '#description' => $this->t('Enable this checkbox if links in video tags should be extracted. The video element is used to embed video content.'),
    ];

    // Get all filters available on the system.
    $bag = new FilterPluginCollection($this->pluginManagerFilter, []);
    $filter_info = $bag->getAll();
    $filter_options = [];
    $filter_descriptions = [];

    foreach ($filter_info as $name => $filter) {
      if (in_array($name, $config->get('extract.filter.default_blacklist'))) {
        $filter_options[$name] = $this->t('@title <span class="marker">(Recommended)</span>', array('@title' => $filter->getLabel()));
      }
      else {
        $filter_options[$name] = $filter->getLabel();
      }
      $filter_descriptions[$name] = [
        '#description' => $filter->getDescription(),
      ];
    }

    $form['extract']['ocms_linkchecker_filter_blacklist'] = [
      '#type' => 'checkboxes',
      '#title' => $this->t('Text formats disabled for link extraction'),
      '#default_value' => $config->get('extract.filter.blacklist'),
      '#options' => $filter_options,
      '#description' => $this->t('<strong>NOTE: Do NOT check any of these boxes until <a href="https://www.drupal.org/node/2876287">https://www.drupal.org/node/2876287</a> has been fixed.</strong> If a filter has been enabled for an input format it runs first and afterwards the link extraction. This helps the link checker module to find all links normally created by custom filters (e.g. Markdown filter, Bbcode). All filters used as inline references (e.g. Weblink filter <code>[link: id]</code>) to other content and filters only wasting processing time (e.g. Line break converter) should be disabled. This setting does not have any effect on how content is shown on a page. This feature optimizes the internal link extraction process for link checker and prevents false alarms about broken links in content not having the real data of a link.'),
    ];
    $form['extract']['ocms_linkchecker_filter_blacklist'] = array_merge($form['extract']['ocms_linkchecker_filter_blacklist'], $filter_descriptions);

    // @todo: Am I forced to use db_query against my own table? Or is there
    //        something akin to nodeStorage (entity storage)?
    $countLidsEnabled = $this->connection->query("SELECT count(lid) FROM {ocms_linkchecker_link} WHERE status = :status", array(':status' => 1))->fetchField();
    $countLidsDisabled = $this->connection->query("SELECT count(lid) FROM {ocms_linkchecker_link} WHERE status = :status", array(':status' => 0))->fetchField();
    $form['check'] = [
      '#type' => 'details',
      '#title' => $this->t('Check settings'),
      '#description' => $this->t('Currently the site has @count links (@count_enabled enabled / @count_disabled disabled).', ['@count' => $countLidsEnabled + $countLidsDisabled, '@count_enabled' => $countLidsEnabled, '@count_disabled' => $countLidsDisabled]),
      '#open' => TRUE,
    ];
    $form['check']['ocms_linkchecker_check_connections_max'] = [
      '#type' => 'select',
      '#title' => $this->t('Number of simultaneous connections'),
      '#description' => $this->t('Defines the maximum number of simultaneous connections that can be opened by the server. How do we get Guzzle to make sure that a single domain is not overloaded beyond RFC limits? For small hosting plans with very limited CPU and RAM it may be required to reduce the default limit.'),
      '#default_value' => $config->get('check.max_connections'),
      '#options' => array_combine([2, 4, 8, 16, 24, 32, 48, 64, 96, 128], [2, 4, 8, 16, 24, 32, 48, 64, 96, 128]),
    ];
    $form['check']['ocms_linkchecker_check_useragent'] = [
      '#type' => 'select',
      '#title' => $this->t('User-Agent'),
      '#description' => $this->t('Defines the user agent that will be used for checking links on remote sites. If someone blocks the standard Drupal user agent you can try with a more common browser.'),
      '#default_value' => $config->get('check.user_agent'),
      '#options' => [
        'Drupal (+http://drupal.org/)' => 'Drupal (+http://drupal.org/)',
        'Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; Touch; rv:11.0) like Gecko' => 'Windows 8.1 (x64), Internet Explorer 11.0',
        'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Safari/537.36 Edge/13.10586' => 'Windows 10 (x64), Edge',
        'Mozilla/5.0 (Windows NT 6.3; WOW64; rv:47.0) Gecko/20100101 Firefox/47.0' => 'Windows 8.1 (x64), Mozilla Firefox 47.0',
        'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:47.0) Gecko/20100101 Firefox/47.0' => 'Windows 10 (x64), Mozilla Firefox 47.0',
      ],
    ];
    $intervals = [86400, 172800, 259200, 604800, 1209600, 2419200, 4838400];
    $period = array_map([$this->dateFormatter, 'formatInterval'], array_combine($intervals, $intervals));
    $form['check']['ocms_linkchecker_check_interval'] = [
      '#type' => 'select',
      '#title' => $this->t('Check interval for links'),
      '#description' => $this->t('This interval setting defines how often cron will re-check the status of links.'),
      '#default_value' => $config->get('check.interval'),
      '#options' => $period,
    ];
    $form['check']['ocms_linkchecker_disable_link_check_for_urls'] = [
      '#default_value' => $config->get('check.disable_for_urls'),
      '#type' => 'textarea',
      '#title' => $this->t('Do not check the link status of links containing these URLs'),
      '#description' => $this->t('By default this list contains the domain names reserved for use in documentation and not available for registration. See <a href=":rfc-2606">RFC 2606</a>, Section 3 for more information. URLs on this list are still extracted, but the link setting <em>Check link status</em> becomes automatically disabled to prevent false alarms. If you change this list you need to clear all link data and re-analyze your content. Otherwise this setting will only affect new links added after the configuration change.', array(':rfc-2606' => 'http://www.rfc-editor.org/rfc/rfc2606.txt')),
    ];
    $form['check']['ocms_linkchecker_logging_level'] = [
      '#default_value' => $config->get('log_level'),
      '#type' => 'select',
      '#title' => $this->t('Log level'),
      '#description' => $this->t('Controls the severity of logging.'),
      '#options' => [
        RfcLogLevel::DEBUG => $this->t('Debug messages'),
        RfcLogLevel::INFO => $this->t('All messages (default)'),
        RfcLogLevel::NOTICE => $this->t('Notices and errors'),
        RfcLogLevel::WARNING => $this->t('Warnings and errors'),
        RfcLogLevel::ERROR => $this->t('Errors only'),
      ],
    ];

    $form['error'] = [
      '#type' => 'details',
      '#title' => $this->t('Error handling'),
      '#description' => $this->t('Defines error handling and custom actions to be executed if specific HTTP requests are failing.'),
      '#open' => TRUE,
    ];
    $ocms_linkchecker_default_impersonate_account = User::load(1);
    $form['error']['ocms_linkchecker_impersonate_account'] = [
      '#type' => 'textfield',
      '#title' => $this->t('Impersonate user account'),
      '#description' => $this->t('If below error handling actions are executed they can be impersonated with a custom user account. By default this is user %name, but you are able to assign a custom user to allow easier identification of these automatic revision updates. Make sure you select a user with <em>full</em> permissions on your site or the user may not able to access and save all content.', array('%name' => $ocms_linkchecker_default_impersonate_account->getAccountName())),
      '#size' => 30,
      '#maxlength' => 60,
      '#autocomplete_path' => 'user/autocomplete',
      '#default_value' => $config->get('error.impersonate_account'),
    ];
    $form['error']['ocms_linkchecker_action_status_code_301'] = [
      '#title' => $this->t('Update permanently moved links'),
      '#description' => $this->t('If enabled, outdated links in content providing a status <em>Moved Permanently</em> (status code 301) are automatically updated to the most recent URL. If used, it is recommended to use a value of <em>three</em> to make sure this is not only a temporarily change. This feature trust sites to provide a valid permanent redirect. A new content revision is automatically created on link updates if <em>create new revision</em> is enabled in the <a href=":content_types">content types</a> publishing options. It is recommended to create new revisions for all link checker enabled content types. Link updates are logged according to your choice of logging system.', array(':content_types' => Url::fromRoute('entity.node_type.collection')->toString())),
      '#type' => 'select',
      '#default_value' => $config->get('error.status_301_action_threshold'),
      '#options' => [
        0 => $this->t('Disabled'),
        1 => $this->t('After one failed check'),
        2 => $this->t('After two failed checks'),
        3 => $this->t('After three failed checks'),
        5 => $this->t('After five failed checks'),
        10 => $this->t('After ten failed checks'),
      ],
    ];
    $form['error']['ocms_linkchecker_action_status_code_404'] = [
      '#title' => $this->t('Unpublish content on file not found error'),
      '#description' => $this->t('If enabled, content with one or more broken links (status code 404) will be unpublished and moved to moderation queue for review after the number of specified checks failed. If used, it is recommended to use a value of <em>three</em> to make sure this is not only a temporarily error.'),
      '#type' => 'select',
      '#default_value' => $config->get('error.status_404_action_threshold'),
      '#options' => [
        0 => $this->t('Disabled'),
        1 => $this->t('After one file not found error'),
        2 => $this->t('After two file not found errors'),
        3 => $this->t('After three file not found errors'),
        5 => $this->t('After five file not found errors'),
        10 => $this->t('After ten file not found errors'),
      ],
    ];
    $form['error']['ocms_linkchecker_ignore_response_codes'] = [
      '#default_value' => $config->get('error.ignore_response_codes'),
      '#type' => 'textarea',
      '#title' => $this->t("Don't treat these response codes as errors"),
      '#description' => $this->t('One HTTP status code per line, e.g. 403.'),
    ];

    return parent::buildForm($form, $form_state);
  }

  /**
   * {@inheritdoc}
   */
  public function validateForm(array &$form, FormStateInterface $form_state) {
    parent::validateForm($form, $form_state);
    $config = $this->config('ocms_linkchecker.settings');

    $form_state->setValue('ocms_linkchecker_disable_link_check_for_urls', trim($form_state->getValue('ocms_linkchecker_disable_link_check_for_urls')));
    $form_state->setValue('ocms_linkchecker_ignore_response_codes', trim($form_state->getValue('ocms_linkchecker_ignore_response_codes')));
    $ignoreResponseCodes = preg_split('/(\r\n?|\n)/', $form_state->getValue('ocms_linkchecker_ignore_response_codes'));
    foreach ($ignoreResponseCodes as $ignoreResponseCode) {
      // @todo: Switch this to use the PuplinkcheckerUtilityService
      if (!$this->validResponseCode($ignoreResponseCode)) {
        $form_state->setErrorByName('ocms_linkchecker_ignore_response_codes', $this->t('Invalid response code %code found.', ['%code' => $ignoreResponseCode]));
      }
    }

    // Prevent the removal of RFC documentation domains. These are the official
    // and reserved documentation domains and not "example" hostnames!
    $ocms_linkchecker_disable_link_check_for_urls = array_filter(preg_split('/(\r\n?|\n)/', $form_state->getValue('ocms_linkchecker_disable_link_check_for_urls')));
    $form_state->setValue('ocms_linkchecker_disable_link_check_for_urls', implode("\n", array_unique(array_merge(explode("\n", trim($config->get('check.reserved_urls'))), $ocms_linkchecker_disable_link_check_for_urls))));

    // Validate impersonation user.
    $ocms_linkchecker_impersonate_account = User::load($form_state->getValue('ocms_linkchecker_impersonate_account'));
    if (!$ocms_linkchecker_impersonate_account) {
      $form_state->setErrorByName('ocms_linkchecker_impersonate_account', $this->t('User account %id cannot be found.', ['%id' => $form_state->getValue('ocms_linkchecker_impersonate_account')]));
    }
  }

  /**
   * {@inheritdoc}
   */
  public function submitForm(array &$form, FormStateInterface $form_state) {
    $this->config('ocms_linkchecker.settings')
      ->set('general.scan_blocks', $form_state->getValue('ocms_linkchecker_scan_blocks'))
      ->set('general.check_link_types', $form_state->getValue('ocms_linkchecker_check_links_types'))
      ->set('extract.from_a', $form_state->getValue('ocms_linkchecker_extract_from_a'))
      ->set('extract.from_audio', $form_state->getValue('ocms_linkchecker_extract_from_audio'))
      ->set('extract.from_embed', $form_state->getValue('ocms_linkchecker_extract_from_embed'))
      ->set('extract.from_iframe', $form_state->getValue('ocms_linkchecker_extract_from_iframe'))
      ->set('extract.from_img', $form_state->getValue('ocms_linkchecker_extract_from_img'))
      ->set('extract.from_object', $form_state->getValue('ocms_linkchecker_extract_from_object'))
      ->set('extract.from_video', $form_state->getValue('ocms_linkchecker_extract_from_video'))
      ->set('extract.filter.blacklist', $form_state->getValue('ocms_linkchecker_filter_blacklist'))
      ->set('check.max_connections', $form_state->getValue('ocms_linkchecker_check_connections_max'))
      ->set('check.user_agent', $form_state->getValue('ocms_linkchecker_check_useragent'))
      ->set('check.interval', $form_state->getValue('ocms_linkchecker_check_interval'))
      ->set('check.disable_for_urls', $form_state->getValue('ocms_linkchecker_disable_link_check_for_urls'))
      ->set('check.log_level', $form_state->getValue('ocms_linkchecker_logging_level'))
      ->set('error.impersonate_account', $form_state->getValue('ocms_linkchecker_impersonate_account'))
      ->set('error.status_301_action_threshold', $form_state->getValue('ocms_linkchecker_action_status_code_301'))
      ->set('error.status_404_action_threshold', $form_state->getValue('ocms_linkchecker_action_status_code_404'))
      ->set('error.ignore_response_codes', $form_state->getValue('ocms_linkchecker_ignore_response_codes'))
      ->save();

    // If block scanning has been selected.
//    if ($form_state->getValue('ocms_linkchecker_scan_blocks') > $form['general']['ocms_linkchecker_scan_blocks']['#default_value']) {
//      module_load_include('inc', 'linkchecker', 'linkchecker.batch');
//      batch_set(_linkchecker_batch_import_block_custom());
//    }

    parent::submitForm($form, $form_state);
  }

  /**
   * Defines the list of allowed response codes for form input validation.
   *
   * @param int $code
   *   A numeric response code.
   *
   * @return bool
   *   TRUE if the status code is valid, otherwise FALSE.
   */
  private function validResponseCode($responseCode) {

    $responses = array(
      100 => 'Continue',
      101 => 'Switching Protocols',
      200 => 'OK',
      201 => 'Created',
      202 => 'Accepted',
      203 => 'Non-Authoritative Information',
      204 => 'No Content',
      205 => 'Reset Content',
      206 => 'Partial Content',
      300 => 'Multiple Choices',
      301 => 'Moved Permanently',
      302 => 'Found',
      303 => 'See Other',
      304 => 'Not Modified',
      305 => 'Use Proxy',
      307 => 'Temporary Redirect',
      400 => 'Bad Request',
      401 => 'Unauthorized',
      402 => 'Payment Required',
      403 => 'Forbidden',
      404 => 'Not Found',
      405 => 'Method Not Allowed',
      406 => 'Not Acceptable',
      407 => 'Proxy Authentication Required',
      408 => 'Request Time-out',
      409 => 'Conflict',
      410 => 'Gone',
      411 => 'Length Required',
      412 => 'Precondition Failed',
      413 => 'Request Entity Too Large',
      414 => 'Request-URI Too Large',
      415 => 'Unsupported Media Type',
      416 => 'Requested range not satisfiable',
      417 => 'Expectation Failed',
      500 => 'Internal Server Error',
      501 => 'Not Implemented',
      502 => 'Bad Gateway',
      503 => 'Service Unavailable',
      504 => 'Gateway Time-out',
      505 => 'HTTP Version not supported',
    );

    return array_key_exists($responseCode, $responses);
  }

}
<file_sep>/docroot/themes/custom/ocms_base/js/mega-menu-navigation.js
/* =================================================/
/============  Mega Menu JavaScript ================/
/=========  This javascript is used to assist ======/
/========  the mega menu css to control this  ======/
/==============   menus' visibility   ==============/
/==================================================*/
+ function($) {
    'use strict';
    // Selecting menu items by index 
    var mMenuNav = $('.header-nav nav'),
        mMenuNavH2 = $('.header-nav nav h2'),
        menuItemOne = $('.header-nav .navbar-nav > li').eq(0),
        menuItemTwo = $('.header-nav .navbar-nav > li').eq(1),
        menuItemThree = $('.header-nav .navbar-nav > li').eq(2),
        menuItemFour = $('.header-nav .navbar-nav > li').eq(3),
        menuItemFive = $('.header-nav .navbar-nav > li').eq(4);

    $(mMenuNav).addClass('megamenu'); // adding mega menu class to drupal mega menu
    $(mMenuNavH2).remove(); // remove hidden h2 for screen reader

    // Appending mega menu items
    $('.filing').appendTo(menuItemOne);
    $('.payments').appendTo(menuItemTwo);
    $('.refunds').appendTo(menuItemThree);
    $('.cnd').appendTo(menuItemFour);
    $('.fni').appendTo(menuItemFive);

    // Adding hover style on hover of sub navigation
    $('.filing').hover(function() {
        $((menuItemOne)[0].firstElementChild).toggleClass('mm-is-active');
    });
    $('.payments').hover(function() {
        $((menuItemTwo)[0].firstElementChild).toggleClass('mm-is-active');
    });
    $('.refunds').hover(function() {
        $((menuItemThree)[0].firstElementChild).toggleClass('mm-is-active');
    });
    $('.cnd').hover(function() {
        $((menuItemFour)[0].firstElementChild).toggleClass('mm-is-active');
    });
    $('.fni').hover(function() {
        $((menuItemFive)[0].firstElementChild).toggleClass('mm-is-active');
    });

// Adding bootstrap classes to sections
    // file link
    if ($('.filing section').length == 1) {
        $('.filing section').addClass('col-lg-12');
    } else if ($('.filing section').length == 2) {
        $('.filing section').addClass('col-lg-6');
    } else if ($('.filing section').length == 3) {
        $('.filing section').addClass('col-lg-4');
    } else if ($('.filing section').length == 4) {
        $('.filing section').addClass('col-lg-3');
    }
    // payments link
    if ($('.payments section').length == 1) {
        $('.payments section').addClass('col-lg-12');
    } else if ($('.payments section').length == 2) {
        $('.payments section').addClass('col-lg-6');
    } else if ($('.payments section').length == 3) {
        $('.payments section').addClass('col-lg-4');
    } else if ($('.payments section').length == 4) {
        $('.payments section').addClass('col-lg-3');
    }
    // refunds link
    if ($('.refunds section').length == 1) {
        $('.refunds section').addClass('col-lg-12');
    } else if ($('.refunds section').length == 2) {
        $('.refunds section').addClass('col-lg-6');
    } else if ($('.refunds section').length == 3) {
        $('.refunds section').addClass('col-lg-4');
    } else if ($('.refunds section').length == 4) {
        $('.refunds section').addClass('col-lg-3');
    }
    // credits and deduction link
    if ($('.cnd section').length == 1) {
        $('.cnd section').addClass('col-lg-12');
    } else if ($('.cnd section').length == 2) {
        $('.cnd section').addClass('col-lg-6');
    } else if ($('.cnd section').length == 3) {
        $('.cnd section').addClass('col-lg-4');
    } else if ($('.cnd section').length == 4) {
        $('.cnd section').addClass('col-lg-3');
    }
    // forms and publications link
    if ($('.fni section').length == 1) {
        $('.fni section').addClass('col-lg-12');
    } else if ($('.fni section').length == 2) {
        $('.fni section').addClass('col-lg-6');
    } else if ($('.fni section').length == 3) {
        $('.fni section').addClass('col-lg-4');
    } else if ($('.fni section').length == 4) {
        $('.fni section').addClass('col-lg-3');
    }

   // remove anchor bottom border from block with descriptions
   $('.paragraph--type--ocms-mega-menu-item').each(function() {
        if ($(this).children('div').hasClass('field--name-field-ocms-text-plain-long')) {
            $(this).find('.field--name-field-ocms-callout-link a').css('border-bottom','none');
        }
   });

    // initialize the megamenu
    $(document).ready(function () {
        // initialize the megamenu
         $(".megamenu").accessibleMegaMenu();
       
        // hack so that the megamenu doesn't show flash of css animation after the page loads.
        setTimeout(function () {
            $('body').removeClass('init');
        }, 500);
    });
}(jQuery);<file_sep>/docroot/modules/custom/ocms_viewfiles/src/Controller/OcmsFileView.php
<?php

namespace Drupal\ocms_viewfiles\Controller;

use Drupal\Core\Controller\ControllerBase;
use Drupal\file\Entity;
use Drupal\media_entity\Entity\Media;
use Drupal\file\Entity\File;
use Drupal\Core\Entity\EntityChangedTrait;
use Drupal\Core\Datetime\DrupalDateTime;
use Drupal\Core\Entity\EntityTypeManager;
use Drupal\Component\Render\FormattableMarkup;
use Drupal\Core\Database\Connection;
use Drupal\Core\Config\ConfigFactoryInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
 *  @file
 *  Controller for media_helper module.
 */
class IrsFileView extends ControllerBase { 

  /**
   * View directory folders under sites files which are in our static file taxonomy 
   */
 public function content() {
  $vid="ocms_static_file_path";
  $parent = 0;
  $max_depth = NULL;
  $load_entities = FALSE;
  $terms = \Drupal::entityTypeManager()->getStorage('taxonomy_term')->loadTree($vid, $parent, $max_depth, $load_entities);
  $directory_names=array();
  $headers = array(
      array('data' => t('Name'))
  
  
      );  
  foreach ($terms as $term){
    $directory_names[]=$term->name;
  }
  $directory_tree="This directory listing is considered an expert interface to locating PDF documents. Please refer to the <a href='https://www.ocms.gov/Forms-&-Pubs'>main forms and publications landing page </a> for more details on locating specific forms, publications, or instructions.<br><br>";
  $path = "sites/default/files/";
  $directories = scandir($path);
  if (count($directories)){
    foreach ($directories as $directory) {
      if (in_array($directory,$directory_names)){
        if ($directory !="images"){
         $link_url= "/downloads/$directory";
         $host = \Drupal::request()->getSchemeAndHttpHost();
         $full_path = $host."/sites/default/files/".$directory;
         $directoryData[] = array(
                'link_url' => $link_url,
                'name' => $directory,
               
                
              );
        }
       }  
    }
  }  
    
 $order = tablesort_get_order($headers);

 $rows = array();
 foreach ($directoryData as $entry) {
   $rows[] = array(
       
       array('data' => new FormattableMarkup('<a href=":link">@name</a>', 
          [':link' => $entry['link_url'], 
          '@name' => $entry['name']])
        ),
       
       
        
      );
 }

   
   $attributes = array('class' => array('tablesorter'),'id'=>array("myTable"));
   $table_element = array(
        '#theme' => 'table',
        '#header' => $headers,
        '#rows' => $rows,
        '#empty' =>t('Your table is empty'),
        '#attributes'=>$attributes,
        
    );  
    $html=drupal_render($table_element);
    $html=$directory_tree.$html;

    $build = array(
          '#type' => 'markup',
          '#markup' => $html,
          '#attached' => array(
          
             'library' => array('ocms_viewfiles/sortfiles_libraries'),
            ),
        );

    return $build;
 
  }
  
  /**
   * View directory folders
   */
   
  public function dir_content($path_dir='') {
	// get the complete path which may be several levels deep
  $current_path = \Drupal::service('path.current')->getPath();
  $path_dir=str_replace("/downloads/","",$current_path);
  $path = "sites/default/files/$path_dir";
  // get the taxonoym id for this path 
  $vid="ocms_static_file_path";
  $file_path_tid=getTidByName($path_dir,$vid);
  $directoryData=array(); 
  
  $parent_dirs=explode("/",$path_dir);
  $last_element=array_pop($parent_dirs);
  $parent_url=implode("/",$parent_dirs);
  $host = \Drupal::request()->getSchemeAndHttpHost();
  $file_names = scandir($path);
  if (count($file_names)) {
    foreach ($file_names as $file_name) {
     // find out if this is a file or a directory
     if ($file_name!="." AND $file_name!="..") {
       $array = explode('.', $file_name);
       if (count($array)>1){
            $extension = end($array);
       }else{
         $extension ="";
       }
       if (!$extension){
        // if it doesnt have any exension it must be a directory 
        $link_url= "/downloads/$path_dir/".$file_name;
        $directoryData[] = array(
                'link_url' => $link_url,
                'name' => $file_name,
                'changed_date' => "",
                'size' => "",
                'description' => ""
              );
       
       }
	} 
	}
  }
  $rows = array();
   foreach ($directoryData as $entry) {
     $dir_rows[] = array(
       array('data' => new FormattableMarkup('<a href=":link">@name</a>', 
          [':link' => $entry['link_url'], 
          '@name' => $entry['name']])
        ),
         
      );
   }
   
   if (count($directoryData)){
	 
	  $directory_headers = array(
         array('data' => t('Name'))
  
  
      ); 
	  $dir_table_element = array(
        '#theme' => 'table',
       
        '#rows' => $dir_rows,
       
        
    );  
    $dir_html=drupal_render($dir_table_element);
	
   }else{
	   $dir_html="";
   }


  
  $headers = array(
     array('data' => t('Name'),'field' => 'filename', 'sort' => 'asc' ),
     array('data' => t('Date'), 'field' => 'changed','sort' => 'asc'),
     array('data' => t('Size'), 'field' => 'filesize','sort' => 'asc'),
     array('data' => t('Description'), 'field' => 'name','sort' => 'asc'),
    );  
	
   $db = \Drupal::database(); 
	   
   $query = $db->select('media_field_data', 'mf_data')
      ->extend('\Drupal\Core\Database\Query\PagerSelectExtender')
      ->extend('\Drupal\Core\Database\Query\TableSortExtender'); 
	  $query->leftJoin('media__field_ocms_posted', 'posted', 'mf_data.mid = posted.entity_id');
	  $query->leftJoin('media__field_document', 'mf_doc', 'mf_data.mid = mf_doc.entity_id');
	  $query->innerJoin('media_field_data','mfd','mfd.mid = mf_data.mid');
	  $query->innerJoin('file_managed', 'fm', 'mf_doc.field_document_target_id = fm.fid');
	  $query->innerJoin('media__field_ocms_file_public_path', 'pp', 'mf_data.mid = pp.entity_id');
	  $query->fields('fm',array('filename','uri','changed','filesize'));
	  $query->fields('mfd',array('name'));
	  //$query->fields('posted',array('name')); 
	  $query->condition('pp.field_ocms_file_public_path_target_id', $file_path_tid, '=');
	  $db_or = db_or();
      $db_or->condition('mf_data.moderation_state', 'published', '=');
	  $db_or->condition('mf_data.moderation_state', NULL, 'IS');
      $query->condition($db_or);
	 

	  $result = $query
      ->limit(50)
      ->orderByHeader($headers)
      ->execute();

	    
   $host = \Drupal::request()->getSchemeAndHttpHost();
     $full_path = $host."/sites/default/files/";    
   // Populate the rows.
   $rows = array();
   foreach($result as $row) {
	   /*
	   $post_data=null;
       if (isset($static_media->field_ocms_posted)){
                 
          $posted_date=$static_media->get('field_ocms_posted')->getValue();
          $post_date=$posted_date[0]['value'];
       }
                 
     if ($post_date){
                 $changed_date= str_replace("T"," ",$post_date);
                }else{
                 $changed_date= date("Y-m-d\ H:i:s", $timestamp);
       }
	   */
	// only show files that are published in the public directory
	//if(strpos($row->uri,"public://") !== false){
	 $link=str_replace("public://",$full_path,$row->uri);
	 $size = format_size($row->filesize);
     $rows[] = array('data' => array(
	 'Name'=> new FormattableMarkup('<a href=":link">@name</a>', 
          [':link' => $link, 
          '@name' => $row->filename])
        ,
   
	  'Date' =>date('Y-m-d\ H:i:s',$row->changed),
	  'Size' =>$size,
      'Description' => $row->name,
    ));
	//}
   }
  
  
  $parent_dirs=explode("/",$path_dir);
  $last_element=array_pop($parent_dirs);
  $parent_url=implode("/",$parent_dirs);
  $host = \Drupal::request()->getSchemeAndHttpHost();
  $file_names = scandir($path);
  // different text for irm directory
  if ($path_dir=="irm") {
      $directory_tree="IRM Source Files<br>This page provides links to the Internal Revenue Manual (IRM) source files. 
      The listing can be sorted by the file name or the date the file was posted. To locate forms, instructions and publications 
      please see the <a href='/forms-pubs'>Forms & Publications page</a>.<br>";

  } else {
      $directory_tree="Contents of Directory $path_dir<br><br>";
  }
  $directory_tree.="<br><a href='/downloads/$parent_url'>Parent Directory</a><br><br>"; 
  if (count($file_names)) {
    // headers array, sorting by default on filename
    
    $directoryData=array();   
    foreach ($file_names as $file_name) {
     // find out if this is a file or a directory
     if ($file_name!="." AND $file_name!="..") {
       $array = explode('.', $file_name);
       if (count($array)>1){
            $extension = end($array);
       }else{
         $extension ="";
       }
       if (!$extension){
        // if it doesnt have any exension it must be a directory 
        $link_url= "/downloads/$path_dir/".$file_name;
        $directoryData[] = array(
                'link_url' => $link_url,
                'name' => $file_name,
                'changed_date' => "",
                'size' => "",
                'description' => ""
              );
       
       }
	 } 
	}
  }

    $table_element = array(
        '#theme' => 'table',
        '#header' => $headers,
        '#rows' => $rows,
        '#empty' =>t('No files found'),
        
        
    );  
 
    $html=drupal_render($table_element);
    $html=$directory_tree.$dir_html.$html;
   
	
	  $build = array(
	      
          '#type' => 'markup',
          '#markup' => $html,
          
        );
		
	
    $build['file_table'] = array('#type' => 'pager');

    return $build;
  }


/**
   * Utility: find term by name and vid.
   * @param null $name
   *  Term name
   * @param null $vid
   *  Term vid
   * @return int
   *  Term id or 0 if none.
   */
   function getTidByName($name = NULL, $vid = NULL) {
    $properties = [];
    if (!empty($name)) {
      $properties['name'] = $name;
    }
    if (!empty($vid)) {
      $properties['vid'] = $vid;
    }
    $terms = \Drupal::entityManager()->getStorage('taxonomy_term')->loadByProperties($properties);
    $term = reset($terms);

    return !empty($term) ? $term->id() : 0;
  }


  protected function getModuleName() {
    return 'ocms_viewfiles';
  }
  
  function is_this_directory ($file){ 
    return ((fileperms("$file") & 0x4000) == 0x4000);
  }
  
 
}
<file_sep>/docroot/themes/custom/ocms_education/js/custom/mobile-menu-header-top.js
  /**
  * Add Javascript - Mobile menu header top
  */
jQuery(document).ready(function($) {
  if ($(".header-top-area .sf-menu").length>0) {
    $("#header-top").addClass('js-header-top-mobile-menu-active');
  };
});
<file_sep>/docroot/modules/custom/ocms_linkchecker/src/OcmsLinkcheckerHttpInterface.php
<?php

namespace Drupal\ocms_linkchecker;

/**
 * Defines an interface for the Link http services.
 */
interface PupLinkcheckerHttpInterface {

  /**
   * Checks if a link is broken.
   *
   * @param object $link
   *   The fully loaded link to check.
   */
  public function checkLink($link);
}
<file_sep>/docroot/modules/custom/ocms_linkchecker/src/OcmsLinkcheckerStatusHandlingInterface.php
<?php

namespace Drupal\ocms_linkchecker;

/**
 * Defines an interface for the Link status handling services.
 */
interface PupLinkcheckerStatusHandlingInterface {

  /**
   * Reacts to the status code of a checked link.
   *
   * @param object $response
   *   An object containing the HTTP request headers, response code, headers,
   *   data and redirect status.
   * @param string $link
   *   An object containing the url, lid and fail_count.
   */
  public function handleStatus(&$response, $link);
}
<file_sep>/docroot/sites/settings.local.php
<?php

/**
 * @file
 * Local development override configuration feature.
 *
 * To activate this feature, copy and rename it such that its path plus
 * filename is 'sites/default/settings.local.php'. Then, go to the bottom of
 * 'sites/default/settings.php' and uncomment the commented lines that mention
 * 'settings.local.php'.
 *
 * If you are using a site name in the path, such as 'sites/example.com', copy
 * this file to 'sites/example.com/settings.local.php', and uncomment the lines
 * at the bottom of 'sites/example.com/settings.php'.
 */

assert_options(ASSERT_ACTIVE, TRUE);
\Drupal\Component\Assertion\Handle::register();

/**
 * Enable local development services.
 */
$settings['container_yamls'][] = DRUPAL_ROOT . '/sites/development.services.yml';

/**
 * Show all error messages, with backtrace information.
 *
 * In case the error level could not be fetched from the database, as for
 * example the database connection failed, we rely only on this value.
 */
$config['system.logging']['error_level'] = 'verbose';


$config_directories = array(
    CONFIG_SYNC_DIRECTORY => '../config',
);
$config_directories['vcs'] = '../config/';
/**
 * Disable CSS and JS aggregation.
 */
$config['system.performance']['css']['preprocess'] = FALSE;
$config['system.performance']['js']['preprocess'] = FALSE;

#$settings['extension_discovery_scan_tests'] = TRUE;

#$settings['rebuild_access'] = TRUE;

$settings['skip_permissions_hardening'] = TRUE;

// <DDSETTINGS>
// Please don't edit anything between <DDSETTINGS> tags.
// This section is autogenerated by Acquia Dev Desktop.
if (isset($_SERVER['DEVDESKTOP_DRUPAL_SETTINGS_DIR']) && file_exists($_SERVER['DEVDESKTOP_DRUPAL_SETTINGS_DIR'] . '/loc_dev_ocms_lamtech_sl_dd.inc')) {
  require $_SERVER['DEVDESKTOP_DRUPAL_SETTINGS_DIR'] . '/loc_dev_ocms_lamtech_sl_dd.inc';
}
// </DDSETTINGS>
<file_sep>/docroot/modules/custom/ocms_linkchecker/src/Controller/BrokenLinksReport.php
<?php

namespace Drupal\ocms_linkchecker\Controller;

use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\Database\Connection;
use Drupal\Core\Routing\RedirectDestinationInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\Core\StringTranslation\TranslationInterface;
use Drupal\ocms_linkchecker\PupLinkcheckerAccessInterface;
use Drupal\ocms_linkchecker\BrokenLinksTableTrait;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
 * Display a table of contents for the presentation
 */
class BrokenLinksReport extends ControllerBase {

  /**
   * Drupal's database service.
   *
   * @var \Drupal\Core\Database\Connection
   */
  protected $connection;

  /**
   * Drupal's translation service.
   *
   * @var \Drupal\Core\StringTranslation\TranslationInterface
   */
  protected $translation;

  /**
   * The config factory.
   *
   * @var \Drupal\Core\Config\ConfigFactoryInterface
   */
  protected $configFactory;

  /**
   * OCMS Linkchecker Access Service.
   *
   * @var \Drupal\ocms_linkchecker\PupLinkcheckerAccessInterface
   */
  protected $access;

  /**
   * The current user.
   *
   * @var \Drupal\Core\Session\AccountInterface
   */
  protected $currentUser;

  /**
   * The redirect destination service.
   *
   * @var \Drupal\Core\Routing\RedirectDestinationInterface
   */
  protected $redirectDestination;

  /**
   * The query ::build will use.
   *
   * @var
   */
  protected $query;

  /**
   * Response codes that should not be considered errors.
   *
   * @var array
   */
  protected $ignoreResponseCodes;

  /**
   * Constructs the broken links controller object.
   *
   * @param \Drupal\Core\Database\Connection
   *   The database connection
   * @param \Drupal\Core\StringTranslation\TranslationInterface
   *   The translation service
   * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
   *   The factory for configuration objects.
   * @param \Drupal\ocms_linkchecker\PupLinkcheckerAccessInterface
   *   The OCMS Linkchecker Access service
   * @param \Drupal\Core\Session\AccountInterface $current_user
   *   The current user.
   * @param \Drupal\Core\Routing\RedirectDestinationInterface
   */
  public function __construct(Connection $database, TranslationInterface $string_translation, ConfigFactoryInterface $config_factory, PupLinkcheckerAccessInterface $ocms_linkchecker_access, AccountInterface $current_user, RedirectDestinationInterface $redirect_destination) {
    $this->connection = $database;
    $this->translation = $string_translation;
    $this->configFactory = $config_factory;
    $this->access = $ocms_linkchecker_access;
    $this->currentUser = $current_user;
    $this->redirectDestination = $redirect_destination;

    $config = $this->configFactory->get('ocms_linkchecker.settings');
    $this->ignoreResponseCodes = preg_split('/(\r\n?|\n)/',
      $config->get('error.ignore_response_codes'));

    // Search for broken links in entities of all users.
    $subquery = $this->connection->select('ocms_linkchecker_entity', 'le')
      ->distinct()
      ->fields('le', array('lid'));

    // Build pager query.
    $query = $this->connection->select('ocms_linkchecker_link', 'll')
      ->extend('\Drupal\Core\Database\Query\PagerSelectExtender')
      ->extend('\Drupal\Core\Database\Query\TableSortExtender');
    $query->innerJoin($subquery, 'q2', 'q2.lid = ll.lid');
    $query->fields('ll');
    $query->condition('ll.last_checked', 0, '<>');
    $query->condition('ll.status', 1);
    $query->condition('ll.code', $this->ignoreResponseCodes, 'NOT IN');

    $this->query = $query;
  }

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container) {
    return new static(
      $container->get('database'),
      $container->get('string_translation'),
      $container->get('config.factory'),
      $container->get('ocms_linkchecker.access'),
      $container->get('current_user'),
      $container->get('redirect.destination')
    );
  }

  use BrokenLinksTableTrait;
}
<file_sep>/docroot/modules/custom/ocms_files/ocms_file_operations/src/Tests/SimpleTest/TestFileOperations.php
<?php

namespace Drupal\irs_file_operations\Tests\SimpleTest;

use Drupal\simpletest\WebTestBase;

/**
 * Test the existence of IRS File Operations module.
 *
 * @group irs_file_operations
 */
class TestFileOperations extends WebTestBase {

  /**
   * Modules to enable.
   *
   * @var array
   */
  public static $modules = array('irspup', 'irs_file_operations', 'toolbar', 'media_entity');
  protected $profile = 'testing';

  /**
   *
   * @var \Drupal\user\UserInterface
   */
  protected function setUp() {
    parent::setUp();
  }

  public function testMediaBundleCreation() {

    $directory = 'simpletestpup/ebook/';
    $source = DRUPAL_ROOT . '/media_unpublish/' . $directory;
    $destination = DRUPAL_ROOT . '/sites/default/files/' . $directory;

    $directory_created = file_prepare_directory($destination, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS);

    if ($directory_created) {
      $this->assertTrue($directory_created);

      $files = file_scan_directory($source, '/.*\.(txt|pdf|doc|docx)$/');

      if (!empty($files)) {
        foreach ($files as $file) {
          $result = file_unmanaged_copy($file->uri, $destination, FILE_EXISTS_REPLACE);
          $this->assertTrue($result, "File copied {$result}.");
        }
      }
      else {
        $this->assertTrue(!empty($files), "Files does not exist!");
      }
    }
    else {
      $this->assertTrue($directory_created, "Unable to create directory {$destination}.");
    }
  }

}
<file_sep>/docroot/modules/custom/ocms_linkchecker/src/Plugin/QueueWorker/OcmsLinkcheckerCheckLinks.php
<?php

namespace Drupal\ocms_linkchecker\Plugin\QueueWorker;

use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\Core\Queue\QueueWorkerBase;
use Drupal\ocms_linkchecker\PupLinkcheckerHttpInterface;
use Drupal\ocms_linkchecker\PupLinkcheckerUtilityInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
 * Updates the aquifer content types.
 *
 * @QueueWorker(
 *   id = "ocms_linkchecker_check_links",
 *   title = @Translation("Check for broken links"),
 *   cron = {"time" = 60}
 * )
 */
class PupLinkcheckerCheckLinks extends QueueWorkerBase implements ContainerFactoryPluginInterface {

  /**
   * The Http service
   * @var Drupal\ocms_linkchecker\PupLinkcheckerHttpInterface
   */
  protected $http;

  /**
   * OCMS Linkchecker Utility Service.
   *
   * @var \Drupal\ocms_linkchecker\PupLinkcheckerUtilityInterface
   */
  protected $utilityService;

  /**
   * The config factory.
   *
   * @var \Drupal\Core\Config\ConfigFactoryInterface
   */
  protected $configFactory;

  /**
   * Constructs the Queue Worker
   *
   * @param \Drupal\ocms_linkchecker\PupLinkcheckerHttpInterface $http
   *   The OCMS Linkchecker Http Service.
   * @param \Drupal\ocms_linkchecker\PupLinkcheckerUtilityInterface $ocms_linkchecker_utility
   *   The OCMS Linkchecker Utility Service.
   * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
   *   The factory for configuration objects.
   */
  public function __construct(PupLinkcheckerHttpInterface $http, PupLinkcheckerUtilityInterface $ocms_linkchecker_utility, ConfigFactoryInterface $config_factory) {
    $this->http = $http;
    $this->utilityService = $ocms_linkchecker_utility;
    $this->configFactory = $config_factory;
  }

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
    return new static(
      $container->get('ocms_linkchecker.http'),
      $container->get('ocms_linkchecker.utility'),
      $container->get('config.factory')
    );
  }

  /**
   * {@inheritdoc}
   */
  public function processItem($data) {
    $link = $this->utilityService->loadLink($data);
    if (is_object($link)) {
      $config = $this->configFactory->get('ocms_linkchecker.settings');
      // This link could appear in the queue more than one time if this
      // QueueWorker ran out of time on a previous cron run. If the link
      // is in the queue more than once and things run fast enough that
      // the QueueWorker is able to get to it again within a single cron
      // run, it would get processed in less time than was configured. So,
      // we double check that this link hasn't already been checked within the
      // configured interval on account of it being in the queue more than one
      // time.
      if ($link->last_checked < (REQUEST_TIME - $config->get('check.interval'))) {
        $this->http->checkLink($link);
      }
    }
  }

}
<file_sep>/docroot/modules/custom/ocms_files/ocms_file_operations/src/Tests/Unit/TestFileOperations.php
<?php

namespace Drupal\irs_file_operations\Tests\Unit;

use Drupal\Tests\UnitTestCase;


if (!defined('DRUPAL_ROOT')) {
  //Looping to find drupal root folder.
  $current_dir = dirname(__DIR__);
  while (!file_exists("$current_dir/index.php")) {
    $current_dir = dirname($current_dir);
  }
  define('DRUPAL_ROOT', $current_dir);
}

/**
 * Tests the Drupal 8 irspup module functionality
 *
 * @group irspup
 */
class TestFileOperations extends UnitTestCase {

  /**
   * Modules to install.
   *
   * @var array
   */
  public static $modules = array('irs_file_operations', 'irspup', 'toolbar');
  protected $profile = 'testing';

    /**
   * {@inheritdoc}
   */
  protected function setUp() {
    parent::setUp();
  }

/**
   * Tests creating a media bundle programmatically.
   */
  public function testMediaBundleCreation() {

    $directory = 'simpletestpup/ebook/';
    $source = DRUPAL_ROOT . '/media_unpublish/' . $directory;
    $destination = DRUPAL_ROOT . '/sites/default/files/' . $directory;
    
    $directory_created = false;
    if (!file_exists($destination)) {
      $directory_created = mkdir($destination, 0777, true);
    }

    $files = glob($source . "*.{pdf,txt,doc,docx}", GLOB_BRACE);

    if(!empty($files)) {
      foreach ($files as $file) {
        $file_name_array = explode("/", $file);
        $count = sizeof($file_name_array);
        $file_name = $file_name_array[$count - 1];
        $result = copy($file, $destination . $file_name); 
        $this->assertTrue($result,"File copied.");
      }
    }
    else {
      $this->assertTrue(!empty($files), "Files does not exist!");
	}
	
  }
  
} <file_sep>/docroot/modules/custom/ocms_files/ocms_file_operations/src/Controller/OcmsFileOperationsController.php
<?php

namespace Drupal\irs_file_operations\Controller;

use Drupal\Core\Controller\ControllerBase;
use Drupal\irspup\Utility\DescriptionTemplateTrait;

/**
 *  @file
 *  Controller for media_helper module.
 */
class IrsFileOperationsController extends ControllerBase {

  use DescriptionTemplateTrait;

  /**
   * Move file to destination
   */
 public function moveFileToDestination($fid, $destination) {
    $file_storage = \Drupal::entityManager()->getStorage('file');

    if (empty($destination)) {
      \Drupal::logger('irs_file_operations')->error($destination . 'Destination cannot be empty');
    }

    $file = $file_storage->load($fid);
    $file_uri = $file->get('uri')->value;
    $file_name = $file->get('filename')->value;
    $query = \Drupal::database()->update('file_managed');
 
    $query->fields([
      'uri' => $destination . $file_name,
    ]);
    
    $query->condition('fid', $fid);
    $query->execute();
    db_truncate('cache_entity')->execute();
    $file_prepare = file_prepare_directory($destination, FILE_CREATE_DIRECTORY);
    
    if ($file_prepare == FALSE) {
      \Drupal::logger('irs_file_operations')->error($file_prepare . 'Directory does not exist and it is not creted.');
    }
    $file_move = file_move($file, $destination, FILE_EXISTS_REPLACE);
    
    if ($file_move == FALSE) {
      \Drupal::logger('irs_file_operations')->error($file_move . 'File is not moved');
    }

    return drupal_flush_all_caches();
  }

  /**
   * Update location path based on folder repository field.
   */
  public function irsFileOperationsGetTax($termid) {
    $storage = \Drupal::service('entity_type.manager')->getStorage('taxonomy_term');
    $parents = $storage->loadAllParents($termid);
    $termname_result = '';
    foreach (array_reverse($parents) as $parent) {
      $termname = irs_file_operations_clean_string($parent->get('name')->value) . '/';
      $termname_result .= $termname;
    }
	// remove the last '/'
	$termname_result=substr_replace($termname_result, "", -1);
    return $termname_result;
  }

  /**
   * Returns URI for the Particular Media
   */
  public function irsFileOperationsUri($fid) {
    $query = \Drupal::database()->select('file_managed', 'fd');
    $query->addField('fd', 'uri');
    $query->condition('fd.fid', $fid);
    $query->range(0, 1);
    $location_path_value = $query->execute()->fetchField();
    return $location_path_value;
  }

  /**
   * {@inheritdoc}
   *
   * We override this so we can see some substitutions.
   */
  protected function getModuleName() {
    return 'irs_file_operations';
  }

}
<file_sep>/docroot/modules/custom/ocms_linkchecker/src/Plugin/QueueWorker/OcmsLinkcheckerAddNodeLinks.php
<?php

namespace Drupal\ocms_linkchecker\Plugin\QueueWorker;

use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\Core\Queue\QueueWorkerBase;
use Drupal\ocms_linkchecker\PupLinkcheckerDatabaseInterface;
use Drupal\ocms_linkchecker\PupLinkcheckerUtilityInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
 * Updates the aquifer content types.
 *
 * @QueueWorker(
 *   id = "ocms_linkchecker_scan_node",
 *   title = @Translation("Scan a node for links"),
 *   cron = {"time" = 60}
 * )
 */
class PupLinkcheckerAddNodeLinks extends QueueWorkerBase implements ContainerFactoryPluginInterface {

  /**
   * The Database service
   * @var Drupal\ocms_linkchecker\PupLinkcheckerDatabaseInterface
   */
  protected $database;

  /**
   * OCMS Linkchecker Utility Service.
   *
   * @var \Drupal\ocms_linkchecker\PupLinkcheckerUtilityInterface
   */
  protected $utilityService;

  /**
   * Constructs the Queue Worker
   *
   * @param \Drupal\ocms_linkchecker\PupLinkcheckerDatabaseInterface $database
   *   The OCMS Linkchecker Database Service.
   * @param \Drupal\ocms_linkchecker\PupLinkcheckerUtilityInterface $ocms_linkchecker_utility
   *   The OCMS Linkchecker Utility Service.
   */
  public function __construct(PupLinkcheckerDatabaseInterface $database, PupLinkcheckerUtilityInterface $ocms_linkchecker_utility) {
    $this->database = $database;
    $this->utilityService = $ocms_linkchecker_utility;
  }

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
    return new static(
      $container->get('ocms_linkchecker.database'),
      $container->get('ocms_linkchecker.utility')
    );
  }

  /**
   * {@inheritdoc}
   */
  public function processItem($data) {
    $node = $this->utilityService->loadEntity('node', $data);
    if (is_object($node)) {
      $this->database->addNodeLinks($node);
    }
  }

}
<file_sep>/docroot/modules/custom/ocms_files/ocms_file_operations/README.txt

/**
 *  @file
 *  README for the IRS File Operation.
 */

This module change the Drupal behaviour. Typical Drupal behavior is to rename files on upload to <filename>_0.<ext>
This module modifies that behavior.

1.0 - Behavior is as follows:
 If the same file exist in folder. replace the new file with older one.


################################################################################
USAGE
################################################################################

1.Enable the irs_file_operation module on the modules page.
2.Your done

#######################
Required Field:
#######################

    1. field_ocms_file_public_path
    2. field_document


How its works  
1) Login as a Admin or Media User
2) Click on Content Menu
3) Click on Media Tab.
4) Click on 'Add Media'
5) Select Folder Repository
5) Select Document to Upload file
6) Choose file and Hit Save and Publish
4) By default media is stored in the private folder when the media is unpublished. If the user published the media, it will move from private to public directory.
Also instead of renaming the file it will replace any existing file with the same name in the same directory.

<file_sep>/docroot/themes/custom/ocms_corporate/theme-settings.php
<?php

function ocms_corporate_form_system_theme_settings_alter(&$form, &$form_state) {

  $form['#attached']['library'][] = 'ocms_corporate/theme-settings';

  $form['mtt_settings'] = array(
    '#type' => 'fieldset',
    '#title' => t('MtT Theme Settings'),
    '#collapsible' => FALSE,
    '#collapsed' => FALSE,
  );

  $form['mtt_settings']['tabs'] = array(
    '#type' => 'vertical_tabs',
    '#default_tab' => 'basic_tab',
  );

  $form['mtt_settings']['basic_tab']['basic_settings'] = array(
    '#type' => 'details',
    '#title' => t('Basic Settings'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#group' => 'tabs',
  );

  $form['mtt_settings']['basic_tab']['basic_settings']['breadcrumb_separator'] = array(
    '#type' => 'textfield',
    '#title' => t('Breadcrumb separator'),
    '#description'   => t('Enter the class of the icon you want from the Font Awesome library e.g.: fa-angle-right. A list of the available classes is provided here: <a href="http://fortawesome.github.io/Font-Awesome/cheatsheet" target="_blank">http://fortawesome.github.io/Font-Awesome/cheatsheet</a>.'),
    '#default_value' => theme_get_setting('breadcrumb_separator', 'ocms_corporate'),
    '#size'          => 20,
    '#maxlength'     => 100,
  );

  $form['mtt_settings']['basic_tab']['basic_settings']['scrolltop'] = array(
      '#type' => 'fieldset',
      '#title' => t('Scroll to top'),
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
  );

  $form['mtt_settings']['basic_tab']['basic_settings']['scrolltop']['scrolltop_display'] = array(
    '#type' => 'checkbox',
    '#title' => t('Show scroll-to-top button'),
    '#description'   => t('Use the checkbox to enable or disable scroll-to-top button.'),
    '#default_value' => theme_get_setting('scrolltop_display', 'ocms_corporate'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );

  $form['mtt_settings']['basic_tab']['basic_settings']['scrolltop']['scrolltop_icon'] = array(
    '#type' => 'textfield',
    '#title' => t('Scroll To Top icon'),
    '#description'   => t('Enter the class of the icon you want from the Font Awesome library e.g.: fa-long-arrow-up. A list of the available classes is provided here: <a href="http://fortawesome.github.io/Font-Awesome/cheatsheet" target="_blank">http://fortawesome.github.io/Font-Awesome/cheatsheet</a>.'),
    '#default_value' => theme_get_setting('scrolltop_icon','ocms_corporate'),
    '#size'          => 20,
    '#maxlength'     => 100,
  );

  $form['mtt_settings']['looknfeel_tab']['looknfeel'] = array(
    '#type' => 'details',
    '#title' => t('Look\'n\'Feel'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#group' => 'tabs',
  );

  $form['mtt_settings']['looknfeel_tab']['looknfeel']['color_scheme'] = array(
    '#type' => 'select',
    '#title' => t('Color Schemes'),
    '#description'   => t('From the drop-down menu, select the color scheme you prefer.'),
    '#default_value' => theme_get_setting('color_scheme', 'ocms_corporate'),
    '#options' => array(
    'turqoise' => t('Turqoise (Default)'),
    'blue' => t('Blue'),
    'green' => t('Green'),
    'red' => t('Red'),
    'pink' => t('Pink'),
    'purple' => t('Purple'),
    'gray' => t('Gray'),
    'orange' => t('Orange'),
    'yellow' => t('Yellow'),
    'night-blue' => t('Night Blue'),
    ),
  );

  $form['mtt_settings']['looknfeel_tab']['looknfeel']['form_style'] = array(
    '#type' => 'select',
    '#title' => t('Form styles of contact page'),
    '#description'   => t('From the drop-down menu, select the form style that you prefer.'),
    '#default_value' => theme_get_setting('form_style', 'ocms_corporate'),
    '#options' => array(
    'form-style-1' => t('Style-1 (default)'),
    'form-style-2' => t('Style-2'),
    ),
  );

  $form['mtt_settings']['regions_tab']['regions'] = array(
    '#type' => 'details',
    '#title' => t('Region settings'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#group' => 'tabs',
  );

  $form['mtt_settings']['regions_tab']['regions']['animations_state'] = array(
    '#type' => 'checkbox',
    '#title' => t('Animations'),
    '#description'   => t('Enable or disable animations globally. You can further adjust this for individual regions below.'),
    '#default_value' => theme_get_setting('animations_state', 'ocms_corporate'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );

  $form['mtt_settings']['regions_tab']['regions']['header'] = array(
      '#type' => 'fieldset',
      '#title' => t('Header'),
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
  );

  $form['mtt_settings']['regions_tab']['regions']['header']['header_layout_container'] = array(
    '#type' => 'select',
    '#title' => t('Container'),
    '#description'   => t('From the drop-down menu, select the layout mode you prefer.'),
    '#default_value' => theme_get_setting('header_layout_container', 'ocms_corporate'),
    '#options' => array(
    'container-fluid' => t('Full Width'),
    'container' => t('Fixed Width'),
    ),
  );

  $form['mtt_settings']['regions_tab']['regions']['header']['fixed_header'] = array(
    '#type' => 'checkbox',
    '#title' => t('Fixed Header'),
    '#description'   => t('Use the checkbox to apply fixed position to the header.'),
    '#default_value' => theme_get_setting('fixed_header', 'ocms_corporate'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );

  $form['mtt_settings']['regions_tab']['regions']['content_top'] = array(
      '#type' => 'fieldset',
      '#title' => t('Content Top'),
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
  );

  $form['mtt_settings']['regions_tab']['regions']['content_top']['content_top_layout_container'] = array(
    '#type' => 'select',
    '#title' => t('Layout Mode'),
    '#description'   => t('From the drop-down menu, select the layout mode you prefer.'),
    '#default_value' => theme_get_setting('content_top_layout_container', 'ocms_corporate'),
    '#options' => array(
      'container-fluid' => t('Full Width'),
      'container' => t('Fixed Width'),
    ),
  );

  $form['mtt_settings']['regions_tab']['regions']['content_top']['content_top_background_color'] = array(
    '#type' => 'select',
    '#title' => t('Background Color'),
    '#description'   => t('From the drop-down menu, select the background color you prefer.'),
    '#default_value' => theme_get_setting('content_top_background_color', 'ocms_corporate'),
    '#options' => array(
    'white-region' => t('White'),
    'light-gray-region' => t('Light Gray'),
    'colored-region' => t('Colored'),
    'colored-region dark' => t('Dark'),
    ),
  );

  $form['mtt_settings']['regions_tab']['regions']['content_top']['content_top_animation_effect'] = array(
    '#type' => 'select',
    '#title' => t('Animation Effect'),
    '#description'   => t('From the drop-down menu, select the animation effect you prefer.'),
    '#default_value' => theme_get_setting('content_top_animation_effect', 'ocms_corporate'),
    '#options' => array(
    'no-animation' => t('None'),
    'fadeIn' => t('Fade In'),
    'fadeInDown' => t('Fade In Down'),
    'fadeInUp' => t('Fade In Up'),
    'fadeInLeft' => t('Fade In Left'),
    'fadeInRight' => t('Fade In Right'),
    ),
  );

  $form['mtt_settings']['regions_tab']['regions']['main_content'] = array(
      '#type' => 'fieldset',
      '#title' => t('Main Content'),
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
  );

  $form['mtt_settings']['regions_tab']['regions']['main_content']['main_content_animation_effect'] = array(
    '#type' => 'select',
    '#title' => t('Animation Effect'),
    '#description'   => t('From the drop-down menu, select the animation effect you prefer.'),
    '#default_value' => theme_get_setting('main_content_animation_effect', 'ocms_corporate'),
    '#options' => array(
    'no-animation' => t('None'),
    'fadeIn' => t('Fade In'),
    'fadeInDown' => t('Fade In Down'),
    'fadeInUp' => t('Fade In Up'),
    'fadeInLeft' => t('Fade In Left'),
    'fadeInRight' => t('Fade In Right'),
    ),
  );

  $form['mtt_settings']['regions_tab']['regions']['sidebar_first'] = array(
      '#type' => 'fieldset',
      '#title' => t('Sidebar First'),
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
  );

  $form['mtt_settings']['regions_tab']['regions']['sidebar_first']['sidebar_first_animation_effect'] = array(
    '#type' => 'select',
    '#title' => t('Animation Effect'),
    '#description'   => t('From the drop-down menu, select the animation effect you prefer.'),
    '#default_value' => theme_get_setting('sidebar_first_animation_effect', 'ocms_corporate'),
    '#options' => array(
    'no-animation' => t('None'),
    'fadeIn' => t('Fade In'),
    'fadeInDown' => t('Fade In Down'),
    'fadeInUp' => t('Fade In Up'),
    'fadeInLeft' => t('Fade In Left'),
    'fadeInRight' => t('Fade In Right'),
    ),
  );

  $form['mtt_settings']['regions_tab']['regions']['sidebar_second'] = array(
      '#type' => 'fieldset',
      '#title' => t('Sidebar Second'),
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
  );

  $form['mtt_settings']['regions_tab']['regions']['sidebar_second']['sidebar_second_animation_effect'] = array(
    '#type' => 'select',
    '#title' => t('Animation Effect'),
    '#description'   => t('From the drop-down menu, select the animation effect you prefer.'),
    '#default_value' => theme_get_setting('sidebar_second_animation_effect', 'ocms_corporate'),
    '#options' => array(
    'no-animation' => t('None'),
    'fadeIn' => t('Fade In'),
    'fadeInDown' => t('Fade In Down'),
    'fadeInUp' => t('Fade In Up'),
    'fadeInLeft' => t('Fade In Left'),
    'fadeInRight' => t('Fade In Right'),
    ),
  );

  $form['mtt_settings']['regions_tab']['regions']['content_bottom'] = array(
      '#type' => 'fieldset',
      '#title' => t('Content Bottom'),
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
  );

  $form['mtt_settings']['regions_tab']['regions']['content_bottom']['content_bottom_background_color'] = array(
    '#type' => 'select',
    '#title' => t('Background Color'),
    '#description'   => t('From the drop-down menu, select the background color you prefer.'),
    '#default_value' => theme_get_setting('content_bottom_background_color', 'ocms_corporate'),
    '#options' => array(
    'white-region' => t('White'),
    'light-gray-region' => t('Light Gray'),
    'colored-region' => t('Colored'),
    'colored-region dark' => t('Dark'),
    ),
  );

  $form['mtt_settings']['regions_tab']['regions']['content_bottom']['content_bottom_animation_effect'] = array(
    '#type' => 'select',
    '#title' => t('Animation Effect'),
    '#description'   => t('From the drop-down menu, select the animation effect you prefer.'),
    '#default_value' => theme_get_setting('content_bottom_animation_effect', 'ocms_corporate'),
    '#options' => array(
    'no-animation' => t('None'),
    'fadeIn' => t('Fade In'),
    'fadeInDown' => t('Fade In Down'),
    'fadeInUp' => t('Fade In Up'),
    'fadeInLeft' => t('Fade In Left'),
    'fadeInRight' => t('Fade In Right'),
    ),
  );

  $form['mtt_settings']['regions_tab']['regions']['featured_top'] = array(
      '#type' => 'fieldset',
      '#title' => t('Featured Top'),
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
  );

  $form['mtt_settings']['regions_tab']['regions']['featured_top']['featured_top_layout_container'] = array(
    '#type' => 'select',
    '#title' => t('Layout Mode'),
    '#description'   => t('From the drop-down menu, select the layout mode you prefer.'),
    '#default_value' => theme_get_setting('featured_top_layout_container', 'ocms_corporate'),
    '#options' => array(
      'container-fluid' => t('Full Width'),
      'container' => t('Fixed Width'),
    ),
  );

  $form['mtt_settings']['regions_tab']['regions']['featured_top']['featured_top_background_color'] = array(
    '#type' => 'select',
    '#title' => t('Background Color'),
    '#description'   => t('From the drop-down menu, select the background color you prefer.'),
    '#default_value' => theme_get_setting('featured_top_background_color', 'ocms_corporate'),
    '#options' => array(
    'white-region' => t('White'),
    'light-gray-region' => t('Light Gray'),
    'colored-region' => t('Colored'),
    'colored-region dark' => t('Dark'),
    ),
  );

  $form['mtt_settings']['regions_tab']['regions']['featured_top']['featured_top_animation_effect'] = array(
    '#type' => 'select',
    '#title' => t('Animation Effect'),
    '#description'   => t('From the drop-down menu, select the animation effect you prefer.'),
    '#default_value' => theme_get_setting('featured_top_animation_effect', 'ocms_corporate'),
    '#options' => array(
    'no-animation' => t('None'),
    'fadeIn' => t('Fade In'),
    'fadeInDown' => t('Fade In Down'),
    'fadeInUp' => t('Fade In Up'),
    'fadeInLeft' => t('Fade In Left'),
    'fadeInRight' => t('Fade In Right'),
    ),
  );

  $form['mtt_settings']['regions_tab']['regions']['featured'] = array(
      '#type' => 'fieldset',
      '#title' => t('Featured'),
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
  );

  $form['mtt_settings']['regions_tab']['regions']['featured']['featured_layout_container'] = array(
    '#type' => 'select',
    '#title' => t('Layout Mode'),
    '#description'   => t('From the drop-down menu, select the layout mode you prefer.'),
    '#default_value' => theme_get_setting('featured_layout_container', 'ocms_corporate'),
    '#options' => array(
      'container-fluid' => t('Full Width'),
      'container' => t('Fixed Width'),
    ),
  );

  $form['mtt_settings']['regions_tab']['regions']['featured']['featured_background_color'] = array(
    '#type' => 'select',
    '#title' => t('Background Color'),
    '#description'   => t('From the drop-down menu, select the background color you prefer.'),
    '#default_value' => theme_get_setting('featured_background_color', 'ocms_corporate'),
    '#options' => array(
    'white-region' => t('White'),
    'light-gray-region' => t('Light Gray'),
    'colored-region' => t('Colored'),
    'colored-region dark' => t('Dark'),
    ),
  );

  $form['mtt_settings']['regions_tab']['regions']['featured']['featured_animation_effect'] = array(
    '#type' => 'select',
    '#title' => t('Animation Effect'),
    '#description'   => t('From the drop-down menu, select the animation effect you prefer.'),
    '#default_value' => theme_get_setting('featured_animation_effect', 'ocms_corporate'),
    '#options' => array(
    'no-animation' => t('None'),
    'fadeIn' => t('Fade In'),
    'fadeInDown' => t('Fade In Down'),
    'fadeInUp' => t('Fade In Up'),
    'fadeInLeft' => t('Fade In Left'),
    'fadeInRight' => t('Fade In Right'),
    ),
  );

  $form['mtt_settings']['regions_tab']['regions']['featured_bottom'] = array(
      '#type' => 'fieldset',
      '#title' => t('Featured Bottom'),
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
  );

  $form['mtt_settings']['regions_tab']['regions']['featured_bottom']['featured_bottom_layout_container'] = array(
    '#type' => 'select',
    '#title' => t('Layout Mode'),
    '#description'   => t('From the drop-down menu, select the layout mode you prefer.'),
    '#default_value' => theme_get_setting('featured_bottom_layout_container', 'ocms_corporate'),
    '#options' => array(
      'container-fluid' => t('Full Width'),
      'container' => t('Fixed Width'),
    ),
  );

  $form['mtt_settings']['regions_tab']['regions']['featured_bottom']['featured_bottom_background_color'] = array(
    '#type' => 'select',
    '#title' => t('Background Color'),
    '#description'   => t('From the drop-down menu, select the background color you prefer.'),
    '#default_value' => theme_get_setting('featured_bottom_background_color', 'ocms_corporate'),
    '#options' => array(
    'white-region' => t('White'),
    'light-gray-region' => t('Light Gray'),
    'colored-region' => t('Colored'),
    'colored-region dark' => t('Dark'),
    ),
  );

  $form['mtt_settings']['regions_tab']['regions']['featured_bottom']['featured_bottom_animation_effect'] = array(
    '#type' => 'select',
    '#title' => t('Animation Effect'),
    '#description'   => t('From the drop-down menu, select the animation effect you prefer.'),
    '#default_value' => theme_get_setting('featured_bottom_animation_effect', 'ocms_corporate'),
    '#options' => array(
    'no-animation' => t('None'),
    'fadeIn' => t('Fade In'),
    'fadeInDown' => t('Fade In Down'),
    'fadeInUp' => t('Fade In Up'),
    'fadeInLeft' => t('Fade In Left'),
    'fadeInRight' => t('Fade In Right'),
    ),
  );

  $form['mtt_settings']['regions_tab']['regions']['highlighted'] = array(
      '#type' => 'fieldset',
      '#title' => t('Highlighted'),
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
  );

  $form['mtt_settings']['regions_tab']['regions']['highlighted']['highlighted_layout_container'] = array(
    '#type' => 'select',
    '#title' => t('Layout Mode'),
    '#description'   => t('From the drop-down menu, select the layout mode you prefer.'),
    '#default_value' => theme_get_setting('highlighted_layout_container', 'ocms_corporate'),
    '#options' => array(
      'container-fluid' => t('Full Width'),
      'container' => t('Fixed Width'),
    ),
  );

  $form['mtt_settings']['regions_tab']['regions']['highlighted']['highlighted_background_color'] = array(
    '#type' => 'select',
    '#title' => t('Background Color'),
    '#description'   => t('From the drop-down menu, select the background color you prefer.'),
    '#default_value' => theme_get_setting('highlighted_background_color', 'ocms_corporate'),
    '#options' => array(
    'white-region' => t('White'),
    'light-gray-region' => t('Light Gray'),
    'colored-region' => t('Colored'),
    'colored-region dark' => t('Dark'),
    ),
  );

  $form['mtt_settings']['regions_tab']['regions']['highlighted']['highlighted_animation_effect'] = array(
    '#type' => 'select',
    '#title' => t('Animation Effect'),
    '#description'   => t('From the drop-down menu, select the animation effect you prefer.'),
    '#default_value' => theme_get_setting('highlighted_animation_effect', 'ocms_corporate'),
    '#options' => array(
    'no-animation' => t('None'),
    'fadeIn' => t('Fade In'),
    'fadeInDown' => t('Fade In Down'),
    'fadeInUp' => t('Fade In Up'),
    'fadeInLeft' => t('Fade In Left'),
    'fadeInRight' => t('Fade In Right'),
    ),
  );

  $form['mtt_settings']['regions_tab']['regions']['highlighted_bottom'] = array(
      '#type' => 'fieldset',
      '#title' => t('Highlighted Bottom'),
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
  );

  $form['mtt_settings']['regions_tab']['regions']['highlighted_bottom']['highlighted_bottom_layout_container'] = array(
    '#type' => 'select',
    '#title' => t('Layout Mode'),
    '#description'   => t('From the drop-down menu, select the layout mode you prefer.'),
    '#default_value' => theme_get_setting('highlighted_bottom_layout_container', 'ocms_corporate'),
    '#options' => array(
      'container-fluid' => t('Full Width'),
      'container' => t('Fixed Width'),
    ),
  );

  $form['mtt_settings']['regions_tab']['regions']['highlighted_bottom']['highlighted_bottom_background_color'] = array(
    '#type' => 'select',
    '#title' => t('Background Color'),
    '#description'   => t('From the drop-down menu, select the background color you prefer.'),
    '#default_value' => theme_get_setting('highlighted_bottom_background_color', 'ocms_corporate'),
    '#options' => array(
    'white-region' => t('White'),
    'light-gray-region' => t('Light Gray'),
    'colored-region' => t('Colored'),
    'colored-region dark' => t('Dark'),
    ),
  );

  $form['mtt_settings']['regions_tab']['regions']['highlighted_bottom']['highlighted_bottom_animation_effect'] = array(
    '#type' => 'select',
    '#title' => t('Animation Effect'),
    '#description'   => t('From the drop-down menu, select the animation effect you prefer.'),
    '#default_value' => theme_get_setting('highlighted_bottom_animation_effect', 'ocms_corporate'),
    '#options' => array(
    'no-animation' => t('None'),
    'fadeIn' => t('Fade In'),
    'fadeInDown' => t('Fade In Down'),
    'fadeInUp' => t('Fade In Up'),
    'fadeInLeft' => t('Fade In Left'),
    'fadeInRight' => t('Fade In Right'),
    ),
  );

  $form['mtt_settings']['regions_tab']['regions']['footer_top'] = array(
      '#type' => 'fieldset',
      '#title' => t('Footer Top'),
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
  );

  $form['mtt_settings']['regions_tab']['regions']['footer_top']['footer_top_background_color'] = array(
    '#type' => 'select',
    '#title' => t('Background Color'),
    '#description'   => t('From the drop-down menu, select the background color you prefer.'),
    '#default_value' => theme_get_setting('footer_top_background_color', 'ocms_corporate'),
    '#options' => array(
    'white-region' => t('White'),
    'light-gray-region' => t('Light Gray'),
    'colored-region' => t('Colored'),
    'colored-region dark' => t('Dark'),
    'bicolor' => t('Bicolor'),
    ),
  );

  $form['mtt_settings']['regions_tab']['regions']['footer_top']['footer_top_animation_effect'] = array(
    '#type' => 'select',
    '#title' => t('Animation Effect'),
    '#description'   => t('From the drop-down menu, select the animation effect you prefer.'),
    '#default_value' => theme_get_setting('footer_top_animation_effect', 'ocms_corporate'),
    '#options' => array(
    'no-animation' => t('None'),
    'fadeIn' => t('Fade In'),
    'fadeInDown' => t('Fade In Down'),
    'fadeInUp' => t('Fade In Up'),
    'fadeInLeft' => t('Fade In Left'),
    'fadeInRight' => t('Fade In Right'),
    ),
  );

  $form['mtt_settings']['regions_tab']['regions']['footer'] = array(
      '#type' => 'fieldset',
      '#title' => t('Footer'),
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
  );

  $form['mtt_settings']['regions_tab']['regions']['footer']['footer_layout_container'] = array(
    '#type' => 'select',
    '#title' => t('Layout Mode'),
    '#description'   => t('From the drop-down menu, select the layout mode you prefer.'),
    '#default_value' => theme_get_setting('footer_layout_container', 'ocms_corporate'),
    '#options' => array(
      'container-fluid' => t('Full Width'),
      'container' => t('Fixed Width'),
    ),
  );

  $form['mtt_settings']['regions_tab']['regions']['footer']['footer_background_color'] = array(
    '#type' => 'select',
    '#title' => t('Background Color'),
    '#description'   => t('From the drop-down menu, select the background color you prefer.'),
    '#default_value' => theme_get_setting('footer_background_color', 'ocms_corporate'),
    '#options' => array(
    'white-region' => t('White'),
    'light-gray-region' => t('Light Gray'),
    'colored-region' => t('Colored'),
    'colored-region dark' => t('Dark'),
    ),
  );

  $form['mtt_settings']['regions_tab']['regions']['footer']['footer_animation_effect'] = array(
    '#type' => 'select',
    '#title' => t('Animation Effect'),
    '#description'   => t('From the drop-down menu, select the animation effect you prefer.'),
    '#default_value' => theme_get_setting('footer_animation_effect', 'ocms_corporate'),
    '#options' => array(
    'no-animation' => t('None'),
    'fadeIn' => t('Fade In'),
    'fadeInDown' => t('Fade In Down'),
    'fadeInUp' => t('Fade In Up'),
    'fadeInLeft' => t('Fade In Left'),
    'fadeInRight' => t('Fade In Right'),
    ),
  );

  $form['mtt_settings']['regions_tab']['regions']['subfooter'] = array(
      '#type' => 'fieldset',
      '#title' => t('Subfooter'),
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
  );

  $form['mtt_settings']['regions_tab']['regions']['subfooter']['subfooter_layout_container'] = array(
    '#type' => 'select',
    '#title' => t('Layout Mode'),
    '#description'   => t('From the drop-down menu, select the layout mode you prefer.'),
    '#default_value' => theme_get_setting('subfooter_layout_container', 'ocms_corporate'),
    '#options' => array(
      'container-fluid' => t('Full Width'),
      'container' => t('Fixed Width'),
    ),
  );

  $form['mtt_settings']['regions_tab']['regions']['subfooter']['subfooter_background_color'] = array(
    '#type' => 'select',
    '#title' => t('Background Color'),
    '#description'   => t('From the drop-down menu, select the background color you prefer.'),
    '#default_value' => theme_get_setting('subfooter_background_color', 'ocms_corporate'),
    '#options' => array(
    'white-region' => t('White'),
    'light-gray-region' => t('Light Gray'),
    'colored-region' => t('Colored'),
    'colored-region dark' => t('Dark'),
    ),
  );

  $form['mtt_settings']['post_tab']['post'] = array(
    '#type' => 'details',
    '#title' => t('Post'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#group' => 'tabs',
  );

  $form['mtt_settings']['post_tab']['post']['reading_time'] = array(
    '#type' => 'checkbox',
    '#title' => t('Time to read'),
    '#description'   => t('Use the checkbox to enable or disable the "Time to read" indicator.'),
    '#default_value' => theme_get_setting('reading_time', 'ocms_corporate'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );

  $form['mtt_settings']['post_tab']['post']['post_progress'] = array(
    '#type' => 'checkbox',
    '#title' => t('Read so far'),
    '#description'   => t('Use the checkbox to enable or disable the reading progress indicator.'),
    '#default_value' => theme_get_setting('post_progress', 'ocms_corporate'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );

  $form['mtt_settings']['post_tab']['post']['affix'] = array(
    '#type' => 'fieldset',
    '#title' => t('Affix configuration'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#description'   => t('If you add or remove blocks from the header please change the corresponding values bellow to make the affix implementation work as expected.'),
  );

  $form['mtt_settings']['post_tab']['post']['affix']['affix_admin_height'] = array(
    '#type' => 'textfield',
    '#title' => t('Admin toolbar height (px)'),
    '#default_value' => theme_get_setting('affix_admin_height', 'ocms_corporate'),
    '#description'   => t('The height of the admin toolbar in pixels'),
  );

  $form['mtt_settings']['post_tab']['post']['affix']['affix_fixedHeader_height'] = array(
    '#type' => 'textfield',
    '#title' => t('Fixed header height (px)'),
    '#default_value' => theme_get_setting('affix_fixedHeader_height', 'ocms_corporate'),
    '#description'   => t('The height of the header when fixed at the top of the window in pixels'),
  );

  $form['mtt_settings']['layout_tab']['layout_modes'] = array(
      '#type' => 'details',
      '#title' => t('Theme Layout'),
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
      '#group' => 'tabs',
  );

  $form['mtt_settings']['layout_tab']['layout_modes']['layout_mode'] = array(
    '#type' => 'select',
    '#title' => t('Global Layout Mode'),
    '#description'   => t('From the drop-down menu, select the layout mode you prefer. This global setting overrides the individual region-specific layout settings.'),
    '#default_value' => theme_get_setting('layout_mode', 'ocms_corporate'),
    '#options' => array(
      'wide' => t('Wide'),
      'boxed' => t('Boxed'),
    ),
  );

  $form['mtt_settings']['font_tab']['font'] = array(
    '#type' => 'details',
    '#title' => t('Font Settings'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#group' => 'tabs',
  );

  $form['mtt_settings']['font_tab']['font']['font_title'] = array(
    '#type' => 'item',
    '#markup' => 'For every region pick the <strong>font-family</strong> that corresponds to your needs.',
  );

  $form['mtt_settings']['font_tab']['font']['sitename_font_family'] = array(
    '#type' => 'select',
    '#title' => t('Site name'),
    '#default_value' => theme_get_setting('sitename_font_family', 'ocms_corporate'),
    '#options' => array(
      'sff-31' => t('Alegreya SC, Georgia, Times, Times New Roman, Serif'),
      'sff-25' => t('Alegreya, Georgia, Times, Times New Roman, Serif'),
      'sff-40' => t('Archivo Narrow, Arial, Helvetica Neue, Sans-serif'),
      'sff-42' => t('Arimo, Arial, Helvetica Neue, Sans-serif'),
      'sff-19' => t('Cabin, Helvetica Neue, Arial, Sans-serif'),
      'sff-16' => t('Cinzel, Georgia, Times, Serif'),
      'sff-27' => t('Crimson Text, Georgia, Times, Times New Roman, Serif'),
      'sff-22' => t('Droid Serif, Georgia, Times, Times New Roman, Serif'),
      'sff-09' => t('Exo, Arial, Helvetica Neue, Sans-serif'),
      'sff-33' => t('Fira Sans, Arial, Helvetica Neue, Sans-serif'),
      'sff-28' => t('Gentium Book Basic, Georgia, Times, Times New Roman, Serif'),
      'sff-13' => t('Georgia, Times, Serif'),
      'sff-21' => t('Helvetica Neue, Arial, Sans-serif'),
      'sff-12' => t('Josefin Sans, Georgia, Times, Serif'),
      'sff-36' => t('Julius Sans One, Arial, Helvetica Neue, Sans-serif'),
      'sff-07' => t('Lato, Helvetica Neue, Arial, Sans-serif'),
      'sff-34' => t('Lora, Georgia, Times, Times New Roman, Serif'),
      'sff-01' => t('Merriweather, Georgia, Times, Serif'),
      'sff-32' => t('Montserrat SC, Arial, Helvetica Neue, Sans-serif'),
      'sff-20' => t('Noto Sans, Arial, Helvetica Neue, Sans-serif'),
      'sff-26' => t('Noto Serif, Georgia, Times, Times New Roman, Serif'),
      'sff-38' => t('Open Sans Condensed, Arial, Helvetica Neue, Sans-serif'),
      'sff-06' => t('Open Sans, Helvetica Neue, Arial, Sans-serif'),
      'sff-17' => t('Oswald, Helvetica Neue, Arial, Sans-serif'),
      'sff-15' => t('Philosopher, Georgia, Times, Serif'),
      'sff-18' => t('Playfair Display SC, Georgia, Times, Serif'),
      'sff-14' => t('Playfair Display, Times, Serif'),
      'sff-39' => t('PT Sans Narrow, Arial, Helvetica Neue, Sans-serif'),
      'sff-04' => t('PT Sans, Helvetica Neue, Arial, Sans-serif'),
      'sff-23' => t('PT Serif, Georgia, Times, Times New Roman, Serif'),
      'sff-35' => t('Quattrocento Sans, Arial, Helvetica Neue, Sans-serif'),
      'sff-11' => t('Raleway, Helvetica Neue, Arial, Sans-serif'),
      'sff-08' => t('Roboto Condensed, Arial Narrow, Arial, Sans-serif'),
      'sff-10' => t('Roboto Slab, Trebuchet MS, Sans-serif'),
      'sff-05' => t('Roboto, Helvetica Neue, Arial, Sans-serif'),
      'sff-02' => t('Source Sans Pro, Helvetica Neue, Arial, Sans-serif'),
      'sff-30' => t('Times, Times New Roman, Serif'),
      'sff-41' => t('Ubuntu Condensed, Arial, Helvetica Neue, Sans-serif'),
      'sff-03' => t('Ubuntu, Helvetica Neue, Arial, Sans-serif'),
      'sff-29' => t('Volkhov, Georgia, Times, Times New Roman, Serif'),
      'sff-24' => t('Vollkorn, Georgia, Times, Times New Roman, Serif'),
      'sff-37' => t('Work Sans, Arial, Helvetica Neue, Sans-serif'),
    ),
  );

  $form['mtt_settings']['font_tab']['font']['slogan_font_family'] = array(
    '#type' => 'select',
    '#title' => t('Slogan'),
    '#default_value' => theme_get_setting('slogan_font_family', 'ocms_corporate'),
    '#options' => array(
      'slff-31' => t('Alegreya SC, Georgia, Times, Times New Roman, Serif'),
      'slff-25' => t('Alegreya, Georgia, Times, Times New Roman, Serif'),
      'slff-40' => t('Archivo Narrow, Arial, Helvetica Neue, Sans-serif'),
      'slff-42' => t('Arimo, Arial, Helvetica Neue, Sans-serif'),
      'slff-19' => t('Cabin, Helvetica Neue, Arial, Sans-serif'),
      'slff-16' => t('Cinzel, Georgia, Times, Serif'),
      'slff-27' => t('Crimson Text, Georgia, Times, Times New Roman, Serif'),
      'slff-22' => t('Droid Serif, Georgia, Times, Times New Roman, Serif'),
      'slff-09' => t('Exo, Arial, Helvetica Neue, Sans-serif'),
      'slff-33' => t('Fira Sans, Arial, Helvetica Neue, Sans-serif'),
      'slff-28' => t('Gentium Book Basic, Georgia, Times, Times New Roman, Serif'),
      'slff-13' => t('Georgia, Times, Serif'),
      'slff-21' => t('Helvetica Neue, Arial, Sans-serif'),
      'slff-12' => t('Josefin Sans, Georgia, Times, Serif'),
      'slff-36' => t('Julius Sans One, Arial, Helvetica Neue, Sans-serif'),
      'slff-07' => t('Lato, Helvetica Neue, Arial, Sans-serif'),
      'slff-34' => t('Lora, Georgia, Times, Times New Roman, Serif'),
      'slff-01' => t('Merriweather, Georgia, Times, Serif'),
      'slff-32' => t('Montserrat SC, Arial, Helvetica Neue, Sans-serif'),
      'slff-20' => t('Noto Sans, Arial, Helvetica Neue, Sans-serif'),
      'slff-26' => t('Noto Serif, Georgia, Times, Times New Roman, Serif'),
      'slff-38' => t('Open Sans Condensed, Arial, Helvetica Neue, Sans-serif'),
      'slff-06' => t('Open Sans, Helvetica Neue, Arial, Sans-serif'),
      'slff-17' => t('Oswald, Helvetica Neue, Arial, Sans-serif'),
      'slff-15' => t('Philosopher, Georgia, Times, Serif'),
      'slff-18' => t('Playfair Display SC, Georgia, Times, Serif'),
      'slff-14' => t('Playfair Display, Times, Serif'),
      'slff-39' => t('PT Sans Narrow, Arial, Helvetica Neue, Sans-serif'),
      'slff-04' => t('PT Sans, Helvetica Neue, Arial, Sans-serif'),
      'slff-23' => t('PT Serif, Georgia, Times, Times New Roman, Serif'),
      'slff-35' => t('Quattrocento Sans, Arial, Helvetica Neue, Sans-serif'),
      'slff-11' => t('Raleway, Helvetica Neue, Arial, Sans-serif'),
      'slff-08' => t('Roboto Condensed, Arial Narrow, Arial, Sans-serif'),
      'slff-10' => t('Roboto Slab, Trebuchet MS, Sans-serif'),
      'slff-05' => t('Roboto, Helvetica Neue, Arial, Sans-serif'),
      'slff-02' => t('Source Sans Pro, Helvetica Neue, Arial, Sans-serif'),
      'slff-30' => t('Times, Times New Roman, Serif'),
      'slff-41' => t('Ubuntu Condensed, Arial, Helvetica Neue, Sans-serif'),
      'slff-03' => t('Ubuntu, Helvetica Neue, Arial, Sans-serif'),
      'slff-29' => t('Volkhov, Georgia, Times, Times New Roman, Serif'),
      'slff-24' => t('Vollkorn, Georgia, Times, Times New Roman, Serif'),
      'slff-37' => t('Work Sans, Arial, Helvetica Neue, Sans-serif'),
    ),
  );

  $form['mtt_settings']['font_tab']['font']['headings_font_family'] = array(
    '#type' => 'select',
    '#title' => t('Headings'),
    '#default_value' => theme_get_setting('headings_font_family', 'ocms_corporate'),
    '#options' => array(
      'hff-31' => t('Alegreya SC, Georgia, Times, Times New Roman, Serif'),
      'hff-25' => t('Alegreya, Georgia, Times, Times New Roman, Serif'),
      'hff-40' => t('Archivo Narrow, Arial, Helvetica Neue, Sans-serif'),
      'hff-42' => t('Arimo, Arial, Helvetica Neue, Sans-serif'),
      'hff-19' => t('Cabin, Helvetica Neue, Arial, Sans-serif'),
      'hff-16' => t('Cinzel, Georgia, Times, Serif'),
      'hff-27' => t('Crimson Text, Georgia, Times, Times New Roman, Serif'),
      'hff-22' => t('Droid Serif, Georgia, Times, Times New Roman, Serif'),
      'hff-09' => t('Exo, Arial, Helvetica Neue, Sans-serif'),
      'hff-33' => t('Fira Sans, Arial, Helvetica Neue, Sans-serif'),
      'hff-28' => t('Gentium Book Basic, Georgia, Times, Times New Roman, Serif'),
      'hff-13' => t('Georgia, Times, Serif'),
      'hff-21' => t('Helvetica Neue, Arial, Sans-serif'),
      'hff-12' => t('Josefin Sans, Georgia, Times, Serif'),
      'hff-36' => t('Julius Sans One, Arial, Helvetica Neue, Sans-serif'),
      'hff-07' => t('Lato, Helvetica Neue, Arial, Sans-serif'),
      'hff-34' => t('Lora, Georgia, Times, Times New Roman, Serif'),
      'hff-01' => t('Merriweather, Georgia, Times, Serif'),
      'hff-32' => t('Montserrat SC, Arial, Helvetica Neue, Sans-serif'),
      'hff-20' => t('Noto Sans, Arial, Helvetica Neue, Sans-serif'),
      'hff-26' => t('Noto Serif, Georgia, Times, Times New Roman, Serif'),
      'hff-38' => t('Open Sans Condensed, Arial, Helvetica Neue, Sans-serif'),
      'hff-06' => t('Open Sans, Helvetica Neue, Arial, Sans-serif'),
      'hff-17' => t('Oswald, Helvetica Neue, Arial, Sans-serif'),
      'hff-15' => t('Philosopher, Georgia, Times, Serif'),
      'hff-18' => t('Playfair Display SC, Georgia, Times, Serif'),
      'hff-14' => t('Playfair Display, Times, Serif'),
      'hff-39' => t('PT Sans Narrow, Arial, Helvetica Neue, Sans-serif'),
      'hff-04' => t('PT Sans, Helvetica Neue, Arial, Sans-serif'),
      'hff-23' => t('PT Serif, Georgia, Times, Times New Roman, Serif'),
      'hff-35' => t('Quattrocento Sans, Arial, Helvetica Neue, Sans-serif'),
      'hff-11' => t('Raleway, Helvetica Neue, Arial, Sans-serif'),
      'hff-08' => t('Roboto Condensed, Arial Narrow, Arial, Sans-serif'),
      'hff-10' => t('Roboto Slab, Trebuchet MS, Sans-serif'),
      'hff-05' => t('Roboto, Helvetica Neue, Arial, Sans-serif'),
      'hff-02' => t('Source Sans Pro, Helvetica Neue, Arial, Sans-serif'),
      'hff-30' => t('Times, Times New Roman, Serif'),
      'hff-41' => t('Ubuntu Condensed, Arial, Helvetica Neue, Sans-serif'),
      'hff-03' => t('Ubuntu, Helvetica Neue, Arial, Sans-serif'),
      'hff-29' => t('Volkhov, Georgia, Times, Times New Roman, Serif'),
      'hff-24' => t('Vollkorn, Georgia, Times, Times New Roman, Serif'),
      'hff-37' => t('Work Sans, Arial, Helvetica Neue, Sans-serif'),
    ),
  );

  $form['mtt_settings']['font_tab']['font']['paragraph_font_family'] = array(
    '#type' => 'select',
    '#title' => t('Paragraph'),
    '#default_value' => theme_get_setting('paragraph_font_family', 'ocms_corporate'),
    '#options' => array(
      'pff-25' => t('Alegreya, Georgia, Times, Times New Roman, Serif'),
      'pff-40' => t('Archivo Narrow, Arial, Helvetica Neue, Sans-serif'),
      'pff-42' => t('Arimo, Arial, Helvetica Neue, Sans-serif'),
      'pff-19' => t('Cabin, Helvetica Neue, Arial, Sans-serif'),
      'pff-27' => t('Crimson Text, Georgia, Times, Times New Roman, Serif'),
      'pff-22' => t('Droid Serif, Georgia, Times, Times New Roman, Serif'),
      'pff-09' => t('Exo, Arial, Helvetica Neue, Sans-serif'),
      'pff-33' => t('Fira Sans, Arial, Helvetica Neue, Sans-serif'),
      'pff-28' => t('Gentium Book Basic, Georgia, Times, Times New Roman, Serif'),
      'pff-13' => t('Georgia, Times, Serif'),
      'pff-21' => t('Helvetica Neue, Arial, Sans-serif'),
      'pff-12' => t('Josefin Sans, Georgia, Times, Serif'),
      'pff-07' => t('Lato, Helvetica Neue, Arial, Sans-serif'),
      'pff-34' => t('Lora, Georgia, Times, Times New Roman, Serif'),
      'pff-01' => t('Merriweather, Georgia, Times, Serif'),
      'pff-20' => t('Noto Sans, Arial, Helvetica Neue, Sans-serif'),
      'pff-26' => t('Noto Serif, Georgia, Times, Times New Roman, Serif'),
      'pff-38' => t('Open Sans Condensed, Arial, Helvetica Neue, Sans-serif'),
      'pff-06' => t('Open Sans, Helvetica Neue, Arial, Sans-serif'),
      'pff-17' => t('Oswald, Helvetica Neue, Arial, Sans-serif'),
      'pff-15' => t('Philosopher, Georgia, Times, Serif'),
      'pff-18' => t('Playfair Display SC, Georgia, Times, Serif'),
      'pff-14' => t('Playfair Display, Times, Serif'),
      'pff-39' => t('PT Sans Narrow, Arial, Helvetica Neue, Sans-serif'),
      'pff-04' => t('PT Sans, Helvetica Neue, Arial, Sans-serif'),
      'pff-23' => t('PT Serif, Georgia, Times, Times New Roman, Serif'),
      'pff-35' => t('Quattrocento Sans, Arial, Helvetica Neue, Sans-serif'),
      'pff-11' => t('Raleway, Helvetica Neue, Arial, Sans-serif'),
      'pff-08' => t('Roboto Condensed, Arial Narrow, Arial, Sans-serif'),
      'pff-10' => t('Roboto Slab, Trebuchet MS, Sans-serif'),
      'pff-05' => t('Roboto, Helvetica Neue, Arial, Sans-serif'),
      'pff-02' => t('Source Sans Pro, Helvetica Neue, Arial, Sans-serif'),
      'pff-30' => t('Times, Times New Roman, Serif'),
      'pff-41' => t('Ubuntu Condensed, Arial, Helvetica Neue, Sans-serif'),
      'pff-03' => t('Ubuntu, Helvetica Neue, Arial, Sans-serif'),
      'pff-29' => t('Volkhov, Georgia, Times, Times New Roman, Serif'),
      'pff-24' => t('Vollkorn, Georgia, Times, Times New Roman, Serif'),
      'pff-37' => t('Work Sans, Arial, Helvetica Neue, Sans-serif'),
    ),
  );

  $form['mtt_settings']['slideshows_tab']['slideshow'] = array(
    '#type' => 'details',
    '#title' => t('Slideshow Settings'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#group' => 'tabs',
  );

  $form['mtt_settings']['slideshows_tab']['slideshow']['revolution_slider_fullscreen'] = array(
      '#type' => 'fieldset',
      '#title' => t('Full Screen (Slider Revolution)'),
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
  );

  $form['mtt_settings']['slideshows_tab']['slideshow']['revolution_slider_fullscreen']['rs_slideshow_fullscreen_effect'] = array(
    '#type' => 'select',
    '#title' => t('Effects'),
    '#description'   => t('From the drop-down menu, select the slideshow effect you prefer.'),
    '#default_value' => theme_get_setting('rs_slideshow_fullscreen_effect', 'ocms_corporate'),
    '#options' => array(
      'fade' => t('Fade'),
      'slideup' => t('Slide To Top'),
      'slidedown' => t('Slide To Bottom'),
      'slideright' => t('Slide To Right'),
      'slideleft' => t('Slide To Left'),
      'slidehorizontal' => t('Slide Horizontal'),
      'slidevertical' => t('Slide Vertical'),
      'boxslide' => t('Slide Boxes'),
      'slotslide-horizontal' => t('Slide Slots Horizontal'),
      'slotslide-vertical' => t('Slide Slots Vertical'),
      'boxfade' => t('Fade Boxes'),
      'slotfade-horizontal' => t('Fade Slots Horizontal'),
      'slotfade-vertical' => t('Fade Slots Vertical'),
      'fadefromright' => t('Fade and Slide from Right'),
      'fadefromleft' => t('Fade and Slide from Left'),
      'fadefromtop' => t('Fade and Slide from Top'),
      'fadefrombottom' => t('Fade and Slide from Bottom'),
      'fadetoleftfadefromright' => t('Fade To Left and Fade From Right'),
      'fadetorightfadefromleft' => t('Fade To Right and Fade From Left'),
      'fadetotopfadefrombottom' => t('Fade To Top and Fade From Bottom'),
      'fadetobottomfadefromtop' => t('Fade To Bottom and Fade From Top'),
      'parallaxtoright' => t('Parallax to Right'),
      'parallaxtoleft' => t('Parallax to Left'),
      'parallaxtotop' => t('Parallax to Top'),
      'parallaxtobottom' => t('Parallax to Bottom'),
      'scaledownfromright' => t('Zoom Out and Fade From Right'),
      'scaledownfromleft' => t('Zoom Out and Fade From Left'),
      'scaledownfromtop' => t('Zoom Out and Fade From Top'),
      'scaledownfrombottom' => t('Zoom Out and Fade From Bottom'),
      'zoomout' => t('ZoomOut'),
      'zoomin' => t('ZoomIn'),
      'slotzoom-horizontal' => t('Zoom Slots Horizontal'),
      'slotzoom-vertical' => t('Zoom Slots Vertical'),
      'curtain-1' => t('Curtain from Left'),
      'curtain-2' => t('Curtain from Right'),
      'curtain-3' => t('Curtain from Middle'),
      '3dcurtain-horizontal' => t('3D Curtain Horizontal'),
      '3dcurtain-vertical' => t('3D Curtain Vertical'),
      'cube' => t('Cube Vertical'),
      'cube-horizontal' => t('Cube Horizontal'),
      'incube' => t('In Cube Vertical'),
      'incube-horizontal' => t('In Cube Horizontal'),
      'turnoff' => t('TurnOff Horizontal'),
      'turnoff-vertical' => t('TurnOff Vertical'),
      'papercut' => t('Paper Cut'),
      'flyin' => t('Fly In'),
      'random-static' => t('Random Flat'),
      'random-premium' => t('Random Premium'),
      'random' => t('Random Flat and Premium/Default'),
    ),
  );

  $form['mtt_settings']['slideshows_tab']['slideshow']['revolution_slider_fullscreen']['rs_slideshow_fullscreen_effect_time'] = array(
    '#type' => 'textfield',
    '#title' => t('Effect duration (sec)'),
    '#default_value' => theme_get_setting('rs_slideshow_fullscreen_effect_time', 'ocms_corporate'),
    '#description'   => t('Set the speed of animations, in seconds.'),
  );

  $form['mtt_settings']['slideshows_tab']['slideshow']['revolution_slider_fullscreen']['rs_slideshow_fullscreen_bullets_position'] = array(
    '#type' => 'select',
    '#title' => t('Navigation bullets position'),
    '#description'   => t('From the drop-down menu, select the position you prefer.'),
    '#default_value' => theme_get_setting('rs_slideshow_fullscreen_bullets_position', 'ocms_corporate'),
    '#options' => array(
      'left' => t('Left'),
      'right' => t('Right'),
    ),
  );

  $form['mtt_settings']['slideshows_tab']['slideshow']['revolution_slider_fullscreen']['transparent_header_state'] = array(
    '#type' => 'checkbox',
    '#title' => t('Transparent Header'),
    '#description'   => t('Use the checkbox to display the header over the slideshow in a transparent style.'),
    '#default_value' => theme_get_setting('transparent_header_state', 'ocms_corporate'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );

  $form['mtt_settings']['slideshows_tab']['slideshow']['revolution_slider_fullscreen']['transparent_header_opacity'] = array(
    '#type' => 'textfield',
    '#title' => t('Transparent Header Background Opacity'),
    '#description'   => t('Set the % opacity for the background of the transparent header over the full screen slideshow.'),
    '#default_value' => theme_get_setting('transparent_header_opacity', 'ocms_corporate'),
  );

  $form['mtt_settings']['slideshows_tab']['slideshow']['revolution_slider_fullwidth'] = array(
      '#type' => 'fieldset',
      '#title' => t('Full Width (Slider Revolution)'),
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
  );

  $form['mtt_settings']['slideshows_tab']['slideshow']['revolution_slider_fullwidth']['rs_slideshow_fullwidth_effect'] = array(
    '#type' => 'select',
    '#title' => t('Effects'),
    '#description'   => t('From the drop-down menu, select the slideshow effect you prefer.'),
    '#default_value' => theme_get_setting('rs_slideshow_fullwidth_effect', 'ocms_corporate'),
    '#options' => array(
    'fade' => t('Fade'),
      'slideup' => t('Slide To Top'),
      'slidedown' => t('Slide To Bottom'),
      'slideright' => t('Slide To Right'),
      'slideleft' => t('Slide To Left'),
      'slidehorizontal' => t('Slide Horizontal'),
      'slidevertical' => t('Slide Vertical'),
      'boxslide' => t('Slide Boxes'),
      'slotslide-horizontal' => t('Slide Slots Horizontal'),
      'slotslide-vertical' => t('Slide Slots Vertical'),
      'boxfade' => t('Fade Boxes'),
      'slotfade-horizontal' => t('Fade Slots Horizontal'),
      'slotfade-vertical' => t('Fade Slots Vertical'),
      'fadefromright' => t('Fade and Slide from Right'),
      'fadefromleft' => t('Fade and Slide from Left'),
      'fadefromtop' => t('Fade and Slide from Top'),
      'fadefrombottom' => t('Fade and Slide from Bottom'),
      'fadetoleftfadefromright' => t('Fade To Left and Fade From Right'),
      'fadetorightfadefromleft' => t('Fade To Right and Fade From Left'),
      'fadetotopfadefrombottom' => t('Fade To Top and Fade From Bottom'),
      'fadetobottomfadefromtop' => t('Fade To Bottom and Fade From Top'),
      'parallaxtoright' => t('Parallax to Right'),
      'parallaxtoleft' => t('Parallax to Left'),
      'parallaxtotop' => t('Parallax to Top'),
      'parallaxtobottom' => t('Parallax to Bottom'),
      'scaledownfromright' => t('Zoom Out and Fade From Right'),
      'scaledownfromleft' => t('Zoom Out and Fade From Left'),
      'scaledownfromtop' => t('Zoom Out and Fade From Top'),
      'scaledownfrombottom' => t('Zoom Out and Fade From Bottom'),
      'zoomout' => t('ZoomOut'),
      'zoomin' => t('ZoomIn'),
      'slotzoom-horizontal' => t('Zoom Slots Horizontal'),
      'slotzoom-vertical' => t('Zoom Slots Vertical'),
      'curtain-1' => t('Curtain from Left'),
      'curtain-2' => t('Curtain from Right'),
      'curtain-3' => t('Curtain from Middle'),
      '3dcurtain-horizontal' => t('3D Curtain Horizontal'),
      '3dcurtain-vertical' => t('3D Curtain Vertical'),
      'cube' => t('Cube Vertical'),
      'cube-horizontal' => t('Cube Horizontal'),
      'incube' => t('In Cube Vertical'),
      'incube-horizontal' => t('In Cube Horizontal'),
      'turnoff' => t('TurnOff Horizontal'),
      'turnoff-vertical' => t('TurnOff Vertical'),
      'papercut' => t('Paper Cut'),
      'flyin' => t('Fly In'),
      'random-static' => t('Random Flat'),
      'random-premium' => t('Random Premium'),
      'random' => t('Random Flat and Premium/Default'),
    ),
  );

  $form['mtt_settings']['slideshows_tab']['slideshow']['revolution_slider_fullwidth']['rs_slideshow_fullwidth_effect_time'] = array(
    '#type' => 'textfield',
    '#title' => t('Effect duration (sec)'),
    '#default_value' => theme_get_setting('rs_slideshow_fullwidth_effect_time', 'ocms_corporate'),
    '#description'   => t('Set the speed of animations, in seconds.'),
  );

  $form['mtt_settings']['slideshows_tab']['slideshow']['revolution_slider_fullwidth']['rs_slideshow_fullwidth_initial_height'] = array(
    '#type' => 'textfield',
    '#title' => t('Initial Height (px)'),
    '#default_value' => theme_get_setting('rs_slideshow_fullwidth_initial_height', 'ocms_corporate'),
    '#description'   => t('Set the initial height, in pixels.'),
  );

  $form['mtt_settings']['slideshows_tab']['slideshow']['revolution_slider_fullwidth']['rs_slideshow_fullwidth_bullets_position'] = array(
    '#type' => 'select',
    '#title' => t('Navigation bullets position'),
    '#description'   => t('From the drop-down menu, select the position you prefer.'),
    '#default_value' => theme_get_setting('rs_slideshow_fullwidth_bullets_position', 'ocms_corporate'),
    '#options' => array(
      'left' => t('Left'),
      'center' => t('Center'),
      'right' => t('Right'),
    ),
  );

  $form['mtt_settings']['slideshows_tab']['slideshow']['revolution_slider_boxedwidth'] = array(
      '#type' => 'fieldset',
      '#title' => t('Boxed Width (Slider Revolution)'),
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
  );

  $form['mtt_settings']['slideshows_tab']['slideshow']['revolution_slider_boxedwidth']['rs_slideshow_boxedwidth_effect'] = array(
    '#type' => 'select',
    '#title' => t('Effects'),
    '#description'   => t('From the drop-down menu, select the slideshow effect you prefer.'),
    '#default_value' => theme_get_setting('rs_slideshow_boxedwidth_effect', 'ocms_corporate'),
    '#options' => array(
      'fade' => t('Fade'),
      'slideup' => t('Slide To Top'),
      'slidedown' => t('Slide To Bottom'),
      'slideright' => t('Slide To Right'),
      'slideleft' => t('Slide To Left'),
      'slidehorizontal' => t('Slide Horizontal'),
      'slidevertical' => t('Slide Vertical'),
      'boxslide' => t('Slide Boxes'),
      'slotslide-horizontal' => t('Slide Slots Horizontal'),
      'slotslide-vertical' => t('Slide Slots Vertical'),
      'boxfade' => t('Fade Boxes'),
      'slotfade-horizontal' => t('Fade Slots Horizontal'),
      'slotfade-vertical' => t('Fade Slots Vertical'),
      'fadefromright' => t('Fade and Slide from Right'),
      'fadefromleft' => t('Fade and Slide from Left'),
      'fadefromtop' => t('Fade and Slide from Top'),
      'fadefrombottom' => t('Fade and Slide from Bottom'),
      'fadetoleftfadefromright' => t('Fade To Left and Fade From Right'),
      'fadetorightfadefromleft' => t('Fade To Right and Fade From Left'),
      'fadetotopfadefrombottom' => t('Fade To Top and Fade From Bottom'),
      'fadetobottomfadefromtop' => t('Fade To Bottom and Fade From Top'),
      'parallaxtoright' => t('Parallax to Right'),
      'parallaxtoleft' => t('Parallax to Left'),
      'parallaxtotop' => t('Parallax to Top'),
      'parallaxtobottom' => t('Parallax to Bottom'),
      'scaledownfromright' => t('Zoom Out and Fade From Right'),
      'scaledownfromleft' => t('Zoom Out and Fade From Left'),
      'scaledownfromtop' => t('Zoom Out and Fade From Top'),
      'scaledownfrombottom' => t('Zoom Out and Fade From Bottom'),
      'zoomout' => t('ZoomOut'),
      'zoomin' => t('ZoomIn'),
      'slotzoom-horizontal' => t('Zoom Slots Horizontal'),
      'slotzoom-vertical' => t('Zoom Slots Vertical'),
      'curtain-1' => t('Curtain from Left'),
      'curtain-2' => t('Curtain from Right'),
      'curtain-3' => t('Curtain from Middle'),
      '3dcurtain-horizontal' => t('3D Curtain Horizontal'),
      '3dcurtain-vertical' => t('3D Curtain Vertical'),
      'cube' => t('Cube Vertical'),
      'cube-horizontal' => t('Cube Horizontal'),
      'incube' => t('In Cube Vertical'),
      'incube-horizontal' => t('In Cube Horizontal'),
      'turnoff' => t('TurnOff Horizontal'),
      'turnoff-vertical' => t('TurnOff Vertical'),
      'papercut' => t('Paper Cut'),
      'flyin' => t('Fly In'),
      'random-static' => t('Random Flat'),
      'random-premium' => t('Random Premium'),
      'random' => t('Random Flat and Premium/Default'),
    ),
  );

  $form['mtt_settings']['slideshows_tab']['slideshow']['revolution_slider_boxedwidth']['rs_slideshow_boxedwidth_effect_time'] = array(
    '#type' => 'textfield',
    '#title' => t('Effect duration (sec)'),
    '#default_value' => theme_get_setting('rs_slideshow_boxedwidth_effect_time', 'ocms_corporate'),
    '#description'   => t('Set the speed of animations, in seconds.'),
  );

  $form['mtt_settings']['slideshows_tab']['slideshow']['revolution_slider_boxedwidth']['rs_slideshow_boxedwidth_initial_height'] = array(
    '#type' => 'textfield',
    '#title' => t('Initial Height (px)'),
    '#default_value' => theme_get_setting('rs_slideshow_boxedwidth_initial_height', 'ocms_corporate'),
    '#description'   => t('Set the initial height, in pixels.'),
  );

  $form['mtt_settings']['slideshows_tab']['slideshow']['revolution_slider_boxedwidth']['rs_slideshow_boxedwidth_bullets_position'] = array(
    '#type' => 'select',
    '#title' => t('Navigation bullets position'),
    '#description'   => t('From the drop-down menu, select the position you prefer.'),
    '#default_value' => theme_get_setting('rs_slideshow_boxedwidth_bullets_position', 'ocms_corporate'),
    '#options' => array(
      'left' => t('Left'),
      'center' => t('Center'),
      'right' => t('Right'),
    ),
  );

  $form['mtt_settings']['slideshows_tab']['slideshow']['revolution_slider_internal'] = array(
      '#type' => 'fieldset',
      '#title' => t('Internal Banner (Slider Revolution)'),
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
  );

  $form['mtt_settings']['slideshows_tab']['slideshow']['revolution_slider_internal']['rs_slideshow_internal_effect'] = array(
    '#type' => 'select',
    '#title' => t('Effects'),
    '#description'   => t('From the drop-down menu, select the slideshow effect you prefer.'),
    '#default_value' => theme_get_setting('rs_slideshow_internal_effect', 'ocms_corporate'),
    '#options' => array(
      'fade' => t('Fade'),
      'slideup' => t('Slide To Top'),
      'slidedown' => t('Slide To Bottom'),
      'slideright' => t('Slide To Right'),
      'slideleft' => t('Slide To Left'),
      'slidehorizontal' => t('Slide Horizontal'),
      'slidevertical' => t('Slide Vertical'),
      'boxslide' => t('Slide Boxes'),
      'slotslide-horizontal' => t('Slide Slots Horizontal'),
      'slotslide-vertical' => t('Slide Slots Vertical'),
      'boxfade' => t('Fade Boxes'),
      'slotfade-horizontal' => t('Fade Slots Horizontal'),
      'slotfade-vertical' => t('Fade Slots Vertical'),
      'fadefromright' => t('Fade and Slide from Right'),
      'fadefromleft' => t('Fade and Slide from Left'),
      'fadefromtop' => t('Fade and Slide from Top'),
      'fadefrombottom' => t('Fade and Slide from Bottom'),
      'fadetoleftfadefromright' => t('Fade To Left and Fade From Right'),
      'fadetorightfadefromleft' => t('Fade To Right and Fade From Left'),
      'fadetotopfadefrombottom' => t('Fade To Top and Fade From Bottom'),
      'fadetobottomfadefromtop' => t('Fade To Bottom and Fade From Top'),
      'parallaxtoright' => t('Parallax to Right'),
      'parallaxtoleft' => t('Parallax to Left'),
      'parallaxtotop' => t('Parallax to Top'),
      'parallaxtobottom' => t('Parallax to Bottom'),
      'scaledownfromright' => t('Zoom Out and Fade From Right'),
      'scaledownfromleft' => t('Zoom Out and Fade From Left'),
      'scaledownfromtop' => t('Zoom Out and Fade From Top'),
      'scaledownfrombottom' => t('Zoom Out and Fade From Bottom'),
      'zoomout' => t('ZoomOut'),
      'zoomin' => t('ZoomIn'),
      'slotzoom-horizontal' => t('Zoom Slots Horizontal'),
      'slotzoom-vertical' => t('Zoom Slots Vertical'),
      'curtain-1' => t('Curtain from Left'),
      'curtain-2' => t('Curtain from Right'),
      'curtain-3' => t('Curtain from Middle'),
      '3dcurtain-horizontal' => t('3D Curtain Horizontal'),
      '3dcurtain-vertical' => t('3D Curtain Vertical'),
      'cube' => t('Cube Vertical'),
      'cube-horizontal' => t('Cube Horizontal'),
      'incube' => t('In Cube Vertical'),
      'incube-horizontal' => t('In Cube Horizontal'),
      'turnoff' => t('TurnOff Horizontal'),
      'turnoff-vertical' => t('TurnOff Vertical'),
      'papercut' => t('Paper Cut'),
      'flyin' => t('Fly In'),
      'random-static' => t('Random Flat'),
      'random-premium' => t('Random Premium'),
      'random' => t('Random Flat and Premium/Default'),
    ),
  );

  $form['mtt_settings']['slideshows_tab']['slideshow']['revolution_slider_internal']['rs_slideshow_internal_effect_time'] = array(
    '#type' => 'textfield',
    '#title' => t('Effect duration (sec)'),
    '#default_value' => theme_get_setting('rs_slideshow_internal_effect_time', 'ocms_corporate'),
    '#description'   => t('Set the speed of animations, in seconds.'),
  );

  $form['mtt_settings']['slideshows_tab']['slideshow']['revolution_slider_internal']['rs_slideshow_internal_initial_height'] = array(
    '#type' => 'textfield',
    '#title' => t('Initial Height (px)'),
    '#default_value' => theme_get_setting('rs_slideshow_internal_initial_height', 'ocms_corporate'),
    '#description'   => t('Set the initial height, in pixels.'),
  );

  $form['mtt_settings']['slideshows_tab']['slideshow']['revolution_slider_internal']['rs_slideshow_internal_bullets_position'] = array(
    '#type' => 'select',
    '#title' => t('Navigation bullets position'),
    '#description'   => t('From the drop-down menu, select the position you prefer.'),
    '#default_value' => theme_get_setting('rs_slideshow_internal_bullets_position', 'ocms_corporate'),
    '#options' => array(
      'left' => t('Left'),
      'center' => t('Center'),
      'right' => t('Right'),
    ),
  );

  $form['mtt_settings']['slideshows_tab']['slideshow']['rs_global'] = array(
    '#type' => 'fieldset',
    '#title' => t('Slider Revolution global settings'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );

  $form['mtt_settings']['slideshows_tab']['slideshow']['rs_global']['rs_slideshow_caption_opacity'] = array(
    '#type' => 'textfield',
    '#title' => t('Caption Background Opacity'),
    '#description'   => t('Set the % opacity for the background of the captions in all sliders implemented with Slider Revolution.'),
    '#default_value' => theme_get_setting('rs_slideshow_caption_opacity', 'ocms_corporate'),
  );

  $form['mtt_settings']['slideshows_tab']['slideshow']['testimonial_slideshow'] = array(
    '#type' => 'fieldset',
    '#title' => t('Testimonials Slider (Flexslider)'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );

  $form['mtt_settings']['slideshows_tab']['slideshow']['testimonial_slideshow']['testimonial_slideshow_effect'] = array(
    '#type' => 'select',
    '#title' => t('Effects'),
    '#description'   => t('From the drop-down menu, select the slideshow effect you prefer.'),
    '#default_value' => theme_get_setting('testimonial_slideshow_effect', 'ocms_corporate'),
    '#options' => array(
    'fade' => t('fade'),
    'slide' => t('slide'),
    ),
  );

  $form['mtt_settings']['slideshows_tab']['slideshow']['testimonial_slideshow']['testimonial_slideshow_effect_time'] = array(
    '#type' => 'textfield',
    '#title' => t('Effect duration (sec)'),
    '#default_value' => theme_get_setting('testimonial_slideshow_effect_time', 'ocms_corporate'),
    '#description'   => t('Set the speed of animations, in seconds.'),
  );

  $form['mtt_settings']['slideshows_tab']['slideshow']['in_page_slider'] = array(
    '#type' => 'fieldset',
    '#title' => t('In Page Images Slider (Flexslider)'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );

  $form['mtt_settings']['slideshows_tab']['slideshow']['in_page_slider']['in_page_slider_effect'] = array(
    '#type' => 'select',
    '#title' => t('Effects'),
    '#description'   => t('From the drop-down menu, select the slideshow effect you prefer.'),
    '#default_value' => theme_get_setting('in_page_slider_effect', 'ocms_corporate'),
    '#options' => array(
    'fade' => t('fade'),
    'slide' => t('slide'),
    ),
  );

  $form['mtt_settings']['slideshows_tab']['slideshow']['carousel']['owl_posts'] = array(
    '#type' => 'fieldset',
    '#title' => t('Promoted Posts (Owl Carousel)'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );

  $form['mtt_settings']['slideshows_tab']['slideshow']['carousel']['owl_posts']['owl_posts_autoplay'] = array(
    '#type' => 'checkbox',
    '#title' => t('Autoplay'),
    '#default_value' => theme_get_setting('owl_posts_autoplay', 'ocms_corporate'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );

  $form['mtt_settings']['slideshows_tab']['slideshow']['carousel']['owl_posts']['owl_posts_effect_time'] = array(
    '#type' => 'textfield',
    '#title' => t('Effect duration (sec)'),
    '#default_value' => theme_get_setting('owl_posts_effect_time', 'ocms_corporate'),
    '#description'   => t('Set the speed of animations, in seconds.'),
  );

  $form['mtt_settings']['slideshows_tab']['slideshow']['carousel']['owl_team'] = array(
    '#type' => 'fieldset',
    '#title' => t('Team Members (Owl Carousel)'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );

  $form['mtt_settings']['slideshows_tab']['slideshow']['carousel']['owl_team']['owl_team_autoplay'] = array(
    '#type' => 'checkbox',
    '#title' => t('Autoplay'),
    '#default_value' => theme_get_setting('owl_team_autoplay', 'ocms_corporate'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );

  $form['mtt_settings']['slideshows_tab']['slideshow']['carousel']['owl_team']['owl_team_effect_time'] = array(
    '#type' => 'textfield',
    '#title' => t('Effect duration (sec)'),
    '#default_value' => theme_get_setting('owl_team_effect_time', 'ocms_corporate'),
    '#description'   => t('Set the speed of animations, in seconds.'),
  );

  $form['mtt_settings']['slideshows_tab']['slideshow']['carousel']['owl_testimonials'] = array(
    '#type' => 'fieldset',
    '#title' => t('Testimonials (Owl Carousel)'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );

  $form['mtt_settings']['slideshows_tab']['slideshow']['carousel']['owl_testimonials']['owl_testimonials_autoplay'] = array(
    '#type' => 'checkbox',
    '#title' => t('Autoplay'),
    '#default_value' => theme_get_setting('owl_testimonials_autoplay', 'ocms_corporate'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );

  $form['mtt_settings']['slideshows_tab']['slideshow']['carousel']['owl_testimonials']['owl_testimonials_effect_time'] = array(
    '#type' => 'textfield',
    '#title' => t('Effect duration (sec)'),
    '#default_value' => theme_get_setting('owl_testimonials_effect_time', 'ocms_corporate'),
    '#description'   => t('Set the speed of animations, in seconds.'),
  );

  $form['mtt_settings']['slideshows_tab']['slideshow']['carousel']['owl_companies'] = array(
    '#type' => 'fieldset',
    '#title' => t('Companies (Owl Carousel)'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );

  $form['mtt_settings']['slideshows_tab']['slideshow']['carousel']['owl_companies']['owl_companies_autoplay'] = array(
    '#type' => 'checkbox',
    '#title' => t('Autoplay'),
    '#default_value' => theme_get_setting('owl_companies_autoplay', 'ocms_corporate'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );

  $form['mtt_settings']['slideshows_tab']['slideshow']['carousel']['owl_companies']['owl_companies_effect_time'] = array(
    '#type' => 'textfield',
    '#title' => t('Effect duration (sec)'),
    '#default_value' => theme_get_setting('owl_companies_effect_time', 'ocms_corporate'),
    '#description'   => t('Set the speed of animations, in seconds.'),
  );

  $form['mtt_settings']['parallax_tab']['parallax_and_video_bg'] = array(
    '#type' => 'details',
    '#title' => t('Parallax/Video Background region'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#group' => 'tabs',
  );

  $form['mtt_settings']['parallax_tab']['parallax_and_video_bg']['highlighted_bottom'] = array(
    '#type' => 'fieldset',
    '#title' => t('Highlighted Bottom Region'),
    '#collapsible' => FALSE,
    '#collapsed' => FALSE,
  );

  $form['mtt_settings']['parallax_tab']['parallax_and_video_bg']['highlighted_bottom']['parallax_and_video_bg_state'] = array(
    '#type' => 'select',
    '#title' => t('Select Background effect'),
    '#default_value' => theme_get_setting('parallax_and_video_bg_state', 'ocms_corporate'),
    '#options' => array(
      'none' => t('None'),
      'parallax' => t('Parallax Background Effect'),
      'video' => t('Video Background'),
    ),
  );

  $form['mtt_settings']['parallax_tab']['parallax_and_video_bg']['highlighted_bottom']['parallax_and_video_bg_opacity'] = array(
    '#type' => 'textfield',
    '#title' => t('Parallax Background/Video Background Opacity'),
    '#description'   => t('Set the % opacity for the background of the parallax/video background region.'),
    '#default_value' => theme_get_setting('parallax_and_video_bg_opacity', 'ocms_corporate'),
  );

  $form['mtt_settings']['isotope_tab'] = array(
    '#type' => 'details',
    '#title' => t('Isotope Filters'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#group' => 'tabs',
  );

  $form['mtt_settings']['isotope_tab']['isotope_filters_text'] = array(
    '#type' => 'textfield',
    '#title' => t('Text of isotope "All" filter'),
    '#default_value' => theme_get_setting('isotope_filters_text', 'ocms_corporate'),
    '#description'   => t('Change the text of "All" filter'),
  );

  $form['mtt_settings']['google_maps_tab'] = array(
    '#type' => 'details',
    '#title' => t('Google Maps Settings'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
    '#group' => 'tabs',
  );

  $form['mtt_settings']['google_maps_tab']['google_maps_key'] = array(
    '#type' => 'textfield',
    '#title' => t('Google Maps API Key'),
    '#description'   => t('Google requires an API key to be included to all calls to Google Maps API. Please create an API key and populate the above field.'),
    '#default_value' => theme_get_setting('google_maps_key','ocms_corporate'),
    '#size'          => 50,
    '#maxlength'     => 50,
  );

}
<file_sep>/docroot/modules/custom/ocms_linkchecker/src/OcmsLinkcheckerExtractionInterface.php
<?php

namespace Drupal\ocms_linkchecker;

/**
 * Defines an interface for the Link extraction services.
 */
interface PupLinkcheckerExtractionInterface {

  /**
   * Extracts links from content.
   *
   * @param string $text
   *   The text to be scanned for links.
   * @param string $contentPath
   *   Path to the content that is currently scanned for links. This value is
   *   required to build full qualified links from relative links. Relative links
   *   are not extracted from content, if path is not provided.
   *
   * @return array
   *   Array whose keys are fully qualified and unique URLs found in the
   *   content, and whose values are arrays of actual text (raw URLs or paths)
   *   corresponding to each fully qualified URL.
   */
  public function extractContentLinks($text, $contentPath);

  /**
   * Extracts links from a node.
   *
   * @param object $node
   *   The fully populated node object.
   * @param boolean $returnFieldNames
   *   If set to TRUE, the returned array will contain the link URLs as keys, and
   *   each element will be an array containing all field names in which the URL
   *   is found. Otherwise, a simple array of URLs will be returned.
   *
   * @return array
   *   An array whose keys are fully qualified and unique URLs found in the node
   *   (as returned by extractContentLinks()), or a more complex
   *   structured array (see above) if $returnFieldNames is TRUE.
   */
  public function extractNodeLinks($node, $returnFieldNames = FALSE);

  /**
   * Extracts links from a comment.
   *
   * @param object $comment
   *   The fully populated comment object.
   * @param boolean $returnFieldNames
   *   If set to TRUE, the returned array will contain the link URLs as keys, and
   *   each element will be an array containing all field names in which the URL
   *   is found. Otherwise, a simple array of URLs will be returned.
   *
   * @return array
   *   An array whose keys are fully qualified and unique URLs found in the node
   *   (as returned by extractContentLinks()), or a more complex
   *   structured array (see above) if $returnFieldNames is TRUE.
   */
  public function extractCommentLinks($comment, $returnFieldNames = FALSE);

  /**
   * Extracts links from a block.
   *
   * @param object $block
   *   The fully populated block object.
   * @param boolean $returnFieldNames
   *   If set to TRUE, the returned array will contain the link URLs as keys, and
   *   each element will be an array containing all field names in which the URL
   *   is found. Otherwise, a simple array of URLs will be returned.
   *
   * @return array
   *   An array whose keys are fully qualified and unique URLs found in the node
   *   (as returned by extractContentLinks()), or a more complex
   *   structured array (see above) if $returnFieldNames is TRUE.
   */
  public function extractBlockLinks($block, $returnFieldNames = FALSE);
}
<file_sep>/docroot/modules/custom/ocms_universal_assets/src/Controller/UniversalAssetsController.php
<?php

namespace Drupal\ocms_universal_assets\Controller;

use Drupal\Core\Controller\ControllerBase;

/**
 * Controller routines for page example routes.
 */
class UniversalAssetsController extends ControllerBase {

  /**
   * Universal assets page content.
   *
   * @return array
   *   Markup to display on universal asset page.
   */
  public function content() {
    return [
      '#markup' => '',
    ];
  }

}
<file_sep>/docroot/themes/custom/ocms_corporate/js/init/owl-carousel-companies-init.js
jQuery(document).ready(function($) {
  $(".view-companies-carousel .owl-carousel.companies").owlCarousel({
    items: 5,
    itemsDesktopSmall: [992,3],
    itemsTablet: [768,3],
    autoPlay: drupalSettings.ocms_corporate.owlCarouselCompaniesInit.owlCompaniesEffectTime,
    navigation: true,
    pagination: false
  });
});
<file_sep>/docroot/themes/custom/ocms_corporate/js/init/video-background-init.js
jQuery(document).ready(function($) {
  $("body").addClass("video-bg-active");
  $(".video-bg-active #highlighted-bottom").vide({
    mp4: drupalSettings.ocms_corporate.VideoBackgroundInit.PathToVideo_mp4,
    webm: drupalSettings.ocms_corporate.VideoBackgroundInit.PathToVideo_webm,
    poster: drupalSettings.ocms_corporate.VideoBackgroundInit.pathToVideo_jpg
  },{
    posterType: 'jpg',
    className: 'video-container'
  });
});<file_sep>/docroot/modules/custom/ocms_linkchecker/src/OcmsLinkcheckerDatabaseInterface.php
<?php

namespace Drupal\ocms_linkchecker;

/**
 * Defines an interface for the Link database services.
 */
interface PupLinkcheckerDatabaseInterface {

  /**
   * Adds node links to database.
   *
   * @param object $node
   *   The fully populated node object.
   * @param bool $skipMissingLinksDetection
   *   To prevent endless batch loops the value needs to be TRUE. With FALSE
   *   the need for content re-scans is detected by the number of missing links.
   */
  public function addNodeLinks($node, $skipMissingLinksDetection = FALSE);

  /**
   * Adds comment links to database.
   *
   * @param object $comment
   *   The fully populated comment object.
   * @param bool $skipMissingLinksDetection
   *   To prevent endless batch loops the value needs to be TRUE. With FALSE
   *   the need for content re-scans is detected by the number of missing links.
   */
  public function addCommentLinks($comment, $skipMissingLinksDetection = FALSE);

  /**
   * Adds block links to database.
   *
   * @param array|object $block
   *   The fully populated block object.
   * @param int $bid
   *   Block id from table {block}.bid.
   * @param bool $skipMissingLinksDetection
   *   To prevent endless batch loops the value needs to be TRUE. With FALSE
   *   the need for content re-scans is detected by the number of missing links.
   */
  public function addBlockLinks($block, $bid, $skipMissingLinksDetection = FALSE);

  /**
   * Removes all node references to links in the {ocms_linkchecker_entity} table.
   *
   * @param \Drupal\node\NodeInterface $node
   *   The node object.
   */
  public function deleteNodeLinks(\Drupal\node\NodeInterface $node);

  /**
   * Sets all references to a node as broken.
   *
   * @param \Drupal\node\NodeInterface $node
   *   The node object.
   */
  public function setBrokenNodeReferences(\Drupal\node\NodeInterface $node);

  /**
   * Removes all comment references to links in the {ocms_linkchecker_entity}
   * table.
   *
   * @param object $comment
   *   The comment object.
   */
  public function deleteCommentLinks($comment);

  /**
   * Removes all block references to links in the {ocms_linkchecker_entity} table.
   *
   * @param object $block
   *   The block object.
   */
  public function deleteBlockLinks($block);

  /**
   * Deletes expired node references to links in the {ocms_linkchecker_entity}
   * table.
   *
   * @param \Drupal\node\NodeInterface $node
   *   The node object.
   * @param array $links
   */
  public function deleteExpiredNodeReferences(\Drupal\node\NodeInterface $node, $links = array());

  /**
   * Deletes expired comment references to links in the
   * {ocms_linkchecker_entity} table.
   *
   * @param object $comment
   *   The comment object.
   * @param array $links
   */
  public function deleteExpiredCommentReferences($comment, $links = array());

  /**
   * Deletes expired block references to links in the {ocms_linkchecker_entity}
   * table.
   *
   * @param object $block
   *   The block object.
   * @param array $links
   */
  public function deleteBlockReferences($block, $links = array());

  /**
   * Returns an array of node references missing in the {ocms_linkchecker_entity}
   * table.
   *
   * @param \Drupal\node\NodeInterface $node
   *   The node object.
   * @param array $links
   *   An array of links.
   *
   * @return array
   *   An array of node references missing in the {ocms_linkchecker_entity} table.
   */
  public function getMissingNodeReferences(\Drupal\node\NodeInterface $node, $links);

  /**
   * Returns an array of comment references missing in the
   * {ocms_linkchecker_entity} table.
   *
   * @param object $comment
   *   The comment object.
   * @param array $links
   *   An array of links.
   *
   * @return array
   *   An array of comment references missing in the {ocms_linkchecker_entity}
   *   table.
   */
  public function getMissingCommentReferences($comment, $links);

  /**
   * Returns an array of block references missing in the {ocms_linkchecker_entity}
   * table.
   *
   * @param object $block
   *   The block object.
   * @param array $links
   *   An array of links.
   *
   * @return array
   *   An array of block references missing in the {ocms_linkchecker_entity}
   *   table.
   */
  public function getMissingBlockReferences($block, $links);

  /**
   * Unpublishes all nodes having the specified link id.
   *
   * @param int $lid
   *   A link ID that have reached a defined failcount.
   */
  public function unpublishNodes($lid);
}
<file_sep>/docroot/themes/custom/ocms_education/theme-settings.php
<?php

function ocms_education_form_system_theme_settings_alter(&$form, &$form_state) {

  $form['#attached']['library'][] = 'ocms_education/theme-settings';

  $form['mtt_settings'] = array(
    '#type' => 'fieldset',
    '#title' => t('MtT Theme Settings'),
    '#collapsible' => FALSE,
    '#collapsed' => FALSE,
  );

  $form['mtt_settings']['tabs'] = array(
    '#type' => 'vertical_tabs',
    '#default_tab' => 'basic_tab',
  );

  $form['mtt_settings']['basic_tab']['basic_settings'] = array(
    '#type' => 'details',
    '#title' => t('Basic Settings'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
    '#group' => 'tabs',
  );

  $form['mtt_settings']['basic_tab']['basic_settings']['breadcrumb_separator'] = array(
    '#type' => 'textfield',
    '#title' => t('Breadcrumb separator'),
    '#default_value' => theme_get_setting('breadcrumb_separator','ocms_education'),
    '#size'          => 5,
    '#maxlength'     => 10,
  );

  $form['mtt_settings']['basic_tab']['basic_settings']['header'] = array(
    '#type' => 'item',
    '#markup' => t('<div class="theme-settings-title">Header positioning</div>'),
  );

  $form['mtt_settings']['basic_tab']['basic_settings']['fixed_header'] = array(
    '#type' => 'checkbox',
    '#title' => t('Fixed position'),
    '#description'   => t('Use the checkbox to apply fixed position to the header.'),
    '#default_value' => theme_get_setting('fixed_header', 'ocms_education'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );

  $form['mtt_settings']['basic_tab']['basic_settings']['scrolltop'] = array(
    '#type' => 'fieldset',
    '#title' => t('Scroll to top'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );

  $form['mtt_settings']['basic_tab']['basic_settings']['scrolltop']['scrolltop_display'] = array(
    '#type' => 'checkbox',
    '#title' => t('Show scroll-to-top button'),
    '#description'   => t('Use the checkbox to enable or disable scroll-to-top button.'),
    '#default_value' => theme_get_setting('scrolltop_display', 'ocms_education'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );

  $form['mtt_settings']['basic_tab']['basic_settings']['scrolltop']['scrolltop_icon'] = array(
    '#type' => 'textfield',
    '#title' => t('Scroll To Top icon'),
    '#description'   => t('Enter the class of the icon you want from the Font Awesome library e.g.: fa-angle-up. A list of the available classes is provided here: <a href="http://fortawesome.github.io/Font-Awesome/cheatsheet" target="_blank">http://fortawesome.github.io/Font-Awesome/cheatsheet</a>.'),
    '#default_value' => theme_get_setting('scrolltop_icon','ocms_education'),
    '#size'          => 20,
    '#maxlength'     => 100,
  );

  $form['mtt_settings']['layout_tab']['layout'] = array(
    '#type' => 'details',
    '#title' => t('Layout'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#group' => 'tabs',
  );

  $form['mtt_settings']['layout_tab']['layout']['three_columns_grid_layout'] = array(
    '#type' => 'select',
    '#title' => t('Adjustments to the three-column, Bootstrap layout grid'),
    '#description'   => t('From the drop-down menu, select the grid of the three-column layout you would like to use. This way, you can set the width of each of your columns, when choosing a three-column layout.
    <br><br>Note: All options refer to Bootstrap columns.'),
    '#default_value' => theme_get_setting('three_columns_grid_layout', 'ocms_education'),
    '#options' => array(
      'grid_3_6_3' => t('3-6-3/Default'),
      'grid_2_6_4' => t('2-6-4'),
      'grid_4_6_2' => t('4-6-2'),
    ),
  );

  $form['mtt_settings']['looknfeel_tab']['looknfeel'] = array(
    '#type' => 'details',
    '#title' => t('Look\'n\'Feel'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#group' => 'tabs',
  );

  $form['mtt_settings']['looknfeel_tab']['looknfeel']['color_scheme'] = array(
    '#type' => 'select',
    '#title' => t('Color Schemes'),
    '#description'   => t('From the drop-down menu, select the color scheme you prefer.'),
    '#default_value' => theme_get_setting('color_scheme', 'ocms_education'),
    '#options' => array(
      'gray' => t('Gray'),
      'gray-green' => t('Gray Green'),
      'gray-orange' => t('Gray Orange'),
      'gray-red' => t('Gray Red'),
      'gray-pink' => t('Gray Pink'),
      'gray-purple' => t('Gray Purple'),
      'blue' => t('Blue'),
      'green' => t('Green'),
      'orange' => t('Orange'),
      'red' => t('Red'),
      'pink' => t('Pink'),
      'purple' => t('Purple'),
    ),
  );

  $form['mtt_settings']['looknfeel_tab']['looknfeel']['form_style'] = array(
    '#type' => 'select',
    '#title' => t('Form styles of contact page'),
    '#description'   => t('From the drop-down menu, select the form style that you prefer.'),
    '#default_value' => theme_get_setting('form_style', 'ocms_education'),
    '#options' => array(
      'form-style-1' => t('Style-1 (default)'),
      'form-style-2' => t('Style-2'),
      ),
  );

  $form['mtt_settings']['font_tab']['font'] = array(
    '#type' => 'details',
    '#title' => t('Font Settings'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#group' => 'tabs',
  );

  $form['mtt_settings']['font_tab']['font']['font_title'] = array(
    '#type' => 'item',
    '#markup' => 'For every region pick the <strong>font-family</strong> that corresponds to your needs.',
  );

  $form['mtt_settings']['font_tab']['font']['sitename_font_family'] = array(
    '#type' => 'select',
    '#title' => t('Site name'),
    '#default_value' => theme_get_setting('sitename_font_family', 'ocms_education'),
    '#options' => array(
      'sff-01' => t('Merriweather, Georgia, Times, Serif'),
      'sff-02' => t('Source Sans Pro, Helvetica Neuee, Arial, Sans-serif'),
      'sff-03' => t('Ubuntu, Helvetica Neue, Arial, Sans-serif'),
      'sff-04' => t('PT Sans, Helvetica Neue, Arial, Sans-serif'),
      'sff-05' => t('Roboto, Helvetica Neue, Arial, Sans-serif'),
      'sff-06' => t('Open Sans, Helvetica Neue, Arial, Sans-serif'),
      'sff-07' => t('Lato, Helvetica Neue, Arial, Sans-serif'),
      'sff-08' => t('Roboto Condensed, Arial Narrow, Arial, Sans-serif'),
      'sff-09' => t('Exo, Arial, Helvetica Neue, Sans-serif'),
      'sff-10' => t('Roboto Slab, Trebuchet MS, Sans-serif'),
      'sff-11' => t('Raleway, Helvetica Neue, Arial, Sans-serif'),
      'sff-12' => t('Josefin Sans, Georgia, Times, Serif'),
      'sff-13' => t('Georgia, Times, Serif'),
      'sff-14' => t('Playfair Display, Times, Serif'),
      'sff-15' => t('Philosopher, Georgia, Times, Serif'),
      'sff-16' => t('Cinzel, Georgia, Times, Serif'),
      'sff-17' => t('Oswald, Helvetica Neue, Arial, Sans-serif'),
      'sff-18' => t('Playfair Display SC, Georgia, Times, Serif'),
      'sff-19' => t('Cabin, Helvetica Neue, Arial, Sans-serif'),
      'sff-20' => t('Noto Sans, Arial, Helvetica Neue, Sans-serif;'),
      'sff-21' => t('Helvetica Neue, Arial, Sans-serif'),
      'sff-22' => t('Droid Serif, Georgia, Times, Times New Roman, Serif'),
      'sff-23' => t('PT Serif, Georgia, Times, Times New Roman, Serif'),
      'sff-24' => t('Vollkorn, Georgia, Times, Times New Roman, Serif'),
      'sff-25' => t('Alegreya, Georgia, Times, Times New Roman, Serif'),
      'sff-26' => t('Noto Serif, Georgia, Times, Times New Roman, Serif'),
      'sff-27' => t('Crimson Text, Georgia, Times, Times New Roman, Serif'),
      'sff-28' => t('Gentium Book Basic, Georgia, Times, Times New Roman, Serif'),
      'sff-29' => t('Volkhov, Georgia, Times, Times New Roman, Serif'),
      'sff-30' => t('Times, Times New Roman, Serif'),
      'sff-31' => t('Alegreya SC, Georgia, Times, Times New Roman, Serif'),
      'sff-32' => t('Montserrat SC, Arial, Helvetica Neue, Sans-serif'),
      'sff-33' => t('Fira Sans, Arial, Helvetica Neue, Sans-serif'),
      'sff-34' => t('Lora, Georgia, Times, Times New Roman, Serif'),
      'sff-35' => t('Quattrocento Sans, Arial, Helvetica Neue, Sans-serif'),
      'sff-36' => t('Julius Sans One, Arial, Helvetica Neue, Sans-serif'),
    ),
  );

  $form['mtt_settings']['font_tab']['font']['slogan_font_family'] = array(
    '#type' => 'select',
    '#title' => t('Slogan'),
    '#default_value' => theme_get_setting('slogan_font_family', 'ocms_education'),
    '#options' => array(
      'slff-01' => t('Merriweather, Georgia, Times, Serif'),
      'slff-02' => t('Source Sans Pro, Helvetica Neuee, Arial, Sans-serif'),
      'slff-03' => t('Ubuntu, Helvetica Neue, Arial, Sans-serif'),
      'slff-04' => t('PT Sans, Helvetica Neue, Arial, Sans-serif'),
      'slff-05' => t('Roboto, Helvetica Neue, Arial, Sans-serif'),
      'slff-06' => t('Open Sans, Helvetica Neue, Arial, Sans-serif'),
      'slff-07' => t('Lato, Helvetica Neue, Arial, Sans-serif'),
      'slff-08' => t('Roboto Condensed, Arial Narrow, Arial, Sans-serif'),
      'slff-09' => t('Exo, Arial, Helvetica Neue, Sans-serif'),
      'slff-10' => t('Roboto Slab, Trebuchet MS, Sans-serif'),
      'slff-11' => t('Raleway, Helvetica Neue, Arial, Sans-serif'),
      'slff-12' => t('Josefin Sans, Georgia, Times, Serif'),
      'slff-13' => t('Georgia, Times, Serif'),
      'slff-14' => t('Playfair Display, Times, Serif'),
      'slff-15' => t('Philosopher, Georgia, Times, Serif'),
      'slff-16' => t('Cinzel, Georgia, Times, Serif'),
      'slff-17' => t('Oswald, Helvetica Neue, Arial, Sans-serif'),
      'slff-18' => t('Playfair Display SC, Georgia, Times, Serif'),
      'slff-19' => t('Cabin, Helvetica Neue, Arial, Sans-serif'),
      'slff-20' => t('Noto Sans, Arial, Helvetica Neue, Sans-serif;'),
      'slff-21' => t('Helvetica Neue, Arial, Sans-serif'),
      'slff-22' => t('Droid Serif, Georgia, Times, Times New Roman, Serif'),
      'slff-23' => t('PT Serif, Georgia, Times, Times New Roman, Serif'),
      'slff-24' => t('Vollkorn, Georgia, Times, Times New Roman, Serif'),
      'slff-25' => t('Alegreya, Georgia, Times, Times New Roman, Serif'),
      'slff-26' => t('Noto Serif, Georgia, Times, Times New Roman, Serif'),
      'slff-27' => t('Crimson Text, Georgia, Times, Times New Roman, Serif'),
      'slff-28' => t('Gentium Book Basic, Georgia, Times, Times New Roman, Serif'),
      'slff-29' => t('Volkhov, Georgia, Times, Times New Roman, Serif'),
      'slff-30' => t('Times, Times New Roman, Serif'),
      'slff-31' => t('Alegreya SC, Georgia, Times, Times New Roman, Serif'),
      'slff-32' => t('Montserrat SC, Arial, Helvetica Neue, Sans-serif'),
      'slff-33' => t('Fira Sans, Arial, Helvetica Neue, Sans-serif'),
      'slff-34' => t('Lora, Georgia, Times, Times New Roman, Serif'),
      'slff-35' => t('Quattrocento Sans, Arial, Helvetica Neue, Sans-serif'),
      'slff-36' => t('Julius Sans One, Arial, Helvetica Neue, Sans-serif'),
    ),
  );

  $form['mtt_settings']['font_tab']['font']['headings_font_family'] = array(
    '#type' => 'select',
    '#title' => t('Headings'),
    '#default_value' => theme_get_setting('headings_font_family', 'ocms_education'),
    '#options' => array(
      'hff-01' => t('Merriweather, Georgia, Times, Serif'),
      'hff-02' => t('Source Sans Pro, Helvetica Neuee, Arial, Sans-serif'),
      'hff-03' => t('Ubuntu, Helvetica Neue, Arial, Sans-serif'),
      'hff-04' => t('PT Sans, Helvetica Neue, Arial, Sans-serif'),
      'hff-05' => t('Roboto, Helvetica Neue, Arial, Sans-serif'),
      'hff-06' => t('Open Sans, Helvetica Neue, Arial, Sans-serif'),
      'hff-07' => t('Lato, Helvetica Neue, Arial, Sans-serif'),
      'hff-08' => t('Roboto Condensed, Arial Narrow, Arial, Sans-serif'),
      'hff-09' => t('Exo, Arial, Helvetica Neue, Sans-serif'),
      'hff-10' => t('Roboto Slab, Trebuchet MS, Sans-serif'),
      'hff-11' => t('Raleway, Helvetica Neue, Arial, Sans-serif'),
      'hff-12' => t('Josefin Sans, Georgia, Times, Serif'),
      'hff-13' => t('Georgia, Times, Serif'),
      'hff-14' => t('Playfair Display, Times, Serif'),
      'hff-15' => t('Philosopher, Georgia, Times, Serif'),
      'hff-16' => t('Cinzel, Georgia, Times, Serif'),
      'hff-17' => t('Oswald, Helvetica Neue, Arial, Sans-serif'),
      'hff-18' => t('Playfair Display SC, Georgia, Times, Serif'),
      'hff-19' => t('Cabin, Helvetica Neue, Arial, Sans-serif'),
      'hff-20' => t('Noto Sans, Arial, Helvetica Neue, Sans-serif;'),
      'hff-21' => t('Helvetica Neue, Arial, Sans-serif'),
      'hff-22' => t('Droid Serif, Georgia, Times, Times New Roman, Serif'),
      'hff-23' => t('PT Serif, Georgia, Times, Times New Roman, Serif'),
      'hff-24' => t('Vollkorn, Georgia, Times, Times New Roman, Serif'),
      'hff-25' => t('Alegreya, Georgia, Times, Times New Roman, Serif'),
      'hff-26' => t('Noto Serif, Georgia, Times, Times New Roman, Serif'),
      'hff-27' => t('Crimson Text, Georgia, Times, Times New Roman, Serif'),
      'hff-28' => t('Gentium Book Basic, Georgia, Times, Times New Roman, Serif'),
      'hff-29' => t('Volkhov, Georgia, Times, Times New Roman, Serif'),
      'hff-30' => t('Times, Times New Roman, Serif'),
      'hff-31' => t('Alegreya SC, Georgia, Times, Times New Roman, Serif'),
      'hff-32' => t('Montserrat SC, Arial, Helvetica Neue, Sans-serif'),
      'hff-33' => t('Fira Sans, Arial, Helvetica Neue, Sans-serif'),
      'hff-34' => t('Lora, Georgia, Times, Times New Roman, Serif'),
      'hff-35' => t('Quattrocento Sans, Arial, Helvetica Neue, Sans-serif'),
      'hff-36' => t('Julius Sans One, Arial, Helvetica Neue, Sans-serif'),
    ),
  );

  $form['mtt_settings']['font_tab']['font']['paragraph_font_family'] = array(
  '#type' => 'select',
  '#title' => t('Paragraph'),
  '#default_value' => theme_get_setting('paragraph_font_family', 'ocms_education'),
    '#options' => array(
      'pff-01' => t('Merriweather, Georgia, Times, Serif'),
      'pff-02' => t('Source Sans Pro, Helvetica Neuee, Arial, Sans-serif'),
      'pff-03' => t('Ubuntu, Helvetica Neue, Arial, Sans-serif'),
      'pff-04' => t('PT Sans, Helvetica Neue, Arial, Sans-serif'),
      'pff-05' => t('Roboto, Helvetica Neue, Arial, Sans-serif'),
      'pff-06' => t('Open Sans, Helvetica Neue, Arial, Sans-serif'),
      'pff-07' => t('Lato, Helvetica Neue, Arial, Sans-serif'),
      'pff-08' => t('Roboto Condensed, Arial Narrow, Arial, Sans-serif'),
      'pff-09' => t('Exo, Arial, Helvetica Neue, Sans-serif'),
      'pff-10' => t('Roboto Slab, Trebuchet MS, Sans-serif'),
      'pff-11' => t('Raleway, Helvetica Neue, Arial, Sans-serif'),
      'pff-12' => t('Josefin Sans, Georgia, Times, Serif'),
      'pff-13' => t('Georgia, Times, Serif'),
      'pff-14' => t('Playfair Display, Times, Serif'),
      'pff-15' => t('Philosopher, Georgia, Times, Serif'),
      'pff-16' => t('Oswald, Helvetica Neue, Arial, Sans-serif'),
      'pff-17' => t('Playfair Display SC, Georgia, Times, Serif'),
      'pff-18' => t('Cabin, Helvetica Neue, Arial, Sans-serif'),
      'pff-19' => t('Noto Sans, Arial, Helvetica Neue, Sans-serif;'),
      'pff-20' => t('Helvetica Neue, Arial, Sans-serif'),
      'pff-21' => t('Droid Serif, Georgia, Times, Times New Roman, Serif'),
      'pff-22' => t('PT Serif, Georgia, Times, Times New Roman, Serif'),
      'pff-23' => t('Vollkorn, Georgia, Times, Times New Roman, Serif'),
      'pff-24' => t('Alegreya, Georgia, Times, Times New Roman, Serif'),
      'pff-25' => t('Noto Serif, Georgia, Times, Times New Roman, Serif'),
      'pff-26' => t('Crimson Text, Georgia, Times, Times New Roman, Serif'),
      'pff-27' => t('Gentium Book Basic, Georgia, Times, Times New Roman, Serif'),
      'pff-28' => t('Volkhov, Georgia, Times, Times New Roman, Serif'),
      'pff-29' => t('Times, Times New Roman, Serif'),
      'pff-30' => t('Fira Sans, Arial, Helvetica Neue, Sans-serif'),
      'pff-31' => t('Lora, Georgia, Times, Times New Roman, Serif'),
      'pff-32' => t('Quattrocento Sans, Arial, Helvetica Neue, Sans-serif'),
    ),
  );

  $form['mtt_settings']['slideshows_tab']['slideshow'] = array(
    '#type' => 'details',
    '#title' => t('Sliders'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#group' => 'tabs',
  );

  $form['mtt_settings']['slideshows_tab']['slideshow']['revolution_slider_boxedwidth'] = array(
    '#type' => 'fieldset',
    '#title' => t('Boxed Width (Slider Revolution)'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );

  $form['mtt_settings']['slideshows_tab']['slideshow']['revolution_slider_boxedwidth']['rs_slideshow_boxedwidth_effect'] = array(
    '#type' => 'select',
    '#title' => t('Effects'),
    '#description'   => t('From the drop-down menu, select the slideshow effect you prefer.'),
    '#default_value' => theme_get_setting('rs_slideshow_boxedwidth_effect', 'ocms_education'),
    '#options' => array(
      'fade' => t('Fade'),
      'slideup' => t('Slide To Top'),
      'slidedown' => t('Slide To Bottom'),
      'slideright' => t('Slide To Right'),
      'slideleft' => t('Slide To Left'),
      'slidehorizontal' => t('Slide Horizontal'),
      'slidevertical' => t('Slide Vertical'),
      'boxslide' => t('Slide Boxes'),
      'slotslide-horizontal' => t('Slide Slots Horizontal'),
      'slotslide-vertical' => t('Slide Slots Vertical'),
      'boxfade' => t('Fade Boxes'),
      'slotfade-horizontal' => t('Fade Slots Horizontal'),
      'slotfade-vertical' => t('Fade Slots Vertical'),
      'fadefromright' => t('Fade and Slide from Right'),
      'fadefromleft' => t('Fade and Slide from Left'),
      'fadefromtop' => t('Fade and Slide from Top'),
      'fadefrombottom' => t('Fade and Slide from Bottom'),
      'fadetoleftfadefromright' => t('Fade To Left and Fade From Right'),
      'fadetorightfadefromleft' => t('Fade To Right and Fade From Left'),
      'fadetotopfadefrombottom' => t('Fade To Top and Fade From Bottom'),
      'fadetobottomfadefromtop' => t('Fade To Bottom and Fade From Top'),
      'parallaxtoright' => t('Parallax to Right'),
      'parallaxtoleft' => t('Parallax to Left'),
      'parallaxtotop' => t('Parallax to Top'),
      'parallaxtobottom' => t('Parallax to Bottom'),
      'scaledownfromright' => t('Zoom Out and Fade From Right'),
      'scaledownfromleft' => t('Zoom Out and Fade From Left'),
      'scaledownfromtop' => t('Zoom Out and Fade From Top'),
      'scaledownfrombottom' => t('Zoom Out and Fade From Bottom'),
      'zoomout' => t('ZoomOut'),
      'zoomin' => t('ZoomIn'),
      'slotzoom-horizontal' => t('Zoom Slots Horizontal'),
      'slotzoom-vertical' => t('Zoom Slots Vertical'),
      'curtain-1' => t('Curtain from Left'),
      'curtain-2' => t('Curtain from Right'),
      'curtain-3' => t('Curtain from Middle'),
      '3dcurtain-horizontal' => t('3D Curtain Horizontal'),
      '3dcurtain-vertical' => t('3D Curtain Vertical'),
      'cube' => t('Cube Vertical'),
      'cube-horizontal' => t('Cube Horizontal'),
      'incube' => t('In Cube Vertical'),
      'incube-horizontal' => t('In Cube Horizontal'),
      'turnoff' => t('TurnOff Horizontal'),
      'turnoff-vertical' => t('TurnOff Vertical'),
      'papercut' => t('Paper Cut'),
      'flyin' => t('Fly In'),
      'random-static' => t('Random Flat'),
      'random-premium' => t('Random Premium'),
      'random' => t('Random Flat and Premium/Default'),
    ),
  );

  $form['mtt_settings']['slideshows_tab']['slideshow']['revolution_slider_boxedwidth']['rs_slideshow_boxedwidth_effect_time'] = array(
    '#type' => 'textfield',
    '#title' => t('Effect duration (sec)'),
    '#default_value' => theme_get_setting('rs_slideshow_boxedwidth_effect_time', 'ocms_education'),
    '#description'   => t('Set the speed of animations, in seconds.'),
  );

  $form['mtt_settings']['slideshows_tab']['slideshow']['revolution_slider_boxedwidth']['rs_slideshow_boxedwidth_initial_height'] = array(
    '#type' => 'textfield',
    '#title' => t('Initial Height (px)'),
    '#default_value' => theme_get_setting('rs_slideshow_boxedwidth_initial_height', 'ocms_education'),
    '#description'   => t('Set the initial height, in pixels.'),
  );

  $form['mtt_settings']['slideshows_tab']['slideshow']['revolution_slider_internal'] = array(
    '#type' => 'fieldset',
    '#title' => t('Internal Banner (Slider Revolution)'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );

  $form['mtt_settings']['slideshows_tab']['slideshow']['revolution_slider_internal']['rs_slideshow_internal_effect'] = array(
    '#type' => 'select',
    '#title' => t('Effects'),
    '#description'   => t('From the drop-down menu, select the slideshow effect you prefer.'),
    '#default_value' => theme_get_setting('rs_slideshow_internal_effect', 'ocms_education'),
    '#options' => array(
      'fade' => t('Fade'),
      'slideup' => t('Slide To Top'),
      'slidedown' => t('Slide To Bottom'),
      'slideright' => t('Slide To Right'),
      'slideleft' => t('Slide To Left'),
      'slidehorizontal' => t('Slide Horizontal'),
      'slidevertical' => t('Slide Vertical'),
      'boxslide' => t('Slide Boxes'),
      'slotslide-horizontal' => t('Slide Slots Horizontal'),
      'slotslide-vertical' => t('Slide Slots Vertical'),
      'boxfade' => t('Fade Boxes'),
      'slotfade-horizontal' => t('Fade Slots Horizontal'),
      'slotfade-vertical' => t('Fade Slots Vertical'),
      'fadefromright' => t('Fade and Slide from Right'),
      'fadefromleft' => t('Fade and Slide from Left'),
      'fadefromtop' => t('Fade and Slide from Top'),
      'fadefrombottom' => t('Fade and Slide from Bottom'),
      'fadetoleftfadefromright' => t('Fade To Left and Fade From Right'),
      'fadetorightfadefromleft' => t('Fade To Right and Fade From Left'),
      'fadetotopfadefrombottom' => t('Fade To Top and Fade From Bottom'),
      'fadetobottomfadefromtop' => t('Fade To Bottom and Fade From Top'),
      'parallaxtoright' => t('Parallax to Right'),
      'parallaxtoleft' => t('Parallax to Left'),
      'parallaxtotop' => t('Parallax to Top'),
      'parallaxtobottom' => t('Parallax to Bottom'),
      'scaledownfromright' => t('Zoom Out and Fade From Right'),
      'scaledownfromleft' => t('Zoom Out and Fade From Left'),
      'scaledownfromtop' => t('Zoom Out and Fade From Top'),
      'scaledownfrombottom' => t('Zoom Out and Fade From Bottom'),
      'zoomout' => t('ZoomOut'),
      'zoomin' => t('ZoomIn'),
      'slotzoom-horizontal' => t('Zoom Slots Horizontal'),
      'slotzoom-vertical' => t('Zoom Slots Vertical'),
      'curtain-1' => t('Curtain from Left'),
      'curtain-2' => t('Curtain from Right'),
      'curtain-3' => t('Curtain from Middle'),
      '3dcurtain-horizontal' => t('3D Curtain Horizontal'),
      '3dcurtain-vertical' => t('3D Curtain Vertical'),
      'cube' => t('Cube Vertical'),
      'cube-horizontal' => t('Cube Horizontal'),
      'incube' => t('In Cube Vertical'),
      'incube-horizontal' => t('In Cube Horizontal'),
      'turnoff' => t('TurnOff Horizontal'),
      'turnoff-vertical' => t('TurnOff Vertical'),
      'papercut' => t('Paper Cut'),
      'flyin' => t('Fly In'),
      'random-static' => t('Random Flat'),
      'random-premium' => t('Random Premium'),
      'random' => t('Random Flat and Premium/Default'),
    ),
  );

  $form['mtt_settings']['slideshows_tab']['slideshow']['revolution_slider_internal']['rs_slideshow_internal_effect_time'] = array(
    '#type' => 'textfield',
    '#title' => t('Effect duration (sec)'),
    '#default_value' => theme_get_setting('rs_slideshow_internal_effect_time', 'ocms_education'),
    '#description'   => t('Set the speed of animations, in seconds.'),
  );

  $form['mtt_settings']['slideshows_tab']['slideshow']['revolution_slider_internal']['rs_slideshow_internal_initial_height'] = array(
    '#type' => 'textfield',
    '#title' => t('Initial Height (px)'),
    '#default_value' => theme_get_setting('rs_slideshow_internal_initial_height', 'ocms_education'),
    '#description'   => t('Set the initial height, in pixels.'),
  );

  $form['mtt_settings']['slideshows_tab']['slideshow']['revolution_slider_internal']['rs_slideshow_internal_bullets_position'] = array(
    '#type' => 'select',
    '#title' => t('Navigation bullets position'),
    '#description'   => t('From the drop-down menu, select the position you prefer.'),
    '#default_value' => theme_get_setting('rs_slideshow_internal_bullets_position', 'ocms_education'),
    '#options' => array(
      'left' => t('Left'),
      'center' => t('Center'),
      'right' => t('Right'),
    ),
  );

  $form['mtt_settings']['google_maps_tab']['google_maps_settings'] = array(
    '#type' => 'details',
    '#title' => t('Google Maps Settings'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
    '#group' => 'tabs',
  );

  $form['mtt_settings']['google_maps_tab']['google_maps_settings']['google_maps_key'] = array(
    '#type' => 'textfield',
    '#title' => t('Google Maps API Key'),
    '#description'   => t('Google requires an API key to be included to all calls to Google Maps API. Please create an API key and populate the above field.'),
    '#default_value' => theme_get_setting('google_maps_key','ocms_education'),
    '#size'          => 50,
    '#maxlength'     => 50,
  );

}
<file_sep>/docroot/modules/custom/ocms_unpublish/src/Plugin/views/field/ScheduledExpirationRange.php
<?php

namespace Drupal\ocms_unpublish\Plugin\views\field;

use Drupal\Core\Datetime\DrupalDateTime;
use Drupal\views\Plugin\views\field\FieldPluginBase;
use Drupal\views\ResultRow;
use DateTime;

/**
 * Field handler to for date range until expiration.
 *
 * @ingroup views_field_handlers
 *
 * @ViewsField("scheduled_expiration_range")
 */
class ScheduledExpirationRange extends FieldPluginBase {

  /**
   * {@inheritdoc}
   */
  public function query() {
    // Leave empty to avoid a query on this field.
  }

  /**
   * {@inheritdoc}
   */
  public function render(ResultRow $values) {
    $node = $values->_entity;

    // Unpublished scheduled_update entity.
    $unpublished_tid = $node->schedule_unpublished_date->target_id;
    if ($unpublished_tid) {
      $schedule_unpublished_entity = \Drupal::entityTypeManager()
        ->getStorage('scheduled_update')
        ->load($unpublished_tid);

      $unpublished_datetime = DrupalDateTime::createFromTimestamp($schedule_unpublished_entity->update_timestamp->value);
      $now = new DateTime();
      $diff = $unpublished_datetime->diff($now);

      if ($diff->days > 90) {
        $diff_range = '> 90';
      }
      elseif ($diff->days > 60) {
        $diff_range = '90';
      }
      elseif ($diff->days > 30) {
        $diff_range = '60';
      }
      elseif ($diff->days > 15) {
        $diff_range = '30';
      }
      elseif ($diff->days > 5) {
        $diff_range = '15';
      }
      elseif ($diff->days > 1) {
        $diff_range = '5';
      }
      else {
        $diff_range = '01';
      }

      return $this->t('@expire_group', array('@expire_group' => $diff_range));
    }
    else {
      return $this->t('No scheduled unpublish date');
    }
  }

}
<file_sep>/docroot/modules/custom/ocms_linkchecker/src/OcmsLinkcheckerFilteringInterface.php
<?php

namespace Drupal\ocms_linkchecker;

/**
 * Defines an interface for the Link filtering services.
 */
interface PupLinkcheckerFilteringInterface {

  /**
   * Calls the core check_markup function with the "filters to skip" argument.
   *
   * @see: https://api.drupal.org/api/drupal/core%21modules%21filter%21filter.module/function/check_markup/8.3.x
   */
  public function checkMarkup($text, $formatId = NULL, $langcode = '');
}
<file_sep>/docroot/themes/custom/ocms_corporate/js/init/owl-carousel-testimonials-init.js
jQuery(document).ready(function($) {
  $(".view-testimonials-carousel .owl-carousel.testimonials").owlCarousel({
    items: 4,
    itemsDesktopSmall: [992,2],
    itemsTablet: [768,2],
    autoPlay: drupalSettings.ocms_corporate.owlCarouselTestimonialsInit.owlTestimonialsEffectTime,
    navigation: true,
    pagination: false
  });
});
<file_sep>/docroot/themes/custom/ocms_showcase/js/init/video-background-init.js
jQuery(document).ready(function($) {
  $("body").addClass("video-bg-active");
  $(".video-bg-active .media-background").vide({
    mp4: drupalSettings.ocms_showcase.VideoBackgroundInit.PathToVideo_mp4,
    webm: drupalSettings.ocms_showcase.VideoBackgroundInit.PathToVideo_webm,
    poster: drupalSettings.ocms_showcase.VideoBackgroundInit.pathToVideo_jpg
  },{
    posterType: 'jpg',
    className: 'video-container'
  });
});<file_sep>/docroot/themes/custom/ocms_base/js/header-mobile.js
+function ($) {
  'use strict';

	//  Set variables 
	var dropdownBody = $('#block-infomenumobile').find('.dropdown-menu'),
      dropdownBtn = $('#block-infomenumobile').find('.dropdown-toggle'),
      mobileMenuBtns = $('.ocms-header-mobile-menu').children(),
      on = 'none',
      clicked,
      btnThatWasOn,
      faCaretIcon = $('<i class="fa fa-angle-down pull-right" aria-hidden="true"></i>');
  
  $(dropdownBtn).click(function(e){
    e.preventDefault();
  });

  // Change behavior of dropdown in info sub-menu to collapse
  $(dropdownBtn).removeAttr('href data-target data-toggle');
  $('.caret').replaceWith(faCaretIcon);
  $(dropdownBody).attr('class', 'collapse');
  $(dropdownBtn).click(function(){
    $(dropdownBody).collapse('toggle');
  });

  $('#ocms-mobile-navbar-infoBtn').mouseup(function(){
      $(this).removeClass('mobile-navbar-close').addClass('mobile-info-icon');
  });
  $('#ocms-mobile-navbar-infoBtn').mousedown(function(){
      $(this).removeClass('mobile-info-icon').addClass('mobile-navbar-close');
  });

  // Click behavior for mobile menu buttons
  $(mobileMenuBtns).click(function(){
    // var target = $(this).data("target");
    var btnThatWasClicked = $(this);
    var wasClickedTarget = $(btnThatWasClicked).data('target');


    // Version #3: Non-Exclusive Button Toggling

    // Turn off the button that was on, if any, including the clicked button
    if ($(btnThatWasOn) != undefined) {
      $(btnThatWasOn).removeClass('ocms-toggle-onBtn-color');
      switch ($(btnThatWasOn).attr('id')) { 
        case 'ocms-mobile-navbar-searchBtn': 
          $(btnThatWasOn).css({"background-color": "#EAF2FA", "color": "black", "border": "none"});
          break;
        case 'ocms-mobile-navbar-menuBtn': 
          $(btnThatWasOn).addClass('mobile-menu-icon').removeClass('mobile-navbar-close');
          break;		
        default:
      }
      $($(btnThatWasOn).data('target')).collapse('hide');
    }
    // Turn on the clicked button unless it was already on
    if (wasClickedTarget != $(btnThatWasOn).data('target')) {
      switch ($(btnThatWasClicked).attr('id')) { 
        case 'ocms-mobile-navbar-searchBtn': 
          $(btnThatWasClicked).css({"background-color": "#2DA5E5", "color": "white", "border": "1px solid #CCCCCC"});
          break;
        case 'ocms-mobile-navbar-menuBtn': 
          $(btnThatWasClicked).removeClass('mobile-menu-icon').addClass('mobile-navbar-close');
          break;		
        default:
      }
      $(wasClickedTarget).collapse('show');
    }
    // Change the value of btnThatWasOn, but only after we use it above
    if (wasClickedTarget == $(btnThatWasOn).data('target')) {
      btnThatWasOn = undefined;
    } else {
      btnThatWasOn = btnThatWasClicked;
    }

  });

}(jQuery);
<file_sep>/docroot/themes/custom/ocms_base/js/footer.js
/* ================================================/
/===========  AccordionJavascript ====================/
/========  This is used to apply dynamically =======/
/==========  Accordion classes and ids   ===========/
/=============================================== */
;(function($){
    'use strict';
    // Setting the ocms-footer Accordion object
    var Accordion = Accordion || {},
        foot = $('.ocms-footer').find(':header'), // finding all ocms-footer headers
        fnav = $('.ocms-footer').find('ul'); // finding all ocms-footer uls

    Accordion = {
        // Setup mobile view
        addingClsNids: function(elem) {            
                $(fnav).addClass('collapse');
                $(foot).addClass("collapsed");  
                $(fnav).each(function(item, ele) { // for ul interactions
                    elem = $(ele).attr('id', 'ocms-foot-collapse-' + (item + 1)); 
                });  
                $(foot).each(function(item, ele) { // for h2 interactions
                    elem = $(ele).attr({
                        "data-toggle" : "collapse",
                        "data-parent" : "#ocms-footer-accordion",
                        "href"        : "#ocms-foot-collapse-"  + (item + 1)
                    });
                });                      
                $(foot).click(function(event) {
                    if($(event.currentTarget).siblings('ul').hasClass('collapse')) {
                        $(this).addClass("up").toggleClass("collapsed");
                        $(this).find('ul').toggleClass('collapse');
                    } else {
                        $(this).addClass("collapsed").toggleClass("up");
                    }
                });
            return false;
        },
        // Setup desktop view        
        removingClsNids: function() { 
            $(fnav).attr({'id':'', 'ocms-foot-collapse-': ''});                        
            $(fnav).removeClass('collapse');
            $(foot).attr({"data-toggle" : "","data-parent" : "","href" : ""}).removeClass('collapsed');
            return false;
        }
    }
    $(window).resize( function() {
        if (window.innerWidth <= 768) { // mobile views
            Accordion.addingClsNids();
        } else {
            Accordion.removingClsNids();
        }
    });
})(jQuery);<file_sep>/docroot/modules/custom/ocms_linkchecker/src/OcmsLinkcheckerAccessService.php
<?php

namespace Drupal\ocms_linkchecker;

use Drupal\Core\Database\Connection;

/**
 * Implements the PupLinkcheckerAccessInterface.
 */
class PupLinkcheckerAccessService implements PupLinkcheckerAccessInterface {

  /**
   * Drupal's database service.
   *
   * @var \Drupal\Core\Database\Connection
   */
  protected $connection;

  /**
   * OCMS Linkchecker Utility Service.
   *
   * @var \Drupal\ocms_linkchecker\PupLinkcheckerUtilityInterface
   */
  protected $utilityService;

  /**
   * Constructs the OCMS Linkchecker Access Service object.
   *
   * @param \Drupal\Core\Database\Connection
   *   The database connection
   * @param \Drupal\ocms_linkchecker\PupLinkcheckerUtilityInterface $ocms_linkchecker_utility
   *   The OCMS Linkchecker Utility Service.
   */
  public function __construct(Connection $database, PupLinkcheckerUtilityInterface $ocms_linkchecker_utility) {
    $this->connection = $database;
    $this->utilityService = $ocms_linkchecker_utility;
  }

  /**
   * {@inheritdoc}
   */
  public function accessBlockIds($link) {
  }

  /**
   * {@inheritdoc}
   */
  public function accessCommentIds($link, $commentAuthorAccount = NULL) {
  }

  /**
   * {@inheritdoc}
   */
  public function accessLink($link) {
  }

  /**
   * {@inheritdoc}
   */
  public function accessNodeIds($link, $nodeAuthorAccount = NULL) {
    static $fieldsWithNodeLinks = array();

    // Exit if all node types are disabled or if the user cannot access content.
    $linkcheckerScanNodeTypes = $this->utilityService->scanNodeTypes();
//    if (empty($linkchecker_scan_nodetypes) || !user_access('access content')) {
    if (empty($linkcheckerScanNodeTypes)) {
      return array();
    }

    // @todo: Port over the rest of the logic that actually checks for access
    //        This is just a cherry-picked snippet of the code I'm supposed to
    //        have.
    $query = $this->connection->select('node', 'n');
    $query->innerJoin('ocms_linkchecker_entity', 'le', 'le.entity_id = n.nid');
    $query->condition('le.lid', $link->lid);
    $query->condition('le.entity_type', 'node');
    $query->fields('n', array('nid'));

    $nodes = $query->execute();
    foreach ($nodes as $node) {
      $nids[] = $node->nid;
    }
    return $nids;
  }
}
<file_sep>/docroot/themes/custom/ocms_corporate/js/init/flexslider-testimonials-init.js
jQuery(document).ready(function($) {
  if ($(".view-testimonials-slider").length>0){
    $(window).load(function() {
      $(".view-testimonials-slider .flexslider").fadeIn("slow");
      $(".view-testimonials-slider .flexslider").flexslider({
        animation: drupalSettings.ocms_corporate.flexsliderTestimonialsInit.TestimonialsSliderEffect,
        slideshowSpeed: drupalSettings.ocms_corporate.flexsliderTestimonialsInit.TestimonialsSliderEffectTime,
        useCSS: false,
        prevText: "prev",
        nextText: "next",
        controlNav: false
      });
    });
  }
});
<file_sep>/docroot/modules/custom/ocms_linkchecker/src/Form/LinkSettingEdit.php
<?php

namespace Drupal\ocms_linkchecker\Form;

use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Datetime\DateFormatterInterface;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\ocms_linkchecker\PupLinkcheckerUtilityInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;

class LinkSettingEdit extends FormBase {

  /**
   * OCMS Linkchecker Utility Service.
   *
   * @var \Drupal\ocms_linkchecker\PupLinkcheckerUtilityInterface
   */
  protected $utilityService;

  /**
   * The config factory.
   *
   * @var \Drupal\Core\Config\ConfigFactoryInterface
   */
  protected $configFactory;

  /**
   * The date formatter service.
   *
   * @var \Drupal\Core\Datetime\DateFormatterInterface
   */
  protected $dateFormatter;

  /**
   * Constructs a form object.
   *
   * @param \Drupal\ocms_linkchecker\PupLinkcheckerUtilityInterface $ocms_linkchecker_utility
   *   The OCMS Linkchecker Utility Service.
   * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
   *   The factory for configuration objects.
   * @param \Drupal\Core\Datetime\DateFormatterInterface $date_formatter
   *   The date formatter
   */
  public function __construct(PupLinkcheckerUtilityInterface $ocms_linkchecker_utility, ConfigFactoryInterface $config_factory, DateFormatterInterface $date_formatter) {
    $this->utilityService = $ocms_linkchecker_utility;
    $this->configFactory = $config_factory;
    $this->dateFormatter = $date_formatter;
  }

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container) {
    return new static(
      $container->get('ocms_linkchecker.utility'),
      $container->get('config.factory'),
      $container->get('date.formatter')
    );
  }

  /**
   * {@inheritdoc}
   */
  public function getFormId() {
    return 'ocms_linkchecker_link_setting_edit';
  }

  /**
   * {@inheritdoc}
   */
  public function buildForm(array $form, FormStateInterface $form_state, $linkId = NULL) {

  $link = $this->utilityService->loadLink($linkId);
  $config = $this->configFactory->get('ocms_linkchecker.settings');

  $form['settings'] = array(
    '#type' => 'fieldset',
    '#title' => t('Settings'),
    '#collapsible' => FALSE
  );

  $form['settings']['link'] = array('#type' => 'value', '#value' => $link);

  $form['settings']['message'] = array(
    '#type' => 'item',
    '#markup' => $this->t('The link <a href="@url">@url</a> was last checked on @lastChecked and failed @failCount times.', array('@url' => $link->url, '@failCount' => $link->fail_count, '@lastChecked' => $this->dateFormatter->format($link->last_checked)))
  );

  $form['settings']['method'] = array(
    '#type' => 'select',
    '#title' => $this->t('Select request method'),
    '#default_value' => $link->method,
    '#options' => array(
      'HEAD' => $this->t('HEAD'),
      'GET' => $this->t('GET'),
    ),
    '#description' => $this->t('Select the request method used for link checks of this link. If you encounter issues like status code 500 errors with the HEAD request method you should try the GET request method before ignoring a link.'),
  );

  $form['settings']['status'] = array(
    '#default_value' => $link->status,
    '#type' => 'checkbox',
    '#title' => $this->t('Check link status'),
    '#description' => $this->t("Uncheck if you wish to ignore this link. Use this setting only as a last resort if there is no other way to solve a failed link check."),
  );

  $form['maintenance'] = array(
    '#type' => 'fieldset',
    '#title' => t('Maintenance'),
    '#collapsible' => FALSE,
  );

  $form['maintenance']['recheck'] = array(
    '#default_value' => 0,
    '#type' => 'checkbox',
    '#title' => $this->t('Re-check link status on next cron run'),
    '#description' => $this->t('Enable this checkbox if you want to re-check the link during the next cron job rather than wait for the next scheduled check on @date.', array('@date' => $this->dateFormatter->format($link->last_checked + $config->get('check.interval')))),
  );

    $form['actions'] = ['#type' => 'actions'];
    $form['actions']['submit'] = [
      '#type' => 'submit',
      '#value' => $this->t('Save Configuration'),
    ];

    return $form;
  }

  /**
   * {@inheritdoc}
   */
  public function submitForm(array &$form, FormStateInterface $form_state) {
    $values = $form_state->getValues();
    $link = $values['link'];

    // Force link re-check asap.
    if ($values['recheck']) {
      $link->last_checked = 0;
      drupal_set_message($this->t('The link %url will be checked again on the next cron run.', array('%url' => $link->url)));
    }

    if ($values['method'] != $link->method) {
      // Update settings and reset statistics for a quick re-check.
      $link->method = $values['method'];
      $link->fail_count = 0;
      $link->last_checked = 0;
      $link->status = $values['status'];
      drupal_set_message(t('The link settings for %url have been saved and the fail counter has been reset.', array('%url' => $link->url)));
    }
    else {
      // Update setting only.
      $link->method = $values['method'];
      $link->status = $values['status'];
      drupal_set_message(t('The link settings for %url have been saved.', array('%url' => $link->url)));
    }

    $this->utilityService->updateLink($link);
  }

}
<file_sep>/docroot/modules/custom/ocms_files/ocms_file_operations/ocms_file_operations.api.php
<?php

/**
 * @file
 * Hooks provided by the  module.
 */

/**
 * Implements hook_form_alter().
 */
function hooks_form_alter() {
  
}

/**
 * Submit handler for media published.
 */
function hooks_form_submit_handler() {
  
}

/*
 * Implements hooks_cron() for the remove Temp folders 
 */

function hooks_cron() {
  
}
<file_sep>/docroot/modules/custom/ocms_linkchecker/src/OcmsLinkcheckerReplacementInterface.php
<?php

namespace Drupal\ocms_linkchecker;

/**
 * Defines an interface for the Link replacement services.
 */
interface PupLinkcheckerReplacementInterface {

  /**
   * Replaces the old url by a new url on 301 status codes.
   *
   * @param string $entityType
   *   The type of entity; e.g., 'node', 'comment'.
   * @param string $bundleName
   *   The name of the bundle aka node type, e.g., 'article', 'page'.
   * @param object $entity
   *   The entity to parse, a $node or a $comment object.
   * @param string $oldUrl
   *   The previous url.
   * @param string $newUrl
   *   The new url to replace the old.
   *
   * @return object
   */
  public function replaceFields($entityType, $bundleName, $entity, $oldUrl, $newUrl);

  /**
   * Replaces an old link with a new link in text.
   *
   * @param string $text
   *   The text a link is inside. Passed in as a reference.
   * @param string $oldLink
   *   The old link to search for in strings.
   * @param string $newLink
   *   The old link should be overwritten with this new link.
   */
  public function replaceLink(&$text, $oldLink, $newLink);
}
<file_sep>/docroot/modules/custom/ocms_linkchecker/src/OcmsLinkcheckerDatabaseService.php
<?php

namespace Drupal\ocms_linkchecker;

use Drupal\Component\Utility\Crypt;
use Drupal\Core\Database\Connection;
use Drupal\node\NodeInterface;

/**
 * Implements the PupLinkcheckerDatabaseInterface
 */
class PupLinkcheckerDatabaseService implements PupLinkcheckerDatabaseInterface {

  /**
   * OCMS Linkchecker Extraction Service.
   *
   * @var \Drupal\ocms_linkchecker\PupLinkcheckerExtractionInterface
   */
  protected $extractionService;

  /**
   * OCMS Linkchecker Utility Service.
   *
   * @var \Drupal\ocms_linkchecker\PupLinkcheckerUtilityInterface
   */
  protected $utilityService;

  /**
   * Drupal's database service.
   *
   * @var \Drupal\Core\Database\Connection
   */
  protected $connection;

  /**
   * Constructs the OCMS Linkchecker Database Service object.
   *
   * @param \Drupal\ocms_linkchecker\PupLinkcheckerExtractionInterface $ocms_linkchecker_extraction
   *   The OCMS Linkchecker Extraction Service.
   * @param \Drupal\ocms_linkchecker\PupLinkcheckerUtilityInterface $ocms_linkchecker_utility
   *   The OCMS Linkchecker Utility Service.
   * @param \Drupal\Core\Database\Connection
   *   The database connection
   */
  public function __construct(PupLinkcheckerExtractionInterface $ocms_linkchecker_extraction, PupLinkcheckerUtilityInterface $ocms_linkchecker_utility, Connection $database) {
    $this->extractionService = $ocms_linkchecker_extraction;
    $this->utilityService = $ocms_linkchecker_utility;
    $this->connection = $database;
  }

  /**
   * {@inheritdoc}
   */
  public function addNodeLinks($node, $skipMissingLinksDetection = FALSE) {
    $links = array_keys($this->extractionService->extractNodeLinks($node));

    // The node had links
    if (!empty($links)) {
      // Remove all links from the links array already in the database and only
      // add missing links to database.
      $missingLinks = $this->getMissingNodeReferences($node, $links);

      // Only add links to database that do not exists.
      $i = 0;
      // @todo: Make this a configurable value
      $maxLinksLimit = 100;
      foreach ($missingLinks as $url) {
        $urlhash = Crypt::hashBase64($url);
        $link = $this->connection->query('SELECT lid FROM {ocms_linkchecker_link} WHERE urlhash = :urlhash', array(':urlhash' => $urlhash))->fetchObject();
        if (!$link) {
          $link = new \stdClass();
          $link->lid = $this->connection->insert('ocms_linkchecker_link')
            ->fields(array(
              'urlhash' => $urlhash,
              'url' => $url,
              'status' => $this->utilityService->shouldCheckLink($url)
            ))
            ->execute();
        }

        $this->connection->insert('ocms_linkchecker_entity')
          ->fields(array(
            'entity_id' => $node->nid->value,
            'entity_type' => 'node',
            'bundle' => $node->bundle(),
            'langcode' => $node->language()->getId(),
            'lid' => $link->lid,
          ))
          ->execute();

        // Break processing if max links limit per run has been reached.
        $i++;
        if ($i >= $maxLinksLimit) {
          break;
        }
      }

      // The first chunk of links not yet found in the {ocms_linkchecker_link}
      // table have now been imported by the above code. If the number of
      // missing links still exceeds $maxLinksLimit the content need to be
      // re-scanned until all links have been collected and saved in
      // {ocms_linkchecker_link} table.
      //
      // Above code has already scanned a number of $maxLinksLimit links and
      // need to be  substracted from the number of missing links to calculate
      // the correct number of re-scan rounds.
      //
      // To prevent endless loops the $skipMissingLinksDetection need to be
      // TRUE. This value will be set by the calling batch process that already
      // knows that it is running a batch job and the number of required re-scan
      // rounds.
      $missingLinksCount = count($missingLinks) - $maxLinksLimit;
      if (!$skipMissingLinksDetection && $missingLinksCount > 0) {
        // @todo: I'm not worrying about processing in batch right now.
        //        Just fire of something to load some links.
        //module_load_include('inc', 'linkchecker', 'linkchecker.batch');
        //batch_set(_linkchecker_batch_import_single_node($node->nid->value, $missing_links_count));

        // If batches were set in the submit handlers, we process them now,
        // possibly ending execution. We make sure we do not react to the batch
        // that is already being processed (if a batch operation performs a
        // drupal_execute).
        //if ($batch = &batch_get() && !isset($batch['current_set'])) {
          //batch_process('node/' . $node->nid->value);
        //}
      }
    }

    // Remove dead link references for cleanup reasons as very last step.
    $this->deleteExpiredNodeReferences($node, $links);
  }

  /**
   * {@inheritdoc}
   */
  public function addCommentLinks($comment, $skipMissingLinksDetection = FALSE) {
  }

  /**
   * {@inheritdoc}
   */
  public function addBlockLinks($block, $bid, $skipMissingLinksDetection = FALSE) {
  }

  /**
   * {@inheritdoc}
   */
  public function deleteNodeLinks(NodeInterface $node) {
    $this->connection->delete('ocms_linkchecker_entity')
      ->condition('entity_id', $node->nid->value)
      ->condition('entity_type', 'node')
      ->condition('langcode', $node->language()->getId())
      ->execute();
  }

  /**
   * {@inheritdoc}
   */
  public function setBrokenNodeReferences(NodeInterface $node) {
    if ($node->language()) {
      $url = $node->toUrl('canonical', ['absolute' => true, 'language' => $node->language()]);
      if ($node->language()->isDefault()) {
        $permaLink = '/node/' . $node->nid->value;
      }
      else {
	$permaLink = '/' . $node->language()->getId() . '/node/' . $node->nid->value;
      }
    }
    else {
      $url = $node->toUrl('canonical', ['absolute' => true]);
      $permaLink = '/node/' . $node->nid->value;
    }
    $aliasedUrl = $url->toString();
    $this->connection->update('ocms_linkchecker_link')
      ->fields(array(
	'code' => 404,
	'error' => 'Not Found',
	'fail_count' => 1,
	'last_checked' => REQUEST_TIME
      ))
      ->condition('url', $aliasedUrl)
      ->execute();
    // This is just being extra careful to make sure that both the aliased and
    // unaliased links are marked as broken. Some pieces of content may be
    // referencing this node with its alias and others with is "permalink."
    // Unfortunately, we don't have a guaranteed way to know about any
    // past aliases that this node had. Those old aliases will just have to
    // work their way through the Broken Links report.
    $uri = @parse_url($aliasedUrl);
    if ($uri['path'] != $permaLink) {
      $unaliasedUrl = str_replace($uri['path'], $permaLink, $aliasedUrl);
      $this->connection->update('ocms_linkchecker_link')
        ->fields(array(
        'code' => 404,
        'error' => 'Not Found',
        'fail_count' => 1,
        'last_checked' => REQUEST_TIME
       ))
       ->condition('url', $unaliasedUrl)
       ->execute();
    }
  }

  /**
   * {@inheritdoc}
   */
  public function deleteCommentLinks($comment) {
    $this->connection->delete('ocms_linkchecker_entity')
      ->condition('entity_id', $comment->cid->value)
      ->condition('entity_type', 'comment')
      ->condition('langcode', $comment->language()->getId())
      ->execute();
  }

  /**
   * {@inheritdoc}
   */
  public function deleteBlockLinks($block) {
  }

  /**
   * {@inheritdoc}
   */
  public function deleteExpiredNodeReferences(NodeInterface $node, $links = array()) {
    if (empty($links)) {
      // Node do not have links. Delete all references if exists.
      $this->connection->delete('ocms_linkchecker_entity')
        ->condition('entity_id', $node->nid->value)
        ->condition('entity_type', 'node')
        ->condition('langcode', $node->language()->getId())
        ->execute();
    }
    else {
      // The node still have more than one link, but other links may have been
      // removed and links no longer in the content need to be deleted from the
      // linkchecker_node reference table.
      // @todo: Switch to using the Utility service
      $urlsHashed = array();
      foreach ($links as $link) {
        $urlsHashed[] = Crypt::hashBase64($link);
      }
      $keepLinks = $this->connection->select('ocms_linkchecker_link')
        ->fields('ocms_linkchecker_link', array('lid'))
        ->condition('urlhash', $urlsHashed, 'IN')
        ->execute()
        ->fetchAllKeyed(0,0);

      $this->connection->delete('ocms_linkchecker_entity')
        ->condition('entity_id', $node->nid->value)
        ->condition('entity_type', 'node')
        ->condition('langcode', $node->language()->getId())
        ->condition('lid', $keepLinks, 'NOT IN')
        ->execute();
    }
  }

  /**
   * {@inheritdoc}
   */
  public function deleteExpiredCommentReferences($comment, $links = array()) {
  }

  /**
   * {@inheritdoc}
   */
  public function deleteBlockReferences($block, $links = array()) {
  }

  /**
   * {@inheritdoc}
   */
  public function getMissingNodeReferences(NodeInterface $node, $links) {
    // @todo: Switch to using the Utility service
    $urlsHashed = array();
    foreach ($links as $link) {
      $urlsHashed[] = Crypt::hashBase64($link);
    }
    $keepLinks = $this->connection->select('ocms_linkchecker_link', 'll');
    $keepLinks->innerJoin('ocms_linkchecker_entity', 'le', 'le.lid = ll.lid');
    $keepLinks->fields('ll', array('url'));
    $keepLinks->condition('ll.urlhash', $urlsHashed, 'IN');
    $keepLinks->condition('le.entity_id', $node->nid->value);
    $keepLinks->condition('le.entity_type', 'node');
    $keepLinks->condition('le.langcode', $node->language()->getId());
    $results=$keepLinks->execute()->fetchAllKeyed(0,0);
    $linksInDatabase = array();
    foreach ($results as $row) {
      $linksInDatabase[] = $row;
    }
    return array_diff($links, $linksInDatabase);
  }

  /**
   * {@inheritdoc}
   */
  public function getMissingCommentReferences($comment, $links) {
  }

  /**
   * {@inheritdoc}
   */
  public function getMissingBlockReferences($block, $links) {
  }

  /**
   * {@inheritdoc}
   */
  public function unpublishNodes($lid) {
  }
}
<file_sep>/docroot/modules/custom/ocms_linkchecker/src/BrokenLinksTableTrait.php
<?php

namespace Drupal\ocms_linkchecker;

use Drupal\Component\Utility\Html;
use Drupal\Core\Link;
use Drupal\Core\Url;

/**
 * Provides logic to build the table of broken links.
 */
trait BrokenLinksTableTrait {

  /**
   * Builds the broken links report table with pager.
   */
  public function build() {

  $links_unchecked = $this->connection->query('SELECT COUNT(1) FROM {ocms_linkchecker_link} WHERE last_checked = :last_checked AND status = :status', array(':last_checked' => 0, ':status' => 1))->fetchField();
  if ($links_unchecked > 0) {
    $links_all = $this->connection->query('SELECT COUNT(1) FROM {ocms_linkchecker_link} WHERE status = :status', array(':status' => 1))->fetchField();
    drupal_set_message($this->translation->formatPlural($links_unchecked,
      'There is 1 unchecked link of about @links_all links in the database. Please be patient until all links have been checked via cron.',
      'There are @count unchecked links of about @links_all links in the database. Please be patient until all links have been checked via cron.',
      array('@links_all' => $links_all)), 'warning');
  }

    $query = $this->query;

    $header = array(
      array('data' => $this->t('URL'), 'field' => 'url', 'sort' => 'desc'),
      array('data' => $this->t('Response'), 'field' => 'code', 'sort' => 'desc'),
      array('data' => $this->t('Error'), 'field' => 'error'),
      array('data' => $this->t('Operations')),
    );

    $result = $query
      ->limit(50)
      ->orderByHeader($header)
      ->execute();

    // Evaluate permission once for performance reasons.
    $accessEditLinkSettings = $this->currentUser->hasPermission('edit link settings');
    $accessAdministerBlocks = $this->currentUser->hasPermission('administer blocks');
    $accessAdministerRedirects = $this->currentUser('administer redirects');

    $rows = array();
    foreach ($result as $link) {
      // Get the node, block and comment IDs that refer to this broken link and
      // that the current user has access to.
      $nids = $this->access->accessNodeIds($link, $this->currentUser);
//    $cids = _linkchecker_link_comment_ids($link, $this->currentUser);
//    $bids = _linkchecker_link_block_ids($link);

    // If the user does not have access to see this link anywhere, do not
    // display it, for reasons explained in _linkchecker_link_access(). We
    // still need to fill the table row, though, so as not to throw off the
    // number of items in the pager.
//    if (empty($nids) && empty($cids) && empty($bids)) {
    if (empty($nids)) {
        $rows[] = array(array('data' => $this->t('Permission restrictions deny you access to this broken link.'), 'colspan' => count($header)));
        continue;
      }

      $links = array();

      // Show links to link settings.
      if ($accessEditLinkSettings) {
	$url = Url::fromRoute('ocms_linkchecker.edit_link', array('linkId' => $link->lid), array('query' => $this->redirectDestination->getAsArray()));
        $links[] = Link::fromTextAndUrl($this->t('Edit link settings'), $url)->toString();
      }

      // Show link to nodes having this broken link.
      foreach ($nids as $nid) {
        $url = Url::fromUri('internal:/node/' . $nid . '/edit', array('query' => $this->redirectDestination->getAsArray()));
        $links[] = Link::fromTextAndUrl($this->t('Edit node @node', array('@node' => $nid)), $url)->toString();
      }

    // Show link to comments having this broken link.
//    $comment_types = linkchecker_scan_comment_types();
//    if (module_exists('comment') && !empty($comment_types)) {
//      foreach ($cids as $cid) {
//        $links[] = l(t('Edit comment @comment', array('@comment' => $cid)), 'comment/' . $cid . '/edit', array('query' => drupal_get_destination()));
//      }
//    }

    // Show link to blocks having this broken link.
//    if ($accessAdministerBlocks) {
//      foreach ($bids as $bid) {
//        $links[] = l(t('Edit block @block', array('@block' => $bid)), 'admin/structure/block/manage/block/' . $bid . '/configure', array('query' => drupal_get_destination()));
//      }
//    }

    // Show link to redirect this broken internal link.
//    if (module_exists('redirect') && $access_administer_redirects && _linkchecker_is_internal_url($link)) {
//      $links[] = l(t('Create redirection'), 'admin/config/search/redirect/add', array('query' => array('source' => $link->internal, drupal_get_destination())));
//    }

      $url = Url::fromUri($link->url);
      // Create table data for output.
      $rows[] = array(
        'data' => array(
          Link::fromTextAndUrl(Html::escape($link->url), $url)->toString(),
          Html::escape($link->code),
          Html::escape($link->error),
          ['data' => ['#theme' => 'item_list', '#items' => $links]],
        ),
      );
    }

    $build['broken_links_table'] = array(
      '#type' => 'table',
      '#header' => $header,
      '#rows' => $rows,
      '#empty' => $this->t('No broken links have been found.'),
    );
    $build['broken_links_pager'] = array('#type' => 'pager');

    // I think I may not need to set cache meta data
    // @todo: How do I want to cache this page?
    //        Will I use cache tags, cache contexts, both of them?
    //$build['#cache']['tags'][] = 'node_list';
    return $build;
  }
}
<file_sep>/docroot/themes/custom/ocms_education/js/custom/fixed-header.js
  /**
  * Add Javascript - Fixed Header
  */
jQuery(document).ready(function($) {
  var preHeaderHeight = $("#pre-header").outerHeight(),
  headerTopHeight = $("#header-top").outerHeight(),
  headerHeight = $("#header").outerHeight();
  $(window).load(function() {
    if(($(window).width() > 767)) {
      $("body").addClass("fixed-header-enabled");
    } else {
      $("body").removeClass("fixed-header-enabled");
    }
  });
  $(window).resize(function() {
    if(($(window).width() > 767)) {
      $("body").addClass("fixed-header-enabled");
    } else {
      $("body").removeClass("fixed-header-enabled");
    }
  });
  $(window).scroll(function() {
    if(($(this).scrollTop() > preHeaderHeight + headerTopHeight) && ($(window).width() > 767)) {
      $("body").addClass("onscroll");
      $("#header + div").css("paddingTop", (headerHeight)+"px");
      var adminHeight = $('body').css('paddingTop');
      $("#header").css("top", adminHeight);
    } else {
      $("body").removeClass("onscroll");
      $("#header").css("top", (0)+"px");
      $("#header + div").css("paddingTop", (0)+"px");
    }
  });
});
<file_sep>/docroot/modules/custom/ocms_linkchecker/src/OcmsLinkcheckerUtilityService.php
<?php

namespace Drupal\ocms_linkchecker;

use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Database\Connection;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\State\StateInterface;

/**
 * Implements the PupLinkcheckeryUtilityInterface.
 */
class PupLinkcheckerUtilityService implements PupLinkcheckerUtilityInterface {

  /**
   * The config factory.
   *
   * @var \Drupal\Core\Config\ConfigFactoryInterface
   */
  protected $configFactory;

  /**
   * The state service.
   *
   * @var \Drupal\Core\State\StateInterface
   */
  protected $state;

  /**
   * Drupal's database service.
   *
   * @var \Drupal\Core\Database\Connection
   */
  protected $connection;

  /**
   * Drupal's entity type manager service.
   *
   * @var \Drupal\Core\Entity\EntityTypeManagerInterface
   */
  protected $entityTypeManager;

  /**
   * Constructs the OCMS Linkchecker Utility Service object.
   *
   * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
   *   The factory for configuration objects.
   * @param \Drupal\Core\State\StateInterface
   *   The state service
   * @param \Drupal\Core\Database\Connection
   *   The database connection
   * @param \Drupal\Core\Entity\EntityTypeManagerInterface
   *   The entity type manager service
   */
  public function __construct(ConfigFactoryInterface $config_factory, StateInterface $state, Connection $database, EntityTypeManagerInterface $entity_type_manager) {
    $this->configFactory = $config_factory;
    $this->state = $state;
    $this->connection = $database;
    $this->entityTypeManager = $entity_type_manager;
  }

  /**
   * {@inheritdoc}
   */
  public function isValidResponseCode($responseCode) {
  }

  /**
   * {@inheritdoc}
   */
  public function isDefaultrevision($entity) {
  }

  /**
   * {@inheritdoc}
   */
  public function recurseArrayValues(array $array) {
    $arrayValues = array();

    foreach ($array as $value) {
      if (is_array($value)) {
        $arrayValues = array_merge($arrayValues, $this->recurseArrayValues($value));
      }
      else {
        $arrayValues[] = $value;
      }
    }

    return $arrayValues;
  }

  /**
   * {@inheritdoc}
   */
  public function shouldCheckLink($url) {
    $config = $this->configFactory->get('ocms_linkchecker.settings');
    $status = TRUE;

    // Is url in domain blacklist?
    $excludedUrls = $config->get('check.disable_for_urls');
    if (!empty($excludedUrls)) {
      $excludeLinks = preg_split('/(\r\n?|\n)/', $excludedUrls);
      $escapedExcludedLinks = array();
      foreach ($excludeLinks as $excludeLink) {
        $escapedExcludedLinks[] = preg_quote($excludeLink, '/');
      }
      $pattern = implode('|', $escapedExcludedLinks);
      if (preg_match('/' . $pattern . '/', $url)) {
        $status = FALSE;
      }
    }

    // Protocol whitelist check (without curl, only http/https is supported).
    if (!preg_match('/^(https?):\/\//i', $url)) {
      $status = FALSE;
    }

    return $status;
  }

  /**
   * {@inheritdoc}
   */
  public function isInternalUrl(&$link) {
  }

  /**
   * {@inheritdoc}
   */
  public function getBlock($bid) {
  }

  /**
   * {@inheritdoc}
   */
  public function scanNodeTypes() {
    $types = array();
    foreach (node_type_get_names() as $type => $name) {
      $scanNode = $this->state->get('ocms_linkchecker.scan_node_' . $type) ?: 0;
      if ($scanNode) {
        $types[$type] = $type;
      }
    }
    return $types;
  }

  /**
   * {@inheritdoc}
   */
  public function scanCommentTypes() {
  }

  /**
   * {@inheritdoc}
   */
  public function impersonateUser($newUser = NULL) {
  }

  /**
   * {@inheritdoc}
   */
  public function revertUser() {
  }

  /**
   * {@inheritdoc}
   */
  public function loadLink($lid) {
    return $this->connection->query('SELECT *
      FROM {ocms_linkchecker_link}
      WHERE lid = :lid',
      array(':lid' => $lid)
    )->fetchObject();
  }

  /**
   * {@inheritdoc}
   */
  public function updateLink($link) {
    $this->connection->update('ocms_linkchecker_link')
      ->fields(array(
        'method' => $link->method,
	'fail_count' => $link->fail_count,
	'last_checked' => $link->last_checked,
	'status' => $link->status
      ))
      ->condition('lid', $link->lid)
      ->execute();
  }

  /**
   * {@inheritdoc}
   */
  public function loadEntity($entityType, $id) {
    return $this->entityTypeManager->getStorage($entityType)->load($id);
  }

}
<file_sep>/docroot/sites/settings.php
<?php

/**
 * @file
 * Drupal site-specific configuration file.
 *
 */

 $databases = array();

 #   $databases['default']['default'] = array(
 #    'driver' => 'pgsql',
 #     'database' => 'databasename',
 #     'username' => 'sqlusername',
 #     'password' => '<PASSWORD>',
 #     'host' => 'localhost',
 #     'prefix' => '',
 #  );

$config_directories = array();
$config_directories = array(
    CONFIG_SYNC_DIRECTORY => '../config',
);
$settings['hash_salt'] = '';

$settings['update_free_access'] = FALSE;

# $settings['omit_vary_cookie'] = TRUE;

# $settings['file_chmod_directory'] = 0775;
# $settings['file_chmod_file'] = 0664;

# $settings['file_public_base_url'] = 'http://downloads.example.com/files';

 $settings['file_public_path'] = 'downloads';

 $settings['file_private_path'] = '../files-private';


# $settings['session_write_interval'] = 180;


# $settings['locale_custom_strings_en'][''] = array(
#   'forum'      => 'Discussion board',
#   '@count min' => '@count minutes',
# );

# $settings['maintenance_theme'] = 'bartik';


# ini_set('pcre.backtrack_limit', 200000);
# ini_set('pcre.recursion_limit', 200000);

# $config['system.site']['name'] = 'My Drupal site';
# $config['system.theme']['default'] = 'stark';
$config['user.settings']['anonymous'] = 'Visitor';

$settings['container_yamls'][] = $app_root . '/' . $site_path . '/services.yml';

$settings['file_scan_ignore_directories'] = [
  'node_modules',
  'bower_components',
];


 if (file_exists($app_root . '/' . $site_path . '/settings.local.php')) {
   include $app_root . '/' . $site_path . '/settings.local.php';
 }

$settings['trusted_host_patterns'] = array(
   '^dev.ocms.lamtech\.sl',
   '^.+\.gov\.sl',
   '^lamtech\.sl',
   '^.+\.lamtech\.sl',
 );

$settings['install_profile'] = 'lightning';
<file_sep>/docroot/modules/custom/ocms_files/ocms_file_operations/src/Tests/Kernel/TestFileOperations.php
<?php

namespace Drupal\Tests\irs_file_operations\Kernel;

use Drupal\Tests\irs_file_operations;
use Drupal\Core\Language\Language;
use Drupal\Core\Entity;
use Drupal\KernelTests\Core\Entity\EntityKernelTestBase;

/**
 * Tests token handling.
 *
 * @requires module token
 * @requires module entity
 *
 * @group media_entity
 */
class TestFileOperations extends EntityKernelTestBase {

  /**
   * {@inheritdoc}
   */
  protected function setUp() {
    parent::setUp();
  }

  public function testMediaBundleCreation() {
    $fid = 1;

    $directory = 'simpletestpup/ebook/';
    $source = DRUPAL_ROOT . '/media_unpublish/' . $directory;
    $destination = DRUPAL_ROOT . '/sites/default/files/' . $directory . 'tmp';
    
    $directory_created = file_prepare_directory($destination, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS);
    
    if($directory_created) {
      $this->assertTrue($directory_created);

      $files = file_scan_directory($source, '/.*\.(txt|pdf|doc|docx)$/');

      if(!empty($files)) {
        foreach ($files as $file) {
          $result = file_unmanaged_copy($file->uri, $destination, FILE_EXISTS_REPLACE);
          $this->assertTrue($result,"Unable to copy {$file->uri} to $destination.");
        }
      }
      else {
        $this->assertTrue(!empty($files), "Files does not exist!");
      }

    }
    else {
      $this->assertTrue($directory_created, "Unable to create directory $destination.");
    }
    
    
  }

  /**
   * Tests some of the tokens provided by media_entity.
   */
  

}
<file_sep>/docroot/themes/custom/ocms_base/js/node--article.js
+function ($) {
  'use strict';

	//  Set variables 
	var accordHeadings = $('.content').find('.ocms-accordion-heading'), 
			accordBodies = $('.content').find('.ocms-accordion-body');

	// Add id to the parent element
	$('.content').attr( "id", "article-accordion-content");

	function classesAndIds() {
		if (window.innerWidth <= 768) { 
			// add classes and ids in mobile view
			$(accordBodies).addClass('collapse');
			$(accordHeadings).addClass('collapsed');
			$(accordBodies).each(function(item, element){
				var el = $(element).attr({"id"	: "collapse-" + (item+1)});
			});
			$(accordHeadings).each(function(item, element) {
				var el = $(element).attr({
					"data-toggle"   : "collapse",
					"data-parent"   : "#article-accordion-content",
					"href" 		      : "#collapse-" + (item +1)
				});
			});
			} else {
			// remove classes and ids in desktop view
			$(accordBodies).removeAttr('id href style').removeClass('collapse');
			$(accordHeadings).removeAttr('data-toggle data-parent href').removeClass('collapsed');
		}
	};

	$(window).resize( function() {
		classesAndIds();
	});

	classesAndIds();
	
}(jQuery);
<file_sep>/docroot/modules/custom/ocms_hierarchical_taxonomy_menu/src/Plugin/Block/OcmsHierarchicalTaxonomyMenuBlock.php
<?php

namespace Drupal\ocms_hierarchical_taxonomy_menu\Plugin\Block;

use Drupal\Core\Block\BlockBase;
use Drupal\Core\Entity\EntityFieldManagerInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Language\LanguageManagerInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\Core\Template\Attribute;
use Drupal\field\Entity\FieldConfig;
use Drupal\taxonomy\Entity\Term;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
 * Provides a 'PupHierarchicalTaxonomyMenuBlock' block.
 *
 * @Block(
 *  id = "ocms_hierarchical_taxonomy_menu",
 *  admin_label = @Translation("OCMS Hierarchical Taxonomy Menu"),
 *  category = @Translation("OCMS Custom"),
 *   context = {
 *     "node" = @ContextDefinition(
 *       "entity:node",
 *       label = @Translation("Current Node")
 *     )
 *   }
 * )
 */
class PupHierarchicalTaxonomyMenuBlock extends BlockBase implements ContainerFactoryPluginInterface {

  /**
   * The entity field manager.
   *
   * @var \Drupal\Core\Entity\EntityFieldManager
   */
  protected $entityFieldManager;

  /**
   * The term storage handler.
   *
   * @var \Drupal\taxonomy\TermStorageInterface
   */
  protected $storageController;

  /**
   * The language manager.
   *
   * @var \Drupal\Core\Language\LanguageManagerInterface
   */
  protected $languageManager;

  /**
   * Constructs a PupHierarchicalTaxonomyMenuBlock object.
   *
   * @param \Drupal\Core\Entity\EntityFieldManagerInterface $entity_field_manager
   *   The entity field manager service
   * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
   *   The entity type manager service.
   * @param \Drupal\Core\Language\LanguageManagerInterface $language_manager
   *   The language manager service.
   */
  public function __construct(
    array $configuration,
    $plugin_id,
    $plugin_definition,
    EntityFieldManagerInterface $entity_field_manager,
    EntityTypeManagerInterface $entity_type_manager,
    LanguageManagerInterface $language_manager
  ) {
    parent::__construct($configuration, $plugin_id, $plugin_definition);
    $this->entityFieldManager = $entity_field_manager;
    $this->storageController = $entity_type_manager->getStorage('taxonomy_term');
    $this->languageManager = $language_manager;
  }

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
    return new static(
      $configuration,
      $plugin_id,
      $plugin_definition,
      $container->get('entity_field.manager'),
      $container->get('entity_type.manager'),
      $container->get('language_manager')
    );
  }

  /**
   * {@inheritdoc}
   */
  public function defaultConfiguration() {
    return [
      'vocabulary' => '',
    ];
  }

  /**
   * {@inheritdoc}
   */
  public function blockForm($form, FormStateInterface $form_state) {
    $form['vocabulary'] = [
      '#title' => $this->t('Vocabulary'),
      '#type' => 'select',
      '#options' => $this->getVocabularyOptions(),
      '#required' => TRUE,
      '#default_value' => $this->configuration['vocabulary'],
    ];
    return $form;
  }

  /**
   * Generate vocabulary select options.
   */
  private function getVocabularyOptions() {
    $options = [];
    $vocabularies = taxonomy_vocabulary_get_names();
    foreach ($vocabularies as $vocabulary) {
      $options[$vocabulary] = $vocabulary;
    }
    return $options;
  }

  /**
   * {@inheritdoc}
   */
  public function blockSubmit($form, FormStateInterface $form_state) {
    $this->configuration['vocabulary'] = $form_state->getValue('vocabulary');
  }

  /**
   * {@inheritdoc}
   */
  public function build() {
    $node = $this->getContextValue('node');
    $nodeReferencesConfiguredVocabulary = false;
    $fields = $this->entityFieldManager->getFieldDefinitions('node', $node->getType());
    foreach ($fields as $field) {
      if (($field instanceof FieldConfig) && method_exists($field, 'getSettings')) {
        $settings = $field->getSettings();
        if (isset($settings['handler_settings']['target_bundles']) && in_array($this->configuration['vocabulary'], $settings['handler_settings']['target_bundles'])) {
          $nodeReferencesConfiguredVocabulary = true;
          $nodeVocabularyReferenceField = $field->getName();
          continue;
        }
      }
    }
    if ($nodeReferencesConfiguredVocabulary) {
      $language = $this->languageManager->getCurrentLanguage()->getId();
      $nodeReferencedTid = $node->get($nodeVocabularyReferenceField)->getValue()[0]['target_id'];

      // Load the parents of the current term
      // Note: This also loads the current term itself
      $parentsObjects = $this->storageController->loadAllParents($nodeReferencedTid);
      $parentsIds = [];
      foreach ($parentsObjects as $parentObject) {
        $parentsIds[] = $parentObject->id();
      }

      // The root term is Level 1
      $levels = count($parentsIds);
      if ($levels >= 2) {
        $activeTrailIndex = $levels - 2;
        $activeTrailId = $parentsIds[$activeTrailIndex];
	$activeParentId = $parentsIds[1];
      }
      else {
        $activeTrailId = 0;
	$activeParentId = 0;
      }
      $vocabularyConfig = $this->configuration['vocabulary'];
      $vocabularyConfig = explode('|', $vocabularyConfig);
      $vocabulary = isset($vocabularyConfig[0]) ? $vocabularyConfig[0] : NULL;
      $vocabularyTree = $this->storageController->loadTree($vocabulary, 0, NULL, FALSE);

      $listItems = [];
      foreach ($vocabularyTree as $item) {
        $includeItem = false;
        $parentId = 0;
	if (in_array($item->tid, $parentsIds)) {
          // This is a parent that we want to show
          $includeItem = true;
          $level = $levels - array_search($item->tid, $parentsIds);
          $itemsParentsObjects = $this->storageController->loadParents($item->tid);
          foreach ($itemsParentsObjects as $parentObject) {
            if (in_array($parentObject->id(), $parentsIds) && ($parentObject->id() != $nodeReferencedTid)) {
              $parentId = $parentObject->id();
              break;
            }
          }
        }
        else {
          $itemsParentsObjects = $this->storageController->loadParents($item->tid);
          foreach ($itemsParentsObjects as $parentObject) {
            if (in_array($parentObject->id(), $parentsIds)) {
              // This is a child of a parent that we are showing
	      // Note: This results in showing the children of the active term,
	      //       which is exactly as the client requested. 
              $includeItem = true;
              $level = $levels - array_search($parentObject->id(), $parentsIds) + 1;
              $parentId = $parentObject->id();
              break;
            }
          }
        }
        if ($includeItem) {
          if ($item->tid == $nodeReferencedTid) {
            $class = [
              'level-' . $level,
              'is-active',
            ];
	  }
          else {
            $class = [
              'level-' . $level,
            ];
	  }
          if ($item->tid == $activeTrailId) {
            $class[] = 'is-active-trail';
	  }
          if ($item->tid == $activeParentId) {
            $class[] = 'is-active-parent';
	  }
          $term = Term::load($item->tid);
          $translationLanguages = $term->getTranslationLanguages();
          if (isset($translationLanguages[$language])) {
            $itemTranslated = $term->getTranslation($language);
          }
          else {
            $itemTranslated = $term;
          }
	  $options = [
            'title' => $itemTranslated->label(),
            'id' => $this->t('term-:termId', array(':termId' => $itemTranslated->id())),
            'rel' => $parentId ? 'child' : 'parent',
          ];
	  $listItems[] = [
            'title' => $itemTranslated->label(),
            'id' => $itemTranslated->id(),
            'url' => $itemTranslated->toUrl(),
            'options' => $options,
            'attributes' => new Attribute([
              'class' => $class,
              'data-indent-level' => $level,
            ]),
            'parentId' => $parentId,
	    'below' => [],
          ];
        }
      }

      $items = [];
      // The items *should* already be in an order such that a child will never
      // appear before the parent has already been loaded. Just to make this
      // more robust we will use a while loop and unset elements as they are
      // placed in the hierarchy found.
      while ($listItems) {
        foreach ($listItems as $key => $item) {
          if ($item['parentId']) {
            $found = $this->setItemBelow($items, $item);
          }
          else {
            $items[$item['id']] = $item;
            $found = true;
          }
          if ($found) {
            unset($listItems[$key]);
	  }
	}
      }

      // There should be only one root key.
      $rootKey = array_keys($items);

      // We never show Level 1 (root) items in the secondary navigation.
      if (isset($items[$rootKey[0]]['below'])) {
        $items = $items[$rootKey[0]]['below'];
      }
      else {
        $items = [];
      }
      if ($items) {
        return [
          '#theme' => 'ocms_hierarchical_taxonomy_menu',
          '#items' => $items,
        ];
      }
    }
  }

  /**
   * Places an item in its parent's below attribute
   * 
   * @param array $items
   *   The master item tree
   * @param object $item
   *   The item being processed
   */
  private function setItemBelow(&$items, $item) {
    if (isset($items[$item['parentId']])) {
      $items[$item['parentId']]['below'][$item['id']] = $item;
      return true;
    }
    else {
      foreach ($items as $itemId => $itemArray) {
        $found = $this->setItemBelow($itemArray['below'], $item);
        if ($found) {
          $items[$itemId]['below'] = $itemArray['below'];
          return true;
	}
      }
    }
  }

}
