PluginProbe
Depicter — Popup & Slider Builder / 1.2.0
Depicter — Popup & Slider Builder v1.2.0
4.8.1 trunk 1.0.0 1.1.0 1.1.2 1.1.4 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.3.0 1.3.1 1.3.2 1.3.3 1.3.5 1.3.8 1.5.0 1.5.1 1.5.2 1.5.5 1.6.0 1.6.1 1.6.2 1.7.0 All 76 releases
depicter / app / src / WordPress / ShortcodesServiceProvider.php

ShortcodesServiceProvider.php in Depicter — Popup & Slider Builder 1.2.0, at app/src/WordPress/ShortcodesServiceProvider.php

56 lines 990 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Depicter\WordPress;
3
4 use WPEmerge\ServiceProviders\ServiceProviderInterface;
5
6 /**
7 * Register shortcodes.
8 */
9 class ShortcodesServiceProvider implements ServiceProviderInterface {
10 /**
11 * {@inheritDoc}
12 */
13 public function register( $container ) {
14 // Nothing to register.
15 }
16
17 /**
18 * {@inheritDoc}
19 */
20 public function bootstrap( $container ) {
21 add_shortcode('depicter' , [ $this, 'process_shortcode' ]);
22 }
23
24 /**
25 * Shortcode callback
26 *
27 * @param array $attrs
28 * @param null $content
29 *
30 * @return string
31 * @throws \Exception
32 */
33 function process_shortcode( $attrs, $content = null ) {
34
35 extract( shortcode_atts([
36 'id' => '',
37 'alias' => '',
38 'slug' => ''
39 ],
40 $attrs,
41 'depicter'
42 ));
43
44 $documentId = $id;
45
46 if ( empty( $documentId ) ) {
47 if( empty( $slug ) && ! empty( $alias ) ){
48 $slug = $alias;
49 }
50 $documentId = $slug;
51 }
52
53 return \Depicter::front()->render()->document( $documentId, [ 'echo' => false ] );
54 }
55 }
56