update the currently used theme
342463
def create
      # the theme used is set in the settings area - this does the update of the current theme used
      Setting.where("setting_name = 'theme_folder'").update_all('setting' => params[:theme])
      Setting.reload_settings
      respond_to do |format|
        format.html { redirect_to admin_themes_path, notice: I18n.t("controllers.admin.themes.create.flash.success") }
      end
    end
906507
protected function get_current_theme()
	{
		if ( ! $this->is_logged_in() ) {
			throw new \Exception( "You are not logged in" );
		}

		$this->getSession()->visit( $this->locatePath( $this->get_admin_url() . '/themes.php' ) );
		$page = $this->getSession()->getPage();
		$e = $page->find( 'css', ".theme.active" );
		if ( $e ) {
			$classes = preg_split( "/\s+/", trim( $e->getAttribute( "aria-describedby" ) ) );
			$theme = preg_replace( "/\-(name|action)$/", "", $classes[0] );
			if ( $theme ) {
				return $theme;
			}
		}

		throw new \Exception( "Maybe you don't have permission to get the current theme." );
	}
304599
private function loadTheme()
    {
        if ($this->isThemeCacheValid()) {
            return;
        }
        $this->invalidateCache();

        $themeDir = $this->app['filesystem']->getDir('themes://' . $this->get('general/theme'));

        $this->data['theme'] = $this->parseTheme($themeDir, $this->data['general']);
    }
391239
public function setTheme()
    {
        $sTheme = $this->getEditObjectId();
        /** @var \OxidEsales\Eshop\Core\Theme $oTheme */
        $oTheme = oxNew(\OxidEsales\Eshop\Core\Theme::class);
        if (!$oTheme->load($sTheme)) {
            \OxidEsales\Eshop\Core\Registry::getUtilsView()->addErrorToDisplay(oxNew(\OxidEsales\Eshop\Core\Exception\StandardException::class, 'EXCEPTION_THEME_NOT_LOADED'));

            return;
        }
        try {
            $oTheme->activate();
            $this->resetContentCache();
        } catch (\OxidEsales\Eshop\Core\Exception\StandardException $exception) {
            Registry::getUtilsView()->addErrorToDisplay($exception);
            Registry::getLogger()->error($exception->getMessage(), [$exception]);
        }
    }
170500
public function AddUpdateCheck() {
      if (C('Garden.NoUpdateCheck'))
         return;

      // Check to see if the application needs to phone-home for updates. Doing
      // this here because this method is always called when admin pages are
      // loaded regardless of the application loading them.
      $UpdateCheckDate = Gdn::Config('Garden.UpdateCheckDate', '');
      if (
         $UpdateCheckDate == '' // was not previous defined
         || !IsTimestamp($UpdateCheckDate) // was not a valid timestamp
         || $UpdateCheckDate < strtotime("-1 day") // was not done within the last day
      ) {
         $UpdateData = array();
         
         // Grab all of the plugins & versions
         $Plugins = Gdn::PluginManager()->AvailablePlugins();
         foreach ($Plugins as $Plugin => $Info) {
            $Name = ArrayValue('Name', $Info, $Plugin);
            $Version = ArrayValue('Version', $Info, '');
            if ($Version != '')
               $UpdateData[] = array(
                  'Name' => $Name,
                  'Version' => $Version,
                  'Type' => 'Plugin'
               );
         }
         
         // Grab all of the applications & versions
         $ApplicationManager = Gdn::Factory('ApplicationManager');
         $Applications = $ApplicationManager->AvailableApplications();
         foreach ($Applications as $Application => $Info) {
            $Name = ArrayValue('Name', $Info, $Application);
            $Version = ArrayValue('Version', $Info, '');
            if ($Version != '')
               $UpdateData[] = array(
                  'Name' => $Name,
                  'Version' => $Version,
                  'Type' => 'Application'
               );
         }

         // Grab all of the themes & versions
         $ThemeManager = new Gdn_ThemeManager;
         $Themes = $ThemeManager->AvailableThemes();
         foreach ($Themes as $Theme => $Info) {
            $Name = ArrayValue('Name', $Info, $Theme);
            $Version = ArrayValue('Version', $Info, '');
            if ($Version != '')
               $UpdateData[] = array(
                  'Name' => $Name,
                  'Version' => $Version,
                  'Type' => 'Theme'
               );
         }

         // Dump the entire set of information into the definition list (jQuery
         // will pick it up and ping the VanillaForums.org server with this info).
         $this->AddDefinition('UpdateChecks', Gdn_Format::Serialize($UpdateData));
      }
   }
