forked from bentideswell/magento2-wordpress-integration
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathregistration.php
47 lines (39 loc) · 1.12 KB
/
registration.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
/**
* @package FishPig_WordPress
* @author Ben Tideswell ([email protected])
* @url https://fishpig.co.uk/magento/wordpress-integration/
*/
use \Magento\Framework\Component\ComponentRegistrar;
ComponentRegistrar::register(
ComponentRegistrar::MODULE,
'FishPig_WordPress',
__DIR__
);
/**
* Translation function fix
* If app/functions.php exists (Magento 2.2 and below)
* Swap it for our version (the same file with a call to function_exists)
*/
$functionsFile = BP . '/app/functions.php';
if (is_file($functionsFile)) {
$legacyFunctions = @file_get_contents($functionsFile);
$fpFunctions = @file_get_contents(__DIR__ . '/functions.php');
if (strpos($legacyFunctions, 'function_exists') === false) {
@file_put_contents($functionsFile, $fpFunctions);
}
}
if (!function_exists('__')) {
function __()
{
$argc = func_get_args();
$text = array_shift($argc);
if (!empty($argc) && is_array($argc[0])) {
$argc = $argc[0];
}
if (isset($GLOBALS['phrase_as_string'])) {
return (string)new \Magento\Framework\Phrase($text, $argc);
}
return new \Magento\Framework\Phrase($text, $argc);
}
}