Register color panel, sections, controls, and settings.

@action customize_register
@since  1.0.0

@param WP_Customize_Manager $wp_customize
762816
public function colors( WP_Customize_Manager $wp_customize ) {

		$wp_customize->add_panel(
			'colors',
			array(
				'title'       => esc_html__( 'Colors', 'rock' ),
				'description' => 'Get what you need.',
				'priority'    => 40,
			)
		);

		$wp_customize->add_section(
			'colors-scheme',
			array(
				'title' => esc_html__( 'Color Schemes', 'rock' ),
				'panel' => 'colors',
			)
		);

		$wp_customize->add_section(
			'colors-header',
			array(
				'title' => esc_html__( 'Header', 'rock' ),
				'panel' => 'colors',
			)
		);

		$wp_customize->add_section(
			'colors-menu',
			array(
				'title' => esc_html__( 'Menu', 'rock' ),
				'panel' => 'colors',
			)
		);

		$wp_customize->add_section(
			'colors-buttons',
			array(
				'title' => esc_html__( 'Buttons', 'rock' ),
				'panel' => 'colors',
			)
		);

		$wp_customize->add_section(
			'colors-content',
			array(
				'title' => esc_html__( 'Content', 'rock' ),
				'panel' => 'colors',
			)
		);

		$wp_customize->add_section(
			'colors-footer',
			array(
				'title' => esc_html__( 'Footer', 'rock' ),
				'panel' => 'colors',
			)
		);

		foreach ( $this->colors as $name => $args ) {

			$this->register_color_setting( $wp_customize, $name, $args );

		}

	}
1061480
private function register_commands() {
		foreach ( $this->commands as $class_name ) {
			\WP_CLI::add_command( $class_name::COMMAND_NAME, $class_name );
		}
	}
398020
protected function registerAssets()
    {
        do_action("before_theme_register_assets");

        $assets = $this->getConfig("assets");

        add_action("wp_enqueue_scripts", function () use ($assets) {
            foreach ($assets as $id => $asset) :
                $file = strpos($asset["file"], "//") === false ? get_template_directory_uri() . "/public/" . $asset["file"] : $asset["file"];
                if ($asset["type"] == "js") :
                    wp_enqueue_script($id, $file, $asset["dependencies"], $asset["version"], $asset["footer"]);
                elseif ($asset["type"] == "css") :
                    wp_enqueue_style($id, $file, $asset["dependencies"], $asset["version"], "all");
                endif;
            endforeach;
        });

        do_action("after_theme_register_assets");
    }
568940
public function init() {

		if ( ! Book::isBook() ) {
			// Not a book, disable
			return;
		}
		if ( class_exists( '\Pressbooks\CustomCss' ) && CustomCss::isCustomCss() ) {
			// Uses old Custom CSS Editor, disable
			return;
		}

		// Code Mirror
		if ( isset( $_REQUEST['page'] ) && $_REQUEST['page'] === $this::PAGE ) {
			add_action(
				'admin_enqueue_scripts', function () {
					wp_enqueue_script( 'wp-codemirror' );
					wp_enqueue_script( 'csslint' );
					wp_enqueue_style( 'wp-codemirror' );
				}
			);
		}

		add_action(
			'init', function () {
				// Admin Menu
				add_action(
					'admin_menu', function () {
						add_theme_page( __( 'Custom Styles', 'pressbooks' ), __( 'Custom Styles', 'pressbooks' ), 'edit_others_posts', $this::PAGE, [ $this, 'editor' ] );
					}, 11
				);
				// Register Post Types
				$this->registerPosts();
			}
		);

		// Catch form submission
		add_action( 'init', [ $this, 'formSubmit' ], 50 );
	}
1093997
function registerThemeDirectories() {

		/**
		 * Register additional theme directories.
		 *
		 * Additional theme directories (e.g. those within another plugin, or custom
		 * subdirectories of wp-content) may be registered via this action hook.
		 *
		 * @since 3.8.0
		 */
		do_action( 'pressbooks_register_theme_directory' );

		if ( is_admin() ) {
			if ( Book::isBook() ) {
				add_filter( 'allowed_themes', [ $this, 'allowedBookThemes' ] );
			} elseif ( ! is_network_admin() ) {
				add_filter( 'allowed_themes', [ $this, 'allowedRootThemes' ] );
			}
		}
	}
1214102
public function add(WPCustomizer $wp_customizer)
    {
        if (!$this->id && !$this->object) {
            return;
        }

        $wp_customizer->add_panel(($this->object ?: $this->id), $this->args);

        \array_walk(
            $this->sections,
            function (
                AbstractSection $section,
                string $key
            ) use ($wp_customizer) {
                $section->add($wp_customizer);
            }
        );
    }
866676
protected function registerPlugins()
    {
        if (isset($this->clientOptions['plugins']) && count($this->clientOptions['plugins'])) {
            foreach ($this->clientOptions['plugins'] as $plugin) {
                $js = 'plugins/' . $plugin . '/' . $plugin . '.js';
                if (file_exists($this->sourcePath . DIRECTORY_SEPARATOR . $js)) {
                    $this->assetBundle->js[] = $js;
                }
                $css = 'plugins/' . $plugin . '/' . $plugin . '.css';
                if (file_exists($this->sourcePath . DIRECTORY_SEPARATOR . $css)) {
                    $this->assetBundle->css[] = $css;
                }
            }
        }
    }
794083
public function init()
    {
        // Get services
        $services = $this->getServices();

        // Register all
        foreach ($services as $alias => $service) {
            $this->add($service, $alias);
        }

        // Register configurations
        $this->initConfigs();

        // Register post types / terms / widgets / admin pages and more
        $this->registerComponents();
    }
