oct_open_graph.ocmod.xml
14.9 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
<?xml version="1.0" encoding="utf-8"?>
<modification>
<code>oct_open_graph</code>
<name>Octemplates - Open Graph</name>
<version>1.0.0</version>
<author>Octemplates</author>
<link>http://octemplates.net/</link>
<file path="catalog/controller/common/home.php">
<operation error="skip">
<search><![CDATA[$data['column_left'] = $this->load->controller('common/column_left');]]></search>
<add position="before"><![CDATA[
$oct_deals_data = $this->config->get('theme_oct_deals_data');
$oct_seo_title = $this->config->get('config_meta_title');
$oct_seo_description = $this->config->get('config_meta_description');
if ($this->config->get('theme_oct_deals_seo_home_status')) {
$oct_seo_home_data = $this->config->get('theme_oct_deals_seo_home_data');
if ((isset($oct_seo_home_data['title'][$this->config->get('config_language_id')]) && !empty($oct_seo_home_data['title'][$this->config->get('config_language_id')]))) {
$this->document->setTitle($oct_seo_home_data['title'][$this->config->get('config_language_id')]);
$oct_seo_title = $oct_seo_home_data['title'][$this->config->get('config_language_id')];
}
if ((isset($oct_seo_home_data['description'][$this->config->get('config_language_id')]) && !empty($oct_seo_home_data['description'][$this->config->get('config_language_id')]))) {
$this->document->setDescription($oct_seo_home_data['description'][$this->config->get('config_language_id')]);
$oct_seo_description = $oct_seo_home_data['description'][$this->config->get('config_language_id')];
}
}
if (isset($oct_deals_data['open_graph']) && $oct_deals_data['open_graph']) {
$site_link = $this->request->server['HTTPS'] ? HTTPS_SERVER : HTTP_SERVER;
$config_logo = file_exists(DIR_IMAGE . $this->config->get('config_logo')) ? $this->config->get('config_logo') : 'catalog/opencart-logo.png';
$home_image = $site_link . 'image/' . $config_logo;
$image_info = getimagesize(DIR_IMAGE . $config_logo);
if ($this->config->get('theme_oct_deals_seo_home_image_status')) {
$oct_seo_home_image_data = $this->config->get('theme_oct_deals_seo_home_image_data');
if ((isset($oct_seo_home_image_data['image'][$this->config->get('config_language_id')]) && !empty($oct_seo_home_image_data['image'][$this->config->get('config_language_id')]))) {
$image_info = file_exists(DIR_IMAGE . $oct_seo_home_image_data['image'][$this->config->get('config_language_id')]) ? getimagesize(DIR_IMAGE . $oct_seo_home_image_data['image'][$this->config->get('config_language_id')]) : getimagesize(DIR_IMAGE . 'catalog/opencart-logo.png');
$home_image = file_exists(DIR_IMAGE . $oct_seo_home_image_data['image'][$this->config->get('config_language_id')]) ? $site_link . 'image/' . $oct_seo_home_image_data['image'][$this->config->get('config_language_id')] : $site_link . 'image/catalog/opencart-logo.png';
}
}
if ($image_info) {
$image_width = $image_info[0];
$image_height = $image_info[1];
} else {
$image_width = $this->config->get('theme_' . $this->config->get('config_theme') . '_image_logo_width') ? $this->config->get('theme_' . $this->config->get('config_theme') . '_image_logo_width') : 140;
$image_height = $this->config->get('theme_' . $this->config->get('config_theme') . '_image_logo_height') ? $this->config->get('theme_' . $this->config->get('config_theme') . '_image_logo_height') : 65;
}
$mime_type = isset($image_info['mime']) ? $image_info['mime'] : 'image/svg+xml';
$this->document->setOCTOpenGraph('og:title', htmlspecialchars(strip_tags(str_replace("\r", " ", str_replace("\n", " ", str_replace("\\", "/", str_replace("\"", "", $oct_seo_title)))))));
$this->document->setOCTOpenGraph('og:description', htmlspecialchars(strip_tags(str_replace("\r", " ", str_replace("\n", " ", str_replace("\\", "/", str_replace("\"", "", $oct_seo_description)))))));
$this->document->setOCTOpenGraph('og:site_name', htmlspecialchars(strip_tags(str_replace("\r", " ", str_replace("\n", " ", str_replace("\\", "/", str_replace("\"", "", $this->config->get('config_name'))))))));
$this->document->setOCTOpenGraph('og:url', $this->url->link('common/home', '', true));
$this->document->setOCTOpenGraph('og:image', str_replace(" ", "%20", $home_image));
if (isset($mime_type) && $mime_type) {
$this->document->setOCTOpenGraph('og:image:type', $mime_type);
}
if (isset($image_width) && $image_width) {
$this->document->setOCTOpenGraph('og:image:width', $image_width);
}
if (isset($image_height) && $image_height) {
$this->document->setOCTOpenGraph('og:image:height', $image_height);
}
$this->document->setOCTOpenGraph('og:image:alt', htmlspecialchars(strip_tags(str_replace("\r", " ", str_replace("\n", " ", str_replace("\\", "/", str_replace("\"", "", $this->config->get('config_meta_title'))))))));
$this->document->setOCTOpenGraph('og:type', 'website');
}
]]></add>
</operation>
</file>
<file path="catalog/controller/product/category.php">
<operation error="skip">
<search><![CDATA[$pagination = new Pagination();]]></search>
<add position="before"><![CDATA[
if (isset($oct_deals_data['open_graph']) && $oct_deals_data['open_graph']) {
$site_link = $this->request->server['HTTPS'] ? HTTPS_SERVER : HTTP_SERVER;
$config_logo = file_exists(DIR_IMAGE . $this->config->get('config_logo')) ? $this->config->get('config_logo') : 'catalog/opencart-logo.png';
$oct_ogimage = $category_info['image'] ? $category_info['image'] : $config_logo;
$category_image = $site_link . 'image/' . $oct_ogimage;
$image_info = getimagesize(DIR_IMAGE . $oct_ogimage);
if ($image_info) {
$image_width = $image_info[0];
$image_height = $image_info[1];
} else {
$image_width = $this->config->get('theme_' . $this->config->get('config_theme') . '_image_logo_width') ? $this->config->get('theme_' . $this->config->get('config_theme') . '_image_logo_width') : 140;
$image_height = $this->config->get('theme_' . $this->config->get('config_theme') . '_image_logo_height') ? $this->config->get('theme_' . $this->config->get('config_theme') . '_image_logo_height') : 65;
}
$mime_type = isset($image_info['mime']) ? $image_info['mime'] : 'image/svg+xml';
$this->document->setOCTOpenGraph('og:title', htmlspecialchars(strip_tags(str_replace("\r", " ", str_replace("\n", " ", str_replace("\\", "/", str_replace("\"", "", (isset($oct_seo_title) && $oct_seo_title) ? $oct_seo_title : $category_info['meta_title'])))))));
$this->document->setOCTOpenGraph('og:description', htmlspecialchars(strip_tags(str_replace("\r", " ", str_replace("\n", " ", str_replace("\\", "/", str_replace("\"", "", (isset($oct_seo_description) && $oct_seo_description && empty($category_info['meta_description'])) ? $oct_seo_description : $category_info['meta_description'])))))));
$this->document->setOCTOpenGraph('og:site_name', htmlspecialchars(strip_tags(str_replace("\r", " ", str_replace("\n", " ", str_replace("\\", "/", str_replace("\"", "", $this->config->get('config_name'))))))));
$this->document->setOCTOpenGraph('og:url', $this->url->link('product/category', 'path=' . $category_info['category_id']));
$this->document->setOCTOpenGraph('og:image', str_replace(" ", "%20", $category_image));
if (isset($mime_type) && $mime_type) {
$this->document->setOCTOpenGraph('og:image:type', $mime_type);
}
if (isset($image_width) && $image_width) {
$this->document->setOCTOpenGraph('og:image:width', $image_width);
}
if (isset($image_height) && $image_height) {
$this->document->setOCTOpenGraph('og:image:height', $image_height);
}
$this->document->setOCTOpenGraph('og:image:alt', htmlspecialchars(strip_tags(str_replace("\r", " ", str_replace("\n", " ", str_replace("\\", "/", str_replace("\"", "", $data['heading_title'])))))));
$this->document->setOCTOpenGraph('og:type', 'website');
}
]]></add>
</operation>
</file>
<file path="catalog/controller/product/product.php">
<operation error="skip">
<search><![CDATA[$this->model_catalog_product->updateViewed($this->request->get['product_id']);]]></search>
<add position="before"><![CDATA[
if (isset($oct_deals_data['open_graph']) && $oct_deals_data['open_graph']) {
$site_link = $this->request->server['HTTPS'] ? HTTPS_SERVER : HTTP_SERVER;
$config_logo = file_exists(DIR_IMAGE . $this->config->get('config_logo')) ? $this->config->get('config_logo') : 'catalog/opencart-logo.png';
$oct_ogimage = $product_info['image'] ? $product_info['image'] : $config_logo;
$product_image = $site_link . 'image/' . $oct_ogimage;
$image_info = getimagesize(DIR_IMAGE . $oct_ogimage);
if ($image_info) {
$image_width = $image_info[0];
$image_height = $image_info[1];
} else {
$image_width = $this->config->get('theme_' . $this->config->get('config_theme') . '_image_logo_width') ? $this->config->get('theme_' . $this->config->get('config_theme') . '_image_logo_width') : 140;
$image_height = $this->config->get('theme_' . $this->config->get('config_theme') . '_image_logo_height') ? $this->config->get('theme_' . $this->config->get('config_theme') . '_image_logo_height') : 65;
}
$mime_type = isset($image_info['mime']) ? $image_info['mime'] : 'image/svg+xml';
$this->document->setOCTOpenGraph('og:title', htmlspecialchars(strip_tags(str_replace("\r", " ", str_replace("\n", " ", str_replace("\\", "/", str_replace("\"", "", (isset($oct_seo_title) && $oct_seo_title) ? $oct_seo_title : $product_info['meta_title'])))))));
$this->document->setOCTOpenGraph('og:description', htmlspecialchars(strip_tags(str_replace("\r", " ", str_replace("\n", " ", str_replace("\\", "/", str_replace("\"", "", (isset($oct_seo_description) && $oct_seo_description && empty($product_info['meta_description'])) ? $oct_seo_description : $product_info['meta_description'])))))));
$this->document->setOCTOpenGraph('og:site_name', htmlspecialchars(strip_tags(str_replace("\r", " ", str_replace("\n", " ", str_replace("\\", "/", str_replace("\"", "", $this->config->get('config_name'))))))));
$this->document->setOCTOpenGraph('og:url', $this->url->link('product/product', 'product_id=' . $product_info['product_id']));
$this->document->setOCTOpenGraph('og:image', str_replace(" ", "%20", $product_image));
if (isset($mime_type) && $mime_type) {
$this->document->setOCTOpenGraph('og:image:type', $mime_type);
}
if (isset($image_width) && $image_width) {
$this->document->setOCTOpenGraph('og:image:width', $image_width);
}
if (isset($image_height) && $image_height) {
$this->document->setOCTOpenGraph('og:image:height', $image_height);
}
$this->document->setOCTOpenGraph('og:image:alt', htmlspecialchars(strip_tags(str_replace("\r", " ", str_replace("\n", " ", str_replace("\\", "/", str_replace("\"", "", $data['heading_title'])))))));
$this->document->setOCTOpenGraph('og:type', 'product');
}
]]></add>
</operation>
</file>
<file path="catalog/controller/product/manufacturer.php">
<operation error="skip">
<search><![CDATA[$pagination = new Pagination();]]></search>
<add position="before"><![CDATA[
if (isset($oct_deals_data['open_graph']) && $oct_deals_data['open_graph']) {
$site_link = $this->request->server['HTTPS'] ? HTTPS_SERVER : HTTP_SERVER;
$config_logo = file_exists(DIR_IMAGE . $this->config->get('config_logo')) ? $this->config->get('config_logo') : 'catalog/opencart-logo.png';
$oct_ogimage = ($manufacturer_info['image'] && file_exists(DIR_IMAGE . $manufacturer_info['image'])) ? $manufacturer_info['image'] : $config_logo;
$manufacturer_image = $site_link . 'image/' . $oct_ogimage;
$image_info = getimagesize(DIR_IMAGE . $oct_ogimage);
if ($image_info) {
$image_width = $image_info[0];
$image_height = $image_info[1];
} else {
$image_width = $this->config->get('theme_' . $this->config->get('config_theme') . '_image_logo_width') ? $this->config->get('theme_' . $this->config->get('config_theme') . '_image_logo_width') : 140;
$image_height = $this->config->get('theme_' . $this->config->get('config_theme') . '_image_logo_height') ? $this->config->get('theme_' . $this->config->get('config_theme') . '_image_logo_height') : 65;
}
$mime_type = isset($image_info['mime']) ? $image_info['mime'] : 'image/svg+xml';
if (isset($data['heading_title']) && $data['heading_title']) {
$this->document->setOCTOpenGraph('og:title', htmlspecialchars(strip_tags(str_replace("\r", " ", str_replace("\n", " ", str_replace("\\", "/", str_replace("\"", "", $data['heading_title'])))))));
}
if (isset($oct_seo_title) && $oct_seo_title) {
$this->document->setOCTOpenGraph('og:title', htmlspecialchars(strip_tags(str_replace("\r", " ", str_replace("\n", " ", str_replace("\\", "/", str_replace("\"", "", $oct_seo_title)))))));
}
if (isset($manufacturer_info['meta_description']) && $manufacturer_info['meta_description']) {
$this->document->setOCTOpenGraph('og:description', htmlspecialchars(strip_tags(str_replace("\r", " ", str_replace("\n", " ", str_replace("\\", "/", str_replace("\"", "", $manufacturer_info['meta_description'])))))));
}
if (isset($oct_seo_description) && $oct_seo_description) {
$this->document->setOCTOpenGraph('og:description', htmlspecialchars(strip_tags(str_replace("\r", " ", str_replace("\n", " ", str_replace("\\", "/", str_replace("\"", "", $oct_seo_description)))))));
}
$this->document->setOCTOpenGraph('og:site_name', htmlspecialchars(strip_tags(str_replace("\r", " ", str_replace("\n", " ", str_replace("\\", "/", str_replace("\"", "", $this->config->get('config_name'))))))));
$this->document->setOCTOpenGraph('og:url', $this->url->link('product/manufacturer/info', 'manufacturer_id=' . $manufacturer_id));
$this->document->setOCTOpenGraph('og:image', str_replace(" ", "%20", $manufacturer_image));
if (isset($mime_type) && $mime_type) {
$this->document->setOCTOpenGraph('og:image:type', $mime_type);
}
if (isset($image_width) && $image_width) {
$this->document->setOCTOpenGraph('og:image:width', $image_width);
}
if (isset($image_height) && $image_height) {
$this->document->setOCTOpenGraph('og:image:height', $image_height);
}
$this->document->setOCTOpenGraph('og:image:alt', htmlspecialchars(strip_tags(str_replace("\r", " ", str_replace("\n", " ", str_replace("\\", "/", str_replace("\"", "", $data['heading_title'])))))));
$this->document->setOCTOpenGraph('og:type', 'website');
}
]]></add>
</operation>
</file>
</modification>