ember-tribe 1.2.14 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -8,9 +8,8 @@ Tribe is a project management framework by Postcode - https://github.com/tribe-f
8
8
  Compatibility
9
9
  ------------------------------------------------------------------------------
10
10
 
11
- * Ember.js v3.24 or above
12
- * Ember CLI v3.24 or above
13
- * Node.js v12 or above
11
+ * Ember.js v5.4 or above
12
+ * Ember CLI v5.4 or above
14
13
 
15
14
 
16
15
  Installation
@@ -28,7 +27,15 @@ ember install ember-tribe
28
27
  ```
29
28
  php sync-types.php
30
29
  ```
31
-
30
+ 4. To serve front-end webapp from backend server and for using page-wise meta tags
31
+ - On local:
32
+ ```
33
+ php sync-dist.php
34
+ ```
35
+ - On server:
36
+ ```
37
+ bash -c "$(wget --no-cache --no-cookie https://raw.githubusercontent.com/tribe-framework/tribe/master/install/ember.sh -O -)"
38
+ ```
32
39
 
33
40
  Usage
34
41
  ------------------------------------------------------------------------------
@@ -0,0 +1,39 @@
1
+ <?php
2
+ //SEO code and Meta tags
3
+
4
+ $core = new \Tribe\Core;
5
+ $uploads = new \Tribe\Uploads;
6
+
7
+ //Website's title, description, twitter handle and cover image link
8
+ $meta_title = "";
9
+ $meta_description = "";
10
+ $meta_image_url = "";
11
+ $twitter_handle = "";
12
+
13
+ if ($type ?? false && $slug ?? false) {
14
+ $postdata = $core->getObject(array('type'=>$type, 'slug'=>$slug));
15
+
16
+ if ($postdata['title'] ?? false)
17
+ $meta_title = $postdata['title'];
18
+
19
+ if ($postdata['short_description'] ?? false)
20
+ $meta_description = $postdata['short_description'];
21
+
22
+ $meta_image_url = ($uploads->getUploadedImageInSize($postdata['cover_url'], 'md')['url'] ??
23
+ ($postdata['cover_url'] ??
24
+ $meta_image_url)
25
+ );
26
+ }
27
+ ?>
28
+
29
+ <title><?=$meta_title?></title>
30
+ <meta name="description" content="<?=$meta_description?>">
31
+
32
+ <meta name="twitter:card" content="summary_large_image" />
33
+ <meta name="twitter:site" content="@<?=$twitter_handle?>" />
34
+ <meta name="twitter:creator" content="@<?=$twitter_handle?>" />
35
+
36
+ <meta property="og:title" content="<?=$meta_title?>">
37
+ <meta property="og:description" content="<?=$meta_description?>">
38
+
39
+ <meta property="og:image" content="<?=$meta_image_url?>">
@@ -0,0 +1 @@
1
+ <!-- analytics code -->
@@ -0,0 +1,25 @@
1
+ <?php
2
+ /*
3
+
4
+ This file provides 4 URL variables for use across the middleware of an Ember app
5
+
6
+ $url = URL of the app
7
+ $type = type
8
+ $slug = slug
9
+ $params = query parameters array
10
+ */
11
+ require __DIR__ . '/../../../../_init.php';
12
+
13
+ $url_parts = parse_url($_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
14
+
15
+ $url_path_parts = explode('/', $url_parts['path']);
16
+
17
+ parse_str(parse_url($_SERVER['REQUEST_URI'], PHP_URL_QUERY), $params);
18
+
19
+ $url = 'https://'
20
+ .$url_parts['host']
21
+ .($url_parts['path'] ?? '');
22
+
23
+ $type = $url_path_parts[1] ?? '';
24
+ $slug = $url_path_parts[2] ?? '';
25
+ ?>
@@ -0,0 +1,3 @@
1
+ # http://www.robotstxt.org
2
+ User-agent: *
3
+ Disallow:
@@ -0,0 +1,58 @@
1
+ <?php
2
+ if (file_exists('dist/index.html') !== false) {
3
+ //get html
4
+ $html = file_get_contents('dist/index.html');
5
+
6
+ //replace head, before title
7
+ $html = str_replace('<title>', '<?php include_once("php/_head.php");?><title>', $html);
8
+
9
+ //replace head-footer, before </head> ends
10
+ $html = str_replace('</head>', '<?php include_once("php/_head_footer.php");?></head>', $html);
11
+
12
+ //replace body-footer, before </body> ends
13
+ $html = str_replace('</body>', '<?php include_once("php/_body_footer.php");?></body>', $html);
14
+
15
+ //load dom
16
+ $dom = new DOMDocument();
17
+ $dom->loadHTML($html);
18
+
19
+ //for tags to be removed
20
+ $remove = [];
21
+
22
+ //remove meta description tag
23
+ $metas = $dom->getElementsByTagName('meta');
24
+ for($i=0; $i <$metas-> length; $i++) {
25
+ $name = $metas->item($i)->getAttribute("name");
26
+ if ($name == 'description')
27
+ $remove[] = $metas->item($i);
28
+ }
29
+
30
+ //remove title tag
31
+ $titles = $dom->getElementsByTagName('title');
32
+ foreach($titles as $item)
33
+ $remove[] = $item;
34
+
35
+ //remove identified tags
36
+ foreach ($remove as $item)
37
+ $item->parentNode->removeChild($item);
38
+
39
+ //save edit dom html
40
+ $html = $dom->saveHTML();
41
+
42
+ //prepend _init.php for $type and $slug and Tribe composer
43
+ $html = '<?php include_once("php/_init.php");?>'.$html;
44
+
45
+ //save to file
46
+ file_put_contents('dist/index.php', $html);
47
+
48
+ //echo success message on commandline
49
+ echo '~~~~~~~~~~'."\r\n";
50
+ echo `tput setaf 2`.'Middleware successfully installed. Synced "/dist" folder with PHP.'.`tput sgr0`."\r\n";
51
+ echo '~~~~~~~~~~'."\r\n";
52
+ }
53
+ else {
54
+ echo '~~~~~~~~~~'."\r\n";
55
+ echo `tput setaf 1`.'Run "ember build -prod" before syncing with PHP.'.`tput sgr0`."\r\n";
56
+ echo '~~~~~~~~~~'."\r\n";
57
+ }
58
+ ?>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ember-tribe",
3
- "version": "1.2.14",
3
+ "version": "2.0.0",
4
4
  "description": "The default blueprint for using Tribe within EmberJS.",
5
5
  "keywords": [
6
6
  "ember-addon"