Skip to content

Commit 9dc0fce

Browse files
committed
Upgrade Plugin Update Checker to v5.6, enhancing auto-update integration and security. Updated README and readme.txt with new features and improvements. Removed deprecated files and adjusted code for compatibility with the latest version.
1 parent 382ff34 commit 9dc0fce

File tree

126 files changed

+3720
-2325
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

126 files changed

+3720
-2325
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,14 @@ For Tutorial check [Infinite Scroll Elementor documentation](https://joychetry.c
6565
- ✅ Added class existence checks to prevent fatal errors
6666
- ✅ Implemented graceful fallback for deprecated Elementor features
6767

68+
**Plugin Update Checker Upgrade:**
69+
- ✅ Updated Plugin Update Checker from v4.11 to v5.6 (4-year upgrade)
70+
- ✅ Added WordPress 5.5+ auto-updates integration for better user experience
71+
- ✅ Improved ZIP handling for more reliable plugin updates
72+
- ✅ Enhanced security with 4+ years of accumulated patches
73+
- ✅ Added broader internationalization support
74+
- ✅ Better Debug Bar integration for debugging capabilities
75+
6876

6977
**Bug Fixes:**
7078
- ✅ Resolved SearchWP integration fatal errors related to deprecated Elementor classes

infinite-scroll-elementor.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,15 +116,14 @@ public function admin_notice_minimum_php_version()
116116

117117
// Check for updates
118118
require 'plugin-update-checker/plugin-update-checker.php';
119-
$myUpdateChecker = Puc_v4_Factory::buildUpdateChecker(
119+
use YahnisElsts\PluginUpdateChecker\v5p6\PucFactory;
120+
121+
$myUpdateChecker = PucFactory::buildUpdateChecker(
120122
'https://github.com/joychetry/infinite-scroll-elementor',
121123
__FILE__,
122124
'infinite-scroll-elementor'
123125
);
124126

125-
//Optional: If you're using a private repository, specify the access token like this:
126-
//$myUpdateChecker->setAuthentication('Add_Code');
127-
128127
//Optional: Set the branch that contains the stable release.
129128
$myUpdateChecker->setBranch('master');
130129

plugin-update-checker/.editorconfig

Lines changed: 0 additions & 15 deletions
This file was deleted.

plugin-update-checker/.gitignore

Lines changed: 0 additions & 40 deletions
This file was deleted.

plugin-update-checker/Puc/v4/Factory.php

Lines changed: 0 additions & 6 deletions
This file was deleted.

plugin-update-checker/Puc/v4p11/Autoloader.php

Lines changed: 0 additions & 63 deletions
This file was deleted.

plugin-update-checker/Puc/v4p11/DebugBar/PluginExtension.php

Lines changed: 0 additions & 33 deletions
This file was deleted.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
namespace YahnisElsts\PluginUpdateChecker\v5;
4+
5+
if ( !class_exists(PucFactory::class, false) ):
6+
7+
class PucFactory extends \YahnisElsts\PluginUpdateChecker\v5p6\PucFactory {
8+
}
9+
10+
endif;
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
<?php
2+
3+
namespace YahnisElsts\PluginUpdateChecker\v5p6;
4+
5+
if ( !class_exists(Autoloader::class, false) ):
6+
7+
class Autoloader {
8+
const DEFAULT_NS_PREFIX = 'YahnisElsts\\PluginUpdateChecker\\';
9+
10+
private $prefix;
11+
private $rootDir;
12+
private $libraryDir;
13+
14+
private $staticMap;
15+
16+
public function __construct() {
17+
$this->rootDir = dirname(__FILE__) . '/';
18+
19+
$namespaceWithSlash = __NAMESPACE__ . '\\';
20+
$this->prefix = $namespaceWithSlash;
21+
22+
$this->libraryDir = $this->rootDir . '../..';
23+
if ( !self::isPhar() ) {
24+
$this->libraryDir = realpath($this->libraryDir);
25+
}
26+
$this->libraryDir = $this->libraryDir . '/';
27+
28+
//Usually, dependencies like Parsedown are in the global namespace,
29+
//but if someone adds a custom namespace to the entire library, they
30+
//will be in the same namespace as this class.
31+
$isCustomNamespace = (
32+
substr($namespaceWithSlash, 0, strlen(self::DEFAULT_NS_PREFIX)) !== self::DEFAULT_NS_PREFIX
33+
);
34+
$libraryPrefix = $isCustomNamespace ? $namespaceWithSlash : '';
35+
36+
$this->staticMap = array(
37+
$libraryPrefix . 'PucReadmeParser' => 'vendor/PucReadmeParser.php',
38+
$libraryPrefix . 'Parsedown' => 'vendor/Parsedown.php',
39+
);
40+
41+
//Add the generic, major-version-only factory class to the static map.
42+
$versionSeparatorPos = strrpos(__NAMESPACE__, '\\v');
43+
if ( $versionSeparatorPos !== false ) {
44+
$versionSegment = substr(__NAMESPACE__, $versionSeparatorPos + 1);
45+
$pointPos = strpos($versionSegment, 'p');
46+
if ( ($pointPos !== false) && ($pointPos > 1) ) {
47+
$majorVersionSegment = substr($versionSegment, 0, $pointPos);
48+
$majorVersionNs = __NAMESPACE__ . '\\' . $majorVersionSegment;
49+
$this->staticMap[$majorVersionNs . '\\PucFactory'] =
50+
'Puc/' . $majorVersionSegment . '/Factory.php';
51+
}
52+
}
53+
54+
spl_autoload_register(array($this, 'autoload'));
55+
}
56+
57+
/**
58+
* Determine if this file is running as part of a Phar archive.
59+
*
60+
* @return bool
61+
*/
62+
private static function isPhar() {
63+
//Check if the current file path starts with "phar://".
64+
static $pharProtocol = 'phar://';
65+
return (substr(__FILE__, 0, strlen($pharProtocol)) === $pharProtocol);
66+
}
67+
68+
public function autoload($className) {
69+
if ( isset($this->staticMap[$className]) && file_exists($this->libraryDir . $this->staticMap[$className]) ) {
70+
include($this->libraryDir . $this->staticMap[$className]);
71+
return;
72+
}
73+
74+
if ( strpos($className, $this->prefix) === 0 ) {
75+
$path = substr($className, strlen($this->prefix));
76+
$path = str_replace(array('_', '\\'), '/', $path);
77+
$path = $this->rootDir . $path . '.php';
78+
79+
if ( file_exists($path) ) {
80+
include $path;
81+
}
82+
}
83+
}
84+
}
85+
86+
endif;

0 commit comments

Comments
 (0)