├── .distignore
├── .github
└── workflows
│ ├── deploy-to-wpdotorg.yml
│ └── update-wpdororg-assets.yml
├── .gitignore
├── .wordpress-org
├── banner-1544x500.jpg
├── banner-772x250.jpg
├── icon-128x128.png
├── icon-256x256.png
├── screenshot-1.png
├── screenshot-2.png
├── screenshot-3.png
├── screenshot-4.png
└── screenshot-5.png
├── Gruntfile.js
├── README.md
├── SECURITY.md
├── assets
├── css
│ ├── fontawesome-all.css
│ ├── fontawesome-all.min.css
│ ├── menu.css
│ └── stag-shortcodes.css
├── icons.yml
├── img
│ ├── codestag-icon.svg
│ └── sprite-popup.png
├── js
│ ├── editor_plugin.js
│ ├── fa-v4-shims.min.js
│ ├── fontawesome-all.min.js
│ ├── icons.js
│ ├── plugin-lang.php
│ ├── plugin.js
│ ├── shortcodes_plugins.js
│ ├── shortcodes_plugins.min.js
│ ├── stag-shortcode-scripts.js
│ └── tinymce-button.js
├── scss
│ ├── _preboot.scss
│ └── stag-shortcodes.scss
└── webfonts
│ ├── fa-brands-400.eot
│ ├── fa-brands-400.svg
│ ├── fa-brands-400.ttf
│ ├── fa-brands-400.woff
│ ├── fa-brands-400.woff2
│ ├── fa-regular-400.eot
│ ├── fa-regular-400.svg
│ ├── fa-regular-400.ttf
│ ├── fa-regular-400.woff
│ ├── fa-regular-400.woff2
│ ├── fa-solid-900.eot
│ ├── fa-solid-900.svg
│ ├── fa-solid-900.ttf
│ ├── fa-solid-900.woff
│ └── fa-solid-900.woff2
├── config.rb
├── includes
├── class-stagtools-themes.php
├── post-type
│ ├── portfolio.php
│ ├── project.php
│ ├── slides.php
│ ├── team.php
│ └── testimonials.php
├── settings
│ └── settings.php
├── tinymce.php
└── widgets
│ ├── lib
│ ├── TwitterText
│ │ └── lib
│ │ │ └── Twitter
│ │ │ ├── Autolink.php
│ │ │ ├── Extractor.php
│ │ │ ├── HitHighlighter.php
│ │ │ └── Regex.php
│ └── TwitterWP
│ │ └── lib
│ │ └── TwitterWP.php
│ ├── stagtools-widget.php
│ ├── widget-dribbble.php
│ ├── widget-flickr.php
│ ├── widget-instagram.php
│ └── widget-twitter.php
├── languages
├── stagtools.mo
└── stagtools.pot
├── package-lock.json
├── package.json
├── readme.txt
├── shortcodes
├── config.php
├── shortcode-class.php
├── shortcodes.php
└── stag-shortcodes.php
├── stagtools.php
└── uninstall.php
/.distignore:
--------------------------------------------------------------------------------
1 | # Directories
2 | /.wordpress-org
3 | /.git
4 | /.github
5 | /.babelrc
6 | /.eslintignore
7 | /phpcs.xml
8 | /node_modules
9 | /tests
10 | /bin
11 | /phpunit.xml
12 |
13 | # Exclude vendor folder, except required dependencies.
14 | /vendor
15 | !/vendor/composer
16 | !/vendor/autoload.php
17 |
18 | # Files
19 | .babelrc
20 | .distignore
21 | .eslintignore
22 | .eslintrc.json
23 | .gitignore
24 | .editorconfig
25 | CHANGELOG.md
26 | CODE_OF_CONDUCT.md
27 | CONTRIBUTING.md
28 | CREDITS.md
29 | LICENSE.md
30 | README.md
31 | composer.json
32 | composer.lock
33 | package-lock.json
34 | yarn.lock
35 | package.json
36 | phpcs.xml
37 | phpunit.xml
38 | webpack.config.js
39 | webpack.gutenberg.config.js
40 |
41 | config.rb
42 | Gruntfile.js
43 |
--------------------------------------------------------------------------------
/.github/workflows/deploy-to-wpdotorg.yml:
--------------------------------------------------------------------------------
1 | name: Deploy to WordPress.org
2 | on:
3 | push:
4 | tags:
5 | - "*"
6 | jobs:
7 | tag:
8 | name: New tag
9 | runs-on: ubuntu-latest
10 | steps:
11 | - uses: actions/checkout@master
12 | - name: WordPress Plugin Deploy
13 | uses: 10up/action-wordpress-plugin-deploy@master
14 | env:
15 | SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
16 | SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
17 |
--------------------------------------------------------------------------------
/.github/workflows/update-wpdororg-assets.yml:
--------------------------------------------------------------------------------
1 | name: Plugin asset/readme update
2 | on:
3 | push:
4 | branches:
5 | - master
6 | jobs:
7 | master:
8 | name: Push to master
9 | runs-on: ubuntu-latest
10 | steps:
11 | - uses: actions/checkout@master
12 | - name: WordPress.org plugin asset/readme update
13 | uses: 10up/action-wordpress-plugin-asset-update@master
14 | env:
15 | SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
16 | SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
17 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | *.DS_Store
3 | .sass-cache/
4 | config.codekit
5 | /.idea
6 |
--------------------------------------------------------------------------------
/.wordpress-org/banner-1544x500.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codestag/stagtools/2635655608eb46b29f44911db766f0a344ad24b1/.wordpress-org/banner-1544x500.jpg
--------------------------------------------------------------------------------
/.wordpress-org/banner-772x250.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codestag/stagtools/2635655608eb46b29f44911db766f0a344ad24b1/.wordpress-org/banner-772x250.jpg
--------------------------------------------------------------------------------
/.wordpress-org/icon-128x128.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codestag/stagtools/2635655608eb46b29f44911db766f0a344ad24b1/.wordpress-org/icon-128x128.png
--------------------------------------------------------------------------------
/.wordpress-org/icon-256x256.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codestag/stagtools/2635655608eb46b29f44911db766f0a344ad24b1/.wordpress-org/icon-256x256.png
--------------------------------------------------------------------------------
/.wordpress-org/screenshot-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codestag/stagtools/2635655608eb46b29f44911db766f0a344ad24b1/.wordpress-org/screenshot-1.png
--------------------------------------------------------------------------------
/.wordpress-org/screenshot-2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codestag/stagtools/2635655608eb46b29f44911db766f0a344ad24b1/.wordpress-org/screenshot-2.png
--------------------------------------------------------------------------------
/.wordpress-org/screenshot-3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codestag/stagtools/2635655608eb46b29f44911db766f0a344ad24b1/.wordpress-org/screenshot-3.png
--------------------------------------------------------------------------------
/.wordpress-org/screenshot-4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codestag/stagtools/2635655608eb46b29f44911db766f0a344ad24b1/.wordpress-org/screenshot-4.png
--------------------------------------------------------------------------------
/.wordpress-org/screenshot-5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codestag/stagtools/2635655608eb46b29f44911db766f0a344ad24b1/.wordpress-org/screenshot-5.png
--------------------------------------------------------------------------------
/Gruntfile.js:
--------------------------------------------------------------------------------
1 | /* jshint node:true */
2 | module.exports = function( grunt ) {
3 | var _ = require( 'lodash' );
4 |
5 | // Load all Grunt tasks
6 | require( 'load-grunt-tasks' )( grunt );
7 |
8 | // Project configuration.
9 | grunt.initConfig({
10 | pkg: grunt.file.readJSON( 'package.json' ),
11 | // jshint: {
12 | // options: grunt.file.readJSON( '.jshintrc' ),
13 | // grunt: {
14 | // src: [
15 | // 'Gruntfile.js'
16 | // ]
17 | // }
18 | // },
19 | clean: {
20 | assets: {
21 | src: [ 'assets/temp' ],
22 | },
23 | },
24 | yaml: {
25 | fontawesome: {
26 | files: [
27 | {
28 | expand: true,
29 | cwd: 'assets',
30 | src: 'icons*.yml',
31 | dest: 'assets/temp',
32 | },
33 | ],
34 | },
35 | },
36 | json_massager: {
37 | fontawesome: {
38 | modifier: function( json ) {
39 | var icons = json,
40 | style = '',
41 | newObj = {};
42 |
43 | _.forEach( icons, function( data, key ) {
44 | _.forEach( data.styles, function( category ) {
45 | if ( 'undefined' === typeof newObj[ category ] ) {
46 | newObj[ category ] = [];
47 | }
48 |
49 | if ( 'regular' === category ) {
50 | style = 'far';
51 | } else if ( 'brands' === category ) {
52 | style = 'fab';
53 | } else if ( 'solid' === category ) {
54 | style = 'fas';
55 | }
56 |
57 | var icon = {
58 | name: data.label,
59 | id: key,
60 | unicode: data.unicode,
61 | style: style,
62 | };
63 | newObj[ category ].push( icon );
64 | });
65 | });
66 |
67 | // _.forEach( newObj, function( category ) {
68 | // category.sort( function( a, b ) {
69 | // if (a.name.toLowerCase() > b.name.toLowerCase()) {
70 | // return 1;
71 | // }
72 | // if (a.name.toLowerCase() < b.name.toLowerCase()) {
73 | // return -1;
74 | // }
75 | // return 0;
76 | // } );
77 | // } );
78 |
79 | return newObj;
80 | },
81 | files: {
82 | 'assets/temp/fontawesome.json': [ 'assets/temp/icons*.json' ],
83 | },
84 | },
85 | },
86 | json: {
87 | fontawesome: {
88 | options: {
89 | namespace: 'stIconObj',
90 | processName: function( filename ) {
91 | return filename.toLowerCase();
92 | },
93 | },
94 | src: [ 'assets/temp/fontawesome.json' ],
95 | dest: 'assets/js/icons.js',
96 | },
97 | },
98 | makepot: {
99 | target: {
100 | options: {
101 | cwd: '',
102 | potFilename: 'stagtools.pot',
103 | exclude: ['includes/widgets/lib/.*'],
104 | type: 'wp-plugin',
105 | processPot: function( pot, options ) {
106 | pot.headers['report-msgid-bugs-to'] = 'https://codestag.com/support/';
107 | pot.headers['last-translator'] = 'Codestag';
108 | pot.headers['language-team'] = 'Codestag';
109 | return pot;
110 | },
111 | },
112 | },
113 | },
114 | });
115 |
116 | // Process the icons YAML file
117 | grunt.registerTask( 'fontawesome', [
118 | 'yaml:fontawesome',
119 | 'json_massager:fontawesome',
120 | 'json:fontawesome',
121 | 'clean:assets',
122 | ]);
123 | };
124 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## Description
2 | StagTools is an open-source WordPress Plugin which brings the power the handy shortcodes and widgets on your site.
3 |
4 | The purpose of StagTools is to keep your content consistent, while you want to change your themes. It could be really pain to update shortcodes everytime you change your theme, that's when StagTools comes to the rescue.
5 |
6 | ### Installation
7 | ##### Uploading in WordPress Dashboard
8 |
9 | 1. Navigate to the 'Add New' in the plugins dashboard
10 | 2. Navigate to the 'Upload' area
11 | 3. Select `stagtools.zip` from your computer
12 | 4. Click 'Install Now'
13 | 5. Activate the plugin in the Plugin dashboard
14 |
15 | ##### Using FTP
16 |
17 | 1. Download `stagtools.zip`
18 | 2. Extract the `stagtools` directory to your computer
19 | 3. Upload the `stagtools` directory to the `/wp-content/plugins/` directory
20 | 4. Activate the plugin in the Plugin dashboard
21 |
22 | ---
23 |
24 | ### Shortcodes
25 | Stagtools includes the following shortcodes:
26 | * Buttons ( optionally, with font icons )
27 | * Columns
28 | * Dropcaps
29 | * Tabs
30 | * Toggle
31 | * Font Icons by [Font Awesome](http://fortawesome.github.io/Font-Awesome/)
32 | * Google Maps with 5 predefined styles, and map types
33 | * Custom Sidebars Area ( requires [Stag Custom Sidebars](https://wordpress.org/plugins/stag-custom-sidebars/) plugin )
34 | * Image with CSS3 filters
35 | * Videos ( supports [oEmbeds](https://codex.wordpress.org/Embeds#Okay.2C_So_What_Sites_Can_I_Embed_From.3F) )
36 |
37 | Shortcodes can easily be inserted via the button include in the editor, check the screenshot:
38 |
39 | 
40 |
41 | Apart from above, the plugin also comes with 3 widgets: Twitter, Dribbble & Flickr.
42 |
--------------------------------------------------------------------------------
/SECURITY.md:
--------------------------------------------------------------------------------
1 | # Security Policy
2 |
3 | ## Reporting a Vulnerability
4 |
5 | You can report a vulnerability or security related issues at the below email address -
6 | support@codestag.com
7 |
8 |
9 | Expect a reply within the next 48-72 hours, depending upon the successful verification of the reported issue.
10 | Make sure to include a how to replicate section in the email.
11 |
12 | In any case, thank you for your contribution.
13 |
--------------------------------------------------------------------------------
/assets/css/menu.css:
--------------------------------------------------------------------------------
1 | /* Menu */
2 | .mceIcon.mce_stagShortcodes,
3 | .mce-i-stagtools {
4 | background: url('../img/codestag-icon.svg') no-repeat center !important;
5 | background-size: 20px !important;
6 | }
7 |
8 | .wp-core-ui .stag-insert {
9 | color: white !important;
10 | margin-top: 3px;
11 | margin-right: 10px;
12 | background: #1b93c7 !important;
13 | border: none;
14 | border-radius: 0;
15 | -webkit-box-shadow: none;
16 | box-shadow: none;
17 | font-size: 14px;
18 | line-height: 1 !important;
19 | height: auto !important;
20 | padding: 10px 14px !important;
21 | }
22 |
23 | .wp-core-ui .stag-insert:hover {
24 | text-shadow: none;
25 | box-shadow: none;
26 | }
27 |
28 | .stag-open-media {
29 | margin-bottom: 5px !important;
30 | }
31 |
32 | .insert-field {
33 | text-align: right;
34 | background: #363f48;
35 | padding: 15px;
36 | margin: 0 -15px;
37 | }
38 |
39 | #stag-sc-form-wrap {
40 | background: #1b93c7;
41 | /*-webkit-mask-image: -webkit-linear-gradient(#000, rgba(0,0,0,.9));*/
42 | font-weight: bold;
43 | color: white;
44 | padding: 23px 10px;
45 | font-size: 13px;
46 | }
47 |
48 | #stag-sc-form-head {
49 | margin: 0;
50 | padding: 0;
51 | line-height: 1;
52 | font-weight: normal;
53 | font-family: "HelveticaNeue-Light","Helvetica Neue Light","Helvetica Neue",sans-serif;
54 | display: inline-block;
55 | color: white;
56 | }
57 |
58 | #close-popup {
59 | display: inline-block;
60 | width: 22px;
61 | height: 22px;
62 | float: right;
63 | cursor: pointer;
64 | background: url('../img/sprite-popup.png') 0 0 no-repeat;
65 | }
66 |
67 | #stag-sc-form-table {
68 | width: 100%;
69 | }
70 | #stag-sc-form-table .label {
71 | width: 20%;
72 | padding-right: 2%;
73 | display: inline-block;
74 | vertical-align: middle;
75 | padding-bottom: 20px;
76 | color: #8e8e8e;
77 | font-size: 14px;
78 | }
79 | #stag-sc-form-table .field {
80 | width: 77%;
81 | display: inline-block;
82 | padding: 0;
83 | }
84 | #stag-sc-form-table tr.form-row {
85 | display: block;
86 | padding: 5px 0;
87 | }
88 | #stag-sc-form-table tbody:last-child tr.form-row {
89 | border: none;
90 | }
91 | #stag-sc-form-table .stag-form-desc, #stag-sc-form-table .child-clone-row-desc {
92 | display: block;
93 | font-size: 12px;
94 | color: #adadad;
95 | padding-top: 5px;
96 | }
97 |
98 | .stag-input {
99 | width: 100%;
100 | }
101 |
102 | .stag-input,
103 | .stag-cinput {
104 | border-radius: 2px !important;
105 | border-color: #e7e7e7 !important;
106 | padding: 13px 10px !important;
107 | -webkit-box-shadow: none !important;
108 | box-shadow: none !important;
109 | font-size: 14px;
110 | }
111 |
112 | #stag-sc-form {
113 | padding: 15px 15px 0 15px;
114 | }
115 |
116 | #form-child-add {
117 | display: block;
118 | width: 630px;
119 | -moz-border-radius: 5px;
120 | border-radius: 5px;
121 | padding: 0;
122 | height: 30px;
123 | line-height: 30px;
124 | margin-bottom: 20px;
125 | font-weight: bold;
126 | font-size: 16px;
127 | text-align: center;
128 | }
129 |
130 | #stag-sc-form-table tbody tr.form-row {
131 | display: block;
132 | }
133 |
134 | #stag-sc-form-table .child-clone-row {
135 | padding: 8px 15px;
136 | background: #F7F7F7;
137 | border: solid 1px #E0E0E0;
138 | margin-bottom: 10px;
139 | cursor: move;
140 | -moz-border-radius: 5px;
141 | border-radius: 5px;
142 | }
143 |
144 | #stag-sc-form-table .child-clone-row-label label {
145 | font-weight: bold;
146 | font-style: italic;
147 | padding-bottom: 7px;
148 | line-height: 1;
149 | display: block;
150 | }
151 |
152 | .child-clone-row-form-row {
153 | display: block;
154 | padding: 7px 0;
155 | border-bottom: solid 1px #DDD;
156 | }
157 |
158 | .child-clone-row-field textarea {
159 | width: 100%;
160 | }
161 |
162 | .child-clone-row-remove {
163 | color: #f00 !important;
164 | padding: 1px;
165 | }
166 |
167 | .child-clone-row-remove:hover {
168 | color: white !important;
169 | background: #f00;
170 | }
171 |
172 | .stag-form-select {
173 | -webkit-appearance: none;
174 | background: url('../img/sprite-popup.png') no-repeat 105% -25px #eaeaea;
175 | border: none;
176 | height: 44px !important;
177 | color: #a9a9a9;
178 | line-height: 1.2 !important;
179 | }
180 |
181 | /* Retina Queries */
182 | @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi){
183 | #close-popup {
184 | background-size: 22px 105px;
185 | background-position-y: -49px;
186 | }
187 | .stag-form-select {
188 | background-size: 22px 105px;
189 | background-position: 100% -75px;
190 | }
191 | }
192 |
193 | .stag-all-icons {
194 | height: 175px;
195 | overflow: auto;
196 | width: 100%;
197 | border: 1px solid #AAA;
198 | overflow-x: hidden;
199 | max-width: 484px;
200 | background: #fff;
201 | }
202 |
203 | .stag-all-icons i {
204 | position: relative;
205 | font-size: 25px;
206 | line-height: 1em;
207 | width: 1em;
208 | color: #494949;
209 | padding: 9px;
210 | display: inline-block;
211 | vertical-align: top;
212 | text-align: center;
213 | border: 1px solid #E1E1E1;
214 | margin-left: -1px;
215 | margin-top: -1px;
216 | cursor: pointer;
217 | }
218 |
219 | .stag-all-icons i.active-icon {
220 | color: #D54E21 !important;
221 | }
222 |
223 | .stag-all-icons i:hover {
224 | color: #278AB7;
225 | background: #fff;
226 | }
227 |
228 | .stag-all-icons .icon-category {
229 | display: block;
230 | font-weight: bold;
231 | margin: 15px 0 15px 5px;
232 | }
233 |
234 | #TB_ajaxContent#TB_ajaxContent {
235 | padding: 0 !important;
236 | width: 100% !important;
237 | height: 100% !important;
238 | }
239 |
240 | .stag-control-buttonset {
241 | position: relative;
242 | width: 100%;
243 | padding: 1px;
244 | overflow: auto;
245 | height: auto;
246 | }
247 |
248 | .stag-control-buttonset label {
249 | display: inline-block;
250 | float: left;
251 | font-size: 13px;
252 | border: none;
253 | outline: 1px solid #ccc;
254 | line-height: 28px;
255 | padding: 5px 10px;
256 | border-color: #ccc;
257 | background: #eee;
258 | }
259 |
260 | .stag-control-buttonset label.ui-state-default {
261 | background: #eee;
262 | }
263 |
264 | .stag-control-buttonset label.ui-state-active {
265 | color: #212121;
266 | background: #fff;
267 | }
268 |
--------------------------------------------------------------------------------
/assets/css/stag-shortcodes.css:
--------------------------------------------------------------------------------
1 | .stag-clearfix {
2 | zoom: 1;
3 | }
4 | .stag-clearfix:before, .stag-clearfix:after {
5 | display: table;
6 | content: "";
7 | }
8 | .stag-clearfix:after {
9 | clear: both;
10 | }
11 |
12 | .stag-tabs,
13 | .stag-toggle,
14 | .stag-video {
15 | margin: 0 0 2em 0;
16 | }
17 |
18 | /* BUTTONS */
19 | .stag-button {
20 | -webkit-appearance: none;
21 | -webkit-font-smoothing: inherit;
22 | display: inline-block;
23 | background: #979797;
24 | color: #fff;
25 | font-size: 16px;
26 | line-height: 1;
27 | margin: 5px;
28 | padding: 12px 16px;
29 | border-radius: 0;
30 | text-decoration: none !important;
31 | text-align: center;
32 | -webkit-box-sizing: border-box;
33 | box-sizing: border-box;
34 | -webkit-transition: all 200ms ease-in-out;
35 | transition: all 200ms ease-in-out;
36 | }
37 | .stag-button:hover {
38 | color: #fff;
39 | text-decoration: none;
40 | }
41 | .stag-button--normal {
42 | filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=90);
43 | opacity: 0.9;
44 | }
45 | .stag-button--medium {
46 | font-size: 18px;
47 | padding: 17px 22px;
48 | }
49 | .stag-button--large {
50 | font-size: 20px;
51 | padding: 22px 40px;
52 | }
53 | .stag-button--stroke {
54 | background: transparent;
55 | border: 1px solid transparent;
56 | }
57 |
58 | .stag-button--black {
59 | background: #000;
60 | }
61 |
62 | .stag-button--stroke.stag-button--black {
63 | background: transparent;
64 | color: #000;
65 | border-color: #000;
66 | }
67 | .stag-button--stroke.stag-button--black:hover {
68 | background: #000;
69 | color: white;
70 | }
71 |
72 | .stag-button--blue {
73 | background: #1b93c7;
74 | }
75 |
76 | .stag-button--stroke.stag-button--blue {
77 | background: transparent;
78 | color: #1b93c7;
79 | border-color: #1b93c7;
80 | }
81 | .stag-button--stroke.stag-button--blue:hover {
82 | background: #1b93c7;
83 | color: white;
84 | }
85 |
86 | .stag-button--green {
87 | background: #84c333;
88 | }
89 |
90 | .stag-button--stroke.stag-button--green {
91 | background: transparent;
92 | color: #84c333;
93 | border-color: #84c333;
94 | }
95 | .stag-button--stroke.stag-button--green:hover {
96 | background: #84c333;
97 | color: white;
98 | }
99 |
100 | .stag-button--grey {
101 | background: #979797;
102 | }
103 |
104 | .stag-button--stroke.stag-button--grey {
105 | background: transparent;
106 | color: #979797;
107 | border-color: #979797;
108 | }
109 | .stag-button--stroke.stag-button--grey:hover {
110 | background: #979797;
111 | color: white;
112 | }
113 |
114 | .stag-button--light-blue {
115 | background: #56c3f2;
116 | }
117 |
118 | .stag-button--stroke.stag-button--light-blue {
119 | background: transparent;
120 | color: #56c3f2;
121 | border-color: #56c3f2;
122 | }
123 | .stag-button--stroke.stag-button--light-blue:hover {
124 | background: #56c3f2;
125 | color: white;
126 | }
127 |
128 | .stag-button--orange {
129 | background: #fc901d;
130 | }
131 |
132 | .stag-button--stroke.stag-button--orange {
133 | background: transparent;
134 | color: #fc901d;
135 | border-color: #fc901d;
136 | }
137 | .stag-button--stroke.stag-button--orange:hover {
138 | background: #fc901d;
139 | color: white;
140 | }
141 |
142 | .stag-button--red {
143 | background: #d15858;
144 | }
145 |
146 | .stag-button--stroke.stag-button--red {
147 | background: transparent;
148 | color: #d15858;
149 | border-color: #d15858;
150 | }
151 | .stag-button--stroke.stag-button--red:hover {
152 | background: #d15858;
153 | color: white;
154 | }
155 |
156 | .stag-button--purple {
157 | background: #c16ad7;
158 | }
159 |
160 | .stag-button--stroke.stag-button--purple {
161 | background: transparent;
162 | color: #c16ad7;
163 | border-color: #c16ad7;
164 | }
165 | .stag-button--stroke.stag-button--purple:hover {
166 | background: #c16ad7;
167 | color: white;
168 | }
169 |
170 | .stag-button--white {
171 | background: #fff;
172 | color: black;
173 | }
174 | .stag-button--white:hover {
175 | color: black;
176 | }
177 |
178 | .stag-button--stroke.stag-button--white {
179 | background: transparent;
180 | color: #fff;
181 | border-color: #fff;
182 | }
183 | .stag-button--stroke.stag-button--white:hover {
184 | background: white;
185 | color: black;
186 | }
187 |
188 | .stag-button--dark {
189 | background: #363f48;
190 | }
191 |
192 | .stag-button--stroke.stag-button--dark {
193 | background: transparent;
194 | color: #363f48;
195 | border-color: #363f48;
196 | }
197 | .stag-button--stroke.stag-button--dark:hover {
198 | background: #363f48;
199 | color: white;
200 | }
201 |
202 | .stag-button--gray {
203 | background: #979797;
204 | }
205 |
206 | .stag-intro-text {
207 | font-size: 125%;
208 | margin-bottom: 2em;
209 | display: block;
210 | }
211 |
212 | /* ALERTS */
213 | .stag-alert {
214 | text-align: center;
215 | color: #fff;
216 | padding: 20px 15px;
217 | margin: 1em 0;
218 | display: block;
219 | }
220 | .stag-alert--white {
221 | background: #f5f5f5;
222 | }
223 | .stag-alert--grey {
224 | background: #979797;
225 | }
226 | .stag-alert--red {
227 | background: #d15858;
228 | }
229 | .stag-alert--yellow {
230 | background: #ffd164;
231 | }
232 | .stag-alert--green {
233 | background: #84c333;
234 | }
235 | .stag-alert--blue {
236 | background: #1b93c7;
237 | }
238 |
239 | .stag-alert--gray {
240 | background: #979797;
241 | }
242 |
243 | .stag-dropcap {
244 | display: block;
245 | float: left;
246 | text-align: center;
247 | margin: 5px 15px 15px 0;
248 | }
249 |
250 | .stag-dropcap--squared {
251 | background: #363f48;
252 | background: var(--stagtools-accent, #363f48);
253 | color: #fff;
254 | }
255 |
256 | /* DIVIDER */
257 | .stag-divider {
258 | border: 0;
259 | height: 1px;
260 | background: #363f48;
261 | background: var(--stagtools-accent, #363f48);
262 | margin: 2em 0;
263 | }
264 | .stag-divider--strong {
265 | height: 7px;
266 | }
267 | .stag-divider--double {
268 | height: 7px;
269 | }
270 | .stag-divider--double:after {
271 | content: '';
272 | display: block;
273 | border-bottom: 1px solid #363f48;
274 | border-bottom: 1px solid var(--stagtools-accent, #363f48);
275 | position: relative;
276 | top: 10px;
277 | }
278 | .stag-divider--dashed {
279 | background: none;
280 | border-bottom: 1px dashed #363f48;
281 | border-bottom: 1px dashed var(--stagtools-accent, #363f48);
282 | }
283 | .stag-divider--dotted {
284 | background: none;
285 | border-bottom: 1px dotted #363f48;
286 | border-bottom: 1px dotted var(--stagtools-accent, #363f48);
287 | }
288 |
289 | /* Tabs */
290 | .stag-nav {
291 | list-style: none !important;
292 | margin: 0;
293 | padding: 0;
294 | }
295 | .stag-nav li {
296 | margin: 0;
297 | float: left;
298 | position: relative;
299 | margin: 0 1px -1px 0 !important;
300 | z-index: 1;
301 | outline: 0;
302 | }
303 | .stag-nav a {
304 | text-decoration: none;
305 | display: block;
306 | padding: 15px 10px;
307 | line-height: 1;
308 | outline: 0;
309 | }
310 |
311 | .stag-tab {
312 | padding: 21px 20px 20px 20px;
313 | }
314 | .stag-tab p:first-of-type {
315 | margin-top: 0;
316 | }
317 | .stag-tab p:last-of-type {
318 | margin-bottom: 0;
319 | }
320 |
321 | .stag-tabs--normal .stag-nav a {
322 | background: #363f48;
323 | background: var(--stagtools-accent, #363f48);
324 | color: #fff;
325 | }
326 |
327 | .stag-tabs--normal .stag-nav .ui-tabs-active a {
328 | background: #fbfbfb;
329 | color: #363f48;
330 | color: var(--stagtools-accent, #363f48);
331 | outline: 0;
332 | }
333 |
334 | .stag-tabs--normal .stag-tab {
335 | background: #fbfbfb;
336 | }
337 |
338 | .stag-tabs--stroke .stag-nav li {
339 | margin: 0 -1px 0 0 !important;
340 | }
341 |
342 | .stag-tabs--stroke .stag-nav a {
343 | border: 1px solid #363f48;
344 | border: 1px solid var(--stagtools-accent, #363f48);
345 | color: #363f48;
346 | color: var(--stagtools-accent, #363f48);
347 | }
348 |
349 | .stag-tabs--stroke .stag-nav .ui-tabs-active a {
350 | border-bottom-color: white;
351 | }
352 |
353 | .stag-tabs--stroke .stag-tab {
354 | border: 1px solid #363f48;
355 | border: 1px solid var(--stagtools-accent, #363f48);
356 | margin-top: -1px;
357 | }
358 |
359 | .stag-toggle-title {
360 | display: block;
361 | padding: 15px 10px;
362 | outline: 0;
363 | cursor: pointer;
364 | position: relative;
365 | }
366 |
367 | .stag-toggle-title:after {
368 | position: absolute;
369 | top: 50%;
370 | right: 15px;
371 | font-size: 18px;
372 | -webkit-transform: translateY(-50%);
373 | transform: translateY(-50%);
374 | content: '\f067';
375 | display: inline-block;
376 | font-family: 'Font Awesome 5 Free';
377 | font-style: normal;
378 | font-weight: 900;
379 | line-height: 1;
380 | -webkit-font-smoothing: antialiased;
381 | -moz-osx-font-smoothing: grayscale;
382 | }
383 |
384 | .stag-toggle-title.ui-state-active:after {
385 | content: "\f068";
386 | }
387 |
388 | .stag-toggle-content {
389 | padding: 20px;
390 | }
391 |
392 | .stag-toggle--normal .stag-toggle-title {
393 | background: #363f48;
394 | background: var(--stagtools-accent, #363f48);
395 | color: white;
396 | }
397 |
398 | .stag-toggle--stroke .stag-toggle-title {
399 | border: 1px solid #363f48;
400 | border: 1px solid var(--stagtools-accent, #363f48);
401 | }
402 |
403 | .stag-toggle--stroke .stag-toggle-title:after {
404 | color: #363f48;
405 | color: var(--stagtools-accent, #363f48);
406 | }
407 |
408 | /* Image */
409 | .stag-image {
410 | display: inline-block;
411 | }
412 | .stag-image--left {
413 | float: left;
414 | margin: 0 1.5em 1em 0;
415 | }
416 | .stag-image--center {
417 | display: block;
418 | margin: 1.5em 0;
419 | text-align: center;
420 | }
421 | .stag-image--right {
422 | float: right;
423 | margin: 0 0 1.5em 1.5em;
424 | }
425 | .stag-image--grayscale {
426 | -webkit-filter: grayscale(1);
427 | filter: grayscale(1);
428 | }
429 | .stag-image--sepia {
430 | -webkit-filter: sepia(100%);
431 | filter: sepia(100%);
432 | }
433 | .stag-image--blur {
434 | -webkit-filter: blur(2px);
435 | filter: blur(2px);
436 | }
437 | .stag-image--hue-rotate {
438 | -webkit-filter: hue-rotate(50deg);
439 | filter: hue-rotate(50deg);
440 | }
441 | .stag-image--contrast {
442 | -webkit-filter: contrast(15%);
443 | filter: contrast(15%);
444 | }
445 | .stag-image--brightness {
446 | -webkit-filter: brightness(2);
447 | filter: brightness(2);
448 | }
449 | .stag-image--invert {
450 | -webkit-filter: invert(100%);
451 | filter: invert(100%);
452 | }
453 |
454 | /* Video */
455 | .stag-video {
456 | position: relative;
457 | padding-bottom: 56.25%;
458 | padding-top: 30px;
459 | height: 0;
460 | overflow: hidden;
461 | }
462 | .stag-video iframe,
463 | .stag-video object,
464 | .stag-video embed {
465 | position: absolute;
466 | top: 0;
467 | left: 0;
468 | width: 100%;
469 | height: 100%;
470 | }
471 |
472 | @media (min-width: 700px) {
473 | .stag-one-half {
474 | width: 48%;
475 | }
476 |
477 | .stag-one-third {
478 | width: 30.66%;
479 | }
480 |
481 | .stag-two-third {
482 | width: 65.33%;
483 | }
484 |
485 | .stag-one-fourth {
486 | width: 22%;
487 | }
488 |
489 | .stag-three-fourth {
490 | width: 74%;
491 | }
492 |
493 | .stag-one-fifth {
494 | width: 16.8%;
495 | }
496 |
497 | .stag-two-fifth {
498 | width: 37.6%;
499 | }
500 |
501 | .stag-three-fifth {
502 | width: 58.4%;
503 | }
504 |
505 | .stag-four-fifth {
506 | width: 79.2%;
507 | }
508 |
509 | .stag-one-sixth {
510 | width: 13.33%;
511 | }
512 |
513 | .stag-five-sixth {
514 | width: 82.67%;
515 | }
516 |
517 | .stag-one-half,
518 | .stag-one-third,
519 | .stag-two-third,
520 | .stag-three-fourth,
521 | .stag-one-fourth,
522 | .stag-one-fifth,
523 | .stag-two-fifth,
524 | .stag-three-fifth,
525 | .stag-four-fifth,
526 | .stag-one-sixth,
527 | .stag-five-sixth {
528 | position: relative;
529 | margin-right: 4%;
530 | margin-bottom: 2em;
531 | float: left;
532 | }
533 |
534 | .stag-column-last {
535 | margin-right: 0 !important;
536 | clear: right;
537 | }
538 | }
539 | .stag-icon-link {
540 | text-decoration: none;
541 | -webkit-transition: color 150ms;
542 | transition: color 150ms;
543 | }
544 |
545 | .fa,
546 | .stag-icon {
547 | text-align: center;
548 | vertical-align: middle;
549 | }
550 | .fa--before .fa,
551 | .stag-icon--before .fa, .fa--before
552 | .stag-icon,
553 | .stag-icon--before
554 | .stag-icon {
555 | margin-right: 0.7em;
556 | }
557 | .fa--after .fa,
558 | .stag-icon--after .fa, .fa--after
559 | .stag-icon,
560 | .stag-icon--after
561 | .stag-icon {
562 | margin-left: 0.7em;
563 | }
564 |
565 | .stag-icon--before svg {
566 | margin-right: 0.7em;
567 | }
568 |
569 | .stag-icon--after svg {
570 | margin-left: 0.7em;
571 | }
572 |
573 | .stag-twitter .time-ago {
574 | display: block;
575 | font-size: .9em;
576 | font-style: italic;
577 | margin-top: 5px;
578 | }
579 | .stag-twitter .twitter-follow-button {
580 | margin: 0;
581 | }
582 |
583 | .stag-latest-tweets {
584 | list-style: none;
585 | margin: 0;
586 | padding: 0;
587 | }
588 | .stag-latest-tweets li {
589 | margin-bottom: 15px;
590 | }
591 |
592 | .stag-flickr li {
593 | list-style: none;
594 | display: inline-block;
595 | margin: 0 5px 5px 0;
596 | }
597 |
598 | .stag-social-icons {
599 | font-size: 45px;
600 | }
601 | .stag-social-icons .stag-icon {
602 | line-height: 72px;
603 | }
604 | .stag-social-icons a {
605 | display: inline-block;
606 | width: 72px;
607 | height: 72px;
608 | text-align: center;
609 | vertical-align: top;
610 | margin: 0 10px 10px 0;
611 | text-decoration: none;
612 | }
613 | .stag-social-icons.normal a {
614 | color: #2f322b;
615 | border: none;
616 | }
617 | .stag-social-icons.square a {
618 | background: #2f322b;
619 | color: #fff;
620 | border: none;
621 | }
622 |
623 | .google-map {
624 | margin: 0 0 2em 0;
625 | }
626 |
627 | .gm-style img {
628 | max-width: none;
629 | }
630 |
631 | .dribbbles {
632 | list-style: none;
633 | }
634 |
--------------------------------------------------------------------------------
/assets/img/codestag-icon.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
14 |
--------------------------------------------------------------------------------
/assets/img/sprite-popup.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codestag/stagtools/2635655608eb46b29f44911db766f0a344ad24b1/assets/img/sprite-popup.png
--------------------------------------------------------------------------------
/assets/js/editor_plugin.js:
--------------------------------------------------------------------------------
1 | (function(){
2 | tinymce.create( "tinymce.plugins.stagShortcodes", {
3 |
4 | init: function ( d, e ) {
5 | d.addCommand("stagPopup", function( a, params){
6 | var popup = params.identifier;
7 |
8 | // load thickbox
9 | tb_show("Insert Stag Shortcode", ajaxurl + "?action=popup&popup=" + popup + "&width=" + 670 );
10 | });
11 | },
12 |
13 | createControl: function( d, e ){
14 | var ed = tinymce.activeEditor,
15 | IsSCSActive = ( typeof StagShortcodes !== 'undefined' && StagShortcodes.is_scs_active === "1") ? true : false;
16 |
17 | if( d === "stagShortcodes" ){
18 | d = e.createMenuButton( "stagShortcodes", {
19 | title: ed.getLang('stag.insert'),
20 | icons: false
21 | });
22 |
23 | var a = this;
24 | d.onRenderMenu.add( function( c, b ) {
25 |
26 | c = b.addMenu( { title:ed.getLang('stag.media_elements') } );
27 | a.addWithPopup( c, ed.getLang('stag.image'), "image" );
28 | a.addWithPopup( c, ed.getLang('stag.video'), "video" );
29 |
30 | if(IsSCSActive){
31 | a.addWithPopup( b, ed.getLang('stag.widget_area'), "widget_area" );
32 | }
33 |
34 | b.addSeparator();
35 |
36 | a.addWithPopup( b, ed.getLang('stag.button'), "button" );
37 | a.addWithPopup( b, ed.getLang('stag.columns'), "columns" );
38 | a.addWithPopup( b, ed.getLang('stag.dropcap'), "dropcap" );
39 | a.addWithPopup( b, ed.getLang('stag.tabs'), "tabs" );
40 | a.addWithPopup( b, ed.getLang('stag.toggle'), "toggle" );
41 | a.addWithPopup( b, ed.getLang('stag.icon'), "icon" );
42 | a.addWithPopup( b, ed.getLang('stag.map'), "map" );
43 |
44 | });
45 |
46 | return d;
47 |
48 | }
49 | return null;
50 | },
51 |
52 | addWithPopup: function (d, e, a){
53 | d.add({
54 | title: e,
55 | onclick: function() {
56 | tinyMCE.activeEditor.execCommand( "stagPopup", false, {
57 | title: e,
58 | identifier: a
59 | })
60 | }
61 | });
62 | },
63 |
64 | addImmediate:function(d,e,a){
65 | d.add({
66 | title:e,
67 | onclick:function(){
68 | tinyMCE.activeEditor.execCommand( "mceInsertContent",false,a)
69 | }
70 | })
71 | }
72 |
73 | });
74 |
75 | tinymce.PluginManager.add( "stagShortcodes", tinymce.plugins.stagShortcodes);
76 |
77 | })();
78 |
--------------------------------------------------------------------------------
/assets/js/fa-v4-shims.min.js:
--------------------------------------------------------------------------------
1 | /*!
2 | * Font Awesome Free 5.15.3 by @fontawesome - https://fontawesome.com
3 | * License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
4 | */
5 | var l,a;l=this,a=function(){"use strict";var l={},a={};try{"undefined"!=typeof window&&(l=window),"undefined"!=typeof document&&(a=document)}catch(l){}var e=(l.navigator||{}).userAgent,r=void 0===e?"":e,n=l,o=a,u=(n.document,!!o.documentElement&&!!o.head&&"function"==typeof o.addEventListener&&o.createElement,~r.indexOf("MSIE")||r.indexOf("Trident/"),"___FONT_AWESOME___"),t=function(){try{return"production"===process.env.NODE_ENV}catch(l){return!1}}();var f=n||{};f[u]||(f[u]={}),f[u].styles||(f[u].styles={}),f[u].hooks||(f[u].hooks={}),f[u].shims||(f[u].shims=[]);var i=f[u],s=[["glass",null,"glass-martini"],["meetup","fab",null],["star-o","far","star"],["remove",null,"times"],["close",null,"times"],["gear",null,"cog"],["trash-o","far","trash-alt"],["file-o","far","file"],["clock-o","far","clock"],["arrow-circle-o-down","far","arrow-alt-circle-down"],["arrow-circle-o-up","far","arrow-alt-circle-up"],["play-circle-o","far","play-circle"],["repeat",null,"redo"],["rotate-right",null,"redo"],["refresh",null,"sync"],["list-alt","far",null],["dedent",null,"outdent"],["video-camera",null,"video"],["picture-o","far","image"],["photo","far","image"],["image","far","image"],["pencil",null,"pencil-alt"],["map-marker",null,"map-marker-alt"],["pencil-square-o","far","edit"],["share-square-o","far","share-square"],["check-square-o","far","check-square"],["arrows",null,"arrows-alt"],["times-circle-o","far","times-circle"],["check-circle-o","far","check-circle"],["mail-forward",null,"share"],["expand",null,"expand-alt"],["compress",null,"compress-alt"],["eye","far",null],["eye-slash","far",null],["warning",null,"exclamation-triangle"],["calendar",null,"calendar-alt"],["arrows-v",null,"arrows-alt-v"],["arrows-h",null,"arrows-alt-h"],["bar-chart","far","chart-bar"],["bar-chart-o","far","chart-bar"],["twitter-square","fab",null],["facebook-square","fab",null],["gears",null,"cogs"],["thumbs-o-up","far","thumbs-up"],["thumbs-o-down","far","thumbs-down"],["heart-o","far","heart"],["sign-out",null,"sign-out-alt"],["linkedin-square","fab","linkedin"],["thumb-tack",null,"thumbtack"],["external-link",null,"external-link-alt"],["sign-in",null,"sign-in-alt"],["github-square","fab",null],["lemon-o","far","lemon"],["square-o","far","square"],["bookmark-o","far","bookmark"],["twitter","fab",null],["facebook","fab","facebook-f"],["facebook-f","fab","facebook-f"],["github","fab",null],["credit-card","far",null],["feed",null,"rss"],["hdd-o","far","hdd"],["hand-o-right","far","hand-point-right"],["hand-o-left","far","hand-point-left"],["hand-o-up","far","hand-point-up"],["hand-o-down","far","hand-point-down"],["arrows-alt",null,"expand-arrows-alt"],["group",null,"users"],["chain",null,"link"],["scissors",null,"cut"],["files-o","far","copy"],["floppy-o","far","save"],["navicon",null,"bars"],["reorder",null,"bars"],["pinterest","fab",null],["pinterest-square","fab",null],["google-plus-square","fab",null],["google-plus","fab","google-plus-g"],["money","far","money-bill-alt"],["unsorted",null,"sort"],["sort-desc",null,"sort-down"],["sort-asc",null,"sort-up"],["linkedin","fab","linkedin-in"],["rotate-left",null,"undo"],["legal",null,"gavel"],["tachometer",null,"tachometer-alt"],["dashboard",null,"tachometer-alt"],["comment-o","far","comment"],["comments-o","far","comments"],["flash",null,"bolt"],["clipboard","far",null],["paste","far","clipboard"],["lightbulb-o","far","lightbulb"],["exchange",null,"exchange-alt"],["cloud-download",null,"cloud-download-alt"],["cloud-upload",null,"cloud-upload-alt"],["bell-o","far","bell"],["cutlery",null,"utensils"],["file-text-o","far","file-alt"],["building-o","far","building"],["hospital-o","far","hospital"],["tablet",null,"tablet-alt"],["mobile",null,"mobile-alt"],["mobile-phone",null,"mobile-alt"],["circle-o","far","circle"],["mail-reply",null,"reply"],["github-alt","fab",null],["folder-o","far","folder"],["folder-open-o","far","folder-open"],["smile-o","far","smile"],["frown-o","far","frown"],["meh-o","far","meh"],["keyboard-o","far","keyboard"],["flag-o","far","flag"],["mail-reply-all",null,"reply-all"],["star-half-o","far","star-half"],["star-half-empty","far","star-half"],["star-half-full","far","star-half"],["code-fork",null,"code-branch"],["chain-broken",null,"unlink"],["shield",null,"shield-alt"],["calendar-o","far","calendar"],["maxcdn","fab",null],["html5","fab",null],["css3","fab",null],["ticket",null,"ticket-alt"],["minus-square-o","far","minus-square"],["level-up",null,"level-up-alt"],["level-down",null,"level-down-alt"],["pencil-square",null,"pen-square"],["external-link-square",null,"external-link-square-alt"],["compass","far",null],["caret-square-o-down","far","caret-square-down"],["toggle-down","far","caret-square-down"],["caret-square-o-up","far","caret-square-up"],["toggle-up","far","caret-square-up"],["caret-square-o-right","far","caret-square-right"],["toggle-right","far","caret-square-right"],["eur",null,"euro-sign"],["euro",null,"euro-sign"],["gbp",null,"pound-sign"],["usd",null,"dollar-sign"],["dollar",null,"dollar-sign"],["inr",null,"rupee-sign"],["rupee",null,"rupee-sign"],["jpy",null,"yen-sign"],["cny",null,"yen-sign"],["rmb",null,"yen-sign"],["yen",null,"yen-sign"],["rub",null,"ruble-sign"],["ruble",null,"ruble-sign"],["rouble",null,"ruble-sign"],["krw",null,"won-sign"],["won",null,"won-sign"],["btc","fab",null],["bitcoin","fab","btc"],["file-text",null,"file-alt"],["sort-alpha-asc",null,"sort-alpha-down"],["sort-alpha-desc",null,"sort-alpha-down-alt"],["sort-amount-asc",null,"sort-amount-down"],["sort-amount-desc",null,"sort-amount-down-alt"],["sort-numeric-asc",null,"sort-numeric-down"],["sort-numeric-desc",null,"sort-numeric-down-alt"],["youtube-square","fab",null],["youtube","fab",null],["xing","fab",null],["xing-square","fab",null],["youtube-play","fab","youtube"],["dropbox","fab",null],["stack-overflow","fab",null],["instagram","fab",null],["flickr","fab",null],["adn","fab",null],["bitbucket","fab",null],["bitbucket-square","fab","bitbucket"],["tumblr","fab",null],["tumblr-square","fab",null],["long-arrow-down",null,"long-arrow-alt-down"],["long-arrow-up",null,"long-arrow-alt-up"],["long-arrow-left",null,"long-arrow-alt-left"],["long-arrow-right",null,"long-arrow-alt-right"],["apple","fab",null],["windows","fab",null],["android","fab",null],["linux","fab",null],["dribbble","fab",null],["skype","fab",null],["foursquare","fab",null],["trello","fab",null],["gratipay","fab",null],["gittip","fab","gratipay"],["sun-o","far","sun"],["moon-o","far","moon"],["vk","fab",null],["weibo","fab",null],["renren","fab",null],["pagelines","fab",null],["stack-exchange","fab",null],["arrow-circle-o-right","far","arrow-alt-circle-right"],["arrow-circle-o-left","far","arrow-alt-circle-left"],["caret-square-o-left","far","caret-square-left"],["toggle-left","far","caret-square-left"],["dot-circle-o","far","dot-circle"],["vimeo-square","fab",null],["try",null,"lira-sign"],["turkish-lira",null,"lira-sign"],["plus-square-o","far","plus-square"],["slack","fab",null],["wordpress","fab",null],["openid","fab",null],["institution",null,"university"],["bank",null,"university"],["mortar-board",null,"graduation-cap"],["yahoo","fab",null],["google","fab",null],["reddit","fab",null],["reddit-square","fab",null],["stumbleupon-circle","fab",null],["stumbleupon","fab",null],["delicious","fab",null],["digg","fab",null],["pied-piper-pp","fab",null],["pied-piper-alt","fab",null],["drupal","fab",null],["joomla","fab",null],["spoon",null,"utensil-spoon"],["behance","fab",null],["behance-square","fab",null],["steam","fab",null],["steam-square","fab",null],["automobile",null,"car"],["envelope-o","far","envelope"],["spotify","fab",null],["deviantart","fab",null],["soundcloud","fab",null],["file-pdf-o","far","file-pdf"],["file-word-o","far","file-word"],["file-excel-o","far","file-excel"],["file-powerpoint-o","far","file-powerpoint"],["file-image-o","far","file-image"],["file-photo-o","far","file-image"],["file-picture-o","far","file-image"],["file-archive-o","far","file-archive"],["file-zip-o","far","file-archive"],["file-audio-o","far","file-audio"],["file-sound-o","far","file-audio"],["file-video-o","far","file-video"],["file-movie-o","far","file-video"],["file-code-o","far","file-code"],["vine","fab",null],["codepen","fab",null],["jsfiddle","fab",null],["life-ring","far",null],["life-bouy","far","life-ring"],["life-buoy","far","life-ring"],["life-saver","far","life-ring"],["support","far","life-ring"],["circle-o-notch",null,"circle-notch"],["rebel","fab",null],["ra","fab","rebel"],["resistance","fab","rebel"],["empire","fab",null],["ge","fab","empire"],["git-square","fab",null],["git","fab",null],["hacker-news","fab",null],["y-combinator-square","fab","hacker-news"],["yc-square","fab","hacker-news"],["tencent-weibo","fab",null],["qq","fab",null],["weixin","fab",null],["wechat","fab","weixin"],["send",null,"paper-plane"],["paper-plane-o","far","paper-plane"],["send-o","far","paper-plane"],["circle-thin","far","circle"],["header",null,"heading"],["sliders",null,"sliders-h"],["futbol-o","far","futbol"],["soccer-ball-o","far","futbol"],["slideshare","fab",null],["twitch","fab",null],["yelp","fab",null],["newspaper-o","far","newspaper"],["paypal","fab",null],["google-wallet","fab",null],["cc-visa","fab",null],["cc-mastercard","fab",null],["cc-discover","fab",null],["cc-amex","fab",null],["cc-paypal","fab",null],["cc-stripe","fab",null],["bell-slash-o","far","bell-slash"],["trash",null,"trash-alt"],["copyright","far",null],["eyedropper",null,"eye-dropper"],["area-chart",null,"chart-area"],["pie-chart",null,"chart-pie"],["line-chart",null,"chart-line"],["lastfm","fab",null],["lastfm-square","fab",null],["ioxhost","fab",null],["angellist","fab",null],["cc","far","closed-captioning"],["ils",null,"shekel-sign"],["shekel",null,"shekel-sign"],["sheqel",null,"shekel-sign"],["meanpath","fab","font-awesome"],["buysellads","fab",null],["connectdevelop","fab",null],["dashcube","fab",null],["forumbee","fab",null],["leanpub","fab",null],["sellsy","fab",null],["shirtsinbulk","fab",null],["simplybuilt","fab",null],["skyatlas","fab",null],["diamond","far","gem"],["intersex",null,"transgender"],["facebook-official","fab","facebook"],["pinterest-p","fab",null],["whatsapp","fab",null],["hotel",null,"bed"],["viacoin","fab",null],["medium","fab",null],["y-combinator","fab",null],["yc","fab","y-combinator"],["optin-monster","fab",null],["opencart","fab",null],["expeditedssl","fab",null],["battery-4",null,"battery-full"],["battery",null,"battery-full"],["battery-3",null,"battery-three-quarters"],["battery-2",null,"battery-half"],["battery-1",null,"battery-quarter"],["battery-0",null,"battery-empty"],["object-group","far",null],["object-ungroup","far",null],["sticky-note-o","far","sticky-note"],["cc-jcb","fab",null],["cc-diners-club","fab",null],["clone","far",null],["hourglass-o","far","hourglass"],["hourglass-1",null,"hourglass-start"],["hourglass-2",null,"hourglass-half"],["hourglass-3",null,"hourglass-end"],["hand-rock-o","far","hand-rock"],["hand-grab-o","far","hand-rock"],["hand-paper-o","far","hand-paper"],["hand-stop-o","far","hand-paper"],["hand-scissors-o","far","hand-scissors"],["hand-lizard-o","far","hand-lizard"],["hand-spock-o","far","hand-spock"],["hand-pointer-o","far","hand-pointer"],["hand-peace-o","far","hand-peace"],["registered","far",null],["creative-commons","fab",null],["gg","fab",null],["gg-circle","fab",null],["tripadvisor","fab",null],["odnoklassniki","fab",null],["odnoklassniki-square","fab",null],["get-pocket","fab",null],["wikipedia-w","fab",null],["safari","fab",null],["chrome","fab",null],["firefox","fab",null],["opera","fab",null],["internet-explorer","fab",null],["television",null,"tv"],["contao","fab",null],["500px","fab",null],["amazon","fab",null],["calendar-plus-o","far","calendar-plus"],["calendar-minus-o","far","calendar-minus"],["calendar-times-o","far","calendar-times"],["calendar-check-o","far","calendar-check"],["map-o","far","map"],["commenting",null,"comment-dots"],["commenting-o","far","comment-dots"],["houzz","fab",null],["vimeo","fab","vimeo-v"],["black-tie","fab",null],["fonticons","fab",null],["reddit-alien","fab",null],["edge","fab",null],["credit-card-alt",null,"credit-card"],["codiepie","fab",null],["modx","fab",null],["fort-awesome","fab",null],["usb","fab",null],["product-hunt","fab",null],["mixcloud","fab",null],["scribd","fab",null],["pause-circle-o","far","pause-circle"],["stop-circle-o","far","stop-circle"],["bluetooth","fab",null],["bluetooth-b","fab",null],["gitlab","fab",null],["wpbeginner","fab",null],["wpforms","fab",null],["envira","fab",null],["wheelchair-alt","fab","accessible-icon"],["question-circle-o","far","question-circle"],["volume-control-phone",null,"phone-volume"],["asl-interpreting",null,"american-sign-language-interpreting"],["deafness",null,"deaf"],["hard-of-hearing",null,"deaf"],["glide","fab",null],["glide-g","fab",null],["signing",null,"sign-language"],["viadeo","fab",null],["viadeo-square","fab",null],["snapchat","fab",null],["snapchat-ghost","fab",null],["snapchat-square","fab",null],["pied-piper","fab",null],["first-order","fab",null],["yoast","fab",null],["themeisle","fab",null],["google-plus-official","fab","google-plus"],["google-plus-circle","fab","google-plus"],["font-awesome","fab",null],["fa","fab","font-awesome"],["handshake-o","far","handshake"],["envelope-open-o","far","envelope-open"],["linode","fab",null],["address-book-o","far","address-book"],["vcard",null,"address-card"],["address-card-o","far","address-card"],["vcard-o","far","address-card"],["user-circle-o","far","user-circle"],["user-o","far","user"],["id-badge","far",null],["drivers-license",null,"id-card"],["id-card-o","far","id-card"],["drivers-license-o","far","id-card"],["quora","fab",null],["free-code-camp","fab",null],["telegram","fab",null],["thermometer-4",null,"thermometer-full"],["thermometer",null,"thermometer-full"],["thermometer-3",null,"thermometer-three-quarters"],["thermometer-2",null,"thermometer-half"],["thermometer-1",null,"thermometer-quarter"],["thermometer-0",null,"thermometer-empty"],["bathtub",null,"bath"],["s15",null,"bath"],["window-maximize","far",null],["window-restore","far",null],["times-rectangle",null,"window-close"],["window-close-o","far","window-close"],["times-rectangle-o","far","window-close"],["bandcamp","fab",null],["grav","fab",null],["etsy","fab",null],["imdb","fab",null],["ravelry","fab",null],["eercast","fab","sellcast"],["snowflake-o","far","snowflake"],["superpowers","fab",null],["wpexplorer","fab",null],["cab",null,"taxi"]];return function(l){try{l()}catch(l){if(!t)throw l}}(function(){var l;"function"==typeof i.hooks.addShims?i.hooks.addShims(s):(l=i.shims).push.apply(l,s)}),s},"object"==typeof exports&&"undefined"!=typeof module?module.exports=a():"function"==typeof define&&define.amd?define(a):l["fontawesome-free-shims"]=a();
--------------------------------------------------------------------------------
/assets/js/plugin-lang.php:
--------------------------------------------------------------------------------
1 | ' )
115 | .css( options.buttonStyle )
116 | .html( label );
117 | }
118 |
119 | // This function can be returned to kill a received event
120 | function nothing( e ) {
121 | e.stopPropagation();
122 | e.preventDefault();
123 | return false;
124 | }
125 |
126 | // Handles a click on the add button
127 | function clicked_add( e ) {
128 | if ( ! options.maxRows || ( rows < options.maxRows ) ) {
129 | add_row();
130 | }
131 | return nothing( e );
132 | }
133 |
134 | // Handles a click event on the remove button
135 | function clicked_del( e ) {
136 | if ( 1 < rows ) {
137 | del_row();
138 | }
139 | return nothing( e );
140 | }
141 |
142 | // Update the buttons
143 | update_buttons();
144 |
145 | };
146 | return this;
147 | }() );
148 |
149 | // 3. custom
150 | var FontAwesomeIcons;
151 |
152 | ( function( $ ) {
153 | 'use strict';
154 |
155 | FontAwesomeIcons = function() {
156 | var html = '';
157 |
158 | $.each( stIconObj.fontawesome, function( cat, icons ) {
159 | html += '' + cat + '';
160 |
161 | icons.map( function( icon ) {
162 | html += '';
163 | });
164 | });
165 |
166 | return html;
167 | };
168 |
169 | }( jQuery ) );
170 |
171 | jQuery( document ).ready( function( $ ) {
172 | var stags = {
173 | loadVals: function() {
174 | var shortcode = $( '#_stag_shortcode' ).text(),
175 | uShortcode = shortcode;
176 |
177 | // fill in the gaps eg {{param}}
178 | $( '.stag-input' ).each( function() {
179 | var input = $( this ),
180 | id = input.attr( 'id' ),
181 | id = id.replace( 'stag_', '' ), // gets rid of the stag_ prefix
182 | re = new RegExp( '{{' + id + '}}', 'g' );
183 |
184 | uShortcode = uShortcode.replace( re, input.val() );
185 | });
186 |
187 | // adds the filled-in shortcode as hidden input
188 | $( '#_stag_ushortcode' ).remove();
189 | $( '#stag-sc-form-table' ).prepend( '
' + uShortcode + '
' );
190 | },
191 |
192 | cLoadVals: function() {
193 | var shortcode = $( '#_stag_cshortcode' ).text(),
194 | pShortcode = '';
195 | shortcodes = '';
196 |
197 | // fill in the gaps eg {{param}}
198 | $( '.child-clone-row' ).each( function() {
199 | var row = $( this ),
200 | rShortcode = shortcode;
201 |
202 | $( '.stag-cinput', this ).each( function() {
203 | var input = $( this ),
204 | id = input.attr( 'id' ),
205 | id = id.replace( 'stag_', '' ); // gets rid of the stag_ prefix
206 | re = new RegExp( '{{' + id + '}}', 'g' );
207 |
208 | rShortcode = rShortcode.replace( re, input.val() );
209 | });
210 |
211 | shortcodes = shortcodes + rShortcode + '\n';
212 | });
213 |
214 | // adds the filled-in shortcode as hidden input
215 | $( '#_stag_cshortcodes' ).remove();
216 | $( '.child-clone-rows' ).prepend( '' + shortcodes + '
' );
217 |
218 | // add to parent shortcode
219 | this.loadVals();
220 | pShortcode = $( '#_stag_ushortcode' ).text().replace( '{{child_shortcode}}', shortcodes );
221 |
222 | // add updated parent shortcode
223 | $( '#_stag_ushortcode' ).remove();
224 | $( '#stag-sc-form-table' ).prepend( '' + pShortcode + '
' );
225 | },
226 |
227 | children: function() {
228 |
229 | // assign the cloning plugin
230 | $( '.child-clone-rows' ).appendo({
231 | subSelect: '> div.child-clone-row:last-child',
232 | allowDelete: false,
233 | focusFirst: false
234 | });
235 |
236 | // remove button
237 | $( '.child-clone-rows' ).on( 'click', '.child-clone-row-remove', function() {
238 | var btn = $( this ),
239 | row = btn.parent();
240 |
241 | if ( 1 < $( '.child-clone-row' ).size() ) {
242 | row.remove();
243 | } else {
244 | alert( 'You need a minimum of one row' );
245 | }
246 |
247 | return false;
248 | });
249 |
250 | // assign jUI sortable
251 | $( '.child-clone-rows' ).sortable({
252 | placeholder: 'sortable-placeholder',
253 | items: '.child-clone-row'
254 | });
255 | },
256 |
257 | resizeTB: function() {
258 | var ajaxCont = $( '#TB_ajaxContent' ),
259 | tbWindow = $( '#TB_window' ),
260 | stagPopup = $( '#stag-popup' );
261 |
262 | tbWindow.css({
263 | height: stagPopup.outerHeight(),
264 | width: stagPopup.outerWidth(),
265 | marginLeft: -( stagPopup.outerWidth() / 2 ),
266 | maxHeight: '85%',
267 | overflowY: 'scroll'
268 | });
269 |
270 | ajaxCont.css({
271 | paddingTop: 0,
272 | paddingLeft: 0,
273 | paddingRight: 0,
274 | paddingBottom: 0,
275 | height: ( tbWindow.outerHeight() ),
276 | overflow: 'auto', // IMPORTANT
277 | width: stagPopup.outerWidth()
278 | });
279 |
280 | $( '#stag-popup' ).addClass( 'no_preview' );
281 | },
282 |
283 | media: function() {
284 | var stag_media_frame,
285 | frame_title,
286 | insertButton = $( '.stag-open-media' );
287 |
288 | if ( 'image' === insertButton.data( 'type' ) ) {
289 | frame_title = StagShortcodes.media_frame_image_title;
290 | } else if ( 'video' === insertButton.data( 'type' ) ) {
291 | frame_title = StagShortcodes.media_frame_video_title;
292 | }
293 |
294 | insertButton.on( 'click', function( e ) {
295 | e.preventDefault();
296 |
297 | if ( stag_media_frame ) {
298 | stag_media_frame.open();
299 | return;
300 | }
301 |
302 | stag_media_frame = wp.media.frames.stag_media_frame = wp.media({
303 | className: 'media-frame stag-media-frame',
304 | frame: 'select',
305 | multiple: false,
306 | title: frame_title,
307 | library: {
308 | type: insertButton.data( 'type' )
309 | },
310 | button: {
311 | text: insertButton.data( 'text' )
312 | }
313 | });
314 |
315 | stag_media_frame.on( 'select', function() {
316 | var media_attachment = stag_media_frame.state().get( 'selection' ).first().toJSON();
317 | $( '#stag_src' ).val( media_attachment.url );
318 | $( '.stag-input' ).trigger( 'change' );
319 | });
320 |
321 | stag_media_frame.open();
322 |
323 | });
324 | },
325 |
326 | load: function() {
327 | var stags = this,
328 | tbWindow = $( '#TB_window' ),
329 | popup = $( '#stag-popup' ),
330 | form = $( '#stag-sc-form', popup ),
331 | shortcode = $( '#_stag_shortcode', form ).text(),
332 | popupType = $( '#_stag_popup', form ).text(),
333 | uShortcode = '',
334 | iconSelector = $( '.stag-all-icons' ).find( 'i' ),
335 | closePopup = $( '#close-popup' );
336 |
337 | closePopup.on( 'click', function() {
338 | tb_remove();
339 | });
340 |
341 | // resize TB
342 | stags.resizeTB();
343 | $( window ).resize( function() {
344 | stags.resizeTB();
345 | });
346 |
347 | tbWindow.css({
348 | border: 'none'
349 | });
350 |
351 | tbWindow.find( '#TB_title' ).remove();
352 |
353 | // initialise
354 | stags.loadVals();
355 | stags.children();
356 | stags.cLoadVals();
357 | stags.media();
358 |
359 | // update on children value change
360 | $( '.child-clone-rows', form ).on( 'change', '.stag-cinput', function() {
361 | stags.cLoadVals();
362 | });
363 |
364 | // update on value change
365 | $( '#stag-sc-form-table', form ).on( 'change', '.stag-input', function() {
366 | stags.loadVals();
367 | });
368 |
369 | var iconContainer = $( '.stag-all-icons' );
370 | iconContainer.append( FontAwesomeIcons() );
371 |
372 | iconContainer.on( 'click', 'i', function( e ) {
373 | iconContainer.find( 'i' ).removeClass( 'active-icon' );
374 | $( this ).addClass( 'active-icon' );
375 | $( '#stag_icon' ).val( $( this ).data( 'icon-id' ) );
376 | $( '#stag_style' ).val( $( this ).data( 'style' ) );
377 | $( '.stag-input' ).trigger( 'change' );
378 | });
379 |
380 | $( '.stag-control-buttonset' ).buttonset();
381 | $( '.stag-control-buttonset' ).on( 'change', 'input', function( e ) {
382 | var id = $( this ).data( 'key' );
383 | $( '#' + id ).val( $( this ).val() );
384 | $( '.stag-input' ).trigger( 'change' );
385 | });
386 |
387 | // when insert is clicked
388 | $( '.stag-insert', form ).click( function() {
389 | if ( window.tinyMCE ) {
390 | var version = tinyMCE.majorVersion;
391 |
392 | if ( '3' === version ) {
393 | window.tinyMCE.execInstanceCommand( window.tinyMCE.activeEditor.id, 'mceInsertContent', false, $( '#_stag_ushortcode', form ).html() );
394 | tb_remove();
395 | } else if ( '4' === version ) {
396 | window.tinyMCE.activeEditor.insertContent( $( '#_stag_ushortcode', form ).html() );
397 | tb_remove();
398 | }
399 |
400 | }
401 | });
402 | }
403 | };
404 |
405 | // run
406 | $( 'body' ).on( 'DOMNodeInserted', '#stag-popup', function(e) {
407 | if ($(e.target).attr('id') === 'stag-popup') {
408 | stags.load();
409 | }
410 | } );
411 | });
412 |
413 | var __ = wp.i18n.__;
414 |
415 | window.StagLang = {
416 | insert: __( 'Insert Stag Shortcode', 'stag' ),
417 | button: __( 'Buttons', 'stag' ),
418 | columns: __( 'Columns', 'stag' ),
419 | tabs: __( 'Tabs', 'stag' ),
420 | toggle: __( 'Toggle', 'stag' ),
421 | dropcap: __( 'Dropcap', 'stag' ),
422 | icon: __( 'Font Icon', 'stag' ),
423 | media_elements: __( 'Media Elements', 'stag' ),
424 | widget_area: __( 'Widget Area', 'stag' ),
425 | image: __( 'Image', 'stag' ),
426 | video: __( 'Video', 'stag' ),
427 | map: __( 'Google Map', 'stag' )
428 | };
429 |
--------------------------------------------------------------------------------
/assets/js/shortcodes_plugins.min.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Table of Contents
3 | *
4 | * 1.jQuery Appendo
5 | * 2. base64.js
6 | * 3. custom
7 | *
8 | */
9 | // 1. jQuery.appendo
10 | /**
11 | * Appendo Plugin for jQuery v1.01
12 | * Creates interface to create duplicate clones of last table row (usually for forms)
13 | * (c) 2008 Kelly Hallman. Free software released under MIT License.
14 | * See http://deepliquid.com/content/Appendo.html for more info
15 | */
16 | // Attach appendo as a jQuery plugin
17 | // 3. custom
18 | var FontAwesomeIcons;jQuery.fn.appendo=function(t){return this.each(function(){jQuery.appendo.init(this,t)}),this},
19 | // appendo namespace
20 | jQuery.appendo=function(){
21 | // Create a closure so that we can refer to "this" correctly down the line
22 | var t=this;
23 | // Global Options
24 | // These can be set with inline Javascript like so:
25 | // jQuery.appendo.opt.maxRows = 5;
26 | // $.appendo.opt.allowDelete = false;
27 | // (no need, in fact you shouldn't, wrap in jQuery(document).ready() etc)
28 | return this.opt={},this.init=function(e,o){
29 | // Extend the defaults with global options and options given, if any
30 | var a,n=jQuery.extend({labelAdd:"Add Row",labelDel:"Remove",allowDelete:!0,
31 | // copyHandlers does not seem to work
32 | // it's been removed from the docs for now...
33 | copyHandlers:!1,focusFirst:!0,onAdd:function(){return!0},onDel:function(){return!0},maxRows:0,wrapClass:"appendoButtons",wrapStyle:{padding:".4em .2em .5em"},buttonStyle:{marginRight:".5em"},subSelect:"tr:last"},t.opt,o),i=jQuery(e).find(n.subSelect).clone(n.copyHandlers),s=1,c=(jQuery("#form-child-add").click(
34 | // Handles a click on the add button
35 | function(t){(!n.maxRows||s").css(n.buttonStyle).html(a)).click(function(t){1'+t+"",o.map(function(t){e+=''})}),e}}(jQuery),jQuery(document).ready(function(t){var e={loadVals:function(){var e=t("#_stag_shortcode").text();
57 | // fill in the gaps eg {{param}}
58 | t(".stag-input").each(function(){var o=t(this),a=(a=o.attr("id")).replace("stag_",""),// gets rid of the stag_ prefix
59 | n=new RegExp("{{"+a+"}}","g");e=e.replace(n,o.val())}),
60 | // adds the filled-in shortcode as hidden input
61 | t("#_stag_ushortcode").remove(),t("#stag-sc-form-table").prepend(''+e+"
")},cLoadVals:function(){var e,o=t("#_stag_cshortcode").text();shortcodes="",
62 | // fill in the gaps eg {{param}}
63 | t(".child-clone-row").each(function(){t(this);var e=o;t(".stag-cinput",this).each(function(){var o=t(this),a=(a=o.attr("id")).replace("stag_","");// gets rid of the stag_ prefix
64 | re=new RegExp("{{"+a+"}}","g"),e=e.replace(re,o.val())}),shortcodes=shortcodes+e+"\n"}),
65 | // adds the filled-in shortcode as hidden input
66 | t("#_stag_cshortcodes").remove(),t(".child-clone-rows").prepend(''+shortcodes+"
"),
67 | // add to parent shortcode
68 | this.loadVals(),e=t("#_stag_ushortcode").text().replace("{{child_shortcode}}",shortcodes),
69 | // add updated parent shortcode
70 | t("#_stag_ushortcode").remove(),t("#stag-sc-form-table").prepend(''+e+"
")},children:function(){
71 | // assign the cloning plugin
72 | t(".child-clone-rows").appendo({subSelect:"> div.child-clone-row:last-child",allowDelete:!1,focusFirst:!1}),
73 | // remove button
74 | t(".child-clone-rows").on("click",".child-clone-row-remove",function(){var e=t(this).parent();return 1');
40 | }
41 | });
42 | }
43 | });
44 | });
45 | })(tinymce);
46 |
--------------------------------------------------------------------------------
/assets/scss/_preboot.scss:
--------------------------------------------------------------------------------
1 | @import "compass/css3";
2 |
3 | // Vars
4 | $accent: #363f48;
5 | $accent_new: var(--stagtools-accent, #363f48);
6 |
7 | $button-map: (
8 | black: #000,
9 | blue: #1b93c7,
10 | green: #84c333,
11 | grey: #979797,
12 | light-blue: #56c3f2,
13 | orange: #fc901d,
14 | red: #d15858,
15 | purple: #c16ad7,
16 | white: #fff,
17 | dark: $accent
18 | );
19 |
20 | $alert-map: (
21 | white: #f5f5f5,
22 | grey: #979797,
23 | red: #d15858,
24 | yellow: #ffd164,
25 | green: #84c333,
26 | blue: #1b93c7,
27 | );
28 |
29 | // Mixin to quickly include font style
30 | @mixin iconify( $code: null ){
31 | @if $code {
32 | content: "#{$code}";
33 | } @else {
34 | @content;
35 | }
36 | display: inline-block;
37 | font-family: 'Font Awesome 5 Free';
38 | font-style: normal;
39 | font-weight: 900;
40 | line-height: 1;
41 | -webkit-font-smoothing: antialiased;
42 | -moz-osx-font-smoothing: grayscale;
43 | }
44 |
45 | %cf {
46 | zoom: 1;
47 | &:before,
48 | &:after {
49 | display: table;
50 | content: "";
51 | }
52 | &:after {
53 | clear: both;
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/assets/scss/stag-shortcodes.scss:
--------------------------------------------------------------------------------
1 | @import "preboot";
2 |
3 | .stag-tabs,
4 | .stag-toggle,
5 | .stag-video {
6 | margin: 0 0 2em 0;
7 | }
8 |
9 | /* BUTTONS */
10 | .stag-button {
11 | -webkit-appearance: none;
12 | -webkit-font-smoothing: inherit;
13 | display: inline-block;
14 | background: #979797;
15 | color: #fff;
16 | font-size: 16px;
17 | line-height: 1;
18 | margin: 5px;
19 | padding: 12px 16px;
20 | border-radius: 0;
21 | text-decoration: none !important;
22 | text-align: center;
23 | @include box-sizing(border-box);
24 | @include transition(all 200ms ease-in-out);
25 | &:hover {
26 | color: #fff;
27 | text-decoration: none;
28 | }
29 |
30 | &--normal {
31 | @include opacity(.9);
32 | }
33 | &--medium {
34 | font-size: 18px;
35 | padding: 17px 22px;
36 | }
37 | &--large {
38 | font-size: 20px;
39 | padding: 22px 40px;
40 | }
41 | &--stroke {
42 | background: transparent;
43 | border: 1px solid transparent;
44 | }
45 | }
46 |
47 | @each $button, $color in $button-map {
48 | .stag-button--#{$button} {
49 | background: #{$color};
50 | @if $button == white {
51 | color: black;
52 | &:hover {
53 | color: black;
54 | }
55 | }
56 | }
57 |
58 | .stag-button--stroke.stag-button--#{$button} {
59 | background: transparent;
60 | color: #{$color};
61 | border-color: #{$color};
62 | &:hover {
63 | @if $button != white {
64 | background: #{$color};
65 | color: white;
66 | } @else {
67 | background: white;
68 | color: black;
69 | }
70 | }
71 | }
72 | }
73 |
74 | .stag-button--gray {
75 | background: #979797;
76 | }
77 |
78 | .stag-intro-text {
79 | font-size: 125%;
80 | margin-bottom: 2em;
81 | display: block;
82 | }
83 |
84 | /* ALERTS */
85 | .stag-alert {
86 | text-align: center;
87 | color: #fff;
88 | padding: 20px 15px;
89 | margin: 1em 0;
90 | display: block;
91 |
92 | @each $alert, $color in $alert-map {
93 | &--#{$alert} {
94 | background: #{$color};
95 | }
96 | }
97 | }
98 | .stag-alert--gray {
99 | background: #979797;
100 | }
101 |
102 | .stag-dropcap {
103 | display: block;
104 | float: left;
105 | text-align: center;
106 | margin: 5px 15px 15px 0;
107 | }
108 |
109 | .stag-dropcap--squared {
110 | background: $accent;
111 | background: $accent_new;
112 | color: #fff;
113 | }
114 |
115 | /* DIVIDER */
116 | .stag-divider {
117 | border: 0;
118 | height: 1px;
119 | background: $accent;
120 | background: $accent_new;
121 | margin: 2em 0;
122 | &--strong {
123 | height: 7px;
124 | }
125 |
126 | &--double {
127 | height: 7px;
128 | }
129 | &--double:after {
130 | content: '';
131 | display: block;
132 | border-bottom: 1px solid $accent;
133 | border-bottom: 1px solid $accent_new;
134 | position: relative;
135 | top: 10px;
136 | }
137 |
138 | &--dashed {
139 | background: none;
140 | border-bottom: 1px dashed $accent;
141 | border-bottom: 1px dashed $accent_new;
142 | }
143 |
144 | &--dotted {
145 | background: none;
146 | border-bottom: 1px dotted $accent;
147 | border-bottom: 1px dotted $accent_new;
148 | }
149 | }
150 |
151 | /* Tabs */
152 | .stag-nav {
153 | list-style: none !important;
154 | margin: 0;
155 | padding: 0;
156 | li {
157 | margin: 0;
158 | float: left;
159 | position: relative;
160 | margin: 0 1px -1px 0 !important;
161 | z-index: 1;
162 | outline: 0;
163 | }
164 | a {
165 | text-decoration: none;
166 | display: block;
167 | padding: 15px 10px;
168 | line-height: 1;
169 | outline: 0;
170 | }
171 | }
172 |
173 | .stag-tab {
174 | padding: 21px 20px 20px 20px;
175 |
176 | p:first-of-type {
177 | margin-top: 0;
178 | }
179 | p:last-of-type {
180 | margin-bottom: 0;
181 | }
182 | }
183 |
184 | .stag-tabs--normal .stag-nav a {
185 | background: $accent;
186 | background: $accent_new;
187 | color: #fff;
188 | }
189 | .stag-tabs--normal .stag-nav .ui-tabs-active a {
190 | background: #fbfbfb;
191 | color: $accent;
192 | color: $accent_new;
193 | outline: 0;
194 | }
195 | .stag-tabs--normal .stag-tab {
196 | background: #fbfbfb;
197 | }
198 |
199 | .stag-tabs--stroke .stag-nav li {
200 | margin: 0 -1px 0 0 !important;
201 | }
202 | .stag-tabs--stroke .stag-nav a {
203 | border: 1px solid $accent;
204 | border: 1px solid $accent_new;
205 | color: $accent;
206 | color: $accent_new;
207 | }
208 | .stag-tabs--stroke .stag-nav .ui-tabs-active a {
209 | border-bottom-color: white;
210 | }
211 | .stag-tabs--stroke .stag-tab {
212 | border: 1px solid $accent;
213 | border: 1px solid $accent_new;
214 | margin-top: -1px;
215 | }
216 |
217 | .stag-toggle-title {
218 | display: block;
219 | padding: 15px 10px;
220 | outline: 0;
221 | cursor: pointer;
222 | position: relative;
223 | }
224 | .stag-toggle-title:after {
225 | position: absolute;
226 | top: 50%;
227 | right: 15px;
228 | font-size: 18px;
229 | @include transform(translateY(-50%));
230 | @include iconify{
231 | content: '\f067';
232 | };
233 | }
234 | .stag-toggle-title.ui-state-active:after {
235 | content: "\f068";
236 | }
237 | .stag-toggle-content {
238 | padding: 20px;
239 | }
240 |
241 | .stag-toggle--normal .stag-toggle-title {
242 | background: $accent;
243 | background: $accent_new;
244 | color: white;
245 | }
246 |
247 | .stag-toggle--stroke .stag-toggle-title {
248 | border: 1px solid $accent;
249 | border: 1px solid $accent_new;
250 | }
251 | .stag-toggle--stroke .stag-toggle-title:after {
252 | color: $accent;
253 | color: $accent_new;
254 | }
255 |
256 | /* Image */
257 | .stag-image {
258 | display: inline-block;
259 |
260 | &--left {
261 | float: left;
262 | margin: 0 1.5em 1em 0;
263 | }
264 |
265 | &--center {
266 | display: block;
267 | margin: 1.5em 0;
268 | text-align: center;
269 | }
270 |
271 | &--right {
272 | float: right;
273 | margin: 0 0 1.5em 1.5em;
274 | }
275 |
276 | &--grayscale { @include filter(grayscale(1)); }
277 | &--sepia { @include filter(sepia(100%)); }
278 | &--blur { @include filter(blur(2px)); }
279 | &--hue-rotate { @include filter(hue-rotate(50deg)); }
280 | &--contrast { @include filter(contrast(15%)); }
281 | &--brightness { @include filter(#{"brightness(2)"}); }
282 | &--invert { @include filter(invert(100%)); }
283 | }
284 |
285 | /* Video */
286 | .stag-video {
287 | position: relative;
288 | padding-bottom: 56.25%;
289 | padding-top: 30px;
290 | height: 0;
291 | overflow: hidden;
292 |
293 | iframe,
294 | object,
295 | embed {
296 | position: absolute;
297 | top: 0;
298 | left: 0;
299 | width: 100%;
300 | height: 100%;
301 | }
302 | }
303 |
304 | @media (min-width: 700px) {
305 | .stag-one-half {
306 | width: 48%;
307 | }
308 |
309 | .stag-one-third {
310 | width: 30.66%;
311 | }
312 |
313 | .stag-two-third {
314 | width: 65.33%;
315 | }
316 |
317 | .stag-one-fourth {
318 | width: 22%;
319 | }
320 |
321 | .stag-three-fourth {
322 | width: 74%;
323 | }
324 |
325 | .stag-one-fifth {
326 | width: 16.8%;
327 | }
328 |
329 | .stag-two-fifth {
330 | width: 37.6%;
331 | }
332 |
333 | .stag-three-fifth {
334 | width: 58.4%;
335 | }
336 |
337 | .stag-four-fifth {
338 | width: 79.2%;
339 | }
340 |
341 | .stag-one-sixth {
342 | width: 13.33%;
343 | }
344 |
345 | .stag-five-sixth {
346 | width: 82.67%;
347 | }
348 |
349 | .stag-one-half,
350 | .stag-one-third,
351 | .stag-two-third,
352 | .stag-three-fourth,
353 | .stag-one-fourth,
354 | .stag-one-fifth,
355 | .stag-two-fifth,
356 | .stag-three-fifth,
357 | .stag-four-fifth,
358 | .stag-one-sixth,
359 | .stag-five-sixth {
360 | position: relative;
361 | margin-right: 4%;
362 | margin-bottom: 2em;
363 | float: left;
364 | }
365 |
366 | .stag-column-last {
367 | margin-right: 0 !important;
368 | clear: right;
369 | }
370 | }
371 |
372 | .stag-clearfix {
373 | @extend %cf;
374 | }
375 |
376 | .stag-icon-link {
377 | text-decoration: none;
378 | @include transition(color 150ms);
379 | }
380 |
381 | .fa,
382 | .stag-icon {
383 | text-align: center;
384 | vertical-align: middle;
385 | &--before &{
386 | margin-right: 0.7em;
387 | }
388 |
389 | &--after &{
390 | margin-left: 0.7em;
391 | }
392 | }
393 |
394 | .stag-icon--before svg {
395 | margin-right: 0.7em;
396 | }
397 | .stag-icon--after svg {
398 | margin-left: 0.7em;
399 | }
400 |
401 | // Twitter Widget
402 | .stag-twitter {
403 | .time-ago {
404 | display: block;
405 | font-size: .9em;
406 | font-style: italic;
407 | margin-top: 5px;
408 | }
409 | .twitter-follow-button {
410 | margin: 0;
411 | }
412 | }
413 | .stag-latest-tweets {
414 | list-style: none;
415 | margin: 0;
416 | padding: 0;
417 | li {
418 | margin-bottom: 15px;
419 | }
420 | }
421 |
422 | // Flickr Widget
423 | .stag-flickr {
424 | li {
425 | list-style: none;
426 | display: inline-block;
427 | margin: 0 5px 5px 0;
428 | }
429 | }
430 |
431 | .stag-social-icons {
432 | font-size: 45px;
433 | .stag-icon {
434 | line-height: 72px;
435 | }
436 | a {
437 | display: inline-block;
438 | width: 72px;
439 | height: 72px;
440 | text-align: center;
441 | vertical-align: top;
442 | margin: 0 10px 10px 0;
443 | text-decoration: none;
444 | }
445 |
446 | &.normal{
447 | a{
448 | color: #2f322b;
449 | border: none;
450 | }
451 | }
452 | &.square{
453 | a{
454 | background: #2f322b;
455 | color: #fff;
456 | border: none;
457 | }
458 | }
459 | }
460 |
461 | .google-map {
462 | margin: 0 0 2em 0;
463 | }
464 |
465 | .gm-style img {
466 | max-width: none;
467 | }
468 |
469 | .dribbbles {
470 | list-style: none;
471 | }
472 |
--------------------------------------------------------------------------------
/assets/webfonts/fa-brands-400.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codestag/stagtools/2635655608eb46b29f44911db766f0a344ad24b1/assets/webfonts/fa-brands-400.eot
--------------------------------------------------------------------------------
/assets/webfonts/fa-brands-400.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codestag/stagtools/2635655608eb46b29f44911db766f0a344ad24b1/assets/webfonts/fa-brands-400.ttf
--------------------------------------------------------------------------------
/assets/webfonts/fa-brands-400.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codestag/stagtools/2635655608eb46b29f44911db766f0a344ad24b1/assets/webfonts/fa-brands-400.woff
--------------------------------------------------------------------------------
/assets/webfonts/fa-brands-400.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codestag/stagtools/2635655608eb46b29f44911db766f0a344ad24b1/assets/webfonts/fa-brands-400.woff2
--------------------------------------------------------------------------------
/assets/webfonts/fa-regular-400.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codestag/stagtools/2635655608eb46b29f44911db766f0a344ad24b1/assets/webfonts/fa-regular-400.eot
--------------------------------------------------------------------------------
/assets/webfonts/fa-regular-400.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codestag/stagtools/2635655608eb46b29f44911db766f0a344ad24b1/assets/webfonts/fa-regular-400.ttf
--------------------------------------------------------------------------------
/assets/webfonts/fa-regular-400.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codestag/stagtools/2635655608eb46b29f44911db766f0a344ad24b1/assets/webfonts/fa-regular-400.woff
--------------------------------------------------------------------------------
/assets/webfonts/fa-regular-400.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codestag/stagtools/2635655608eb46b29f44911db766f0a344ad24b1/assets/webfonts/fa-regular-400.woff2
--------------------------------------------------------------------------------
/assets/webfonts/fa-solid-900.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codestag/stagtools/2635655608eb46b29f44911db766f0a344ad24b1/assets/webfonts/fa-solid-900.eot
--------------------------------------------------------------------------------
/assets/webfonts/fa-solid-900.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codestag/stagtools/2635655608eb46b29f44911db766f0a344ad24b1/assets/webfonts/fa-solid-900.ttf
--------------------------------------------------------------------------------
/assets/webfonts/fa-solid-900.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codestag/stagtools/2635655608eb46b29f44911db766f0a344ad24b1/assets/webfonts/fa-solid-900.woff
--------------------------------------------------------------------------------
/assets/webfonts/fa-solid-900.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codestag/stagtools/2635655608eb46b29f44911db766f0a344ad24b1/assets/webfonts/fa-solid-900.woff2
--------------------------------------------------------------------------------
/config.rb:
--------------------------------------------------------------------------------
1 | require 'compass/import-once/activate'
2 | # Require any additional compass plugins here.
3 |
4 | # Set this to the root of your project when deployed:
5 | http_path = "/"
6 | css_dir = "assets/css"
7 | sass_dir = "assets/scss"
8 | images_dir = "assets/img"
9 | javascripts_dir = "assets/js"
10 | fonts_dir = "assets/fonts"
11 |
12 | output_style = :expanded
13 |
14 | # To enable relative paths to assets via compass helper functions. Uncomment:
15 | # relative_assets = true
16 |
17 | # To disable debugging comments that display the original location of your selectors. Uncomment:
18 | line_comments = false
19 | color_output = false
20 |
21 |
22 | # If you prefer the indented syntax, you might want to regenerate this
23 | # project again passing --syntax sass, or you can uncomment this:
24 | # preferred_syntax = :sass
25 | # and then run:
26 | # sass-convert -R --from scss --to sass assets/scss scss && rm -rf sass && mv scss sass
27 | preferred_syntax = :scss
28 |
--------------------------------------------------------------------------------
/includes/class-stagtools-themes.php:
--------------------------------------------------------------------------------
1 | get_codestag_themes();
14 | }
15 |
16 | public function admin_page() {
17 | $themes = json_decode( $this->get_codestag_themes() );
18 |
19 | $browse_all_link = add_query_arg(
20 | array(
21 | 'utm_source' => 'stagtools-plugin-page',
22 | 'utm_medium' => 'stagtools',
23 | 'utm_campaign' => 'StagTools',
24 | 'utm_content' => 'All themes',
25 | ),
26 | 'https://codestag.com/themes/'
27 | );
28 |
29 | ?>
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 | 'stagtools-plugin-page',
46 | 'utm_medium' => 'stagtools',
47 | 'utm_campaign' => 'StagTools',
48 | 'utm_content' => $theme->title,
49 | ),
50 | $theme->link
51 | );
52 | ?>
53 |
54 |
55 | is_new ) : ?>
56 |
New
57 |
58 |
59 |
title ); ?>
60 |
61 |
62 |
63 |
subtitle ); ?>.
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
154 | __( 'Portfolio', 'stag' ),
11 | 'singular_name' => __( 'Portfolio', 'stag' ),
12 | 'add_new' => __( 'Add New', 'stag' ),
13 | 'add_new_item' => __( 'Add New Portfolio', 'stag' ),
14 | 'edit_item' => __( 'Edit Portfolio', 'stag' ),
15 | 'new_item' => __( 'New Portfolio', 'stag' ),
16 | 'view_item' => __( 'View Portfolio', 'stag' ),
17 | 'search_items' => __( 'Search Portfolio', 'stag' ),
18 | 'not_found' => __( 'No Portfolios found', 'stag' ),
19 | 'not_found_in_trash' => __( 'No Portfolios found in trash', 'stag' ),
20 | 'parent_item_colon' => '',
21 | )
22 | );
23 |
24 | $stag_options = get_option( 'stag_options' );
25 | $portfolio_slug = $stag_options['portfolio_slug'] ?? 'portfolio';
26 | $skills_slug = $stag_options['skills_slug'] ?? 'skill';
27 | $rewrite = defined( 'STAG_PORTFOLIO_DISABLE_REWRITE' ) && STAG_PORTFOLIO_DISABLE_REWRITE ? false : array(
28 | 'slug' => $portfolio_slug,
29 | 'with_front' => false,
30 | );
31 |
32 | $portfolio_args = array(
33 | 'labels' => $portfolio_labels,
34 | 'public' => true,
35 | 'show_ui' => true,
36 | 'show_in_menu' => true,
37 | 'show_in_rest' => true,
38 | 'show_in_nav_menus' => false,
39 | 'menu_position' => 32,
40 | 'menu_icon' => 'dashicons-portfolio',
41 | 'rewrite' => $rewrite,
42 | 'supports' => apply_filters( 'stag_portfolio_supports', array( 'title', 'editor', 'thumbnail', 'revisions' ) ),
43 | 'taxonomies' => array( 'skill' ),
44 | );
45 |
46 | register_post_type( 'portfolio', apply_filters( 'stag_portfolio_post_type_args', $portfolio_args ) );
47 |
48 | register_taxonomy(
49 | 'skill',
50 | 'portfolio',
51 | array(
52 | 'label' => __( 'Skills', 'stag' ),
53 | 'singular_label' => __( 'Skill', 'stag' ),
54 | 'public' => true,
55 | 'hierarchical' => true,
56 | 'show_ui' => true,
57 | 'show_in_nav_menus' => true,
58 | 'args' => array( 'orderby' => 'term_order' ),
59 | 'query_var' => true,
60 | 'rewrite' => array(
61 | 'slug' => $skills_slug,
62 | 'hierarchical' => true,
63 | ),
64 | )
65 | );
66 |
67 | /**
68 | * Modify Portfolio columns
69 | *
70 | * @param array $old_columns Old columns
71 | * @return $columns Return new columns
72 | */
73 | function stag_portfolio_edit_columns( $columns ) {
74 | $columns = array(
75 | 'cb' => '',
76 | 'title' => __( 'Portfolio Title', 'stag' ),
77 | 'skill' => __( 'Skills', 'stag' ),
78 | 'date' => __( 'Date', 'stag' ),
79 | );
80 |
81 | return $columns;
82 | }
83 | add_filter( 'manage_edit-portfolio_columns', 'stag_portfolio_edit_columns' );
84 |
85 | /**
86 | * Custom post type Portfolio column.
87 | *
88 | * @param array $column
89 | * @return void
90 | */
91 | function stag_portfolio_custom_column( $column ) {
92 | global $post;
93 | switch ( $column ) {
94 | case 'skill':
95 | $terms = get_the_terms( $post->ID, $column );
96 | if ( ! $terms ) {
97 | echo '—';
98 | } else {
99 | foreach ( $terms as $term ) {
100 | $termlist[] = '' . ucfirst( $term->name ) . '';
101 | }
102 |
103 | echo implode( ', ', $termlist );
104 | }
105 | break;
106 | }
107 | }
108 | add_action( 'manage_posts_custom_column', 'stag_portfolio_custom_column' );
109 |
--------------------------------------------------------------------------------
/includes/post-type/project.php:
--------------------------------------------------------------------------------
1 | _x( 'Projects', 'post type general name', 'stag' ),
13 | 'singular_name' => _x( 'Project', 'post type singular name', 'stag' ),
14 | 'menu_name' => _x( 'Portfolio', 'admin menu', 'stag' ),
15 | 'name_admin_bar' => _x( 'Project', 'add new on admin bar', 'stag' ),
16 | 'add_new' => _x( 'Add New', 'Project', 'stag' ),
17 | 'add_new_item' => __( 'Add New Project', 'stag' ),
18 | 'new_item' => __( 'New Project', 'stag' ),
19 | 'edit_item' => __( 'Edit Project', 'stag' ),
20 | 'view_item' => __( 'View Project', 'stag' ),
21 | 'all_items' => __( 'All Projects', 'stag' ),
22 | 'search_items' => __( 'Search Projects', 'stag' ),
23 | 'parent_item_colon' => __( 'Parent Projects:', 'stag' ),
24 | 'not_found' => __( 'No Projects found.', 'stag' ),
25 | 'not_found_in_trash' => __( 'No Projects found in Trash.', 'stag' ),
26 | )
27 | );
28 |
29 | $portfolio_args = array(
30 | 'labels' => $portfolio_labels,
31 | 'public' => true,
32 | 'publicly_queryable' => true,
33 | 'show_ui' => true,
34 | 'show_in_menu' => true,
35 | 'show_in_rest' => true,
36 | 'menu_position' => 100,
37 | 'menu_icon' => 'dashicons-portfolio',
38 | 'query_var' => true,
39 | 'rewrite' => array( 'slug' => 'portfolio' ),
40 | 'capability_type' => 'post',
41 | 'has_archive' => true,
42 | 'hierarchical' => false,
43 | 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'revisions' ),
44 | );
45 |
46 | register_post_type( 'stag-portfolio', $portfolio_args );
47 |
48 | register_taxonomy(
49 | 'stag-portfolio-type',
50 | 'stag-portfolio',
51 | array(
52 | 'label' => __( 'Project Types', 'stag' ),
53 | 'singular_label' => __( 'Project Type', 'stag' ),
54 | 'public' => true,
55 | 'hierarchical' => true,
56 | 'show_ui' => true,
57 | 'show_in_nav_menus' => true,
58 | 'args' => array( 'orderby' => 'term_order' ),
59 | 'query_var' => true,
60 | 'rewrite' => array( 'slug' => 'project-type' ),
61 | )
62 | );
63 |
64 | register_taxonomy(
65 | 'stag-portfolio-tag',
66 | 'stag-portfolio',
67 | array(
68 | 'label' => __( 'Project Tags', 'stag' ),
69 | 'singular_label' => __( 'Project Tag', 'stag' ),
70 | 'public' => true,
71 | 'hierarchical' => false,
72 | 'show_ui' => true,
73 | 'show_in_nav_menus' => true,
74 | 'args' => array( 'orderby' => 'term_order' ),
75 | 'query_var' => true,
76 | 'rewrite' => array( 'slug' => 'project-tag' ),
77 | )
78 | );
79 |
80 | /**
81 | * Modify Article columns
82 | *
83 | * @param array $old_columns Old columns
84 | * @return $columns Return new columns
85 | */
86 | function stag_portfolio_columns( $old_columns ) {
87 | $columns = array();
88 |
89 | $columns['cb'] = '';
90 | $columns['thumbnail'] = '';
91 | $columns['title'] = __( 'Project', 'stag' );
92 | $columns['stag-portfolio-type'] = __( 'Project Types', 'stag' );
93 | $columns['stag-portfolio-tag'] = __( 'Project Tags', 'stag' );
94 | $columns['date'] = __( 'Date', 'stag' );
95 |
96 | return $columns;
97 | }
98 | add_filter( 'manage_edit-stag-portfolio_columns', 'stag_portfolio_columns' );
99 |
100 | /**
101 | * Custom post type article column.
102 | *
103 | * @param array $column
104 | * @return void
105 | */
106 | function stag_portfolio_custom_columns( $column ) {
107 | global $post;
108 |
109 | switch ( $column ) {
110 | case 'stag-portfolio-type':
111 | case 'stag-portfolio-tag':
112 | $terms = get_the_terms( $post->ID, $column );
113 | if ( ! $terms ) {
114 | echo '—';
115 | } else {
116 | foreach ( $terms as $term ) {
117 | $termlist[] = '' . ucfirst( $term->name ) . '';
118 | }
119 |
120 | echo implode( ', ', $termlist );
121 | }
122 | break;
123 |
124 | case 'thumbnail':
125 | echo get_the_post_thumbnail( $post->ID, array( 100, 100 ) );
126 | break;
127 | }
128 | }
129 | add_action( 'manage_stag-portfolio_posts_custom_column', 'stag_portfolio_custom_columns', 2 );
130 |
131 | function stag_portfolio_admin_css() {
132 | global $pagenow;
133 |
134 | if ( 'edit.php' !== $pagenow && 'stag-portfolio' !== get_post_type() ) {
135 | return;
136 | }
137 |
138 | ?>
139 |
140 |
144 |
145 | __( 'Slides', 'stag' ),
5 | 'singular_name' => __( 'Slide', 'stag' ),
6 | 'add_new' => __( 'Add New', 'stag' ),
7 | 'add_new_item' => __( 'Add New Slide', 'stag' ),
8 | 'edit_item' => __( 'Edit Slide', 'stag' ),
9 | 'new_item' => __( 'New Slide', 'stag' ),
10 | 'view_item' => __( 'View Slide', 'stag' ),
11 | 'search_items' => __( 'Search Slide', 'stag' ),
12 | 'not_found' => __( 'No Slides found', 'stag' ),
13 | 'not_found_in_trash' => __( 'No Slides found in trash', 'stag' ),
14 | 'parent_item_colon' => '',
15 | );
16 |
17 | $args = array(
18 | 'labels' => $labels,
19 | 'public' => false,
20 | 'exclude_from_search' => true,
21 | 'publicly_queryable' => true,
22 | 'rewrite' => array( 'slug' => 'slides' ),
23 | 'show_ui' => true,
24 | 'query_var' => true,
25 | 'capability_type' => 'post',
26 | 'hierarchical' => false,
27 | 'menu_position' => 33,
28 | 'menu_icon' => 'dashicons-images-alt2',
29 | 'has_archive' => false,
30 | 'supports' => array( 'title' ),
31 | );
32 |
33 | register_post_type( 'slides', $args );
34 |
35 | function stag_slide_edit_column( $columns ) {
36 | $columns = array(
37 | 'cb' => '',
38 | 'title' => __( 'Slide Title', 'stag' ),
39 | 'date' => __( 'Date', 'stag' ),
40 | );
41 | return $columns;
42 | }
43 |
44 | add_filter( 'manage_edit-slide_columns', 'stag_slide_edit_column' );
45 |
--------------------------------------------------------------------------------
/includes/post-type/team.php:
--------------------------------------------------------------------------------
1 | __( 'Team', 'stag' ),
5 | 'singular_name' => __( 'Team', 'stag' ),
6 | 'add_new' => __( 'Add New', 'stag' ),
7 | 'add_new_item' => __( 'Add New Team Member', 'stag' ),
8 | 'edit_item' => __( 'Edit Team Member', 'stag' ),
9 | 'new_item' => __( 'New Team Member', 'stag' ),
10 | 'view_item' => __( 'View Team Member', 'stag' ),
11 | 'search_items' => __( 'Search Team Member', 'stag' ),
12 | 'not_found' => __( 'No Team Member found', 'stag' ),
13 | 'not_found_in_trash' => __( 'No Team Member in trash', 'stag' ),
14 | 'parent_item_colon' => '',
15 | );
16 |
17 | $args = array(
18 | 'labels' => $labels,
19 | 'public' => false,
20 | 'exclude_from_search' => true,
21 | 'publicly_queryable' => false,
22 | 'rewrite' => array( 'slug' => 'team' ),
23 | 'show_ui' => true,
24 | 'show_in_rest' => true,
25 | 'query_var' => true,
26 | 'capability_type' => 'post',
27 | 'hierarchical' => false,
28 | 'menu_position' => 34,
29 | 'menu_icon' => 'dashicons-groups',
30 | 'has_archive' => false,
31 | 'supports' => array( 'title', 'thumbnail' ),
32 | );
33 |
34 | register_post_type( 'team', $args );
35 |
36 | function stag_team_edit_columns( $columns ) {
37 | $columns = array(
38 | 'cb' => '',
39 | 'title' => __( 'Team Member Title', 'stag' ),
40 | 'member_info' => __( 'Member Info', 'stag' ),
41 | 'date' => __( 'Date', 'stag' ),
42 | );
43 | return $columns;
44 | }
45 |
46 | function stag_team_custom_column( $columns ) {
47 | global $post;
48 | switch ( $columns ) {
49 | case 'member_info':
50 | echo get_post_meta( $post->ID, '_stag_team_info', true );
51 | break;
52 | }
53 | }
54 |
55 | add_filter( 'manage_edit-team_columns', 'stag_team_edit_columns' );
56 | add_action( 'manage_posts_custom_column', 'stag_team_custom_column' );
57 |
--------------------------------------------------------------------------------
/includes/post-type/testimonials.php:
--------------------------------------------------------------------------------
1 | __( 'Testimonials', 'stag' ),
5 | 'singular_name' => __( 'Testimonial', 'stag' ),
6 | 'add_new' => __( 'Add New', 'stag' ),
7 | 'add_new_item' => __( 'Add New Testimonial', 'stag' ),
8 | 'edit_item' => __( 'Edit Testimonial', 'stag' ),
9 | 'new_item' => __( 'New Testimonial', 'stag' ),
10 | 'view_item' => __( 'View Testimonial', 'stag' ),
11 | 'search_items' => __( 'Search Testimonials', 'stag' ),
12 | 'not_found' => __( 'No Testimonials found', 'stag' ),
13 | 'not_found_in_trash' => __( 'No Testimonials in trash', 'stag' ),
14 | 'parent_item_colon' => '',
15 | );
16 |
17 | $args = array(
18 | 'labels' => $labels,
19 | 'public' => false,
20 | 'exclude_from_search' => true,
21 | 'publicly_queryable' => false,
22 | 'rewrite' => array( 'slug' => 'testimonials' ),
23 | 'show_ui' => true,
24 | 'show_in_rest' => true,
25 | 'query_var' => true,
26 | 'capability_type' => 'post',
27 | 'hierarchical' => false,
28 | 'menu_position' => 35,
29 | 'menu_icon' => 'dashicons-format-chat',
30 | 'has_archive' => false,
31 | 'supports' => array( 'title', 'editor' ),
32 | );
33 |
34 | register_post_type( 'testimonials', $args );
35 |
36 | function stag_testimonials_edit_columns( $columns ) {
37 | $columns = array(
38 | 'cb' => '',
39 | 'title' => __( 'Testimonial Title', 'stag' ),
40 | 'date' => __( 'Date', 'stag' ),
41 | );
42 | return $columns;
43 | }
44 |
45 | add_filter( 'manage_edit-testimonials_columns', 'stag_testimonials_edit_columns' );
46 |
--------------------------------------------------------------------------------
/includes/tinymce.php:
--------------------------------------------------------------------------------
1 | plugin_url() . '/assets/js/tinymce-button.js';
87 |
88 | return $plugins;
89 | }
90 |
91 | /**
92 | * Implement the TinyMCE button for creating a button.
93 | *
94 | * @since 2.0.0.
95 | *
96 | * @param array $buttons The current array of plugins.
97 | * @return array The modified plugins array.
98 | */
99 | public function register_mce_button( $buttons ) {
100 | $buttons[] = 'stagtools_mce_hr_button';
101 |
102 | return $buttons;
103 | }
104 |
105 | /**
106 | * Add styles to the Styles dropdown.
107 | *
108 | * @since 2.0.0.
109 | *
110 | * @param array $settings TinyMCE settings array.
111 | * @return array Modified array.
112 | */
113 | public function style_formats( $settings ) {
114 | $style_formats = array(
115 | // Big (big)
116 | array(
117 | 'title' => __( 'Run In', 'stag' ),
118 | 'block' => 'p',
119 | 'classes' => 'stag-intro-text run-in',
120 | ),
121 | array(
122 | 'title' => __( 'Alert', 'stag' ),
123 | 'items' => array(
124 | array(
125 | 'title' => __( 'Green', 'stag' ),
126 | 'block' => 'p',
127 | 'attributes' => array(
128 | 'class' => 'stag-alert stag-alert--green',
129 | ),
130 | ),
131 | array(
132 | 'title' => __( 'Red', 'stag' ),
133 | 'block' => 'p',
134 | 'attributes' => array(
135 | 'class' => 'stag-alert stag-alert--red',
136 | ),
137 | ),
138 | array(
139 | 'title' => __( 'Yellow', 'stag' ),
140 | 'block' => 'p',
141 | 'attributes' => array(
142 | 'class' => 'stag-alert stag-alert--yellow',
143 | ),
144 | ),
145 | array(
146 | 'title' => __( 'Blue', 'stag' ),
147 | 'block' => 'p',
148 | 'attributes' => array(
149 | 'class' => 'stag-alert stag-alert--blue',
150 | ),
151 | ),
152 | array(
153 | 'title' => __( 'Grey', 'stag' ),
154 | 'block' => 'p',
155 | 'attributes' => array(
156 | 'class' => 'stag-alert stag-alert--grey',
157 | ),
158 | ),
159 | ),
160 | ),
161 | );
162 |
163 | // Combine with existing format definitions
164 | if ( isset( $settings['style_formats'] ) ) {
165 | $existing_formats = json_decode( $settings['style_formats'] );
166 | $style_formats = array_merge( $existing_formats, $style_formats );
167 | }
168 |
169 | // Allow styles to be customized
170 | $style_formats = apply_filters( 'stagtools_style_formats', $style_formats );
171 |
172 | // Encode
173 | $settings['style_formats'] = json_encode( $style_formats );
174 |
175 | return $settings;
176 | }
177 |
178 | /**
179 | * Add the Styles dropdown for the Visual editor.
180 | *
181 | * @since 2.0.0.
182 | *
183 | * @param array $buttons Array of activated buttons.
184 | * @return array The modified array.
185 | */
186 | public function register_mce_formats( $buttons ) {
187 | // Add the styles dropdown
188 | array_unshift( $buttons, 'styleselect' );
189 |
190 | return $buttons;
191 | }
192 |
193 | /**
194 | * Position the new hr button in the place that the old hr usually resides.
195 | *
196 | * @since 2.0.0.
197 | *
198 | * @param array $mceInit The configuration for the current editor.
199 | * @param string $editor_id The ID for the current editor.
200 | * @return array The modified configuration array.
201 | */
202 | public function tiny_mce_before_init( $mceInit, $editor_id ) {
203 | if ( ! empty( $mceInit['toolbar1'] ) ) {
204 | if ( in_array( 'hr', explode( ',', $mceInit['toolbar1'] ), true ) ) {
205 | // Remove the current positioning of the new hr button
206 | $mceInit['toolbar1'] = str_replace( ',hr,', ',stagtools_mce_hr_button,', $mceInit['toolbar1'] );
207 |
208 | // Remove the duplicated new hr button
209 | $pieces = explode( ',', $mceInit['toolbar1'] );
210 | $pieces = array_unique( $pieces );
211 | $mceInit['toolbar1'] = implode( ',', $pieces );
212 | }
213 | }
214 |
215 | return $mceInit;
216 | }
217 |
218 | /**
219 | * Add translations for plugin.
220 | *
221 | * @since 2.0.0.
222 | *
223 | * @param array $mce_translation Key/value pairs of strings.
224 | * @param string $mce_locale Locale.
225 | * @return array The updated translation array.
226 | */
227 | public function wp_mce_translation( $mce_translation, $mce_locale ) {
228 | $additional_items = array(
229 | 'Insert Horizontal Line' => __( 'Insert Horizontal Line', 'make' ),
230 | 'Horizontal line' => __( 'Horizontal line', 'make' ),
231 | 'Style' => __( 'Style', 'make' ),
232 | 'Plain' => __( 'Plain', 'make' ),
233 | 'Strong' => __( 'Strong', 'make' ),
234 | 'Double' => __( 'Double', 'make' ),
235 | 'Dashed' => __( 'Dashed', 'make' ),
236 | 'Dotted' => __( 'Dotted', 'make' ),
237 | );
238 |
239 | return array_merge( $mce_translation, $additional_items );
240 | }
241 | }
242 |
243 | /**
244 | * Instantiate or return the one StagTools_TinyMCE instance.
245 | *
246 | * @since 2.0.0.
247 | *
248 | * @return StagTools_TinyMCE
249 | */
250 | function stag_get_tinmyce_styles() {
251 | return StagTools_TinyMCE::instance();
252 | }
253 |
254 | add_action( 'admin_init', 'stag_get_tinmyce_styles' );
255 |
--------------------------------------------------------------------------------
/includes/widgets/lib/TwitterText/lib/Twitter/Autolink.php:
--------------------------------------------------------------------------------
1 |
4 | * @author Nick Pope
5 | * @copyright Copyright © 2010, Mike Cochrane, Nick Pope
6 | * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License v2.0
7 | * @package Twitter
8 | */
9 |
10 | require_once 'Regex.php';
11 |
12 | /**
13 | * Twitter Autolink Class
14 | *
15 | * Parses tweets and generates HTML anchor tags around URLs, usernames,
16 | * username/list pairs and hashtags.
17 | *
18 | * Originally written by {@link http://github.com/mikenz Mike Cochrane}, this
19 | * is based on code by {@link http://github.com/mzsanford Matt Sanford} and
20 | * heavily modified by {@link http://github.com/ngnpope Nick Pope}.
21 | *
22 | * @author Mike Cochrane
23 | * @author Nick Pope
24 | * @copyright Copyright © 2010, Mike Cochrane, Nick Pope
25 | * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License v2.0
26 | * @package Twitter
27 | */
28 | class Twitter_Autolink extends Twitter_Regex {
29 |
30 | /**
31 | * CSS class for auto-linked URLs.
32 | *
33 | * @var string
34 | */
35 | protected $class_url = 'url';
36 |
37 | /**
38 | * CSS class for auto-linked username URLs.
39 | *
40 | * @var string
41 | */
42 | protected $class_user = 'username';
43 |
44 | /**
45 | * CSS class for auto-linked list URLs.
46 | *
47 | * @var string
48 | */
49 | protected $class_list = 'list';
50 |
51 | /**
52 | * CSS class for auto-linked hashtag URLs.
53 | *
54 | * @var string
55 | */
56 | protected $class_hash = 'hashtag';
57 |
58 | /**
59 | * URL base for username links (the username without the @ will be appended).
60 | *
61 | * @var string
62 | */
63 | protected $url_base_user = 'http://twitter.com/';
64 |
65 | /**
66 | * URL base for list links (the username/list without the @ will be appended).
67 | *
68 | * @var string
69 | */
70 | protected $url_base_list = 'http://twitter.com/';
71 |
72 | /**
73 | * URL base for hashtag links (the hashtag without the # will be appended).
74 | *
75 | * @var string
76 | */
77 | protected $url_base_hash = 'http://twitter.com/search?q=%23';
78 |
79 | /**
80 | * Whether to include the value 'nofollow' in the 'rel' attribute.
81 | *
82 | * @var bool
83 | */
84 | protected $nofollow = true;
85 |
86 | /**
87 | * Whether to include the value 'external' in the 'rel' attribute.
88 | *
89 | * Often this is used to be matched on in JavaScript for dynamically adding
90 | * the 'target' attribute which is deprecated in HTML 4.01. In HTML 5 it has
91 | * been undeprecated and thus the 'target' attribute can be used. If this is
92 | * set to false then the 'target' attribute will be output.
93 | *
94 | * @var bool
95 | */
96 | protected $external = true;
97 |
98 | /**
99 | * The scope to open the link in.
100 | *
101 | * Support for the 'target' attribute was deprecated in HTML 4.01 but has
102 | * since been reinstated in HTML 5. To output the 'target' attribute you
103 | * must disable the adding of the string 'external' to the 'rel' attribute.
104 | *
105 | * @var string
106 | */
107 | protected $target = '_blank';
108 |
109 | /**
110 | * Provides fluent method chaining.
111 | *
112 | * @param string $tweet The tweet to be converted.
113 | * @param bool $full_encode Whether to encode all special characters.
114 | *
115 | * @see __construct()
116 | *
117 | * @return Twitter_Autolink
118 | */
119 | public static function create($tweet, $full_encode = false) {
120 | return new self($tweet, $full_encode);
121 | }
122 |
123 | /**
124 | * Reads in a tweet to be parsed and converted to contain links.
125 | *
126 | * As the intent is to produce links and output the modified tweet to the
127 | * user, we take this opportunity to ensure that we escape user input.
128 | *
129 | * @see htmlspecialchars()
130 | *
131 | * @param string $tweet The tweet to be converted.
132 | * @param bool $escape Whether to escape the tweet (default: true).
133 | * @param bool $full_encode Whether to encode all special characters.
134 | */
135 | public function __construct($tweet, $escape = true, $full_encode = false) {
136 | if ($escape) {
137 | if ($full_encode) {
138 | parent::__construct(htmlentities($tweet, ENT_QUOTES, 'UTF-8', false));
139 | } else {
140 | parent::__construct(htmlspecialchars($tweet, ENT_QUOTES, 'UTF-8', false));
141 | }
142 | } else {
143 | parent::__construct($tweet);
144 | }
145 | }
146 |
147 | /**
148 | * CSS class for auto-linked URLs.
149 | *
150 | * @return string CSS class for URL links.
151 | */
152 | public function getURLClass() {
153 | return $this->class_url;
154 | }
155 |
156 | /**
157 | * CSS class for auto-linked URLs.
158 | *
159 | * @param string $v CSS class for URL links.
160 | *
161 | * @return Twitter_Autolink Fluid method chaining.
162 | */
163 | public function setURLClass($v) {
164 | $this->class_url = trim($v);
165 | return $this;
166 | }
167 |
168 | /**
169 | * CSS class for auto-linked username URLs.
170 | *
171 | * @return string CSS class for username links.
172 | */
173 | public function getUsernameClass() {
174 | return $this->class_user;
175 | }
176 |
177 | /**
178 | * CSS class for auto-linked username URLs.
179 | *
180 | * @param string $v CSS class for username links.
181 | *
182 | * @return Twitter_Autolink Fluid method chaining.
183 | */
184 | public function setUsernameClass($v) {
185 | $this->class_user = trim($v);
186 | return $this;
187 | }
188 |
189 | /**
190 | * CSS class for auto-linked username/list URLs.
191 | *
192 | * @return string CSS class for username/list links.
193 | */
194 | public function getListClass() {
195 | return $this->class_list;
196 | }
197 |
198 | /**
199 | * CSS class for auto-linked username/list URLs.
200 | *
201 | * @param string $v CSS class for username/list links.
202 | *
203 | * @return Twitter_Autolink Fluid method chaining.
204 | */
205 | public function setListClass($v) {
206 | $this->class_list = trim($v);
207 | return $this;
208 | }
209 |
210 | /**
211 | * CSS class for auto-linked hashtag URLs.
212 | *
213 | * @return string CSS class for hashtag links.
214 | */
215 | public function getHashtagClass() {
216 | return $this->class_hash;
217 | }
218 |
219 | /**
220 | * CSS class for auto-linked hashtag URLs.
221 | *
222 | * @param string $v CSS class for hashtag links.
223 | *
224 | * @return Twitter_Autolink Fluid method chaining.
225 | */
226 | public function setHashtagClass($v) {
227 | $this->class_hash = trim($v);
228 | return $this;
229 | }
230 |
231 | /**
232 | * Whether to include the value 'nofollow' in the 'rel' attribute.
233 | *
234 | * @return bool Whether to add 'nofollow' to the 'rel' attribute.
235 | */
236 | public function getNoFollow() {
237 | return $this->nofollow;
238 | }
239 |
240 | /**
241 | * Whether to include the value 'nofollow' in the 'rel' attribute.
242 | *
243 | * @param bool $v The value to add to the 'target' attribute.
244 | *
245 | * @return Twitter_Autolink Fluid method chaining.
246 | */
247 | public function setNoFollow($v) {
248 | $this->nofollow = $v;
249 | return $this;
250 | }
251 |
252 | /**
253 | * Whether to include the value 'external' in the 'rel' attribute.
254 | *
255 | * Often this is used to be matched on in JavaScript for dynamically adding
256 | * the 'target' attribute which is deprecated in HTML 4.01. In HTML 5 it has
257 | * been undeprecated and thus the 'target' attribute can be used. If this is
258 | * set to false then the 'target' attribute will be output.
259 | *
260 | * @return bool Whether to add 'external' to the 'rel' attribute.
261 | */
262 | public function getExternal() {
263 | return $this->external;
264 | }
265 |
266 | /**
267 | * Whether to include the value 'external' in the 'rel' attribute.
268 | *
269 | * Often this is used to be matched on in JavaScript for dynamically adding
270 | * the 'target' attribute which is deprecated in HTML 4.01. In HTML 5 it has
271 | * been undeprecated and thus the 'target' attribute can be used. If this is
272 | * set to false then the 'target' attribute will be output.
273 | *
274 | * @param bool $v The value to add to the 'target' attribute.
275 | *
276 | * @return Twitter_Autolink Fluid method chaining.
277 | */
278 | public function setExternal($v) {
279 | $this->external = $v;
280 | return $this;
281 | }
282 |
283 | /**
284 | * The scope to open the link in.
285 | *
286 | * Support for the 'target' attribute was deprecated in HTML 4.01 but has
287 | * since been reinstated in HTML 5. To output the 'target' attribute you
288 | * must disable the adding of the string 'external' to the 'rel' attribute.
289 | *
290 | * @return string The value to add to the 'target' attribute.
291 | */
292 | public function getTarget() {
293 | return $this->target;
294 | }
295 |
296 | /**
297 | * The scope to open the link in.
298 | *
299 | * Support for the 'target' attribute was deprecated in HTML 4.01 but has
300 | * since been reinstated in HTML 5. To output the 'target' attribute you
301 | * must disable the adding of the string 'external' to the 'rel' attribute.
302 | *
303 | * @param string $v The value to add to the 'target' attribute.
304 | *
305 | * @return Twitter_Autolink Fluid method chaining.
306 | */
307 | public function setTarget($v) {
308 | $this->target = trim($v);
309 | return $this;
310 | }
311 |
312 | /**
313 | * Adds links to all elements in the tweet.
314 | *
315 | * @return string The modified tweet.
316 | */
317 | public function addLinks() {
318 | $original = $this->tweet;
319 | $this->tweet = $this->addLinksToURLs();
320 | $this->tweet = $this->addLinksToHashtags();
321 | $this->tweet = $this->addLinksToUsernamesAndLists();
322 | $modified = $this->tweet;
323 | $this->tweet = $original;
324 | return $modified;
325 | }
326 |
327 | /**
328 | * Adds links to hashtag elements in the tweet.
329 | *
330 | * @return string The modified tweet.
331 | */
332 | public function addLinksToHashtags() {
333 | return preg_replace_callback(
334 | self::REGEX_HASHTAG,
335 | array($this, '_addLinksToHashtags'),
336 | $this->tweet);
337 | }
338 |
339 | /**
340 | * Adds links to URL elements in the tweet.
341 | *
342 | * @return string The modified tweet.
343 | */
344 | public function addLinksToURLs() {
345 | return preg_replace_callback(
346 | self::$REGEX_VALID_URL,
347 | array($this, '_addLinksToURLs'),
348 | $this->tweet);
349 | }
350 |
351 | /**
352 | * Adds links to username/list elements in the tweet.
353 | *
354 | * @return string The modified tweet.
355 | */
356 | public function addLinksToUsernamesAndLists() {
357 | return preg_replace_callback(
358 | self::REGEX_USERNAME_LIST,
359 | array($this, '_addLinksToUsernamesAndLists'),
360 | $this->tweet);
361 | }
362 |
363 | /**
364 | * Wraps a tweet element in an HTML anchor tag using the provided URL.
365 | *
366 | * This is a helper function to perform the generation of the link.
367 | *
368 | * @param string $url The URL to use as the href.
369 | * @param string $class The CSS class(es) to apply (space separated).
370 | * @param string $element The tweet element to wrap.
371 | *
372 | * @return string The tweet element with a link applied.
373 | */
374 | protected function wrap($url, $class, $element) {
375 | $link = 'external) $rel[] = 'external';
380 | if ($this->nofollow) $rel[] = 'nofollow';
381 | if (!empty($rel)) $link .= ' rel="'.implode(' ', $rel).'"';
382 | if ($this->target) $link .= ' target="'.$this->target.'"';
383 | $link .= '>'.$element.'';
384 | return $link;
385 | }
386 |
387 | /**
388 | * Callback used by the method that adds links to hashtags.
389 | *
390 | * @see addLinksToHashtags()
391 | *
392 | * @param array $matches The regular expression matches.
393 | *
394 | * @return string The link-wrapped hashtag.
395 | */
396 | protected function _addLinksToHashtags($matches) {
397 | $replacement = $matches[1];
398 | $element = $matches[2] . $matches[3];
399 | $url = $this->url_base_hash . $matches[3];
400 | $replacement .= $this->wrap($url, $this->class_hash, $element);
401 | return $replacement;
402 | }
403 |
404 | /**
405 | * Callback used by the method that adds links to URLs.
406 | *
407 | * @see addLinksToURLs()
408 | *
409 | * @param array $matches The regular expression matches.
410 | *
411 | * @return string The link-wrapped URL.
412 | */
413 | protected function _addLinksToURLs($matches) {
414 | list($all, $before, $url, $protocol, $domain, $path, $query) = array_pad($matches, 7, '');
415 | $url = htmlspecialchars($url, ENT_QUOTES, 'UTF-8', false);
416 | if (!$protocol && !preg_match(self::REGEX_PROBABLE_TLD, $domain)) return $all;
417 | $href = ((!$protocol || strtolower($protocol) === 'www.') ? 'http://'.$url : $url);
418 | return $before . $this->wrap($href, $this->class_url, $url);
419 | }
420 |
421 | /**
422 | * Callback used by the method that adds links to username/list pairs.
423 | *
424 | * @see addLinksToUsernamesAndLists()
425 | *
426 | * @param array $matches The regular expression matches.
427 | *
428 | * @return string The link-wrapped username/list pair.
429 | */
430 | protected function _addLinksToUsernamesAndLists($matches) {
431 | list($all, $before, $at, $username, $slash_listname, $after) = array_pad($matches, 6, '');
432 | # If $after is not empty, there is an invalid character.
433 | if (!empty($after)) return $all;
434 | if (!empty($slash_listname)) {
435 | # Replace the list and username
436 | $element = $username . substr($slash_listname, 0, 26);
437 | $class = $this->class_list;
438 | $url = $this->url_base_list . $element;
439 | $postfix = substr($slash_listname, 26);
440 | } else {
441 | # Replace the username
442 | $element = $username;
443 | $class = $this->class_user;
444 | $url = $this->url_base_user . $element;
445 | $postfix = '';
446 | }
447 | return $before . $this->wrap($url, $class, $at . $element) . $postfix . $after;
448 | }
449 |
450 | }
451 |
--------------------------------------------------------------------------------
/includes/widgets/lib/TwitterText/lib/Twitter/Extractor.php:
--------------------------------------------------------------------------------
1 |
4 | * @author Nick Pope
5 | * @copyright Copyright © 2010, Mike Cochrane, Nick Pope
6 | * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License v2.0
7 | * @package Twitter
8 | */
9 |
10 | require_once 'Regex.php';
11 |
12 | /**
13 | * Twitter Extractor Class
14 | *
15 | * Parses tweets and extracts URLs, usernames, username/list pairs and
16 | * hashtags.
17 | *
18 | * Originally written by {@link http://github.com/mikenz Mike Cochrane}, this
19 | * is based on code by {@link http://github.com/mzsanford Matt Sanford} and
20 | * heavily modified by {@link http://github.com/ngnpope Nick Pope}.
21 | *
22 | * @author Mike Cochrane
23 | * @author Nick Pope
24 | * @copyright Copyright © 2010, Mike Cochrane, Nick Pope
25 | * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License v2.0
26 | * @package Twitter
27 | */
28 | class Twitter_Extractor extends Twitter_Regex {
29 |
30 | /**
31 | * Provides fluent method chaining.
32 | *
33 | * @param string $tweet The tweet to be converted.
34 | *
35 | * @see __construct()
36 | *
37 | * @return Twitter_Extractor
38 | */
39 | public static function create($tweet) {
40 | return new self($tweet);
41 | }
42 |
43 | /**
44 | * Reads in a tweet to be parsed and extracts elements from it.
45 | *
46 | * Extracts various parts of a tweet including URLs, usernames, hashtags...
47 | *
48 | * @param string $tweet The tweet to extract.
49 | */
50 | public function __construct($tweet) {
51 | parent::__construct($tweet);
52 | }
53 |
54 | /**
55 | * Extracts all parts of a tweet and returns an associative array containing
56 | * the extracted elements.
57 | *
58 | * @return array The elements in the tweet.
59 | */
60 | public function extract() {
61 | return array(
62 | 'hashtags' => $this->extractHashtags(),
63 | 'urls' => $this->extractURLs(),
64 | 'mentions' => $this->extractMentionedUsernames(),
65 | 'replyto' => $this->extractRepliedUsernames(),
66 | 'hashtags_with_indices' => $this->extractHashtagsWithIndices(),
67 | 'urls_with_indices' => $this->extractURLsWithIndices(),
68 | 'mentions_with_indices' => $this->extractMentionedUsernamesWithIndices(),
69 | );
70 | }
71 |
72 | /**
73 | * Extracts all the hashtags from the tweet.
74 | *
75 | * @return array The hashtag elements in the tweet.
76 | */
77 | public function extractHashtags() {
78 | preg_match_all(self::REGEX_HASHTAG, $this->tweet, $matches);
79 | return $matches[3];
80 | }
81 |
82 | /**
83 | * Extracts all the URLs from the tweet.
84 | *
85 | * @return array The URL elements in the tweet.
86 | */
87 | public function extractURLs() {
88 | preg_match_all(self::$REGEX_VALID_URL, $this->tweet, $matches);
89 | list($all, $before, $url, $protocol, $domain, $path, $query) = array_pad($matches, 7, '');
90 | $i = count($url)-1;
91 | for (; $i >= 0; $i--) {
92 | if (!preg_match('!https?://!', $protocol[$i])) {
93 | # Note: $protocol can contain 'www.' if no protocol exists!
94 | if (preg_match(self::REGEX_PROBABLE_TLD, $domain[$i]) || strtolower($protocol[$i]) === 'www.') {
95 | $url[$i] = 'http://'.(strtolower($protocol[$i]) === 'www.' ? $protocol[$i] : '').$domain[$i];
96 | } else {
97 | unset($url[$i]);
98 | }
99 | }
100 | }
101 | # Renumber the array:
102 | return array_values($url);
103 | }
104 |
105 | /**
106 | * Extract all the usernames from the tweet.
107 | *
108 | * A mention is an occurrence of a username anywhere in a tweet.
109 | *
110 | * @return array The usernames elements in the tweet.
111 | */
112 | public function extractMentionedUsernames() {
113 | preg_match_all(self::REGEX_USERNAME_MENTION, $this->tweet, $matches);
114 | list($all, $before, $username, $after) = array_pad($matches, 4, '');
115 | $usernames = array();
116 | for ($i = 0; $i < count($username); $i ++) {
117 | # If $after is not empty, there is an invalid character.
118 | if (!empty($after[$i])) continue;
119 | array_push($usernames, $username[$i]);
120 | }
121 | return $usernames;
122 | }
123 |
124 | /**
125 | * Extract all the usernames replied to from the tweet.
126 | *
127 | * A reply is an occurrence of a username at the beginning of a tweet.
128 | *
129 | * @return array The usernames replied to in a tweet.
130 | */
131 | public function extractRepliedUsernames() {
132 | preg_match(self::$REGEX_REPLY_USERNAME, $this->tweet, $matches);
133 | return isset($matches[2]) ? $matches[2] : '';
134 | }
135 |
136 | /**
137 | * Extracts all the hashtags and the indices they occur at from the tweet.
138 | *
139 | * @return array The hashtag elements in the tweet.
140 | */
141 | public function extractHashtagsWithIndices() {
142 | preg_match_all(self::REGEX_HASHTAG, $this->tweet, $matches, PREG_OFFSET_CAPTURE);
143 | $m = &$matches[3];
144 | for ($i = 0; $i < count($m); $i++) {
145 | $m[$i] = array_combine(array('hashtag', 'indices'), $m[$i]);
146 | # XXX: Fix for PREG_OFFSET_CAPTURE returning byte offsets...
147 | $start = mb_strlen(substr($this->tweet, 0, $matches[1][$i][1]));
148 | $start += mb_strlen($matches[1][$i][0]);
149 | $length = mb_strlen($m[$i]['hashtag']);
150 | $m[$i]['indices'] = array($start, $start + $length + 1);
151 | }
152 | return $m;
153 | }
154 |
155 | /**
156 | * Extracts all the URLs and the indices they occur at from the tweet.
157 | *
158 | * @return array The URLs elements in the tweet.
159 | */
160 | public function extractURLsWithIndices() {
161 | preg_match_all(self::$REGEX_VALID_URL, $this->tweet, $matches, PREG_OFFSET_CAPTURE);
162 | $m = &$matches[2];
163 | for ($i = 0; $i < count($m); $i++) {
164 | $m[$i] = array_combine(array('url', 'indices'), $m[$i]);
165 | # XXX: Fix for PREG_OFFSET_CAPTURE returning byte offsets...
166 | $start = mb_strlen(substr($this->tweet, 0, $matches[1][$i][1]));
167 | $start += mb_strlen($matches[1][$i][0]);
168 | $length = mb_strlen($m[$i]['url']);
169 | $m[$i]['indices'] = array($start, $start + $length);
170 | }
171 | return $m;
172 | }
173 |
174 | /**
175 | * Extracts all the usernames and the indices they occur at from the tweet.
176 | *
177 | * @return array The username elements in the tweet.
178 | */
179 | public function extractMentionedUsernamesWithIndices() {
180 | preg_match_all(self::REGEX_USERNAME_MENTION, $this->tweet, $matches, PREG_OFFSET_CAPTURE);
181 | $m = &$matches[2];
182 | for ($i = 0; $i < count($m); $i++) {
183 | $m[$i] = array_combine(array('screen_name', 'indices'), $m[$i]);
184 | # XXX: Fix for PREG_OFFSET_CAPTURE returning byte offsets...
185 | $start = mb_strlen(substr($this->tweet, 0, $matches[1][$i][1]));
186 | $start += mb_strlen($matches[1][$i][0]);
187 | $length = mb_strlen($m[$i]['screen_name']);
188 | $m[$i]['indices'] = array($start, $start + $length + 1);
189 | }
190 | return $m;
191 | }
192 |
193 | }
194 |
--------------------------------------------------------------------------------
/includes/widgets/lib/TwitterText/lib/Twitter/HitHighlighter.php:
--------------------------------------------------------------------------------
1 |
4 | * @copyright Copyright © 2010, Nick Pope
5 | * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License v2.0
6 | * @package Twitter
7 | */
8 |
9 | require_once 'Regex.php';
10 |
11 | /**
12 | * Twitter HitHighlighter Class
13 | *
14 | * Performs "hit highlighting" on tweets that have been auto-linked already.
15 | * Useful with the results returned from the search API.
16 | *
17 | * Originally written by {@link http://github.com/mikenz Mike Cochrane}, this
18 | * is based on code by {@link http://github.com/mzsanford Matt Sanford} and
19 | * heavily modified by {@link http://github.com/ngnpope Nick Pope}.
20 | *
21 | * @author Nick Pope
22 | * @copyright Copyright © 2010, Nick Pope
23 | * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License v2.0
24 | * @package Twitter
25 | */
26 | class Twitter_HitHighlighter extends Twitter_Regex {
27 |
28 | /**
29 | * The tag to surround hits with.
30 | *
31 | * @var string
32 | */
33 | protected $tag = 'em';
34 |
35 | /**
36 | * Provides fluent method chaining.
37 | *
38 | * @param string $tweet The tweet to be hit highlighted.
39 | * @param bool $full_encode Whether to encode all special characters.
40 | *
41 | * @see __construct()
42 | *
43 | * @return Twitter_HitHighlighter
44 | */
45 | public static function create($tweet, $full_encode = false) {
46 | return new self($tweet, $full_encode);
47 | }
48 |
49 | /**
50 | * Reads in a tweet to be parsed and hit highlighted.
51 | *
52 | * We take this opportunity to ensure that we escape user input.
53 | *
54 | * @see htmlspecialchars()
55 | *
56 | * @param string $tweet The tweet to be hit highlighted.
57 | * @param bool $escape Whether to escape the tweet (default: true).
58 | * @param bool $full_encode Whether to encode all special characters.
59 | */
60 | public function __construct($tweet, $escape = true, $full_encode = false) {
61 | if ($escape) {
62 | if ($full_encode) {
63 | parent::__construct(htmlentities($tweet, ENT_QUOTES, 'UTF-8', false));
64 | } else {
65 | parent::__construct(htmlspecialchars($tweet, ENT_QUOTES, 'UTF-8', false));
66 | }
67 | } else {
68 | parent::__construct($tweet);
69 | }
70 | }
71 |
72 | /**
73 | * Set the highlighting tag to surround hits with. The default tag is 'em'.
74 | *
75 | * @return string The tag name.
76 | */
77 | public function getTag() {
78 | return $this->tag;
79 | }
80 |
81 | /**
82 | * Set the highlighting tag to surround hits with. The default tag is 'em'.
83 | *
84 | * @param string $v The tag name.
85 | *
86 | * @return Twitter_HitHighlighter Fluid method chaining.
87 | */
88 | public function setTag($v) {
89 | $this->tag = $v;
90 | return $this;
91 | }
92 |
93 | /**
94 | * Hit highlights the tweet.
95 | *
96 | * @param array $hits An array containing the start and end index pairs
97 | * for the highlighting.
98 | *
99 | * @return string The hit highlighted tweet.
100 | */
101 | public function addHitHighlighting(array $hits) {
102 | if (empty($hits)) return $this->tweet;
103 | $tweet = '';
104 | $tags = array('<'.$this->tag.'>', ''.$this->tag.'>');
105 | # Check whether we can simply replace or whether we need to chunk...
106 | if (strpos($this->tweet, '<') === false) {
107 | $ti = 0; // tag increment (for added tags)
108 | $tweet = $this->tweet;
109 | foreach ($hits as $hit) {
110 | $tweet = self::mb_substr_replace($tweet, $tags[0], $hit[0] + $ti, 0);
111 | $ti += mb_strlen($tags[0]);
112 | $tweet = self::mb_substr_replace($tweet, $tags[1], $hit[1] + $ti, 0);
113 | $ti += mb_strlen($tags[1]);
114 | }
115 | } else {
116 | $chunks = preg_split('/[<>]/iu', $this->tweet);
117 | $chunk = $chunks[0];
118 | $chunk_index = 0;
119 | $chunk_cursor = 0;
120 | $offset = 0;
121 | $start_in_chunk = false;
122 | # Flatten the multidimensional hits array:
123 | $hits_flat = array();
124 | foreach ($hits as $hit) $hits_flat = array_merge($hits_flat, $hit);
125 | # Loop over the hit indices:
126 | for ($index = 0; $index < count($hits_flat); $index++) {
127 | $hit = $hits_flat[$index];
128 | $tag = $tags[$index % 2];
129 | $placed = false;
130 | while ($chunk !== null && $hit >= ($i = $offset + mb_strlen($chunk))) {
131 | $tweet .= mb_substr($chunk, $chunk_cursor);
132 | if ($start_in_chunk && $hit === $i) {
133 | $tweet .= $tag;
134 | $placed = true;
135 | }
136 | if (isset($chunks[$chunk_index+1])) $tweet .= '<' . $chunks[$chunk_index+1] . '>';
137 | $offset += mb_strlen($chunk);
138 | $chunk_cursor = 0;
139 | $chunk_index += 2;
140 | $chunk = (isset($chunks[$chunk_index]) ? $chunks[$chunk_index] : null);
141 | $start_in_chunk = false;
142 | }
143 | if (!$placed && $chunk !== null) {
144 | $hit_spot = $hit - $offset;
145 | $tweet .= mb_substr($chunk, $chunk_cursor, $hit_spot - $chunk_cursor) . $tag;
146 | $chunk_cursor = $hit_spot;
147 | $start_in_chunk = ($index % 2 === 0);
148 | $placed = true;
149 | }
150 | # Ultimate fallback - hits that run off the end get a closing tag:
151 | if (!$placed) $tweet .= $tag;
152 | }
153 | if ($chunk !== null) {
154 | if ($chunk_cursor < mb_strlen($chunk)) {
155 | $tweet .= mb_substr($chunk, $chunk_cursor);
156 | }
157 | for ($index = $chunk_index + 1; $index < count($chunks); $index++) {
158 | $tweet .= ($index % 2 === 0 ? $chunks[$index] : '<' . $chunks[$index] . '>');
159 | }
160 | }
161 | }
162 | return $tweet;
163 | }
164 |
165 | /**
166 | * A multibyte-aware substring replacement function.
167 | *
168 | * @param string $string The string to modify.
169 | * @param string $replacement The replacement string.
170 | * @param int $start The start of the replacement.
171 | * @param int $length The number of characters to replace.
172 | * @param string $encoding The encoding of the string.
173 | *
174 | * @return string The modified string.
175 | *
176 | * @see http://www.php.net/manual/en/function.substr-replace.php#90146
177 | */
178 | protected static function mb_substr_replace($string, $replacement, $start, $length = null, $encoding = null) {
179 | if (extension_loaded('mbstring') === true) {
180 | $string_length = (is_null($encoding) === true) ? mb_strlen($string) : mb_strlen($string, $encoding);
181 | if ($start < 0) {
182 | $start = max(0, $string_length + $start);
183 | } else if ($start > $string_length) {
184 | $start = $string_length;
185 | }
186 | if ($length < 0) {
187 | $length = max(0, $string_length - $start + $length);
188 | } else if ((is_null($length) === true) || ($length > $string_length)) {
189 | $length = $string_length;
190 | }
191 | if (($start + $length) > $string_length) {
192 | $length = $string_length - $start;
193 | }
194 | if (is_null($encoding) === true) {
195 | return mb_substr($string, 0, $start) . $replacement . mb_substr($string, $start + $length, $string_length - $start - $length);
196 | }
197 | return mb_substr($string, 0, $start, $encoding) . $replacement . mb_substr($string, $start + $length, $string_length - $start - $length, $encoding);
198 | }
199 | return (is_null($length) === true) ? substr_replace($string, $replacement, $start) : substr_replace($string, $replacement, $start, $length);
200 | }
201 |
202 | }
203 |
--------------------------------------------------------------------------------
/includes/widgets/lib/TwitterText/lib/Twitter/Regex.php:
--------------------------------------------------------------------------------
1 |
4 | * @author Nick Pope
5 | * @copyright Copyright © 2010, Mike Cochrane, Nick Pope
6 | * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License v2.0
7 | * @package Twitter
8 | */
9 |
10 | /**
11 | * Twitter Regex Abstract Class
12 | *
13 | * Used by subclasses that need to parse tweets.
14 | *
15 | * Originally written by {@link http://github.com/mikenz Mike Cochrane}, this
16 | * is based on code by {@link http://github.com/mzsanford Matt Sanford} and
17 | * heavily modified by {@link http://github.com/ngnpope Nick Pope}.
18 | *
19 | * @author Mike Cochrane
20 | * @author Nick Pope
21 | * @copyright Copyright © 2010, Mike Cochrane, Nick Pope
22 | * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License v2.0
23 | * @package Twitter
24 | */
25 | abstract class Twitter_Regex {
26 |
27 | /**
28 | * Expression to at sign characters
29 | *
30 | * @var string
31 | */
32 | const REGEX_AT_SIGNS = '[@@]';
33 |
34 | /**
35 | * Expression to match characters that may come before a URL.
36 | *
37 | * @var string
38 | */
39 | const REGEX_URL_CHARS_BEFORE = '(?:[^-\\/"\':!=a-z0-9_@@]|^|\\:)';
40 |
41 | /**
42 | * Expression to match the domain portion of a URL.
43 | *
44 | * @var string
45 | */
46 | const REGEX_URL_DOMAIN = '(?:[^\\p{P}\\p{Lo}\\s][\\.-](?=[^\\p{P}\\p{Lo}\\s])|[^\\p{P}\\p{Lo}\\s])+\\.[a-z]{2,}(?::[0-9]+)?';
47 |
48 | /**
49 | * Expression to match handful of probable TLDs for protocol-less URLS.
50 | *
51 | * @var string
52 | */
53 | const REGEX_PROBABLE_TLD = '/\\.(?:com|net|org|gov|edu)$/iu';
54 |
55 | /**
56 | * Expression to match characters that may come in the URL path.
57 | *
58 | * @var string
59 | */
60 | const REGEX_URL_CHARS_PATH = '(?:(?:\\([a-z0-9!\\*\';:=\\+\\$\\/%#\\[\\]\\-_,~]+\\))|@[a-z0-9!\\*\';:=\\+\\$\\/%#\\[\\]\\-_,~]+\\/|[\\.\\,]?(?:[a-z0-9!\\*\';:=\\+\\$\\/%#\\[\\]\\-_~]|,(?!\s)))';
61 |
62 | /**
63 | * Expression to match characters that may come at the end of the URL path.
64 | *
65 | * @var string
66 | */
67 | const REGEX_URL_CHARS_PATH_END = '[a-z0-9=#\\/]';
68 |
69 | /**
70 | * Expression to match characters that may come in the URL query string.
71 | *
72 | * @var string
73 | */
74 | const REGEX_URL_CHARS_QUERY = '[a-z0-9!\\*\'\\(\\);:&=\\+\\$\\/%#\\[\\]\\-_\\.,~]';
75 |
76 | /**
77 | * Expression to match characters that may come at the end of the URL query
78 | * string.
79 | *
80 | * @var string
81 | */
82 | const REGEX_URL_CHARS_QUERY_END = '[a-z0-9_&=#\\/]';
83 |
84 | /**
85 | * Expression to match a username followed by a list.
86 | *
87 | * @var string
88 | */
89 | const REGEX_USERNAME_LIST = '/([^a-z0-9_\/]|^|RT:?)([@@]+)([a-z0-9_]{1,20})(\/[a-z][-_a-z0-9\x80-\xFF]{0,24})?([@@\xC0-\xD6\xD8-\xF6\xF8-\xFF]?)/iu';
90 |
91 | /**
92 | * Expression to match a username mentioned anywhere in a tweet.
93 | *
94 | * @var string
95 | */
96 | const REGEX_USERNAME_MENTION = '/(^|[^a-z0-9_])[@@]([a-z0-9_]{1,20})([@@\xC0-\xD6\xD8-\xF6\xF8-\xFF]?)/iu';
97 |
98 | /**
99 | * Expression to match a hashtag.
100 | *
101 | * @var string
102 | */
103 | const REGEX_HASHTAG = '/(^|[^0-9A-Z&\/\?]+)([##]+)([0-9A-Z_]*[A-Z_]+[a-z0-9_üÀ-ÖØ-öø-ÿ]*)/iu';
104 |
105 | /**
106 | * Expression to match whitespace.
107 | *
108 | * Single byte whitespace characters
109 | * 0x0009-0x000D White_Space # Cc # ..
110 | * 0x0020 White_Space # Zs # SPACE
111 | * 0x0085 White_Space # Cc #
112 | * 0x00A0 White_Space # Zs # NO-BREAK SPACE
113 | * Multi byte whitespace characters
114 | * 0x1680 White_Space # Zs # OGHAM SPACE MARK
115 | * 0x180E White_Space # Zs # MONGOLIAN VOWEL SEPARATOR
116 | * 0x2000-0x200A White_Space # Zs # EN QUAD..HAIR SPACE
117 | * 0x2028 White_Space # Zl # LINE SEPARATOR
118 | * 0x2029 White_Space # Zp # PARAGRAPH SEPARATOR
119 | * 0x202F White_Space # Zs # NARROW NO-BREAK SPACE
120 | * 0x205F White_Space # Zs # MEDIUM MATHEMATICAL SPACE
121 | * 0x3000 White_Space # Zs # IDEOGRAPHIC SPACE
122 | *
123 | * @var string
124 | */
125 | const REGEX_WHITESPACE = '[\x09-\x0D\x20\x85\xA0]|\xe1\x9a\x80|\xe1\xa0\x8e|\xe2\x80[\x80-\x8a,\xa8,\xa9,\xaf\xdf]|\xe3\x80\x80';
126 |
127 | /**
128 | * Contains the complete valid URL pattern string.
129 | *
130 | * This should be generated the first time the constructor is called.
131 | *
132 | * @var string The regex pattern for a valid URL.
133 | */
134 | protected static $REGEX_VALID_URL = null;
135 |
136 | /**
137 | * Contains the reply username pattern string.
138 | *
139 | * This should be generated the first time the constructor is called.
140 | *
141 | * @var string The regex pattern for a reply username.
142 | */
143 | protected static $REGEX_REPLY_USERNAME = null;
144 |
145 | /**
146 | * The tweet to be used in parsing. This should be populated by the
147 | * constructor of all subclasses.
148 | *
149 | * @var string
150 | */
151 | protected $tweet = '';
152 |
153 | /**
154 | * This constructor is used to populate some variables.
155 | *
156 | * @param string $tweet The tweet to parse.
157 | */
158 | protected function __construct($tweet) {
159 | if (is_null(self::$REGEX_VALID_URL)) {
160 | self::$REGEX_VALID_URL = '/(?:' # $1 Complete match (preg_match already matches everything.)
161 | . '('.self::REGEX_URL_CHARS_BEFORE.')' # $2 Preceding character
162 | . '(' # $3 Complete URL
163 | . '((?:https?:\\/\\/|www\\.)?)' # $4 Protocol (or www)
164 | . '('.self::REGEX_URL_DOMAIN.')' # $5 Domain(s) (and port)
165 | . '(\\/'.self::REGEX_URL_CHARS_PATH.'*' # $6 URL Path
166 | . self::REGEX_URL_CHARS_PATH_END.'?)?'
167 | . '(\\?'.self::REGEX_URL_CHARS_QUERY.'*' # $7 Query String
168 | . self::REGEX_URL_CHARS_QUERY_END.')?'
169 | . ')'
170 | . ')/iux';
171 | }
172 | if (is_null(self::$REGEX_REPLY_USERNAME)) {
173 | self::$REGEX_REPLY_USERNAME = '/^('.self::REGEX_WHITESPACE.')*[@@]([a-zA-Z0-9_]{1,20})/';
174 | }
175 | $this->tweet = $tweet;
176 | }
177 |
178 | }
179 |
--------------------------------------------------------------------------------
/includes/widgets/stagtools-widget.php:
--------------------------------------------------------------------------------
1 | $this->widget_id,
21 | 'description' => $this->widget_description,
22 | 'customize_selective_refresh' => true,
23 | );
24 |
25 | parent::__construct( $this->widget_id, $this->widget_name, $widget_ops, $this->control_ops );
26 |
27 | add_action( 'save_post', array( $this, 'flush_widget_cache' ) );
28 | add_action( 'deleted_post', array( $this, 'flush_widget_cache' ) );
29 | add_action( 'switch_theme', array( $this, 'flush_widget_cache' ) );
30 | }
31 |
32 | function get_cached_widget( $args ) {
33 | $cache = wp_cache_get( $this->widget_id, 'widget' );
34 |
35 | if ( ! is_array( $cache ) )
36 | $cache = array();
37 |
38 | if ( isset( $cache[ $args[ 'widget_id' ] ] ) ) {
39 | echo $cache[ $args[ 'widget_id' ] ];
40 | return true;
41 | }
42 |
43 | return false;
44 | }
45 |
46 | public function cache_widget( $args, $content ) {
47 | $cache[ $args[ 'widget_id' ] ] = $content;
48 |
49 | wp_cache_set( $this->widget_id, $cache, 'widget' );
50 | }
51 |
52 | public function flush_widget_cache() {
53 | wp_cache_delete( $this->widget_id, 'widget' );
54 | }
55 |
56 | public function update( $new_instance, $old_instance ) {
57 | $instance = $old_instance;
58 |
59 | if ( ! $this->settings )
60 | return $instance;
61 |
62 | foreach ( $this->settings as $key => $setting ) {
63 | switch ( $setting[ 'type' ] ) {
64 | case 'textarea' :
65 | if ( current_user_can( 'unfiltered_html' ) )
66 | $instance[ $key ] = $new_instance[ $key ];
67 | else
68 | $instance[ $key ] = wp_kses_data( $new_instance[ $key ] );
69 | break;
70 | case 'number' :
71 | $instance[ $key ] = absint( $new_instance[ $key ] );
72 | break;
73 | default :
74 | $instance[ $key ] = isset( $new_instance[ $key ] ) ? sanitize_text_field( $new_instance[ $key ] ) : '';
75 | break;
76 | }
77 | }
78 |
79 | $this->flush_widget_cache();
80 |
81 | return $instance;
82 | }
83 |
84 | public function form( $instance ) {
85 |
86 | if ( ! $this->settings )
87 | return;
88 |
89 | foreach ( $this->settings as $key => $setting ) {
90 | $value = isset( $instance[ $key ] ) ? $instance[ $key ] : $setting[ 'std' ];
91 |
92 | switch ( $setting[ 'type' ] ) {
93 | case 'description' :
94 | ?>
95 |
96 |
101 |
102 |
103 | />
104 |
105 |
106 |
107 |
108 |
113 |
114 |
118 |
119 |
124 |
125 |
126 |
131 |
132 |
139 |
140 |
141 |
146 |
147 | 0 );
152 |
153 | if ( isset( $setting['taxonomy'] ) ) $args['taxonomy'] = $setting['taxonomy'];
154 |
155 | $categories = get_categories( $args );
156 | ?>
157 |
158 |
159 |
165 |
166 |
174 |
175 |
176 |
177 |
178 |
183 |
184 |
185 |
186 |
187 | widget_id = 'stag-dribbble';
11 | $this->widget_cssclass = 'stag-dribbble';
12 | $this->widget_description = __( 'Display your latest Dribbble shots.', 'stag' );
13 | $this->widget_name = __( 'Stag Dribbble Shots', 'stag' );
14 | $this->settings = array(
15 | 'title' => array(
16 | 'type' => 'text',
17 | 'std' => 'Latest Shots',
18 | 'label' => __( 'Title:', 'stag' ),
19 | ),
20 | 'count' => array(
21 | 'type' => 'number',
22 | 'std' => 4,
23 | 'label' => __( 'Number of shots to show:', 'stag' ),
24 | 'step' => 1,
25 | 'min' => 1,
26 | 'max' => 10,
27 | ),
28 | );
29 |
30 | parent::__construct();
31 | }
32 |
33 | public function widget( $args, $instance ) {
34 | if ( $this->get_cached_widget( $args ) )
35 | return;
36 |
37 | ob_start();
38 |
39 | extract( $args );
40 |
41 | $title = apply_filters( 'widget_title', $instance['title'] );
42 | $count = absint( $instance['count'] );
43 | $index = 0;
44 |
45 | $stag_options = get_option( 'stag_options' );
46 | if ( ! isset( $stag_options['dribbble_access_token'] ) || '' === $stag_options['dribbble_access_token'] ) {
47 | if ( current_user_can( 'edit_theme_options' ) ) :
48 | ?>
49 |
50 | StagTools settings', 'stag' ),
53 | admin_url( 'options-general.php?page=stagtools#stagtools_settings_general[dribbble_access_token]' )
54 | );
55 | ?>
56 |
57 | dribbble_shots( $access_token, $count );
64 |
65 | echo $before_widget;
66 |
67 | ?>
68 |
69 |
70 |
89 |
90 | cache_widget( $args, $content );
98 | }
99 |
100 | public static function register() {
101 | register_widget( __CLASS__ );
102 | }
103 |
104 | /**
105 | * Get Dribbble shots.
106 | *
107 | * @param string $username Dribbble username.
108 | * @param string $access_token Client access token.
109 | * @param int $count Number of posts to return.
110 | *
111 | * @since 2.2.0.
112 | *
113 | * @return mixed
114 | */
115 | public function dribbble_shots( $access_token, $count ) {
116 | if ( '' === $access_token ) return;
117 |
118 | $transient_key = "st_dribble_${access_token}_${count}";
119 | $shots = get_transient( $transient_key );
120 |
121 | if ( empty( $shots ) || false === $shots ) {
122 | $remote_url = add_query_arg( array(
123 | 'access_token' => $access_token,
124 | 'per_page' => $count,
125 | ), 'https://api.dribbble.com/v2/user/shots' );
126 |
127 | $request = wp_remote_get( $remote_url, array(
128 | 'sslverify' => false,
129 | ) );
130 |
131 | if ( is_wp_error( $request ) ) {
132 | return false;
133 | } else {
134 | $body = wp_remote_retrieve_body( $request );
135 | $shots = json_decode( $body );
136 |
137 | if ( ! empty( $shots ) ) {
138 | set_transient( $transient_key, $shots, DAY_IN_SECONDS );
139 | }
140 | }
141 | }
142 |
143 | return $shots;
144 | }
145 | }
146 |
147 | add_action( 'widgets_init', array( 'Stag_Dribbble', 'register' ) );
148 |
--------------------------------------------------------------------------------
/includes/widgets/widget-flickr.php:
--------------------------------------------------------------------------------
1 | widget_id = 'stag-flickr';
11 | $this->widget_cssclass = 'stag-flickr';
12 | $this->widget_description = __( 'Display your latest Flickr photos.', 'stag' );
13 | $this->widget_name = __( 'Stag Flickr Photos', 'stag' );
14 | $this->settings = array(
15 | 'title' => array(
16 | 'type' => 'text',
17 | 'std' => 'Flickr Photos',
18 | 'label' => __( 'Title:', 'stag' ),
19 | ),
20 | 'flickr_id' => array(
21 | 'type' => 'text',
22 | 'std' => null,
23 | 'label' => __( 'Your Flickr User ID:', 'stag' ),
24 | ),
25 | 'flickr_id_desc' => array(
26 | 'type' => 'description',
27 | 'std' => sprintf( __( 'Head over to %s to find your Flickr user ID.', 'stag' ), 'idgettr' ),
28 | ),
29 | 'count' => array(
30 | 'type' => 'number',
31 | 'std' => 4,
32 | 'label' => __( 'Number of photos to show:', 'stag' ),
33 | 'step' => 1,
34 | 'min' => 1,
35 | 'max' => 10,
36 | ),
37 | );
38 |
39 | parent::__construct();
40 | }
41 |
42 | function widget( $args, $instance ) {
43 | if ( $this->get_cached_widget( $args ) )
44 | return;
45 |
46 | ob_start();
47 |
48 | extract( $args );
49 |
50 | $title = apply_filters( 'widget_title', $instance['title'] );
51 | $flickr_id = esc_attr( $instance['flickr_id'] );
52 | $count = absint( $instance['count'] );
53 |
54 | include_once ABSPATH . WPINC . '/feed.php';
55 |
56 | $rss = fetch_feed( 'https://api.flickr.com/services/feeds/photos_public.gne?ids=' . $flickr_id . '&lang=en-us&format=rss_200' );
57 |
58 | add_filter(
59 | 'wp_feed_cache_transient_lifetime', function() {
60 | return 1800;
61 | }
62 | );
63 |
64 | if ( ! is_wp_error( $rss ) ) {
65 | $items = $rss->get_items( 0, $rss->get_item_quantity( $count ) );
66 | }
67 |
68 | echo $before_widget;
69 | ?>
70 |
71 |
93 |
94 | cache_widget( $args, $content );
102 | }
103 |
104 | public static function register() {
105 | register_widget( __CLASS__ );
106 | }
107 | }
108 |
109 | add_action( 'widgets_init', array( 'Stag_Flickr', 'register' ) );
110 |
--------------------------------------------------------------------------------
/includes/widgets/widget-instagram.php:
--------------------------------------------------------------------------------
1 | widget_id = 'stag-instagram';
14 | $this->widget_cssclass = 'stag-instagram';
15 | $this->widget_description = __( 'Display your latest Instagrams photos.', 'stag' );
16 | $this->widget_name = __( '(Deprecated) Stag Instagram Photos', 'stag' );
17 |
18 | parent::__construct();
19 | }
20 |
21 | /**
22 | * Front-end display of widget.
23 | *
24 | * @see WP_Widget::widget()
25 | *
26 | * @param array $args Widget arguments.
27 | * @param array $instance Saved values from database.
28 | */
29 | public function widget( $args, $instance ) {
30 | if ( ! current_user_can( 'manage_options' ) ) {
31 | return;
32 | }
33 |
34 | printf(
35 | '
%1$s%3$s%4$s
%5$s',
36 | __( 'Instagram widget has been deprecated due to changes in their API with no alternatives available. We recommend using a third-party plugin for ', 'stagtools' ),
37 | esc_url( 'https://wordpress.org/plugins/search/instagram/' ),
38 | __( 'Instagram', 'stagtools' ),
39 | __( ' related features.', 'stagtools' ),
40 | __( ' This notice is only visible to admins.', 'stagtools' )
41 | );
42 | }
43 |
44 | /**
45 | * Deprecated message for form.
46 | *
47 | * @param array $instance Saved values from database.
48 | * @return void
49 | */
50 | public function form( $instance ) {
51 | printf(
52 | '
%1$s%3$s%4$s
',
53 | __( 'Instagram widget has been deprecated due to changes in their API with no alternatives available. We recommend using a third-party plugin for ', 'stagtools' ),
54 | esc_url( 'https://wordpress.org/plugins/search/instagram/' ),
55 | __( 'Instagram', 'stagtools' ),
56 | __( ' related features.', 'stagtools' )
57 | );
58 | }
59 |
60 | /**
61 | * Register class.
62 | *
63 | * @return void
64 | */
65 | public static function register() {
66 | register_widget( __CLASS__ );
67 | }
68 | }
69 | endif;
70 |
71 | add_action( 'widgets_init', array( 'Stag_Instagram', 'register' ) );
72 |
--------------------------------------------------------------------------------
/includes/widgets/widget-twitter.php:
--------------------------------------------------------------------------------
1 | widget_id = 'stag-twitter';
12 | $this->widget_cssclass = 'stag-twitter';
13 | $this->widget_description = __( 'Display a list of a user’s latest tweets.', 'stag' );
14 | $this->widget_name = __( 'Stag Twitter Feed', 'stag' );
15 | $this->settings = array(
16 | 'title' => array(
17 | 'type' => 'text',
18 | 'std' => 'Tweets',
19 | 'label' => __( 'Title:', 'stag' ),
20 | ),
21 | 'twitter_id' => array(
22 | 'type' => 'text',
23 | 'std' => null,
24 | 'label' => __( 'Twitter Username:', 'stag' ),
25 | ),
26 | 'count' => array(
27 | 'type' => 'number',
28 | 'std' => 5,
29 | 'label' => __( 'Number of Tweets to show:', 'stag' ),
30 | 'step' => 1,
31 | 'min' => 1,
32 | 'max' => 50,
33 | ),
34 | 'twitter_hide_replies' => array(
35 | 'type' => 'checkbox',
36 | 'std' => false,
37 | 'label' => __( 'Hide @ Replies', 'stag' ),
38 | ),
39 | 'twitter_hide_retweets' => array(
40 | 'type' => 'checkbox',
41 | 'std' => false,
42 | 'label' => __( 'Hide Retweets', 'stag' ),
43 | ),
44 | 'show_time_stamp' => array(
45 | 'type' => 'checkbox',
46 | 'std' => true,
47 | 'label' => __( 'Show Tweet Timestamp', 'stag' ),
48 | ),
49 | 'twitter_duration' => array(
50 | 'type' => 'select',
51 | 'std' => '60',
52 | 'label' => __( 'Load new Tweets every:', 'stag' ),
53 | 'options' => array(
54 | '5' => __( '5 Minutes', 'stag' ),
55 | '15' => __( '15 Minutes', 'stag' ),
56 | '30' => __( '30 Minutes', 'stag' ),
57 | '60' => __( '1 Hour', 'stag' ),
58 | '120' => __( '2 Hours', 'stag' ),
59 | '240' => __( '4 Hours', 'stag' ),
60 | '720' => __( '12 Hours', 'stag' ),
61 | '1440' => __( '24 Hours', 'stag' ),
62 | ),
63 | ),
64 | 'follow_link_show' => array(
65 | 'type' => 'checkbox',
66 | 'std' => false,
67 | 'label' => __( 'Include link to twitter page?', 'stag' ),
68 | ),
69 | 'follow_link_text' => array(
70 | 'type' => 'text',
71 | 'std' => 'Follow on twitter',
72 | 'label' => __( 'Link Text:', 'stag' ),
73 | ),
74 | );
75 |
76 | parent::__construct();
77 | }
78 |
79 | /**
80 | * Front-end display of widget.
81 | *
82 | * @see WP_Widget::widget()
83 | *
84 | * @param array $args Widget arguments.
85 | * @param array $instance Saved values from database.
86 | */
87 | function widget( $args, $instance ) {
88 | if ( $this->get_cached_widget( $args ) )
89 | return;
90 |
91 | ob_start();
92 |
93 | echo $args['before_widget'];
94 |
95 | $title = apply_filters( 'widget_title', $instance['title'] );
96 |
97 | if ( $title ) echo $args['before_title'] . $title . $args['after_title'];
98 |
99 | self::tweets_list( $instance );
100 |
101 | if ( $instance['follow_link_show'] && $instance['follow_link_text'] ) {
102 | echo '';
103 | }
104 |
105 | echo $args['after_widget'];
106 |
107 | $content = ob_get_clean();
108 |
109 | echo $content;
110 |
111 | $this->cache_widget( $args, $content );
112 | }
113 |
114 | /**
115 | * Gets and displays an html list of formatted tweets
116 | *
117 | * @param array $settings Settings for grabbing tweets
118 | */
119 | public static function tweets_list( $settings ) {
120 | echo self::get_tweets_list( $settings );
121 | }
122 |
123 | /**
124 | * Gets an html list of formatted tweets
125 | *
126 | * @param array $settings Settings for grabbing tweets
127 | * @return string Html list of formatted tweets
128 | */
129 | public static function get_tweets_list( $settings ) {
130 | $list_format = apply_filters( 'stag_twitter_tweet_list_format', "\n", $settings );
131 | $tweet_format = apply_filters( 'stag_twitter_tweet_format', "\t%s\n", $settings );
132 |
133 | $list = '';
134 | $tweets = self::get_tweets( $settings );
135 |
136 | foreach ( (array) $tweets as $tweet ) {
137 | $list .= sprintf( $tweet_format, $tweet );
138 | }
139 |
140 | return sprintf( $list_format, $list );
141 | }
142 |
143 | /**
144 | * Gets array of formatted tweets (cached in a transient).
145 | *
146 | * @param array $settings Settings for grabbing tweets.
147 | * @return array Array of formatted tweets.
148 | */
149 | public static function get_tweets( $settings ) {
150 | $twitter_id = $settings['twitter_id'];
151 |
152 | if ( ! trim( $twitter_id ) ) {
153 | return self::do_error( __( 'Please provide a Twitter Username.', 'codestag' ) );
154 | }
155 |
156 | $twitter_num = (int) $settings['count'];
157 | $twitter_duration = absint( $settings['twitter_duration'] ) < 1 ? 60 : absint( $settings['twitter_duration'] );
158 |
159 | // create our transient ID
160 | $trans_id = $twitter_id .'-'. $twitter_num .'-'. $twitter_duration;
161 |
162 | // Should we reset our data?
163 | $reset_trans = isset( $_GET['delete-trans'] ) && $_GET['delete-trans'] == true;
164 |
165 | // If we're resetting the transient, or our transient is expired
166 | if ( $reset_trans || ! ( $tweets = get_transient( $trans_id ) ) ) {
167 | $hide_replies = $settings['twitter_hide_replies'];
168 | $hide_retweets = $settings['twitter_hide_retweets'];
169 | $show_time = $settings['show_time_stamp'];
170 | $number = ( $hide_replies || $hide_retweets ) ? $twitter_num + 80 : $twitter_num;
171 | $tweets = array();
172 |
173 | // Make sure we have our Twitter class
174 | if ( ! class_exists( 'TwitterWP' ) ) {
175 | require_once( 'lib/TwitterWP/lib/TwitterWP.php' );
176 | }
177 |
178 | $stag_options = get_option( 'stag_options' );
179 |
180 | if ( empty( $stag_options['consumer_key'] ) || empty( $stag_options['consumer_secret'] ) || empty( $stag_options['access_key'] ) || empty( $stag_options['access_secret'] ) ) {
181 | return self::do_error( sprintf( __( 'Please fill in the Twitter oAuth settings', 'stag' ), admin_url( 'options-general.php?page=stagtools' ) ) );
182 | }
183 |
184 | // Initiate our Twitter app
185 | $tw = TwitterWP::start( array(
186 | $stag_options['consumer_key'],
187 | $stag_options['consumer_secret'],
188 | $stag_options['access_key'],
189 | $stag_options['access_secret'],
190 | ) );
191 |
192 | if ( is_wp_error( $tw ) ) {
193 | return self::do_error( is_user_logged_in() ? $tw->show_wp_error( $tw, false ) : '' );
194 | }
195 |
196 | // Retrieve tweets from the api
197 | $twitter = $tw->get_tweets( $twitter_id, $number );
198 |
199 | if ( ! $twitter ) {
200 | return array( __( 'The Twitter API is taking too long to respond. Please try again later.', 'stag' ) );
201 | } elseif ( is_wp_error( $twitter ) ) {
202 | return self::do_error( is_user_logged_in() ? $tw->show_wp_error( $twitter, false ) : '' );
203 | }
204 |
205 | $count = 1;
206 |
207 | // Build the tweets array
208 | foreach ( (array) $twitter as $tweet ) {
209 |
210 | if ( $hide_retweets && property_exists( $tweet, 'retweeted_status' ) )
211 | continue;
212 |
213 | // Don't include @ replies (if applicable)
214 | if ( $hide_replies && $tweet->in_reply_to_user_id )
215 | continue;
216 |
217 | // Format tweet (hashtags, links, etc)
218 | $content = self::twitter_linkify( $tweet->full_text );
219 |
220 | if ( $show_time ) {
221 | // Calculate time difference
222 | $timeago = sprintf( __( '%s ago', 'stag' ), human_time_diff( strtotime( $tweet->created_at ) ) );
223 | $timeago_link = sprintf( '%s', esc_url( sprintf( 'https://twitter.com/%s/status/%s', $twitter_id, $tweet->id_str ) ), esc_html( $timeago ) );
224 | // Include timestamp
225 | $content .= ''."\n";
226 | }
227 |
228 | // Add tweet to array
229 | $tweets[] = apply_filters( 'stag_twitter_tweet_content', $content, $tweet, $settings );
230 |
231 | // Stop the loop if we've got enough tweets
232 | if ( $hide_replies && $count >= $twitter_num ) {
233 | break;
234 | }
235 |
236 | $count++;
237 | }
238 |
239 | // Just in case
240 | $tweets = array_slice( (array) $tweets, 0, $twitter_num );
241 |
242 | $time = ( $twitter_duration * 60 );
243 |
244 | // Save tweets to a transient
245 | set_transient( $trans_id, $tweets, $time );
246 | }
247 |
248 | return $tweets;
249 | }
250 |
251 | /**
252 | * Parses tweets and generates HTML anchor tags around URLs, usernames,
253 | * username/list pairs and hashtags.
254 | *
255 | * @link https://github.com/mzsanford/twitter-text-php
256 | *
257 | * @param string $content Tweet content
258 | * @return string Modified tweet content
259 | */
260 | public static function twitter_linkify( $content ) {
261 | if ( ! class_exists( 'Twitter_Regex' ) ) {
262 | require_once( 'lib/TwitterText/lib/Twitter/Autolink.php' );
263 | }
264 |
265 | return Twitter_Autolink::create( $content, true )
266 | ->setNoFollow( false )->setExternal( true )->setTarget( '_blank' )
267 | ->setUsernameClass( 'tweet-url username' )
268 | ->setListClass( 'tweet-url list-slug' )
269 | ->setHashtagClass( 'tweet-url hashtag' )
270 | ->setURLClass( 'tweet-url tweek-link' )
271 | ->addLinks();
272 | }
273 |
274 | public static function register() {
275 | register_widget( __CLASS__ );
276 | }
277 |
278 | /**
279 | * Return error message in an array.
280 | *
281 | * @param string $msg Error message (optional).
282 | * @return array Error message in an array.
283 | */
284 | public static function do_error( $msg = '' ) {
285 | $msg = $msg ? $msg : self::$error;
286 | return array( apply_filters( 'stag_twitter_error', $msg ) );
287 | }
288 | }
289 |
290 | add_action( 'widgets_init', array( 'Stag_Twitter', 'register' ) );
291 |
--------------------------------------------------------------------------------
/languages/stagtools.mo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codestag/stagtools/2635655608eb46b29f44911db766f0a344ad24b1/languages/stagtools.mo
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "stagtools",
3 | "version": "2.3.8",
4 | "description": "A powerful plugin to extend functionality to your WordPress themes offering shortcodes, font icons and useful widgets.",
5 | "homepage": "https://github.com/codestag/stagtools",
6 | "bugs": "https://github.com/codestag/stagtools/issues",
7 | "license": "GPLv2",
8 | "repository": {
9 | "type": "git",
10 | "url": "git@github.com:mauryaratan/stagtools.git"
11 | },
12 | "dependencies": {
13 | "grunt": "~1.5.3",
14 | "load-grunt-tasks": "~3.5.2",
15 | "grunt-contrib-jshint": "~1.1.0",
16 | "grunt-curl": "~2.4.1",
17 | "grunt-yaml": "~0.4.1",
18 | "grunt-json": "~0.2.0",
19 | "grunt-json-massager": "~0.1.0",
20 | "grunt-prompt": "~1.3.0",
21 | "lodash": "~4.17.21",
22 | "grunt-contrib-clean": "~1.1.0",
23 | "grunt-text-replace": "~0.4.0",
24 | "grunt-wp-i18n": "~1.0.1",
25 | "semver": "~5.4.1"
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/readme.txt:
--------------------------------------------------------------------------------
1 | === StagTools ===
2 |
3 | Contributors: mauryaratan, codestag
4 | Donate link: https://codest.ag/st-donate
5 | Tags: widget, icons, retina, shortcodes, themeforest, font icons, fontawesome, font awesome 5, sidebar, social, social media, maps, google maps, flickr, dribbble, custom post type, codestag, mauryaratan, twitter
6 | Requires at least: 5.0
7 | Requires PHP: 7.3
8 | Tested up to: 6.2.2
9 | Stable tag: 2.3.8
10 | License: GPLv2 or later
11 | License URI: https://www.gnu.org/licenses/gpl-2.0.html
12 |
13 | StagTools is a powerful plugin to extend functionality to your WordPress themes offering shortcodes, FontAwesome icons and useful widgets.
14 |
15 | == Description ==
16 |
17 | StagTools powers your WordPress website with some regularly needed shortcodes including buttons, columns, alerts, font icons etc. It also includes several widgets and editor styles.
18 |
19 | **Shortcodes:**
20 |
21 | * Buttons ( optionally, with font icons )
22 | * Columns
23 | * Dropcaps
24 | * Tabs
25 | * Toggle
26 | * Font Icons by [Font Awesome](http://fortawesome.github.io/Font-Awesome/)
27 | * Google Maps with 5 predefined styles, and map types
28 | * Custom Sidebars Area ( requires [Stag Custom Sidebars](https://wordpress.org/plugins/stag-custom-sidebars/) plugin )
29 | * Image with CSS3 filters
30 | * Videos ( supports [oEmbeds](https://codex.wordpress.org/Embeds#Okay.2C_So_What_Sites_Can_I_Embed_From.3F) )
31 |
32 | **Widgets:** Twitter, Dribbble, Flickr
33 |
34 | **Custom Post Types:** Portfolio, Slides, Team, Testimonials
35 |
36 | = Get Involved =
37 | If you are a developer, you can contribute to the source code on [StagTools Github Repository](https://github.com/mauryaratan/stagtools)
38 |
39 | *Checkout our finely tuned WordPress themes over at [Codestag](https://codestag.com?ref=WordPress).*
40 |
41 | == Frequently Asked Questions ==
42 |
43 | = What is this plugin and why do I need it? =
44 |
45 | The StagTools provides extra functionality to any WordPress theme. It includes shortcode builder, font icons and several widgets along with custom post types (only for Codestag Themes). This plugin is not requirement to use Codestag themes however it extends the theme functionality.
46 |
47 | = Can I insert shortcodes manually instead of using shortcode generator? =
48 |
49 | Yes; although we have a shortcode builder you can also see a list of [all available shortcodes](https://gist.github.com/mauryaratan/6071262) and use it manually in any supported area.
50 |
51 | = Can I use this plugin with other themes? =
52 |
53 | The StagTools was developed to work with any WordPress theme as it includes default styling. However, we provide our extra bit of styling to all of our [themes](https://codestag.com) at Codestag.
54 |
55 | = Why shortcodes are prefixed with stag_ ? =
56 | Simply to avoid any conflict with other shortcodes on your site enabled via any third-party plugin or theme.
57 |
58 | = I love this plugin! Can I contribute? =
59 | Yes you can! Join me on [Github Repository](https://github.com/mauryaratan/stagtools/) :)
60 |
61 | == Screenshots ==
62 |
63 | 1. StagTools widgets will appear in you list of available widgets.
64 | 2. Shortcode builder is located on your WordPress editor at very last.
65 | 3. All widgets added by StagTools are highlighted.
66 | 4. Settings panel for adding twitter oAuth keys.
67 | 5. Editor styles; includes Intro Text/Run In and alerts.
68 |
69 | == Installation ==
70 |
71 | = Minimum Requirements =
72 |
73 | * WordPress 4.0 or greater
74 | * PHP version 5.2.4 or greater
75 | * MySQL version 5.0 or greater
76 |
77 | = Automatic Installation =
78 |
79 | 1. Log in and navigate to Plugins → Add New.
80 | 2. Type “StagTools” into the Search input and click the “Search Widgets” button.
81 | 3. Locate the “StagTools” in the list of search results and click “Install Now”.
82 | 4. Click the “Activate Plugin” link at the bottom of the install screen.
83 | 5. Navigate to Settings → StagTools to modify the plugin’s settings. The widgets will be available in Appearance → Widgets.
84 |
85 | = Manual Installation =
86 |
87 | 1. Download the “StagTools” plugin from WordPress.org.
88 | 2. Unzip the package and move to your plugins directory.
89 | 3. Log into WordPress and navigate to the “Plugins” screen.
90 | 4. Locate “StagTools” in the list and click the “Activate” link.
91 | 5. Navigate to Settings → StagTools to learn about the plugin's features. The widgets will be available in Appearance → Widgets.
92 |
93 | == Changelog ==
94 |
95 | = 2.3.8 - August 04, 2023 =
96 | * Fix: Escape Stag Shortcodes Popup in Editor
97 | * Fix: Undefined key at Shortcodes Popups
98 | * Improvements: Other minor code changes
99 |
100 | = 2.3.7 - March 23, 2023 =
101 | * Fix: Escaping issues in Shortcodes
102 | * Fix: Replace deprecated function calls
103 | * Improvements: Support for WordPress 6.x.x
104 | * Improvements: Many code improvements
105 |
106 | = 2.3.6 - April 06, 2021 =
107 | * New: Update FontAwesome library to v5.15.3
108 | * Fix: Multiple shortcode output
109 | * Improvements: Support for WordPress 5.7
110 |
111 | = 2.3.5 - October 10, 2020 =
112 | * Improve deprecated message formatting for Instagram widget and fix trailing comma error
113 |
114 | = 2.3.4 - October 09, 2020 =
115 | * Fix Stag shortcodes inserter error at Classic editor
116 |
117 | = 2.3.3 - Aug 01, 2020 =
118 | * Fix tweets not showing up at twitter widget
119 | * Deprecate Instagram widget due to changes in Instagram's API
120 |
121 | = 2.3.2 - June 22, 2020 =
122 | * Compatible with WordPress 5.4.2
123 | * Replace deprecated contextual help screen issue
124 | * Fix undefined error under widgets
125 |
126 | = 2.3.1 - January 11, 2019 =
127 | * Fix broken Twitter API library
128 |
129 | = 2.3 - January 5, 2019 =
130 | * Compatibility with WordPress 5.0+
131 | * Update FontAwesome to v5.6.3
132 | * Added REST API support for all custom post types
133 | * Remove deprecate function call to create_function
134 | * Added themes list on settings page
135 | * Fix StagTools popup not opening inside Gutenberg
136 | * Fix JS translation for Classic editor custom buttons
137 |
138 | = 2.2.6 - March 16, 2018 =
139 | * Fixed an issue with Instagram widget
140 | * Updated FontAwesome library to v5.0.8
141 |
142 | = 2.2.5 - Feb 16, 2018 =
143 | * Updated FontAwesome library to v5.0.6
144 | * Wrap @ in anchor tags in Twitter widget
145 | * Update Dribbble widget to use v2 API
146 | * Fix Font awesome icons in icon buttons
147 | * Replace uses of accent color in stylesheet with css variables with fallback, for better theming
148 |
149 | = 2.2.4 - Dec 21, 2017 =
150 | * Fix an issue with Instagram widget returning images with 403 response due to recent change to Instagram
151 |
152 | = 2.2.3 - Dec 21, 2017 =
153 | * Updated FontAwesome library to v5.0.2
154 | * Added FontAwesome v4 shim for better fallback
155 |
156 | = 2.2.2 - Dec 19, 2017 =
157 | * Fix `[stag_social]` shortcode showing invalid icons since previous update
158 |
159 | = 2.2.1 - Dec 18, 2017 =
160 | * Compatible with FontAwesome v5.0.1
161 |
162 | = 2.2.0 - Nov 19, 2017 =
163 | * Compatible upto WordPress 4.9+
164 | * Fixed an issue with Instagram widget not working due to public feed not being available any longer.
165 | * Fixed an issue with Dribbble widget not working due to API authentication changes
166 | * Added support for Widgets selective refresh
167 | * Use new Codestag icon for editor button
168 | * Fixed issue with Google Map error showing out of place
169 | * Make use of CSS variables for StagTools' accent color, to easily customize accent colors in theme
170 |
171 | = 2.1.3 - Nov 07, 2016 =
172 | * Updated FontAwesome library to v4.7.0
173 |
174 | = 2.1.2 - July 21, 2016 =
175 | * Added a new settings for Google Maps API key under Settings > StagTools
176 | * Minor tweak on settings page
177 | * Updated FontAwesome library to v4.6.3
178 |
179 | = 2.1.1 - May 02, 2016 =
180 | * Updated - FontAwesome library v4.6.1
181 |
182 | = 2.1.0 - February 26, 2016 =
183 | * New - Google map shortcode now supports map type to choose between Roadmap, Satellite, Hybrid, and Terrain
184 | * Tweak - Replaced dropdown fields in Shortcode generator with buttonsets
185 | * Fix - Instagram widget to work with new API
186 | * Fix - Dribbble widget feed URL causing widget to fail
187 | * Fix - Fix an issue with Skype field showing incorrect value due to URL escaping
188 | * Updated - FontAwesome library v4.5.0
189 |
190 | = 2.0.1 - August 21, 2014 =
191 | * Fix - PHP constructor method error, introduced in WordPress 4.3
192 | * Fix - Invalid flickr ID error when adding widget, props @ragzor
193 | * Fix - StagTools modal excessive padding in some cases
194 | * Fix - Updated language files
195 | * Updated - FontAwesome library v4.4.0
196 |
197 | = 2.0 - July 15, 2014 =
198 | * New - Restyled and simplified font icon selector
199 | * New - Rewritten Twitter widget
200 | * New - Rewritten Instagram widget
201 | * Tweak - Divider shortcode is now merged with default "Horizontal Line" editor button
202 | * Tweak - Intro and Alert shortcodes are now editor styles, as "Formats" in editor
203 | * Tweak - Better widget cache handling
204 | * Tweak - Enqueue styles/scripts depending on widget visibility
205 | * Fixed - Small CSS clearing issue with stag_two_third_last shortcode, props @egifford
206 | * Updated - FontAwesome library v4.3.0
207 |
208 | = 1.2.6 - June 23, 2014 =
209 | * Fix - Issue with buttons shortcode generator when no link provided
210 |
211 | = 1.2.5 - June 18, 2014 =
212 | * Fix - Twitter widget option storage, works flawlessly
213 | * Fix - Instagram widget image size styles
214 | * Fix - Properly sanitize Instagram username
215 | * Improved - Instagram widget now grabs video thumbnails too
216 |
217 | = 1.2.4 - May 22, 2014 =
218 | * New - ``[stag_column]`` shortcode for wrapping the columns
219 | * New - Added ``stag-section`` class to all block level shortcodes
220 | * New - Custom post type "Project" added, better version of portfolios
221 | * Fix - Minor issue with popup modal not resizing properly
222 | * Tweak - Enqeueu FontAwesome stylesheet before StagTools' shortcode styles
223 | * Update - FontAwesome icons updated to v4.1.0, includes 71 new icons
224 | * Improved - FontAwesome icons now use default FontAwesome classes instead of custom
225 | * Improved - Removed redundant code
226 |
227 | = 1.2.3 - April 16, 2014 =
228 | * New - Added Compatibility with WordPress 3.9
229 | * New - White color option for button
230 | * Fix - Invalid variables under instagram widget
231 | * Fix - Icon shortcode, vertical alignment
232 | * Tweak - Shortcode generator styles for WordPress 3.9
233 | * Improved - Intro text shortcode
234 | * Improved - Shortcode styles
235 |
236 | = 1.2.2 - March 04, 2014 =
237 | * Improved: Instagram Widget, rewritten from base
238 |
239 | = 1.2.1 - January 25, 2014 =
240 | * Tweak - Performance tweaks for Google Maps
241 | * Tweak - Twitter widget, fixed an issue with page break when tweets are not retrieved
242 | * Tweak - Added custom post type menu positions and icons
243 | * Tweak - Disable scroll wheel zoom on Google Map
244 | * Tweak - Add default options for portfolio and skills slugs
245 | * Improved - Added inline docs for Portfolio post type
246 | * Improved - Make skill terms filter portfolio items based on skills when clicked
247 | * Fix - Added missing zoom parameter in Google Maps shortcode
248 | * Fix - Custom post type's visibilities
249 | * Fix - Add *google-map* class on Google maps shortcode
250 | * Fix - Fix Team post type title
251 |
252 | = 1.2 - January 09, 2014 =
253 | * New - Settings Page UI
254 | * New - Instagram Widget
255 | * New - Social Icons Shortcode
256 | * Fix - Flush rewrite rules on saving settings, when required
257 | * Fix - Make StagTools shortcode window insert content in active editor instead of main editor
258 | * Tweak - Use ``add_theme_support( 'post-type', array( 'portfolio' ) )`` instead of separate theme support check. Where ``portfolio`` is the custom post type
259 | * Tweak - Google Maps Shortcode. Now accepts ``lat``, ``long``, ``width``, ``height``, ``zoom``, ``style`` as arguments
260 | * Tweak - Added optional follow button in twitter widget
261 | * Tweak - Inline documentation
262 | * Tweak - Dribbble shot markup
263 | * Tweak - Backwards compatbility for Portfolio settings
264 | * Tweak - Replace help under settings tab with Contextual help
265 | * And several bug fixes, documentation enhancement and improvements
266 |
267 | = 1.1.1 - November 20, 2013 =
268 | * Fix - FontAwesome icon missing class names after upgrading to latest version
269 |
270 | = 1.1 - November 15, 2013 =
271 | * New - Compatibility with FontAwesome 4
272 | * New - Insert font icons in buttons
273 | * New - Settings for changing slugs for custom post type ‘portfolio’ and taxonomy ‘skill’
274 | * New - Contextual help screen on settings page
275 | * Fix - Properly resize shortcode modal window width
276 | * Fix - Image/Video Media frame title
277 | * Fix - Check if there are no sidebar created via Stag Custom Sidebars
278 | * Tweak - Compatibility with the plugin [Stag Custom Sidebars](https://wordpress.org/plugins/stag-custom-sidebars/)
279 | * Tweak - Refractored code
280 | * Tweak - Inline plugin documentation
281 |
282 | = 1.0.8 - October 02, 2013 =
283 | * Fix - Twitter widget incorrect links
284 | * New - Revisions support for portfolio
285 |
286 | = 1.0.7 - September 14, 2013 =
287 | * Fix - Disable Portfolio Archives
288 |
289 | = 1.0.6 - September 11, 2013 =
290 | * New - Modify Portfolio post type label, slug and rewrites
291 | * New - Attach ``stagtools`` body class to frontend
292 | * Fix - Frontend shortcode stylesheet on the top of theme stylesheet
293 | * Fix - Minor issues with intro and button shortcode styling
294 |
295 | = 1.0.5 - September 08, 2013 =
296 | * Fix - Portfolio taxonomy skills archives
297 |
298 | = 1.0.4 - September 07, 2013 =
299 | * New - Google Map Shortcode
300 | * Fix - Flickr Widget disabled wrapper warnings
301 |
302 | = 1.0.3 - September 01, 2013 =
303 | * Fix - Admin font icon rendering issue
304 |
305 | = 1.0.2 - September 01, 2013 =
306 | * Fix - FontAwesome conflict with other classes using icon-
307 |
308 | = 1.0.1 - Auguest 16, 2013 =
309 | * Fix - Theme support check
310 |
311 | = 1.0 - July 27, 2013 =
312 | * Initial Release
313 |
314 | == Upgrade Notice ==
315 |
316 | = 2.3.1 =
317 | * Fixes broken twitter library in last update
318 |
319 | = 2.3 =
320 | * Adds compatibility with WordPress 5.0+. Includes various fixes.
321 |
322 | = 2.2.3 =
323 | Updated to FontAwesome v5.0.2
324 |
325 | = 2.2.1 =
326 | Adds compatibility with FontAwesome v5.0.1
327 |
328 | = 2.1.2 =
329 | If you're using Google Maps shortcode anywhere on your site. Please make sure fill-in the API key for Google Maps under Settings > StagTools > API key.
330 |
331 | = 1.2.6 =
332 | Fixes an issue with buttons shortcodes not showing icons in some cases.
333 |
334 | = 1.2.5 =
335 | Includes fixes and improvements for Twitter and Instagram widget.
336 |
337 | = 1.2.3 =
338 | Adds compatbility with WordPress 3.9. 1 beta tester was killed during this update.
339 |
340 | = 1.2.2 =
341 | If you're using instagram widget, it's required to update widget settings.
342 |
343 | = 1.2 =
344 | This update requires update to all Google Map shortcodes.
345 |
--------------------------------------------------------------------------------
/shortcodes/shortcode-class.php:
--------------------------------------------------------------------------------
1 | conf = dirname( __FILE__ ) . '/config.php';
20 | $this->popup = $popup;
21 |
22 | $this->format_shortcode();
23 | } else {
24 | $this->append_error( __( 'Config file does not exist', 'stag' ) );
25 | }
26 | }
27 |
28 | public function append_output( $output ) {
29 | $this->output = $this->output . "\n" . $output;
30 | }
31 |
32 | public function reset_output( $output ) {
33 | $this->output = '';
34 | }
35 |
36 | public function append_error( $error ) {
37 | $this->errors = $this->errors . "\n" . $error;
38 | }
39 |
40 | public function format_shortcode() {
41 | global $stagtools;
42 | require_once $this->conf;
43 |
44 | if ( isset( $stag_shortcodes[ $this->popup ]['child_shortcode'] ) ) {
45 | $this->has_child = true;
46 | }
47 |
48 | if ( isset( $stag_shortcodes ) && is_array( $stag_shortcodes ) ) {
49 | $this->params = $stag_shortcodes[ $this->popup ]['params'];
50 | $this->shortcode = $stag_shortcodes[ $this->popup ]['shortcode'];
51 | $this->popup_title = $stag_shortcodes[ $this->popup ]['popup_title'];
52 |
53 | $this->append_output( "\n" . '' . $this->shortcode . '
' );
54 | $this->append_output( "\n" . '' );
55 |
56 | if ( isset( $stag_shortcodes[ $this->popup ]['no_preview'] ) && $stag_shortcodes[ $this->popup ]['no_preview'] ) {
57 | $this->no_preview = true;
58 | }
59 |
60 | foreach ( $this->params as $pkey => $param ) {
61 |
62 | // Prefix the name and id with stag_.
63 | $pkey = 'stag_' . $pkey;
64 | $hidden_class = '';
65 | if ( isset( $param['hidden'] ) && $param['hidden'] ) {
66 | $hidden_class = 'hidden';
67 | }
68 |
69 | $row_start = '' . "\n";
70 | $row_start .= '' . "\n";
71 | $row_start .= '' . $param['label'] . ' | ' . "\n";
72 | $row_start .= '' . "\n";
73 |
74 | $row_end = '' . $param['desc'] . '' . "\n";
75 | $row_end .= ' | ' . "\n";
76 | $row_end .= '
' . "\n";
77 | $row_end .= '' . "\n";
78 |
79 | switch ( $param['type'] ) {
80 |
81 | case 'text':
82 | $output = $row_start;
83 | $output .= '' . "\n";
84 | $output .= $row_end;
85 | $this->append_output( $output );
86 | break;
87 |
88 | case 'textarea':
89 | $output = $row_start;
90 | $output .= '' . "\n";
91 | $output .= $row_end;
92 | $this->append_output( $output );
93 | break;
94 |
95 | case 'select':
96 | $output = $row_start;
97 | $output .= '' . "\n";
110 | $output .= $row_end;
111 | $this->append_output( $output );
112 | break;
113 |
114 | case 'buttonset':
115 | $output = $row_start;
116 |
117 | ksort( $param['options'] );
118 |
119 | $output .= "";
120 |
121 | if ( ! isset( $param['std'] ) ) {
122 | $param['std'] = '';
123 | }
124 |
125 | foreach ( $param['options'] as $value => $option ) {
126 | $output .= "';
127 | $output .= "";
128 | }
129 |
130 | $output .= '
';
131 | $output .= '';
132 | $output .= $row_end;
133 | $this->append_output( $output );
134 | break;
135 |
136 | case 'checkbox':
137 | $output = $row_start;
138 | $output .= '' . "\n";
141 | $output .= $row_end;
142 | $this->append_output( $output );
143 | break;
144 |
145 | case 'image';
146 | $output = $row_start;
147 | $output .= '' . __( 'Choose Image', 'stag' ) . '';
148 | $output .= '';
149 | $output .= $row_end;
150 | $this->append_output( $output );
151 | break;
152 |
153 | case 'video';
154 | $output = $row_start;
155 | $output .= '' . __( 'Choose Video', 'stag' ) . '';
156 | $output .= '';
157 | $output .= $row_end;
158 | $this->append_output( $output );
159 | break;
160 |
161 | case 'icons':
162 | $output = $row_start;
163 | $output .= '';
164 |
165 | $output .= '
';
166 | $output .= '';
167 | $output .= $row_end;
168 | $this->append_output( $output );
169 | break;
170 |
171 | case 'widget_area':
172 | if ( $stagtools->is_scs_active() ) {
173 | $output = $row_start;
174 |
175 | $output .= 'Hello Custom Widget Area
';
176 |
177 | $output .= $row_end;
178 | $this->append_output( $output );
179 | } else {
180 | return false;
181 | }
182 | break;
183 |
184 | }
185 | }
186 |
187 | if ( isset( $stag_shortcodes[ $this->popup ]['child_shortcode'] ) ) {
188 | $this->cparams = $stag_shortcodes[ $this->popup ]['child_shortcode']['params'];
189 | $this->cshortcode = $stag_shortcodes[ $this->popup ]['child_shortcode']['shortcode'];
190 |
191 | $prow_start = '' . "\n";
192 | $prow_start .= '' . "\n";
193 | $prow_start .= '' . $stag_shortcodes[ $this->popup ]['child_shortcode']['clone_button'] . '' . "\n";
194 | $prow_start .= '' . "\n";
195 |
196 | // for js use
197 | $prow_start .= ' ' . $this->cshortcode . ' ' . "\n";
198 |
199 | // start the default row
200 | $prow_start .= ' ' . "\n";
201 | $prow_start .= ' ' . "\n";
260 | $prow_end .= ' Remove' . "\n";
261 | $prow_end .= ' ' . "\n";
262 | $prow_end .= ' ' . "\n";
263 | $prow_end .= ' | ' . "\n";
264 | $prow_end .= '
' . "\n";
265 | $prow_end .= '' . "\n";
266 |
267 | $this->append_output( $prow_end );
268 | }
269 | }
270 | }
271 | }
272 |
--------------------------------------------------------------------------------
/shortcodes/stag-shortcodes.php:
--------------------------------------------------------------------------------
1 | plugin_url() . '/assets/css/menu.css' );
20 |
21 | wp_enqueue_style( 'font-awesome', $stagtools->plugin_url() . '/assets/css/fontawesome-all' . SCRIPT_SUFFIX . '.css', '', '5.15.3' );
22 |
23 | wp_register_script( 'font-awesome-icons-list', $stagtools->plugin_url() . '/assets/js/icons.js', array(), '5.15.3', true );
24 | wp_enqueue_script( 'font-awesome-icons-list' );
25 |
26 | wp_enqueue_script( 'jquery-ui-button' );
27 |
28 | wp_enqueue_script( 'jquery-ui-sortable' );
29 | wp_enqueue_script( 'stag-shortcode-plugins', $stagtools->plugin_url() . '/assets/js/shortcodes_plugins' . SCRIPT_SUFFIX . '.js', array( 'font-awesome-icons-list', 'wp-i18n', 'jquery' ), filemtime( $stagtools->plugin_path() . '/assets/js/shortcodes_plugins' . SCRIPT_SUFFIX . '.js' ), true );
30 |
31 | if ( function_exists( 'wp_set_script_translations' ) ) {
32 | wp_set_script_translations( 'stag-shortcode-plugins', 'stag' );
33 | }
34 |
35 | wp_localize_script(
36 | 'jquery',
37 | 'StagShortcodes',
38 | array(
39 | 'plugin_folder' => WP_PLUGIN_URL . '/shortcodes',
40 | /** Check if Stag Custom Sidebars plugin is active {@link https://wordpress.org/plugins/stag-custom-sidebars/} */
41 | 'is_scs_active' => $stagtools->is_scs_active(),
42 | 'media_frame_video_title' => __( 'Upload or Choose Your Custom Video File', 'stag' ),
43 | 'media_frame_image_title' => __( 'Upload or Choose Your Custom Image File', 'stag' ),
44 | )
45 | );
46 | }
47 |
48 | if ( 'settings_page_stagtools' == $hook ) {
49 | $custom_css = '.settings_page_stagtools .form-table th>label>strong{font-size:1.2em;font-weight:600;}';
50 |
51 | wp_add_inline_style( 'forms', $custom_css );
52 | }
53 | }
54 |
55 | public function shortcodes_init() {
56 | if ( ( current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' ) ) && get_user_option( 'rich_editing' ) ) {
57 | add_filter( 'mce_external_plugins', array( &$this, 'add_rich_plugins' ) );
58 | add_filter( 'mce_buttons', array( &$this, 'register_rich_buttons' ) );
59 | }
60 | }
61 |
62 | public function add_tinymce_lang( $arr ) {
63 | global $stagtools;
64 | $arr['stagShortcodes'] = $stagtools->plugin_path() . '/assets/js/plugin-lang.php';
65 | return $arr;
66 | }
67 |
68 | public function add_rich_plugins( $plugin_array ) {
69 | global $stagtools, $tinymce_version;
70 |
71 | if ( version_compare( $tinymce_version, '400', '<' ) ) {
72 | $plugin_array['stagShortcodes'] = $stagtools->plugin_url() . '/assets/js/editor_plugin.js';
73 | } else {
74 | $plugin_array['stagShortcodes'] = $stagtools->plugin_url() . '/assets/js/plugin.js';
75 | }
76 |
77 | return $plugin_array;
78 | }
79 |
80 | public function register_rich_buttons( $buttons ) {
81 | array_push( $buttons, 'stagShortcodes' );
82 | return $buttons;
83 | }
84 |
85 | public function shortcode_popup_callback() {
86 | require_once 'shortcode-class.php';
87 | $popup_key = esc_html( wp_unslash( $_REQUEST['popup'] ) );
88 |
89 | $available_tools = array(
90 | 'button',
91 | 'toggle',
92 | 'columns',
93 | 'tabs',
94 | 'dropcap',
95 | 'image',
96 | 'video',
97 | 'icon',
98 | 'map',
99 | 'widget_area',
100 | );
101 |
102 | if ( ! is_string( $popup_key ) || ! in_array( $popup_key, $available_tools ) ) {
103 | exit( 'Invalid request!' );
104 | }
105 |
106 | $shortcode = new Stag_Shortcodes( $popup_key );
107 |
108 | ?>
109 |
110 |
111 |
112 |
113 |
114 |
154 |
155 |
156 |
157 |