All-in-One Event Calendar - Version 2.5.31

Version Description

Download this release

Release Info

Developer calvinyeh
Plugin Icon 128x128 All-in-One Event Calendar
Version 2.5.31
Comparing to
See all releases

Code changes from version 2.5.30 to 2.5.31

all-in-one-event-calendar.php CHANGED
@@ -5,7 +5,7 @@
5
  * Description: A calendar system with month, week, day, agenda views, upcoming events widget, color-coded categories, recurrence, and import/export of .ics feeds.
6
  * Author: Time.ly Network Inc.
7
  * Author URI: https://time.ly/
8
- * Version: 2.5.30
9
  * Text Domain: all-in-one-event-calendar
10
  * Domain Path: /language
11
  */
5
  * Description: A calendar system with month, week, day, agenda views, upcoming events widget, color-coded categories, recurrence, and import/export of .ics feeds.
6
  * Author: Time.ly Network Inc.
7
  * Author URI: https://time.ly/
8
+ * Version: 2.5.31
9
  * Text Domain: all-in-one-event-calendar
10
  * Domain Path: /language
11
  */
app/config/constants.php CHANGED
@@ -50,7 +50,7 @@ function ai1ec_initiate_constants( $ai1ec_base_dir, $ai1ec_base_url ) {
50
  // = Plugin Version =
51
  // ==================
52
  if ( ! defined( 'AI1EC_VERSION' ) ) {
53
- define( 'AI1EC_VERSION', '2.5.30' );
54
  }
55
 
56
  // ================
50
  // = Plugin Version =
51
  // ==================
52
  if ( ! defined( 'AI1EC_VERSION' ) ) {
53
+ define( 'AI1EC_VERSION', '2.5.31' );
54
  }
55
 
56
  // ================
app/view/event/single.php CHANGED
@@ -172,6 +172,7 @@ class Ai1ec_View_Event_Single extends Ai1ec_Base {
172
  $instance_id = preg_replace( '/\D/', '', $instance_id );
173
  }
174
  $event = $this->_registry->get( 'model.event', get_the_ID(), $instance_id );
 
175
  $content = $this->_registry->get( 'view.event.content' );
176
  $desc = $event->get( 'post' )->post_content;
177
  $desc = apply_filters( 'the_excerpt', $desc );
@@ -180,6 +181,11 @@ class Ai1ec_View_Event_Single extends Ai1ec_Base {
180
  $desc = strip_tags( $desc );
181
  $desc = preg_replace( '/\n+/', ' ', $desc);
182
  $desc = substr( $desc, 0, 300 );
 
 
 
 
 
183
 
184
  $og = array(
185
  'url' => home_url( esc_url( add_query_arg( null, null ) ) ),
@@ -189,7 +195,7 @@ class Ai1ec_View_Event_Single extends Ai1ec_Base {
189
  ),
190
  'type' => 'article',
191
  'description' => htmlspecialchars( $desc ),
192
- 'image' => $content->get_content_img_url( $event )
193
  );
194
  foreach ( $og as $key => $val ) {
195
  echo "<meta property=\"og:$key\" content=\"$val\" />\n";
@@ -202,7 +208,7 @@ class Ai1ec_View_Event_Single extends Ai1ec_Base {
202
  ' (' . substr( $event->get( 'start' ) , 0, 10 ) . ')'
203
  ),
204
  'description' => htmlspecialchars( $desc ),
205
- 'image' => $content->get_content_img_url( $event )
206
  );
207
  foreach ( $twitter as $key => $val ) {
208
  if ( empty( $val ) && 'image' !== $key ) {
172
  $instance_id = preg_replace( '/\D/', '', $instance_id );
173
  }
174
  $event = $this->_registry->get( 'model.event', get_the_ID(), $instance_id );
175
+ $avatar = $this->_registry->get( 'view.event.avatar' );
176
  $content = $this->_registry->get( 'view.event.content' );
177
  $desc = $event->get( 'post' )->post_content;
178
  $desc = apply_filters( 'the_excerpt', $desc );
181
  $desc = strip_tags( $desc );
182
  $desc = preg_replace( '/\n+/', ' ', $desc);
183
  $desc = substr( $desc, 0, 300 );
184
+ // Get featured image
185
+ $image = $avatar->get_post_thumbnail_url( $event );
186
+ if ( ! $image ) {
187
+ $image = $content->get_content_img_url( $event );
188
+ }
189
 
190
  $og = array(
191
  'url' => home_url( esc_url( add_query_arg( null, null ) ) ),
195
  ),
196
  'type' => 'article',
197
  'description' => htmlspecialchars( $desc ),
198
+ 'image' => $image,
199
  );
200
  foreach ( $og as $key => $val ) {
201
  echo "<meta property=\"og:$key\" content=\"$val\" />\n";
208
  ' (' . substr( $event->get( 'start' ) , 0, 10 ) . ')'
209
  ),
210
  'description' => htmlspecialchars( $desc ),
211
+ 'image' => $image,
212
  );
213
  foreach ( $twitter as $key => $val ) {
214
  if ( empty( $val ) && 'image' !== $key ) {
language/all-in-one-event-calendar.mo CHANGED
Binary file
language/all-in-one-event-calendar.po CHANGED
@@ -2,13 +2,13 @@
2
  # This file is distributed under the same license as the All-in-One Event Calendar by Time.ly package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: All-in-One Event Calendar by Time.ly 2.5.30\n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/all-in-one-event-calendar\n"
7
- "POT-Creation-Date: 2018-04-11 19:41:23+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
11
- "PO-Revision-Date: 2018-04-11 19:41+0000\n"
12
  "Last-Translator: Timely <support@time.ly>\n"
13
  "Language-Team:\n"
14
 
@@ -2078,11 +2078,11 @@ msgstr "Buy Tickets"
2078
  msgid "Edit this occurrence (%s)"
2079
  msgstr "Edit this occurrence (%s)"
2080
 
2081
- #: app/view/event/single.php:209
2082
  msgid "No data"
2083
  msgstr "No data"
2084
 
2085
- #: app/view/event/single.php:227
2086
  msgid ""
2087
  "This post was replicated from another site's <a href=\"%s\" title="
2088
  "\"iCalendar feed\"><i class=\"ai1ec-fa ai1ec-fa-calendar\"></i> calendar "
@@ -2092,11 +2092,11 @@ msgstr ""
2092
  "\"iCalendar feed\"><i class=\"ai1ec-fa ai1ec-fa-calendar\"></i> calendar "
2093
  "feed</a>."
2094
 
2095
- #: app/view/event/single.php:231
2096
  msgid "This post was imported from a CSV/ICS file."
2097
  msgstr "This post was imported from a CSV/ICS file."
2098
 
2099
- #: app/view/event/single.php:244
2100
  msgid "View original"
2101
  msgstr "View original"
2102
 
@@ -2411,7 +2411,7 @@ msgstr ""
2411
  "PHP extension \"mbstring\" needed for All-In-One-Event-Calendar is missing. "
2412
  "Please, check your PHP configuration.<br />"
2413
 
2414
- #: lib/environment/check.php:255
2415
  msgid ""
2416
  "The add-on <strong>%s</strong> must be updated to at least version %s to "
2417
  "maintain compatibility with the core calendar."
@@ -2419,7 +2419,7 @@ msgstr ""
2419
  "The add-on <strong>%s</strong> must be updated to at least version %s to "
2420
  "maintain compatibility with the core calendar."
2421
 
2422
- #: lib/environment/check.php:256
2423
  msgid ""
2424
  "If you do not see update notices below, ensure you have properly <a href="
2425
  "\"https://time.ly/document/user-guide/getting-started/license-keys/\" target="
@@ -2772,8 +2772,8 @@ msgctxt "Recurrence editor - weekly tab"
2772
  msgid "on"
2773
  msgstr "on"
2774
 
2775
- #: lib/recurrence/rule.php:249 lib/recurrence/rule.php:278
2776
- #: lib/recurrence/rule.php:327
2777
  msgid "and"
2778
  msgstr "and"
2779
 
2
  # This file is distributed under the same license as the All-in-One Event Calendar by Time.ly package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: All-in-One Event Calendar by Time.ly 2.5.31\n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/all-in-one-event-calendar\n"
7
+ "POT-Creation-Date: 2018-05-07 17:13:30+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
11
+ "PO-Revision-Date: 2018-05-07 17:13+0000\n"
12
  "Last-Translator: Timely <support@time.ly>\n"
13
  "Language-Team:\n"
14
 
2078
  msgid "Edit this occurrence (%s)"
2079
  msgstr "Edit this occurrence (%s)"
2080
 
2081
+ #: app/view/event/single.php:215
2082
  msgid "No data"
2083
  msgstr "No data"
2084
 
2085
+ #: app/view/event/single.php:233
2086
  msgid ""
2087
  "This post was replicated from another site's <a href=\"%s\" title="
2088
  "\"iCalendar feed\"><i class=\"ai1ec-fa ai1ec-fa-calendar\"></i> calendar "
2092
  "\"iCalendar feed\"><i class=\"ai1ec-fa ai1ec-fa-calendar\"></i> calendar "
2093
  "feed</a>."
2094
 
2095
+ #: app/view/event/single.php:237
2096
  msgid "This post was imported from a CSV/ICS file."
2097
  msgstr "This post was imported from a CSV/ICS file."
2098
 
2099
+ #: app/view/event/single.php:250
2100
  msgid "View original"
2101
  msgstr "View original"
2102
 
2411
  "PHP extension \"mbstring\" needed for All-In-One-Event-Calendar is missing. "
2412
  "Please, check your PHP configuration.<br />"
2413
 
2414
+ #: lib/environment/check.php:256
2415
  msgid ""
2416
  "The add-on <strong>%s</strong> must be updated to at least version %s to "
2417
  "maintain compatibility with the core calendar."
2419
  "The add-on <strong>%s</strong> must be updated to at least version %s to "
2420
  "maintain compatibility with the core calendar."
2421
 
2422
+ #: lib/environment/check.php:257
2423
  msgid ""
2424
  "If you do not see update notices below, ensure you have properly <a href="
2425
  "\"https://time.ly/document/user-guide/getting-started/license-keys/\" target="
2772
  msgid "on"
2773
  msgstr "on"
2774
 
2775
+ #: lib/recurrence/rule.php:249 lib/recurrence/rule.php:252
2776
+ #: lib/recurrence/rule.php:278 lib/recurrence/rule.php:327
2777
  msgid "and"
2778
  msgstr "and"
2779
 
language/all-in-one-event-calendar.pot CHANGED
@@ -2,9 +2,9 @@
2
  # This file is distributed under the same license as the All-in-One Event Calendar by Time.ly package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: All-in-One Event Calendar by Time.ly 2.5.30\n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/all-in-one-event-calendar\n"
7
- "POT-Creation-Date: 2018-04-11 19:41:23+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -1887,22 +1887,22 @@ msgstr ""
1887
  msgid "Edit this occurrence (%s)"
1888
  msgstr ""
1889
 
1890
- #: app/view/event/single.php:209
1891
  msgid "No data"
1892
  msgstr ""
1893
 
1894
- #: app/view/event/single.php:227
1895
  msgid ""
1896
  "This post was replicated from another site's <a href=\"%s\" title="
1897
  "\"iCalendar feed\"><i class=\"ai1ec-fa ai1ec-fa-calendar\"></i> calendar "
1898
  "feed</a>."
1899
  msgstr ""
1900
 
1901
- #: app/view/event/single.php:231
1902
  msgid "This post was imported from a CSV/ICS file."
1903
  msgstr ""
1904
 
1905
- #: app/view/event/single.php:244
1906
  msgid "View original"
1907
  msgstr ""
1908
 
@@ -2180,13 +2180,13 @@ msgid ""
2180
  "Please, check your PHP configuration.<br />"
2181
  msgstr ""
2182
 
2183
- #: lib/environment/check.php:255
2184
  msgid ""
2185
  "The add-on <strong>%s</strong> must be updated to at least version %s to "
2186
  "maintain compatibility with the core calendar."
2187
  msgstr ""
2188
 
2189
- #: lib/environment/check.php:256
2190
  msgid ""
2191
  "If you do not see update notices below, ensure you have properly <a href="
2192
  "\"https://time.ly/document/user-guide/getting-started/license-keys/\" target="
@@ -2522,8 +2522,8 @@ msgctxt "Recurrence editor - weekly tab"
2522
  msgid "on"
2523
  msgstr ""
2524
 
2525
- #: lib/recurrence/rule.php:249 lib/recurrence/rule.php:278
2526
- #: lib/recurrence/rule.php:327
2527
  msgid "and"
2528
  msgstr ""
2529
 
2
  # This file is distributed under the same license as the All-in-One Event Calendar by Time.ly package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: All-in-One Event Calendar by Time.ly 2.5.31\n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/all-in-one-event-calendar\n"
7
+ "POT-Creation-Date: 2018-05-07 17:13:30+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
1887
  msgid "Edit this occurrence (%s)"
1888
  msgstr ""
1889
 
1890
+ #: app/view/event/single.php:215
1891
  msgid "No data"
1892
  msgstr ""
1893
 
1894
+ #: app/view/event/single.php:233
1895
  msgid ""
1896
  "This post was replicated from another site's <a href=\"%s\" title="
1897
  "\"iCalendar feed\"><i class=\"ai1ec-fa ai1ec-fa-calendar\"></i> calendar "
1898
  "feed</a>."
1899
  msgstr ""
1900
 
1901
+ #: app/view/event/single.php:237
1902
  msgid "This post was imported from a CSV/ICS file."
1903
  msgstr ""
1904
 
1905
+ #: app/view/event/single.php:250
1906
  msgid "View original"
1907
  msgstr ""
1908
 
2180
  "Please, check your PHP configuration.<br />"
2181
  msgstr ""
2182
 
2183
+ #: lib/environment/check.php:256
2184
  msgid ""
2185
  "The add-on <strong>%s</strong> must be updated to at least version %s to "
2186
  "maintain compatibility with the core calendar."
2187
  msgstr ""
2188
 
2189
+ #: lib/environment/check.php:257
2190
  msgid ""
2191
  "If you do not see update notices below, ensure you have properly <a href="
2192
  "\"https://time.ly/document/user-guide/getting-started/license-keys/\" target="
2522
  msgid "on"
2523
  msgstr ""
2524
 
2525
+ #: lib/recurrence/rule.php:249 lib/recurrence/rule.php:252
2526
+ #: lib/recurrence/rule.php:278 lib/recurrence/rule.php:327
2527
  msgid "and"
2528
  msgstr ""
2529
 
lib/environment/check.php CHANGED
@@ -161,6 +161,7 @@ class Ai1ec_Environment_Checks extends Ai1ec_Base {
161
  ! $rewrite ||
162
  ! is_object( $wp_rewrite ) ||
163
  ! isset( $wp_rewrite->rules ) ||
 
164
  0 === count( $wp_rewrite->rules )
165
  ) {
166
  return;
161
  ! $rewrite ||
162
  ! is_object( $wp_rewrite ) ||
163
  ! isset( $wp_rewrite->rules ) ||
164
+ ! is_array ( $wp_rewrite->rules ) ||
165
  0 === count( $wp_rewrite->rules )
166
  ) {
167
  return;
lib/exception/handler.php CHANGED
@@ -110,7 +110,7 @@ class Ai1ec_Exception_Handler {
110
  *
111
  * @return string|null Add-on identifier (plugin url), or null.
112
  */
113
- public function is_caused_by_addon( Exception $exception ) {
114
  $addon = null;
115
  if ( method_exists( $exception, 'plugin_to_disable' ) ) {
116
  $addon = $exception->plugin_to_disable();
@@ -567,7 +567,7 @@ class Ai1ec_Exception_Handler {
567
  *
568
  * @return string HTML code.
569
  */
570
- protected function _get_backtrace( Exception $exception ) {
571
  $backtrace = '';
572
  $trace = nl2br( $exception->getTraceAsString() );
573
  $ident = sha1( $trace );
110
  *
111
  * @return string|null Add-on identifier (plugin url), or null.
112
  */
113
+ public function is_caused_by_addon( $exception ) {
114
  $addon = null;
115
  if ( method_exists( $exception, 'plugin_to_disable' ) ) {
116
  $addon = $exception->plugin_to_disable();
567
  *
568
  * @return string HTML code.
569
  */
570
+ protected function _get_backtrace( $exception ) {
571
  $backtrace = '';
572
  $trace = nl2br( $exception->getTraceAsString() );
573
  $ident = sha1( $trace );
lib/import-export/api-ics.php CHANGED
@@ -179,7 +179,12 @@ class Ai1ec_Api_Ics_Import_Export_Engine
179
 
180
  // Check if the timezone is a recognized TZ in PHP
181
  // Note: the TZ may be perfectly valid, but it may not be an accepted value in the PHP version the plugin is running on
182
- $tz = @timezone_open( $event_timezone );
 
 
 
 
 
183
 
184
  if ( ! $tz || $allday || preg_match( "/GMT[+|-][0-9]{4}.*/", $event_timezone ) ) {
185
  $event_timezone = $local_timezone;
179
 
180
  // Check if the timezone is a recognized TZ in PHP
181
  // Note: the TZ may be perfectly valid, but it may not be an accepted value in the PHP version the plugin is running on
182
+ try {
183
+ $tz = @timezone_open( $event_timezone );
184
+ } catch ( Exception $e ) {
185
+ // Invalid timzeone
186
+ $tz = null;
187
+ }
188
 
189
  if ( ! $tz || $allday || preg_match( "/GMT[+|-][0-9]{4}.*/", $event_timezone ) ) {
190
  $event_timezone = $local_timezone;
lib/recurrence/rule.php CHANGED
@@ -249,7 +249,7 @@ class Ai1ec_Recurrence_Rule extends Ai1ec_Base {
249
  $_days .= ' ' . $wp_locale->weekday[$day] . ' ' . Ai1ec_I18n::__( 'and' );
250
  }
251
  // remove the last ' and'
252
- $_days = substr( $_days, 0, -4 );
253
  $txt .= ' ' . Ai1ec_I18n::_x( 'on', 'Recurrence editor - weekly tab' ) . $_days;
254
  }
255
  } else {
249
  $_days .= ' ' . $wp_locale->weekday[$day] . ' ' . Ai1ec_I18n::__( 'and' );
250
  }
251
  // remove the last ' and'
252
+ $_days = substr( $_days, 0, -( strlen( Ai1ec_I18n::__( 'and' ) ) + 1 ) );
253
  $txt .= ' ' . Ai1ec_I18n::_x( 'on', 'Recurrence editor - weekly tab' ) . $_days;
254
  }
255
  } else {
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: uchu, calvinyeh, raquelleira, renatotbueno, domanb, elirenato, hubrik, vtowel, yani.iliev, nicolapeluchetti, jbutkus, lpawlik, bangelov
3
  Tags: calendar, event, ical, feed, ics, icalendar, sync, aggregator, google, venue, calendar widget, events widget
4
  Requires at least: 3.5
5
- Tested up to: 4.9.5
6
- Stable tag: 2.5.30
7
  License: GNU General Public License, version 3 (GPL-3.0)
8
 
9
  An events calendar system with multiple views, upcoming events widget, color-coded categories, recurrence, and import/export of .ics feeds.
@@ -79,12 +79,6 @@ Timely is supported by a committed group of translators offering [languages file
79
 
80
  You can help translate by going to [https://translate.time.ly](https://translate.time.ly).
81
 
82
- = Become the Hub of your community =
83
-
84
- If your goal is to run a community events calendar, Timely's All-in-one Event Calendar has everything you'll need.
85
-
86
- https://vimeo.com/135004810
87
-
88
  = Helpful Links =
89
 
90
  * [**Access our User Guide**](https://time.ly/document/user-guide/).
@@ -129,6 +123,9 @@ https://vimeo.com/135004810
129
 
130
  == Changelog ==
131
 
 
 
 
132
  = Version 2.5.30 =
133
  * Fixed compatibility with PHP 7.2
134
  * Clean up: Removing use of deprecated WordPress function.
2
  Contributors: uchu, calvinyeh, raquelleira, renatotbueno, domanb, elirenato, hubrik, vtowel, yani.iliev, nicolapeluchetti, jbutkus, lpawlik, bangelov
3
  Tags: calendar, event, ical, feed, ics, icalendar, sync, aggregator, google, venue, calendar widget, events widget
4
  Requires at least: 3.5
5
+ Tested up to: 4.9.6
6
+ Stable tag: 2.5.31
7
  License: GNU General Public License, version 3 (GPL-3.0)
8
 
9
  An events calendar system with multiple views, upcoming events widget, color-coded categories, recurrence, and import/export of .ics feeds.
79
 
80
  You can help translate by going to [https://translate.time.ly](https://translate.time.ly).
81
 
 
 
 
 
 
 
82
  = Helpful Links =
83
 
84
  * [**Access our User Guide**](https://time.ly/document/user-guide/).
123
 
124
  == Changelog ==
125
 
126
+ = Version 2.5.31 =
127
+ * Fixed: Featured Image was not being shown when the event was shared on Twitter or Facebook.
128
+
129
  = Version 2.5.30 =
130
  * Fixed compatibility with PHP 7.2
131
  * Clean up: Removing use of deprecated WordPress function.
vendor/twig/Node/Module.php CHANGED
@@ -50,7 +50,7 @@ class Twig_Node_Module extends Twig_Node
50
 
51
  $this->compileClassHeader($compiler);
52
 
53
- if (count($this->getNode('blocks')) || count($this->getNode('traits')) || null === $this->getNode('parent') || $this->getNode('parent') instanceof Twig_Node_Expression_Constant) {
54
  $this->compileConstructor($compiler);
55
  }
56
 
@@ -150,7 +150,7 @@ class Twig_Node_Module extends Twig_Node
150
  ;
151
  }
152
 
153
- $countTraits = count($this->getNode('traits'));
154
  if ($countTraits) {
155
  // traits
156
  foreach ($this->getNode('traits') as $i => $trait) {
@@ -292,7 +292,7 @@ class Twig_Node_Module extends Twig_Node
292
  //
293
  // Put another way, a template can be used as a trait if it
294
  // only contains blocks and use statements.
295
- $traitable = null === $this->getNode('parent') && 0 === count($this->getNode('macros'));
296
  if ($traitable) {
297
  if ($this->getNode('body') instanceof Twig_Node_Body) {
298
  $nodes = $this->getNode('body')->getNode(0);
@@ -300,12 +300,12 @@ class Twig_Node_Module extends Twig_Node
300
  $nodes = $this->getNode('body');
301
  }
302
 
303
- if (!count($nodes)) {
304
  $nodes = new Twig_Node(array($nodes));
305
  }
306
 
307
  foreach ($nodes as $node) {
308
- if (!count($node)) {
309
  continue;
310
  }
311
 
50
 
51
  $this->compileClassHeader($compiler);
52
 
53
+ if ((null !== $this->getNode('blocks') && count($this->getNode('blocks'))) || (null !== $this->getNode('traits') && count($this->getNode('traits'))) || null === $this->getNode('parent') || $this->getNode('parent') instanceof Twig_Node_Expression_Constant) {
54
  $this->compileConstructor($compiler);
55
  }
56
 
150
  ;
151
  }
152
 
153
+ $countTraits = null !== $this->getNode('traits') ? count($this->getNode('traits')) : 0;
154
  if ($countTraits) {
155
  // traits
156
  foreach ($this->getNode('traits') as $i => $trait) {
292
  //
293
  // Put another way, a template can be used as a trait if it
294
  // only contains blocks and use statements.
295
+ $traitable = null === $this->getNode('parent') && null !== $this->getNode('macros') && 0 === count($this->getNode('macros'));
296
  if ($traitable) {
297
  if ($this->getNode('body') instanceof Twig_Node_Body) {
298
  $nodes = $this->getNode('body')->getNode(0);
300
  $nodes = $this->getNode('body');
301
  }
302
 
303
+ if (null === $nodes || !count($nodes)) {
304
  $nodes = new Twig_Node(array($nodes));
305
  }
306
 
307
  foreach ($nodes as $node) {
308
+ if (null === $node || !count($node)) {
309
  continue;
310
  }
311