SEO SQUIRRLY™ - Version 6.1.0

Version Description

  • Compatible with WP 4.6
  • Fixed the Front Page SEO to work with more WP themes
  • Fixed compatibility with PolyLang plugin
  • Fixed compatibility with Customizr theme
  • Fixed Squirrly SEO Snippet for arabic lang
Download this release

Release Info

Developer cifi
Plugin Icon 128x128 SEO SQUIRRLY™
Version 6.1.0
Comparing to
See all releases

Code changes from version 5.2.8 to 6.1.0

classes/SQ_Tools.php CHANGED
@@ -5,7 +5,8 @@
5
  *
6
  * @author Squirrly
7
  */
8
- class SQ_Tools extends SQ_FrontController {
 
9
 
10
  /** @var array Saved options in database */
11
  public static $options = array();
@@ -17,7 +18,8 @@ class SQ_Tools extends SQ_FrontController {
17
  private static $debug;
18
  private static $source_code;
19
 
20
- public function __construct() {
 
21
  parent::__construct();
22
 
23
  self::$options = $this->getOptions();
@@ -25,7 +27,8 @@ class SQ_Tools extends SQ_FrontController {
25
  $this->checkDebug(); //dev mode
26
  }
27
 
28
- public static function getUserID() {
 
29
  global $current_user;
30
  return $current_user->ID;
31
  }
@@ -35,7 +38,8 @@ class SQ_Tools extends SQ_FrontController {
35
  *
36
  * @return void
37
  */
38
- function hookInit() {
 
39
  //TinyMCE editor required
40
  //set_user_setting('editor', 'tinymce');
41
 
@@ -52,7 +56,8 @@ class SQ_Tools extends SQ_FrontController {
52
  * @param type $file
53
  * @return array
54
  */
55
- public function hookActionlink($links, $file) {
 
56
  if ($file == _SQ_PLUGIN_NAME_ . '/squirrly.php') {
57
  $link = '<a href="' . admin_url('admin.php?page=sq_dashboard') . '">' . __('Getting started', _SQ_PLUGIN_NAME_) . '</a>';
58
  array_unshift($links, $link);
@@ -66,7 +71,8 @@ class SQ_Tools extends SQ_FrontController {
66
  *
67
  * @return void
68
  */
69
- public static function getOptions() {
 
70
  $default = array(
71
  'sq_ver' => 0,
72
  'sq_api' => '',
@@ -79,6 +85,7 @@ class SQ_Tools extends SQ_FrontController {
79
  // --
80
  'sq_auto_canonical' => 1,
81
  'sq_auto_sitemap' => 0,
 
82
  'sq_auto_jsonld' => 0,
83
  'sq_jsonld_type' => 'Organization',
84
  'sq_jsonld' => array(
@@ -117,19 +124,19 @@ class SQ_Tools extends SQ_FrontController {
117
  'sitemap-custom-post' => array('sitemap-custom-posts.xml', 0),
118
  ),
119
  'sq_auto_robots' => 1,
120
- 'sq_robots_security' => array(
121
  'User-agent: *',
122
  'Disallow: */trackback/',
123
  'Disallow: */xmlrpc.php',
124
  'Disallow: /wp-*.php',
125
  'Disallow: /cgi-bin/',
126
  'Disallow: /wp-admin/',
127
- 'Disallow: /wp-includes/',
128
- 'Allow: */wp-content/uploads/'),
129
  'sq_auto_meta' => 1,
130
  'sq_auto_favicon' => 0,
131
  'favicon' => '',
132
  'sq_auto_twitter' => 0,
 
133
  'sq_auto_facebook' => 0,
134
  'sq_og_locale' => 'en_US',
135
  'sq_twitter_account' => '',
@@ -180,7 +187,8 @@ class SQ_Tools extends SQ_FrontController {
180
  return $default;
181
  }
182
 
183
- public static function getBriefOptions() {
 
184
  if ($pageId = get_option('page_on_front')) {
185
  $title = SQ_ObjController::getModel('SQ_Frontend')->getAdvancedMeta($pageId, 'title');
186
  $description = SQ_ObjController::getModel('SQ_Frontend')->getAdvancedMeta($pageId, 'description');
@@ -203,15 +211,15 @@ class SQ_Tools extends SQ_FrontController {
203
  'sq_auto_twitter' => SQ_Tools::$options['sq_auto_twitter'],
204
  'sq_auto_facebook' => SQ_Tools::$options['sq_auto_facebook'],
205
  'sq_auto_seo' => SQ_Tools::$options['sq_auto_seo'],
206
- 'sq_auto_title' => (int) (SQ_Tools::$options['sq_auto_title'] == 1 && $title <> ''),
207
- 'sq_auto_description' => (int) (SQ_Tools::$options['sq_auto_description'] == 1 && $description <> ''),
208
- 'sq_google_plus' => (int) (SQ_Tools::$options['sq_google_plus'] <> ''),
209
- 'sq_google_wt' => (int) (SQ_Tools::$options['sq_google_wt'] <> ''),
210
- 'sq_google_analytics' => (int) (SQ_Tools::$options['sq_google_analytics'] <> ''),
211
- 'sq_facebook_insights' => (int) (SQ_Tools::$options['sq_facebook_insights'] <> ''),
212
- 'sq_bing_wt' => (int) (SQ_Tools::$options['sq_bing_wt'] <> ''),
213
- 'sq_pinterest' => (int) (SQ_Tools::$options['sq_pinterest'] <> ''),
214
- 'sq_alexa' => (int) (SQ_Tools::$options['sq_alexa'] <> ''),
215
  'sq_keyword_help' => SQ_Tools::$options['sq_keyword_help'],
216
  'sq_keyword_information' => SQ_Tools::$options['sq_keyword_information'],
217
  'sq_google_country_strict' => SQ_Tools::$options['sq_google_country_strict'],
@@ -225,7 +233,8 @@ class SQ_Tools extends SQ_FrontController {
225
  *
226
  * @return void
227
  */
228
- public static function saveOptions($key = null, $value = '') {
 
229
  if (isset($key)) {
230
  self::$options[$key] = $value;
231
  }
@@ -237,7 +246,8 @@ class SQ_Tools extends SQ_FrontController {
237
  * Set the header type
238
  * @param type $type
239
  */
240
- public static function setHeader($type) {
 
241
  if (SQ_Tools::getValue('sq_debug') == 'on')
242
  return;
243
 
@@ -265,10 +275,11 @@ class SQ_Tools extends SQ_FrontController {
265
  * @param mixed $defaultValue (optional)
266
  * @return mixed Value
267
  */
268
- public static function getValue($key, $defaultValue = false, $withcode = false) {
269
- if (!isset($key) OR empty($key) OR ! is_string($key))
 
270
  return false;
271
- $ret = (isset($_POST[$key]) ? $_POST[$key] : (isset($_GET[$key]) ? (is_string($_GET[$key]) ? urldecode($_GET[$key]) : $_GET[$key]) : $defaultValue));
272
 
273
  if (is_string($ret) === true && $withcode === false) {
274
  $ret = sanitize_text_field($ret);
@@ -283,8 +294,9 @@ class SQ_Tools extends SQ_FrontController {
283
  * @param string $key
284
  * @return boolean
285
  */
286
- public static function getIsset($key) {
287
- if (!isset($key) OR empty($key) OR ! is_string($key))
 
288
  return false;
289
  return isset($_POST[$key]) ? true : (isset($_GET[$key]) ? true : false);
290
  }
@@ -294,10 +306,11 @@ class SQ_Tools extends SQ_FrontController {
294
  *
295
  * @return void
296
  */
297
- public static function showNotices($message, $type = 'sq_notices') {
 
298
  if (file_exists(_SQ_THEME_DIR_ . 'SQ_notices.php')) {
299
  ob_start();
300
- include (_SQ_THEME_DIR_ . 'SQ_notices.php');
301
  $message = ob_get_contents();
302
  ob_end_clean();
303
  }
@@ -308,7 +321,8 @@ class SQ_Tools extends SQ_FrontController {
308
  /**
309
  * Load the multilanguage support from .mo
310
  */
311
- private function loadMultilanguage() {
 
312
  if (!defined('WP_PLUGIN_DIR')) {
313
  load_plugin_textdomain(_SQ_PLUGIN_NAME_, _SQ_PLUGIN_NAME_ . '/languages/');
314
  } else {
@@ -319,24 +333,40 @@ class SQ_Tools extends SQ_FrontController {
319
  /**
320
  * Connect remote with CURL if exists
321
  */
322
- public static function sq_remote_get($url, $param = array(), $options = array()) {
 
323
  $parameters = '';
324
  $cookies = array();
325
  $cookie_string = '';
326
 
327
  $url_domain = parse_url($url);
328
- $url_domain = $url_domain['host'];
 
 
 
 
329
 
330
- if (isset($param))
331
  foreach ($param as $key => $value) {
332
- if (isset($key) && $key <> '' && $key <> 'timeout')
333
  $parameters .= ($parameters == "" ? "" : "&") . $key . "=" . $value;
 
334
  }
335
- if ($parameters <> '')
 
 
336
  $url .= ((strpos($url, "?") === false) ? "?" : "&") . $parameters;
 
337
 
338
  //send the cookie for preview
339
- if ($url_domain == $_SERVER['HTTP_HOST'] && strpos($url, 'preview=true') !== false) {
 
 
 
 
 
 
 
340
  foreach ($_COOKIE as $name => $value) {
341
  if (strpos($name, 'wordpress') !== false || strpos($name, 'wp') !== false || strpos($name, 'slimstat') !== false || strpos($name, 'sforum') !== false) {
342
  $cookies[] = new WP_Http_Cookie(array('name' => $name, 'value' => $value));
@@ -352,9 +382,70 @@ class SQ_Tools extends SQ_FrontController {
352
  }
353
  $options['sslverify'] = false;
354
 
355
- if (!$response = self::sq_wpcall($url, $options)) {
356
  if (function_exists('curl_init') && !ini_get('safe_mode') && !ini_get('open_basedir')) {
357
- $response = self::sq_curl($url, $options);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
358
  } else {
359
  return false;
360
  }
@@ -369,18 +460,29 @@ class SQ_Tools extends SQ_FrontController {
369
  * @param array $param
370
  * @return string
371
  */
372
- private static function sq_curl($url, $options) {
 
373
 
374
  $ch = curl_init();
375
  curl_setopt($ch, CURLOPT_URL, $url);
376
  curl_setopt($ch, CURLOPT_HEADER, false);
377
  //--
378
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
379
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
380
  //--
381
  curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
382
  curl_setopt($ch, CURLOPT_TIMEOUT, $options['timeout']);
383
 
 
 
 
 
 
 
 
 
 
 
384
  if (isset($options['followlocation'])) {
385
  curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
386
  curl_setopt($ch, CURLOPT_MAXREDIRS, 1);
@@ -396,7 +498,7 @@ class SQ_Tools extends SQ_FrontController {
396
  $response = curl_exec($ch);
397
  $response = self::cleanResponce($response);
398
 
399
- self::dump('CURL', $url, $options, $ch, $response); //output debug
400
 
401
  if (curl_errno($ch) == 1 || $response === false) { //if protocol not supported
402
  if (curl_errno($ch)) {
@@ -417,22 +519,28 @@ class SQ_Tools extends SQ_FrontController {
417
  * @param array $param
418
  * @return string
419
  */
420
- private static function sq_wpcall($url, $options) {
421
- $response = wp_remote_get($url, $options);
 
 
 
 
 
422
  if (is_wp_error($response)) {
423
  self::dump($response);
424
  return false;
425
  }
426
 
427
  $response = self::cleanResponce(wp_remote_retrieve_body($response)); //clear and get the body
428
- self::dump('wp_remote_get', $url, $options, $response); //output debug
429
  return $response;
430
  }
431
 
432
  /**
433
  * Connect remote with CURL if exists
434
  */
435
- public static function sq_remote_head($url) {
 
436
  $response = array();
437
 
438
  if (function_exists('curl_exec')) {
@@ -458,7 +566,8 @@ class SQ_Tools extends SQ_FrontController {
458
  * @param string $response
459
  * @return string
460
  */
461
- private static function cleanResponce($response) {
 
462
 
463
  if (function_exists('substr_count'))
464
  if (substr_count($response, '(') > 1)
@@ -473,14 +582,15 @@ class SQ_Tools extends SQ_FrontController {
473
  /**
474
  * Check for SEO blog bad settings
475
  */
476
- public static function checkErrorSettings($count_only = false) {
 
477
  if (current_user_can('manage_options')) {
478
 
479
  $fixit = "<a href=\"javascript:void(0);\" onclick=\"%s jQuery(this).closest('div').fadeOut('slow'); if(parseInt(jQuery('.sq_count').html())>0) { var notif = (parseInt(jQuery('.sq_count').html()) - 1); if (notif > 0) {jQuery('.sq_count').html(notif); }else{ jQuery('.sq_count').html(notif); jQuery('.sq_count').hide(); } } jQuery.post(ajaxurl, { action: '%s', nonce: '" . wp_create_nonce(_SQ_NONCE_ID_) . "'});\" >" . __("Fix it for me!", _SQ_PLUGIN_NAME_) . "</a>";
480
 
481
  /* IF SEO INDEX IS OFF */
482
  if (self::getAutoSeoSquirrly()) {
483
- self::$errors_count ++;
484
  if (!$count_only) {
485
  SQ_Error::setError(__('Activate the Squirrly SEO for your blog (recommended)', _SQ_PLUGIN_NAME_) . " <br />" . sprintf($fixit, "jQuery('#sq_use_on').trigger('click');", "sq_fixautoseo") . "", 'settings', 'sq_fix_auto');
486
  }
@@ -491,7 +601,7 @@ class SQ_Tools extends SQ_FrontController {
491
  if (self::$source_code <> '') {
492
  /* IF TITLE DUPLICATES */
493
  if (self::getDuplicateTitle()) {
494
- self::$errors_count ++;
495
  if (!$count_only) {
496
  SQ_Error::setError(__('You have META Title Duplicates. Disable the Squirrly Title Optimization or disable the other SEO Plugins', _SQ_PLUGIN_NAME_) . " <br />" . sprintf($fixit, "jQuery('#sq_auto_title0').attr('checked', true); jQuery('#sq_automatically').attr('checked', true);", "sq_fix_titleduplicate") . "", 'settings', 'sq_fix_descduplicate');
497
  }
@@ -499,7 +609,7 @@ class SQ_Tools extends SQ_FrontController {
499
 
500
  /* IF DESCRIPTION DUPLICATES */
501
  if (self::getDuplicateDescription()) {
502
- self::$errors_count ++;
503
  if (!$count_only) {
504
  SQ_Error::setError(__('You have META Description Duplicates. Disable the Squirrly Description Optimization or disable the other SEO Plugins', _SQ_PLUGIN_NAME_) . " <br />" . sprintf($fixit, "jQuery('#sq_auto_description0').attr('checked', true); jQuery('#sq_automatically').attr('checked', true);", "sq_fix_descduplicate") . "", 'settings', 'sq_fix_descduplicate');
505
  }
@@ -507,7 +617,7 @@ class SQ_Tools extends SQ_FrontController {
507
 
508
  /* IF OG DUPLICATES */
509
  if (self::getDuplicateOG()) {
510
- self::$errors_count ++;
511
  if (!$count_only) {
512
  SQ_Error::setError(__('You have Open Graph META Duplicates. Disable the Squirrly SEO Open Graph or disable the other SEO Plugins', _SQ_PLUGIN_NAME_) . " <br />" . sprintf($fixit, "jQuery('#sq_auto_facebook0').attr('checked', true);", "sq_fix_ogduplicate") . "", 'settings', 'sq_fix_ogduplicate');
513
  }
@@ -515,7 +625,7 @@ class SQ_Tools extends SQ_FrontController {
515
 
516
  /* IF TWITTER CARD DUPLICATES */
517
  if (self::getDuplicateTC()) {
518
- self::$errors_count ++;
519
  if (!$count_only) {
520
  SQ_Error::setError(__('You have Twitter Card META Duplicates. Disable the Squirrly SEO Twitter Card or disable the other SEO Plugins', _SQ_PLUGIN_NAME_) . " <br />" . sprintf($fixit, "jQuery('#sq_auto_twitter0').attr('checked', true);", "sq_fix_tcduplicate") . "", 'settings', 'sq_fix_tcduplicate');
521
  }
@@ -550,9 +660,10 @@ class SQ_Tools extends SQ_FrontController {
550
  * Check if the automatically seo si active
551
  * @return bool
552
  */
553
- private static function getAutoSeoSquirrly() {
 
554
  if (isset(self::$options['sq_use']))
555
- return ((int) self::$options['sq_use'] == 0 );
556
 
557
  return true;
558
  }
@@ -561,7 +672,8 @@ class SQ_Tools extends SQ_FrontController {
561
  * Check for META duplicates
562
  * @return boolean
563
  */
564
- private static function getDuplicateOG() {
 
565
  if (!function_exists('preg_match_all')) {
566
  return false;
567
  }
@@ -583,7 +695,8 @@ class SQ_Tools extends SQ_FrontController {
583
  * Check for META duplicates
584
  * @return boolean
585
  */
586
- private static function getDuplicateTC() {
 
587
  if (!function_exists('preg_match_all')) {
588
  return false;
589
  }
@@ -605,7 +718,8 @@ class SQ_Tools extends SQ_FrontController {
605
  * Check for META duplicates
606
  * @return boolean
607
  */
608
- private static function getDuplicateDescription() {
 
609
  if (!function_exists('preg_match_all')) {
610
  return false;
611
  }
@@ -631,7 +745,8 @@ class SQ_Tools extends SQ_FrontController {
631
  * Check for META duplicates
632
  * @return boolean
633
  */
634
- private static function getDuplicateTitle() {
 
635
  if (!function_exists('preg_match_all')) {
636
  return false;
637
  }
@@ -657,15 +772,17 @@ class SQ_Tools extends SQ_FrontController {
657
  * Check if the blog is in private mode
658
  * @return bool
659
  */
660
- public static function getPrivateBlog() {
661
- return ((int) get_option('blog_public') == 0 );
 
662
  }
663
 
664
  /**
665
  * Check if the blog has a bad link structure
666
  * @return bool
667
  */
668
- private static function getBadLinkStructure() {
 
669
  global $wp_rewrite;
670
  if (function_exists('apache_get_modules')) {
671
  //Check if mod_rewrite is installed in apache
@@ -689,7 +806,8 @@ class SQ_Tools extends SQ_FrontController {
689
  * @param string $in
690
  * @return string $in localized
691
  */
692
- public static function i18n($in) {
 
693
  if (function_exists('langswitch_filter_langs_with_message')) {
694
  $in = langswitch_filter_langs_with_message($in);
695
  }
@@ -710,13 +828,15 @@ class SQ_Tools extends SQ_FrontController {
710
  * @param int $decimals Precision of the number of decimal places.
711
  * @return string Converted number in string format.
712
  */
713
- public static function i18n_number_format($number, $decimals = 0) {
 
714
  global $wp_locale;
715
  $formatted = number_format($number, absint($decimals), $wp_locale->number_format['decimal_point'], $wp_locale->number_format['thousands_sep']);
716
  return apply_filters('number_format_i18n', $formatted);
717
  }
718
 
719
- public static function getBrowserInfo() {
 
720
  $ub = '';
721
  $u_agent = $_SERVER['HTTP_USER_AGENT'];
722
  $bname = 'Unknown';
@@ -781,44 +901,61 @@ class SQ_Tools extends SQ_FrontController {
781
  * @param string $url
782
  * @return array
783
  */
784
- public static function getSnippet($url) {
785
- if ($url == '' || !function_exists('preg_match'))
 
786
  return;
 
 
787
  $snippet = array();
788
- $length = array('title' => 66,
789
- 'description' => 240,
790
- 'url' => 45);
 
 
 
 
 
 
 
 
 
 
791
 
792
- self::$source_code = self::sq_remote_get($url, array(), array('timeout' => 10, 'followlocation' => true));
793
 
794
- $title_regex = "/<title[^>]*>([^<>]*)<\/title>/si";
795
- preg_match($title_regex, self::$source_code, $title);
796
 
797
- if (is_array($title) && count($title) > 0) {
798
- $snippet['title'] = $title[1];
799
- $snippet['title'] = self::i18n(trim(strip_tags($snippet['title'])));
800
- }
801
 
802
- $description_regex = '/<meta[^>]*(name|property)=["\']description["\'][^>]*content="([^"<>]+)"[^<>]*>/si';
803
- preg_match($description_regex, self::$source_code, $description);
804
- if (is_array($description) && count($description) > 0) {
805
- $snippet['description'] = self::i18n(trim(strip_tags($description[2])));
806
 
807
- if (strlen($snippet['description']) > $length['description'])
808
- $snippet['description'] = substr($snippet['description'], 0, ($length['description'] - 1)) . '...';
809
- }
810
 
811
- $snippet['url'] = $url;
812
- if (strlen($snippet['url']) > $length['url'])
813
- $snippet['url'] = substr($snippet['url'], 0, ($length['url'] - 1)) . '...';
 
 
814
 
815
  return $snippet;
 
816
  }
817
 
818
  /**
819
  * Check if debug is called
820
  */
821
- private function checkDebug() {
 
822
  //if debug is called
823
  if (self::getIsset('sq_debug')) {
824
  if (self::getValue('sq_debug') == self::$options['sq_api']) {
@@ -838,7 +975,8 @@ class SQ_Tools extends SQ_FrontController {
838
  /**
839
  * Store the debug for a later view
840
  */
841
- public static function dump() {
 
842
  if (self::getValue('sq_debug') !== 'on') {
843
  return;
844
  }
@@ -854,26 +992,26 @@ class SQ_Tools extends SQ_FrontController {
854
 
855
  $run_time = number_format(microtime(true) - REQUEST_TIME, 3);
856
  if (function_exists('debug_backtrace'))
857
- list( $callee ) = debug_backtrace();
858
 
859
  $output .= '<fieldset style="background: #FFFFFF; border: 1px #CCCCCC solid; padding: 5px; font-size: 9pt; margin: 0;">';
860
  $output .= '<legend style="background: #EEEEEE; padding: 2px; font-size: 8pt;">' . $callee['file'] . ' Time: ' . $run_time . ' @ line: ' . $callee['line']
861
- . '</legend><pre style="margin: 0; font-size: 8pt; text-align: left;">';
862
 
863
  $i = 0;
864
  foreach ($arguments as $argument) {
865
  if (count($arguments) > 1)
866
- $output .= "\n" . '<strong>#' . ( ++$i ) . ' of ' . $total_arguments . '</strong>: ';
867
 
868
  // if argument is boolean, false value does not display, so ...
869
  if (is_bool($argument))
870
- $argument = ( $argument ) ? 'TRUE' : 'FALSE';
871
  else
872
- if (is_object($argument) && function_exists('array_reverse') && function_exists('class_parents'))
873
- $output .= implode("\n" . '|' . "\n", array_reverse(class_parents($argument))) . "\n" . '|' . "\n";
874
 
875
  $output .= htmlspecialchars(print_r($argument, TRUE))
876
- . ( ( is_object($argument) && function_exists('spl_object_hash') ) ? spl_object_hash($argument) : '' );
877
  }
878
  $output .= "</pre>";
879
  $output .= "</fieldset>";
@@ -884,25 +1022,30 @@ class SQ_Tools extends SQ_FrontController {
884
  /**
885
  * Show the debug dump
886
  */
887
- public static function showDebug() {
 
 
888
  echo "Debug result: <br />" . '<div id="wpcontent">' . @implode('<br />', self::$debug) . '</div>';
889
 
890
  $run_time = number_format(microtime(true) - REQUEST_TIME, 3);
891
  $pps = number_format(1 / $run_time, 0);
892
  $memory_avail = ini_get('memory_limit');
893
- $memory_used = number_format(memory_get_usage(true) / ( 1024 * 1024 ), 2);
894
- $memory_peak = number_format(memory_get_peak_usage(true) / ( 1024 * 1024 ), 2);
895
 
896
  echo PHP_EOL . " Load: {$memory_avail} (avail) / {$memory_used}M (used) / {$memory_peak}M (peak)";
897
  echo " | Time: {$run_time}s | {$pps} req/sec";
 
898
  }
899
 
900
- public function sq_activate() {
 
901
  set_transient('sq_activate', true);
902
  set_transient('sq_rewrite', true);
903
  }
904
 
905
- public function sq_deactivate() {
 
906
  //clear the cron job
907
  wp_clear_scheduled_hook('sq_processCron');
908
 
@@ -910,12 +1053,13 @@ class SQ_Tools extends SQ_FrontController {
910
  $args['type'] = 'deact';
911
  SQ_Action::apiCall('sq/user/log', $args, 5);
912
 
913
- remove_filter('rewrite_rules_array', array(SQ_ObjController::getBlock('SQ_BlockSettingsSeo'), 'rewrite_rules'), 999, 1);
914
  global $wp_rewrite;
915
  $wp_rewrite->flush_rules();
916
  }
917
 
918
- public static function emptyCache($post_id = null) {
 
919
  if (function_exists('w3tc_pgcache_flush')) {
920
  w3tc_pgcache_flush();
921
  }
@@ -932,7 +1076,8 @@ class SQ_Tools extends SQ_FrontController {
932
  }
933
  }
934
 
935
- public static function checkUpgrade() {
 
936
  if (self::$options['sq_ver'] == 0 || self::$options['sq_ver'] < SQ_VERSION_ID) {
937
  //Delete the old versions table
938
  global $wpdb;
@@ -943,6 +1088,9 @@ class SQ_Tools extends SQ_FrontController {
943
  $wpdb->query("UPDATE " . $wpdb->postmeta . " SET `meta_key` = '_sq_post_keyword' WHERE `meta_key` = 'sq_post_keyword'");
944
 
945
  self::saveOptions('sq_ver', SQ_VERSION_ID);
 
 
 
946
  }
947
  }
948
 
5
  *
6
  * @author Squirrly
7
  */
8
+ class SQ_Tools extends SQ_FrontController
9
+ {
10
 
11
  /** @var array Saved options in database */
12
  public static $options = array();
18
  private static $debug;
19
  private static $source_code;
20
 
21
+ public function __construct()
22
+ {
23
  parent::__construct();
24
 
25
  self::$options = $this->getOptions();
27
  $this->checkDebug(); //dev mode
28
  }
29
 
30
+ public static function getUserID()
31
+ {
32
  global $current_user;
33
  return $current_user->ID;
34
  }
38
  *
39
  * @return void
40
  */
41
+ function hookInit()
42
+ {
43
  //TinyMCE editor required
44
  //set_user_setting('editor', 'tinymce');
45
 
56
  * @param type $file
57
  * @return array
58
  */
59
+ public function hookActionlink($links, $file)
60
+ {
61
  if ($file == _SQ_PLUGIN_NAME_ . '/squirrly.php') {
62
  $link = '<a href="' . admin_url('admin.php?page=sq_dashboard') . '">' . __('Getting started', _SQ_PLUGIN_NAME_) . '</a>';
63
  array_unshift($links, $link);
71
  *
72
  * @return void
73
  */
74
+ public static function getOptions()
75
+ {
76
  $default = array(
77
  'sq_ver' => 0,
78
  'sq_api' => '',
85
  // --
86
  'sq_auto_canonical' => 1,
87
  'sq_auto_sitemap' => 0,
88
+ 'sq_auto_feed' => 0,
89
  'sq_auto_jsonld' => 0,
90
  'sq_jsonld_type' => 'Organization',
91
  'sq_jsonld' => array(
124
  'sitemap-custom-post' => array('sitemap-custom-posts.xml', 0),
125
  ),
126
  'sq_auto_robots' => 1,
127
+ 'sq_robots_permission' => array(
128
  'User-agent: *',
129
  'Disallow: */trackback/',
130
  'Disallow: */xmlrpc.php',
131
  'Disallow: /wp-*.php',
132
  'Disallow: /cgi-bin/',
133
  'Disallow: /wp-admin/',
134
+ 'Allow: */wp-content/uploads/',),
 
135
  'sq_auto_meta' => 1,
136
  'sq_auto_favicon' => 0,
137
  'favicon' => '',
138
  'sq_auto_twitter' => 0,
139
+ 'sq_auto_twittersize' => 'summary',
140
  'sq_auto_facebook' => 0,
141
  'sq_og_locale' => 'en_US',
142
  'sq_twitter_account' => '',
187
  return $default;
188
  }
189
 
190
+ public static function getBriefOptions()
191
+ {
192
  if ($pageId = get_option('page_on_front')) {
193
  $title = SQ_ObjController::getModel('SQ_Frontend')->getAdvancedMeta($pageId, 'title');
194
  $description = SQ_ObjController::getModel('SQ_Frontend')->getAdvancedMeta($pageId, 'description');
211
  'sq_auto_twitter' => SQ_Tools::$options['sq_auto_twitter'],
212
  'sq_auto_facebook' => SQ_Tools::$options['sq_auto_facebook'],
213
  'sq_auto_seo' => SQ_Tools::$options['sq_auto_seo'],
214
+ 'sq_auto_title' => (int)(SQ_Tools::$options['sq_auto_title'] == 1 && $title <> ''),
215
+ 'sq_auto_description' => (int)(SQ_Tools::$options['sq_auto_description'] == 1 && $description <> ''),
216
+ 'sq_google_plus' => (int)(SQ_Tools::$options['sq_google_plus'] <> ''),
217
+ 'sq_google_wt' => (int)(SQ_Tools::$options['sq_google_wt'] <> ''),
218
+ 'sq_google_analytics' => (int)(SQ_Tools::$options['sq_google_analytics'] <> ''),
219
+ 'sq_facebook_insights' => (int)(SQ_Tools::$options['sq_facebook_insights'] <> ''),
220
+ 'sq_bing_wt' => (int)(SQ_Tools::$options['sq_bing_wt'] <> ''),
221
+ 'sq_pinterest' => (int)(SQ_Tools::$options['sq_pinterest'] <> ''),
222
+ 'sq_alexa' => (int)(SQ_Tools::$options['sq_alexa'] <> ''),
223
  'sq_keyword_help' => SQ_Tools::$options['sq_keyword_help'],
224
  'sq_keyword_information' => SQ_Tools::$options['sq_keyword_information'],
225
  'sq_google_country_strict' => SQ_Tools::$options['sq_google_country_strict'],
233
  *
234
  * @return void
235
  */
236
+ public static function saveOptions($key = null, $value = '')
237
+ {
238
  if (isset($key)) {
239
  self::$options[$key] = $value;
240
  }
246
  * Set the header type
247
  * @param type $type
248
  */
249
+ public static function setHeader($type)
250
+ {
251
  if (SQ_Tools::getValue('sq_debug') == 'on')
252
  return;
253
 
275
  * @param mixed $defaultValue (optional)
276
  * @return mixed Value
277
  */
278
+ public static function getValue($key, $defaultValue = false, $withcode = false)
279
+ {
280
+ if (!isset($key) OR empty($key) OR !is_string($key))
281
  return false;
282
+ $ret = (isset($_POST[$key]) ? (is_string($_POST[$key]) ? urldecode($_POST[$key]) : $_POST[$key]) : (isset($_GET[$key]) ? (is_string($_GET[$key]) ? urldecode($_GET[$key]) : $_GET[$key]) : $defaultValue));
283
 
284
  if (is_string($ret) === true && $withcode === false) {
285
  $ret = sanitize_text_field($ret);
294
  * @param string $key
295
  * @return boolean
296
  */
297
+ public static function getIsset($key)
298
+ {
299
+ if (!isset($key) OR empty($key) OR !is_string($key))
300
  return false;
301
  return isset($_POST[$key]) ? true : (isset($_GET[$key]) ? true : false);
302
  }
306
  *
307
  * @return void
308
  */
309
+ public static function showNotices($message, $type = 'sq_notices')
310
+ {
311
  if (file_exists(_SQ_THEME_DIR_ . 'SQ_notices.php')) {
312
  ob_start();
313
+ include(_SQ_THEME_DIR_ . 'SQ_notices.php');
314
  $message = ob_get_contents();
315
  ob_end_clean();
316
  }
321
  /**
322
  * Load the multilanguage support from .mo
323
  */
324
+ private function loadMultilanguage()
325
+ {
326
  if (!defined('WP_PLUGIN_DIR')) {
327
  load_plugin_textdomain(_SQ_PLUGIN_NAME_, _SQ_PLUGIN_NAME_ . '/languages/');
328
  } else {
333
  /**
334
  * Connect remote with CURL if exists
335
  */
336
+ public static function sq_remote_get($url, $param = array(), $options = array())
337
+ {
338
  $parameters = '';
339
  $cookies = array();
340
  $cookie_string = '';
341
 
342
  $url_domain = parse_url($url);
343
+ if (isset($url_domain['host'])) {
344
+ $url_domain = $url_domain['host'];
345
+ } else {
346
+ $url_domain = '';
347
+ }
348
 
349
+ if (isset($param)) {
350
  foreach ($param as $key => $value) {
351
+ if (isset($key) && $key <> '' && $key <> 'timeout') {
352
  $parameters .= ($parameters == "" ? "" : "&") . $key . "=" . $value;
353
+ }
354
  }
355
+ }
356
+
357
+ if ($parameters <> '') {
358
  $url .= ((strpos($url, "?") === false) ? "?" : "&") . $parameters;
359
+ }
360
 
361
  //send the cookie for preview
362
+ $server_domain = '';
363
+ if (isset($_SERVER['HTTP_HOST'])) {
364
+ $server_domain = $_SERVER['HTTP_HOST'];
365
+ } elseif (isset($_SERVER['SERVER_NAME'])) {
366
+ $server_domain = $_SERVER['SERVER_NAME'];
367
+ }
368
+
369
+ if ($url_domain == $server_domain && strpos($url, 'preview=true') !== false) {
370
  foreach ($_COOKIE as $name => $value) {
371
  if (strpos($name, 'wordpress') !== false || strpos($name, 'wp') !== false || strpos($name, 'slimstat') !== false || strpos($name, 'sforum') !== false) {
372
  $cookies[] = new WP_Http_Cookie(array('name' => $name, 'value' => $value));
382
  }
383
  $options['sslverify'] = false;
384
 
385
+ if (!$response = self::sq_wpcall($url, $options, 'get')) {
386
  if (function_exists('curl_init') && !ini_get('safe_mode') && !ini_get('open_basedir')) {
387
+ $response = self::sq_curl($url, $options, 'get');
388
+ } else {
389
+ return false;
390
+ }
391
+ }
392
+
393
+ return $response;
394
+ }
395
+
396
+ /**
397
+ * Connect remote with CURL if exists
398
+ */
399
+ public static function sq_remote_post($url, $param = array(), $options = array())
400
+ {
401
+ $parameters = '';
402
+ $cookies = array();
403
+ $cookie_string = '';
404
+
405
+ $url_domain = parse_url($url);
406
+ if (isset($url_domain['host'])) {
407
+ $url_domain = $url_domain['host'];
408
+ } else {
409
+ $url_domain = '';
410
+ }
411
+
412
+ if (isset($param)) {
413
+ foreach ($param as $key => $value) {
414
+ if (isset($key) && $key <> '' && $key <> 'timeout') {
415
+ $parameters .= ($parameters == "" ? "" : "&") . $key . "=" . $value;
416
+ }
417
+ }
418
+ }
419
+
420
+ if ($parameters <> '') {
421
+ $url .= ((strpos($url, "?") === false) ? "?" : "&") . $parameters;
422
+ }
423
+
424
+ //send the cookie for preview
425
+ $server_domain = '';
426
+ if (isset($_SERVER['HTTP_HOST'])) {
427
+ $server_domain = $_SERVER['HTTP_HOST'];
428
+ } elseif (isset($_SERVER['SERVER_NAME'])) {
429
+ $server_domain = $_SERVER['SERVER_NAME'];
430
+ }
431
+
432
+ if ($url_domain == $server_domain && strpos($url, 'preview=true') !== false) {
433
+ foreach ($_COOKIE as $name => $value) {
434
+ $cookies[] = new WP_Http_Cookie(array('name' => $name, 'value' => $value));
435
+ $cookie_string .= "$name=$value;";
436
+ }
437
+ }
438
+
439
+ $options['timeout'] = (isset($options['timeout'])) ? $options['timeout'] : 30;
440
+ if (!isset($options['cookie_string'])) {
441
+ $options['cookies'] = $cookies;
442
+ $options['cookie_string'] = $cookie_string;
443
+ }
444
+ $options['sslverify'] = false;
445
+
446
+ if (!$response = self::sq_wpcall($url, $options, 'post')) {
447
+ if (function_exists('curl_init') && !ini_get('safe_mode') && !ini_get('open_basedir')) {
448
+ $response = self::sq_curl($url, $options, 'post');
449
  } else {
450
  return false;
451
  }
460
  * @param array $param
461
  * @return string
462
  */
463
+ private static function sq_curl($url, $options, $method = 'get')
464
+ {
465
 
466
  $ch = curl_init();
467
  curl_setopt($ch, CURLOPT_URL, $url);
468
  curl_setopt($ch, CURLOPT_HEADER, false);
469
  //--
470
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
471
+
472
  //--
473
  curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
474
  curl_setopt($ch, CURLOPT_TIMEOUT, $options['timeout']);
475
 
476
+ if ($method == 'post') {
477
+ curl_setopt($ch, CURLOPT_POST, 1);
478
+ }
479
+
480
+ if (isset($options['sslverify'])) {
481
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
482
+ } else {
483
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
484
+ }
485
+
486
  if (isset($options['followlocation'])) {
487
  curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
488
  curl_setopt($ch, CURLOPT_MAXREDIRS, 1);
498
  $response = curl_exec($ch);
499
  $response = self::cleanResponce($response);
500
 
501
+ self::dump('CURL', $method, $url, $options, $ch, $response); //output debug
502
 
503
  if (curl_errno($ch) == 1 || $response === false) { //if protocol not supported
504
  if (curl_errno($ch)) {
519
  * @param array $param
520
  * @return string
521
  */
522
+ private static function sq_wpcall($url, $options, $method = 'get')
523
+ {
524
+ if ($method == 'post') {
525
+ $response = wp_remote_post($url, $options);
526
+ } else {
527
+ $response = wp_remote_get($url, $options);
528
+ }
529
  if (is_wp_error($response)) {
530
  self::dump($response);
531
  return false;
532
  }
533
 
534
  $response = self::cleanResponce(wp_remote_retrieve_body($response)); //clear and get the body
535
+ self::dump('wp_remote_get', $method, $url, $options, $response); //output debug
536
  return $response;
537
  }
538
 
539
  /**
540
  * Connect remote with CURL if exists
541
  */
542
+ public static function sq_remote_head($url)
543
+ {
544
  $response = array();
545
 
546
  if (function_exists('curl_exec')) {
566
  * @param string $response
567
  * @return string
568
  */
569
+ private static function cleanResponce($response)
570
+ {
571
 
572
  if (function_exists('substr_count'))
573
  if (substr_count($response, '(') > 1)
582
  /**
583
  * Check for SEO blog bad settings
584
  */
585
+ public static function checkErrorSettings($count_only = false)
586
+ {
587
  if (current_user_can('manage_options')) {
588
 
589
  $fixit = "<a href=\"javascript:void(0);\" onclick=\"%s jQuery(this).closest('div').fadeOut('slow'); if(parseInt(jQuery('.sq_count').html())>0) { var notif = (parseInt(jQuery('.sq_count').html()) - 1); if (notif > 0) {jQuery('.sq_count').html(notif); }else{ jQuery('.sq_count').html(notif); jQuery('.sq_count').hide(); } } jQuery.post(ajaxurl, { action: '%s', nonce: '" . wp_create_nonce(_SQ_NONCE_ID_) . "'});\" >" . __("Fix it for me!", _SQ_PLUGIN_NAME_) . "</a>";
590
 
591
  /* IF SEO INDEX IS OFF */
592
  if (self::getAutoSeoSquirrly()) {
593
+ self::$errors_count++;
594
  if (!$count_only) {
595
  SQ_Error::setError(__('Activate the Squirrly SEO for your blog (recommended)', _SQ_PLUGIN_NAME_) . " <br />" . sprintf($fixit, "jQuery('#sq_use_on').trigger('click');", "sq_fixautoseo") . "", 'settings', 'sq_fix_auto');
596
  }
601
  if (self::$source_code <> '') {
602
  /* IF TITLE DUPLICATES */
603
  if (self::getDuplicateTitle()) {
604
+ self::$errors_count++;
605
  if (!$count_only) {
606
  SQ_Error::setError(__('You have META Title Duplicates. Disable the Squirrly Title Optimization or disable the other SEO Plugins', _SQ_PLUGIN_NAME_) . " <br />" . sprintf($fixit, "jQuery('#sq_auto_title0').attr('checked', true); jQuery('#sq_automatically').attr('checked', true);", "sq_fix_titleduplicate") . "", 'settings', 'sq_fix_descduplicate');
607
  }
609
 
610
  /* IF DESCRIPTION DUPLICATES */
611
  if (self::getDuplicateDescription()) {
612
+ self::$errors_count++;
613
  if (!$count_only) {
614
  SQ_Error::setError(__('You have META Description Duplicates. Disable the Squirrly Description Optimization or disable the other SEO Plugins', _SQ_PLUGIN_NAME_) . " <br />" . sprintf($fixit, "jQuery('#sq_auto_description0').attr('checked', true); jQuery('#sq_automatically').attr('checked', true);", "sq_fix_descduplicate") . "", 'settings', 'sq_fix_descduplicate');
615
  }
617
 
618
  /* IF OG DUPLICATES */
619
  if (self::getDuplicateOG()) {
620
+ self::$errors_count++;
621
  if (!$count_only) {
622
  SQ_Error::setError(__('You have Open Graph META Duplicates. Disable the Squirrly SEO Open Graph or disable the other SEO Plugins', _SQ_PLUGIN_NAME_) . " <br />" . sprintf($fixit, "jQuery('#sq_auto_facebook0').attr('checked', true);", "sq_fix_ogduplicate") . "", 'settings', 'sq_fix_ogduplicate');
623
  }
625
 
626
  /* IF TWITTER CARD DUPLICATES */
627
  if (self::getDuplicateTC()) {
628
+ self::$errors_count++;
629
  if (!$count_only) {
630
  SQ_Error::setError(__('You have Twitter Card META Duplicates. Disable the Squirrly SEO Twitter Card or disable the other SEO Plugins', _SQ_PLUGIN_NAME_) . " <br />" . sprintf($fixit, "jQuery('#sq_auto_twitter0').attr('checked', true);", "sq_fix_tcduplicate") . "", 'settings', 'sq_fix_tcduplicate');
631
  }
660
  * Check if the automatically seo si active
661
  * @return bool
662
  */
663
+ private static function getAutoSeoSquirrly()
664
+ {
665
  if (isset(self::$options['sq_use']))
666
+ return ((int)self::$options['sq_use'] == 0);
667
 
668
  return true;
669
  }
672
  * Check for META duplicates
673
  * @return boolean
674
  */
675
+ private static function getDuplicateOG()
676
+ {
677
  if (!function_exists('preg_match_all')) {
678
  return false;
679
  }
695
  * Check for META duplicates
696
  * @return boolean
697
  */
698
+ private static function getDuplicateTC()
699
+ {
700
  if (!function_exists('preg_match_all')) {
701
  return false;
702
  }
718
  * Check for META duplicates
719
  * @return boolean
720
  */
721
+ private static function getDuplicateDescription()
722
+ {
723
  if (!function_exists('preg_match_all')) {
724
  return false;
725
  }
745
  * Check for META duplicates
746
  * @return boolean
747
  */
748
+ private static function getDuplicateTitle()
749
+ {
750
  if (!function_exists('preg_match_all')) {
751
  return false;
752
  }
772
  * Check if the blog is in private mode
773
  * @return bool
774
  */
775
+ public static function getPrivateBlog()
776
+ {
777
+ return ((int)get_option('blog_public') == 0);
778
  }
779
 
780
  /**
781
  * Check if the blog has a bad link structure
782
  * @return bool
783
  */
784
+ private static function getBadLinkStructure()
785
+ {
786
  global $wp_rewrite;
787
  if (function_exists('apache_get_modules')) {
788
  //Check if mod_rewrite is installed in apache
806
  * @param string $in
807
  * @return string $in localized
808
  */
809
+ public static function i18n($in)
810
+ {
811
  if (function_exists('langswitch_filter_langs_with_message')) {
812
  $in = langswitch_filter_langs_with_message($in);
813
  }
828
  * @param int $decimals Precision of the number of decimal places.
829
  * @return string Converted number in string format.
830
  */
831
+ public static function i18n_number_format($number, $decimals = 0)
832
+ {
833
  global $wp_locale;
834
  $formatted = number_format($number, absint($decimals), $wp_locale->number_format['decimal_point'], $wp_locale->number_format['thousands_sep']);
835
  return apply_filters('number_format_i18n', $formatted);
836
  }
837
 
838
+ public static function getBrowserInfo()
839
+ {
840
  $ub = '';
841
  $u_agent = $_SERVER['HTTP_USER_AGENT'];
842
  $bname = 'Unknown';
901
  * @param string $url
902
  * @return array
903
  */
904
+ public static function getSnippet($url)
905
+ {
906
+ if ($url == '' || !function_exists('preg_match')) {
907
  return;
908
+ }
909
+
910
  $snippet = array();
911
+ $frontend = SQ_ObjController::getModel('SQ_Frontend');
912
+
913
+ $postid = url_to_postid($url);
914
+ if ($postid > 0) {
915
+ $frontend->setPost(get_post($postid));
916
+ $snippet['title'] = $frontend->getTitle();
917
+ $snippet['description'] = $frontend->getDescription();
918
+ $snippet['url'] = $url;
919
+ self::dump($snippet);
920
+ } else {
921
+ $length = array('title' => 66,
922
+ 'description' => 240,
923
+ 'url' => 45);
924
 
925
+ self::$source_code = self::sq_remote_get($url, array(), array('timeout' => 10, 'followlocation' => true));
926
 
927
+ $title_regex = "/<title[^>]*>([^<>]*)<\/title>/si";
928
+ preg_match($title_regex, self::$source_code, $title);
929
 
930
+ if (is_array($title) && count($title) > 0) {
931
+ $snippet['title'] = $title[1];
932
+ $snippet['title'] = self::i18n(trim(strip_tags($snippet['title'])));
933
+ }
934
 
935
+ $description_regex = '/<meta[^>]*(name|property)=["\']description["\'][^>]*content="([^"<>]+)"[^<>]*>/si';
936
+ preg_match($description_regex, self::$source_code, $description);
937
+ if (is_array($description) && count($description) > 0) {
938
+ $snippet['description'] = self::i18n(trim(strip_tags($description[2])));
939
 
940
+ if (strlen($snippet['description']) > $length['description'])
941
+ $snippet['description'] = substr($snippet['description'], 0, ($length['description'] - 1)) . '...';
942
+ }
943
 
944
+ $snippet['url'] = $url;
945
+ if (strlen($snippet['url']) > $length['url'])
946
+ $snippet['url'] = substr($snippet['url'], 0, ($length['url'] - 1)) . '...';
947
+
948
+ }
949
 
950
  return $snippet;
951
+
952
  }
953
 
954
  /**
955
  * Check if debug is called
956
  */
957
+ private function checkDebug()
958
+ {
959
  //if debug is called
960
  if (self::getIsset('sq_debug')) {
961
  if (self::getValue('sq_debug') == self::$options['sq_api']) {
975
  /**
976
  * Store the debug for a later view
977
  */
978
+ public static function dump()
979
+ {
980
  if (self::getValue('sq_debug') !== 'on') {
981
  return;
982
  }
992
 
993
  $run_time = number_format(microtime(true) - REQUEST_TIME, 3);
994
  if (function_exists('debug_backtrace'))
995
+ list($callee) = debug_backtrace();
996
 
997
  $output .= '<fieldset style="background: #FFFFFF; border: 1px #CCCCCC solid; padding: 5px; font-size: 9pt; margin: 0;">';
998
  $output .= '<legend style="background: #EEEEEE; padding: 2px; font-size: 8pt;">' . $callee['file'] . ' Time: ' . $run_time . ' @ line: ' . $callee['line']
999
+ . '</legend><pre style="margin: 0; font-size: 8pt; text-align: left;">';
1000
 
1001
  $i = 0;
1002
  foreach ($arguments as $argument) {
1003
  if (count($arguments) > 1)
1004
+ $output .= "\n" . '<strong>#' . (++$i) . ' of ' . $total_arguments . '</strong>: ';
1005
 
1006
  // if argument is boolean, false value does not display, so ...
1007
  if (is_bool($argument))
1008
+ $argument = ($argument) ? 'TRUE' : 'FALSE';
1009
  else
1010
+ if (is_object($argument) && function_exists('array_reverse') && function_exists('class_parents'))
1011
+ $output .= implode("\n" . '|' . "\n", array_reverse(class_parents($argument))) . "\n" . '|' . "\n";
1012
 
1013
  $output .= htmlspecialchars(print_r($argument, TRUE))
1014
+ . ((is_object($argument) && function_exists('spl_object_hash')) ? spl_object_hash($argument) : '');
1015
  }
1016
  $output .= "</pre>";
1017
  $output .= "</fieldset>";
1022
  /**
1023
  * Show the debug dump
1024
  */
1025
+ public static function showDebug()
1026
+ {
1027
+ global $wp_query;
1028
  echo "Debug result: <br />" . '<div id="wpcontent">' . @implode('<br />', self::$debug) . '</div>';
1029
 
1030
  $run_time = number_format(microtime(true) - REQUEST_TIME, 3);
1031
  $pps = number_format(1 / $run_time, 0);
1032
  $memory_avail = ini_get('memory_limit');
1033
+ $memory_used = number_format(memory_get_usage(true) / (1024 * 1024), 2);
1034
+ $memory_peak = number_format(memory_get_peak_usage(true) / (1024 * 1024), 2);
1035
 
1036
  echo PHP_EOL . " Load: {$memory_avail} (avail) / {$memory_used}M (used) / {$memory_peak}M (peak)";
1037
  echo " | Time: {$run_time}s | {$pps} req/sec";
1038
+ echo "<pre>" . print_r($wp_query, true) . "</pre>";
1039
  }
1040
 
1041
+ public function sq_activate()
1042
+ {
1043
  set_transient('sq_activate', true);
1044
  set_transient('sq_rewrite', true);
1045
  }
1046
 
1047
+ public function sq_deactivate()
1048
+ {
1049
  //clear the cron job
1050
  wp_clear_scheduled_hook('sq_processCron');
1051
 
1053
  $args['type'] = 'deact';
1054
  SQ_Action::apiCall('sq/user/log', $args, 5);
1055
 
1056
+ remove_filter('rewrite_rules_array', array(SQ_ObjController::getBlock('SQ_BlockSettingsSeo'), 'rewrite_rules'));
1057
  global $wp_rewrite;
1058
  $wp_rewrite->flush_rules();
1059
  }
1060
 
1061
+ public static function emptyCache($post_id = null)
1062
+ {
1063
  if (function_exists('w3tc_pgcache_flush')) {
1064
  w3tc_pgcache_flush();
1065
  }
1076
  }
1077
  }
1078
 
1079
+ public static function checkUpgrade()
1080
+ {
1081
  if (self::$options['sq_ver'] == 0 || self::$options['sq_ver'] < SQ_VERSION_ID) {
1082
  //Delete the old versions table
1083
  global $wpdb;
1088
  $wpdb->query("UPDATE " . $wpdb->postmeta . " SET `meta_key` = '_sq_post_keyword' WHERE `meta_key` = 'sq_post_keyword'");
1089
 
1090
  self::saveOptions('sq_ver', SQ_VERSION_ID);
1091
+
1092
+ global $wp_rewrite;
1093
+ $wp_rewrite->flush_rules();
1094
  }
1095
  }
1096
 
controllers/SQ_Feed.php ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class for Sitemap Generator
5
+ */
6
+ class SQ_Feed extends SQ_FrontController {
7
+ /* @var string post limit */
8
+
9
+ var $posts_limit = 10000;
10
+
11
+ public function __construct() {
12
+ parent::__construct();
13
+ add_filter('template_redirect', array($this, 'hookPreventRedirect'), 1, 0);
14
+ }
15
+
16
+ public function hookPreventRedirect() {
17
+ global $wp_query;
18
+ if (!empty($wp_query->query_vars["feed"])) {
19
+ $wp_query->is_404 = false;
20
+ $wp_query->is_feed = true;
21
+
22
+ add_filter('feed_content_type', array($this, 'feedHeader'), 10, 2);
23
+ add_action('rss_tag_pre', array($this, 'feedStyle'));
24
+ add_action('rss2_head', array($this, 'feedCss'));
25
+ add_filter('the_content', array($this, 'addFeedMedia'));
26
+ }
27
+ }
28
+
29
+ public function feedCss() {
30
+ echo "\t" . '<feedcss>' . _SQ_THEME_URL_ . 'css/' . 'sq_feed.css</feedcss>' . "\n";
31
+ }
32
+
33
+ public function feedStyle() {
34
+ echo '<?xml-stylesheet type="text/xsl" href="' . _SQ_THEME_URL_ . 'css/' . 'sq_feed.xsl' . '"?>';
35
+ }
36
+
37
+ public function feedHeader($content_type, $type) {
38
+ if (empty($type)) {
39
+ $type = get_default_feed();
40
+ }
41
+
42
+ $types = array(
43
+ 'rss' => ' text/xml',
44
+ 'rss2' => ' text/xml'
45
+ );
46
+ $content_type = (!empty($types[$type]) ) ? $types[$type] : $content_type;
47
+
48
+ return $content_type;
49
+ }
50
+
51
+ public function addFeedMedia($content) {
52
+ global $post;
53
+ if (has_post_thumbnail($post->ID)) {
54
+ $attachment = get_post(get_post_thumbnail_id($post->ID));
55
+ $thumb = wp_get_attachment_image_src($attachment->ID, 'large');
56
+ $content = '<div class="thumbnail">
57
+ <a href="' . get_permalink($post->ID) . '">
58
+ <img src="' . esc_url($thumb[0]) . '" alt="' . get_the_title($post->ID) . '">
59
+ </a>
60
+ </div>' . $content;
61
+ }
62
+ return $content;
63
+ }
64
+
65
+ function featuredtoRSS($content) {
66
+ global $post;
67
+ if (has_post_thumbnail($post->ID)) {
68
+ $content = '<div>' . get_the_post_thumbnail($post->ID, 'medium') . '</div>' . $content;
69
+ }
70
+ return $content;
71
+ }
72
+
73
+ public function refreshSitemap($new_status, $old_status, $post) {
74
+ if ($old_status <> $new_status && $new_status = 'publish') {
75
+ if (SQ_Tools::$options['sq_sitemap_ping'] == 1) {
76
+ wp_schedule_single_event(time() + 5, 'sq_processPing');
77
+ }
78
+ }
79
+ }
80
+
81
+ }
controllers/SQ_Frontend.php CHANGED
@@ -6,24 +6,38 @@ class SQ_Frontend extends SQ_FrontController {
6
 
7
  public function __construct() {
8
 
9
- if ($this->_isAjax())
10
  return;
 
11
 
12
  parent::__construct();
13
  SQ_ObjController::getController('SQ_Tools', false);
14
 
15
-
16
  if (SQ_Tools::$options['sq_use'] == 1) {
17
  /* Check if sitemap is on */
18
  if (SQ_Tools::$options['sq_auto_sitemap'] == 1) {
19
  /* Load the Sitemap */
 
20
  SQ_ObjController::getController('SQ_Sitemaps');
21
  }
22
 
 
 
 
 
 
23
  //validate custom arguments for favicon and sitemap
24
  add_filter('query_vars', array($this, 'validateParams'), 1, 1);
25
- add_action('template_redirect', array($this, 'startBuffer'), 10);
26
 
 
 
 
 
 
 
 
 
 
27
 
28
  if (SQ_Tools::$options['sq_url_fix'] == 1) {
29
  add_action('the_content', array($this, 'fixFeedLinks'), 11);
@@ -31,6 +45,15 @@ class SQ_Frontend extends SQ_FrontController {
31
  }
32
  }
33
 
 
 
 
 
 
 
 
 
 
34
  private function _isAjax() {
35
  if (isset($_SERVER['PHP_SELF']) && strpos($_SERVER['PHP_SELF'], '/admin-ajax.php') !== false)
36
  return true;
@@ -38,16 +61,18 @@ class SQ_Frontend extends SQ_FrontController {
38
  return false;
39
  }
40
 
41
- public function startBuffer() {
42
- if ($this->_isAjax()) {
43
- return;
44
- }
45
 
46
- if (SQ_Tools::$options['sq_use'] == 1) {
47
- add_filter('sq_title', array($this->model, 'clearTitle'));
48
- add_filter('sq_description', array($this->model, 'clearDescription'));
49
- //Use buffer only for meta Title
50
- $this->model->startBuffer();
 
 
51
  }
52
  }
53
 
@@ -68,26 +93,6 @@ class SQ_Frontend extends SQ_FrontController {
68
  }
69
  }
70
 
71
- /**
72
- * Hook the Header load
73
- */
74
- public function hookFronthead() {
75
- if ($this->_isAjax())
76
- return;
77
-
78
- echo $this->model->setStart();
79
-
80
- if (SQ_Tools::$options['sq_use'] == 1) {
81
- //flush the header with the title and removing duplicates
82
- $this->model->flushHeader();
83
- //show the Squirrly header
84
- echo $this->model->setHeader();
85
- }
86
-
87
- SQ_ObjController::getController('SQ_DisplayController', false)
88
- ->loadMedia(_SQ_THEME_URL_ . 'css/sq_frontend.css');
89
- }
90
-
91
  /**
92
  * Change the image path to absolute when in feed
93
  */
@@ -122,12 +127,16 @@ class SQ_Frontend extends SQ_FrontController {
122
  }
123
  }
124
  }
125
- if (!is_array($urls) || (is_array($urls) && empty($urls)))
126
  return $content;
 
127
 
 
128
  foreach ($urls as $url) {
129
- $find[] = $url;
130
- $replace[] = get_bloginfo('url') . $url;
 
 
131
  }
132
  if (!empty($find) && !empty($replace)) {
133
  $content = str_replace($find, $replace, $content);
@@ -144,34 +153,46 @@ class SQ_Frontend extends SQ_FrontController {
144
  * @return $vars
145
  */
146
  public function validateParams($vars) {
147
- $vars[] = 'sq_get';
148
- $vars[] = 'sq_size';
 
149
  return $vars;
150
  }
151
 
152
  public function action() {
 
 
 
153
 
154
- switch (get_query_var('sq_get')) {
155
- case 'favicon':
156
- if (SQ_Tools::$options['favicon'] <> '') {
157
- //show the favico file
158
- SQ_Tools::setHeader('ico');
159
- readfile(_SQ_CACHE_DIR_ . SQ_Tools::$options['favicon']);
160
- exit();
161
- }
162
- break;
163
- case 'touchicon':
164
- $size = get_query_var('sq_size');
165
- if (SQ_Tools::$options['favicon'] <> '') {
166
- //show the favico file
167
- SQ_Tools::setHeader('png');
168
- if ($size <> '') {
169
- readfile(_SQ_CACHE_DIR_ . SQ_Tools::$options['favicon'] . get_query_var('sq_size'));
170
- } else {
171
  readfile(_SQ_CACHE_DIR_ . SQ_Tools::$options['favicon']);
 
172
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
173
  exit();
174
- }
 
175
  }
176
  }
177
 
6
 
7
  public function __construct() {
8
 
9
+ if ($this->_isAjax()) {
10
  return;
11
+ }
12
 
13
  parent::__construct();
14
  SQ_ObjController::getController('SQ_Tools', false);
15
 
 
16
  if (SQ_Tools::$options['sq_use'] == 1) {
17
  /* Check if sitemap is on */
18
  if (SQ_Tools::$options['sq_auto_sitemap'] == 1) {
19
  /* Load the Sitemap */
20
+ add_filter('rewrite_rules_array', array($this, 'rewrite_rules'), 1, 1);
21
  SQ_ObjController::getController('SQ_Sitemaps');
22
  }
23
 
24
+ if (SQ_Tools::$options['sq_auto_feed'] == 1) {
25
+ /* Load the Feed Style */
26
+ SQ_ObjController::getController('SQ_Feed');
27
+ }
28
+
29
  //validate custom arguments for favicon and sitemap
30
  add_filter('query_vars', array($this, 'validateParams'), 1, 1);
 
31
 
32
+ if (!$this->_isAjax()) {
33
+ add_filter('sq_title', array($this->model, 'clearTitle'));
34
+ add_filter('sq_description', array($this->model, 'clearDescription'));
35
+
36
+ add_action('plugins_loaded', array($this->model, 'startBuffer'));
37
+ //flush the header with the title and removing duplicates
38
+ add_action('wp_head', array($this->model, 'flushHeader'),99);
39
+ add_action('shutdown', array($this->model, 'flushHeader'));
40
+ }
41
 
42
  if (SQ_Tools::$options['sq_url_fix'] == 1) {
43
  add_action('the_content', array($this, 'fixFeedLinks'), 11);
45
  }
46
  }
47
 
48
+ public function rewrite_rules($wp_rewrite) {
49
+ if (SQ_Tools::$options['sq_auto_sitemap'] == 1) {
50
+ foreach (SQ_Tools::$options['sq_sitemap'] as $name => $sitemap) {
51
+ $rules[preg_quote($sitemap[0]) . '$'] = 'index.php?sq_feed=' . $name;
52
+ }
53
+ }
54
+ return array_merge($rules, $wp_rewrite);
55
+ }
56
+
57
  private function _isAjax() {
58
  if (isset($_SERVER['PHP_SELF']) && strpos($_SERVER['PHP_SELF'], '/admin-ajax.php') !== false)
59
  return true;
61
  return false;
62
  }
63
 
64
+ /**
65
+ * Hook the Header load
66
+ */
67
+ public function hookFronthead() {
68
 
69
+ if (!$this->_isAjax()) {
70
+ if (SQ_Tools::$options['sq_use'] == 1) {
71
+ echo $this->model->setStartTag();
72
+ }
73
+
74
+ SQ_ObjController::getController('SQ_DisplayController', false)
75
+ ->loadMedia(_SQ_THEME_URL_ . 'css/sq_frontend.css');
76
  }
77
  }
78
 
93
  }
94
  }
95
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
  /**
97
  * Change the image path to absolute when in feed
98
  */
127
  }
128
  }
129
  }
130
+ if (!is_array($urls) || (is_array($urls) && empty($urls))) {
131
  return $content;
132
+ }
133
 
134
+ $urls = array_unique($urls);
135
  foreach ($urls as $url) {
136
+ $find[] = "'" . $url . "'";
137
+ $replace[] = "'" . esc_url(get_bloginfo('url') . $url) . "'";
138
+ $find[] = '"' . $url . '"';
139
+ $replace[] = '"' . esc_url(get_bloginfo('url') . $url) . '"';
140
  }
141
  if (!empty($find) && !empty($replace)) {
142
  $content = str_replace($find, $replace, $content);
153
  * @return $vars
154
  */
155
  public function validateParams($vars) {
156
+ array_push($vars, 'sq_feed');
157
+ array_push($vars, 'sq_get');
158
+ array_push($vars, 'sq_size');
159
  return $vars;
160
  }
161
 
162
  public function action() {
163
+ global $wp_query;
164
+ if (!empty($wp_query->query_vars["sq_get"])) {
165
+ $wp_query->is_404 = false;
166
 
167
+
168
+ switch (get_query_var('sq_get')) {
169
+ case 'favicon':
170
+ if (SQ_Tools::$options['favicon'] <> '') {
171
+ //show the favico file
172
+ SQ_Tools::setHeader('ico');
 
 
 
 
 
 
 
 
 
 
 
173
  readfile(_SQ_CACHE_DIR_ . SQ_Tools::$options['favicon']);
174
+ exit();
175
  }
176
+ break;
177
+ case 'touchicon':
178
+ $size = get_query_var('sq_size');
179
+ if (SQ_Tools::$options['favicon'] <> '') {
180
+ //show the favico file
181
+ SQ_Tools::setHeader('png');
182
+ if ($size <> '') {
183
+ readfile(_SQ_CACHE_DIR_ . SQ_Tools::$options['favicon'] . get_query_var('sq_size'));
184
+ } else {
185
+ readfile(_SQ_CACHE_DIR_ . SQ_Tools::$options['favicon']);
186
+ }
187
+ exit();
188
+ }
189
+ break;
190
+
191
+ case 'feedcss':
192
+ readfile(_SQ_THEME_DIR_ . 'css/' . 'sq_feed.css');
193
  exit();
194
+ break;
195
+ }
196
  }
197
  }
198
 
controllers/SQ_Post.php CHANGED
@@ -1,6 +1,7 @@
1
  <?php
2
 
3
- class SQ_Post extends SQ_FrontController {
 
4
 
5
  public $saved;
6
 
@@ -9,7 +10,8 @@ class SQ_Post extends SQ_FrontController {
9
  *
10
  * @return void
11
  */
12
- public function hookInit() {
 
13
  $this->saved = array();
14
 
15
  add_filter('tiny_mce_before_init', array($this->model, 'setCallback'));
@@ -19,7 +21,7 @@ class SQ_Post extends SQ_FrontController {
19
  if (SQ_Tools::$options['sq_api'] == '')
20
  return;
21
 
22
- add_action('save_post', array($this, 'hookSavePost'), 11);
23
  add_action('shopp_product_saved', array($this, 'hookShopp'), 11);
24
 
25
  if (SQ_Tools::$options['sq_use'] == 1 && SQ_Tools::$options['sq_auto_sitemap'] == 1) {
@@ -32,7 +34,8 @@ class SQ_Post extends SQ_FrontController {
32
  *
33
  * @global integer $post_ID
34
  */
35
- public function hookHead() {
 
36
  global $post_ID;
37
  parent::hookHead();
38
 
@@ -42,10 +45,10 @@ class SQ_Post extends SQ_FrontController {
42
  *
43
  * Set the global variable $sq_postID for cookie and keyword record
44
  */
45
- if ((int) $post_ID == 0) {
46
  if (SQ_Tools::getIsset('id'))
47
- $GLOBALS['sq_postID'] = (int) SQ_Tools::getValue('id');
48
- }else {
49
  $GLOBALS['sq_postID'] = $post_ID;
50
  }
51
  /* * ****************************** */
@@ -56,7 +59,8 @@ class SQ_Post extends SQ_FrontController {
56
  /**
57
  * Hook the Shopp plugin save product
58
  */
59
- public function hookShopp($Product) {
 
60
  $this->checkSeo($Product->id);
61
  }
62
 
@@ -64,20 +68,23 @@ class SQ_Post extends SQ_FrontController {
64
  * Hook the post save/update
65
  * @param type $post_id
66
  */
67
- public function hookSavePost($post_id) {
 
 
68
 
69
- $file_name = false;
70
- if (!isset($this->saved[$post_id]))
71
  $this->saved[$post_id] = false;
 
72
 
73
  // unhook this function so it doesn't loop infinitely
74
- remove_action('save_post', array($this, 'hookSavePost'), 11);
75
  //If the post is a new or edited post
76
  if ((SQ_Tools::getValue('action')) == 'editpost' &&
77
- wp_is_post_autosave($post_id) == '' &&
78
- get_post_status($post_id) != 'auto-draft' &&
79
- get_post_status($post_id) != 'inherit' &&
80
- SQ_Tools::getValue('autosave') == '') {
 
81
 
82
  if ($this->saved[$post_id] === false) {
83
  //check for custom SEO
@@ -91,7 +98,7 @@ class SQ_Post extends SQ_FrontController {
91
  }
92
 
93
 
94
- add_action('save_post', array($this, 'hookSavePost'), 11);
95
  }
96
 
97
  /**
@@ -100,7 +107,8 @@ class SQ_Post extends SQ_FrontController {
100
  * @param integer $post_id
101
  * @return false|void
102
  */
103
- public function checkImage($post_id) {
 
104
 
105
  //if the option to save the images locally is set on
106
  if (SQ_Tools::$options['sq_local_images'] == 1) {
@@ -125,7 +133,8 @@ class SQ_Post extends SQ_FrontController {
125
 
126
  foreach ($out[1] as $row) {
127
  if (strpos($row, '//') !== false &&
128
- strpos($row, $domain['host']) === false) {
 
129
  if (!in_array($row, $urls)) {
130
  $urls[] = $row;
131
  }
@@ -143,6 +152,7 @@ class SQ_Post extends SQ_FrontController {
143
  $time = microtime(true);
144
  foreach ($urls as $url) {
145
  if ($file = $this->model->upload_image($url)) {
 
146
  if (!file_is_valid_image($file['file']))
147
  continue;
148
 
@@ -156,7 +166,7 @@ class SQ_Post extends SQ_FrontController {
156
  'post_content' => urldecode(SQ_Tools::getValue('sq_fp_title', '')),
157
  'post_status' => 'inherit',
158
  'guid' => $local_file
159
- ), $file['file'], $post_id);
160
 
161
  $attach_data = wp_generate_attachment_metadata($attach_id, $file['file']);
162
  wp_update_attachment_metadata($attach_id, $attach_data);
@@ -170,8 +180,8 @@ class SQ_Post extends SQ_FrontController {
170
 
171
  if ($local_file !== false) {
172
  wp_update_post(array(
173
- 'ID' => $post_id,
174
- 'post_content' => $content)
175
  );
176
  }
177
  }
@@ -183,7 +193,8 @@ class SQ_Post extends SQ_FrontController {
183
  * @param integer $post_id
184
  * @param void
185
  */
186
- public function checkSeo($post_id, $status = '') {
 
187
  $args = array();
188
 
189
  $seo = SQ_Tools::getValue('sq_seo');
@@ -197,7 +208,7 @@ class SQ_Post extends SQ_FrontController {
197
  $args['permalink'] = get_permalink($post_id);
198
  $args['permalink'] = $this->getPaged($args['permalink']);
199
  $args['permalink'] = $args['permalink'];
200
- $args['author'] = (int) SQ_Tools::getUserID();
201
  $args['post_id'] = $post_id;
202
 
203
  $process = array();
@@ -220,7 +231,8 @@ class SQ_Post extends SQ_FrontController {
220
  }
221
  }
222
 
223
- public function getPaged($link) {
 
224
  $page = get_query_var('paged');
225
  if ($page && $page > 1) {
226
  $link = trailingslashit($link) . "page/" . "$page" . '/';
@@ -233,7 +245,8 @@ class SQ_Post extends SQ_FrontController {
233
  *
234
  * @return void
235
  */
236
- public function action() {
 
237
  parent::action();
238
 
239
  switch (SQ_Tools::getValue('action')) {
@@ -256,7 +269,7 @@ class SQ_Post extends SQ_FrontController {
256
  'post_content' => '',
257
  'post_status' => 'inherit',
258
  'guid' => $local_file
259
- ), $return['file'], SQ_Tools::getValue('post_id'));
260
 
261
  $attach_data = wp_generate_attachment_metadata($attach_id, $return['file']);
262
  wp_update_attachment_metadata($attach_id, $attach_data);
@@ -285,7 +298,8 @@ class SQ_Post extends SQ_FrontController {
285
  * @return array | false
286
  *
287
  */
288
- private function _checkAdvMeta($post_id) {
 
289
 
290
  $meta = array();
291
  if (SQ_Tools::getIsset('sq_canonical') || SQ_Tools::getIsset('sq_fp_title') || SQ_Tools::getIsset('sq_fp_description') || SQ_Tools::getIsset('sq_fp_keywords')) {
@@ -317,7 +331,8 @@ class SQ_Post extends SQ_FrontController {
317
  return false;
318
  }
319
 
320
- public function hookFooter() {
 
321
  if (!defined('DISABLE_WP_CRON') || DISABLE_WP_CRON == true) {
322
  global $pagenow;
323
  if (in_array($pagenow, array('post.php', 'post-new.php'))) {
@@ -326,7 +341,8 @@ class SQ_Post extends SQ_FrontController {
326
  }
327
  }
328
 
329
- public function processCron() {
 
330
  SQ_ObjController::getController('SQ_Tools', false);
331
  SQ_ObjController::getController('SQ_Action', false);
332
 
1
  <?php
2
 
3
+ class SQ_Post extends SQ_FrontController
4
+ {
5
 
6
  public $saved;
7
 
10
  *
11
  * @return void
12
  */
13
+ public function hookInit()
14
+ {
15
  $this->saved = array();
16
 
17
  add_filter('tiny_mce_before_init', array($this->model, 'setCallback'));
21
  if (SQ_Tools::$options['sq_api'] == '')
22
  return;
23
 
24
+ add_action('save_post', array($this, 'hookSavePost'), 99);
25
  add_action('shopp_product_saved', array($this, 'hookShopp'), 11);
26
 
27
  if (SQ_Tools::$options['sq_use'] == 1 && SQ_Tools::$options['sq_auto_sitemap'] == 1) {
34
  *
35
  * @global integer $post_ID
36
  */
37
+ public function hookHead()
38
+ {
39
  global $post_ID;
40
  parent::hookHead();
41
 
45
  *
46
  * Set the global variable $sq_postID for cookie and keyword record
47
  */
48
+ if ((int)$post_ID == 0) {
49
  if (SQ_Tools::getIsset('id'))
50
+ $GLOBALS['sq_postID'] = (int)SQ_Tools::getValue('id');
51
+ } else {
52
  $GLOBALS['sq_postID'] = $post_ID;
53
  }
54
  /* * ****************************** */
59
  /**
60
  * Hook the Shopp plugin save product
61
  */
62
+ public function hookShopp($Product)
63
+ {
64
  $this->checkSeo($Product->id);
65
  }
66
 
68
  * Hook the post save/update
69
  * @param type $post_id
70
  */
71
+ public function hookSavePost($post_id)
72
+ {
73
+
74
 
75
+ if (!isset($this->saved[$post_id])) {
 
76
  $this->saved[$post_id] = false;
77
+ }
78
 
79
  // unhook this function so it doesn't loop infinitely
80
+ remove_action('save_post', array($this, 'hookSavePost'), 99);
81
  //If the post is a new or edited post
82
  if ((SQ_Tools::getValue('action')) == 'editpost' &&
83
+ wp_is_post_autosave($post_id) == '' &&
84
+ get_post_status($post_id) != 'auto-draft' &&
85
+ get_post_status($post_id) != 'inherit' &&
86
+ SQ_Tools::getValue('autosave') == ''
87
+ ) {
88
 
89
  if ($this->saved[$post_id] === false) {
90
  //check for custom SEO
98
  }
99
 
100
 
101
+ add_action('save_post', array($this, 'hookSavePost'), 99);
102
  }
103
 
104
  /**
107
  * @param integer $post_id
108
  * @return false|void
109
  */
110
+ public function checkImage($post_id)
111
+ {
112
 
113
  //if the option to save the images locally is set on
114
  if (SQ_Tools::$options['sq_local_images'] == 1) {
133
 
134
  foreach ($out[1] as $row) {
135
  if (strpos($row, '//') !== false &&
136
+ strpos($row, $domain['host']) === false
137
+ ) {
138
  if (!in_array($row, $urls)) {
139
  $urls[] = $row;
140
  }
152
  $time = microtime(true);
153
  foreach ($urls as $url) {
154
  if ($file = $this->model->upload_image($url)) {
155
+
156
  if (!file_is_valid_image($file['file']))
157
  continue;
158
 
166
  'post_content' => urldecode(SQ_Tools::getValue('sq_fp_title', '')),
167
  'post_status' => 'inherit',
168
  'guid' => $local_file
169
+ ), $file['file'], $post_id);
170
 
171
  $attach_data = wp_generate_attachment_metadata($attach_id, $file['file']);
172
  wp_update_attachment_metadata($attach_id, $attach_data);
180
 
181
  if ($local_file !== false) {
182
  wp_update_post(array(
183
+ 'ID' => $post_id,
184
+ 'post_content' => $content)
185
  );
186
  }
187
  }
193
  * @param integer $post_id
194
  * @param void
195
  */
196
+ public function checkSeo($post_id, $status = '')
197
+ {
198
  $args = array();
199
 
200
  $seo = SQ_Tools::getValue('sq_seo');
208
  $args['permalink'] = get_permalink($post_id);
209
  $args['permalink'] = $this->getPaged($args['permalink']);
210
  $args['permalink'] = $args['permalink'];
211
+ $args['author'] = (int)SQ_Tools::getUserID();
212
  $args['post_id'] = $post_id;
213
 
214
  $process = array();
231
  }
232
  }
233
 
234
+ public function getPaged($link)
235
+ {
236
  $page = get_query_var('paged');
237
  if ($page && $page > 1) {
238
  $link = trailingslashit($link) . "page/" . "$page" . '/';
245
  *
246
  * @return void
247
  */
248
+ public function action()
249
+ {
250
  parent::action();
251
 
252
  switch (SQ_Tools::getValue('action')) {
269
  'post_content' => '',
270
  'post_status' => 'inherit',
271
  'guid' => $local_file
272
+ ), $return['file'], SQ_Tools::getValue('post_id'));
273
 
274
  $attach_data = wp_generate_attachment_metadata($attach_id, $return['file']);
275
  wp_update_attachment_metadata($attach_id, $attach_data);
298
  * @return array | false
299
  *
300
  */
301
+ private function _checkAdvMeta($post_id)
302
+ {
303
 
304
  $meta = array();
305
  if (SQ_Tools::getIsset('sq_canonical') || SQ_Tools::getIsset('sq_fp_title') || SQ_Tools::getIsset('sq_fp_description') || SQ_Tools::getIsset('sq_fp_keywords')) {
331
  return false;
332
  }
333
 
334
+ public function hookFooter()
335
+ {
336
  if (!defined('DISABLE_WP_CRON') || DISABLE_WP_CRON == true) {
337
  global $pagenow;
338
  if (in_array($pagenow, array('post.php', 'post-new.php'))) {
341
  }
342
  }
343
 
344
+ public function processCron()
345
+ {
346
  SQ_ObjController::getController('SQ_Tools', false);
347
  SQ_ObjController::getController('SQ_Action', false);
348
 
controllers/SQ_PostsList.php CHANGED
@@ -225,6 +225,7 @@ class SQ_PostsList extends SQ_FrontController {
225
  * @return array
226
  */
227
  public function insert($src, $in, $pos) {
 
228
  if (is_int($pos))
229
  $array = array_merge(array_slice($src, 0, $pos), $in, array_slice($src, $pos));
230
  else {
225
  * @return array
226
  */
227
  public function insert($src, $in, $pos) {
228
+ $array = array();
229
  if (is_int($pos))
230
  $array = array_merge(array_slice($src, 0, $pos), $in, array_slice($src, $pos));
231
  else {
controllers/SQ_Sitemaps.php CHANGED
@@ -13,24 +13,20 @@ class SQ_Sitemaps extends SQ_FrontController {
13
 
14
  public function __construct() {
15
  parent::__construct();
16
-
17
- add_filter('request', array($this, 'feedRequest'));
18
  add_filter('user_trailingslashit', array($this, 'untrailingslashit'));
19
  add_action('sq_processPing', array($this, 'processCron'));
20
-
21
  }
22
 
23
- public function feedHeader($content_type, $type) {
24
- if (empty($type))
25
- $type = get_default_feed();
26
- $types = array(
27
- 'rss' => 'application/rss+xml',
28
- 'rss2' => 'application/rss+xml',
29
- 'rss-http' => 'text/xml',
30
- 'atom' => 'application/xml',
31
- 'rdf' => 'application/rdf+xml'
32
- );
33
- $content_type = (!empty($types[$type]) ) ? $types[$type] : 'application/octet-stream';
34
  }
35
 
36
  public function refreshSitemap($new_status, $old_status, $post) {
@@ -47,11 +43,16 @@ class SQ_Sitemaps extends SQ_FrontController {
47
  * @return array
48
  */
49
  public function feedRequest($request) {
 
50
 
51
- if (isset($request['feed']) && strpos($request['feed'], 'sitemap') !== false) {
52
- @ini_set('memory_limit','512M');
 
 
 
 
53
 
54
- $this->model->type = $request['feed'];
55
 
56
  //show products
57
  if ($this->model->type == 'sitemap-product') {
@@ -62,8 +63,7 @@ class SQ_Sitemaps extends SQ_FrontController {
62
 
63
  if (isset(SQ_Tools::$options['sq_sitemap'][$this->model->type]) && SQ_Tools::$options['sq_sitemap'][$this->model->type][1] == 1) {
64
 
65
- add_action('do_feed_' . $request['feed'], array($this, 'showSitemap'));
66
-
67
  //PREPARE CUSTOM QUERIES
68
  switch ($this->model->type) {
69
 
@@ -74,19 +74,24 @@ class SQ_Sitemaps extends SQ_FrontController {
74
  case 'sitemap-category':
75
  case 'sitemap-post_tag':
76
  case 'sitemap-custom-tax':
77
- add_filter("get_terms_fields", array($this, 'customTaxFilter'), 5, 2);
 
 
 
 
 
78
  break;
79
  case 'sitemap-page':
80
- add_filter('pre_get_posts', array($this, 'pageFilter'), 5, 1);
81
  break;
82
  case 'sitemap-author':
83
  add_filter('sq-sitemap-authors', array($this, 'authorFilter'), 5);
84
  break;
85
  case 'sitemap-custom-post':
86
- add_filter('pre_get_posts', array($this, 'customPostFilter'), 5, 1);
87
  break;
88
  case 'sitemap-product':
89
- add_filter('pre_get_posts', array($this, 'productFilter'), 5, 1);
90
  break;
91
  case 'sitemap-archive':
92
  add_filter('sq-sitemap-archive', array($this, 'archiveFilter'), 5);
@@ -96,6 +101,7 @@ class SQ_Sitemaps extends SQ_FrontController {
96
  add_filter('post_limits', array($this, 'setLimits'));
97
  }
98
  }
 
99
  return $request;
100
  }
101
 
@@ -174,7 +180,6 @@ class SQ_Sitemaps extends SQ_FrontController {
174
  * @return string
175
  */
176
  public function showSitemap() {
177
-
178
  switch ($this->model->type) {
179
  case 'sitemap':
180
  $this->showSitemapHeader();
@@ -298,7 +303,7 @@ class SQ_Sitemaps extends SQ_FrontController {
298
  */
299
  public function getXmlUrl($sitemap) {
300
  if (!get_option('permalink_structure')) {
301
- $sitemap = '?feed=' . str_replace('.xml', '', $sitemap);
302
  } else {
303
  if (isset(SQ_Tools::$options['sq_sitemap'][$sitemap])) {
304
  $sitemap = SQ_Tools::$options['sq_sitemap'][$sitemap][0];
@@ -370,7 +375,11 @@ class SQ_Sitemaps extends SQ_FrontController {
370
  return $request; // trailingslashit($request);
371
  }
372
 
373
- function customTaxFilter($query) {
 
 
 
 
374
  global $wpdb;
375
 
376
  $query[] = "(SELECT
@@ -382,17 +391,18 @@ class SQ_Sitemaps extends SQ_FrontController {
382
  return $query;
383
  }
384
 
385
- function pageFilter($query) {
386
  $query->set('post_type', array('page'));
 
387
  }
388
 
389
- function authorFilter() {
390
  //get only the author with posts
391
  add_filter('pre_user_query', array($this, 'userFilter'));
392
  return get_users();
393
  }
394
 
395
- function userFilter($query) {
396
  $query->query_fields .= ',p.lastmod';
397
  $query->query_from .= ' LEFT OUTER JOIN (
398
  SELECT MAX(post_modified) as lastmod, post_author, COUNT(*) as post_count
@@ -403,7 +413,7 @@ class SQ_Sitemaps extends SQ_FrontController {
403
  $query->query_where .= ' AND post_count > 0 ';
404
  }
405
 
406
- function customPostFilter($query) {
407
  $types = get_post_types();
408
  foreach (array('post', 'page', 'attachment', 'revision', 'nav_menu_item', 'product', 'wpsc-product') as $exclude) {
409
  if (in_array($exclude, $types)) {
@@ -424,16 +434,18 @@ class SQ_Sitemaps extends SQ_FrontController {
424
  }
425
 
426
  $query->set('post_type', $types); // id of page or post
 
427
  }
428
 
429
- function productFilter($query) {
430
  if (!$types = SQ_ObjController::getModel('SQ_BlockSettingsSeo')->isEcommerce()) {
431
  $types = array('custom-post');
432
  }
433
  $query->set('post_type', $types); // id of page or post
 
434
  }
435
 
436
- function archiveFilter() {
437
  global $wpdb;
438
  $archives = $wpdb->get_results("
439
  SELECT DISTINCT YEAR(post_date_gmt) as `year`, MONTH(post_date_gmt) as `month`, max(post_date_gmt) as lastmod, count(ID) as posts
13
 
14
  public function __construct() {
15
  parent::__construct();
16
+ add_filter('template_redirect', array($this, 'hookPreventRedirect'), 1, 0);
 
17
  add_filter('user_trailingslashit', array($this, 'untrailingslashit'));
18
  add_action('sq_processPing', array($this, 'processCron'));
 
19
  }
20
 
21
+ public function hookPreventRedirect() {
22
+ global $wp_query;
23
+ if (!empty($wp_query->query_vars["sq_feed"])) {
24
+ $wp_query->is_404 = false;
25
+ $wp_query->is_feed = true;
26
+ $this->feedRequest($wp_query->query_vars);
27
+ $this->showSitemap();
28
+ exit();
29
+ }
 
 
30
  }
31
 
32
  public function refreshSitemap($new_status, $old_status, $post) {
43
  * @return array
44
  */
45
  public function feedRequest($request) {
46
+ global $wp_query;
47
 
48
+ if (!empty($request['feed'])) {
49
+ $request['sq_feed'] = $request['feed'];
50
+ }
51
+
52
+ if (isset($request['sq_feed']) && strpos($request['sq_feed'], 'sitemap') !== false) {
53
+ @ini_set('memory_limit', '512M');
54
 
55
+ $this->model->type = $request['sq_feed'];
56
 
57
  //show products
58
  if ($this->model->type == 'sitemap-product') {
63
 
64
  if (isset(SQ_Tools::$options['sq_sitemap'][$this->model->type]) && SQ_Tools::$options['sq_sitemap'][$this->model->type][1] == 1) {
65
 
66
+ add_action('do_feed_' . $request['sq_feed'], array($this, 'showSitemap'));
 
67
  //PREPARE CUSTOM QUERIES
68
  switch ($this->model->type) {
69
 
74
  case 'sitemap-category':
75
  case 'sitemap-post_tag':
76
  case 'sitemap-custom-tax':
77
+ remove_all_filters('terms_clauses'); //prevent language filters
78
+ add_filter('get_terms_fields', array($this, 'customTaxFilter'), 5, 2);
79
+
80
+ break;
81
+ case 'sitemap-post':
82
+ add_action('parse_query', array($this, 'postFilter'), 99);
83
  break;
84
  case 'sitemap-page':
85
+ add_action('parse_query', array($this, 'pageFilter'), 99);
86
  break;
87
  case 'sitemap-author':
88
  add_filter('sq-sitemap-authors', array($this, 'authorFilter'), 5);
89
  break;
90
  case 'sitemap-custom-post':
91
+ add_action('parse_query', array($this, 'customPostFilter'), 99);
92
  break;
93
  case 'sitemap-product':
94
+ add_action('parse_query', array($this, 'productFilter'), 99);
95
  break;
96
  case 'sitemap-archive':
97
  add_filter('sq-sitemap-archive', array($this, 'archiveFilter'), 5);
101
  add_filter('post_limits', array($this, 'setLimits'));
102
  }
103
  }
104
+
105
  return $request;
106
  }
107
 
180
  * @return string
181
  */
182
  public function showSitemap() {
 
183
  switch ($this->model->type) {
184
  case 'sitemap':
185
  $this->showSitemapHeader();
303
  */
304
  public function getXmlUrl($sitemap) {
305
  if (!get_option('permalink_structure')) {
306
+ $sitemap = '?sq_feed=' . str_replace('.xml', '', $sitemap);
307
  } else {
308
  if (isset(SQ_Tools::$options['sq_sitemap'][$sitemap])) {
309
  $sitemap = SQ_Tools::$options['sq_sitemap'][$sitemap][0];
375
  return $request; // trailingslashit($request);
376
  }
377
 
378
+ public function postFilter(&$query) {
379
+ $query->set('tax_query', array());
380
+ }
381
+
382
+ public function customTaxFilter($query) {
383
  global $wpdb;
384
 
385
  $query[] = "(SELECT
391
  return $query;
392
  }
393
 
394
+ public function pageFilter(&$query) {
395
  $query->set('post_type', array('page'));
396
+ $query->set('tax_query', array());
397
  }
398
 
399
+ public function authorFilter() {
400
  //get only the author with posts
401
  add_filter('pre_user_query', array($this, 'userFilter'));
402
  return get_users();
403
  }
404
 
405
+ public function userFilter($query) {
406
  $query->query_fields .= ',p.lastmod';
407
  $query->query_from .= ' LEFT OUTER JOIN (
408
  SELECT MAX(post_modified) as lastmod, post_author, COUNT(*) as post_count
413
  $query->query_where .= ' AND post_count > 0 ';
414
  }
415
 
416
+ public function customPostFilter(&$query) {
417
  $types = get_post_types();
418
  foreach (array('post', 'page', 'attachment', 'revision', 'nav_menu_item', 'product', 'wpsc-product') as $exclude) {
419
  if (in_array($exclude, $types)) {
434
  }
435
 
436
  $query->set('post_type', $types); // id of page or post
437
+ $query->set('tax_query', array());
438
  }
439
 
440
+ public function productFilter(&$query) {
441
  if (!$types = SQ_ObjController::getModel('SQ_BlockSettingsSeo')->isEcommerce()) {
442
  $types = array('custom-post');
443
  }
444
  $query->set('post_type', $types); // id of page or post
445
+ $query->set('tax_query', array());
446
  }
447
 
448
+ public function archiveFilter() {
449
  global $wpdb;
450
  $archives = $wpdb->get_results("
451
  SELECT DISTINCT YEAR(post_date_gmt) as `year`, MONTH(post_date_gmt) as `month`, max(post_date_gmt) as lastmod, count(ID) as posts
core/SQ_BlockSettingsSeo/SQ_BlockSettingsSeo.php CHANGED
@@ -52,6 +52,7 @@ class SQ_BlockSettingsSeo extends SQ_BlockController {
52
  /////////////////////////////SOCIAL OPTION
53
  SQ_Tools::saveOptions('sq_auto_facebook', (int) SQ_Tools::getValue('sq_auto_facebook'));
54
  SQ_Tools::saveOptions('sq_auto_twitter', (int) SQ_Tools::getValue('sq_auto_twitter'));
 
55
  SQ_Tools::saveOptions('sq_og_locale', SQ_Tools::getValue('sq_og_locale'));
56
 
57
  SQ_Tools::saveOptions('sq_twitter_account', $this->model->checkTwitterAccount(SQ_Tools::getValue('sq_twitter_account')));
@@ -78,15 +79,17 @@ class SQ_BlockSettingsSeo extends SQ_BlockController {
78
 
79
  if (!empty($meta))
80
  SQ_ObjController::getModel('SQ_Post')->saveAdvMeta($pageId, $meta);
81
- }else {
82
- SQ_Tools::saveOptions('sq_fp_title', SQ_Tools::getValue('sq_fp_title'));
83
- SQ_Tools::saveOptions('sq_fp_description', SQ_Tools::getValue('sq_fp_description'));
84
- SQ_Tools::saveOptions('sq_fp_keywords', SQ_Tools::getValue('sq_fp_keywords'));
85
  }
86
 
 
 
 
 
 
87
  ///////////////////////////////////////////
88
  /////////////////////////////SITEMAP OPTION
89
  SQ_Tools::saveOptions('sq_auto_sitemap', (int) SQ_Tools::getValue('sq_auto_sitemap'));
 
90
  SQ_Tools::saveOptions('sq_sitemap_frequency', SQ_Tools::getValue('sq_sitemap_frequency'));
91
  SQ_Tools::saveOptions('sq_sitemap_ping', (int) SQ_Tools::getValue('sq_sitemap_ping'));
92
 
@@ -224,6 +227,7 @@ class SQ_BlockSettingsSeo extends SQ_BlockController {
224
  SQ_Tools::saveOptions('ignore_warn', 1);
225
  break;
226
  case 'sq_get_snippet':
 
227
  if (SQ_Tools::getValue('url') <> '') {
228
  $url = SQ_Tools::getValue('url');
229
  } else {
@@ -295,10 +299,14 @@ class SQ_BlockSettingsSeo extends SQ_BlockController {
295
  if (SQ_Tools::$options['sq_auto_sitemap'] == 1) {
296
  foreach (SQ_Tools::$options['sq_sitemap'] as $name => $sitemap) {
297
  if ($sitemap[1] == 1 || $sitemap[1] == 2) { // is show sitemap
298
- $rules[preg_quote($sitemap[0])] = 'index.php?feed=' . $name;
299
  }
300
  }
301
  }
 
 
 
 
302
  }
303
  return array_merge($rules, $wp_rewrite);
304
  }
52
  /////////////////////////////SOCIAL OPTION
53
  SQ_Tools::saveOptions('sq_auto_facebook', (int) SQ_Tools::getValue('sq_auto_facebook'));
54
  SQ_Tools::saveOptions('sq_auto_twitter', (int) SQ_Tools::getValue('sq_auto_twitter'));
55
+ SQ_Tools::saveOptions('sq_auto_twittersize', SQ_Tools::getValue('sq_auto_twittersize'));
56
  SQ_Tools::saveOptions('sq_og_locale', SQ_Tools::getValue('sq_og_locale'));
57
 
58
  SQ_Tools::saveOptions('sq_twitter_account', $this->model->checkTwitterAccount(SQ_Tools::getValue('sq_twitter_account')));
79
 
80
  if (!empty($meta))
81
  SQ_ObjController::getModel('SQ_Post')->saveAdvMeta($pageId, $meta);
 
 
 
 
82
  }
83
 
84
+ SQ_Tools::saveOptions('sq_fp_title', SQ_Tools::getValue('sq_fp_title'));
85
+ SQ_Tools::saveOptions('sq_fp_description', SQ_Tools::getValue('sq_fp_description'));
86
+ SQ_Tools::saveOptions('sq_fp_keywords', SQ_Tools::getValue('sq_fp_keywords'));
87
+
88
+
89
  ///////////////////////////////////////////
90
  /////////////////////////////SITEMAP OPTION
91
  SQ_Tools::saveOptions('sq_auto_sitemap', (int) SQ_Tools::getValue('sq_auto_sitemap'));
92
+ SQ_Tools::saveOptions('sq_auto_feed', (int) SQ_Tools::getValue('sq_auto_feed'));
93
  SQ_Tools::saveOptions('sq_sitemap_frequency', SQ_Tools::getValue('sq_sitemap_frequency'));
94
  SQ_Tools::saveOptions('sq_sitemap_ping', (int) SQ_Tools::getValue('sq_sitemap_ping'));
95
 
227
  SQ_Tools::saveOptions('ignore_warn', 1);
228
  break;
229
  case 'sq_get_snippet':
230
+
231
  if (SQ_Tools::getValue('url') <> '') {
232
  $url = SQ_Tools::getValue('url');
233
  } else {
299
  if (SQ_Tools::$options['sq_auto_sitemap'] == 1) {
300
  foreach (SQ_Tools::$options['sq_sitemap'] as $name => $sitemap) {
301
  if ($sitemap[1] == 1 || $sitemap[1] == 2) { // is show sitemap
302
+ $rules[preg_quote($sitemap[0])] = 'index.php?sq_feed=' . $name;
303
  }
304
  }
305
  }
306
+
307
+ if (SQ_Tools::$options['sq_auto_feed'] == 1) {
308
+ $rules['sqfeedcss$'] = 'index.php?sq_get=feedcss';
309
+ }
310
  }
311
  return array_merge($rules, $wp_rewrite);
312
  }
models/SQ_BlockPostsAnalytics.php CHANGED
@@ -140,7 +140,6 @@ class Model_SQ_BlockPostsAnalytics extends WP_List_Table {
140
  $query['post__in'] = (array) $post__in;
141
 
142
  wp($query);
143
- //echo '<pre>' . print_r($wp_query, true) . '</pre>';
144
  return $avail_post_stati;
145
  }
146
 
140
  $query['post__in'] = (array) $post__in;
141
 
142
  wp($query);
 
143
  return $avail_post_stati;
144
  }
145
 
models/SQ_BlockSettingsSeo.php CHANGED
@@ -1,11 +1,13 @@
1
  <?php
2
 
3
- class Model_SQ_BlockSettingsSeo {
 
4
 
5
  var $eTypes;
6
  var $appleSizes;
7
 
8
- public function __construct() {
 
9
  $this->appleSizes = preg_split('/[,]+/', _SQ_MOBILE_ICON_SIZES);
10
  }
11
 
@@ -13,7 +15,8 @@ class Model_SQ_BlockSettingsSeo {
13
  * Check if ecommerce is installed
14
  * @return boolean
15
  */
16
- public function isEcommerce() {
 
17
  if (isset($this->eTypes)) {
18
  return $this->eTypes;
19
  }
@@ -38,22 +41,20 @@ class Model_SQ_BlockSettingsSeo {
38
  *
39
  * @return string
40
  */
41
- public function checkGoogleWTCode($code) {
 
42
 
43
  if ($code <> '') {
44
  if (strpos($code, 'content') !== false) {
45
  preg_match('/content\\s*=\\s*[\'\"]([^\'\"]+)[\'\"]/i', $code, $result);
46
- if (isset($result[1]) && !empty($result[1]))
47
- $code = $result[1];
48
  }
49
  if (strpos($code, '"') !== false) {
50
  preg_match('/[\'\"]([^\'\"]+)[\'\"]/i', $code, $result);
51
- if (isset($result[1]) && !empty($result[1]))
52
- $code = $result[1];
53
  }
54
 
55
- if ($code == '')
56
- SQ_Error::setError(__("The code for Google Webmaster Tool is incorrect.", _SQ_PLUGIN_NAME_));
57
  }
58
  return $code;
59
  }
@@ -63,19 +64,18 @@ class Model_SQ_BlockSettingsSeo {
63
  *
64
  * @return string
65
  */
66
- public function checkGoogleAnalyticsCode($code) {
 
67
  //echo $code;
68
  if ($code <> '') {
69
  if (strpos($code, 'GoogleAnalyticsObject') !== false) {
70
  preg_match('/ga\(\'create\',[^\'"]*[\'"]([^\'"]+)[\'"],/i', $code, $result);
71
- if (isset($result[1]) && !empty($result[1]))
72
- $code = $result[1];
73
  }
74
 
75
  if (strpos($code, '"') !== false) {
76
  preg_match('/[\'\"]([^\'\"]+)[\'\"]/i', $code, $result);
77
- if (isset($result[1]) && !empty($result[1]))
78
- $code = $result[1];
79
  }
80
 
81
  if (strpos($code, 'UA-') === false) {
@@ -91,7 +91,8 @@ class Model_SQ_BlockSettingsSeo {
91
  *
92
  * @return string
93
  */
94
- public function checkFavebookInsightsCode($code) {
 
95
  if ($code <> '') {
96
  if (strpos($code, 'content') !== false) {
97
  preg_match('/content\\s*=\\s*[\'\"]([^\'\"]+)[\'\"]/i', $code, $result);
@@ -105,13 +106,18 @@ class Model_SQ_BlockSettingsSeo {
105
  preg_match('/facebook.com\/([^\/]+)/i', $code, $result);
106
  $code = '';
107
  if (isset($result[1]) && !empty($result[1])) {
108
- $json = SQ_Tools::sq_remote_get('http://graph.facebook.com/' . $result[1]);
109
- if ($json <> '') {
110
- if ($json = @json_decode($json)) {
111
- if (isset($json->id)) {
112
- $code = $json->id;
 
 
 
113
  }
114
  }
 
 
115
  }
116
  }
117
  }
@@ -136,22 +142,20 @@ class Model_SQ_BlockSettingsSeo {
136
  *
137
  * @return string
138
  */
139
- public function checkPinterestCode($code) {
 
140
  if ($code <> '') {
141
  if (strpos($code, 'content') !== false) {
142
  preg_match('/content\\s*=\\s*[\'\"]([^\'\"]+)[\'\"]/i', $code, $result);
143
- if (isset($result[1]) && !empty($result[1]))
144
- $code = $result[1];
145
  }
146
 
147
  if (strpos($code, '"') !== false) {
148
  preg_match('/[\'\"]([^\'\"]+)[\'\"]/i', $code, $result);
149
- if (isset($result[1]) && !empty($result[1]))
150
- $code = $result[1];
151
  }
152
 
153
- if ($code == '')
154
- SQ_Error::setError(__("The code for Pinterest is incorrect.", _SQ_PLUGIN_NAME_));
155
  }
156
  return $code;
157
  }
@@ -161,22 +165,20 @@ class Model_SQ_BlockSettingsSeo {
161
  *
162
  * @return string
163
  */
164
- public function checkBingWTCode($code) {
 
165
  if ($code <> '') {
166
  if (strpos($code, 'content') !== false) {
167
  preg_match('/content\\s*=\\s*[\'\"]([^\'\"]+)[\'\"]/i', $code, $result);
168
- if (isset($result[1]) && !empty($result[1]))
169
- $code = $result[1];
170
  }
171
 
172
  if (strpos($code, '"') !== false) {
173
  preg_match('/[\'\"]([^\'\"]+)[\'\"]/i', $code, $result);
174
- if (isset($result[1]) && !empty($result[1]))
175
- $code = $result[1];
176
  }
177
 
178
- if ($code == '')
179
- SQ_Error::setError(__("The code for Bing is incorrect.", _SQ_PLUGIN_NAME_));
180
  }
181
  return $code;
182
  }
@@ -186,7 +188,8 @@ class Model_SQ_BlockSettingsSeo {
186
  *
187
  * @return string
188
  */
189
- public function checkTwitterAccount($account) {
 
190
  if (SQ_ObjController::getModel('SQ_Frontend')->getTwitterAccount($account) === false) {
191
  SQ_Error::setError(__("The twitter account is incorrect", _SQ_PLUGIN_NAME_));
192
  }
@@ -201,7 +204,8 @@ class Model_SQ_BlockSettingsSeo {
201
  *
202
  * @return string
203
  */
204
- public function checkGoogleAccount($account) {
 
205
  if ($account <> '' && strpos($account, 'google.') === false) {
206
  $account = 'https://plus.google.com/' . $account;
207
  }
@@ -213,7 +217,8 @@ class Model_SQ_BlockSettingsSeo {
213
  *
214
  * @return string
215
  */
216
- public function checkLinkeinAccount($account) {
 
217
  if ($account <> '' && strpos($account, 'linkedin.') === false) {
218
  $account = 'https://www.linkedin.com/in/' . $account;
219
  }
@@ -225,7 +230,8 @@ class Model_SQ_BlockSettingsSeo {
225
  *
226
  * @return string
227
  */
228
- public function checkFacebookAccount($account) {
 
229
  if ($account <> '' && strpos($account, 'facebook.com') === false) {
230
  $account = 'https://www.facebook.com/' . $account;
231
  }
@@ -240,7 +246,8 @@ class Model_SQ_BlockSettingsSeo {
240
  * @return array [name (the name of the file), favicon (the path of the ico), message (the returned message)]
241
  *
242
  */
243
- public function addFavicon($file, $path = ABSPATH) {
 
244
 
245
  /* get the file extension */
246
  $file_name = explode('.', $file['name']);
@@ -322,6 +329,7 @@ class Model_SQ_BlockSettingsSeo {
322
  $ico->remove_ico($path . "/" . 'favicon.ico');
323
  }
324
  if (!is_multisite()) {
 
325
  $ico->save_ico($path . "/" . 'favicon.ico');
326
  }
327
  }
@@ -333,19 +341,9 @@ class Model_SQ_BlockSettingsSeo {
333
  }
334
  }
335
 
336
- private function checkFunctions() {
337
- $required_functions = array(
338
- 'getimagesize',
339
- 'imagecreatefromstring',
340
- 'imagecreatetruecolor',
341
- 'imagecolortransparent',
342
- 'imagecolorallocatealpha',
343
- 'imagealphablending',
344
- 'imagesavealpha',
345
- 'imagesx',
346
- 'imagesy',
347
- 'imagecopyresampled',
348
- );
349
 
350
  foreach ($required_functions as $function) {
351
  if (!function_exists($function)) {
1
  <?php
2
 
3
+ class Model_SQ_BlockSettingsSeo
4
+ {
5
 
6
  var $eTypes;
7
  var $appleSizes;
8
 
9
+ public function __construct()
10
+ {
11
  $this->appleSizes = preg_split('/[,]+/', _SQ_MOBILE_ICON_SIZES);
12
  }
13
 
15
  * Check if ecommerce is installed
16
  * @return boolean
17
  */
18
+ public function isEcommerce()
19
+ {
20
  if (isset($this->eTypes)) {
21
  return $this->eTypes;
22
  }
41
  *
42
  * @return string
43
  */
44
+ public function checkGoogleWTCode($code)
45
+ {
46
 
47
  if ($code <> '') {
48
  if (strpos($code, 'content') !== false) {
49
  preg_match('/content\\s*=\\s*[\'\"]([^\'\"]+)[\'\"]/i', $code, $result);
50
+ if (isset($result[1]) && !empty($result[1])) $code = $result[1];
 
51
  }
52
  if (strpos($code, '"') !== false) {
53
  preg_match('/[\'\"]([^\'\"]+)[\'\"]/i', $code, $result);
54
+ if (isset($result[1]) && !empty($result[1])) $code = $result[1];
 
55
  }
56
 
57
+ if ($code == '') SQ_Error::setError(__("The code for Google Webmaster Tool is incorrect.", _SQ_PLUGIN_NAME_));
 
58
  }
59
  return $code;
60
  }
64
  *
65
  * @return string
66
  */
67
+ public function checkGoogleAnalyticsCode($code)
68
+ {
69
  //echo $code;
70
  if ($code <> '') {
71
  if (strpos($code, 'GoogleAnalyticsObject') !== false) {
72
  preg_match('/ga\(\'create\',[^\'"]*[\'"]([^\'"]+)[\'"],/i', $code, $result);
73
+ if (isset($result[1]) && !empty($result[1])) $code = $result[1];
 
74
  }
75
 
76
  if (strpos($code, '"') !== false) {
77
  preg_match('/[\'\"]([^\'\"]+)[\'\"]/i', $code, $result);
78
+ if (isset($result[1]) && !empty($result[1])) $code = $result[1];
 
79
  }
80
 
81
  if (strpos($code, 'UA-') === false) {
91
  *
92
  * @return string
93
  */
94
+ public function checkFavebookInsightsCode($code)
95
+ {
96
  if ($code <> '') {
97
  if (strpos($code, 'content') !== false) {
98
  preg_match('/content\\s*=\\s*[\'\"]([^\'\"]+)[\'\"]/i', $code, $result);
106
  preg_match('/facebook.com\/([^\/]+)/i', $code, $result);
107
  $code = '';
108
  if (isset($result[1]) && !empty($result[1])) {
109
+ if (is_string($result[1])) {
110
+ $html = SQ_Tools::sq_remote_post('http://findmyfbid.com/', array('url' => $result[1]));
111
+ if ($html <> '' && strpos($html, '<code') !== false) {
112
+ $result = array();
113
+ if (preg_match('/<code[^>]*>([0-9]+)<\/code[^>]*>/i', $html, $result)) {
114
+ if (isset($result[1]) && !empty($result[1])) {
115
+ $code = $result[1];
116
+ }
117
  }
118
  }
119
+ } elseif(is_numeric($result[1])) {
120
+ $code = $result[1];
121
  }
122
  }
123
  }
142
  *
143
  * @return string
144
  */
145
+ public function checkPinterestCode($code)
146
+ {
147
  if ($code <> '') {
148
  if (strpos($code, 'content') !== false) {
149
  preg_match('/content\\s*=\\s*[\'\"]([^\'\"]+)[\'\"]/i', $code, $result);
150
+ if (isset($result[1]) && !empty($result[1])) $code = $result[1];
 
151
  }
152
 
153
  if (strpos($code, '"') !== false) {
154
  preg_match('/[\'\"]([^\'\"]+)[\'\"]/i', $code, $result);
155
+ if (isset($result[1]) && !empty($result[1])) $code = $result[1];
 
156
  }
157
 
158
+ if ($code == '') SQ_Error::setError(__("The code for Pinterest is incorrect.", _SQ_PLUGIN_NAME_));
 
159
  }
160
  return $code;
161
  }
165
  *
166
  * @return string
167
  */
168
+ public function checkBingWTCode($code)
169
+ {
170
  if ($code <> '') {
171
  if (strpos($code, 'content') !== false) {
172
  preg_match('/content\\s*=\\s*[\'\"]([^\'\"]+)[\'\"]/i', $code, $result);
173
+ if (isset($result[1]) && !empty($result[1])) $code = $result[1];
 
174
  }
175
 
176
  if (strpos($code, '"') !== false) {
177
  preg_match('/[\'\"]([^\'\"]+)[\'\"]/i', $code, $result);
178
+ if (isset($result[1]) && !empty($result[1])) $code = $result[1];
 
179
  }
180
 
181
+ if ($code == '') SQ_Error::setError(__("The code for Bing is incorrect.", _SQ_PLUGIN_NAME_));
 
182
  }
183
  return $code;
184
  }
188
  *
189
  * @return string
190
  */
191
+ public function checkTwitterAccount($account)
192
+ {
193
  if (SQ_ObjController::getModel('SQ_Frontend')->getTwitterAccount($account) === false) {
194
  SQ_Error::setError(__("The twitter account is incorrect", _SQ_PLUGIN_NAME_));
195
  }
204
  *
205
  * @return string
206
  */
207
+ public function checkGoogleAccount($account)
208
+ {
209
  if ($account <> '' && strpos($account, 'google.') === false) {
210
  $account = 'https://plus.google.com/' . $account;
211
  }
217
  *
218
  * @return string
219
  */
220
+ public function checkLinkeinAccount($account)
221
+ {
222
  if ($account <> '' && strpos($account, 'linkedin.') === false) {
223
  $account = 'https://www.linkedin.com/in/' . $account;
224
  }
230
  *
231
  * @return string
232
  */
233
+ public function checkFacebookAccount($account)
234
+ {
235
  if ($account <> '' && strpos($account, 'facebook.com') === false) {
236
  $account = 'https://www.facebook.com/' . $account;
237
  }
246
  * @return array [name (the name of the file), favicon (the path of the ico), message (the returned message)]
247
  *
248
  */
249
+ public function addFavicon($file, $path = ABSPATH)
250
+ {
251
 
252
  /* get the file extension */
253
  $file_name = explode('.', $file['name']);
329
  $ico->remove_ico($path . "/" . 'favicon.ico');
330
  }
331
  if (!is_multisite()) {
332
+ $ico = SQ_ObjController::getModel('SQ_Ico');
333
  $ico->save_ico($path . "/" . 'favicon.ico');
334
  }
335
  }
341
  }
342
  }
343
 
344
+ private function checkFunctions()
345
+ {
346
+ $required_functions = array('getimagesize', 'imagecreatefromstring', 'imagecreatetruecolor', 'imagecolortransparent', 'imagecolorallocatealpha', 'imagealphablending', 'imagesavealpha', 'imagesx', 'imagesy', 'imagecopyresampled',);
 
 
 
 
 
 
 
 
 
 
347
 
348
  foreach ($required_functions as $function) {
349
  if (!function_exists($function)) {
models/SQ_Frontend.php CHANGED
@@ -54,7 +54,29 @@ class Model_SQ_Frontend {
54
  * @return string
55
  */
56
  public function setStart() {
57
- return "\n\n<!-- Squirrly SEO Plugin " . SQ_VERSION . ", visit: http://www.squirrly.co/ -->\n";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  }
59
 
60
  /**
@@ -98,21 +120,40 @@ class Model_SQ_Frontend {
98
  */
99
  public function flushHeader() {
100
  $buffers = array();
101
- if (function_exists('ob_list_handlers')) {
102
- $buffers = @ob_list_handlers();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
103
  }
104
 
105
- if (sizeof($buffers) > 0 && strtolower($buffers[sizeof($buffers) - 1]) == strtolower(get_class($this) . '::getBuffer')) {
106
- @ob_end_flush();
107
- $buffers = @ob_list_handlers();
108
  }
109
 
110
- if (sizeof($buffers) > 0 && strtolower($buffers[sizeof($buffers) - 1]) == strtolower('All_in_One_SEO_Pack::output_callback_for_title')) {
111
- if (isset($this->buffer)) {
112
- @ob_end_clean();
113
- echo $this->buffer;
114
- }
115
  }
 
 
116
  }
117
 
118
  /**
@@ -120,35 +161,37 @@ class Model_SQ_Frontend {
120
  *
121
  * @return string
122
  */
123
- private function setMetaInBuffer($buffer) {
124
  global $post;
 
125
  //if the title is already shown
126
- if (isset($this->title)) {
127
  return $buffer;
128
  }
129
-
130
  //get the post from shop if woocommerce is installed
131
- if (function_exists('is_shop') && is_shop()) {
132
- $this->post = get_post(woocommerce_get_page_id('shop'));
133
- } elseif (isset($post->ID)) {
134
- $this->post = get_post($post->ID);
 
 
135
  }
136
- if ($this->isHomePage() || is_single() || is_preview() || is_page() || is_archive() || is_author() || is_category() || is_tag() || is_search() || in_array(get_post_type(), $this->post_type)) {
 
 
137
  preg_match("/<head[^>]*>/i", $buffer, $out);
138
  if (!empty($out)) {
139
-
 
 
 
140
  $this->title = $this->getCustomTitle();
141
- if (isset($this->title) && $this->title <> '') {
142
- //replace the existing title
143
- $buffer = @preg_replace('/<title[^<>]*>([^<>]*)<\/title>/si', sprintf("<title>%s</title>", str_replace('$', '\$', $this->title)), $buffer, 1, $count);
144
- if ($count == 0) { //if no title found
145
- $buffer .= sprintf("<title>%s</title>", $this->title) . "\n"; //add the title
146
- }
147
- }
148
 
149
  if ((SQ_Tools::$options['sq_auto_description'] == 1 && $this->isHomePage()) || !$this->isHomePage()) {
150
  //clear the existing description and keywords
151
- $buffer = @preg_replace('/<meta[^>]*(name|property)=["\'](description|keywords)["\'][^>]*content=["\'][^"\'>]*["\'][^>]*>[\n\r]*/si', '', $buffer, -1);
152
  }
153
  if (SQ_Tools::$options['sq_auto_facebook'] == 1) {
154
  $buffer = @preg_replace('/<meta[^>]*(name|property)=["\'](og:|article:)[^"\'>]+["\'][^>]*content=["\'][^"\'>]+["\'][^>]*>[\n\r]*/si', '', $buffer, -1);
@@ -157,14 +200,44 @@ class Model_SQ_Frontend {
157
  $buffer = @preg_replace('/<meta[^>]*(name|property)=["\'](twitter:)[^"\'>]+["\'][^>]*content=["\'][^"\'>]+["\'][^>]*>[\n\r]*/si', '', $buffer, -1);
158
  }
159
 
 
 
 
 
160
  if (SQ_Tools::$options['sq_auto_canonical'] == 1) {
161
- $buffer = @preg_replace('/<link[^>]*rel=[^>]*(canonical|prev|next)[^>]*>[\n\r]*/si', '', $buffer, -1);
162
  }
163
  if (SQ_Tools::$options['sq_auto_jsonld'] == 1) {
164
  $buffer = @preg_replace('/<script[^>]*type=["\']application\/ld\+json["\'][^>]*>[^>]*<\/script>[\n\r]*/si', '', $buffer, -1);
165
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
166
  }
167
  }
 
 
 
 
168
  return $buffer;
169
  }
170
 
@@ -175,87 +248,66 @@ class Model_SQ_Frontend {
175
  *
176
  * @return string
177
  */
178
- public function setHeader() {
179
- global $post;
180
  $ret = '';
 
181
 
182
-
183
- if (!function_exists('preg_replace')) {
184
- return $ret;
 
185
  }
186
 
187
- if ($this->isHomePage() || is_single() || is_page() || is_singular() || is_preview() || is_archive() || is_category() || is_author() || is_tag() || is_search() || in_array(get_post_type(), $this->post_type)) {
188
-
189
- if (!isset($this->post)) {
190
- //get the post from shop if woocommerce is installed
191
- if (function_exists('is_shop') && is_shop()) {
192
- $this->post = get_post(woocommerce_get_page_id('shop'));
193
- } elseif (isset($post->ID)) {
194
- $this->post = get_post($post->ID);
195
- }
196
- }
197
-
198
- $this->meta['blogname'] = get_bloginfo('name');
199
-
200
- /* Meta setting */
201
- $this->url = $this->getCanonicalUrl();
202
- $this->title = $this->getCustomTitle();
203
-
204
- /* Get the thumb image from post */
205
- $this->thumb_images = $this->getImagesFromContent();
206
-
207
- //Add description in homepage if is set or add description in other pages if is not home page
208
- if ((SQ_Tools::$options['sq_auto_description'] == 1 && $this->isHomePage()) || !$this->isHomePage()) {
209
- $ret .= $this->getCustomDescription() . "\n";
210
- $ret .= $this->getCustomKeyword() . "\n";
211
- }
212
-
213
- if (SQ_Tools::$options['sq_auto_canonical'] == 1) {
214
- $ret .= $this->setCanonical();
215
- $ret .= $this->setRelPrevNext();
216
- }
217
 
218
- if (SQ_Tools::$options['sq_auto_sitemap'] == 1) {
219
- $ret .= $this->getXMLSitemap();
220
- }
221
- /* Auto setting */
222
 
223
- if (SQ_Tools::$options['sq_auto_favicon'] == 1) {
224
- $ret .= $this->getFavicon();
225
- }
226
 
227
- if (SQ_Tools::$options['sq_auto_meta'] == 1) {
228
- $ret .= "\n";
229
- $ret .= $this->getGooglePlusMeta();
230
- $ret .= $this->getLanguage();
231
- $ret .= $this->getCopyright();
232
- $ret .= $this->getDublinCore();
233
- }
234
- if (SQ_Tools::$options['sq_auto_facebook'] == 1) {
235
- add_filter('jetpack_enable_opengraph', '__return_false', 99);
236
- $ret .= $this->getOpenGraph() . "\n";
237
- }
238
 
239
- if (SQ_Tools::$options['sq_auto_twitter'] == 1) {
240
- $ret .= $this->getTwitterCard() . "\n";
241
- }
242
- /* SEO optimizer tool */
243
- $ret .= $this->getGoogleWT();
244
- $ret .= $this->getGoogleAnalytics();
245
- $ret .= $this->getFacebookIns();
246
- $ret .= $this->getBingWT();
247
- $ret .= $this->getPinterest();
248
- $ret .= $this->getAlexaT();
249
-
250
- if (SQ_Tools::$options['sq_auto_jsonld'] == 1) {
251
- $ret .= $this->getJsonLD() . "\n";
252
- }
253
 
254
- $ret .= $this->setEnd();
 
255
  }
 
 
256
  return $ret;
257
  }
258
 
 
 
 
 
 
259
  private function getTwitterCard() {
260
  $meta = "\n";
261
 
@@ -267,7 +319,7 @@ class Model_SQ_Frontend {
267
  $sq_twitter_creator = SQ_Tools::$options['sq_twitter_account'];
268
  $sq_twitter_site = SQ_Tools::$options['sq_twitter_account'];
269
 
270
- if (!empty($this->thumb_images)) {
271
  $meta .= '<meta name="twitter:card" content="summary_large_image" />' . "\n";
272
  } else {
273
  $meta .= '<meta name="twitter:card" content="summary" />' . "\n";
@@ -414,13 +466,17 @@ class Model_SQ_Frontend {
414
  return (($meta <> '') ? apply_filters('sq_prevnext_meta', $meta) . "\n" : '');
415
  }
416
 
 
 
 
 
 
417
  /**
418
  * Get the correct title of the article
419
  *
420
  * @return string
421
  */
422
  public function getCustomTitle() {
423
- $title = '';
424
  $sep = ' | ';
425
 
426
  if (isset($this->title)) {
@@ -432,89 +488,88 @@ class Model_SQ_Frontend {
432
  //If is category
433
  if (is_category()) { //for category
434
  $category = get_category(get_query_var('cat'), false);
435
- $title = $category->cat_name;
436
- if ($title == '') {
437
- $title = $this->grabTitleFromPost();
438
  }
439
  if (is_paged()) {
440
- $title .= $sep . __('Page', _SQ_PLUGIN_NAME_) . " " . get_query_var('paged');
441
  }
442
  } elseif (is_author()) { //for author
443
- if ($title == '') {
444
- $title = $this->grabTitleFromPost() . $sep . ucfirst($this->getAuthor('display_name'));
445
  }
446
- if ($title == '') {
447
- $title = __('About') . " " . ucfirst($this->getAuthor('display_name'));
448
  }
449
  if (is_paged()) {
450
- $title .= $sep . __('Page', _SQ_PLUGIN_NAME_) . " " . get_query_var('paged');
451
  }
452
  } elseif (is_tag()) { //for tags
453
  if (is_paged()) {
454
  $tag = get_query_var('tag');
455
- $title = ucfirst(str_replace('-', ' ', $tag)) . $sep . __('Page', _SQ_PLUGIN_NAME_) . " " . get_query_var('paged');
456
  }
457
  } elseif (is_archive()) { //for archive and products
458
  if (isset($this->post) && isset($this->post->ID)) {
459
- $title = $this->grabTitleFromPost($this->post->ID);
460
 
461
  //if woocommerce is installed and is a product category
462
  if (function_exists('is_product_category') && is_product_category()) {
463
  global $wp_query;
464
  $cat = $wp_query->get_queried_object();
465
- if (!empty($cat)) {
466
- $title .= $sep . $cat->name;
467
  }
468
  } else {
469
  $cat = get_the_terms($this->post->ID, 'category');
470
  if (!empty($cat)) {
471
- $title .= $sep . $cat[0]->name;
472
  }
473
  }
474
  }
475
 
476
  if (is_paged()) {
477
- $title .= $sep . __('Page', _SQ_PLUGIN_NAME_) . " " . get_query_var('paged');
478
  }
479
  } elseif (is_single() || is_page() || is_singular() || in_array(get_post_type(), $this->post_type)) {
480
  if (isset($this->post) && isset($this->post->ID)) {
481
  //is a post page
482
- $title = $this->grabTitleFromPost($this->post->ID);
483
 
484
  //if woocommerce is installed and is a product
485
  if (function_exists('is_product') && is_product()) {
486
  $cat = get_the_terms($this->post->ID, 'product_cat');
487
  if (!empty($cat) && count($cat) > 1) {
488
- $title .= $sep . $cat[0]->name;
489
  }
490
  }
491
  }
492
  }
493
- }
494
 
495
- //If title then clear it and truncate it
496
- if ($title <> '') {
497
- $title = $this->truncate($title, $this->min_title_length, $this->max_title_length);
498
- }
499
-
500
- /* Check if is a predefined Title for home page */
501
- if ($this->isHomePage() &&
502
- SQ_Tools::$options ['sq_auto_title'] == 1) {
503
 
504
  //If the home page is a static page that has custom snippet
505
  if (is_page() && isset($this->post) && isset($this->post->ID) && $this->getAdvancedMeta($this->post->ID, 'title') <> '') {
506
- $title = $this->getAdvancedMeta($this->post->ID, 'title');
507
  } elseif (SQ_Tools::$options['sq_fp_title'] <> '') {
508
- $title = SQ_Tools::$options['sq_fp_title'];
509
  } else {
510
- $title = $this->grabTitleFromPost();
511
- if ($title <> "" && $this->meta['blogname'] <> '') {
512
- $title .= $sep . $this->meta ['blogname'];
 
 
 
 
513
  }
514
  }
515
  }
516
-
517
- return apply_filters('sq_title', $title);
518
  }
519
 
520
  public function clearTitle($title) {
@@ -611,16 +666,15 @@ class Model_SQ_Frontend {
611
  }
612
  $videos[] = esc_url($match[0]);
613
  }
614
- //fast.wistia.net/embed/iframe/{code}
615
- //http://fwd4.wistia.com/medias/84ddsijns7
616
- preg_match('/(?:http(?:s)?:\/\/)?(?:fast\.wistia\.net\/(?:embed)\/(?:iframe)\/)([^\?&\"\'>\s]+)/si', $post->post_content, $match);
617
 
618
- if (isset($match[0])) {
619
- if (strpos($match[0], '//') !== false && strpos($match[0], 'http') === false) {
620
- $match[0] = 'http:' . $match[0];
621
- }
622
- $videos[] = esc_url($match[0]);
623
- }
 
 
624
 
625
  preg_match('/(?:http(?:s)?:\/\/)?(?:fwd4\.wistia\.com\/(?:medias)\/)([^\?&\"\'>\s]+)/si', $post->post_content, $match);
626
 
@@ -628,6 +682,11 @@ class Model_SQ_Frontend {
628
  $videos[] = esc_url('http://fast.wistia.net/embed/iframe/' . $match[1]);
629
  }
630
 
 
 
 
 
 
631
 
632
  preg_match('/src=["|\']([^"\']*(.mpg|.mpeg|.mp4|.mov|.wmv|.asf|.avi|.ra|.ram|.rm|.flv)["|\'])/i', $post->post_content, $match);
633
 
@@ -640,12 +699,16 @@ class Model_SQ_Frontend {
640
  return $videos;
641
  }
642
 
 
 
 
 
643
  /**
644
  * Get the description from last/current article
645
  *
646
  * @return string
647
  */
648
- private function getCustomDescription() {
649
 
650
  $sep = ' | ';
651
  $description = '';
@@ -698,7 +761,11 @@ class Model_SQ_Frontend {
698
  global $wp_query;
699
  $cat = $wp_query->get_queried_object();
700
  if (!empty($cat)) {
701
- $description .= $sep . $cat->name;
 
 
 
 
702
  }
703
  } else {
704
  $cat = get_the_terms($this->post->ID, 'category');
@@ -725,11 +792,10 @@ class Model_SQ_Frontend {
725
  }
726
  }
727
  }
728
- }
729
 
730
  /* Check if is a predefined TitleIn Snippet */
731
- if ($this->isHomePage() &&
732
- SQ_Tools::$options['sq_auto_description'] == 1) {
733
 
734
  //If the home page is a static page that has custom snippet
735
  if (is_page() && isset($this->post) && isset($this->post->ID) && $this->getAdvancedMeta($this->post->ID, 'description') <> '') {
@@ -984,12 +1050,17 @@ class Model_SQ_Frontend {
984
  if ($sq_google_analytics <> '') {
985
  SQ_ObjController::getController('SQ_DisplayController', false)
986
  ->loadMedia('https://www.google-analytics.com/analytics.js');
 
987
  return sprintf("<script>
988
- //<![CDATA[
989
- window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
990
- ga('create', '%s', 'auto'); ga('require', 'linkid', 'linkid.js'); ga('send', 'pageview');
991
- //]]>
992
- </script>", $sq_google_analytics) . "\n";
 
 
 
 
993
  }
994
 
995
  return false;
@@ -1068,16 +1139,22 @@ class Model_SQ_Frontend {
1068
  $meta .= '"url": "' . $this->url . '"';
1069
  foreach (SQ_Tools::$options['sq_jsonld'][SQ_Tools::$options['sq_jsonld_type']] as $key => $value) {
1070
  if ($value <> '') {
1071
- if ($key == 'logo') {
1072
- $key = 'image';
1073
- }
1074
  if (SQ_Tools::$options['sq_jsonld_type'] == 'Organization' && $key == 'contactType') {
1075
  continue;
1076
  }
1077
  if (SQ_Tools::$options['sq_jsonld_type'] == 'Organization' && $key == 'telephone') {
1078
  $meta .= $sep . '"contactPoint": {"@type": "ContactPoint", "telephone": "' . $value . '", "contactType": "' . SQ_Tools::$options['sq_jsonld'][SQ_Tools::$options['sq_jsonld_type']]['contactType'] . '"}';
1079
  }
1080
- $meta .= ($meta <> '' ? $sep : '') . '"' . $key . '":"' . $value . '"';
 
 
 
 
 
 
 
 
 
1081
  }
1082
  }
1083
  }
@@ -1097,11 +1174,7 @@ class Model_SQ_Frontend {
1097
  $social .= ($social <> '' ? "," : '') . '"' . SQ_Tools::$options['sq_linkedin_account'] . '"';
1098
  }
1099
 
1100
- $search = $sep . '"potentialAction": {
1101
- "@type": "SearchAction",
1102
- "target": "' . get_bloginfo('url') . '?s={search_string}",
1103
- "query-input": "required name=search_string"
1104
- }';
1105
 
1106
  if ($social <> '') {
1107
  $social = $sep . '"sameAs": [' . $social . ']';
@@ -1111,22 +1184,57 @@ class Model_SQ_Frontend {
1111
  }
1112
  } elseif (is_single()) {
1113
  $meta .= '"@type": "Article"' . $sep;
1114
- if (isset($this->title))
1115
  $meta .= '"name": "' . $this->title . '"' . $sep;
1116
- if (isset($this->description))
 
1117
  $meta .= '"headline": "' . $this->description . '"' . $sep;
 
1118
  $meta .= '"url": "' . $this->url . '"' . $sep;
1119
- if (!empty($this->thumb_images))
 
 
1120
  $meta .= '"thumbnailUrl": "' . $this->thumb_images[0]['src'] . '"' . $sep;
1121
- if (isset($this->post->post_date))
 
1122
  $meta .= '"datePublished": "' . date('c', strtotime($this->post->post_date)) . '"' . $sep;
 
 
 
 
1123
  if (!empty($this->thumb_images)) {
1124
  foreach ($this->thumb_images as $image) {
1125
- $meta .= '"image": "' . $image['src'] . '"' . $sep;
 
 
 
 
 
 
1126
  break;
1127
  }
1128
  }
1129
  $meta .= '"author": {"@type": "Person", "url": "' . $this->getAuthor('user_url') . '", "name": "' . $this->getAuthor('display_name') . '"}' . $sep;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1130
  $meta .= '"keywords": ["' . str_replace(',', '","', $this->grabKeywordsFromPost()) . '"]';
1131
 
1132
  $meta = '{ "@context": "http://schema.org"' . $sep . $meta . '}';
@@ -1287,35 +1395,43 @@ class Model_SQ_Frontend {
1287
  }
1288
 
1289
  if (is_home()) {
1290
- if (SQ_Tools::$options['sq_keywordtag'] == 1) {
1291
- foreach ($wp_query->posts as $post) {
1292
- foreach (wp_get_post_tags($post->ID) as $keyword) {
1293
- $keywords[] = SQ_Tools::i18n($keyword->name);
 
 
 
 
1294
  }
1295
  }
1296
- }
1297
 
1298
- if (sizeof($keywords) > $this->max_keywords) {
1299
- $keywords = array_slice($keywords, 0, $this->max_keywords);
 
1300
  }
1301
  }
1302
  if (count($keywords) <= $this->max_keywords) {
1303
- foreach ($wp_query->posts as $post) {
1304
- $id = (is_attachment()) ? ($post->post_parent) : ($post->ID);
1305
 
1306
- if (SQ_Tools::$options['sq_keywordtag'] == 1) {
1307
- foreach (wp_get_post_tags($id) as $keyword) {
1308
- $keywords[] = SQ_Tools::i18n($keyword->name);
 
 
 
 
1309
  }
1310
- }
1311
  // autometa
1312
- $autometa = stripcslashes(get_post_meta($id, 'autometa', true));
1313
- //$autometa = stripcslashes(get_post_meta($post->ID, "autometa", true));
1314
- if (isset($autometa) && !empty($autometa)) {
1315
-
1316
- $autometa_array = explode(' ', $autometa);
1317
- foreach ($autometa_array as $e) {
1318
- $keywords[] = SQ_Tools::i18n($e);
 
1319
  }
1320
  }
1321
  }
@@ -1462,6 +1578,29 @@ class Model_SQ_Frontend {
1462
  return (is_home() || (isset($wp_query->query) && empty($wp_query->query) && !is_preview()));
1463
  }
1464
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1465
  /**
1466
  * Check if page is shown in front
1467
  *
@@ -1701,8 +1840,8 @@ class Model_SQ_Frontend {
1701
  }
1702
  echo "\n\n";
1703
 
1704
- if (!empty(SQ_Tools::$options['sq_robots_security'])) {
1705
- foreach ((array) SQ_Tools::$options['sq_robots_security'] as $robot_txt)
1706
  echo $robot_txt . "\n";
1707
  }
1708
  echo "\n\n";
54
  * @return string
55
  */
56
  public function setStart() {
57
+ return "\n\n<!-- Squirrly SEO Plugin " . SQ_VERSION . ", visit: http://plugin.squirrly.co/ -->\n";
58
+ }
59
+
60
+ /**
61
+ * Set the line where Squirrly will start the code
62
+ * @return string
63
+ */
64
+ public function setStartTag() {
65
+
66
+ if ($this->is_squirrly()) {
67
+ global $post;
68
+
69
+ if (function_exists('is_shop') && is_shop()) {
70
+ $this->post = get_post(woocommerce_get_page_id('shop'));
71
+ } elseif (isset($post->ID)) {
72
+ $this->post = get_post($post->ID);
73
+ }
74
+
75
+ SQ_Tools::dump('Show Squirrly', 'isHomePage: ' . $this->isHomePage(), 'is_single: ' . is_single(), 'is_preview: ' . is_preview(), 'is_page: ' . is_page(), 'is_archive: ' . is_archive(), 'is_author: ' . is_author(), 'is_category: ' . is_category(), 'is_tag: ' . is_tag(), 'is_search: ' . is_search(), 'in_array: ' . (!empty($this->post_type) && in_array(get_post_type(), $this->post_type)));
76
+ return "<squirrly />";
77
+ } else {
78
+ SQ_Tools::dump('Hide Squirrly');
79
+ }
80
  }
81
 
82
  /**
120
  */
121
  public function flushHeader() {
122
  $buffers = array();
123
+
124
+
125
+ try {
126
+ if (function_exists('ob_list_handlers')) {
127
+ $buffers = @ob_list_handlers();
128
+
129
+ if (sizeof($buffers) > 0) {
130
+ if (is_string($buffers[sizeof($buffers) - 1])) {
131
+ if (strtolower($buffers[sizeof($buffers) - 1]) == strtolower(get_class($this) . '::getBuffer')) {
132
+ @ob_end_flush();
133
+ $buffers = @ob_list_handlers();
134
+ }
135
+ }
136
+ }
137
+ }
138
+ } catch (Exception $ex) {
139
+ //error
140
+ }
141
+ }
142
+
143
+ public function is_squirrly() {
144
+ if (SQ_Tools::getValue('sq_use') == 'off') {
145
+ return false;
146
  }
147
 
148
+ if (!$this->isHtmlHeader()) {
149
+ return false;
 
150
  }
151
 
152
+ if ($this->isHomePage() || is_single() || is_preview() || is_page() || is_archive() || is_author() || is_category() || is_tag() || is_search() || (!empty($this->post_type) && in_array(get_post_type(), $this->post_type))) {
153
+ return true;
 
 
 
154
  }
155
+
156
+ return false;
157
  }
158
 
159
  /**
161
  *
162
  * @return string
163
  */
164
+ public function setMetaInBuffer($buffer) {
165
  global $post;
166
+
167
  //if the title is already shown
168
+ if (isset($this->url)) {
169
  return $buffer;
170
  }
 
171
  //get the post from shop if woocommerce is installed
172
+ if (!isset($this->post)) {
173
+ if (function_exists('is_shop') && is_shop()) {
174
+ $this->post = get_post(woocommerce_get_page_id('shop'));
175
+ } elseif (isset($post->ID)) {
176
+ $this->post = get_post($post->ID);
177
+ }
178
  }
179
+
180
+ if ($this->is_squirrly()) {
181
+
182
  preg_match("/<head[^>]*>/i", $buffer, $out);
183
  if (!empty($out)) {
184
+ $this->meta['blogname'] = get_bloginfo('name');
185
+ //Get the url
186
+ $this->url = $this->getCanonicalUrl();
187
+ //Get the title
188
  $this->title = $this->getCustomTitle();
189
+ /* Get the thumb image from post */
190
+ $this->thumb_images = $this->getImagesFromContent();
 
 
 
 
 
191
 
192
  if ((SQ_Tools::$options['sq_auto_description'] == 1 && $this->isHomePage()) || !$this->isHomePage()) {
193
  //clear the existing description and keywords
194
+ $buffer = @preg_replace('/<meta[^>]*(name|property)=["\'](description|keywords)["\'][^>]*content=["\'][^"\'>]*["\'][^>]*>[\n\r]*/si', '', $buffer, -1, $count);
195
  }
196
  if (SQ_Tools::$options['sq_auto_facebook'] == 1) {
197
  $buffer = @preg_replace('/<meta[^>]*(name|property)=["\'](og:|article:)[^"\'>]+["\'][^>]*content=["\'][^"\'>]+["\'][^>]*>[\n\r]*/si', '', $buffer, -1);
200
  $buffer = @preg_replace('/<meta[^>]*(name|property)=["\'](twitter:)[^"\'>]+["\'][^>]*content=["\'][^"\'>]+["\'][^>]*>[\n\r]*/si', '', $buffer, -1);
201
  }
202
 
203
+ if (SQ_Tools::$options['sq_auto_favicon'] == 1) {
204
+ $buffer = @preg_replace('/<link[^>]*rel=[^>]*(shortcut icon)[^>]*>[\n\r]*/si', '', $buffer, -1);
205
+ }
206
+
207
  if (SQ_Tools::$options['sq_auto_canonical'] == 1) {
208
+ $buffer = @preg_replace('/<link[^>]*rel=[^>]*(canonical)[^>]*>[\n\r]*/si', '', $buffer, -1);
209
  }
210
  if (SQ_Tools::$options['sq_auto_jsonld'] == 1) {
211
  $buffer = @preg_replace('/<script[^>]*type=["\']application\/ld\+json["\'][^>]*>[^>]*<\/script>[\n\r]*/si', '', $buffer, -1);
212
  }
213
+
214
+
215
+ if ((SQ_Tools::$options['sq_auto_title'] == 1 && $this->isHomePage()) || !$this->isHomePage()) {
216
+ if (isset($this->title) && $this->title <> '') {
217
+ //replace the existing title
218
+ $buffer = @preg_replace('/<title[^<>]*>([^<>]*)<\/title>/si', '', $buffer, 1);
219
+ $buffer = @preg_replace('/(<head[^>]*>)/si', sprintf("$1\n<title>%s</title>", $this->title) . "\n", $buffer, 1);
220
+ }
221
+ } else {
222
+ $buffer = @preg_replace('/(<head[^>]*>)/si', sprintf("$1%s", $this->getHeader()) . "\n", $buffer, 1);
223
+ }
224
+
225
+ if (strpos($buffer, '<squirrly />') !== false) {
226
+ $buffer = @preg_replace('/(<squirrly[^>]*>)/si', sprintf("%s", $this->getHeader()) . "\n", $buffer, 1);
227
+ } elseif (strpos($buffer, '</title>') !== false) {
228
+ $buffer = @preg_replace('/(<\/title>)/si', sprintf("$1\n%s", $this->getHeader()) . "\n", $buffer, 1);
229
+ } else {
230
+ $buffer = @preg_replace('/(<head[^>]*>)/si', sprintf("$1\n%s", $this->getHeader()) . "\n", $buffer, 1);
231
+ }
232
+
233
+ return $buffer;
234
+ //
235
  }
236
  }
237
+
238
+ if (strpos($buffer, '<squirrly />') !== false) {
239
+ $buffer = str_replace("<squirrly />", "", $buffer);
240
+ }
241
  return $buffer;
242
  }
243
 
248
  *
249
  * @return string
250
  */
251
+ public function getHeader() {
 
252
  $ret = '';
253
+ $ret .= $this->setStart();
254
 
255
+ //Add description in homepage if is set or add description in other pages if is not home page
256
+ if ((SQ_Tools::$options['sq_auto_description'] == 1 && $this->isHomePage()) || !$this->isHomePage()) {
257
+ $ret .= $this->getCustomDescription() . "\n";
258
+ $ret .= $this->getCustomKeyword() . "\n";
259
  }
260
 
261
+ if (SQ_Tools::$options['sq_auto_canonical'] == 1) {
262
+ $ret .= $this->setCanonical();
263
+ $ret .= $this->setRelPrevNext();
264
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
265
 
266
+ if (SQ_Tools::$options['sq_auto_sitemap'] == 1) {
267
+ $ret .= $this->getXMLSitemap();
268
+ }
269
+ /* Auto setting */
270
 
271
+ if (SQ_Tools::$options['sq_auto_favicon'] == 1) {
272
+ $ret .= $this->getFavicon();
273
+ }
274
 
275
+ if (SQ_Tools::$options['sq_auto_meta'] == 1) {
276
+ $ret .= "\n";
277
+ $ret .= $this->getGooglePlusMeta();
278
+ $ret .= $this->getLanguage();
279
+ $ret .= $this->getCopyright();
280
+ $ret .= $this->getDublinCore();
281
+ }
282
+ if (SQ_Tools::$options['sq_auto_facebook'] == 1) {
283
+ add_filter('jetpack_enable_opengraph', '__return_false', 99);
284
+ $ret .= $this->getOpenGraph() . "\n";
285
+ }
286
 
287
+ if (SQ_Tools::$options['sq_auto_twitter'] == 1) {
288
+ $ret .= $this->getTwitterCard() . "\n";
289
+ }
290
+ /* SEO optimizer tool */
291
+ $ret .= $this->getGoogleWT();
292
+ $ret .= $this->getGoogleAnalytics();
293
+ $ret .= $this->getFacebookIns();
294
+ $ret .= $this->getBingWT();
295
+ $ret .= $this->getPinterest();
296
+ $ret .= $this->getAlexaT();
 
 
 
 
297
 
298
+ if (SQ_Tools::$options['sq_auto_jsonld'] == 1) {
299
+ $ret .= $this->getJsonLD() . "\n";
300
  }
301
+
302
+ $ret .= $this->setEnd();
303
  return $ret;
304
  }
305
 
306
+ public function setPost($newpost){
307
+ global $post;
308
+ $this->post = $post = $newpost;
309
+ }
310
+
311
  private function getTwitterCard() {
312
  $meta = "\n";
313
 
319
  $sq_twitter_creator = SQ_Tools::$options['sq_twitter_account'];
320
  $sq_twitter_site = SQ_Tools::$options['sq_twitter_account'];
321
 
322
+ if (SQ_Tools::$options['sq_auto_twittersize'] == 'summary_large_image' && !empty($this->thumb_images)) {
323
  $meta .= '<meta name="twitter:card" content="summary_large_image" />' . "\n";
324
  } else {
325
  $meta .= '<meta name="twitter:card" content="summary" />' . "\n";
466
  return (($meta <> '') ? apply_filters('sq_prevnext_meta', $meta) . "\n" : '');
467
  }
468
 
469
+ public function getTitle() {
470
+ $this->getCustomTitle();
471
+ return $this->title;
472
+ }
473
+
474
  /**
475
  * Get the correct title of the article
476
  *
477
  * @return string
478
  */
479
  public function getCustomTitle() {
 
480
  $sep = ' | ';
481
 
482
  if (isset($this->title)) {
488
  //If is category
489
  if (is_category()) { //for category
490
  $category = get_category(get_query_var('cat'), false);
491
+ $this->title = $category->cat_name;
492
+ if ($this->title == '') {
493
+ $this->title = $this->grabTitleFromPost();
494
  }
495
  if (is_paged()) {
496
+ $this->title .= $sep . __('Page', _SQ_PLUGIN_NAME_) . " " . get_query_var('paged');
497
  }
498
  } elseif (is_author()) { //for author
499
+ if ($this->title == '') {
500
+ $this->title = $this->grabTitleFromPost() . $sep . ucfirst($this->getAuthor('display_name'));
501
  }
502
+ if ($this->title == '') {
503
+ $this->title = __('About') . " " . ucfirst($this->getAuthor('display_name'));
504
  }
505
  if (is_paged()) {
506
+ $this->title .= $sep . __('Page', _SQ_PLUGIN_NAME_) . " " . get_query_var('paged');
507
  }
508
  } elseif (is_tag()) { //for tags
509
  if (is_paged()) {
510
  $tag = get_query_var('tag');
511
+ $this->title = ucfirst(str_replace('-', ' ', $tag)) . $sep . __('Page', _SQ_PLUGIN_NAME_) . " " . get_query_var('paged');
512
  }
513
  } elseif (is_archive()) { //for archive and products
514
  if (isset($this->post) && isset($this->post->ID)) {
515
+ $this->title = $this->grabTitleFromPost($this->post->ID);
516
 
517
  //if woocommerce is installed and is a product category
518
  if (function_exists('is_product_category') && is_product_category()) {
519
  global $wp_query;
520
  $cat = $wp_query->get_queried_object();
521
+ if (!empty($cat) && $cat->name <> '') {
522
+ $this->title = $cat->name;
523
  }
524
  } else {
525
  $cat = get_the_terms($this->post->ID, 'category');
526
  if (!empty($cat)) {
527
+ $this->title .= $sep . $cat[0]->name;
528
  }
529
  }
530
  }
531
 
532
  if (is_paged()) {
533
+ $this->title .= $sep . __('Page', _SQ_PLUGIN_NAME_) . " " . get_query_var('paged');
534
  }
535
  } elseif (is_single() || is_page() || is_singular() || in_array(get_post_type(), $this->post_type)) {
536
  if (isset($this->post) && isset($this->post->ID)) {
537
  //is a post page
538
+ $this->title = $this->grabTitleFromPost($this->post->ID);
539
 
540
  //if woocommerce is installed and is a product
541
  if (function_exists('is_product') && is_product()) {
542
  $cat = get_the_terms($this->post->ID, 'product_cat');
543
  if (!empty($cat) && count($cat) > 1) {
544
+ $this->title .= $sep . $cat[0]->name;
545
  }
546
  }
547
  }
548
  }
 
549
 
550
+ //If title then clear it and truncate it
551
+ if ($this->title <> '') {
552
+ $this->title = $this->truncate($this->title, $this->min_title_length, $this->max_title_length);
553
+ }
554
+ } elseif (SQ_Tools::$options ['sq_auto_title'] == 1) { /* Check if is a predefined Title for home page */
 
 
 
555
 
556
  //If the home page is a static page that has custom snippet
557
  if (is_page() && isset($this->post) && isset($this->post->ID) && $this->getAdvancedMeta($this->post->ID, 'title') <> '') {
558
+ $this->title = $this->getAdvancedMeta($this->post->ID, 'title');
559
  } elseif (SQ_Tools::$options['sq_fp_title'] <> '') {
560
+ $this->title = SQ_Tools::$options['sq_fp_title'];
561
  } else {
562
+ if (isset($this->post->ID)) {
563
+ $this->title = $this->grabTitleFromPost($this->post->ID);
564
+ if ($this->title <> "" && $this->meta['blogname'] <> '') {
565
+ $this->title .= $sep . $this->meta['blogname'];
566
+ }
567
+ } else {
568
+ $this->title = get_the_title();
569
  }
570
  }
571
  }
572
+ return apply_filters('sq_title', $this->title);
 
573
  }
574
 
575
  public function clearTitle($title) {
666
  }
667
  $videos[] = esc_url($match[0]);
668
  }
 
 
 
669
 
670
+ // preg_match('/(?:http(?:s)?:\/\/)?(?:fast\.wistia\.net\/(?:embed)\/(?:iframe)\/)([^\?&\"\'>\s]+)/si', $post->post_content, $match);
671
+ //
672
+ // if (isset($match[0])) {
673
+ // if (strpos($match[0], '//') !== false && strpos($match[0], 'http') === false) {
674
+ // $match[0] = 'http:' . $match[0];
675
+ // }
676
+ // $videos[] = esc_url($match[0]);
677
+ // }
678
 
679
  preg_match('/(?:http(?:s)?:\/\/)?(?:fwd4\.wistia\.com\/(?:medias)\/)([^\?&\"\'>\s]+)/si', $post->post_content, $match);
680
 
682
  $videos[] = esc_url('http://fast.wistia.net/embed/iframe/' . $match[1]);
683
  }
684
 
685
+ preg_match('/class=["|\']([^"\']*wistia_async_([^\?&\"\'>\s]+)[^"\']*["|\'])/si', $post->post_content, $match);
686
+
687
+ if (isset($match[0])) {
688
+ $videos[] = esc_url('http://fast.wistia.net/embed/iframe/' . $match[2]);
689
+ }
690
 
691
  preg_match('/src=["|\']([^"\']*(.mpg|.mpeg|.mp4|.mov|.wmv|.asf|.avi|.ra|.ram|.rm|.flv)["|\'])/i', $post->post_content, $match);
692
 
699
  return $videos;
700
  }
701
 
702
+ public function getDescription() {
703
+ $this->getCustomDescription();
704
+ return $this->description;
705
+ }
706
  /**
707
  * Get the description from last/current article
708
  *
709
  * @return string
710
  */
711
+ public function getCustomDescription() {
712
 
713
  $sep = ' | ';
714
  $description = '';
761
  global $wp_query;
762
  $cat = $wp_query->get_queried_object();
763
  if (!empty($cat)) {
764
+ if ($cat->description <> '' && strlen($cat->description) > 10) {
765
+ $description = $cat->description;
766
+ } else {
767
+ $description .= $sep . $cat->name;
768
+ }
769
  }
770
  } else {
771
  $cat = get_the_terms($this->post->ID, 'category');
792
  }
793
  }
794
  }
795
+ }else
796
 
797
  /* Check if is a predefined TitleIn Snippet */
798
+ if (SQ_Tools::$options['sq_auto_description'] == 1) {
 
799
 
800
  //If the home page is a static page that has custom snippet
801
  if (is_page() && isset($this->post) && isset($this->post->ID) && $this->getAdvancedMeta($this->post->ID, 'description') <> '') {
1050
  if ($sq_google_analytics <> '') {
1051
  SQ_ObjController::getController('SQ_DisplayController', false)
1052
  ->loadMedia('https://www.google-analytics.com/analytics.js');
1053
+
1054
  return sprintf("<script>
1055
+ (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
1056
+ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
1057
+ m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
1058
+ })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
1059
+
1060
+ ga('create', '%s', 'auto');
1061
+ ga('send', 'pageview');
1062
+
1063
+ </script>", $sq_google_analytics);
1064
  }
1065
 
1066
  return false;
1139
  $meta .= '"url": "' . $this->url . '"';
1140
  foreach (SQ_Tools::$options['sq_jsonld'][SQ_Tools::$options['sq_jsonld_type']] as $key => $value) {
1141
  if ($value <> '') {
 
 
 
1142
  if (SQ_Tools::$options['sq_jsonld_type'] == 'Organization' && $key == 'contactType') {
1143
  continue;
1144
  }
1145
  if (SQ_Tools::$options['sq_jsonld_type'] == 'Organization' && $key == 'telephone') {
1146
  $meta .= $sep . '"contactPoint": {"@type": "ContactPoint", "telephone": "' . $value . '", "contactType": "' . SQ_Tools::$options['sq_jsonld'][SQ_Tools::$options['sq_jsonld_type']]['contactType'] . '"}';
1147
  }
1148
+
1149
+ if ($key == 'logo') {
1150
+ if (SQ_Tools::$options['sq_jsonld_type'] == 'Person') {
1151
+ $key = 'image';
1152
+ }
1153
+ $value = '{"@type": "ImageObject","url": "' . $value . '"}';
1154
+ } else {
1155
+ $value = '"' . $value . '"';
1156
+ }
1157
+ $meta .= ($meta <> '' ? $sep : '') . '"' . $key . '":' . $value . '';
1158
  }
1159
  }
1160
  }
1174
  $social .= ($social <> '' ? "," : '') . '"' . SQ_Tools::$options['sq_linkedin_account'] . '"';
1175
  }
1176
 
1177
+ $search = $sep . '"potentialAction": { "@type": "SearchAction", "target": "' . get_bloginfo('url') . '?s={search_string}", "query-input": "required name=search_string" }';
 
 
 
 
1178
 
1179
  if ($social <> '') {
1180
  $social = $sep . '"sameAs": [' . $social . ']';
1184
  }
1185
  } elseif (is_single()) {
1186
  $meta .= '"@type": "Article"' . $sep;
1187
+ if (isset($this->title)) {
1188
  $meta .= '"name": "' . $this->title . '"' . $sep;
1189
+ }
1190
+ if (isset($this->description)) {
1191
  $meta .= '"headline": "' . $this->description . '"' . $sep;
1192
+ }
1193
  $meta .= '"url": "' . $this->url . '"' . $sep;
1194
+ $meta .= '"mainEntityOfPage": { "@type": "WebPage", "url": "' . $this->url . '" }' . $sep;
1195
+
1196
+ if (!empty($this->thumb_images)) {
1197
  $meta .= '"thumbnailUrl": "' . $this->thumb_images[0]['src'] . '"' . $sep;
1198
+ }
1199
+ if (isset($this->post->post_date)) {
1200
  $meta .= '"datePublished": "' . date('c', strtotime($this->post->post_date)) . '"' . $sep;
1201
+ }
1202
+ if (isset($this->post->post_modified)) {
1203
+ $meta .= '"dateModified": "' . date('c', strtotime($this->post->post_modified)) . '"' . $sep;
1204
+ }
1205
  if (!empty($this->thumb_images)) {
1206
  foreach ($this->thumb_images as $image) {
1207
+ //$meta .= '"image": "' . $image['src'] . '"' . $sep;
1208
+ $meta .= '"image": {
1209
+ "@type": "ImageObject",
1210
+ "url": "' . $image['src'] . '",
1211
+ "height": ' . ((isset($image['height']) && $image['height'] <> '' ) ? (int) $image['height'] : 500) . ',
1212
+ "width": ' . ((isset($image['width']) && $image['width'] <> '' ) ? (int) $image['width'] : 700) . '
1213
+ }' . $sep;
1214
  break;
1215
  }
1216
  }
1217
  $meta .= '"author": {"@type": "Person", "url": "' . $this->getAuthor('user_url') . '", "name": "' . $this->getAuthor('display_name') . '"}' . $sep;
1218
+ if (SQ_Tools::$options['sq_jsonld_type'] == 'Organization' && isset(SQ_Tools::$options['sq_jsonld'][SQ_Tools::$options['sq_jsonld_type']])) {
1219
+ $meta .= '"publisher": {';
1220
+ $meta .= '"@type":"' . SQ_Tools::$options['sq_jsonld_type'] . '"' . $sep;
1221
+ $meta .= '"url": "' . $this->url . '"';
1222
+ foreach (SQ_Tools::$options['sq_jsonld'][SQ_Tools::$options['sq_jsonld_type']] as $key => $value) {
1223
+ if ($value <> '') {
1224
+ if ($key == 'contactType' || $key == 'telephone') {
1225
+ continue;
1226
+ }
1227
+
1228
+ if ($key == 'logo') {
1229
+ $value = '{"@type": "ImageObject","url": "' . $value . '"}';
1230
+ } else {
1231
+ $value = '"' . $value . '"';
1232
+ }
1233
+ $meta .= ($meta <> '' ? $sep : '') . '"' . $key . '":' . $value . '';
1234
+ }
1235
+ }
1236
+ $meta .= '}' . $sep;
1237
+ }
1238
  $meta .= '"keywords": ["' . str_replace(',', '","', $this->grabKeywordsFromPost()) . '"]';
1239
 
1240
  $meta = '{ "@context": "http://schema.org"' . $sep . $meta . '}';
1395
  }
1396
 
1397
  if (is_home()) {
1398
+ if (isset($wp_query->posts) && !empty($wp_query->posts)) {
1399
+ $posts = (array) $wp_query->posts;
1400
+
1401
+ if (SQ_Tools::$options['sq_keywordtag'] == 1) {
1402
+ foreach ($posts as $post) {
1403
+ foreach (wp_get_post_tags($post->ID) as $keyword) {
1404
+ $keywords[] = SQ_Tools::i18n($keyword->name);
1405
+ }
1406
  }
1407
  }
 
1408
 
1409
+ if (sizeof($keywords) > $this->max_keywords) {
1410
+ $keywords = array_slice($keywords, 0, $this->max_keywords);
1411
+ }
1412
  }
1413
  }
1414
  if (count($keywords) <= $this->max_keywords) {
1415
+ if (isset($wp_query->posts) && !empty($wp_query->posts)) {
1416
+ $posts = (array) $wp_query->posts;
1417
 
1418
+ foreach ($posts as $post) {
1419
+ $id = (is_attachment()) ? ($post->post_parent) : ($post->ID);
1420
+
1421
+ if (SQ_Tools::$options['sq_keywordtag'] == 1) {
1422
+ foreach (wp_get_post_tags($id) as $keyword) {
1423
+ $keywords[] = SQ_Tools::i18n($keyword->name);
1424
+ }
1425
  }
 
1426
  // autometa
1427
+ $autometa = stripcslashes(get_post_meta($id, 'autometa', true));
1428
+ //$autometa = stripcslashes(get_post_meta($post->ID, "autometa", true));
1429
+ if (isset($autometa) && !empty($autometa)) {
1430
+
1431
+ $autometa_array = explode(' ', $autometa);
1432
+ foreach ($autometa_array as $e) {
1433
+ $keywords[] = SQ_Tools::i18n($e);
1434
+ }
1435
  }
1436
  }
1437
  }
1578
  return (is_home() || (isset($wp_query->query) && empty($wp_query->query) && !is_preview()));
1579
  }
1580
 
1581
+ private function isHtmlHeader() {
1582
+ $headers = headers_list();
1583
+
1584
+ foreach ($headers as $index => $value) {
1585
+ if (strpos($value, ':') !== false) {
1586
+ $exploded = @explode(': ', $value);
1587
+ if (count($exploded) > 1) {
1588
+ $headers[$exploded[0]] = $exploded[1];
1589
+ }
1590
+ }
1591
+ }
1592
+
1593
+ if (isset($headers['Content-Type'])) {
1594
+ if (strpos($headers['Content-Type'], 'text/html') !== false) {
1595
+ return true;
1596
+ }
1597
+ } else {
1598
+ return true;
1599
+ }
1600
+
1601
+ return false;
1602
+ }
1603
+
1604
  /**
1605
  * Check if page is shown in front
1606
  *
1840
  }
1841
  echo "\n\n";
1842
 
1843
+ if (!empty(SQ_Tools::$options['sq_robots_permission'])) {
1844
+ foreach ((array) SQ_Tools::$options['sq_robots_permission'] as $robot_txt)
1845
  echo $robot_txt . "\n";
1846
  }
1847
  echo "\n\n";
models/SQ_Sitemaps.php CHANGED
@@ -81,7 +81,8 @@ class Model_SQ_Sitemaps {
81
  * @return type
82
  */
83
  public function getListPosts() {
84
-
 
85
  $posts = array();
86
  $posts['contains'] = array();
87
  if (have_posts()) {
@@ -160,6 +161,9 @@ class Model_SQ_Sitemaps {
160
  * @return type
161
  */
162
  public function getListNews() {
 
 
 
163
  $posts = array();
164
  $posts['contains'] = array();
165
 
@@ -270,6 +274,9 @@ class Model_SQ_Sitemaps {
270
  if (!empty($terms)) {
271
  foreach ($terms AS $term) {
272
  $xml = array();
 
 
 
273
 
274
  $xml['loc'] = esc_url(get_term_link($term, $term->taxonomy));
275
  $xml['lastmod'] = date('Y-m-d\TH:i:s+00:00', $term->lastmod);
81
  * @return type
82
  */
83
  public function getListPosts() {
84
+ global $wp_query;
85
+ $wp_query->get_posts();
86
  $posts = array();
87
  $posts['contains'] = array();
88
  if (have_posts()) {
161
  * @return type
162
  */
163
  public function getListNews() {
164
+ global $wp_query;
165
+ $wp_query->get_posts();
166
+
167
  $posts = array();
168
  $posts['contains'] = array();
169
 
274
  if (!empty($terms)) {
275
  foreach ($terms AS $term) {
276
  $xml = array();
277
+ if (!isset($term->lastmod)){
278
+ continue;
279
+ }
280
 
281
  $xml['loc'] = esc_url(get_term_link($term, $term->taxonomy));
282
  $xml['lastmod'] = date('Y-m-d\TH:i:s+00:00', $term->lastmod);
readme.txt CHANGED
@@ -1,11 +1,11 @@
1
  === SEO by SQUIRRLY™ ===
2
- Contributors: cifi, calinvingan, florinmuresan
3
  Tags: seo,seo plugin,wordpress seo,seo optimization,seo content,plugin,content seo,search engine optimization,xml,sitemap,keyword,keyword research,post,posts,page,multisite,squirrly,wordpress,tag,image,images,photos,flickr,statistics,stats,google,content,title,description,favicon,mobile,canonical,author,google plus,analytics,admin,seo correction,seo title,seo meta,meta,google,twitter,news,blog,e-commerce,ecommerce,woocommerce,feed,feeds,marketing,buddypress,social,social media,url,automatic,iphone
4
- Requires at least: 3.5
5
- Tested up to: 4.4
6
- Stable tag: trunk
7
- Donate link: https://www.squirrly.co/wordpress-seo-by-squirrly
8
-
9
  SEO Plugin By Squirrly is for the NON-SEO experts. Get Excellent Seo with Better Content, Ranking and Analytics. For Both Humans and Search Bots.
10
 
11
  == Description ==
@@ -83,15 +83,15 @@ Once you start having bigger content marketing and SEO needs (more than one arti
83
 
84
  <strong>You can read reviews from Internet Marketing experts on http://howto.squirrly.co/testimonials/</strong>
85
 
86
- Over 1,000,000 Downloads. Our startup consists of 10 content marketing professionals dedicated to making Squirrly an amazing piece of software and writing great training materials to help you be successful and stay successful.
87
 
88
- Over 550 Content Marketing Experts have reviewed our Wordpress SEO plugin and loved it.
89
 
90
- Over 2500 students to our $147 Content Marketing Training on Udemy. Part of that training you'll be receiving for free when signing up for this Wordpress seo plugin.
91
 
92
  over +285% increase in traffic to over 49,000 survey participants.
93
 
94
- Recently our team grew to 10 people. More than helping you with your internet marketing efforts, we strive to offer Excellence in Customer Service.
95
 
96
  * we have a Free Training session with 14 lessons and 10 actionable work files, awaiting you after you install the plugin and connect to squirrly.co (you'll receive them by email)
97
 
@@ -133,11 +133,64 @@ Type a keyword to the right of the screen and start using Squirrly Seo. Enjoy!
133
  6. Seo - Let Squirrly do the SEO Settings that your blog needs
134
  7. Seo - Check your Weekly Site Audit and improve to get higher scores
135
 
 
 
136
 
137
  == Changelog ==
138
- = 5.2.8 =
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
139
  * Fixed the compatibility issue in Performance Analytics
140
  * Added twitter summary for large images
 
 
 
141
  * Compatible with WP 4.4
142
 
143
  = 5.2.7 =
@@ -147,7 +200,6 @@ Type a keyword to the right of the screen and start using Squirrly Seo. Enjoy!
147
  * Set Squirrly SEO Live Assistant to work with more multilanguage plugins
148
  * Fixed the images in Squirrly Inspiration Box
149
 
150
-
151
  = 5.2.6 =
152
  * Compatible with Smart Security Tools plugin
153
  * Added the google.ee in Squirrly Rank Option
@@ -367,21 +419,23 @@ Type a keyword to the right of the screen and start using Squirrly Seo. Enjoy!
367
  * Added Google Country Select in Squirrly SEO > Settings
368
 
369
  == Credits ==
370
- Florin Muresan - CEO at Squirrly
371
- Calin Vingan - CTO at Squirrly
372
- Andreea Leau - VP Marketing
373
- Cristina Leau - Squirrly mascot designer
374
- Alexandra Nicola - Content Writer, future COO
375
- Tim - Content Writer
376
- Lynn Silva - Content Writer
377
- Teodora Vingan - SEO Analyser
378
- Ana Darstaru - Chief of Customer Service
379
- Lucian Nertan - VP of Agency
380
- Sorel Nagy- Developer
381
-
382
- Investors:
383
- Ibrahim Evsan, serial entrepreneur, one of the best known bloggers in Germany
384
- Philipp Kandal, co-Founder and CTO of Skobbler (recently aquired for $24M by Telenav)
 
 
385
 
386
  Many Thanks.
387
 
@@ -392,7 +446,7 @@ You'll be able to use this seo software once you install the plugin and use your
392
 
393
  For higher content marketing and SEO needs, you can check our Official Site and see what the PRO Plan offers.
394
 
395
- == Frequently Asked Questions ==
396
  = I can't log into the Wordpress with my user. Get the message 'An error occured.' What can I do? =
397
  I see that your host server is not letting you to access our remote API.
398
  Please tell your web master to add the IPs 144.76.66.106 and 176.9.112.210 in the white-list for remote access and it should work.
@@ -434,7 +488,7 @@ All of the features that we offer have been built having the customer's best int
434
  and we've proven time and again that we are a great team that knows all there is to know about good *SEO automation*. We had a community of 20,000 blogs that all
435
  used our SEO techniques, and they have gotten lots of hits from search engines due to our optimization. Now we offer the same quality for you:
436
 
437
- [UPDATE] Squirrly now has over 1,000,000 downloads, so we've been offering great software for over two years now.
438
 
439
  - SEO Advice as you're typing your articles
440
  - Advice in real time from the SEO Live Assistant on how to write better content for your Human readers
@@ -483,17 +537,16 @@ used our SEO techniques, and they have gotten lots of hits from search engines d
483
  - Integrated with other Ecommerce Plugins like WooCommerce, WP Ecommerce, MarketPress, Ready!, Shopp
484
  - Compatibility with all the other plugins, like Auto Meta, Ultimate Tag Warrior and others.
485
  - Works best with multisites
486
- - SEO error check and fix the META duplicates
487
 
488
  And the best ones that we have (and the others don't):
489
  - *Keyword research and SEO Analysis*: find the keywords that are easier to rank for
490
  - *SEO Live Assistant*: Your WordPress gives you SEO advice as you type or Edit your article
491
- - *Inspiration box*: get images you can use for free, tweets you can quote and get up to date with latest news about your subject
492
  - *SEO Rank*: Measure and Monitor the impact of SEO and Social Signals for each of your articles
493
 
494
- = Where can I enter the title and page description? =
495
- If you click the Squirrly tab in your dashboard, go to the "First Page Optimization" section and switch the Title and Description option on. You can enter custom Title, Description and Keywords.
496
 
497
  = Is this Wordpress SEO plugin the only SEO plugin I will need to install? =
498
- It all depends on how you have setup your Wordpress until now. Some people use Squirrly seo plugin only for the Content Optimization with the Live Assistant part, some use use it to check their SEO stats and see where they need to improve their Wordpress seo, but most of our users and customer use Squirrly for everything related to SEO: from keyword analysis, to seo settings on Wordpress, to analytics and to weekly monitoring and audit reports.
499
-
1
  === SEO by SQUIRRLY™ ===
2
+ Contributors: calinvingan, florinmuresan, nagy.sorel
3
  Tags: seo,seo plugin,wordpress seo,seo optimization,seo content,plugin,content seo,search engine optimization,xml,sitemap,keyword,keyword research,post,posts,page,multisite,squirrly,wordpress,tag,image,images,photos,flickr,statistics,stats,google,content,title,description,favicon,mobile,canonical,author,google plus,analytics,admin,seo correction,seo title,seo meta,meta,google,twitter,news,blog,e-commerce,ecommerce,woocommerce,feed,feeds,marketing,buddypress,social,social media,url,automatic,iphone
4
+ Requires at least: 3.5
5
+ Tested up to: 4.6
6
+ Stable tag: trunk
7
+ Donate link: https://www.squirrly.co/wordpress-seo-by-squirrly
8
+
9
  SEO Plugin By Squirrly is for the NON-SEO experts. Get Excellent Seo with Better Content, Ranking and Analytics. For Both Humans and Search Bots.
10
 
11
  == Description ==
83
 
84
  <strong>You can read reviews from Internet Marketing experts on http://howto.squirrly.co/testimonials/</strong>
85
 
86
+ Over 1,460,000 Downloads. Our startup consists of 10 content marketing professionals dedicated to making Squirrly an amazing piece of software and writing great training materials to help you be successful and stay successful.
87
 
88
+ Over 860 Content Marketing Experts have reviewed our Wordpress SEO plugin and loved it.
89
 
90
+ Over 2580 students to our $147 Content Marketing Training on Udemy. Part of that training you'll be receiving for free when signing up for this Wordpress seo plugin.
91
 
92
  over +285% increase in traffic to over 49,000 survey participants.
93
 
94
+ Recently our team grew to 20 people. More than helping you with your internet marketing efforts, we strive to offer Excellence in Customer Service.
95
 
96
  * we have a Free Training session with 14 lessons and 10 actionable work files, awaiting you after you install the plugin and connect to squirrly.co (you'll receive them by email)
97
 
133
  6. Seo - Let Squirrly do the SEO Settings that your blog needs
134
  7. Seo - Check your Weekly Site Audit and improve to get higher scores
135
 
136
+ == Upgrade Notice ==
137
+ Squirrly 5.2.8 it's a stable version of Squirrly SEO and has all the SEO requirements by Search Engines
138
 
139
  == Changelog ==
140
+ = 6.1.0 =
141
+ * Compatible with WP 4.6
142
+ * Fixed the Front Page SEO to work with more WP themes
143
+ * Fixed compatibility with PolyLang plugin
144
+ * Fixed compatibility with Customizr theme
145
+ * Fixed Squirrly SEO Snippet for arabic lang
146
+
147
+ = 6.0.9 =
148
+ * Compatible with WP 4.5
149
+ * Fixed Squirrly Analaytics in Performance Analytics
150
+
151
+ = 6.0.6 =
152
+ * Update the Squirrly SEO Snippet
153
+ * Fixed the Json AMP for articles
154
+ * Added dateModified, ImageObject, mainEntityOfPage, publisher
155
+
156
+ = 6.0.4 =
157
+ * Fixed the snippet to save long text
158
+ * Fixed the woocommerce title and description for a category
159
+ * Fix the SEO for more themes
160
+
161
+ = 6.0.3 =
162
+ * Fixed compatibility with NextGen Gallery plugin
163
+ * Compatible with 4.4.3
164
+
165
+ = 6.0.2 =
166
+ * Added style for the site feed in Squirrly > SEO
167
+ * Fixed the hook for feed when Squirrly SEO sitemap is active
168
+ * Fixed the SEO for more WP themes
169
+
170
+ = 6.0.0 =
171
+ * The last stable version of Squirrly with all the features included:
172
+ * Squirrly SEO is compatible with more WP themes
173
+ * Twitter Card latest updates (summary and summary_large_image)
174
+ * Open Graph updates (multiple images, videos)
175
+ * Sitemap with more video like Wistia.com, FLV
176
+ * External Canonical Link
177
+ * Woocommerce & Instapage compatility
178
+ * Compatible with WP 4.4.1
179
+
180
+ = 5.3.1 =
181
+ * Added the Twitter Summary Type option in Squirrly > SEO > Twitter Card
182
+ * Fixed the same Title SEO issues for some WP themes
183
+ * Fixed small bugs
184
+
185
+ = 5.2.9 =
186
+ * Optimized the way SEO is loading in every page
187
+ * Optimized SEO for Instapage Plugin
188
+ * Updated the Google Analytics Tracking code
189
  * Fixed the compatibility issue in Performance Analytics
190
  * Added twitter summary for large images
191
+
192
+
193
+ = 5.2.8 =
194
  * Compatible with WP 4.4
195
 
196
  = 5.2.7 =
200
  * Set Squirrly SEO Live Assistant to work with more multilanguage plugins
201
  * Fixed the images in Squirrly Inspiration Box
202
 
 
203
  = 5.2.6 =
204
  * Compatible with Smart Security Tools plugin
205
  * Added the google.ee in Squirrly Rank Option
419
  * Added Google Country Select in Squirrly SEO > Settings
420
 
421
  == Credits ==
422
+ * Florin Muresan - CEO at Squirrly
423
+ * Calin Vingan - CTO at Squirrly
424
+ * Sorel Nagy - Developer
425
+ * Andreea Leau - VP Marketing
426
+ * Cristina Leau - Squirrly mascot designer
427
+ * Alexandra Nicola - COO
428
+ * Teodora Vingan - SEO Analyser
429
+ * Tim - Content Writer
430
+ * Olivia Barbu - Content Writer
431
+ * Alex Iftode - Content Writer
432
+ * Irina Pogor - Content Writer
433
+ * Ana Darstaru - Chief of Customer Service
434
+ * Lucian Nertan - VP of Agency
435
+
436
+ == Investors ==
437
+ * Ibrahim Evsan, serial entrepreneur, one of the best known bloggers in Germany
438
+ * Philipp Kandal, co-Founder and CTO of Skobbler (recently aquired for $24M by Telenav)
439
 
440
  Many Thanks.
441
 
446
 
447
  For higher content marketing and SEO needs, you can check our Official Site and see what the PRO Plan offers.
448
 
449
+ == Frequently Asked Questions ==
450
  = I can't log into the Wordpress with my user. Get the message 'An error occured.' What can I do? =
451
  I see that your host server is not letting you to access our remote API.
452
  Please tell your web master to add the IPs 144.76.66.106 and 176.9.112.210 in the white-list for remote access and it should work.
488
  and we've proven time and again that we are a great team that knows all there is to know about good *SEO automation*. We had a community of 20,000 blogs that all
489
  used our SEO techniques, and they have gotten lots of hits from search engines due to our optimization. Now we offer the same quality for you:
490
 
491
+ [UPDATE] Squirrly now has over 1,000,000 downloads, so we've been offering great software for over two years now.
492
 
493
  - SEO Advice as you're typing your articles
494
  - Advice in real time from the SEO Live Assistant on how to write better content for your Human readers
537
  - Integrated with other Ecommerce Plugins like WooCommerce, WP Ecommerce, MarketPress, Ready!, Shopp
538
  - Compatibility with all the other plugins, like Auto Meta, Ultimate Tag Warrior and others.
539
  - Works best with multisites
540
+ - SEO error check and fix the META duplicates
541
 
542
  And the best ones that we have (and the others don't):
543
  - *Keyword research and SEO Analysis*: find the keywords that are easier to rank for
544
  - *SEO Live Assistant*: Your WordPress gives you SEO advice as you type or Edit your article
545
+ - *Inspiration box*: get images you can use for free, tweets you can quote and get up to date with latest news about your subject
546
  - *SEO Rank*: Measure and Monitor the impact of SEO and Social Signals for each of your articles
547
 
548
+ = Where can I enter the title and page description? =
549
+ If you click the Squirrly tab in your dashboard, go to the "First Page Optimization" section and switch the Title and Description option on. You can enter custom Title, Description and Keywords.
550
 
551
  = Is this Wordpress SEO plugin the only SEO plugin I will need to install? =
552
+ It all depends on how you have setup your Wordpress until now. Some people use Squirrly seo plugin only for the Content Optimization with the Live Assistant part, some use use it to check their SEO stats and see where they need to improve their Wordpress seo, but most of our users and customer use Squirrly for everything related to SEO: from keyword analysis, to seo settings on Wordpress, to analytics and to weekly monitoring and audit reports.
 
squirrly.php CHANGED
@@ -8,12 +8,12 @@
8
  Plugin URI: http://www.squirrly.co
9
  Description: SEO Plugin By Squirrly is for the NON-SEO experts. Get Excellent Seo with Better Content, Ranking and Analytics. For Both Humans and Search Bots.<BR> <a href="http://my.squirrly.co/user" target="_blank"><strong>Check your profile</strong></a>
10
  Author: cifi, calinvingan, florinmuresan
11
- Version: 5.2.8
12
  Author URI: http://www.squirrly.co
13
  */
14
 
15
  /* SET THE CURRENT VERSION ABOVE AND BELOW */
16
- define('SQ_VERSION', '5.2.8');
17
  /* Call config files */
18
  if (file_exists(dirname(__FILE__) . '/config/config.php')) {
19
  require(dirname(__FILE__) . '/config/config.php');
8
  Plugin URI: http://www.squirrly.co
9
  Description: SEO Plugin By Squirrly is for the NON-SEO experts. Get Excellent Seo with Better Content, Ranking and Analytics. For Both Humans and Search Bots.<BR> <a href="http://my.squirrly.co/user" target="_blank"><strong>Check your profile</strong></a>
10
  Author: cifi, calinvingan, florinmuresan
11
+ Version: 6.1.0
12
  Author URI: http://www.squirrly.co
13
  */
14
 
15
  /* SET THE CURRENT VERSION ABOVE AND BELOW */
16
+ define('SQ_VERSION', '6.1.0');
17
  /* Call config files */
18
  if (file_exists(dirname(__FILE__) . '/config/config.php')) {
19
  require(dirname(__FILE__) . '/config/config.php');
themes/default/SQ_BlockAffiliate.php CHANGED
@@ -15,7 +15,7 @@
15
  <fieldset>
16
  <legend>
17
  <span class="sq_legend_title"><?php _e('Join Squirrly today!', _SQ_PLUGIN_NAME_); ?></span>
18
- <span><?php echo sprintf(__('%sHow I Started Making Money With the Squirrly Affiliate Program%s', _SQ_PLUGIN_NAME_), '<a href="http://www.squirrly.co/affiliate_program_squirrly-pagblog-article_id62228.html" target="_blank">', '</a>'); ?></span>
19
 
20
  <span><p class="sq_settings_affiliate_bigtitle">
21
  <?php _e('Affiliate Benefits', _SQ_PLUGIN_NAME_); ?>
15
  <fieldset>
16
  <legend>
17
  <span class="sq_legend_title"><?php _e('Join Squirrly today!', _SQ_PLUGIN_NAME_); ?></span>
18
+ <span><?php echo sprintf(__('%sHow I Started Making Money With the Squirrly Affiliate Program%s', _SQ_PLUGIN_NAME_), '<a href="https://plugin.squirrly.co/wp-content/uploads/Squirrly-Affiliate-Program.pdf" target="_blank">', '</a>'); ?></span>
19
 
20
  <span><p class="sq_settings_affiliate_bigtitle">
21
  <?php _e('Affiliate Benefits', _SQ_PLUGIN_NAME_); ?>
themes/default/SQ_BlockAnalytics.php CHANGED
@@ -2,6 +2,9 @@
2
  <?php
3
  foreach ($view->audit->content as $key => $audit) {
4
  $current_grup = $view->audit->groups->$key;
 
 
 
5
  ?>
6
  <div class="sq_analytics_groups" >
7
  <ul class="sq_analytics_list" >
@@ -32,7 +35,6 @@
32
  foreach ($audit as $key => $task) {
33
  $task->id = $view->post_id . $task->id;
34
  $replace = '';
35
- //echo '<pre>' . print_R($task->value, true) . '</pre>';
36
  if (is_array($task->value)) {
37
  foreach ($task->value as $value) {
38
  if (is_object($value)) {
2
  <?php
3
  foreach ($view->audit->content as $key => $audit) {
4
  $current_grup = $view->audit->groups->$key;
5
+ if (!isset($current_grup->total)){
6
+ continue;
7
+ }
8
  ?>
9
  <div class="sq_analytics_groups" >
10
  <ul class="sq_analytics_list" >
35
  foreach ($audit as $key => $task) {
36
  $task->id = $view->post_id . $task->id;
37
  $replace = '';
 
38
  if (is_array($task->value)) {
39
  foreach ($task->value as $value) {
40
  if (is_object($value)) {
themes/default/SQ_BlockSettings.php CHANGED
@@ -149,6 +149,7 @@
149
  <option value="com.br"><?php _e('Brazil', _SQ_PLUGIN_NAME_); ?> (http://www.google.com.br/)</option>
150
  <option value="vg"><?php _e('British Virgin Islands', _SQ_PLUGIN_NAME_); ?> (http://www.google.vg/)</option>
151
  <option value="bi"><?php _e('Burundi', _SQ_PLUGIN_NAME_); ?> (http://www.google.bi/)</option>
 
152
  <option value="ca"><?php _e('Canada', _SQ_PLUGIN_NAME_); ?> (http://www.google.ca/)</option>
153
  <option value="td"><?php _e('Chad', _SQ_PLUGIN_NAME_); ?> (http://www.google.td/)</option>
154
  <option value="cl"><?php _e('Chile', _SQ_PLUGIN_NAME_); ?> (http://www.google.cl/)</option>
@@ -221,6 +222,7 @@
221
  <option value="rw"><?php _e('Rwanda', _SQ_PLUGIN_NAME_); ?> (http://www.google.rw/)</option>
222
  <option value="sh"><?php _e('Saint Helena', _SQ_PLUGIN_NAME_); ?> (http://www.google.sh/)</option>
223
  <option value="sm"><?php _e('San Marino', _SQ_PLUGIN_NAME_); ?> (http://www.google.sm/)</option>
 
224
  <option value="com.sg"><?php _e('Singapore', _SQ_PLUGIN_NAME_); ?> (http://www.google.com.sg/)</option>
225
  <option value="sk"><?php _e('Slovakia', _SQ_PLUGIN_NAME_); ?> (http://www.google.sk/)</option>
226
  <option value="co.za"><?php _e('South Africa', _SQ_PLUGIN_NAME_); ?> (http://www.google.co.za/)</option>
149
  <option value="com.br"><?php _e('Brazil', _SQ_PLUGIN_NAME_); ?> (http://www.google.com.br/)</option>
150
  <option value="vg"><?php _e('British Virgin Islands', _SQ_PLUGIN_NAME_); ?> (http://www.google.vg/)</option>
151
  <option value="bi"><?php _e('Burundi', _SQ_PLUGIN_NAME_); ?> (http://www.google.bi/)</option>
152
+ <option value="bg"><?php _e('Bulgaria', _SQ_PLUGIN_NAME_); ?> (http://www.google.bg/)</option>
153
  <option value="ca"><?php _e('Canada', _SQ_PLUGIN_NAME_); ?> (http://www.google.ca/)</option>
154
  <option value="td"><?php _e('Chad', _SQ_PLUGIN_NAME_); ?> (http://www.google.td/)</option>
155
  <option value="cl"><?php _e('Chile', _SQ_PLUGIN_NAME_); ?> (http://www.google.cl/)</option>
222
  <option value="rw"><?php _e('Rwanda', _SQ_PLUGIN_NAME_); ?> (http://www.google.rw/)</option>
223
  <option value="sh"><?php _e('Saint Helena', _SQ_PLUGIN_NAME_); ?> (http://www.google.sh/)</option>
224
  <option value="sm"><?php _e('San Marino', _SQ_PLUGIN_NAME_); ?> (http://www.google.sm/)</option>
225
+ <option value="com.sa"><?php _e('Saudi Arabia', _SQ_PLUGIN_NAME_); ?> (http://www.google.com.sa/)</option>
226
  <option value="com.sg"><?php _e('Singapore', _SQ_PLUGIN_NAME_); ?> (http://www.google.com.sg/)</option>
227
  <option value="sk"><?php _e('Slovakia', _SQ_PLUGIN_NAME_); ?> (http://www.google.sk/)</option>
228
  <option value="co.za"><?php _e('South Africa', _SQ_PLUGIN_NAME_); ?> (http://www.google.co.za/)</option>
themes/default/SQ_BlockSettingsSeo.php CHANGED
@@ -17,7 +17,7 @@
17
  <form id="sq_settings_form" name="settings" action="" method="post" enctype="multipart/form-data">
18
  <div id="sq_settings_body">
19
  <fieldset>
20
- <legend style="height: 370px;">
21
  <span class="sq_legend_title"><?php _e('Let Squirrly SEO optimize this blog', _SQ_PLUGIN_NAME_); ?></span>
22
  <span><?php echo sprintf(__('%sIs Squirrly SEO better then WordPress SEO by Yoast?%s', _SQ_PLUGIN_NAME_), '<a href="http://www.squirrly.co/why_is_squirrly_seo_better_then_wordpress_seo_by_yoast-pagblog-article_id61980-html" target="_blank"><strong>', '</strong></a>'); ?></span>
23
 
@@ -87,6 +87,23 @@
87
  <span><?php echo sprintf(__('adds the <strong>%sXML Sitemap%s</strong> for search engines: %s', _SQ_PLUGIN_NAME_), '<a href="https://support.google.com/webmasters/answer/156184?rd=1" target="_blank">', '</a>', '<strong><a href="' . SQ_ObjController::getController('SQ_Sitemaps')->getXmlUrl('sitemap') . '" target="_blank">' . SQ_ObjController::getController('SQ_Sitemaps')->getXmlUrl('sitemap') . '</a></strong>'); ?></span>
88
  </div>
89
  </li>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90
  <li>
91
  <?php
92
  $auto_option = false;
@@ -419,6 +436,16 @@
419
  <span class="sq_switch-selection"></span>
420
  </div>
421
  <span><?php echo __('Add the <strong>Twitter card</strong> in your tweets. ', _SQ_PLUGIN_NAME_) . ' <a href="https://dev.twitter.com/docs/cards/validation/validator" target="_blank" title="Twitter Card Validator">Check here</a> to validate your site'; ?></span>
 
 
 
 
 
 
 
 
 
 
422
  <span style="color: #f7681a; margin-top: 9px; text-align: center; <?php echo ((SQ_Tools::$options['sq_twitter_account'] <> '') ? 'display:none' : '') ?>"><?php echo __('You need to add your <strong>Twitter account</strong> below', _SQ_PLUGIN_NAME_); ?></span>
423
 
424
  </div>
@@ -430,7 +457,7 @@
430
  <fieldset id="sq_social_media_accounts" style="<?php echo ((SQ_Tools::$options['sq_use'] == 0) ? 'display:none;' : ''); ?>">
431
  <legend class="sq_legend_medium">
432
  <span class="sq_legend_title"><?php _e('Social Media Accounts', _SQ_PLUGIN_NAME_); ?></span>
433
- <span><?php echo sprintf(__('%sLink your Google+ profile to the content you create%s', _SQ_PLUGIN_NAME_), '<a href="https://plus.google.com/authorship" target="_blank">', '</a>'); ?></span>
434
  <span><?php echo sprintf(__('%sTwitter account is mandatory for <strong>Twitter Card Validation</strong>%s', _SQ_PLUGIN_NAME_), '<a href="https://dev.twitter.com/docs/cards/validation/validator" target="_blank">', '</a>'); ?></span>
435
  <span><?php echo sprintf(__('%sAdd all your social accounts for <strong>JSON-LD Semantic SEO</strong>%s', _SQ_PLUGIN_NAME_), '<a href="http://howto.squirrly.c%so/sides/squirrly-json-ld-structured-data/" target="_blank">', '</a>'); ?></span>
436
  <span><?php echo sprintf(__('%sSpecify your social profiles to Google%s', _SQ_PLUGIN_NAME_), '<a href="https://developers.google.com/structured-data/customize/social-profiles" target="_blank">', '</a>'); ?></span>
17
  <form id="sq_settings_form" name="settings" action="" method="post" enctype="multipart/form-data">
18
  <div id="sq_settings_body">
19
  <fieldset>
20
+ <legend style="height: 405px;">
21
  <span class="sq_legend_title"><?php _e('Let Squirrly SEO optimize this blog', _SQ_PLUGIN_NAME_); ?></span>
22
  <span><?php echo sprintf(__('%sIs Squirrly SEO better then WordPress SEO by Yoast?%s', _SQ_PLUGIN_NAME_), '<a href="http://www.squirrly.co/why_is_squirrly_seo_better_then_wordpress_seo_by_yoast-pagblog-article_id61980-html" target="_blank"><strong>', '</strong></a>'); ?></span>
23
 
87
  <span><?php echo sprintf(__('adds the <strong>%sXML Sitemap%s</strong> for search engines: %s', _SQ_PLUGIN_NAME_), '<a href="https://support.google.com/webmasters/answer/156184?rd=1" target="_blank">', '</a>', '<strong><a href="' . SQ_ObjController::getController('SQ_Sitemaps')->getXmlUrl('sitemap') . '" target="_blank">' . SQ_ObjController::getController('SQ_Sitemaps')->getXmlUrl('sitemap') . '</a></strong>'); ?></span>
88
  </div>
89
  </li>
90
+ <li>
91
+ <?php
92
+ $auto_option = false;
93
+ if (SQ_Tools::$options['sq_auto_feed'] == 1)
94
+ $auto_option = true;
95
+ ?>
96
+ <div class="sq_option_content sq_option_content_small">
97
+ <div class="sq_switch sq_seo_switch_condition" style="<?php echo ((SQ_Tools::$options['sq_use'] == 0) ? 'display:none;' : ''); ?>">
98
+ <input id="sq_auto_feed1" type="radio" class="sq_switch-input" name="sq_auto_feed" value="1" <?php echo ($auto_option ? "checked" : '') ?> />
99
+ <label for="sq_auto_feed1" class="sq_switch-label sq_switch-label-off"><?php _e('Yes', _SQ_PLUGIN_NAME_); ?></label>
100
+ <input id="sq_auto_feed0" type="radio" class="sq_switch-input" name="sq_auto_feed" value="0" <?php echo (!$auto_option ? "checked" : '') ?> />
101
+ <label for="sq_auto_feed0" class="sq_switch-label sq_switch-label-on"><?php _e('No', _SQ_PLUGIN_NAME_); ?></label>
102
+ <span class="sq_switch-selection"></span>
103
+ </div>
104
+ <span><?php echo __('adds <strong>Feed style</strong> to your blog feed (eg. /feed)', _SQ_PLUGIN_NAME_) ?></span>
105
+ </div>
106
+ </li>
107
  <li>
108
  <?php
109
  $auto_option = false;
436
  <span class="sq_switch-selection"></span>
437
  </div>
438
  <span><?php echo __('Add the <strong>Twitter card</strong> in your tweets. ', _SQ_PLUGIN_NAME_) . ' <a href="https://dev.twitter.com/docs/cards/validation/validator" target="_blank" title="Twitter Card Validator">Check here</a> to validate your site'; ?></span>
439
+ <br />
440
+ <div class="sq_switch sq_seo_switch_condition" style="<?php echo ((SQ_Tools::$options['sq_use'] == 0) ? 'display:none;' : ''); ?>">
441
+ <input id="sq_auto_twittersize1" type="radio" class="sq_switch-input" name="sq_auto_twittersize" value="summary_large_image" <?php echo ((SQ_Tools::$options['sq_auto_twittersize'] <> 'summary') ? "checked" : '') ?> />
442
+ <label for="sq_auto_twittersize1" class="sq_switch-label sq_switch-label-off"><?php _e('Yes', _SQ_PLUGIN_NAME_); ?></label>
443
+ <input id="sq_auto_twittersize0" type="radio" class="sq_switch-input" name="sq_auto_twittersize" value="summary" <?php echo ((SQ_Tools::$options['sq_auto_twittersize'] == 'summary') ? "checked" : '') ?> />
444
+ <label for="sq_auto_twittersize0" class="sq_switch-label sq_switch-label-on"><?php _e('No', _SQ_PLUGIN_NAME_); ?></label>
445
+ <span class="sq_switch-selection"></span>
446
+ </div>
447
+ <span><?php echo sprintf(__('Use <strong>Twitter %ssummary_large_image%s</strong> for your tweeter card. ', _SQ_PLUGIN_NAME_) ,'<a href="https://dev.twitter.com/cards/types/summary-large-image" target="_blank" title="Twitter Large Summary">','</a> ') . ''; ?></span>
448
+ <br />
449
  <span style="color: #f7681a; margin-top: 9px; text-align: center; <?php echo ((SQ_Tools::$options['sq_twitter_account'] <> '') ? 'display:none' : '') ?>"><?php echo __('You need to add your <strong>Twitter account</strong> below', _SQ_PLUGIN_NAME_); ?></span>
450
 
451
  </div>
457
  <fieldset id="sq_social_media_accounts" style="<?php echo ((SQ_Tools::$options['sq_use'] == 0) ? 'display:none;' : ''); ?>">
458
  <legend class="sq_legend_medium">
459
  <span class="sq_legend_title"><?php _e('Social Media Accounts', _SQ_PLUGIN_NAME_); ?></span>
460
+ <span><?php echo sprintf(__('%sLink your Google+ profile to the content you create%s', _SQ_PLUGIN_NAME_), '<a href="https://developers.google.com/structured-data/" target="_blank">', '</a>'); ?></span>
461
  <span><?php echo sprintf(__('%sTwitter account is mandatory for <strong>Twitter Card Validation</strong>%s', _SQ_PLUGIN_NAME_), '<a href="https://dev.twitter.com/docs/cards/validation/validator" target="_blank">', '</a>'); ?></span>
462
  <span><?php echo sprintf(__('%sAdd all your social accounts for <strong>JSON-LD Semantic SEO</strong>%s', _SQ_PLUGIN_NAME_), '<a href="http://howto.squirrly.c%so/sides/squirrly-json-ld-structured-data/" target="_blank">', '</a>'); ?></span>
463
  <span><?php echo sprintf(__('%sSpecify your social profiles to Google%s', _SQ_PLUGIN_NAME_), '<a href="https://developers.google.com/structured-data/customize/social-profiles" target="_blank">', '</a>'); ?></span>
themes/default/css/sq_feed.css ADDED
@@ -0,0 +1,337 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* http://meyerweb.com/eric/tools/css/reset/
2
+ v2.0 | 20110126
3
+ License: none (public domain)
4
+ */
5
+ /* HTML5 display-role reset for older browsers */
6
+ article,
7
+ aside,
8
+ details,
9
+ figcaption,
10
+ figure,
11
+ footer,
12
+ header,
13
+ hgroup,
14
+ menu,
15
+ nav,
16
+ section {
17
+ display: block;
18
+ }
19
+ body {
20
+ line-height: 1;
21
+ }
22
+ ol,
23
+ ul {
24
+ list-style: none;
25
+ }
26
+ blockquote,
27
+ q {
28
+ quotes: none;
29
+ }
30
+ blockquote:before,
31
+ blockquote:after,
32
+ q:before,
33
+ q:after {
34
+ content: '';
35
+ content: none;
36
+ }
37
+ table {
38
+ border-collapse: collapse;
39
+ border-spacing: 0;
40
+ }
41
+ * {
42
+ box-sizing: border-box;
43
+ -webkit-appearance: none;
44
+ -moz-appearance: none;
45
+ appearance: none;
46
+ }
47
+ .cf {
48
+ *zoom: 1;
49
+ }
50
+ .cf:before,
51
+ .cf:after {
52
+ content: "";
53
+ display: table;
54
+ }
55
+ .cf:after {
56
+ clear: both;
57
+ }
58
+ html {
59
+ background-color: #e9f3f1;
60
+ }
61
+ a:link,
62
+ a:visited,
63
+ a:active {
64
+ color: #428bca;
65
+ text-decoration: none;
66
+ }
67
+ a:hover {
68
+ text-decoration: underline;
69
+ }
70
+ body {
71
+ margin: 0 auto;
72
+ padding: 0;
73
+ font-family: Helvetica, Arial, sans-serif;
74
+ font-size: 13px;
75
+ color: #333;
76
+ }
77
+ p {
78
+ line-height: 22px;
79
+ font-size: 14px;
80
+ margin-bottom: 20px;
81
+ color: #444;
82
+ }
83
+ p strong {
84
+ font-weight: bold;
85
+ }
86
+ div#main {
87
+ margin: 0 auto;
88
+ width: 980px;
89
+ padding: 0;
90
+ }
91
+ div#header {
92
+ padding: 20px;
93
+ margin: 16px auto;
94
+ background: none;
95
+ border: none;
96
+ border-radius: 8px;
97
+ *zoom: 1;
98
+ }
99
+ div#header:before,
100
+ div#header:after {
101
+ content: "";
102
+ display: table;
103
+ }
104
+ div#header:after {
105
+ clear: both;
106
+ }
107
+ div#header h1 {
108
+ font-size: 32px;
109
+ color: #900;
110
+ line-height: 101%;
111
+ letter-spacing: -0.5px;
112
+ }
113
+ div#header h2 {
114
+ font-size: 15px;
115
+ color: #999;
116
+ }
117
+ div#header p.about {
118
+ color: #333;
119
+ font-size: 14px;
120
+ margin: 10px 0 3px;
121
+ line-height: 1.3;
122
+ }
123
+ div#header img#feedimage {
124
+ float: right;
125
+ padding-bottom: 10px;
126
+ max-width: 200px;
127
+ max-height: 110px;
128
+ }
129
+ div#subscribe {
130
+ margin: 0 0 18px 0;
131
+ padding: 20px 20px 30px;
132
+ border-radius: 8px;
133
+ }
134
+ div#subscribe h3 {
135
+ padding-left: 0;
136
+ font-size: 18px;
137
+ color: #888;
138
+ }
139
+ div#subscribe h4 {
140
+ font-weight: normal;
141
+ margin: 14px 0 6px 0;
142
+ }
143
+ div#subscribe div#feedinput {
144
+ text-align: center;
145
+ }
146
+ div#subscribe div#feedinput input[type=text] {
147
+ padding: 6px;
148
+ border: 1px solid #d4d4d4;
149
+ font-size: 16px;
150
+ width: 500px;
151
+ color: #333;
152
+ outline: none;
153
+ }
154
+ div#subscribe div#feedinput input[type=button] {
155
+ padding: 6px;
156
+ border: 1px solid #5db85c;
157
+ background: #5db85c;
158
+ font-size: 16px;
159
+ width: 180px;
160
+ margin: 0 0 0 4px;
161
+ color: #fff;
162
+ outline: none;
163
+ font-weight: bold;
164
+ }
165
+ div#subscribe div#readerslinks {
166
+ text-align: center;
167
+ }
168
+ div#subscribe div#xmllink {
169
+ text-align: center;
170
+ }
171
+ div#subscribe div#newsletterlink {
172
+ text-align: center;
173
+ }
174
+ div#subscribe div img {
175
+ padding-left: 3px;
176
+ padding-right: 3px;
177
+ padding-bottom: 3px;
178
+ }
179
+ div#subscribe p {
180
+ margin-top: 12px;
181
+ line-height: 150%;
182
+ }
183
+ ul li.regularitem {
184
+ padding: 20px 20px 5px;
185
+ border: 1px dashed #d4d4d4;
186
+ border-radius: 8px;
187
+ margin-bottom: 40px;
188
+ background-color: white;
189
+ }
190
+ ul li.regularitem h4.itemtitle {
191
+ font-size: 26px;
192
+ margin: 10px 0;
193
+ padding-bottom: 12px;
194
+ letter-spacing: -0.25px;
195
+ border-bottom: 1px dashed #d4d4d4;
196
+ }
197
+ ul li.regularitem h5.itemposttime {
198
+ font-size: 12px;
199
+ font-weight: normal;
200
+ color: #666;
201
+ margin-top: 3px;
202
+ margin-bottom: 20px;
203
+ }
204
+ ul li.regularitem h5.itemposttime span {
205
+ color: #999;
206
+ }
207
+ ul li.regularitem .thumbnail{
208
+ width: 100%;
209
+ height: auto;
210
+ max-height: 400px;
211
+ text-align: center;
212
+ border-bottom: 1px dashed #eee;
213
+ margin-bottom: 20px;
214
+ overflow: hidden;
215
+ box-shadow: 0 0 10px -2px #999;
216
+ }
217
+ ul li.regularitem .thumbnail img{
218
+ margin: 0 auto;
219
+ width: 500px;
220
+ }
221
+ ul li.regularitem div.itemcontent {
222
+ font-size: 14px;
223
+ line-height: 130% ! important;
224
+ overflow: hidden;
225
+ width: 99%;
226
+ /*img {
227
+ display: block;
228
+ margin: 0 auto 20px;
229
+ text-align: center;
230
+ }*/
231
+ }
232
+ ul li.regularitem div.itemcontent ul {
233
+ list-style: square;
234
+ padding-left: 1em;
235
+ margin-bottom: 1em;
236
+ }
237
+ ul li.regularitem div.itemcontent li {
238
+ margin-left: 2.4em;
239
+ margin-bottom: .5em;
240
+ }
241
+ ul li.regularitem div.itemcontent ol {
242
+ list-style-type: decimal;
243
+ margin-bottom: 1em;
244
+ }
245
+ ul li.regularitem div.itemcontent img[align=right] {
246
+ padding-left: 12px;
247
+ padding-bottom: 12px;
248
+ }
249
+ ul li.regularitem div.itemcontent img[align=left] {
250
+ padding-right: 12px;
251
+ padding-bottom: 12px;
252
+ }
253
+ ul li.regularitem div.itemcontent iframe {
254
+ display: block !important;
255
+ margin: 0 auto 25px !important;
256
+ text-align: center;
257
+ }
258
+ ul li.regularitem div.itemcontent pre {
259
+ border: 0 !important;
260
+ font-size: 13px;
261
+ margin: 0 25px 25px;
262
+ font-family: Inconsolata, Monaco, Consolas, "Liberation Mono", Lucida Console, monospace;
263
+ white-space: pre-wrap;
264
+ /* CSS3 */
265
+ white-space: -moz-pre-wrap;
266
+ /* Mozilla, post millennium */
267
+ white-space: -pre-wrap;
268
+ /* Opera 4-6 */
269
+ white-space: -o-pre-wrap;
270
+ /* Opera 7 */
271
+ word-wrap: break-word;
272
+ /* Internet Explorer 5.5+ */
273
+ }
274
+ ul li.regularitem div.itemcontent blockquote {
275
+ margin: 25px;
276
+ }
277
+ ul li.regularitem p.mediaenclosure {
278
+ text-transform: uppercase;
279
+ font-weight: bold;
280
+ margin: 10px 0 10px 0;
281
+ }
282
+ ul li.regularitem p.mediaenclosure a {
283
+ text-transform: none;
284
+ }
285
+ ul li.regularitem audio {
286
+ width: 100%;
287
+ margin: 10px 10px 20px 10px;
288
+ }
289
+ #footer {
290
+ height: 60px;
291
+ padding: 20px 20px 5px;
292
+ background: rgba(255, 255, 255, 0.75);
293
+ border-top: 1px dashed #d4d4d4;
294
+ }
295
+ #footer p {
296
+ line-height: 140%;
297
+ }
298
+ #footer img {
299
+ float: right;
300
+ margin: 0 0 0 10px;
301
+ }
302
+ @media screen and (max-width: 980px) {
303
+ div#main {
304
+ width: auto;
305
+ }
306
+ div#header {
307
+ margin: 0;
308
+ border: 0;
309
+ border-radius: 0;
310
+ }
311
+ div#header img {
312
+ display: none;
313
+ }
314
+ div#subscribe {
315
+ margin: 0;
316
+ border: 0;
317
+ border-radius: 0;
318
+ }
319
+ div#subscribe div#feedinput input[type=text] {
320
+ max-width: 100%;
321
+ }
322
+ ul li.regularitem {
323
+ margin-bottom: 0;
324
+ border: 0;
325
+ border-radius: 0;
326
+ }
327
+ #footer p {
328
+ text-align: center;
329
+ }
330
+ #footer img {
331
+ float: none;
332
+ display: block;
333
+ margin: 0 auto 15px;
334
+ }
335
+ }
336
+
337
+ .sr-only{position:absolute!important;clip:rect(1px,1px,1px,1px);padding:0!important;border:0!important;height:1px!important;width:1px!important;overflow:hidden}@-webkit-keyframes progress{to{background-position:40px 0}}@keyframes progress{to{background-position:40px 0}}.player{position:relative;max-width:100%;min-width:290px}.player,.player *,.player ::after,.player ::before{box-sizing:border-box}.player-video-wrapper{position:relative}.player video{width:100%;height:auto;vertical-align:middle}.player-captions{display:none;position:absolute;bottom:0;left:0;width:100%;padding:20px;min-height:2.5em;color:#fff;font-size:16px;font-weight:600;text-shadow:-1px -1px 0 #565d64,1px -1px 0 #565d64,-1px 1px 0 #565d64,1px 1px 0 #565d64;text-align:center;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}@media (min-width:768px){.player-captions{font-size:24px}}.player.captions-active .player-captions{display:block}.player-controls{zoom:1;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;position:relative;padding:10px;background:#343f4a;line-height:1;text-align:center}.player-controls:after,.player-controls:before{content:"";display:table}.player-controls:after{clear:both}.player-controls-right{display:block;margin:10px auto 0}@media (min-width:560px){.player-controls-left{float:left}.player-controls-right{float:right;margin-top:0}}.player-controls button,.player-controls input+label{display:inline-block;vertical-align:middle;margin:0 2px;padding:5px 10px;transition:background .3s ease;border-radius:3px;cursor:pointer}.player-controls button svg,.player-controls input+label svg{width:18px;height:18px;display:block;fill:currentColor;transition:fill .3s ease}.player-controls .inverted:checked+label,.player-controls input+label{color:#565d64}.player-controls .inverted+label,.player-controls button,.player-controls input:checked+label{color:#cbd0d3}.player-controls button{border:0;background:0 0;overflow:hidden}.player-controls [type=checkbox]+label:hover,.player-controls [type=checkbox]:focus+label,.player-controls button:focus,.player-controls button:hover{background:#3498db;color:#fff}.player-controls button:focus,.player-controls input:focus+label{outline:0}.player-controls .icon-captions-on,.player-controls .icon-exit-fullscreen,.player-controls .icon-muted{display:none}.player-controls .player-time{display:inline-block;vertical-align:middle;margin-left:10px;color:#cbd0d3;font-weight:600;font-size:14px;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.player-tooltip{visibility:hidden;position:absolute;z-index:2;bottom:100%;margin-bottom:10px;padding:10px 15px;opacity:0;background:#343f4a;border-radius:3px;color:#fff;font-size:14px;line-height:1.5;font-weight:600;-webkit-transform:translate(-50%,30px);transform:translate(-50%,30px);transition:-webkit-transform .2s .2s ease,opacity .2s .2s ease;transition:transform .2s .2s ease,opacity .2s .2s ease}.player-tooltip::after{content:"";display:block;position:absolute;left:50%;bottom:-5px;margin-left:-5px;width:0;height:0;transition:inherit;border-style:solid;border-width:5px 5px 0;border-color:#343f4a transparent transparent}.player button:focus .player-tooltip,.player button:hover .player-tooltip,.player input:focus+label .player-tooltip,.player label:hover .player-tooltip{visibility:visible;opacity:1;-webkit-transform:translate(-50%,0);transform:translate(-50%,0)}.player button:hover .player-tooltip,.player label:hover .player-tooltip{z-index:3}.player-progress{position:absolute;bottom:100%;left:0;right:0;width:100%;height:10px;background:rgba(86,93,100,.2)}.player-progress-buffer[value],.player-progress-played[value],.player-progress-seek[type=range]{position:absolute;left:0;top:0;width:100%;height:10px;margin:0;padding:0;vertical-align:top;-webkit-appearance:none;-moz-appearance:none;border:none;background:0 0}.player-progress-buffer[value]::-webkit-progress-bar,.player-progress-played[value]::-webkit-progress-bar{background:0 0}.player-progress-buffer[value]::-webkit-progress-value,.player-progress-played[value]::-webkit-progress-value{background:currentColor}.player-progress-buffer[value]::-moz-progress-bar,.player-progress-played[value]::-moz-progress-bar{background:currentColor}.player-progress-played[value]{z-index:2;color:#3498db}.player-progress-buffer[value]{color:rgba(86,93,100,.25)}.player-progress-seek[type=range]{z-index:4;cursor:pointer;outline:0}.player-progress-seek[type=range]::-webkit-slider-runnable-track{background:0 0;border:0}.player-progress-seek[type=range]::-webkit-slider-thumb{-webkit-appearance:none;background:0 0;border:0;width:20px;height:10px}.player-progress-seek[type=range]::-moz-range-track{background:0 0;border:0}.player-progress-seek[type=range]::-moz-range-thumb{-moz-appearance:none;background:0 0;border:0;width:20px;height:10px}.player-progress-seek[type=range]::-ms-track{color:transparent;background:0 0;border:0}.player-progress-seek[type=range]::-ms-fill-lower,.player-progress-seek[type=range]::-ms-fill-upper{background:0 0;border:0}.player-progress-seek[type=range]::-ms-thumb{background:0 0;border:0;width:20px;height:10px}.player-progress-seek[type=range]:focus{outline:0}.player-progress-seek[type=range]::-moz-focus-outer{border:0}.player.loading .player-progress-buffer{-webkit-animation:progress 1s linear infinite;animation:progress 1s linear infinite;background-size:40px 40px;background-repeat:repeat-x;background-color:rgba(86,93,100,.25);background-image:linear-gradient(-45deg,rgba(0,0,0,.15) 25%,transparent 25%,transparent 50%,rgba(0,0,0,.15) 50%,rgba(0,0,0,.15) 75%,transparent 75%,transparent);color:transparent}.player-controls [data-player=pause],.player.playing .player-controls [data-player=play]{display:none}.player.playing .player-controls [data-player=pause]{display:inline-block}.player-volume[type=range]{display:inline-block;vertical-align:middle;-webkit-appearance:none;-moz-appearance:none;width:100px;margin:0 10px 0 0;padding:0;cursor:pointer;background:0 0}.player-volume[type=range]::-webkit-slider-runnable-track{height:6px;background:#565d64;border:0;border-radius:3px}.player-volume[type=range]::-webkit-slider-thumb{-webkit-appearance:none;margin-top:-3px;height:12px;width:12px;background:#cbd0d3;border:0;border-radius:6px;transition:background .3s ease;cursor:ew-resize}.player-volume[type=range]::-moz-range-track{height:6px;background:#565d64;border:0;border-radius:3px}.player-volume[type=range]::-moz-range-thumb{height:12px;width:12px;background:#cbd0d3;border:0;border-radius:6px;transition:background .3s ease;cursor:ew-resize}.player-volume[type=range]::-ms-track{height:6px;background:0 0;border-color:transparent;border-width:3px 0;color:transparent}.player-volume[type=range]::-ms-fill-lower,.player-volume[type=range]::-ms-fill-upper{height:6px;background:#565d64;border:0;border-radius:3px}.player-volume[type=range]::-ms-thumb{height:12px;width:12px;background:#cbd0d3;border:0;border-radius:6px;transition:background .3s ease;cursor:ew-resize}.player-volume[type=range]:focus{outline:0}.player-volume[type=range]:focus::-webkit-slider-thumb{background:#3498db}.player-volume[type=range]:focus::-moz-range-thumb{background:#3498db}.player-volume[type=range]:focus::-ms-thumb{background:#3498db}.player-audio.ios .player-controls-right,.player.ios .player-volume,.player.ios [data-player=mute],.player.ios [data-player=mute]+label{display:none}.player-audio.ios .player-controls-left{float:none}.player-fullscreen,.player.fullscreen-active{position:fixed;top:0;left:0;right:0;bottom:0;height:100%;width:100%;z-index:10000000;background:#000}.player-fullscreen video,.player.fullscreen-active video{height:100%}.player-fullscreen .player-video-wrapper,.player.fullscreen-active .player-video-wrapper{height:100%;width:100%}.player-fullscreen .player-video-wrapper .player-captions,.player.fullscreen-active .player-video-wrapper .player-captions{top:auto;bottom:90px}@media (min-width:560px) and (max-width:767px){.player-fullscreen .player-video-wrapper .player-captions,.player.fullscreen-active .player-video-wrapper .player-captions{bottom:60px}}@media (min-width:768px){.player-fullscreen .player-video-wrapper .player-captions,.player.fullscreen-active .player-video-wrapper .player-captions{bottom:80px}}.player-fullscreen .player-controls,.player.fullscreen-active .player-controls{position:absolute;bottom:0;left:0;right:0}.player-fullscreen.fullscreen-hide-controls.playing .player-controls,.player.fullscreen-active.fullscreen-hide-controls.playing .player-controls{-webkit-transform:translateY(100%) translateY(5px);transform:translateY(100%) translateY(5px);transition:-webkit-transform .3s 1s ease;transition:transform .3s 1s ease}.player-fullscreen.fullscreen-hide-controls.playing .player-controls.hover,.player.fullscreen-active.fullscreen-hide-controls.playing .player-controls.hover{-webkit-transform:translateY(0);transform:translateY(0);transition-delay:0}.player.captions-active .player-controls .icon-captions-on,.player.fullscreen-active .icon-exit-fullscreen,.player.muted .player-controls .icon-muted{display:block}.player [data-player=captions],.player [data-player=captions]+label,.player [data-player=fullscreen],.player [data-player=fullscreen]+label,.player.captions-active .player-controls .icon-captions-on+svg,.player.fullscreen-active .icon-exit-fullscreen+svg,.player.muted .player-controls .icon-muted+svg{display:none}.player.captions-enabled [data-player=captions],.player.captions-enabled [data-player=captions]+label,.player.fullscreen-enabled [data-player=fullscreen],.player.fullscreen-enabled [data-player=fullscreen]+label{display:inline-block}
themes/default/css/sq_feed.xsl ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:feedpress="https://feed.press/xmlns" version="1.0">
2
+ <xsl:variable name="freeVersion">false</xsl:variable>
3
+ <xsl:include href="sq_feedstyle.xsl"/>
4
+ <xsl:template match="/">
5
+ <xsl:element name="html">
6
+ <xsl:copy-of select="$html_TemplateHeader"/>
7
+ <xsl:apply-templates select="rss/channel"/>
8
+ </xsl:element>
9
+ </xsl:template>
10
+ <xsl:template match="channel">
11
+ <body>
12
+ <div id="cometestme" style="display:none;">
13
+ <xsl:text disable-output-escaping="yes">&amp;</xsl:text>
14
+ </div>
15
+ <div id="main">
16
+ <div id="header" class="cf">
17
+ <xsl:apply-templates select="image"/>
18
+ <xsl:copy-of select="$html_FeedHeader"/>
19
+ </div>
20
+
21
+ <ul>
22
+ <xsl:apply-templates select="item"/>
23
+ </ul>
24
+ <xsl:copy-of select="$html_FeedFooter"/>
25
+ </div>
26
+
27
+ </body>
28
+ </xsl:template>
29
+ </xsl:stylesheet>
30
+
themes/default/css/sq_feedstyle.xsl ADDED
@@ -0,0 +1,567 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:feedpress="https://feed.press/xmlns" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="1.0">
2
+ <!-- Doctype -->
3
+ <xsl:output method="html"/>
4
+ <!-- Common variables -->
5
+ <xsl:variable name="language">
6
+ <xsl:choose>
7
+ <xsl:when test="/rss/channel/language">
8
+ <xsl:value-of select="/rss/channel/language"/>
9
+ </xsl:when>
10
+ <xsl:otherwise>en</xsl:otherwise>
11
+ </xsl:choose>
12
+ </xsl:variable>
13
+ <xsl:variable name="locale">
14
+ <xsl:choose>
15
+ <xsl:when test="/rss/channel/feedpress:locale">
16
+ <xsl:value-of select="/rss/channel/feedpress:locale"/>
17
+ </xsl:when>
18
+ <xsl:when test="/atom:feed/feedpress:locale">
19
+ <xsl:value-of select="/atom:feed/feedpress:locale"/>
20
+ </xsl:when>
21
+ <xsl:otherwise>en</xsl:otherwise>
22
+ </xsl:choose>
23
+ </xsl:variable>
24
+ <xsl:variable name="title">
25
+ <xsl:choose>
26
+ <xsl:when test="/rss/channel/title">
27
+ <xsl:value-of select="/rss/channel/title"/>
28
+ </xsl:when>
29
+ <xsl:when test="atom:feed/atom:title">
30
+ <xsl:value-of select="atom:feed/atom:title"/>
31
+ </xsl:when>
32
+ <xsl:otherwise>
33
+ <xsl:text/>
34
+ </xsl:otherwise>
35
+ </xsl:choose>
36
+ </xsl:variable>
37
+ <xsl:variable name="subTitle">
38
+ <xsl:choose>
39
+ <xsl:when test="/rss/channel/itunes:subtitle">
40
+ <xsl:value-of select="/rss/channel/itunes:subtitle"/>
41
+ </xsl:when>
42
+ <xsl:when test="/rss/channel/description">
43
+ <xsl:value-of select="/rss/channel/description"/>
44
+ </xsl:when>
45
+ <xsl:when test="atom:feed/atom:subtitle">
46
+ <xsl:value-of select="atom:feed/atom:subtitle"/>
47
+ </xsl:when>
48
+ <xsl:otherwise>
49
+ <xsl:text/>
50
+ </xsl:otherwise>
51
+ </xsl:choose>
52
+ </xsl:variable>
53
+ <xsl:variable name="podcastId">
54
+ <xsl:choose>
55
+ <xsl:when test="/rss/channel/feedpress:podcastId">
56
+ <xsl:value-of select="/rss/channel/feedpress:podcastId"/>
57
+ </xsl:when>
58
+ <xsl:when test="/atom:feed/feedpress:podcastId">
59
+ <xsl:value-of select="/atom:feed/feedpress:podcastId"/>
60
+ </xsl:when>
61
+ <xsl:otherwise>
62
+ <xsl:text/>
63
+ </xsl:otherwise>
64
+ </xsl:choose>
65
+ </xsl:variable>
66
+ <xsl:variable xmlns:atom10="http://www.w3.org/2005/Atom" name="feedUrl">
67
+ <xsl:choose>
68
+ <xsl:when test="/rss/channel/atom10:link[@rel='via']/@href">
69
+ <xsl:value-of select="/rss/channel/atom10:link[@rel='via']/@href"/>
70
+ </xsl:when>
71
+ <xsl:when test="atom:feed/atom:link[@rel='via']/@href">
72
+ <xsl:value-of select="atom:feed/atom:link[@rel='via']/@href"/>
73
+ </xsl:when>
74
+ <xsl:otherwise>
75
+ <xsl:choose>
76
+ <xsl:when test="/rss/channel/atom10:link[@rel='self']/@href">
77
+ <xsl:value-of select="/rss/channel/atom10:link[@rel='self']/@href"/>
78
+ </xsl:when>
79
+ <xsl:when test="atom:feed/atom:link[@rel='self']/@href">
80
+ <xsl:value-of select="atom:feed/atom:link[@rel='self']/@href"/>
81
+ </xsl:when>
82
+ <xsl:otherwise>
83
+ <xsl:text/>
84
+ </xsl:otherwise>
85
+ </xsl:choose>
86
+ </xsl:otherwise>
87
+ </xsl:choose>
88
+ </xsl:variable>
89
+ <xsl:variable name="siteUrl">
90
+ <xsl:choose>
91
+ <xsl:when test="atom:feed/atom:link[@rel='alternate']/@href">
92
+ <xsl:value-of select="atom:feed/atom:link[@rel='alternate']/@href"/>
93
+ </xsl:when>
94
+ <xsl:when test="/rss/channel/link">
95
+ <xsl:value-of select="/rss/channel/link"/>
96
+ </xsl:when>
97
+ <xsl:otherwise>
98
+ <xsl:text/>
99
+ </xsl:otherwise>
100
+ </xsl:choose>
101
+ </xsl:variable>
102
+ <xsl:variable name="newsletterId">
103
+ <xsl:choose>
104
+ <xsl:when test="/rss/channel/feedpress:newsletterId">
105
+ <xsl:value-of select="/rss/channel/feedpress:newsletterId"/>
106
+ </xsl:when>
107
+ <xsl:when test="/atom:feed/feedpress:newsletterId">
108
+ <xsl:value-of select="/atom:feed/feedpress:newsletterId"/>
109
+ </xsl:when>
110
+ <xsl:otherwise>none</xsl:otherwise>
111
+ </xsl:choose>
112
+ </xsl:variable>
113
+ <xsl:variable name="cssFile">
114
+ <xsl:choose>
115
+ <xsl:when test="/rss/channel/feedcss">
116
+ <xsl:value-of select="/rss/channel/feedcss"/>
117
+ </xsl:when>
118
+ <xsl:when test="/atom:feed/feedcss">
119
+ <xsl:value-of select="/atom:feed/feedcss"/>
120
+ </xsl:when>
121
+ <xsl:otherwise>/sqfeedcss</xsl:otherwise>
122
+ </xsl:choose>
123
+ </xsl:variable>
124
+ <!-- Localization -->
125
+ <xsl:variable name="lang_Subscribe">
126
+ <xsl:choose>
127
+ <xsl:when test="$locale='fr'">Inscription</xsl:when>
128
+ <xsl:when test="$locale='ru'">Подписаться</xsl:when>
129
+ <xsl:when test="$locale='pt'">Subscrever</xsl:when>
130
+ <xsl:when test="$locale='ca'">Subscriu-t’hi</xsl:when>
131
+ <xsl:when test="$locale='it'">Iscriviti</xsl:when>
132
+ <xsl:when test="$locale='es'">Suscríbete</xsl:when>
133
+ <xsl:otherwise>Subscribe</xsl:otherwise>
134
+ </xsl:choose>
135
+ </xsl:variable>
136
+ <xsl:variable name="lang_CopyPaste">
137
+ <xsl:choose>
138
+ <xsl:when test="$locale='fr'">
139
+ Copiez et collez l'adresse du flux dans votre lecteur RSS préféré pour vous inscrire :
140
+ </xsl:when>
141
+ <xsl:when test="$locale='ru'">
142
+ Скопируйте и вставьте ссылку на фид в свой любимый ридер, чтобы подписаться.
143
+ </xsl:when>
144
+ <xsl:when test="$locale='pt'">
145
+ Copie e cole o atalho do feed no seu leitor favorito para subscrever:
146
+ </xsl:when>
147
+ <xsl:when test="$locale='engb'">
148
+ Copy and paste the feed URL in your favourite reader to subscribe:
149
+ </xsl:when>
150
+ <xsl:when test="$locale='enca'">
151
+ Copy and paste the feed URL in your favourite reader to subscribe:
152
+ </xsl:when>
153
+ <xsl:when test="$locale='ca'">
154
+ Copia i enganxa l’adreça web del “feed” al teu lector preferit per subscriure-t’hi:
155
+ </xsl:when>
156
+ <xsl:when test="$locale='it'">
157
+ Per iscriverti copia e incolla l'URL del feed nel reader preferito:
158
+ </xsl:when>
159
+ <xsl:when test="$locale='es'">
160
+ Copia y pega la dirección RSS en tu lector de noticias favorito para suscribirte:
161
+ </xsl:when>
162
+ <xsl:otherwise>
163
+ Copy and paste the feed URL in your favorite reader to subscribe:
164
+ </xsl:otherwise>
165
+ </xsl:choose>
166
+ </xsl:variable>
167
+ <xsl:variable name="lang_ClickLink">
168
+ <xsl:choose>
169
+ <xsl:when test="$locale='fr'">Ou cliquez directement sur un de ces liens :</xsl:when>
170
+ <xsl:when test="$locale='ru'">Или нажмите на одну из этих ссылок:</xsl:when>
171
+ <xsl:when test="$locale='pt'">Ou clique directamente num destes atalhos:</xsl:when>
172
+ <xsl:when test="$locale='ca'">O clica directament un dels enllaços:</xsl:when>
173
+ <xsl:when test="$locale='it'">Oppure fai click su uno di questi link:</xsl:when>
174
+ <xsl:when test="$locale='es'">O pulsa directamente en uno de estos enlaces:</xsl:when>
175
+ <xsl:otherwise>Or directly click on one of these links:</xsl:otherwise>
176
+ </xsl:choose>
177
+ </xsl:variable>
178
+ <xsl:variable name="lang_SubscribeEmail">
179
+ <xsl:choose>
180
+ <xsl:when test="$locale='fr'">
181
+ S'inscrire à
182
+ <xsl:value-of select="$title"/>
183
+ par email
184
+ </xsl:when>
185
+ <xsl:when test="$locale='ru'">
186
+ Подпишитесь на
187
+ <xsl:value-of select="$title"/>
188
+ по E-mail
189
+ </xsl:when>
190
+ <xsl:when test="$locale='pt'">
191
+ Subscreva o feed
192
+ <xsl:value-of select="$title"/>
193
+ por email
194
+ </xsl:when>
195
+ <xsl:when test="$locale='ca'">
196
+ Subscriu-te a
197
+ <xsl:value-of select="$title"/>
198
+ per correu electrònic
199
+ </xsl:when>
200
+ <xsl:when test="$locale='it'">
201
+ Iscriviti a
202
+ <xsl:value-of select="$title"/>
203
+ via email
204
+ </xsl:when>
205
+ <xsl:when test="$locale='es'">
206
+ Suscríbete a
207
+ <xsl:value-of select="$title"/>
208
+ por correo
209
+ </xsl:when>
210
+ <xsl:otherwise>
211
+ Subscribe to
212
+ <xsl:value-of select="$title"/>
213
+ by email
214
+ </xsl:otherwise>
215
+ </xsl:choose>
216
+ </xsl:variable>
217
+ <xsl:variable name="lang_Posted">
218
+ <xsl:choose>
219
+ <xsl:when test="$locale='fr'">Posté le :</xsl:when>
220
+ <xsl:when test="$locale='ru'">Опубликовано:</xsl:when>
221
+ <xsl:when test="$locale='pt'">Publicado:</xsl:when>
222
+ <xsl:when test="$locale='ca'">Enviat:</xsl:when>
223
+ <xsl:when test="$locale='it'">Pubblicato:</xsl:when>
224
+ <xsl:when test="$locale='es'">Publicado:</xsl:when>
225
+ <xsl:otherwise>Posted:</xsl:otherwise>
226
+ </xsl:choose>
227
+ </xsl:variable>
228
+ <xsl:variable name="lang_Enclosure">
229
+ <xsl:choose>
230
+ <xsl:when test="$locale='fr'">Fichier joint :</xsl:when>
231
+ <xsl:when test="$locale='pt'">Anexo:</xsl:when>
232
+ <xsl:when test="$locale='ca'">Arxiu:</xsl:when>
233
+ <xsl:when test="$locale='it'">Allegato:</xsl:when>
234
+ <xsl:otherwise>Enclosure:</xsl:otherwise>
235
+ </xsl:choose>
236
+ </xsl:variable>
237
+ <xsl:variable name="lang_ProvidedBy">
238
+ <xsl:choose>
239
+ <xsl:when test="$locale='fr'">fourni par FeedPress</xsl:when>
240
+ <xsl:when test="$locale='pt'">fornecido por FeedPress</xsl:when>
241
+ <xsl:otherwise>provided by FeedPress</xsl:otherwise>
242
+ </xsl:choose>
243
+ </xsl:variable>
244
+ <!-- Templates -->
245
+ <xsl:template xmlns:dc="http://purl.org/dc/elements/1.1/" match="item|atom:entry">
246
+ <li class="regularitem">
247
+ <h4 class="itemtitle">
248
+ <xsl:choose>
249
+ <xsl:when test="guid[@isPermaLink='true']">
250
+ <a href="{normalize-space(guid)}">
251
+ <xsl:value-of select="title"/>
252
+ </a>
253
+ </xsl:when>
254
+ <xsl:when test="link">
255
+ <a href="{normalize-space(link)}">
256
+ <xsl:value-of select="title"/>
257
+ </a>
258
+ </xsl:when>
259
+ <xsl:when test="guid[@isPermaLink='true']">
260
+ <a href="{normalize-space(guid)}">
261
+ <xsl:value-of select="atom:title"/>
262
+ </a>
263
+ </xsl:when>
264
+ <xsl:when test="atom:link">
265
+ <a href="{normalize-space(atom:link/@href)}">
266
+ <xsl:value-of select="atom:title"/>
267
+ </a>
268
+ </xsl:when>
269
+ <xsl:otherwise>
270
+ <xsl:choose>
271
+ <xsl:when test="atom:title">
272
+ <xsl:variable name="atitle" select="atom:title" />
273
+ <xsl:value-of select="atom:title"/>
274
+ </xsl:when>
275
+ <xsl:otherwise>
276
+ <xsl:variable name="atitle" select="title" />
277
+ <xsl:value-of select="title"/>
278
+ </xsl:otherwise>
279
+ </xsl:choose>
280
+ </xsl:otherwise>
281
+ </xsl:choose>
282
+ </h4>
283
+ <h5 class="itemposttime">
284
+ <xsl:if test="count(child::pubDate)=1">
285
+ <span>
286
+ <xsl:value-of select="$lang_Posted"/>
287
+ </span>
288
+ <span class="itemposttime-data">
289
+ <xsl:value-of select="pubDate"/>
290
+ </span>
291
+ </xsl:if>
292
+ <xsl:if test="count(child::dc:date)=1">
293
+ <span>
294
+ <xsl:value-of select="$lang_Posted"/>
295
+ </span>
296
+ <span class="itemposttime-data">
297
+ <xsl:value-of select="dc:date"/>
298
+ </span>
299
+ </xsl:if>
300
+ </h5>
301
+ <div class="itemcontent" name="decodeable">
302
+ <xsl:call-template name="outputContent"/>
303
+ </div>
304
+ <xsl:choose>
305
+ <xsl:when test="count(child::enclosure)=1">
306
+ <p class="mediaenclosure">
307
+ <xsl:value-of select="$lang_Enclosure"/>
308
+ <a href="{enclosure/@url}">
309
+ <xsl:value-of select="child::enclosure/@url"/>
310
+ </a>
311
+ </p>
312
+ <xsl:if test="contains(enclosure/@url, '.mp3')">
313
+ <audio controls="enabled" preload="none">
314
+ <source src="{enclosure/@url}" type="audio/mpeg"/>
315
+ </audio>
316
+ </xsl:if>
317
+ <xsl:if test="contains(enclosure/@url, '.m4a')">
318
+ <audio controls="enabled" preload="none">
319
+ <source src="{enclosure/@url}" type="audio/mp4"/>
320
+ </audio>
321
+ </xsl:if>
322
+ <xsl:if test="contains(enclosure/@url, '.mp4')">
323
+ <div class="player">
324
+ <video controls="controls" preload="metadata">
325
+ <source src="{enclosure/@url}" type="video/mp4"/>
326
+ </video>
327
+ </div>
328
+ </xsl:if>
329
+ <xsl:if test="contains(enclosure/@url, '.m4v')">
330
+ <div class="player">
331
+ <video controls="controls" preload="metadata">
332
+ <source src="{enclosure/@url}" type="video/mp4"/>
333
+ </video>
334
+ </div>
335
+ </xsl:if>
336
+ </xsl:when>
337
+ <xsl:when test="count(child::atom:link[@rel=enclosure])=1">
338
+ <p class="mediaenclosure">
339
+ <xsl:value-of select="$lang_Enclosure"/>
340
+ <a href="{child::atom:link[@rel=enclosure]/@url}">
341
+ <xsl:value-of select="child::atom:link[@rel=enclosure]/@url"/>
342
+ </a>
343
+ </p>
344
+ <xsl:if test="contains(child::atom:link[@rel=enclosure]/@url, '.mp3')">
345
+ <audio controls="enabled" preload="none">
346
+ <source src="{child::atom:link[@rel=enclosure]/@url}" type="audio/mpeg"/>
347
+ </audio>
348
+ </xsl:if>
349
+ <xsl:if test="contains(child::atom:link[@rel=enclosure]/@url, '.m4a')">
350
+ <audio controls="enabled" preload="none">
351
+ <source src="{child::atom:link[@rel=enclosure]/@url}" type="audio/mp4"/>
352
+ </audio>
353
+ </xsl:if>
354
+ <xsl:if test="contains(child::atom:link[@rel=enclosure]/@url, '.mp4')">
355
+ <div class="player">
356
+ <video controls="controls" preload="metadata">
357
+ <source src="{child::atom:link[@rel=enclosure]/@url}" type="video/mp4"/>
358
+ </video>
359
+ </div>
360
+ </xsl:if>
361
+ <xsl:if test="contains(child::atom:link[@rel=enclosure]/@url, '.m4v')">
362
+ <div class="player">
363
+ <video controls="controls" preload="metadata">
364
+ <source src="{child::atom:link[@rel=enclosure]/@url}" type="video/mp4"/>
365
+ </video>
366
+ </div>
367
+ </xsl:if>
368
+ </xsl:when>
369
+ </xsl:choose>
370
+ </li>
371
+ </xsl:template>
372
+ <xsl:template match="image">
373
+ <a href="{normalize-space(link)}" title="{title}">
374
+ <img src="{url}" id="feedimage" alt="{title}"/>
375
+ </a>
376
+ <xsl:text/>
377
+ </xsl:template>
378
+
379
+ <xsl:template match="logo">
380
+ <img src="{logo}" id="feedimage"/>
381
+ <xsl:text/>
382
+ </xsl:template>
383
+
384
+
385
+ <xsl:template name="outputContent">
386
+ <xsl:choose>
387
+ <xsl:when xmlns:xhtml="http://www.w3.org/1999/xhtml" test="xhtml:body">
388
+ <xsl:copy-of select="xhtml:body/*"/>
389
+ </xsl:when>
390
+ <xsl:when xmlns:xhtml="http://www.w3.org/1999/xhtml" test="xhtml:div">
391
+ <xsl:copy-of select="xhtml:div"/>
392
+ </xsl:when>
393
+ <xsl:when xmlns:content="http://purl.org/rss/1.0/modules/content/" test="content:encoded">
394
+ <xsl:value-of select="content:encoded" disable-output-escaping="yes"/>
395
+ </xsl:when>
396
+ <xsl:when test="atom:content">
397
+ <xsl:value-of select="atom:content" disable-output-escaping="yes"/>
398
+ </xsl:when>
399
+ <xsl:when test="description">
400
+ <xsl:value-of select="description" disable-output-escaping="yes"/>
401
+ </xsl:when>
402
+ <xsl:when test="atom:summary">
403
+ <xsl:value-of select="atom:summary" disable-output-escaping="yes"/>
404
+ </xsl:when>
405
+ </xsl:choose>
406
+ </xsl:template>
407
+ <xsl:variable name="html_Subscribe">
408
+ <div id="subscribe">
409
+ <div id="feedinput">
410
+ <h4>
411
+ <xsl:value-of select="$lang_CopyPaste"/>
412
+ </h4>
413
+ <input type="text" name="feed" value="{$feedUrl}"/>
414
+ <input type="button" onclick="subscribeButton();" value="{$lang_Subscribe}"/>
415
+ </div>
416
+ <div id="readerslinks">
417
+ <h4>
418
+ <xsl:value-of select="$lang_ClickLink"/>
419
+ </h4>
420
+ <xsl:choose>
421
+ <xsl:when test="$locale='jp'">
422
+ <a class="subscribe" href="http://rd.yahoo.co.jp/myyahoo/rss/addtomy/users/*http://add.my.yahoo.co.jp/rss?url={$feedUrl}">
423
+ <img src="http://i.yimg.jp/i/jp/my/addtomy/standard_bb.gif" width="91" height="17" alt="My Yahoo!に追加"/>
424
+ </a>
425
+ </xsl:when>
426
+ <xsl:otherwise>
427
+ <a class="subscribe" href="http://add.my.yahoo.com/rss?url={$feedUrl}">
428
+ <img src="http://us.i1.yimg.com/us.yimg.com/i/us/my/addtomyyahoo4.gif" width="91" height="17" alt="My Yahoo!"/>
429
+ </a>
430
+ </xsl:otherwise>
431
+ </xsl:choose>
432
+ <a class="subscribe" href="http://www.feedly.com/home#subscription/feed/{$feedUrl}">
433
+ <img src="http://s3.feedly.com/img/follows/feedly-follow-rectangle-volume-small_2x.png" width="61" height="20" alt="Feedly"/>
434
+ </a>
435
+ <a class="subscribe" href="http://www.netvibes.com/subscribe.php?url={$feedUrl}">
436
+ <img src="http://www.netvibes.com/img/add2netvibes.gif" alt="Netvibes"/>
437
+ </a>
438
+ </div>
439
+ <xsl:choose>
440
+ <xsl:when test="$newsletterId!='none'">
441
+ <div id="newsletterlink">
442
+ <h4>
443
+ <a onclick="window.open('https://feed.press/e/mailverify?feed_id={$newsletterId}', 'popupwindow', 'scrollbars=yes,width=550,height=520');return true" target="popupwindow" href="https://feed.press/e/mailverify?feed_id={$newsletterId}">
444
+ <xsl:value-of select="$lang_SubscribeEmail"/>
445
+ </a>
446
+ </h4>
447
+ </div>
448
+ </xsl:when>
449
+ <xsl:otherwise></xsl:otherwise>
450
+ </xsl:choose>
451
+ </div>
452
+ </xsl:variable>
453
+ <xsl:variable name="html_TemplateHeader">
454
+ <head>
455
+ <title>
456
+ <xsl:value-of select="$title"/>
457
+ <xsl:if test="$freeVersion='true'">
458
+
459
+ <xsl:value-of select="$lang_ProvidedBy"/>
460
+ </xsl:if>
461
+ </title>
462
+ <link href="{$cssFile}" rel="stylesheet" type="text/css" media="all"/>
463
+ <xsl:choose>
464
+ <xsl:when test="$language='ar'">
465
+ <style>body {direction: rtl;}</style>
466
+ </xsl:when>
467
+ <xsl:otherwise/>
468
+ </xsl:choose>
469
+ <link rel="alternate" type="application/rss+xml" title="{$title}" href="{$feedUrl}"/>
470
+ <meta name="viewport" content="width=device-width"/>
471
+ <xsl:choose>
472
+ <xsl:when test="$podcastId">
473
+ <meta name="apple-itunes-app" content="app-id={$podcastId}"/>
474
+ </xsl:when>
475
+ <xsl:otherwise/>
476
+ </xsl:choose>
477
+
478
+ </head>
479
+ </xsl:variable>
480
+ <xsl:variable name="html_FeedHeader">
481
+ <h1>
482
+ <xsl:choose>
483
+ <xsl:when test="$siteUrl">
484
+ <a href="{normalize-space($siteUrl)}" title="{$title}">
485
+ <xsl:value-of select="$title"/>
486
+ </a>
487
+ </xsl:when>
488
+ <xsl:otherwise>
489
+ <xsl:value-of select="$title"/>
490
+ </xsl:otherwise>
491
+ </xsl:choose>
492
+ </h1>
493
+ <xsl:choose>
494
+ <xsl:when test="$freeVersion='true'">
495
+ <xsl:choose>
496
+ <xsl:when test="$locale='fr'">
497
+ <h2>proposé avec joie par FeedPress</h2>
498
+ <p class="about">
499
+ FeedPress donne de la puissance à ce flux pour que vous puissiez retrouver vos contenus préférés dans votre lecteur RSS.
500
+ <br/>
501
+ <a href="https://feed.press">Cliquez ici pour ajouter votre flux →</a>
502
+ </p>
503
+ </xsl:when>
504
+ <xsl:otherwise>
505
+ <h2>proudly brought to you by FeedPress</h2>
506
+ <p class="about">
507
+ FeedPress empowers this feed to let you add your favorite content easily in your reader of choice.
508
+ <br/>
509
+ <a href="https://feed.press">Click here to press your own feed →</a>
510
+ </p>
511
+ </xsl:otherwise>
512
+ </xsl:choose>
513
+ </xsl:when>
514
+ <xsl:otherwise>
515
+ <xsl:if test="$subTitle">
516
+ <h2>
517
+ <xsl:value-of select="$subTitle"/>
518
+ </h2>
519
+ </xsl:if>
520
+ </xsl:otherwise>
521
+ </xsl:choose>
522
+ </xsl:variable>
523
+ <xsl:variable name="html_FeedFooter">
524
+ <div id="footer">
525
+ <a href="https://plugin.squirrly.co">
526
+ <img src="//www.squirrly.co/wp-content/uploads/squirrly_logo.png" height="30" />
527
+ </a>
528
+ <p>
529
+ Feed generated with Squirrly SEO
530
+ </p>
531
+ </div>
532
+ </xsl:variable>
533
+ <xsl:variable name="html_FeedFooterScripts">
534
+ <xsl:element name="script">
535
+ <xsl:attribute name="type">text/javascript</xsl:attribute>
536
+ <xsl:attribute name="src">
537
+ //cdnjs.cloudflare.com/ajax/libs/jstimezonedetect/1.0.4/jstz.min.js
538
+ </xsl:attribute>
539
+ </xsl:element>
540
+ <xsl:element name="script">
541
+ <xsl:attribute name="type">text/javascript</xsl:attribute>
542
+ <xsl:attribute name="src">
543
+ //cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.3/moment.min.js
544
+ </xsl:attribute>
545
+ </xsl:element>
546
+ <xsl:element name="script">
547
+ <xsl:attribute name="type">text/javascript</xsl:attribute>
548
+ <xsl:attribute name="src">//static.feedpress.it/js/moment-timezone-data.js</xsl:attribute>
549
+ </xsl:element>
550
+ <xsl:element name="script">
551
+ <xsl:attribute name="type">text/javascript</xsl:attribute>
552
+ <xsl:attribute name="src">//static.feedpress.it/js/plyr.js</xsl:attribute>
553
+ </xsl:element>
554
+ <xsl:element name="script">
555
+ <xsl:attribute name="type">text/javascript</xsl:attribute>
556
+ <xsl:attribute name="src">//static.feedpress.it/js/feed.js</xsl:attribute>
557
+ </xsl:element>
558
+ <script>
559
+ <![CDATA[
560
+ (function(d,p){ var a=new XMLHttpRequest(), b=d.body; a.open("GET",p,!0); a.send(); a.onload=function(){ var c=d.createElement("div"); c.style.display="none"; c.innerHTML=a.responseText; b.insertBefore(c,b.childNodes[0]) } })(document,"//static.feedpress.it/svg/plyr.svg");
561
+ ]]>
562
+ </script>
563
+ <script>
564
+ <![CDATA[ plyr.setup(); ]]>
565
+ </script>
566
+ </xsl:variable>
567
+ </xsl:stylesheet>
themes/default/js/sq_blocksettingsseo.js CHANGED
@@ -260,6 +260,7 @@ function sq_submitSettings() {
260
  sq_auto_favicon: jQuery('#sq_settings').find('input[name=sq_auto_favicon]:checked').val(),
261
  sq_auto_facebook: jQuery('#sq_settings').find('input[name=sq_auto_facebook]:checked').val(),
262
  sq_auto_twitter: jQuery('#sq_settings').find('input[name=sq_auto_twitter]:checked').val(),
 
263
  sq_og_locale: jQuery('#sq_settings').find('select[name=sq_og_locale] option:selected').val(),
264
  //--
265
  sq_twitter_account: jQuery('#sq_settings').find('input[name=sq_twitter_account]').val(),
@@ -268,6 +269,7 @@ function sq_submitSettings() {
268
  sq_linkedin_account: jQuery('#sq_settings').find('input[name=sq_linkedin_account]').val(),
269
  //--
270
  sq_auto_sitemap: jQuery('#sq_settings').find('input[name=sq_auto_sitemap]:checked').val(),
 
271
  sq_sitemap: sq_sitemap,
272
  sq_sitemap_show: sq_sitemap_show,
273
  sq_sitemap_frequency: jQuery('#sq_settings').find('select[name=sq_sitemap_frequency] option:selected').val(),
260
  sq_auto_favicon: jQuery('#sq_settings').find('input[name=sq_auto_favicon]:checked').val(),
261
  sq_auto_facebook: jQuery('#sq_settings').find('input[name=sq_auto_facebook]:checked').val(),
262
  sq_auto_twitter: jQuery('#sq_settings').find('input[name=sq_auto_twitter]:checked').val(),
263
+ sq_auto_twittersize: jQuery('#sq_settings').find('input[name=sq_auto_twittersize]:checked').val(),
264
  sq_og_locale: jQuery('#sq_settings').find('select[name=sq_og_locale] option:selected').val(),
265
  //--
266
  sq_twitter_account: jQuery('#sq_settings').find('input[name=sq_twitter_account]').val(),
269
  sq_linkedin_account: jQuery('#sq_settings').find('input[name=sq_linkedin_account]').val(),
270
  //--
271
  sq_auto_sitemap: jQuery('#sq_settings').find('input[name=sq_auto_sitemap]:checked').val(),
272
+ sq_auto_feed: jQuery('#sq_settings').find('input[name=sq_auto_feed]:checked').val(),
273
  sq_sitemap: sq_sitemap,
274
  sq_sitemap_show: sq_sitemap_show,
275
  sq_sitemap_frequency: jQuery('#sq_settings').find('select[name=sq_sitemap_frequency] option:selected').val(),