Let's the user know that options aren't available for their theme
176033
function options_notice() {
		global $pagenow;
        if ( !is_multisite() && ( $pagenow == 'plugins.php' || $pagenow == 'themes.php' ) ) {
			global $current_user ;
			$user_id = $current_user->ID;
			if ( ! get_user_meta($user_id, 'optionsframework_ignore_notice') ) {
				echo '<div class="updated optionsframework_setup_nag"><p>';
				printf( __('Your current theme does not have support for the Options Framework plugin.  <a href="%1$s" target="_blank">Learn More</a> | <a href="%2$s">Hide Notice</a>', 'options-framework' ), 'http://wptheming.com/options-framework-plugin', '?optionsframework_nag_ignore=0');
				echo "</p></div>";
			}
        }
	}
110052
def allowed_to_preview(user):
    
    if (
        user.is_authenticated and
        user.is_active and
        user.is_staff
    ):
        return True
    return False
491584
function validateComposeOption(composeTheme) {
  if ([ COMPOSE_DEEPLY, COMPOSE_SOFTLY, DONT_COMPOSE ].indexOf(composeTheme) === -1) {
    throw new Error(
      `Invalid composeTheme option for react-css-themr. Valid composition options\
 are ${COMPOSE_DEEPLY}, ${COMPOSE_SOFTLY} and ${DONT_COMPOSE}. The given\
 option was ${composeTheme}`
    )
  }
}
1140984
function initThemes() {
        var activeThemeName = settingsCache.get('active_theme'),
            self = this;

        debug('init themes', activeThemeName);

        // Register a listener for server-start to load all themes
        common.events.on('server.start', function readAllThemesOnServerStart() {
            themeLoader.loadAllThemes();
        });

        // Just read the active theme for now
        return themeLoader
            .loadOneTheme(activeThemeName)
            .then(function activeThemeHasLoaded(theme) {
                // Validate
                return validate
                    .check(theme)
                    .then(function validationSuccess(checkedTheme) {
                        if (!validate.canActivate(checkedTheme)) {
                            const checkError = new common.errors.ThemeValidationError({
                                message: common.i18n.t('errors.middleware.themehandler.invalidTheme', {theme: activeThemeName}),
                                errorDetails: Object.assign(
                                    _.pick(checkedTheme, ['checkedVersion', 'name', 'path', 'version']), {
                                        errors: checkedTheme.results.error
                                    }
                                )
                            });

                            common.logging.error(checkError);

                            self.activate(theme, checkedTheme, checkError);
                        } else {
                            // CASE: inform that the theme has errors, but not fatal (theme still works)
                            if (checkedTheme.results.error.length) {
                                common.logging.warn(new common.errors.ThemeValidationError({
                                    errorType: 'ThemeWorksButHasErrors',
                                    message: common.i18n.t('errors.middleware.themehandler.themeHasErrors', {theme: activeThemeName}),
                                    errorDetails: Object.assign(
                                        _.pick(checkedTheme, ['checkedVersion', 'name', 'path', 'version']), {
                                            errors: checkedTheme.results.error
                                        }
                                    )
                                }));
                            }

                            debug('Activating theme (method A on boot)', activeThemeName);

                            self.activate(theme, checkedTheme);
                        }
                    });
            })
            .catch(common.errors.NotFoundError, function (err) {
                // CASE: active theme is missing, we don't want to exit because the admin panel will still work
                err.message = common.i18n.t('errors.middleware.themehandler.missingTheme', {theme: activeThemeName});
                common.logging.error(err);
            })
            .catch(function (err) {
                // CASE: theme threw an odd error, we don't want to exit because the admin panel will still work
                // This is the absolute catch-all, at this point, we do not know what went wrong!
                common.logging.error(err);
            });
    }
1995
def theme_set(new):
    
    if (not isinstance(new, theme) and
            not issubclass(new, theme)):
        raise PlotnineError("Expecting object to be a theme")

    out = get_option('current_theme')
    set_option('current_theme', new)
    return out
395793
protected function setMessageEditEditor()
    {
        if ($this->current_theme['id'] == $this->data_module['id']) {
            $message = $this->text('You cannot edit the current theme');
            $this->setMessage($message, 'warning');
        } else if ($this->canSaveEditor() && $this->data_extension === 'php') {
            if (!$this->editor->canValidatePhpCode()) {
                $message = $this->text('Warning! PHP syntax validation is disabled due to your environment settings. It means that nothing stops you from saving invalid PHP code!');
                $this->setMessage($message, 'warning');
            }
            $this->setMessage($this->text('Be careful! Invalid PHP code can break down all your site!'), 'danger');
        }
    }
330450
function checkOptions ( opts ) {
        var isNum, isNumWithUnit;

        if ( opts.direction && !( opts.direction === 'vertical' || opts.direction === 'horizontal' || opts.direction === 'both' ) ) {
            throw new Error( 'Invalid option value: direction = "' + opts.direction + '"' );
        }

        if ( opts.box && !( opts.box === 'border-box' || opts.box === 'content-box' ) ) {
            throw new Error( 'Invalid option value: box = "' + opts.box + '"' );
        }

        if ( opts.tolerance !== undefined ) {
            isNum = isNumber( opts.tolerance );
            isNumWithUnit = isString( opts.tolerance ) && ( /^[+-]?\d*\.?\d+(px|%)?$/.test( opts.tolerance ) );
            if ( ! ( isNum || isNumWithUnit ) ) throw new Error( 'Invalid option value: tolerance = "' + opts.tolerance + '"' );
        }

    }