253345
public function createPanels($wp_customize)
    {
        $data = $this->getData();

        // Move all default sections to the default panel
        $defaultPanel = $data['options']['default_panel'];
        $wp_customize->add_panel($defaultPanel['id'], array(
            'priority'    => 10,
            'title'       => Strings::translate($defaultPanel['title']),
            'description' => ''
        ));

        $existingSections = $wp_customize->sections();
        /** @var \WP_Customize_Section $section */
        foreach ($existingSections as $sectionId => $section) {
            if (empty($section->panel)) {
                $section->panel = $defaultPanel['id'];
            }
        }

        // Define additional panels and sections
        $panels = $data['panels'];
        $panelPriority = 1000;
        foreach ($panels as $panelProps) {
            if (isset($panelProps['title'])) {
                $panelId = 'panel-' . $panelPriority;
                $wp_customize->add_panel($panelId, array(
                    'priority'    => $panelPriority,
                    'title'       => Strings::translate($panelProps['title']),
                    'description' => Strings::translate($panelProps['description'])
                ));
            } else {
                $panelId = $defaultPanel['id'];
            }

            $sectionPriority = 10;
            foreach ($panelProps['sections'] as $sectionId => $sectionProps) {
                $wp_customize->add_section($sectionId, array(
                    'panel'       => $panelId,
                    'priority'    => $sectionPriority,
                    'title'       => Strings::translate($sectionProps['title']),
                    'description' => Strings::translate($sectionProps['description'])

                ));

                $sectionPriority += 10;
            }

            $panelPriority += 10;
        }

        return $wp_customize;
    }
1125681
public function registerAnimateCss()
    {
        if (isset($this->options['animation']) && $this->options['animation'] === false) {
            if (isset($this->options['customClass'])) {
                AnimateCssAsset::register($this->view);
            }
        }
    }
815632
public function register()
    {
        if (! $this->is('registered')) {
            call_user_func("wp_register_{$this->getType()}",
                $this->getSlug(),
                $this->getPath(),
                $this->getArgument('dependences'),
                $this->getArgument('version'),
                ($this->getPlacement() === 'footer') ? true : false
            );

            $this->localizeAsset();
        }

        return $this;
    }
70131
protected function registerSidebars()
    {
        do_action("before_theme_register_sidebars");

        foreach ($this->getConfig("sidebars") as $id => $sidebar):
            add_action("widgets_init", function () use ($id, $sidebar) {
                register_sidebar(array(
                    'name' => __($sidebar["name"], 'sections'),
                    'id' => $id,
                    'description' => __($sidebar["description"], 'sections'),
                    'before_widget' => $sidebar["before_widget"],
                    'after_widget' => $sidebar["after_widget"],
                    'before_title' => $sidebar["before_title"],
                    'after_title' => $sidebar["after_title"]
                ));
            });
        endforeach;

        do_action("after_theme_register_sidebars");
    }
956861
public function color_overlay_transparency( WP_Customize_Manager $wp_customize ) {

		$wp_customize->add_setting(
			'hero_image_color_overlay',
			array(
				'default'           => $this->get_color_overlay_transparency_default_value(),
				'sanitize_callback' => 'absint',
				'transport'         => 'postMessage',
			)
		);

		$wp_customize->add_control(
			'hero_image_color_overlay',
			array(
				'label'           => esc_html__( 'Hero Background Overlay', 'rock' ),
				'description'     => esc_html__( 'Control the color overlay transparency when using a custom Header Image.', 'rock' ),
				'section'         => 'colors-header',
				'priority'        => 20,
				'active_callback' => 'rock_has_hero_image',
				'type'            => 'range',
				'input_attrs'     => array(
					'min'  => 0,
					'max'  => 100,
					'step' => 1,
				),
			)
		);

	}
461952
public function register_cli() {
		if ( ! defined( 'WP_CLI' ) || ! WP_CLI ) {
			return;
		}
		self::$list[$this->table] = get_called_class();
		if ( self::$initialized ) {
			return;
		}
		\WP_CLI::add_command( "schema", \Hametuha\Pattern\Command::class );
		self::$initialized = false;
	}
518851
public function register_shortcode_ui() {
		$template = $this->get_page_template();
		$context  = [ 'page_template' => $template ];

		array_walk( $this->shortcode_uis,
			function ( ShortcodeUIInterface $shortcode_ui ) use ( $context ) {
				$shortcode_ui->register( $context );
			}
		);
	}
760236
public function register()
    {
        /** @var ThemeManager $theme */
        $theme = $this->app->make('wp.theme');

        Asset::add('theme_styles', 'css/theme.css', [], $theme->getHeader('version'))->to('front');
        Asset::add('theme_woo', 'css/woocommerce.css', ['theme_styles'], $theme->getHeader('version'))->to('front');
        Asset::add('theme_js', 'js/theme.min.js', [], $theme->getHeader('version'))->to('front');
    }
1029732
public function registerOptionPage($pluginName = null)
    {
        add_action('admin_init', array(&$this, 'adminInit'));
        if ($this->multiSite) {
            add_action('network_admin_menu', array(&$this, 'networkAdminMenu'));
            add_action('update_wpmu_options', array(&$this, 'adminUpdateOptions'));
        } else {
            add_action('admin_menu', array(&$this, 'adminMenu'));
        }
        if ($pluginName) {
            add_filter("plugin_action_links_" . $pluginName, array(&$this, 'settingsLink'));
        }
    }