Skip to content

Commit

Permalink
Release 1.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
hiteshaggarwal committed May 28, 2020
1 parent e8d7398 commit ec444b0
Show file tree
Hide file tree
Showing 77 changed files with 5,672 additions and 435 deletions.
11 changes: 11 additions & 0 deletions com_jdbuilder/administrator/config.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<config>
<fieldset label="COM_JDBUILDER" name="jdbuilder">
<field name="key" type="text" default="" label="JDB_ACTIVATION_KEY"></field>
<field name="gmapkey" type="text" default="" label="JDB_GOOGLE_MAP_KEY"></field>
<field type="spacer" name="gmapkeySpacer" hr="true" />
<field name="fbAppId" type="text" default="" description="JDB_FACEBOOK_SDK_ALERT" label="JDB_FB_APP_ID"></field>
<field type="spacer" name="fbAppIdSpacer" hr="false" label="JDB_FACEBOOK_SDK_ALERT" />
<field name="captchaspacer" type="spacer" label="JDB_FIELD_SPACER"></field>
<field name="recaptchaSiteKey" type="text" default="" label="JDB_RECAPTCHA_SITE_KEY"></field>
<field name="recaptchaSecretKey" type="text" default="" label="JDB_RECAPTCHA_SECRET_KEY"></field>
</fieldset>

<fieldset name="permissions" description="JCONFIG_PERMISSIONS_DESC" label="JCONFIG_PERMISSIONS_LABEL">
<field name="rules" type="rules" component="com_jdbuilder" class="inputbox" filter="rules" validate="rules" label="JCONFIG_PERMISSIONS_LABEL" section="component" />
</fieldset>
Expand Down
2 changes: 1 addition & 1 deletion com_jdbuilder/administrator/helpers/jdbuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public static function versionMessage()
return;
}
$document = JFactory::getDocument();
$document->addStyleDeclaration('.jdb-pro-message{background-image:linear-gradient(110deg, #099a97 6%, #15cda8 100%);box-shadow:8px 8px 8px rgba(221, 221, 221, 0.81);overflow:hidden;border-radius:4px;display:flex;color:#fff;margin-bottom:25px;line-height: 1.5rem;font-size:14px;}.jdb-pro-message h4{font-size:16px;margin:0 0 10px;}body.admin.com_jdbuilder #content .jdb-pro-message a{color:#fff;}.jdb-pro-logo{color: white;min-width: 80px;display: grid;align-items: center;padding: 15px;box-sizing: border-box;background-image:linear-gradient(110.7deg, #099a97 6.3%, #15cda8 90.6%);margin-right:10px;}.jdb-content{padding:20px 10px;align-self:center;}.jdb-content p{color:#f1f1f1;margin:0;}.jdb-content strong{color:#fff;}');
$document->addStyleDeclaration('.jdb-pro-message{background-image:linear-gradient(110deg, #099a97 6%, #15cda8 100%);box-shadow:8px 8px 8px rgba(221, 221, 221, 0.81);overflow:hidden;border-radius:4px;display:flex;color:#fff;margin-bottom:25px;line-height: 1.5rem;font-size:14px;}.jdb-pro-message h4{font-size:16px;margin:0 0 10px;}body.admin.com_jdbuilder #content .jdb-pro-message a{color:#fff;}.jdb-pro-logo{color: white;width: 100px;display: grid;align-items: center;padding: 15px;box-sizing: border-box;background-image:linear-gradient(110.7deg, #099a97 6.3%, #15cda8 90.6%);margin-right:10px;}.jdb-content{padding:20px 10px;align-self:center;}.jdb-content p{color:#f1f1f1;margin:0;}.jdb-content strong{color:#fff;}');

$prefix = $isPro ? 'PRO' : 'FREE';
return '<div class="jdb-pro-message"><div class="jdb-pro-logo">' . file_get_contents(JURI::root() . 'media/jdbuilder/images/jdb-icon.svg') . '</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ COM_JDBUILDER_HELP="Help"


