Converts style specified as array or Css object to string
@param $style
@return string
15597
protected function _styleToString(&$style) {

        if (is_array($style)) {
            $css = $this->newStyle();
            foreach ($style as $prop => $val) {
                $css[$prop] = $val;
            }
            return $css->css();
        } elseif (is_a($style, '\\s4y\\Style')) {
            return $style->css();
        }
        return $style.PHP_EOL;
    }
471140
function styles(obj) {
  var str = '';
  for(var key in obj) {
    str += key + ':' + obj[key] + ';';
  }
  return str;
}
731723
static public function implodeStyles(array $styles)
    {
        $a = [];

        foreach ($styles as $p => $v) {
            $a[] = "$p:$v";
        }

        return implode(';', $a);
    }
328837
public function setStyle($style)
    {
        $dir = ForumEnv::get('WEB_ROOT').'themes/'.$style.'/';
        if (!is_dir($dir)) {
            throw new RunBBException('The style '.$style.' doesn\'t exist');
        }

        if (is_file($dir . 'bootstrap.php')) {
            $vars = include_once $dir . 'bootstrap.php';
            // file exist but return nothing
            if (!is_array($vars)) {
                $vars = [];
            }
            foreach ($vars as $key => $assets) {
                if ($key === 'jsraw' || !in_array($key, ['js', 'jshead', 'css'])) {
                    continue;
                }
                foreach ($assets as $asset) {
                    $params = ($key === 'css') ? ['type' => 'text/css', 'rel' => 'stylesheet'] : (
                    ($key === 'js' || $key === 'jshead') ? ['type' => 'text/javascript'] : []
                    );
                    $this->addAsset($key, $asset, $params);
                }
            }
            $this->set('jsraw', isset($vars['jsraw']) ? $vars['jsraw'] : '');
        }

        if (isset($vars['themeTemplates']) && $vars['themeTemplates'] == true) {
            $templatesDir = ForumEnv::get('WEB_ROOT').'themes/'.$style.'/view';
        } else {
            $templatesDir = ForumEnv::get('FORUM_ROOT') . 'View/';
        }

        $this->set('style', (string) $style);

        $this->addTemplatesDirectory($templatesDir);
    }
1127447
private function getFontSectionContent($style)
    {
        $defaultStyle = $this->getDefaultStyle();

        $content = '<style:text-properties';

        $fontColor = $style->getFontColor();
        if ($fontColor !== $defaultStyle->getFontColor()) {
            $content .= ' fo:color="#' . $fontColor . '"';
        }

        $fontName = $style->getFontName();
        if ($fontName !== $defaultStyle->getFontName()) {
            $content .= ' style:font-name="' . $fontName . '" style:font-name-asian="' . $fontName . '" style:font-name-complex="' . $fontName . '"';
        }

        $fontSize = $style->getFontSize();
        if ($fontSize !== $defaultStyle->getFontSize()) {
            $content .= ' fo:font-size="' . $fontSize . 'pt" style:font-size-asian="' . $fontSize . 'pt" style:font-size-complex="' . $fontSize . 'pt"';
        }

        if ($style->isFontBold()) {
            $content .= ' fo:font-weight="bold" style:font-weight-asian="bold" style:font-weight-complex="bold"';
        }
        if ($style->isFontItalic()) {
            $content .= ' fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic"';
        }
        if ($style->isFontUnderline()) {
            $content .= ' style:text-underline-style="solid" style:text-underline-type="single"';
        }
        if ($style->isFontStrikethrough()) {
            $content .= ' style:text-line-through-style="solid"';
        }

        $content .= '/>';

        return $content;
    }
1084290
protected function defaultUrl($style = '')
    {
        if ($this->config('default_url')) {
            $url = $this->getInterpolator()->interpolate($this->config('default_url'), $style);

            return parse_url($url, PHP_URL_HOST) ? $url : $this->config('prefix_url') . $url;
        }

        return '';
    }
360614
public static String decode(Style style) {
		if (style != null) {
			if (style instanceof ShapeStyle) {
				return decode((ShapeStyle) style);
			} else if (style instanceof FontStyle) {
				return decode((FontStyle) style);
			} else if (style instanceof PictureStyle) {
				return decode((PictureStyle) style);
			}
		}
		return "";
	}