1323919
@Override
	public void installTheme(Theme theme) {
		this.removeCssLinks();
		if (this.currentTheme != null) {
			for (CssLink link : this.currentTheme.getLinks()) {
				link.getLink().removeFromParent();
			}
		}
		this.currentTheme = theme;
		this.resetTheme();
	}
640824
def update_buttons(self):
        """"""
        current_scheme = self.current_scheme
        names = self.get_option("names")
        try:
            names.pop(names.index(u'Custom'))
        except ValueError:
            pass
        delete_enabled = current_scheme not in names
        self.delete_button.setEnabled(delete_enabled)
        self.reset_button.setEnabled(not delete_enabled)
275538
def switch_theme(root_element, theme)
      old_map = @mapping
      new_map = map(theme)

      root_element.each_child do |e|
        old_classes = css_classes_for_map e.class.name, old_map
        new_classes = css_classes_for_map e.class.name, new_map
        update_element_css_classes(e, old_classes, new_classes)

        old_classes = css_classes_for_map e.class.superclass.name, old_map
        new_classes = css_classes_for_map e.class.superclass.name, new_map
        update_element_css_classes(e, old_classes, new_classes)
      end

      @mapping = new_map
    end
1090516
public function maybeUpdateStylesheets() {
		// If this is ajax/cron/404, don't update right now
		if ( wp_doing_ajax() || wp_doing_cron() || is_404() ) {
			return false;
		}

		// Compare current and previous Buckram versions
		$current_buckram_version = $this->getBuckramVersion();
		$last_buckram_version = get_option( 'pressbooks_buckram_version' );
		$buckram_updated = version_compare( $current_buckram_version, $last_buckram_version ) > 0;

		// Compare current and previous theme versions
		$theme = wp_get_theme();
		$current_theme_version = $theme->get( 'Version' );
		$last_theme_version = get_option( 'pressbooks_theme_version' );
		$theme_updated = version_compare( $current_theme_version, $last_theme_version ) > 0;

		// If either Buckram or the theme were updated, rebuild the web and editor stylesheets.
		if ( $buckram_updated || $theme_updated ) {
			// Try to stop a Cache Stampede, Dog-Pile, Cascading Failure...
			if ( ! get_transient( 'pressbooks_updating_stylesheet' ) ) {
				set_transient( 'pressbooks_updating_stylesheet', 1, 5 * MINUTE_IN_SECONDS );
				( new Modules\ThemeOptions\Admin() )->clearCache();
				$this->updateWebBookStyleSheet();
				update_editor_style();
				if ( $buckram_updated ) {
					update_option( 'pressbooks_buckram_version', $current_buckram_version );
				}
				if ( $theme_updated ) {
					update_option( 'pressbooks_theme_version', $current_theme_version );
				}
				delete_transient( 'pressbooks_updating_stylesheet' );
				return true;
			}
		}

		return false;
	}
642468
public function up()
    {

        $date = new Carbon;

        $themesController = DB::table('admin_controllers')->select('id')->where('controller', '=', 'themes')->first();
        $updateAction = DB::table('admin_actions')->select('id')->where('controller_id', '=', $themesController->id)->where('action', '=', 'update')->first();

        DB::table('admin_actions')->insert(
            array(
                array(
                    'controller_id' => $themesController->id,
                    'action' => 'forms',
                    'inherit' => 0,
                    'edit_based' => 0,
                    'name' => 'Change Form Rules',
                    'about' => null,
                    'created_at' => $date,
                    'updated_at' => $date
                )
            )
        );

        $lastInsertId = DB::getPdo()->lastInsertId();

        DB::table('user_roles_actions')->insert(
            array(
                array(
                    'role_id' => 2,
                    'action_id' => $updateAction->id,
                    'created_at' => $date,
                    'updated_at' => $date
                ),
                array(
                    'role_id' => 2,
                    'action_id' => $lastInsertId,
                    'created_at' => $date,
                    'updated_at' => $date
                )
            )
        );

        DB::table('admin_actions')->where('controller_id', '=', $themesController->id)->where('action', '=', 'update')->update(['inherit' => 0]);
        DB::table('admin_actions')->where('controller_id', '=', $themesController->id)->where('action', '=', 'index')->update(['name' => 'Show Theme Management']);

    }