937308
def show_options(self):
        """"""
        # import here only so that it is AFTER i18n set up
        from safe.gui.tools.options_dialog import OptionsDialog

        dialog = OptionsDialog(
            iface=self.iface,
            parent=self.iface.mainWindow())
        dialog.show_option_dialog()
        if dialog.exec_():  # modal
            self.dock_widget.read_settings()
            from safe.gui.widgets.message import getting_started_message
            send_static_message(self.dock_widget, getting_started_message())
            # Issue #4734, make sure to update the combobox after update the
            # InaSAFE option
            self.dock_widget.get_layers()
889780
protected function handleDefaultOptions()
    {
        if ($this->options->getOpt('no-colors')) {
            $this->colors->disable();
        }
        if ($this->options->getOpt('help')) {
            echo $this->options->help();
            exit(0);
        }
    }
344468
def list_themes_user():
    """"""
    themes = [*os.scandir(os.path.join(CONF_DIR, "colorschemes/dark/")),
              *os.scandir(os.path.join(CONF_DIR, "colorschemes/light/"))]
    return [t for t in themes if os.path.isfile(t.path)]
1093806
def _handle_option_deprecations(options):
    """"""
    undeprecated_options = _CaseInsensitiveDictionary()
    for key, value in iteritems(options):
        optname = str(key).lower()
        if optname in URI_OPTIONS_DEPRECATION_MAP:
            renamed_key = URI_OPTIONS_DEPRECATION_MAP[optname]
            if renamed_key.lower() in options:
                warnings.warn("Deprecated option '%s' ignored in favor of "
                              "'%s'." % (str(key), renamed_key))
                continue
            warnings.warn("Option '%s' is deprecated, use '%s' instead." % (
                          str(key), renamed_key))
        undeprecated_options[str(key)] = value
    return undeprecated_options
929878
public function AvailableThemes($Force = FALSE) {
      if (is_null($this->ThemeCache) || $Force) {
      
         $this->ThemeCache = array();
         
         // Check cache freshness
         foreach ($this->SearchPaths() as $SearchPath => $Trash) {
            unset($SearchPathCache);
            
            // Check Cache
            $SearchPathCacheKey = 'Garden.Themes.PathCache.'.$SearchPath;
            if ($this->Apc) {
               $SearchPathCache = apc_fetch($SearchPathCacheKey);
            } else {
               $SearchPathCache = Gdn::Cache()->Get($SearchPathCacheKey, array(Gdn_Cache::FEATURE_NOPREFIX => TRUE));
            }
            
            $CacheHit = ($SearchPathCache !== Gdn_Cache::CACHEOP_FAILURE);
            if ($CacheHit && is_array($SearchPathCache)) {
               $CacheIntegrityCheck = (sizeof(array_intersect(array_keys($SearchPathCache), array('CacheIntegrityHash', 'ThemeInfo'))) == 2);
               if (!$CacheIntegrityCheck) {
                  $SearchPathCache = array(
                     'CacheIntegrityHash'    => NULL,
                     'ThemeInfo'             => array()
                  );
               }
            }
            
            $CacheThemeInfo = &$SearchPathCache['ThemeInfo'];
            if (!is_array($CacheThemeInfo))
               $CacheThemeInfo = array();
            
            $PathListing = scandir($SearchPath, 0);
            sort($PathListing);
            
            $PathIntegrityHash = md5(serialize($PathListing));
            if (GetValue('CacheIntegrityHash',$SearchPathCache) != $PathIntegrityHash) {
               // Trace('Need to re-index theme cache');
               // Need to re-index this folder
               $PathIntegrityHash = $this->IndexSearchPath($SearchPath, $CacheThemeInfo, $PathListing);
               if ($PathIntegrityHash === FALSE)
                  continue;
               
               $SearchPathCache['CacheIntegrityHash'] = $PathIntegrityHash;
               if ($this->Apc) {
                  apc_store($SearchPathCacheKey, $SearchPathCache);
               } else {
                  Gdn::Cache()->Store($SearchPathCacheKey, $SearchPathCache, array(Gdn_Cache::FEATURE_NOPREFIX => TRUE));
               }
            }
            
            $this->ThemeCache = array_merge($this->ThemeCache, $CacheThemeInfo);
         }
      }
            
      return $this->ThemeCache;
   }
760733
public function reload_theme() {
        if (!is_null($this->_theme)) {
            $this->_theme = theme_config::load($this->_theme->name);
        }
    }
81180
def options(self, *args, **kwargs):
        """"""
        self.enable_cache()
        self.handle_session_cookie()
        self.preflight()

        if self.verify_origin():
            allowed_methods = getattr(self, 'access_methods', 'OPTIONS, POST')
            self.set_header('Access-Control-Allow-Methods', allowed_methods)
            self.set_header('Allow', allowed_methods)

            self.set_status(204)
        else:
            # Set forbidden
            self.set_status(403)

        self.finish()
5101
def can_view(self, user):
        """"""
        return user.is_admin or self == user \
            or set(self.classes).intersection(user.admin_for)
108169
void allowedOptions(String... opts) {
        for (String opt : opts) {
            options.putIfAbsent(opt, false);
        }
    }
692899
function registered(themeName) {
      if (themeName === undefined || themeName === '') return true;
      return applyTheme.THEMES[themeName] !== undefined;
    }