581974
function (element, style) {
			var styleString = '';

			for (var key in style) {
				styleString += key + ': ' + style[key] + ';';
			}

			element.setAttribute('style', styleString);

			return element;
		}
1247097
protected function parseStyleDimensions($style)
  	{
		if (is_callable($style->value)) {
			return  array(null, null, 'custom');
		}

		if (strpos($style->value, 'x') === false)
		{
			// Width given, height automagically selected to preserve aspect ratio (landscape).
			$width = $style->value;

			return  array($width, null, 'landscape');
		}

		$dimensions = explode('x', $style->value);
		$width = $dimensions[0];
		$height = $dimensions[1];

		if (empty($width))
    	{
			// Height given, width automagically selected to preserve aspect ratio (portrait).
			return  array(null, $height, 'portrait');
		}

		$resizingOption = substr($height, -1, 1);

		if ($resizingOption == '#')
		{
			// Resize, then crop.
      		$height = rtrim($height, '#');

			return  array($width, $height, 'crop');
		}

		if ($resizingOption == '!')
		{
			// Resize by exact width/height (does not preserve aspect ratio).
			$height = rtrim($height, '!');

			return  array($width, $height, 'exact');
		}

		// Let the script decide the best way to resize.
		return  array($width, $height, 'auto');
	}
1240451
protected function makeStyles($styles = array())
        {
            $styles = array_merge($this->styles, $styles);
            $output = '';
            foreach ($styles as $property => $value) {
                $output .= $property . ':' . $value . ';';
            }

            return $output;
        }
1048258
public function registerStyle($style)
    {
        $registeredStyle = parent::registerStyle($style);
        $this->registerFill($registeredStyle);
        $this->registerBorder($registeredStyle);
        return $registeredStyle;
    }
1368857
public function buildRowStyle(array $style)
    {
        $finalStyle = new StyleBuilder();

        // Spout doesn't offer support for changing column alignment.

        if (array_key_exists('font', $style)) {
            if (array_key_exists('color', $style['font'])) {
                $finalStyle->setFontColor(
                    Color::toARGB($style['font']['color']['rgb'])
                );
            }

            if (array_key_exists('bold', $style['font']) && ($style['font']['bold'] === true)) {
                $finalStyle->setFontBold();
            }
        }

        return $finalStyle->build();
    }
1070284
function styleObjectToString(style) {
      return Object.keys(style).reduce(function (acc, prop) {
        return (acc + " " + prop + ": " + (style[prop]) + ";")
      }, '')
    }
79985
public function render(array $style)
    {
        $result = [];

        if (isset($style['feature'])) {
            $result[] = $this->renderStyle('feature', $style['feature']);
        }

        if (isset($style['element'])) {
            $result[] = $this->renderStyle('element', $style['element']);
        }

        foreach ($style['rules'] as $rule => $value) {
            $result[] = $this->renderStyle($rule, $value);
        }

        return implode('|', $result);
    }
542946
function convertStyleToRules( style ) {
		var styleDef = style.getDefinition(),
			rules = {},
			rule,
			attrs = styleDef.attributes;

		rules[ styleDef.element ] = rule = {
			styles: styleDef.styles,
			requiredStyles: styleDef.styles && CKEDITOR.tools.objectKeys( styleDef.styles )
		};

		if ( attrs ) {
			attrs = copy( attrs );
			rule.classes = attrs[ 'class' ] ? attrs[ 'class' ].split( /\s+/ ) : null;
			rule.requiredClasses = rule.classes;
			delete attrs[ 'class' ];
			rule.attributes = attrs;
			rule.requiredAttributes = attrs && CKEDITOR.tools.objectKeys( attrs );
		}

		return rules;
	}
663640
public function import(Style $style)
    {
        foreach ($style->getArrayCopy() as $styleTextContent) {
            $this->append($styleTextContent);
        }
    }
857624
public function style($styles)
    {
        if (is_string($styles)) {
            return $this->style([$styles]);
        }

        $styles = array_map(function ($style) {
            return 'box-'.$style;
        }, $styles);

        $this->class = $this->class.' '.implode(' ', $styles);

        return $this;
    }