Skip to content

Commit

Permalink
Psource Updater 1.2 (PhP8 Fixes, Security Fixes)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dernerd committed Dec 7, 2022
1 parent 928b9e8 commit b08370a
Show file tree
Hide file tree
Showing 122 changed files with 3,111 additions and 2,405 deletions.
6 changes: 4 additions & 2 deletions affiliate.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@
Plugin URI: https://n3rds.work/piestingtal-source-project/ps-affiliate/
Description: Dieses Plugin fügt Deiner Seite ein einfaches Affiliate-System hinzu. Verfolge eingehende Klicks von Affiliate-Referer-Links, die Integration der Auftragsverfolgung in PSeCommerce, bezahlte Bloghosting-Anmeldungen und bezahlte Mitgliedschaftsanmeldungen.
Author: WebMasterService N@W
Version: 3.2.6
Version: 3.2.7
Author URI: https://n3rds.work
Domain Path: /affiliateincludes/languages
*/

require 'psource/psource-plugin-update/psource-plugin-updater.php';
$MyUpdateChecker = Puc_v4_Factory::buildUpdateChecker(
use Psource\PluginUpdateChecker\v5\PucFactory;
$MyUpdateChecker = PucFactory::buildUpdateChecker(
'https://n3rds.work//wp-update-server/?action=get_metadata&slug=affiliate',
__FILE__,
'affiliate'
Expand Down
2 changes: 1 addition & 1 deletion affiliateincludes/classes/affiliateadmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -1675,7 +1675,7 @@ function show_affiliates_panel_menu() {
$menus = array();
$menus['affiliatesadmin'] = __( 'Partnerberichte', 'affiliate' );
$menus['affiliatesadminmanage'] = __( 'Partner verwalten', 'affiliate' );
$menus['affiliatesadminsettings'] = __( 'Partnerprogramm-Einstellungen', 'affiliate' );
$menus['affiliatesadminsettings'] = __( 'Einstellungen', 'affiliate' );
$menus['affiliatesadminaddons'] = __( 'Erweiterungen verwalten', 'affiliate' );

$menus = apply_filters( 'affiliate_menus', $menus );
Expand Down
6 changes: 0 additions & 6 deletions psource/psource-plugin-update/Puc/v4/Factory.php

This file was deleted.

63 changes: 0 additions & 63 deletions psource/psource-plugin-update/Puc/v4p10/Autoloader.php

This file was deleted.

This file was deleted.

118 changes: 0 additions & 118 deletions psource/psource-plugin-update/Puc/v4p10/Vcs/ThemeUpdateChecker.php

This file was deleted.

10 changes: 10 additions & 0 deletions psource/psource-plugin-update/Puc/v5/PucFactory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace Psource\PluginUpdateChecker\v5;

if ( !class_exists(PucFactory::class, false) ):

class PucFactory extends \Psource\PluginUpdateChecker\v5p0\PucFactory {
}

endif;
86 changes: 86 additions & 0 deletions psource/psource-plugin-update/Puc/v5p0/Autoloader.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
<?php

namespace Psource\PluginUpdateChecker\v5p0;

if ( !class_exists(Autoloader::class, false) ):

class Autoloader {
const DEFAULT_NS_PREFIX = 'Psource\\PluginUpdateChecker\\';

private $prefix;
private $rootDir;
private $libraryDir;

private $staticMap;

public function __construct() {
$this->rootDir = dirname(__FILE__) . '/';

$namespaceWithSlash = __NAMESPACE__ . '\\';
$this->prefix = $namespaceWithSlash;

$this->libraryDir = $this->rootDir . '../..';
if ( !self::isPhar() ) {
$this->libraryDir = realpath($this->libraryDir);
}
$this->libraryDir = $this->libraryDir . '/';

//Usually, dependencies like Parsedown are in the global namespace,
//but if someone adds a custom namespace to the entire library, they
//will be in the same namespace as this class.
$isCustomNamespace = (
substr($namespaceWithSlash, 0, strlen(self::DEFAULT_NS_PREFIX)) !== self::DEFAULT_NS_PREFIX
);
$libraryPrefix = $isCustomNamespace ? $namespaceWithSlash : '';

$this->staticMap = array(
$libraryPrefix . 'PucReadmeParser' => 'vendor/PucReadmeParser.php',
$libraryPrefix . 'Parsedown' => 'vendor/Parsedown.php',
);

//Add the generic, major-version-only factory class to the static map.
$versionSeparatorPos = strrpos(__NAMESPACE__, '\\v');
if ( $versionSeparatorPos !== false ) {
$versionSegment = substr(__NAMESPACE__, $versionSeparatorPos + 1);
$pointPos = strpos($versionSegment, 'p');
if ( ($pointPos !== false) && ($pointPos > 1) ) {
$majorVersionSegment = substr($versionSegment, 0, $pointPos);
$majorVersionNs = __NAMESPACE__ . '\\' . $majorVersionSegment;
$this->staticMap[$majorVersionNs . '\\PucFactory'] =
'Puc/' . $majorVersionSegment . '/Factory.php';
}
}

spl_autoload_register(array($this, 'autoload'));
}

/**
* Determine if this file is running as part of a Phar archive.
*
* @return bool
*/
private static function isPhar() {
//Check if the current file path starts with "phar://".
static $pharProtocol = 'phar://';
return (substr(__FILE__, 0, strlen($pharProtocol)) === $pharProtocol);
}

public function autoload($className) {
if ( isset($this->staticMap[$className]) && file_exists($this->libraryDir . $this->staticMap[$className]) ) {
include($this->libraryDir . $this->staticMap[$className]);
return;
}

if ( strpos($className, $this->prefix) === 0 ) {
$path = substr($className, strlen($this->prefix));
$path = str_replace(array('_', '\\'), '/', $path);
$path = $this->rootDir . $path . '.php';

if ( file_exists($path) ) {
include $path;
}
}
}
}

endif;
Loading

0 comments on commit b08370a

Please sign in to comment.