COM_JDBUILDER_VER_MSG_FREE_TITLE="Get JD Builder Pro and unlock the magical power of page building"
COM_JDBUILDER_VER_MSG_FREE_DESC='30+ premium elements, Priority email support, Library of prebuilt sections, Keyboard shortcuts and a bunch more! <strong>Get it today</strong> at <a href="https://www.joomdev.com/pro"><strong>joomdev.com/pro</strong></a>'
COM_JDBUILDER_VER_MSG_FREE_DESC="30+ premium elements, Priority email support, Library of prebuilt sections, Keyboard shortcuts and a bunch more! <strong>Get it today</strong> at <a href='https://www.joomdev.com/pro'><strong>joomdev.com/pro</strong></a>"

COM_JDBUILDER_VER_MSG_PRO_TITLE="Unlock JD Builder by adding license key."
COM_JDBUILDER_VER_MSG_PRO_DESC='Hello, In order to use the premium features and receive auto-updates, you need to add your license key. <a href="index.php?option=com_config&view=component&component=com_jdbuilder"><strong>Activate JD Builder Pro</strong></a>'
COM_JDBUILDER_VER_MSG_PRO_DESC="Hello, In order to use the premium features and receive auto-updates, you need to add your license key. <a href='index.php?option=com_config&view=component&component=com_jdbuilder'><strong>Activate JD Builder Pro</strong></a>"

JDB_ACTIVATION_KEY="Builder Pro Activation Key"
JDB_GOOGLE_MAP_KEY="Google Map API Key"
Expand Down
2 changes: 1 addition & 1 deletion com_jdbuilder/jdbuilder.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<author>Team Joomdev</author>
<authorEmail>[email protected]</authorEmail>
<authorUrl>https://www.joomdev.com</authorUrl>
<version>1.6.0</version>
<version>1.7.0</version>
<description>{jdbcomdesc}</description>
<install> <!-- Runs on install -->
<sql>
Expand Down
2 changes: 1 addition & 1 deletion com_jdbuilder/media/css/style.min.css

Large diffs are not rendered by default.

14 changes: 13 additions & 1 deletion mod_jdbuilder/mod_jdbuilder.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<authorUrl>https://www.joomdev.com</authorUrl>
<copyright>Copyright (C) 2020 Joomdev, Inc. All rights reserved.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<version>1.6.0</version>
<version>1.7.0</version>
<description>This Module allows you to create your own Module using the JD Builder.</description>
<files>
<filename>mod_jdbuilder.xml</filename>
Expand All @@ -20,6 +20,18 @@
<fieldset addfieldpath="/plugins/system/jdbuilder/fields" name="basic">
<field name="jdbuilder_layout" default="0" type="jdbeditor" />
</fieldset>
<fieldset name="advanced">
<field name="layout" type="modulelayout" label="JFIELD_ALT_LAYOUT_LABEL" description="JFIELD_ALT_MODULE_LAYOUT_DESC" />
<field name="moduleclass_sfx" type="textarea" rows="3" label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL" description="COM_MODULES_FIELD_MODULECLASS_SFX_DESC" />
<field name="cache" type="list" default="1" label="COM_MODULES_FIELD_CACHING_LABEL" description="COM_MODULES_FIELD_CACHING_DESC">
<option value="1">JGLOBAL_USE_GLOBAL</option>
<option value="0">COM_MODULES_FIELD_VALUE_NOCACHING</option>
</field>
<field name="cache_time" type="text" default="900" label="COM_MODULES_FIELD_CACHE_TIME_LABEL" description="COM_MODULES_FIELD_CACHE_TIME_DESC" />
<field name="cachemode" type="hidden" default="itemid">
<option value="itemid"></option>
</field>
</fieldset>
</fields>
</config>
</extension>
47 changes: 36 additions & 11 deletions pkg_jdbuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,49 +9,74 @@
// no direct access
defined('_JEXEC') or die;

