Sets mobile views as `Mobile` theme.

Only needs to be called if auto is set to false.
Then you probably want to call this from your AppController::beforeRender().

@return void
974925
public function setMobile() {
		if ($this->isMobile === null) {
			$this->isMobile();
		}
		$forceMobile = $this->Controller->getRequest()->getSession()->read('User.mobile');

		if ($forceMobile !== null && !$forceMobile) {
			$this->setMobile = false;
		} elseif ($forceMobile !== null && $forceMobile || $this->isMobile()) {
			$this->setMobile = true;
		} else {
			$this->setMobile = false;
		}

		//$urlParams = Router::getParams(true);
		$urlParams = [];
		if (!isset($urlParams['pass'])) {
			$urlParams['pass'] = [];
		}
		$urlParams = array_merge($urlParams, $urlParams['pass']);
		unset($urlParams['pass']);
		if (isset($urlParams['prefix'])) {
			unset($urlParams['prefix']);
		}

		if ($this->setMobile) {
			$urlParams['?']['mobile'] = 0;
			$url = Router::url($urlParams);
			$this->Controller->set('desktopUrl', $url);
		} else {
			$urlParams['?']['mobile'] = 1;
			$url = Router::url($urlParams);
			$this->Controller->set('mobileUrl', $url);
		}

		Configure::write('User.setMobile', (int)$this->setMobile);

		if (!$this->setMobile) {
			return;
		}

		$this->Controller->viewBuilder()->setClassName('Theme');
		$this->Controller->viewBuilder()->setTheme('Mobile');
	}
553087
public function setActiveTheme($themeName = '')
    {
        Event::fire('theme.before_is_set', [$this]);

        if($themeName) {
            if(!self::ifExists($themeName)) {
                throw new \Exception($themeName . ' Theme  could not be found in file directory.');
            }
        }else{
            // return mobile theme if site is accessed from mobile or tablet
            if(settings('activateMobileTheme') && (MobileDetect::isMobile() || MobileDetect::isTablet()) ) {
                $themeName = settings('mobileActiveTheme');
            }else {
                // Theme from settings
                $themeName = settings('activeTheme');

                // Or return default theme of no theme is selected in settings
                if (!$themeName) {
                    $themeName = config('project.defaultTheme');
                }
            }
        }

        // Ensure theme exist
        if(!self::ifExists($themeName)) {
            throw new \Exception("Theme '$themeName' does not exist in Themes directory!");
        }

        self::$activeTheme = $themeName;

        $this->setConfig();

        Event::fire('theme.after_is_set', [$this]);
    }
633663
public function beforeRenderSiteTitle()
    {
        $controller = $this->_controller();

        $controller->set('siteTitle', $this->_getSiteTitle());
        $controller->set('siteTitleLink', $this->_getSiteTitleLink());
        $controller->set('siteTitleImage', $this->_getSiteTitleImage());
    }
176587
private function _setView()
	{
		if (preg_match('/^[a-z0-9_-]+$/', $this->_requestVars[1])) {
			$this->_view = $this->_requestVars[1];
        } else {
        	$this->_view = $this->_requestVars[1] = self::DEFAULT_VIEW;
        }

        return $this;
	}
1260403
public function setTheme(View $view, $themes)
    {
        $cacheKey = $this->getCacheKey($view);

        $this->themes[$cacheKey] = $themes;
    }
717032
public function Render()
    {
        if (strlen($this->_ankor) > 0) {
            WebApplication::$app->getResponse()->addJavaScript("window.location='#" . $this->_ankor . "'", true);
            $this->_ankor = '';
        }
        $this->beforeRender();
        $this->RenderImpl();
        $this->afterRender();
    }
919076
protected function set_active_styles() {

		$style = '.' . $this->id() . ' .dashicons.dashicons-plus-alt{ color: ' . $this->base_color() . ' !important;}';
		$style .= '.' . $this->id() . ' .column-handle{background-color: ' . $this->base_color() . ' !important;}';
		$style .= '.' . $this->id() . ' .uix-component-toolbar{background-color: ' . $this->base_color() . ' !important;}';
		$style .= '.' . $this->id() . '.processing:after {background: url(' . $this->url . 'assets/svg/loading.php?base_color=' . urlencode( str_replace( '#', '', $this->base_color() ) ) . ') no-repeat center center;}';

		uix_share()->set_active_styles( $style );

	}
