YaWK  24.1
Yet another WebKit
YAWK\FRAMEWORK\cssFramework Class Reference

Helper function to output custom (overriden) bootstrap css (settings.css) More...

+ Inheritance diagram for YAWK\FRAMEWORK\cssFramework:

Public Member Functions

 init ()
 Init calls setBootstrapComponents and return all css code as string on success or null on error. More...
 
 outputCssCode ()
 Check CSS code and return it on success as string, otherwise return null. More...
 
 setBootstrapComponents ()
 Check if Bootstrap is version 3 or 4 and load the required component methods. More...
 

Public Attributes

 $cssCode = ''
 
 $tplSettings = ''
 
 $version = ''
 

Detailed Description

Helper function to output custom (overriden) bootstrap css (settings.css)

Bootstrap CSS check version + return corresponding css

This is a helper function, used by admin/includes/template-save.php. It generates the custom css code for the current loaded bootstrap version, depending on the selection of the fields within the backend.

Author
Daniel Retzl danie.nosp@m.lret.nosp@m.zl@gm.nosp@m.ail..nosp@m.com
Version
1.0.0

Definition at line 17 of file cssFramework.php.

Member Function Documentation

◆ init()

YAWK\FRAMEWORK\cssFramework::init ( )

Init calls setBootstrapComponents and return all css code as string on success or null on error.

Initialize and start check function

Returns
string|null the generated css code as (big) string

Reimplemented in YAWK\FRAMEWORK\BOOTSTRAP4\bootstrap4, and YAWK\FRAMEWORK\BOOTSTRAP3\bootstrap3.

Definition at line 83 of file cssFramework.php.

84  {
85  // load required methods, depending on this bootstrap version
86  if ($this->setBootstrapComponents() === true)
87  {
88  // ok, return css code
89  return $this->cssCode;
90  }
91  else
92  { // unknown error
93  return null;
94  }
95  }
setBootstrapComponents()
Check if Bootstrap is version 3 or 4 and load the required component methods.

References YAWK\FRAMEWORK\cssFramework\$cssCode, and YAWK\FRAMEWORK\cssFramework\setBootstrapComponents().

◆ outputCssCode()

YAWK\FRAMEWORK\cssFramework::outputCssCode ( )

Check CSS code and return it on success as string, otherwise return null.

Check and return generated CSS Code as string

Returns
string|null the generated css code as (big) string

Definition at line 102 of file cssFramework.php.

103  { // check if css code string is set and not empty
104  if (isset($this->cssCode) && (is_string($this->cssCode) && (!empty($this->cssCode))))
105  { // ok, return css code
106  return $this->cssCode;
107  }
108  else
109  { // do nothing
110  return null;
111  }
112  }

References YAWK\FRAMEWORK\cssFramework\$cssCode.

◆ setBootstrapComponents()

YAWK\FRAMEWORK\cssFramework::setBootstrapComponents ( )

Check if Bootstrap is version 3 or 4 and load the required component methods.

Returns
true|null the generated css code as (big) string

Return true after executing component methods or false if Bootstrap version is unknown

Definition at line 119 of file cssFramework.php.

120  {
121  // if Bootstrap 3 is loaded
122  if ($this->version == 3)
123  { // include bootstrap 3 class
124  require_once 'bootstrap3.php';
125  // generate new object
126  $bootstrap3 = new \YAWK\FRAMEWORK\BOOTSTRAP3\bootstrap3($this->version, $this->tplSettings);
127  // init bootstrap 3 class
128  $this->cssCode = $bootstrap3->init();
129  // check if bootstrap 3 css code is set
130  if (isset($this->cssCode) && (is_string($this->cssCode) && (!empty($this->cssCode))))
131  { // bootstrap 3 css code is set
132  return true;
133  }
134  else
135  { // css code not set properly
136  return null;
137  }
138  }
139  // if Bootstrap 4 is loaded
140  if ($this->version == 4)
141  { // include bootstrap 4 class
142  require_once 'bootstrap4.php';
143  // generate new object
144  $bootstrap4 = new \YAWK\FRAMEWORK\BOOTSTRAP4\bootstrap4($this->version, $this->tplSettings);
145  // init bootstrap 4 class
146  $this->cssCode = $bootstrap4->init();
147  // check if bootstrap 4 css code is set
148  if (isset($this->cssCode) && (is_string($this->cssCode) && (!empty($this->cssCode))))
149  { // bootstrap 4 css code is set
150  return true;
151  }
152  else
153  { // css code not set properly
154  return null;
155  }
156  }
157  else
158  {
159  // bootstrap version not supported
160  return null;
161  }
162  }

Referenced by YAWK\FRAMEWORK\cssFramework\init().

Member Data Documentation

◆ $cssCode

YAWK\FRAMEWORK\cssFramework::$cssCode = ''
Parameters
stringall the css as string

Definition at line 24 of file cssFramework.php.

Referenced by YAWK\FRAMEWORK\cssFramework\init(), and YAWK\FRAMEWORK\cssFramework\outputCssCode().

◆ $tplSettings

YAWK\FRAMEWORK\cssFramework::$tplSettings = ''
Parameters
arraytemplate settings array

Definition at line 22 of file cssFramework.php.

◆ $version

YAWK\FRAMEWORK\cssFramework::$version = ''
Parameters
intcurrent loaded bootstrap version

Definition at line 20 of file cssFramework.php.


The documentation for this class was generated from the following file: