Version Description
Download this release
Release Info
Developer | keywordrush |
Plugin | Content Egg |
Version | 2.6.1 |
Comparing to | |
See all releases |
Code changes from version 2.6.0 to 2.6.1
- application/Plugin.php +1 -1
- application/helpers/TemplateHelper.php +7 -3
- application/modules/AE/AEConfig.php +76 -0
- application/modules/AE/AEModule.php +178 -0
- application/modules/AE/ExtraDataAE.php +21 -0
- application/modules/AE/index.php +1 -0
- application/modules/AE/templates/data_grid.php +65 -0
- application/modules/AE/templates/data_item.php +110 -0
- application/modules/AE/templates/data_list.php +50 -0
- application/modules/Amazon/AmazonConfig.php +1 -1
- application/modules/RssFetcher/RssFetcherModule.php +8 -4
- content-egg.php +1 -1
- readme.txt +1 -1
application/Plugin.php
CHANGED
@@ -13,7 +13,7 @@ use ContentEgg\application\admin\GeneralConfig;
|
|
13 |
*/
|
14 |
class Plugin {
|
15 |
|
16 |
-
const version = '2.6.
|
17 |
const db_version = 9;
|
18 |
const wp_requires = '4.2.2';
|
19 |
const slug = 'content-egg';
|
13 |
*/
|
14 |
class Plugin {
|
15 |
|
16 |
+
const version = '2.6.1';
|
17 |
const db_version = 9;
|
18 |
const wp_requires = '4.2.2';
|
19 |
const slug = 'content-egg';
|
application/helpers/TemplateHelper.php
CHANGED
@@ -37,9 +37,13 @@ class TemplateHelper {
|
|
37 |
return number_format($number, absint($decimals), $decimal_point, $thousands_sep);
|
38 |
}
|
39 |
|
40 |
-
public static function price_format_i18n($number)
|
41 |
{
|
42 |
-
|
|
|
|
|
|
|
|
|
43 |
}
|
44 |
|
45 |
public static function truncate($string, $length = 80, $etc = '...', $charset = 'UTF-8', $break_words = false, $middle = false)
|
@@ -177,7 +181,7 @@ class TemplateHelper {
|
|
177 |
{
|
178 |
$return = '';
|
179 |
$currency = self::currencyTyping($currencyCode);
|
180 |
-
$price = self::price_format_i18n($price);
|
181 |
|
182 |
if (in_array($currencyCode, array('RUB', 'UAH')))
|
183 |
return $price . ' ' . $currency;
|
37 |
return number_format($number, absint($decimals), $decimal_point, $thousands_sep);
|
38 |
}
|
39 |
|
40 |
+
public static function price_format_i18n($number, $currency = null)
|
41 |
{
|
42 |
+
if ($currency && in_array($currency, array('RUB', 'UAH')))
|
43 |
+
$decimal = 0;
|
44 |
+
else
|
45 |
+
$decimal = 2;
|
46 |
+
return self::number_format_i18n($number, $decimal);
|
47 |
}
|
48 |
|
49 |
public static function truncate($string, $length = 80, $etc = '...', $charset = 'UTF-8', $break_words = false, $middle = false)
|
181 |
{
|
182 |
$return = '';
|
183 |
$currency = self::currencyTyping($currencyCode);
|
184 |
+
$price = self::price_format_i18n($price, $currencyCode);
|
185 |
|
186 |
if (in_array($currencyCode, array('RUB', 'UAH')))
|
187 |
return $price . ' ' . $currency;
|
application/modules/AE/AEConfig.php
ADDED
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ContentEgg\application\modules\AE;
|
4 |
+
|
5 |
+
use ContentEgg\application\components\AffiliateParserModuleConfig;
|
6 |
+
|
7 |
+
/**
|
8 |
+
* AEConfig class file
|
9 |
+
*
|
10 |
+
* @author keywordrush.com <support@keywordrush.com>
|
11 |
+
* @link http://www.keywordrush.com/
|
12 |
+
* @copyright Copyright © 2016 keywordrush.com
|
13 |
+
*/
|
14 |
+
class AEConfig extends AffiliateParserModuleConfig {
|
15 |
+
|
16 |
+
public function options()
|
17 |
+
{
|
18 |
+
$options = array(
|
19 |
+
'deeplink' => array(
|
20 |
+
'title' => __('Партнеркая ссылка', 'content-egg'),
|
21 |
+
'description' => __('Укажите Deeplink одной из CPA-сетей. Для прямых партнерских программ вы можете использовать параметр вида <em>partner_id=12345</em>, или сформируйте партнерскую ссылку по шаблону, например: <em>{{url}}/partner_id-12345/</em> ({{url}}/{{url_encoded}} - будут заменены на URL текущего товара).', 'content-egg'),
|
22 |
+
'callback' => array($this, 'render_input'),
|
23 |
+
'default' => '',
|
24 |
+
'validator' => array(
|
25 |
+
'trim',
|
26 |
+
),
|
27 |
+
'section' => 'default',
|
28 |
+
),
|
29 |
+
'entries_per_page' => array(
|
30 |
+
'title' => __('Результатов', 'content-egg'),
|
31 |
+
'description' => __('Количество результатов для одного поискового запроса.', 'content-egg'),
|
32 |
+
'callback' => array($this, 'render_input'),
|
33 |
+
'default' => 9,
|
34 |
+
'validator' => array(
|
35 |
+
'trim',
|
36 |
+
'absint',
|
37 |
+
array(
|
38 |
+
'call' => array('\ContentEgg\application\helpers\FormValidator', 'less_than_equal_to'),
|
39 |
+
'arg' => 50,
|
40 |
+
'message' => __('Поле "Результатов" не может быть больше 50.', 'content-egg'),
|
41 |
+
),
|
42 |
+
),
|
43 |
+
'section' => 'default',
|
44 |
+
),
|
45 |
+
'entries_per_page_update' => array(
|
46 |
+
'title' => __('Результатов для обновления', 'content-egg'),
|
47 |
+
'description' => __('Количество результатов для автоматического обновления и автоблоггинга.', 'content-egg'),
|
48 |
+
'callback' => array($this, 'render_input'),
|
49 |
+
'default' => 6,
|
50 |
+
'validator' => array(
|
51 |
+
'trim',
|
52 |
+
'absint',
|
53 |
+
array(
|
54 |
+
'call' => array('\ContentEgg\application\helpers\FormValidator', 'less_than_equal_to'),
|
55 |
+
'arg' => 50,
|
56 |
+
'message' => __('Поле "Результатов" не может быть больше 50.', 'content-egg'),
|
57 |
+
),
|
58 |
+
),
|
59 |
+
'section' => 'default',
|
60 |
+
),
|
61 |
+
'save_img' => array(
|
62 |
+
'title' => __('Сохранять картинки', 'content-egg'),
|
63 |
+
'description' => __('Сохранять картинки на сервер.', 'content-egg'),
|
64 |
+
'callback' => array($this, 'render_checkbox'),
|
65 |
+
'default' => false,
|
66 |
+
'section' => 'default',
|
67 |
+
),
|
68 |
+
);
|
69 |
+
|
70 |
+
$parent = parent::options();
|
71 |
+
$parent['ttl']['default'] = 4320000;
|
72 |
+
$parent['ttl_items']['default'] = 2592000;
|
73 |
+
return array_merge($parent, $options);
|
74 |
+
}
|
75 |
+
|
76 |
+
}
|
application/modules/AE/AEModule.php
ADDED
@@ -0,0 +1,178 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ContentEgg\application\modules\AE;
|
4 |
+
|
5 |
+
use ContentEgg\application\admin\AeIntegrationConfig;
|
6 |
+
use ContentEgg\application\components\AffiliateParserModule;
|
7 |
+
use ContentEgg\application\components\ContentProduct;
|
8 |
+
use ContentEgg\application\admin\PluginAdmin;
|
9 |
+
use ContentEgg\application\helpers\TextHelper;
|
10 |
+
use ContentEgg\application\components\LinkHandler;
|
11 |
+
use \Keywordrush\AffiliateEgg\ParserManager;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* AmazonModule class file
|
15 |
+
*
|
16 |
+
* @author keywordrush.com <support@keywordrush.com>
|
17 |
+
* @link http://www.keywordrush.com/
|
18 |
+
* @copyright Copyright © 2016 keywordrush.com
|
19 |
+
*/
|
20 |
+
class AEModule extends AffiliateParserModule {
|
21 |
+
|
22 |
+
public function __construct($module_id = null)
|
23 |
+
{
|
24 |
+
if (!AeIntegrationConfig::isAEIntegrationPosible())
|
25 |
+
throw new \Exception('The required Affiliate Egg plugin is not installed.');
|
26 |
+
|
27 |
+
parent::__construct($module_id);
|
28 |
+
}
|
29 |
+
|
30 |
+
public function info()
|
31 |
+
{
|
32 |
+
$name = \Keywordrush\AffiliateEgg\ShopManager::getInstance()->getShopName($this->getMyShortId());
|
33 |
+
$uri = \Keywordrush\AffiliateEgg\ShopManager::getInstance()->getShopUri($this->getMyShortId());
|
34 |
+
$uri = str_replace('http://', '', $uri);
|
35 |
+
return array(
|
36 |
+
'name' => 'AE:' . $name,
|
37 |
+
'description' => __('Поиск на основании парсера Affiliate Egg плагина для' . ' ' . $uri . '.', 'content-egg'),
|
38 |
+
);
|
39 |
+
}
|
40 |
+
|
41 |
+
public function getParserType()
|
42 |
+
{
|
43 |
+
return self::PARSER_TYPE_PRODUCT;
|
44 |
+
}
|
45 |
+
|
46 |
+
public function defaultTemplateName()
|
47 |
+
{
|
48 |
+
return 'data_grid';
|
49 |
+
}
|
50 |
+
|
51 |
+
public function isItemsUpdateAvailable()
|
52 |
+
{
|
53 |
+
return true;
|
54 |
+
}
|
55 |
+
|
56 |
+
public function isFree()
|
57 |
+
{
|
58 |
+
return true;
|
59 |
+
}
|
60 |
+
|
61 |
+
public function doRequest($keyword, $query_params = array(), $is_autoupdate = false)
|
62 |
+
{
|
63 |
+
if ($is_autoupdate)
|
64 |
+
$entries_per_page = $this->config('entries_per_page_update');
|
65 |
+
else
|
66 |
+
$entries_per_page = $this->config('entries_per_page');
|
67 |
+
|
68 |
+
// 1. Parse catalog
|
69 |
+
$product_urls = ParserManager::getInstance()->parseSearchCatalog($this->getMyShortId(), $keyword, $entries_per_page);
|
70 |
+
if (!$product_urls || !is_array($product_urls))
|
71 |
+
return array();
|
72 |
+
|
73 |
+
//2. Parse products
|
74 |
+
$product_sleep = \Keywordrush\AffiliateEgg\GeneralConfig::getInstance()->option('product_sleep');
|
75 |
+
|
76 |
+
$results = array();
|
77 |
+
foreach ($product_urls as $key => $url)
|
78 |
+
{
|
79 |
+
try
|
80 |
+
{
|
81 |
+
$results[] = ParserManager::getInstance()->parseProduct($url);
|
82 |
+
} catch (\Exception $e)
|
83 |
+
{
|
84 |
+
continue;
|
85 |
+
}
|
86 |
+
|
87 |
+
// sleep
|
88 |
+
if ($product_sleep && $key < count($product_urls) - 1)
|
89 |
+
usleep($product_sleep);
|
90 |
+
}
|
91 |
+
|
92 |
+
return $this->prepareResults($results);
|
93 |
+
}
|
94 |
+
|
95 |
+
private function prepareResults($results)
|
96 |
+
{
|
97 |
+
$data = array();
|
98 |
+
$deeplink = $this->config('deeplink');
|
99 |
+
|
100 |
+
foreach ($results as $key => $r)
|
101 |
+
{
|
102 |
+
$content = new ContentProduct;
|
103 |
+
$content->unique_id = md5($r['orig_url']);
|
104 |
+
$content->url = LinkHandler::createAffUrl($r['orig_url'], $deeplink);
|
105 |
+
$content->orig_url = $r['orig_url'];
|
106 |
+
$content->img = $r['img'];
|
107 |
+
$content->title = $r['title'];
|
108 |
+
$content->description = $r['description'];
|
109 |
+
$content->price = $r['price'];
|
110 |
+
$content->priceOld = $r['old_price'];
|
111 |
+
$content->currencyCode = $r['currency'];
|
112 |
+
$content->currency = TextHelper::currencyTyping($content->currencyCode);
|
113 |
+
$content->manufacturer = $r['manufacturer'];
|
114 |
+
$content->availability = $r['in_stock'];
|
115 |
+
|
116 |
+
$content->extra = new ExtraDataAE;
|
117 |
+
if (isset($r['extra']['features']))
|
118 |
+
{
|
119 |
+
$content->extra->features = $r['extra']['features'];
|
120 |
+
unset($r['extra']['features']);
|
121 |
+
}
|
122 |
+
if (isset($r['extra']['comments']))
|
123 |
+
{
|
124 |
+
$content->extra->comments = $r['extra']['comments'];
|
125 |
+
unset($r['extra']['comments']);
|
126 |
+
}
|
127 |
+
if (isset($r['extra']['images']))
|
128 |
+
{
|
129 |
+
$content->extra->images = $r['extra']['images'];
|
130 |
+
unset($r['extra']['images']);
|
131 |
+
}
|
132 |
+
$content->extra->data = $r['extra'];
|
133 |
+
|
134 |
+
$data[] = $content;
|
135 |
+
}
|
136 |
+
return $data;
|
137 |
+
}
|
138 |
+
|
139 |
+
public function doRequestItems(array $items)
|
140 |
+
{
|
141 |
+
$key = 0;
|
142 |
+
$product_sleep = \Keywordrush\AffiliateEgg\GeneralConfig::getInstance()->option('product_update_sleep');
|
143 |
+
foreach ($items as $i => $item)
|
144 |
+
{
|
145 |
+
if ($product_sleep && $key > 0)
|
146 |
+
usleep($product_sleep);
|
147 |
+
$key++;
|
148 |
+
|
149 |
+
try
|
150 |
+
{
|
151 |
+
$r = ParserManager::getInstance()->parseProduct($item['orig_url']);
|
152 |
+
|
153 |
+
// update url if deeplink changed
|
154 |
+
$items[$i]['url'] = LinkHandler::createAffUrl($r['orig_url'], $this->config('deeplink'));
|
155 |
+
$items[$i]['price'] = $r['price'];
|
156 |
+
$items[$i]['priceOld'] = $r['old_price'];
|
157 |
+
$items[$i]['currencyCode'] = $r['currency'];
|
158 |
+
$items[$i]['currency'] = TextHelper::currencyTyping($items[$i]['currencyCode']);
|
159 |
+
} catch (\Exception $e)
|
160 |
+
{
|
161 |
+
continue;
|
162 |
+
}
|
163 |
+
}
|
164 |
+
|
165 |
+
return $items;
|
166 |
+
}
|
167 |
+
|
168 |
+
public function renderResults()
|
169 |
+
{
|
170 |
+
PluginAdmin::render('_metabox_results', array('module_id' => $this->getId()));
|
171 |
+
}
|
172 |
+
|
173 |
+
public function renderSearchResults()
|
174 |
+
{
|
175 |
+
PluginAdmin::render('_metabox_search_results', array('module_id' => $this->getId()));
|
176 |
+
}
|
177 |
+
|
178 |
+
}
|
application/modules/AE/ExtraDataAE.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace ContentEgg\application\modules\AE;
|
4 |
+
|
5 |
+
use ContentEgg\application\components\ExtraData;
|
6 |
+
|
7 |
+
/**
|
8 |
+
* ExtraDataAE class file
|
9 |
+
*
|
10 |
+
* @author keywordrush.com <support@keywordrush.com>
|
11 |
+
* @link http://www.keywordrush.com/
|
12 |
+
* @copyright Copyright © 2016 keywordrush.com
|
13 |
+
*/
|
14 |
+
class ExtraDataAE extends ExtraData {
|
15 |
+
|
16 |
+
public $features = array();
|
17 |
+
public $comments = array();
|
18 |
+
public $images = array();
|
19 |
+
public $data = array();
|
20 |
+
|
21 |
+
}
|
application/modules/AE/index.php
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<?php // Silence is golden.
|
application/modules/AE/templates/data_grid.php
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Name: Grid
|
4 |
+
*/
|
5 |
+
|
6 |
+
__('Grid', 'content-egg-tpl');
|
7 |
+
|
8 |
+
use ContentEgg\application\helpers\TemplateHelper;
|
9 |
+
?>
|
10 |
+
|
11 |
+
<?php
|
12 |
+
\wp_enqueue_style('egg-bootstrap');
|
13 |
+
\wp_enqueue_style('content-egg-products');
|
14 |
+
?>
|
15 |
+
|
16 |
+
<div class="egg-container egg-grid">
|
17 |
+
<?php if ($title): ?>
|
18 |
+
<h3><?php echo esc_html($title); ?></h3>
|
19 |
+
<?php endif; ?>
|
20 |
+
|
21 |
+
<div class="container-fluid">
|
22 |
+
<?php $i = 0; ?>
|
23 |
+
<?php foreach ($items as $item): ?>
|
24 |
+
|
25 |
+
<a rel="nofollow" target="_blank" href="<?php echo esc_url($item['url']) ?>">
|
26 |
+
<div class="col-md-4 productbox">
|
27 |
+
<?php if ($item['percentageSaved']): ?>
|
28 |
+
<div class="cegg-promotion">
|
29 |
+
<span class="cegg-discount">- <?php echo round($item['percentageSaved']); ?>%</span>
|
30 |
+
</div>
|
31 |
+
<?php endif; ?>
|
32 |
+
|
33 |
+
<?php if ($item['img']): ?>
|
34 |
+
<img class="img-responsive" src="<?php echo esc_attr($item['img']) ?>" alt="<?php echo esc_attr($item['title']); ?>" />
|
35 |
+
<?php endif; ?>
|
36 |
+
|
37 |
+
<div class="producttitle">
|
38 |
+
<?php if ($item['manufacturer']): ?><?php echo esc_html($item['manufacturer']); ?><?php endif; ?>
|
39 |
+
<span><?php echo esc_html(TemplateHelper::truncate($item['title'], 80)); ?></span>
|
40 |
+
</div>
|
41 |
+
|
42 |
+
<?php if (!empty($item['extra']['data']['rating'])): ?>
|
43 |
+
<div>
|
44 |
+
<span class="rating_small"><?php echo str_repeat("<span>★</span>", (int) $item['extra']['data']['rating']);echo str_repeat("<span>☆</span>", 5 - (int) $item['extra']['data']['rating']);?></span>
|
45 |
+
</div>
|
46 |
+
<?php endif; ?>
|
47 |
+
|
48 |
+
<div class="productprice">
|
49 |
+
<?php if ($item['price']): ?>
|
50 |
+
<?php if ($item['priceOld']): ?><strike>
|
51 |
+
<?php echo TemplateHelper::formatPriceCurrency($item['priceOld'], $item['currencyCode']); ?>
|
52 |
+
</strike> <?php endif; ?>
|
53 |
+
<?php echo TemplateHelper::formatPriceCurrency($item['price'], $item['currencyCode']); ?>
|
54 |
+
<?php endif; ?>
|
55 |
+
</div>
|
56 |
+
</div>
|
57 |
+
</a>
|
58 |
+
|
59 |
+
<?php $i++;
|
60 |
+
if ($i % 3 == 0): ?>
|
61 |
+
<div class="clearfix"></div>
|
62 |
+
<?php endif; ?>
|
63 |
+
<?php endforeach; ?>
|
64 |
+
</div>
|
65 |
+
</div>
|
application/modules/AE/templates/data_item.php
ADDED
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Name: Product card
|
4 |
+
*/
|
5 |
+
|
6 |
+
__('Product card', 'content-egg-tpl');
|
7 |
+
|
8 |
+
use ContentEgg\application\helpers\TemplateHelper;
|
9 |
+
?>
|
10 |
+
|
11 |
+
<?php
|
12 |
+
\wp_enqueue_style('egg-bootstrap');
|
13 |
+
\wp_enqueue_style('content-egg-products');
|
14 |
+
|
15 |
+
?>
|
16 |
+
|
17 |
+
|
18 |
+
<div class="egg-container egg-item">
|
19 |
+
|
20 |
+
<?php if ($title): ?>
|
21 |
+
<h3><?php echo esc_html($title); ?></h3>
|
22 |
+
<?php endif; ?>
|
23 |
+
|
24 |
+
<div class="products">
|
25 |
+
|
26 |
+
<?php foreach ($items as $item): ?>
|
27 |
+
<div class="row">
|
28 |
+
<div class="col-md-5">
|
29 |
+
<?php if ($item['img']): ?>
|
30 |
+
<a rel="nofollow" target="_blank" href="<?php echo $item['url']; ?>">
|
31 |
+
<img src="<?php echo $item['img']; ?>" alt="<?php echo esc_attr($item['title']); ?>" class="img-responsive" />
|
32 |
+
</a>
|
33 |
+
<?php endif; ?>
|
34 |
+
</div>
|
35 |
+
<div class="col-md-7">
|
36 |
+
<h2 class="media-heading"><?php echo $item['title']; ?><?php if ($item['manufacturer']): ?>, <?php echo esc_html($item['manufacturer']); ?><?php endif;?></h2>
|
37 |
+
|
38 |
+
<?php if (!empty($item['extra']['data']['rating'])): ?>
|
39 |
+
<span class="rating"><?php echo str_repeat("<span>★</span>", $item['extra']['data']['rating']);
|
40 |
+
echo str_repeat("<span>☆</span>", 5 - $item['extra']['data']['rating']); ?></span>
|
41 |
+
<?php endif; ?>
|
42 |
+
|
43 |
+
<div class="well-lg">
|
44 |
+
|
45 |
+
<div class="row">
|
46 |
+
<div class="col-md-6">
|
47 |
+
<?php if ($item['priceOld']): ?>
|
48 |
+
<span class="text-muted">
|
49 |
+
<strike>
|
50 |
+
<?php echo TemplateHelper::formatPriceCurrency($item['priceOld'], $item['currencyCode']); ?>
|
51 |
+
</strike></span><br>
|
52 |
+
<?php endif; ?>
|
53 |
+
|
54 |
+
<?php if ($item['price']): ?>
|
55 |
+
<span class="cegg-price">
|
56 |
+
<?php echo TemplateHelper::formatPriceCurrency($item['price'], $item['currencyCode']); ?>
|
57 |
+
</span>
|
58 |
+
<?php endif; ?>
|
59 |
+
</div>
|
60 |
+
<div class="col-md-6 text-center text-muted">
|
61 |
+
<a rel="nofollow" target="_blank" href="<?php echo $item['url']; ?>" class="btn btn-success"><?php _e('BUY THIS ITEM', 'content-egg-tpl'); ?></a>
|
62 |
+
<?php if (!empty($item['extra']['domain'])): ?>
|
63 |
+
<br>
|
64 |
+
<small><?php echo $item['extra']['domain']; ?></small>
|
65 |
+
<?php endif; ?>
|
66 |
+
</div>
|
67 |
+
|
68 |
+
</div>
|
69 |
+
|
70 |
+
</div>
|
71 |
+
|
72 |
+
</div>
|
73 |
+
</div>
|
74 |
+
|
75 |
+
<div class="row">
|
76 |
+
<div class="col-md-12">
|
77 |
+
<?php if ($item['description']): ?>
|
78 |
+
<p><?php echo $item['description']; ?></p>
|
79 |
+
<?php endif; ?>
|
80 |
+
|
81 |
+
<?php if ($item['extra']['features']): ?>
|
82 |
+
<h4><?php _e('Features', 'content-egg-tpl'); ?></h4>
|
83 |
+
<ul>
|
84 |
+
<?php foreach ($item['extra']['features'] as $feature): ?>
|
85 |
+
<li><?php echo '<strong>' . esc_html($feature['name']) . '</strong>' . ': ' . esc_html($feature['value']); ?></li>
|
86 |
+
<?php endforeach; ?>
|
87 |
+
</ul>
|
88 |
+
<?php endif; ?>
|
89 |
+
|
90 |
+
<?php if (!empty($item['extra']['comments'])): ?>
|
91 |
+
<h4><?php _e('User reviews', 'content-egg-tpl'); ?></h4>
|
92 |
+
<?php foreach ($item['extra']['comments'] as $key => $comment): ?>
|
93 |
+
<blockquote>
|
94 |
+
<?php if (!empty($comment['rating'])): ?>
|
95 |
+
<span class="rating_small">
|
96 |
+
<?php echo str_repeat("<span>★</span>", (int) $comment['rating']); ?><?php echo str_repeat("<span>☆</span>", 5 - (int) $comment['rating']); ?>
|
97 |
+
</span>
|
98 |
+
<?php endif; ?>
|
99 |
+
<?php echo $comment['comment']; ?>
|
100 |
+
</blockquote>
|
101 |
+
<?php endforeach; ?>
|
102 |
+
<p style="text-align: right;">
|
103 |
+
<a class="btn btn-info" rel="nofollow" target="_blank" href="<?php echo esc_url($item['url']) ?>"><?php _e('View all reviews', 'content-egg-tpl'); ?></a>
|
104 |
+
</p>
|
105 |
+
<?php endif; ?>
|
106 |
+
</div>
|
107 |
+
</div>
|
108 |
+
<?php endforeach; ?>
|
109 |
+
</div>
|
110 |
+
</div>
|
application/modules/AE/templates/data_list.php
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Name: List
|
4 |
+
*/
|
5 |
+
|
6 |
+
__('List', 'content-egg-tpl');
|
7 |
+
|
8 |
+
use ContentEgg\application\helpers\TemplateHelper;
|
9 |
+
?>
|
10 |
+
|
11 |
+
<?php
|
12 |
+
\wp_enqueue_style('egg-bootstrap');
|
13 |
+
\wp_enqueue_style('content-egg-products');
|
14 |
+
?>
|
15 |
+
|
16 |
+
<div class="egg-container egg-list">
|
17 |
+
<?php if ($title): ?>
|
18 |
+
<h3><?php echo esc_html($title); ?></h3>
|
19 |
+
<?php endif; ?>
|
20 |
+
|
21 |
+
<div class="egg-listcontainer">
|
22 |
+
|
23 |
+
<?php foreach ($items as $item): ?>
|
24 |
+
<div class="row-products">
|
25 |
+
<div class="col-md-2 col-sm-2 col-xs-12 cegg-image-cell">
|
26 |
+
<?php if ($item['img']): ?>
|
27 |
+
<?php $img = str_replace('/spare_covers/', '/c200/', $item['img']);?>
|
28 |
+
<a rel="nofollow" target="_blank" href="<?php echo $item['url']; ?>">
|
29 |
+
<img src="<?php echo $img; ?>" alt="<?php echo esc_attr($item['title']); ?>" />
|
30 |
+
</a>
|
31 |
+
<?php endif; ?>
|
32 |
+
</div>
|
33 |
+
<div class="col-md-7 col-sm-7 col-xs-12 cegg-desc-cell">
|
34 |
+
<a rel="nofollow" target="_blank" href="<?php echo $item['url']; ?>">
|
35 |
+
<h4><?php echo $item['title']; ?></h4>
|
36 |
+
</a>
|
37 |
+
</div>
|
38 |
+
<div class="col-md-3 col-sm-3 col-xs-12 offer_price cegg-price-cell">
|
39 |
+
<?php if ($item['priceOld']): ?>
|
40 |
+
<span class="text-muted"><strike><?php echo TemplateHelper::formatPriceCurrency($item['priceOld'], $item['currencyCode']); ?></strike></span><br>
|
41 |
+
<?php endif; ?>
|
42 |
+
|
43 |
+
<?php if ($item['price']): ?>
|
44 |
+
<?php echo TemplateHelper::formatPriceCurrency($item['price'], $item['currencyCode']); ?>
|
45 |
+
<?php endif; ?>
|
46 |
+
</div>
|
47 |
+
</div>
|
48 |
+
<?php endforeach; ?>
|
49 |
+
</div>
|
50 |
+
</div>
|
application/modules/Amazon/AmazonConfig.php
CHANGED
@@ -48,7 +48,7 @@ class AmazonConfig extends AffiliateParserModuleConfig {
|
|
48 |
'section' => 'default',
|
49 |
),
|
50 |
'associate_tag' => array(
|
51 |
-
'title' => 'Tracking ID по-умолчанию <span class="cegg_required">*</span>',
|
52 |
'description' => __('Связь с вашим аккаунтом в партнерской программе. Чтобы получать комиссию от продаж, правильно укажите этот параметр.', 'content-egg') . ' ' .
|
53 |
__('Tracking ID должен соотвествовать установке локали по-умолчанию.', 'content-egg') . ' ' .
|
54 |
__('Ниже вы можете задать значения Tracking ID для остальных локалей, если хотите добавить товары более чем с одной локали.', 'content-egg'),
|
48 |
'section' => 'default',
|
49 |
),
|
50 |
'associate_tag' => array(
|
51 |
+
'title' => __('Tracking ID по-умолчанию', 'content-egg') . ' <span class="cegg_required">*</span>',
|
52 |
'description' => __('Связь с вашим аккаунтом в партнерской программе. Чтобы получать комиссию от продаж, правильно укажите этот параметр.', 'content-egg') . ' ' .
|
53 |
__('Tracking ID должен соотвествовать установке локали по-умолчанию.', 'content-egg') . ' ' .
|
54 |
__('Ниже вы можете задать значения Tracking ID для остальных локалей, если хотите добавить товары более чем с одной локали.', 'content-egg'),
|
application/modules/RssFetcher/RssFetcherModule.php
CHANGED
@@ -31,11 +31,11 @@ class RssFetcherModule extends ParserModule {
|
|
31 |
{
|
32 |
return self::PARSER_TYPE_CONTENT;
|
33 |
}
|
34 |
-
|
35 |
public function isFree()
|
36 |
{
|
37 |
return true;
|
38 |
-
}
|
39 |
|
40 |
public function doRequest($keyword, $query_params = array(), $is_autoupdate = false)
|
41 |
{
|
@@ -54,8 +54,10 @@ class RssFetcherModule extends ParserModule {
|
|
54 |
{
|
55 |
throw new \Exception(strip_tags($e->getMessage()));
|
56 |
}
|
|
|
57 |
|
58 |
-
$results = $this->normaliseResults($results);
|
|
|
59 |
$data = array();
|
60 |
foreach ($results as $r)
|
61 |
{
|
@@ -81,7 +83,7 @@ class RssFetcherModule extends ParserModule {
|
|
81 |
return $data;
|
82 |
}
|
83 |
|
84 |
-
private function normaliseResults($feed)
|
85 |
{
|
86 |
$results = array();
|
87 |
if (isset($feed['items']))
|
@@ -100,6 +102,8 @@ class RssFetcherModule extends ParserModule {
|
|
100 |
$results[] = $feed['entry'];
|
101 |
}
|
102 |
|
|
|
|
|
103 |
foreach ($results as $key => $res)
|
104 |
{
|
105 |
//получаем title
|
31 |
{
|
32 |
return self::PARSER_TYPE_CONTENT;
|
33 |
}
|
34 |
+
|
35 |
public function isFree()
|
36 |
{
|
37 |
return true;
|
38 |
+
}
|
39 |
|
40 |
public function doRequest($keyword, $query_params = array(), $is_autoupdate = false)
|
41 |
{
|
54 |
{
|
55 |
throw new \Exception(strip_tags($e->getMessage()));
|
56 |
}
|
57 |
+
|
58 |
|
59 |
+
$results = $this->normaliseResults($results, $entries_per_page);
|
60 |
+
|
61 |
$data = array();
|
62 |
foreach ($results as $r)
|
63 |
{
|
83 |
return $data;
|
84 |
}
|
85 |
|
86 |
+
private function normaliseResults($feed, $entries_per_page = 10)
|
87 |
{
|
88 |
$results = array();
|
89 |
if (isset($feed['items']))
|
102 |
$results[] = $feed['entry'];
|
103 |
}
|
104 |
|
105 |
+
$results = array_slice($results, 0, $entries_per_page);
|
106 |
+
|
107 |
foreach ($results as $key => $res)
|
108 |
{
|
109 |
//получаем title
|
content-egg.php
CHANGED
@@ -6,7 +6,7 @@ namespace ContentEgg;
|
|
6 |
Plugin Name: Content Egg
|
7 |
Plugin URI: http://www.keywordrush.com/contentegg
|
8 |
Description: Easily adding auto updating products from affiliate systems and additional content to posts.
|
9 |
-
Version: 2.6.
|
10 |
Author: keywordrush.com
|
11 |
Author URI: http://www.keywordrush.com
|
12 |
Text Domain: content-egg
|
6 |
Plugin Name: Content Egg
|
7 |
Plugin URI: http://www.keywordrush.com/contentegg
|
8 |
Description: Easily adding auto updating products from affiliate systems and additional content to posts.
|
9 |
+
Version: 2.6.1
|
10 |
Author: keywordrush.com
|
11 |
Author URI: http://www.keywordrush.com
|
12 |
Text Domain: content-egg
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: keywordrush,koleksii,wpsoul
|
|
3 |
Tags: content, affiliate, autoblogging, amazon, affilinet, coupons, linkshare, shareasale, ozon, flickr, youtube, commission junction, aliexpress, cj, images, wikipedia, freebase, ecommerce, links, shortcode, monetize, search engine optimization, ebay, zanox, moneymaking, price comparison, google images, timesaving, clickbank, linkshare, pixabay, admitad, affilitewindow, otimisemedia, tradedoubler, flipkart
|
4 |
Requires at least: 4.2.2
|
5 |
Tested up to: 4.7
|
6 |
-
Stable tag: 2.6.
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
3 |
Tags: content, affiliate, autoblogging, amazon, affilinet, coupons, linkshare, shareasale, ozon, flickr, youtube, commission junction, aliexpress, cj, images, wikipedia, freebase, ecommerce, links, shortcode, monetize, search engine optimization, ebay, zanox, moneymaking, price comparison, google images, timesaving, clickbank, linkshare, pixabay, admitad, affilitewindow, otimisemedia, tradedoubler, flipkart
|
4 |
Requires at least: 4.2.2
|
5 |
Tested up to: 4.7
|
6 |
+
Stable tag: 2.6.1
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|