Skip to content

Commit

Permalink
release
Browse files Browse the repository at this point in the history
  • Loading branch information
Skullbock committed Oct 28, 2021
0 parents commit e9ca116
Show file tree
Hide file tree
Showing 18 changed files with 1,004 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.idea
.DS_Store
plugin/vendor
build/*
plugin/renderer/item/positions.config
plugin/composer.lock
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Algolia integration for ZOO

Plugin to allow any ZOO item to be indexed into an algolia index.
Each ZOO application has its own Algolia configuration, allowing for different indexes per-application.

Each ZOO type can be mapped through a simple drag and drop configuration using the standard ZOO layouts.

## Installation

Download [a release here on github](https://github.com/Weble/ZOOalgolia/releases) and install it using Joomla Installer.

## Usage

1. Install the plugin
2. Enable it
3. Go into your ZOO application instance configuration and fill in the required settings ![Config](./img/config.jpg)
4. Go into the ZOO layout configuration and map your type. Use the "Label" to set the key of that property. ![Layout](./img/layout.jpg)

Now, every time you create / save / delete an item from zoo, it will be instantly indexed in Algolia.

## Console Commands

If you have [JoomlaCommands](https://github.com/Weble/JoomlaCommands) installed, the plugin provides an handy `algolia:sync` command to deal with syncing from the command line

```php bin/console algolia:sync {--app=[ID] --type=[type] --ids=1,2,3}```

## Build from source

```./build.sh```
9 changes: 9 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Remove old files
rm -f build/*.zip

# Zip Plugin
cd plugin/
composer install
zip -qr ../build/plg_system_zooalgolia.zip ./*

cd ../
Binary file added img.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/config.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/layout.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions plugin/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"require": {
"php": "^7.4 || ^8.0",
"algolia/algoliasearch-client-php": "^3.0"
},
"autoload": {
"psr-4": {
"Weble\\ZOOAlgolia\\": [
"src"
]
}
},
"config": {
"platform": {
"php": "7.4.22"
}
}
}
11 changes: 11 additions & 0 deletions plugin/config/application.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<applications>
<application group="all">
<params group="application-config">
<param name="algolia_app_id" type="text" description="Algolia Application Id" label="Algolia App Id" default="" />
<param name="algolia_search_key" type="text" description="Algolia Search Key" label="Algolia Search Key" default="" />
<param name="algolia_secret_key" type="text" description="Algolia Secret Key" label="Algolia Secret Key" default="" />
<param name="algolia_index" type="text" description="Algolia Index name" label="Algolia Index Name" default="" />
</params>
</application>
</applications>
36 changes: 36 additions & 0 deletions plugin/install.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

use Joomla\CMS\Factory;

defined('_JEXEC') or die('Restricted access');

class plgSystemZooalgoliaInstallerScript
{
public const MIN_PHP = '7.4';

public function preflight($type, $parent)
{
$app = Factory::getApplication();
$msg = null;

if (!in_array($type, ['install', 'update'])) {
return;
}

// check minimum PHP version
if (!version_compare(PHP_VERSION, self::MIN_PHP, 'ge')) {
$msg = sprintf('You need PHP %s or later to install this extension.', self::minPHP);
}

if ($msg) {
$app->enqueueMessage($msg, 'warning');

return false;
}
}

function install($parent)
{
// $db = \JFactory::getDBO();
}
}
1 change: 1 addition & 0 deletions plugin/renderer/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>
3 changes: 3 additions & 0 deletions plugin/renderer/item/algolia.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php
defined('_JEXEC') or die('Restricted access');
?>
1 change: 1 addition & 0 deletions plugin/renderer/item/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>
7 changes: 7 additions & 0 deletions plugin/renderer/item/metadata.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<layout name="algolia">
<name>Algolia</name>
<description>Map ZOO items to Algolia</description>
</layout>
</metadata>
6 changes: 6 additions & 0 deletions plugin/renderer/item/positions.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0"?>
<renderer>
<positions layout="algolia">
<position name="search">Search</position>
</positions>
</renderer>
Loading

0 comments on commit e9ca116

Please sign in to comment.