44122
public function theme()
    {
        $keys = [
            'Theme_id'
        ];

        /** @var ThemeSettingsTable $ThemeSettings */
        $ThemeSettings = $this->loadModel('Wasabi/Cms.ThemeSettings');

        $settings = $ThemeSettings->getKeyValues(new GeneralSetting(), $keys);

        if ($this->request->is('post') && !empty($this->request->data)) {
            $settings = $ThemeSettings->newEntity($this->request->data);
            if (!$settings->errors()) {
                if ($ThemeSettings->saveKeyValues($settings, $keys)) {
                    $this->Flash->success(__d('wasabi_cms', 'The theme settings have been updated.'));
                    $this->redirect(['action' => 'theme']);
                    return;
                } else {
                    $this->Flash->error($this->dbErrorMessage);
                }
            } else {
                $this->Flash->error($this->formErrorMessage);
            }
        }
        $this->set([
            'settings' => $settings,
            'themes' => ThemeManager::getThemesForSelect()
        ]);
    }
517049
public function reset_theme_and_output() {
        global $COURSE, $SITE;

        $COURSE = clone($SITE);
        $this->_theme = null;
        $this->_wherethemewasinitialised = null;
        $this->_course = null;
        $this->_cm = null;
        $this->_module = null;
        $this->_context = null;
    }
541098
def update(self):
        '''
        
        '''
        self.image = self.blank.copy()
        vcenter_blit(self.image, 
                self.font.render(self.get(), True, self.color), 
                self.margin)
1174913
function reapplyDisplayStyles() {
    reapplyDisplayStyle(".show-Idl",        e_showIdl.checked)
    reapplyDisplayStyle(".show-JavaScript", e_showJavaScript.checked)
    reapplyDisplayStyle(".show-Java",       e_showJava.checked)
}
23586
public static void reset() {
        if ((_DEFAULT_THEME & COLOR_SCHEME_MASK) == 0) {
            _DEFAULT_THEME = DARK;
        }
        _THEME_MODIFIER = 0;
        _THEMES_MAP.clear();

        map(DARK,
                Holo_Theme);
        map(DARK | FULLSCREEN,
                Holo_Theme_Fullscreen);
        map(DARK | NO_ACTION_BAR,
                Holo_Theme_NoActionBar);
        map(DARK | NO_ACTION_BAR | FULLSCREEN,
                Holo_Theme_NoActionBar_Fullscreen);

        map(DARK | DIALOG,
                Holo_Theme_Dialog);
        map(DARK | DIALOG_WHEN_LARGE,
                Holo_Theme_DialogWhenLarge);
        map(DARK | DIALOG_WHEN_LARGE | NO_ACTION_BAR,
                Holo_Theme_DialogWhenLarge_NoActionBar);
        map(DARK | ALERT_DIALOG,
                Holo_Theme_Dialog_Alert);

        map(DARK | WALLPAPER,
                Holo_Theme_Wallpaper);
        map(DARK | NO_ACTION_BAR | WALLPAPER,
                Holo_Theme_NoActionBar_Wallpaper);
        map(DARK | FULLSCREEN | WALLPAPER,
                Holo_Theme_Fullscreen_Wallpaper);
        map(DARK | NO_ACTION_BAR | FULLSCREEN | WALLPAPER,
                Holo_Theme_NoActionBar_Fullscreen_Wallpaper);

        map(LIGHT,
                Holo_Theme_Light);
        map(LIGHT | FULLSCREEN,
                Holo_Theme_Light_Fullscreen);
        map(LIGHT | NO_ACTION_BAR,
                Holo_Theme_Light_NoActionBar);
        map(LIGHT | NO_ACTION_BAR | FULLSCREEN,
                Holo_Theme_Light_NoActionBar_Fullscreen);

        map(LIGHT | DIALOG,
                Holo_Theme_Dialog_Light);
        map(LIGHT | DIALOG_WHEN_LARGE,
                Holo_Theme_DialogWhenLarge_Light);
        map(LIGHT | DIALOG_WHEN_LARGE | NO_ACTION_BAR,
                Holo_Theme_DialogWhenLarge_Light_NoActionBar);
        map(LIGHT | ALERT_DIALOG,
                Holo_Theme_Dialog_Alert_Light);

        map(LIGHT | WALLPAPER,
                Holo_Theme_Light_Wallpaper);
        map(LIGHT | NO_ACTION_BAR | WALLPAPER,
                Holo_Theme_Light_NoActionBar_Wallpaper);
        map(LIGHT | FULLSCREEN | WALLPAPER,
                Holo_Theme_Light_Fullscreen_Wallpaper);
        map(LIGHT | NO_ACTION_BAR | FULLSCREEN | WALLPAPER,
                Holo_Theme_Light_NoActionBar_Fullscreen_Wallpaper);

        map(MIXED,
                Holo_Theme_Light_DarkActionBar);
        map(MIXED | FULLSCREEN,
                Holo_Theme_Light_DarkActionBar_Fullscreen);
        map(MIXED | NO_ACTION_BAR,
                Holo_Theme_Light_DarkActionBar_NoActionBar);
        map(MIXED | NO_ACTION_BAR | FULLSCREEN,
                Holo_Theme_Light_DarkActionBar_NoActionBar_Fullscreen);

        map(MIXED | DIALOG,
                Holo_Theme_Dialog_Light);
        map(MIXED | DIALOG_WHEN_LARGE,
                Holo_Theme_DialogWhenLarge_Light_DarkActionBar);
        map(MIXED | DIALOG_WHEN_LARGE | NO_ACTION_BAR,
                Holo_Theme_DialogWhenLarge_Light_DarkActionBar_NoActionBar);
        map(MIXED | ALERT_DIALOG,
                Holo_Theme_Dialog_Alert_Light);

        map(MIXED | WALLPAPER,
                Holo_Theme_Light_DarkActionBar_Wallpaper);
        map(MIXED | NO_ACTION_BAR | WALLPAPER,
                Holo_Theme_Light_DarkActionBar_NoActionBar_Wallpaper);
        map(MIXED | FULLSCREEN | WALLPAPER,
                Holo_Theme_Light_DarkActionBar_Fullscreen_Wallpaper);
        map(MIXED | NO_ACTION_BAR | FULLSCREEN | WALLPAPER,
                Holo_Theme_Light_DarkActionBar_NoActionBar_Fullscreen_Wallpaper);

        if (sThemeSetters != null) {
            for (ThemeSetter setter : sThemeSetters) {
                setter.setupThemes();
            }
        }
    }