438390
protected function beforeRender()
    {

        // secured page
        if (is_object($this->actualPage)) {
            if (!$this->getUser()->isLoggedIn() && $this->actualPage->getSecured()) {
                $this->redirect(':Frontend:Login:');
            }
        }

        if (is_object($this->actualPage)) {
            if ($this->actualPage->getLayout()) {
                $this->setLayout($this->actualPage->getLayout());
            } elseif ($this->actualPage->getDefault()) {
                $this->setLayout("layoutDefault");
            } else {
                $this->setLayout("layout");
            }
        }

        if ($this->isAjax()) {
            $this->invalidateControl('flashMessages');
        }

        $this->template->registerHelperLoader('\WebCMS\Helpers\SystemHelper::loader');

        // get top page for sidebar menu
        if (is_object($this->actualPage)) {
            $top = $this->actualPage;
            while ($top->getParent() != NULL && $top->getLevel() > 1) {
                $top = $top->getParent();
            }
        }

        // set up boxes
        $this->setUpBoxes();

        // load user defined scripts & styles
        $this->setPageScripts();
        $this->setPageStyles();

        // set default seo settings
        if (is_object($this->actualPage)) {
            $this->template->breadcrumb = $this->getBreadcrumbs();
            $this->template->sidebar = $this->getStructure($this, $top, $this->em->getRepository('WebCMS\Entity\Page'), false, $this->settings->get('Sidebar class', \WebCMS\Settings::SECTION_BASIC, 'text')->getValue(), false, false, null, $this->settings->get('Sidebar class', \WebCMS\Settings::SECTION_BASIC, 'text')->getValue());
        }

        $this->template->abbr = $this->abbr;
        $this->template->settings = $this->settings;
        // !params load from settings
        $this->template->structuresRaw = $this->em->getRepository('WebCMS\Entity\Page')->findBy(array(
            'language' => $this->language
        ));
        $this->template->structures = $this->getStructures(!$this->settings->get('Navbar dropdown', \WebCMS\Settings::SECTION_BASIC, 'text')->getValue(), $this->settings->get('Navbar class', \WebCMS\Settings::SECTION_BASIC, 'text')->getValue(), $this->settings->get('Navbar dropdown', \WebCMS\Settings::SECTION_BASIC, 'text')->getValue(), $this->settings->get('Navbar id', \WebCMS\Settings::SECTION_BASIC, 'text')->getValue());
        $this->template->setTranslator($this->translator);
        $this->template->actualPage = $this->actualPage;
        $this->template->user = $this->getUser();
        $this->template->activePresenter = $this->getPresenter()->getName();
        $this->template->language = $this->language;
        $this->template->languages = $this->em->getRepository('WebCMS\Entity\Language')->findAll();
    }
665626
public function prepareTheme()
    {
        $this->viewBuilder()->layout('default');
        if (!empty($this->request->params['prefix']) &&
            strtolower($this->request->params['prefix']) === 'admin'
        ) {
            $this->viewBuilder()->theme(option('back_theme'));
        } else {
            $this->viewBuilder()->theme(option('front_theme'));
        }

        if ($this->request->isAjax()) {
            $this->viewBuilder()->layout('ajax');
        }

        if ($this->request->isHome()) {
            $this->viewBuilder()->layout('home');
        }

        if ($this->request->isDashboard()) {
            $this->viewBuilder()->layout('dashboard');
        }
    }
1050558
protected function setRenderingHints()
	{
		// Test for post-processing in templates. Theorically allows for false positives and
		// false negatives, but not in any realistic setting
		$this->hints['postProcessing'] = (int) (strpos($this->xsl, 'data-s9e-livepreview-postprocess') !== false);
		$this->hints['ignoreAttrs']    = (int) (strpos($this->xsl, 'data-s9e-livepreview-ignore-attrs') !== false);
	}
666345
protected function applyViewRenderer() {
		//set the ViewRenderer
		$config = $this->getConfig();
		$inputData = $this->getSite()->getSanitizedInputData();
		if ($viewRendererName = $this->getViewRendererName()) {
			$this->getSite()->setViewRenderer(new $viewRendererName($this->getSite()->getGlobalUser(),$this->getSite()->getPages(),$inputData,(!empty($config['controllerConfig']) ? $config['controllerConfig']['name']:null)));
		} else {
			$this->logger->error("ViewRenderer Class not found");
			exit;
		}
	}
