Exemplo n.º 1
0
 /**
  * Merge asked configuration with default configuration
  *
  * @param array $configuration asked configuration from the manifest
  * @param array $default       default configuration
  *
  * @return array merged configuration
  *
  * @see   Tools::parseBooleans();
  * @since 1.2.0
  */
 protected function mergeConfigurationWithDefault($configuration, $default)
 {
     if (is_array($configuration)) {
         return array_merge($default, $configuration);
     } elseif (Tools::parseBooleans($configuration)) {
         return $default;
     }
 }
Exemplo n.º 2
0
 /**
  * Registration method
  *
  * @return void
  *
  * @see   Feature::$configuration
  * @see   Feature::enableSVG();
  * @see   Tools::parseBooleans();
  * @see   https://codex.wordpress.org/Function_Reference/add_filter
  * @since 1.2.0
  */
 protected function registration()
 {
     foreach ($this->configuration as $option => $status) {
         Tools::parseBooleans($status);
         switch ($option) {
             case 'svg-upload':
                 if ($status === true) {
                     $this->enableSVG();
                 }
                 break;
             case 'comments':
                 if ($status === false) {
                     $this->removeComments();
                 }
                 break;
             case 'widgets':
                 if ($status === false) {
                     $this->removeWidgets();
                 }
                 break;
             case 'widget':
                 if ($status === false) {
                     $this->removeWidgets();
                 }
                 break;
             case 'cleanup':
                 if ($status === true || is_array($status)) {
                     new CleanUp($status);
                 }
                 break;
             case 'js-detection':
                 if ($status === true) {
                     $this->enableJSDetection();
                 }
                 break;
             case 'all-settings':
                 if ($status === true) {
                     $this->enableAllSettingsPage();
                 }
                 break;
         }
     }
 }