Skip to content

Commit 954f547

Browse files
committed
EFAQ 6.1.4
= 6.1.4 = * Small tune-up, gallery support added to configuration. * [SITE_URL] BBCode support added for install/import.
1 parent e969e0f commit 954f547

File tree

14 files changed

+119
-53
lines changed

14 files changed

+119
-53
lines changed

Controllers/Admin/FAQ/FAQ_Controller.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ public function printContent()
3434
array('faqs'), 'faqs', isset($_GET['tab']) ? $_GET['tab'] : ''
3535
);
3636

37-
// 2. Set the view variables - other variables
38-
$this->view->addNewFAQ_URL = admin_url('admin.php?page='.$this->conf->getPluginURL_Prefix().'add-edit-faq&faq_id=0');
37+
// 2. Set the view variables - FAQs tab
38+
$this->view->addNewFAQ_URL = admin_url('admin.php?page='.$this->conf->getPluginURL_Prefix().'add-edit-faq&faq_id=0');
3939
$this->view->trustedAdminFAQ_ListHTML = $objFAQsObserver->getTrustedAdminListHTML();
4040

4141
// Print the template

ExpandableFAQ.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Plugin Name: Expandable FAQ
44
* Plugin URI: https://wordpress.org/plugins/expandable-faq/
55
* Description: It’s a high quality, native and responsive WordPress plugin to create and view F.A.Q.'s
6-
* Version: 6.1.3
6+
* Version: 6.1.4
77
* Author: KestutisIT
88
* Author URI: https://profiles.wordpress.org/KestutisIT
99
* Text Domain: expandable-faq
@@ -43,7 +43,7 @@ final class ExpandableFAQ
4343
const REQUIRED_PHP_VERSION = '5.6.0';
4444
const REQUIRED_WP_VERSION = 4.6;
4545
const OLDEST_COMPATIBLE_PLUGIN_SEMVER = '6.0.0';
46-
const PLUGIN_SEMVER = '6.1.3';
46+
const PLUGIN_SEMVER = '6.1.4';
4747