618970
public static function setup_theme() {

		global $pagenow;

		if ( ( is_admin() && 'themes.php' == $pagenow ) || ! self::can_switch_themes() ) {
			return;
		}

		self::check_reset();
		self::load_cookie();

		if ( empty( self::$theme ) ) {
			return;
		}

		add_filter( 'pre_option_template', array( self::$theme, 'get_template' ) );
		add_filter( 'pre_option_stylesheet', array( self::$theme, 'get_stylesheet' ) );
		add_filter( 'pre_option_stylesheet_root', array( self::$theme, 'get_theme_root' ) );
		$parent = self::$theme->parent();
		add_filter( 'pre_option_template_root', array( empty( $parent ) ? self::$theme : $parent, 'get_theme_root' ) );
		add_filter( 'pre_option_current_theme', '__return_false' );
	}
1346056
public function onBeforeInit() {
        $only_dev = LessCompilerConfig::config()->only_dev;
        
        // Only check and compile either on dev, or on all environments (if set)
        if (!$only_dev || $only_dev && Director::isDev()) {

            // Allow extensions for before less is compiled
            $this->owner->extend("onBeforeLessCompiler");

            $files = LessCompilerConfig::config()->file_mappings;
            $root_path = LessCompilerConfig::config()->root_path;
            $temp_folder = TEMP_FOLDER;
            
            if (is_array($files)) {
                $theme_dir = Controller::join_links(
                    "themes",
                    SSViewer::current_theme()
                );
                $base_theme = Controller::join_links(
                    $theme_dir,
                    SSViewer::current_theme()
                );
                
                $options = array('cache_dir' => $temp_folder);
                
                if (LessCompilerConfig::config()->compress) {
                    $options['compress'] = true;
                }
                
                // First loop through all files and deal with inputs
                foreach ($files as $input => $output) {
                    if ($input && $output) {
                        
                        // Does output and input contain a path
                        if (strpos($input, '/') === false) {
                            $input = Controller::join_links(
                                $theme_dir,
                                "less",
                                $input
                            );
                        }
                        
                        if (strpos($output, '/') === false) {
                            $output = Controller::join_links(
                                $theme_dir,
                                "css",
                                $output
                            );
                        }
                        
                        // Now append the full system path to the input
                        // and output file.
                        $input = Controller::join_links(BASE_PATH, $input);
                        $output = Controller::join_links(BASE_PATH, $output);
                        
                        // Finally try to compile our less files
                        try {
                            $css_file_name = Less_Cache::Get(
                                array( $input => $root_path),
                                $options
                            );
                            $css = file_get_contents(Controller::join_links($temp_folder,$css_file_name));
                            
                            $output_file = fopen($output, "w");
                            fwrite($output_file, $css);
                            fclose($output_file);
                        } catch (exception $e) {
                            error_log($e->getMessage());
                        }
                    }
                }
            }

            // Allow extensions for after less has compiled
            $this->owner->extend("onAfterLessCompiler");
        }
    }
202640
protected function _initView ()
    {
        // Create default view model, to be used in all templates and layouts
        $this->appView  = new \Zend\View\Model\ViewModel();

        // Convenience access variables
        $this->_appView = $this->appView;
        $this->view     = $this->appView;
        $this->_view    = $this->appView;
    }
415019
private function prepare(): void
  {
    $this->addClass(static::$class);

    if (static::$responsiveMediaQuery!==null && $this->getAttribute('id')===null)
    {
      $this->setAttrId(Html::getAutoId());
    }
  }
1292858
public function onBeforeWrite()
    {
        // Publish Icon Images:
        
        if ($this->owner->AppIconSmall()->exists()) {
            $this->owner->AppIconSmall()->publishRecursive();
        }
        
        if ($this->owner->AppIconLarge()->exists()) {
            $this->owner->AppIconLarge()->publishRecursive();
        }
        
        if ($this->owner->AppIconTouch()->exists()) {
            $this->owner->AppIconTouch()->publishRecursive();
        }
    }
630631
private function setActiveTheme()
    {
        if ($this->inAdministration()) {
            $themeName = $this->app['config']->get('society.core.core.admin-theme');

            return $this->app['stylist']->activate($themeName, true);
        }

        return $this->app['stylist']->activate($this->app['config']->get('society.core.core.frontend-theme'), true);
    }