forked from kemie/Style-Guide-Boilerplate-Bootstrap-Edition
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
187 lines (177 loc) · 6.71 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
<?php
$project_name = "Project Name";
// Build out URI to reload from form dropdown
// Need full url for this to work in Opera Mini
$pageURL = (@$_SERVER["HTTPS"] == "on") ? "https://" : "http://";
if (isset($_POST['sg_uri']) && isset($_POST['sg_section_switcher'])) {
$pageURL .= $_POST[sg_uri].$_POST[sg_section_switcher];
header("Location: $pageURL");
}
// Display title of each markup samples as a select option
function listElementsAsOptions ($type) {
$files = array();
$handle=opendir($type.'/');
while (false !== ($file = readdir($handle))):
if(stristr($file,'.html')):
$files[] = $file;
endif;
endwhile;
echo '<li role="presentation" class="divider"></li><li role="presentation" class="dropdown-header">'.$type.'</li>';
sort($files);
foreach ($files as $file):
$filename = preg_replace("/\.html$/i", "", $file);
$title = preg_replace("/\-/i", " ", $filename);
$title = ucwords($title);
echo '<li><a href="#sg-'.$filename.'">'.$title.'</a></li>';
endforeach;
}
// Display title of each markup samples as a select option
function listMarkupAsOptions ($type) {
$files = array();
$handle=opendir('markup/'.$type);
while (false !== ($file = readdir($handle))):
if(stristr($file,'.html')):
$files[] = $file;
endif;
endwhile;
sort($files);
foreach ($files as $file):
$filename = preg_replace("/\.html$/i", "", $file);
$title = preg_replace("/\-/i", " ", $filename);
$title = ucwords($title);
echo '<li><a href="#sg-'.$filename.'">'.$title.'</a></li>';
endforeach;
}
// Display foundation elements
function showDocs() {
$files = array();
$handle=opendir('docs/');
while (false !== ($file = readdir($handle))):
if(stristr($file,'.html')):
$files[] = $file;
endif;
endwhile;
sort($files);
foreach ($files as $file):
$filename = preg_replace("/\.html$/i", "", $file);
$title = preg_replace("/\-/i", " ", $filename);
echo '<div class="col-lg-12 sg-section" id="sg-'.$filename.'">';
echo '<div class="sg-display">';
echo '<h2 class="sg-h2">'.$title.'</h2>';
include('docs/'.$file);
echo '</div><!--/.sg-display-->';
echo '</div><!--/.sg-section-->';
endforeach;
}
// Display foundation elements
function showFoundation() {
$files = array();
$handle=opendir('foundation/');
while (false !== ($file = readdir($handle))):
if(stristr($file,'.html')):
$files[] = $file;
endif;
endwhile;
sort($files);
foreach ($files as $file):
$filename = preg_replace("/\.html$/i", "", $file);
$title = preg_replace("/\-/i", " ", $filename);
echo '<div class="col-lg-12 sg-section" id="sg-'.$filename.'">';
echo '<div class="sg-display">';
echo '<h2 class="sg-h2">'.$title.'</h2>';
include('foundation/'.$file);
echo '</div><!--/.sg-display-->';
echo '</div><!--/.sg-section-->';
endforeach;
}
// Display markup view & source
function showMarkup($type) {
$files = array();
$handle=opendir('markup/'.$type);
while (false !== ($file = readdir($handle))):
if(stristr($file,'.html')):
$files[] = $file;
endif;
endwhile;
sort($files);
foreach ($files as $file):
$filename = preg_replace("/\.html$/i", "", $file);
$title = preg_replace("/\-/i", " ", $filename);
echo '<div class="col-lg-12 sg-section" id="sg-'.$filename.'">';
echo '<div class="sg-display">';
echo '<h2 class="sg-h2">'.$title.'</h2>';
include('markup/'.$type.'/'.$file);
echo '</div><!--/.sg-display-->';
echo '<div class="sg-markup-controls"><a class="btn btn-primary sg-btn sg-btn--source" href="#">View Source</a> <a class="sg-btn--top" href="#top">Back to Top</a> </div>';
echo '<div class="sg-source sg-animated">';
echo '<a class="btn btn-default sg-btn sg-btn--select" href="#">Copy Source</a>';
echo '<pre class="prettyprint linenums"><code>';
echo htmlspecialchars(file_get_contents('markup/'.$type.'/'.$file));
echo '</code></pre>';
echo '</div><!--/.sg-source-->';
echo '</div><!--/.sg-section-->';
endforeach;
}
?>
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<title><?php echo($project_name)?>Style Guide</title>
<meta name="viewport" content="width=device-width">
<!-- Style Guide Boilerplate Styles -->
<link rel="stylesheet" href="css/styleguide.css">
<link rel="stylesheet" href="css/bootstrap.css">
<!-- Replace below stylesheet with your own stylesheet -->
<link rel="stylesheet" href="css/theme.css">
</head>
<body data-spy="scroll" data-target=".navbar-default" data-offset="60" >
<!-- Fixed navbar -->
<div class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header"> <a class="navbar-brand" href="#"><strong><?php echo($project_name)?></strong> Style Guide</a> </div>
<ul class="nav navbar-nav navbar-right">
<li class="dropdown active"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">Select an element: <b class="caret"></b></a>
<ul class="dropdown-menu scroll-menu sg-sect">
<?php listElementsAsOptions('docs'); ?>
<?php listElementsAsOptions('foundation'); ?>
<li role="presentation" class="divider"></li>
<li role="presentation" class="dropdown-header">Base Styles</li>
<?php listMarkupAsOptions('base'); ?>
<li role="presentation" class="divider"></li>
<li role="presentation" class="dropdown-header">Patterns</li>
<?php listMarkupAsOptions('patterns'); ?>
</ul>
</li>
</ul>
</div>
</div>
<!--/.sg-header-->
<div class="sg-body sg-container container">
<div class="row">
<h1 class="page-header">Style Guide Documentation</h1>
<?php showDocs(); ?>
</div>
<!--/.row-->
<div class="row">
<h1 class="page-header">Foundation</h1>
<?php showFoundation(); ?>
</div>
<!--/.row-->
<div class="row sg-base-styles">
<h1 class="page-header">Base Styles</h1>
<?php showMarkup('base'); ?>
<!--</div>/.sg-base-styles-->
<div class="sg-pattern-styles">
<h1 class="page-header">Patterns<small> - Design and mark-up patterns unique to your site.</small></h1>
<?php showMarkup('patterns'); ?>
</div>
<!--/.sg-pattern-styles-->
</div>
<!--/.sg-body-->
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<script src="js/scrollspy.js"></script>
<script src="js/dropdown.js"></script>
<script src="js/sg-plugins.js"></script>
<script src="js/sg-scripts.js"></script>
</body>
</html>