class pkg_jdbuilderInstallerScript {
class pkg_jdbuilderInstallerScript
{

private $min_php_version = '7.2';

/**
*
* Function to run before installing the component
*/
public function preflight($type, $parent) {

public function preflight($type, $parent)
{
if (!$this->passMinimumPHPVersion()) {

return false;
}
}

/**
*
* Function to run when installing the component
* @return void
*/
public function install($parent) {
public function install($parent)
{
}

/**
*
* Function to run when un-installing the component
* @return void
*/
public function uninstall($parent) {
public function uninstall($parent)
{
}

/**
*
* Function to run when updating the component
* @return void
*/
function update($parent) {
function update($parent)
{
}

/**
*
* Function to run after installing the component
*/
public function postflight($type, $parent) {
public function postflight($type, $parent)
{
}

private function passMinimumPHPVersion()
{

if (version_compare(PHP_VERSION, $this->min_php_version, 'l')) {
\JFactory::getApplication()->enqueueMessage(
\JText::sprintf(
'You current PHP version is %s. The minimum recommended PHP version for JD Builder is PHP %s.',
'<strong>' . PHP_VERSION . '</strong>',
'<strong>' . $this->min_php_version . '</strong>'
),
'error'
);

return false;
}

return true;
}
}
4 changes: 3 additions & 1 deletion pkg_jdbuilder.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<packagerurl>https://www.joomdev.com</packagerurl>
<author>Team JoomDev</author>
<creationDate>Apr 2020</creationDate>
<version>1.6.0</version>
<version>1.7.0</version>
<url>https://www.joomdev.com</url>
<copyright>Copyright (C) 2020 Joomdev, Inc. All rights reserved.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
Expand All @@ -16,6 +16,8 @@
<description>{jdpkgdesc}</description>
<scriptfile>pkg_jdbuilder.php</scriptfile>
<files>
<folder type="plugin" id="jdbuilder" client="site" group="finder">plg_finder_jdbuilder</folder>
<folder type="plugin" id="jdbuilder" client="site" group="search">plg_search_jdbuilder</folder>
<folder type="plugin" id="jdbuilder" client="site" group="system">plg_jdbuilder</folder>
<folder type="component" id="com_jdbuilder" client="site">com_jdbuilder</folder>
<folder type="module" id="mod_jdbuilder" client="site">mod_jdbuilder</folder>
Expand Down
217 changes: 217 additions & 0 deletions plg_finder_jdbuilder/jdbuilder.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,217 @@
<?php

/**
* @package JD Builder
* @author Team Joomdev <[email protected]>
* @copyright 2020 www.joomdev.com
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

defined('_JEXEC') or die;

use Joomla\Registry\Registry;
use JDPageBuilder\Builder;
use JDPageBuilder\Element\Layout;

JLoader::register('FinderIndexerAdapter', JPATH_ADMINISTRATOR . '/components/com_finder/helpers/indexer/adapter.php');

class PlgFinderJDBuilder extends FinderIndexerAdapter
{
/**
* The plugin identifier.
*/
protected $context = 'JDBuilder';

/**
* The extension name.
*/
protected $extension = 'com_jdbuilder';

/**
* The sublayout to use when rendering the results.
*/
protected $layout = 'page';

/**
* The type of content that the adapter indexes.
*/
protected $type_title = 'Page';

/**
* The table name.
*/
protected $table = '#__jdbuilder_page';

/**
* The field the published state is stored in.
*/
protected $state_field = 'published';

/**
* Load the language file on instantiation.
*/
protected $autoloadLanguage = true;

/**
* Method to remove the link information for items that have been deleted.
*/
public function onFinderAfterDelete($context, $table)
{
if ($context === 'com_jdbuilder.page') {
$id = $table->id;
} elseif ($context === 'com_finder.index') {
$id = $table->link_id;
} else {
return true;
}

// Remove the items.
return $this->remove($id);
}

/**
* Method to determine if the access level of an item changed.
*/
public function onFinderAfterSave($context, $row, $isNew)
{
if ($context === 'com_jdbuilder.page') {
if (!$isNew && $this->old_access != $row->access) {
$this->itemAccessChange($row);
}

$this->reindex($row->id);
}

return true;
}

/**
* Method to reindex the link information for an item that has been saved.
* This event is fired before the data is actually saved so we are going
* to queue the item to be indexed later.
*/
public function onFinderBeforeSave($context, $row, $isNew)
{
if ($context === 'com_jdbuilder.page') {
if (!$isNew) {
$this->checkItemAccess($row);
}
}

return true;
}

/**
* Method to update the link information for items that have been changed
* from outside the edit screen. This is fired when the item is published,
* unpublished, archived, or unarchived from the list view.
*/
public function onFinderChangeState($context, $pks, $value)
{
if ($context === 'com_jdbuilder.page') {
$this->itemStateChange($pks, $value);
}

if ($context === 'com_plugins.plugin' && $value === 0) {
$this->pluginDisable($pks);
}
}

/**
* Method to index an item. The item must be a FinderIndexerResult object.
*/
protected function index(FinderIndexerResult $item, $format = 'html')
{
Builder::init(JFactory::getApplication());
// Check if the extension is enabled
if (JComponentHelper::isEnabled($this->extension) === false) {
return;
}

$menuItem = self::getActiveMenu($item->id);
$item->setLanguage();
$item->url = $this->getUrl($item->id, $this->extension, $this->layout);

$object = $item;
$object->layout = $item->body;
$layout = new Layout($object, 'page', $item->id, true);
$rendered = $layout->render();

$item->body = trim(strip_tags($rendered));

$link = 'index.php?option=com_jdbuilder&view=page&id=' . $item->id;

if ($item->language && $item->language !== '*' && JLanguageMultilang::isEnabled()) {
$link .= '&lang=' . $item->language;
}

if (isset($menuItem->id) && $menuItem->id) {
$link .= '&Itemid=' . $menuItem->id;
}

$item->route = $link;

$item->path = $item->route;

if (isset($menuItem->title) && $menuItem->title) {
$item->title = $menuItem->title;
}

// Handle the page author data.
$item->addInstruction(FinderIndexer::META_CONTEXT, 'user');

// Add the type taxonomy data.
$item->addTaxonomy('Type', 'Page');

// Add the language taxonomy data.
$item->addTaxonomy('Language', $item->language);

// Index the item.
$this->indexer->index($item);
}

/**
* Method to setup the indexer to be run.
*/
protected function setup()
{
JLoader::register('JdbuilderRouter', JPATH_SITE . '/components/com_jdbuilder/router.php');

return true;
}

/**
* Method to get the SQL query used to retrieve the list of page items.
*/
protected function getListQuery($query = null)
{
$db = JFactory::getDbo();

// Check if we can use the supplied SQL query.
$query = $query instanceof JDatabaseQuery ? $query : $db->getQuery(true)
->select('a.id, a.title AS title, l.layout as body, FROM_UNIXTIME(l.created) as start_date')
->select('a.created_by, FROM_UNIXTIME(l.updated) as modified, a.modified_by, a.language')
->select('a.access, a.category_id, a.state, a.ordering')

->select('u.name')
->from('#__jdbuilder_pages AS a')
->join('LEFT', '#__users AS u ON u.id = a.created_by')
->join('LEFT', '#__jdbuilder_layouts AS l ON l.id = a.layout_id');

return $query;
}

public static function getActiveMenu($pageId)
{
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select(array('title, id'));
$query->from($db->quoteName('#__menu'));
$query->where($db->quoteName('link') . ' LIKE ' . $db->quote('%option=com_jdbuilder&view=page&id=' . $pageId . '%'));
$query->where($db->quoteName('published') . ' = ' . $db->quote('1'));
$db->setQuery($query);
$item = $db->loadObject();

return $item;
}
}
Loading

0 comments on commit ec444b0

Please sign in to comment.