939116
function updateThemeClass(theme) {
        if (!theme) return;
        if (!registered(theme)) {
          $log.warn('Attempted to use unregistered theme \'' + theme + '\'. ' +
                    'Register it with $mdThemingProvider.theme().');
        }

        var oldTheme = el.data('$mdThemeName');
        if (oldTheme) el.removeClass('md-' + oldTheme +'-theme');
        el.addClass('md-' + theme + '-theme');
        el.data('$mdThemeName', theme);
        if (ctrl) {
          el.data('$mdThemeController', ctrl);
        }
      }
834726
def update_style(self, title=None,defaults=None,mappings=None, verbose=False):
        
        u=self.__url
        host=u.split("//")[1].split(":")[0]
        port=u.split(":")[2].split("/")[0]
        version=u.split(":")[2].split("/")[1]

        if defaults:
            defaults_=[]
            for d in defaults:
                if d:
                    defaults_.append(d)
            defaults=defaults_

        if mappings:
            mappings_=[]
            for m in mappings:
                if m:
                    mappings_.append(m)
            mappings=mappings_

        URL="http://"+str(host)+":"+str(port)+"/v1/styles/"+str(title)
        if verbose:
            print(URL)
            sys.stdout.flush()

        response = requests.get(URL).json()

        olddefaults=response["defaults"]
        oldmappings=response["mappings"]

        if mappings:
            mappings_visual_properties=[ m["visualProperty"] for m in mappings ]
            newmappings=[ m for m in oldmappings if m["visualProperty"] not in mappings_visual_properties ]
            for m in mappings:
                newmappings.append(m)
        else:
            newmappings=oldmappings

        if defaults:
            defaults_visual_properties=[ m["visualProperty"] for m in defaults ]
            newdefaults=[ m for m in olddefaults if m["visualProperty"] not in defaults_visual_properties ]
            for m in defaults:
                newdefaults.append(m)
        else:
            newdefaults=olddefaults

        r=requests.delete(URL)
        checkresponse(r)

        URL="http://"+str(host)+":"+str(port)+"/v1/styles"
        PARAMS={"title":title,\
            "defaults":newdefaults,\
            "mappings":newmappings}
        r = requests.post(url = URL, json = PARAMS)
        checkresponse(r)