4848
// Settings
4949
/**

Languages/en_US.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
'LANG_REQ_TEXT' => 'Req.',
3535
'LANG_NOT_REQUIRED_TEXT' => 'Not required',
3636
'LANG_REQUIRED_TEXT' => 'Required',
37+
'LANG_AVAILABLE_TEXT' => 'Available',
3738
'LANG_VISIBLE_TEXT' => 'Visible',
3839
'LANG_HIDDEN_TEXT' => 'Hidden',
3940
'LANG_ENABLED_TEXT' => 'Enabled',
@@ -71,6 +72,10 @@
7172
'LANG_OPTIONAL_TEXT' => 'Optional',
7273
'LANG_OPTIONAL2_TEXT' => 'optional', // Lowercase
7374
'LANG_IMAGE_TEXT' => 'Image',
75+
'LANG_IMAGE_VIEW_TEXT' => 'View Image',
76+
'LANG_IMAGE_VIEW_DEMO_TEXT' => 'View Demo Image',
77+
'LANG_IMAGE_DELETE_TEXT' => 'Delete Image',
78+
'LANG_IMAGE_UNSET_DEMO_TEXT' => 'Unset Demo Image',
7479
'LANG_IMAGE_NONE_TEXT' => 'No Image',
7580
'LANG_NO_ERRORS_TEXT' => 'No errors',
7681
'LANG_UNKNOWN_TEXT' => 'Unknown',

Models/Configuration/Configuration.php

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,31 @@ public function __construct(
9393
$this->pluginURL_Prefix = isset($params['plugin_url_prefix']) ? sanitize_key($params['plugin_url_prefix']) : '';
9494
$this->pluginCSS_Prefix = isset($params['plugin_css_prefix']) ? sanitize_key($params['plugin_css_prefix']) : '';
9595

96+
if(isset($params['gallery_folder_name']) && !is_array($params['gallery_folder_name']))
97+
{
98+
// No sanitization, uppercase needed
99+
$this->galleryFolderName = preg_replace('[^-_0-9a-zA-Z]', '', $params['gallery_folder_name']);
100+
} else
101+
{
102+
$this->galleryFolderName = '';
103+
}
104+
105+
// Extension gallery is always in one place, so it is static, and can be defined in the class constructor to safe resources later
106+
$uploadsDir = wp_upload_dir();
107+
if($this->galleryFolderName != "")
108+
{
109+
// This plugin has its own gallery folder
110+
$this->globalGalleryPath = str_replace('\\', DIRECTORY_SEPARATOR, $uploadsDir['basedir']).DIRECTORY_SEPARATOR.$this->galleryFolderName.DIRECTORY_SEPARATOR;
111+
$this->globalGalleryPathWithoutEndSlash = str_replace('\\', DIRECTORY_SEPARATOR, $uploadsDir['basedir']).DIRECTORY_SEPARATOR.$this->galleryFolderName;
112+
$this->globalGalleryURL = $uploadsDir['baseurl'].'/'.$this->galleryFolderName.'/';
113+
} else
114+
{
115+
// Otherwise - either gallery is not needed, or we should use global gallery folder
116+
$this->globalGalleryPath = str_replace('\\', DIRECTORY_SEPARATOR, $uploadsDir['basedir']).DIRECTORY_SEPARATOR;
117+
$this->globalGalleryPathWithoutEndSlash = str_replace('\\', DIRECTORY_SEPARATOR, $uploadsDir['basedir']);
118+
$this->globalGalleryURL = $uploadsDir['baseurl'].'/';
119+
}
120+
96121
if(isset($params['theme_ui_folder_name']) && !is_array($params['theme_ui_folder_name']))
97122
{
98123
// No sanitization, uppercase chars needed
@@ -337,6 +362,26 @@ public function getPluginCSS_Prefix()
337362
return $this->pluginCSS_Prefix;
338363
}
339364

365+
public function getGalleryFolderName()
366+
{
367+
return $this->galleryFolderName;
368+
}
369+
370+
public function getGlobalGalleryPath()
371+
{
372+
return $this->globalGalleryPath;
373+
}
374+
375+
public function getGlobalGalleryPathWithoutEndSlash()
376+
{
377+
return $this->globalGalleryPathWithoutEndSlash;
378+
}
379+
380+
public function getGlobalGalleryURL()
381+
{
382+
return $this->globalGalleryURL;
383+
}
384+
340385
public function getThemeUI_FolderName()
341386
{
342387
return $this->themeUI_FolderName;

Models/Configuration/ConfigurationInterface.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ public function getPluginPrefix();
6363
public function getPluginHandlePrefix();
6464
public function getPluginURL_Prefix();
6565
public function getPluginCSS_Prefix();
66+
public function getGalleryFolderName();
67+
public function getGlobalGalleryPath();
68+
public function getGlobalGalleryPathWithoutEndSlash();
69+
public function getGlobalGalleryURL();
6670
public function getThemeUI_FolderName();
6771
public function getPluginName();
6872
public function getBlogPrefix($paramBlogId = -1);

Models/FAQ/FAQ.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* FAQ
4-
3+
* FAQ Element
4+
*
55
* @package ExpandableFAQ
66
* @author KestutisIT
77
* @copyright KestutisIT
@@ -136,7 +136,6 @@ public function save(array $params)
136136
}
137137
} else if($ok)
138138
{
139-
// For admins we do not save the IP, as the source writers IP may be unknown
140139
$saved = $this->conf->getInternalWPDB()->query("
141140
INSERT INTO {$this->conf->getPrefix()}faqs
142141
(

Models/Import/Demo.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function getId()
4747
return $this->demoId;
4848
}
4949

50-
private function replaceBBCodes($trustedSQLData)
50+
private function replaceBBCodes($trustedSQL_Data)
5151
{
5252
// Spring
5353
$springStartTimestamp = strtotime(date("Y")."-03-01 00:00:00");
@@ -73,6 +73,7 @@ private function replaceBBCodes($trustedSQLData)
7373
// WP Prefix is used in demos only in one place - in WordPress user meta data table for blog prefix
7474
$arrFrom = array(
7575
'[WP_PREFIX]', '[BLOG_ID]',
76+
'[SITE_URL]',
7677
'[SPRING_START_TIMESTAMP]', '[SPRING_END_TIMESTAMP]',
7778
'[SUMMER_START_TIMESTAMP]', '[SUMMER_END_TIMESTAMP]',
7879
'[AUTUMN_START_TIMESTAMP]', '[AUTUMN_END_TIMESTAMP]',
@@ -81,15 +82,16 @@ private function replaceBBCodes($trustedSQLData)
8182
);
8283
$arrTo = array(
8384
$this->conf->getBlogPrefix(), $this->conf->getBlogId(),
85+
get_site_url(),
8486
$springStartTimestamp, $springEndTimestamp,
8587
$summerStartTimestamp, $summerEndTimestamp,
8688
$autumnStartTimestamp, $autumnEndTimestamp,
8789
$winterStartTimestamp, $winterEndTimestamp,
8890
$todayTimestamp, $yesterdayTimestamp
8991
);
90-
$replacedSQLData = str_replace($arrFrom, $arrTo, $trustedSQLData);
92+
$replacedSQL_Data = str_replace($arrFrom, $arrTo, $trustedSQL_Data);
9193

92-
return $replacedSQLData;
94+
return $replacedSQL_Data;
9395
}
9496

9597
/**
@@ -123,9 +125,9 @@ public function replaceContent()
123125
// Parse blog id and plugin version BB codes and replace data in plugin tables
124126
foreach($arrPluginReplaceSQL AS $sqlTable => $sqlData)
125127
{
126-
$replacedSQLData = $this->replaceBBCodes($sqlData);
128+
$replacedSQL_Data = $this->replaceBBCodes($sqlData);
127129
$sqlQuery = "
128-
REPLACE INTO `{$this->conf->getPrefix()}{$sqlTable}` {$replacedSQLData}
130+
REPLACE INTO `{$this->conf->getPrefix()}{$sqlTable}` {$replacedSQL_Data}
129131
";
130132

131133
// DEBUG

Models/Import/DemosObserver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ private function getAll()
101101
// DEBUG
102102
if($this->debugMode == 1)
103103
{
104-
echo "<br />Php demo files: ".nl2br(print_r($phpFiles, TRUE));
104+
echo "<br />PHP demo files: ".nl2br(print_r($phpFiles, TRUE));
105105
echo "<br />Demos: ".nl2br(print_r($retDemos, TRUE));
106106
}
107107

Models/Install/Install.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ public static function getTableClasses()
6363
*/
6464
public function insertContent()
6565
{
66-
$validBlogId = intval($this->blogId);
6766
// Language file already loaded, so we can use translated text
6867

6968
// Insert SQL
@@ -82,7 +81,8 @@ public function insertContent()
8281
// Insert data to WP tables
8382
foreach($arrInsertSQL AS $sqlTable => $sqlData)
8483
{
85-
$sqlQuery = "INSERT INTO `{$this->conf->getBlogPrefix($this->blogId)}{$sqlTable}` {$sqlData}";
84+
$replacedSQL_Data = $this->parseBBCodes($sqlData);
85+
$sqlQuery = "INSERT INTO `{$this->conf->getBlogPrefix($this->blogId)}{$sqlTable}` {$replacedSQL_Data}";
8686
$ok = $this->conf->getInternalWPDB()->query($sqlQuery);
8787
if($ok === FALSE)
8888
{
@@ -101,10 +101,10 @@ public function insertContent()
101101
// Parse shortcodes and make SQL queries
102102
foreach($arrPluginInsertSQL AS $sqlTable => $sqlData)
103103
{
104-
$sqlData = $this->parseBBCodes($sqlData);
104+
$replacedSQL_Data = $this->parseBBCodes($sqlData);
105105

106106
// Note: we don't use blog_id param for getPrefix, as it is always the same
107-
$sqlQuery = "INSERT INTO `{$this->conf->getPrefix()}{$sqlTable}` {$sqlData}";
107+
$sqlQuery = "INSERT INTO `{$this->conf->getPrefix()}{$sqlTable}` {$replacedSQL_Data}";
108108
$ok = $this->conf->getInternalWPDB()->query($sqlQuery);
109109
if($ok === FALSE)
110110
{
@@ -157,9 +157,10 @@ public function resetContent()
157157
// Replace data to WP tables
158158
foreach($arrReplaceSQL AS $sqlTable => $sqlData)
159159
{
160+
$replacedSQL_Data = $this->parseBBCodes($sqlData);
160161
// Note - MySQL 'REPLACE INTO' works like MySQL 'INSERT INTO', except that if there is a row
161162
// with the same key you are trying to insert, it will be deleted on replace instead of giving you an error.
162-
$sqlQuery = "REPLACE INTO `{$this->conf->getBlogPrefix($this->blogId)}{$sqlTable}` {$sqlData}";
163+
$sqlQuery = "REPLACE INTO `{$this->conf->getBlogPrefix($this->blogId)}{$sqlTable}` {$replacedSQL_Data}";
163164
$ok = $this->conf->getInternalWPDB()->query($sqlQuery);
164165
if($ok === FALSE)
165166
{
@@ -178,9 +179,9 @@ public function resetContent()
178179
// Parse shortcodes and make SQL queries
179180
foreach($arrPluginReplaceSQL AS $sqlTable => $sqlData)
180181
{
181-
$sqlData = str_replace('[BLOG_ID]', intval($this->blogId), $sqlData);
182+
$replacedSQL_Data = $this->parseBBCodes($sqlData);
182183
// Note: we don't use blog_id param for getPrefix, as it is always the same
183-
$sqlQuery = "REPLACE INTO `{$this->conf->getPrefix()}{$sqlTable}` {$sqlData}";
184+
$sqlQuery = "REPLACE INTO `{$this->conf->getPrefix()}{$sqlTable}` {$replacedSQL_Data}";
184185
$ok = $this->conf->getInternalWPDB()->query($sqlQuery);
185186

186187
if($ok === FALSE)

Models/Update/Patches61Z.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ final class Patches61Z extends AbstractDatabase implements StackInterface, Datab
1717
{
1818
const CURRENT_MAJOR = 6; // Positive integer [X]
1919
const CURRENT_MINOR = 1; // Positive integer [Y]
20-
const LATEST_PATCH = 3; // Positive integer [Z]
20+
const LATEST_PATCH = 4; // Positive integer [Z]
2121
const LATEST_RELEASE = ''; // String
2222
const LATEST_BUILD_METADATA = ''; // String
2323
const PLUGIN_PREFIX = "expandable_faq_";

0 commit comments

Comments
 (0)