Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
w3scout committed Jul 12, 2023
0 parents commit 0271529
Show file tree
Hide file tree
Showing 37 changed files with 2,745 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

# EditorConfig is awesome: http://EditorConfig.org

# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.{php,twig,yml,yaml}]
indent_style = space
indent_size = 4

[*.{html5,svg,min.css,min.js}]
insert_final_newline = false

[*/contao/**.{css,js,php},*/public/**.{css,js}]
indent_style = tab

[*/contao/**.html5]
indent_style = space
indent_size = 2
7 changes: 7 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/.ecs
/.github export-ignore
/tests export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/phpunit.xml.dist export-ignore
/.travis.yml export-ignore
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Jetbrains
/.idea/*

# tools
/vendor/
/tools/*/vendor
/composer.lock
/.php-cs-fixer.cache
/tools/phpunit/.phpunit.result.cache
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

# Welcome to Contao GoogleBusinessReviews Bundle
### Notice: this bundle is still under construction!

## Requirements:
- Google Cloud Console Account
- Google Business Account
- Google Places API Key
- Google Place ID

## Known limitations:
the Google Places API returnes only 5 reviews. If you need more, you need to request access to the Business Profile API: https://developers.google.com/my-business/content/overview?hl=de

## How to set up a Google Places API Key:
[Google Docs Places API](https://developers.google.com/maps/documentation/places/web-service/get-api-key)

DON´T FORGET TO RESTRICT YOUR API KEY! https://developers.google.com/maps/documentation/places/web-service/get-api-key#restrict_key

## How to find your Google Place ID:
Go to the Google Places ID Finder page [Google Places ID Finder](https://developers.google.com/maps/documentation/javascript/examples/places-placeid-finder) and search for your business. When your business is found, click on the marker and copy the Place ID out of it.

## How to find the URL to your Google My Business entry:
Go to your Google My Business entry, copy the URL out of the browser address bar and remove everything after your business name.

## How to find the "Write a new review" link":
Go to your Google My Business entry and click on "Write a review". Copy the link out of the browser address bar.
51 changes: 51 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"name": "w3scout/contao-googlebusinessreviews-bundle",
"description": "Zeigt eine Liste von Google Business Rezensionen",
"keywords": [
"contao",
"bundle",
"Google Business Rezensionen",
"Google Business Reviews"
],
"type": "contao-bundle",
"license": "GPL-3.0-or-later",
"authors": [
{
"name": "Darko Selesi",
"email": "hallo@w3scouts.com",
"homepage": "https://w3scouts.com",
"role": "Developer"
}
],
"support": {
"issues": "https://github.com/w3scout/contao-googlebusinessreviews-bundle/issues",
"source": "https://github.com/w3scout/contao-googlebusinessreviews-bundle"
},
"require": {
"php": "^8.1",
"contao/core-bundle": "^4.13 || ^5.0"
},
"require-dev": {
"contao/manager-plugin": "^2.12"
},
"autoload": {
"psr-4": {
"W3Scout\\ContaoGoogleBusinessReviews\\": "src/"
}
},
"config": {
"allow-plugins": {
"contao-components/installer": false,
"contao/manager-plugin": false,
"contao-community-alliance/composer-plugin": true
}
},
"extra": {
"contao-manager-plugin": "W3Scout\\ContaoGoogleBusinessReviews\\ContaoManager\\Plugin"
},
"scripts": {
"cs-fixer": "@php tools/ecs/vendor/bin/ecs check config/ contao/ src/ templates/ tests/ --config tools/ecs/config.php --fix --ansi",
"unit-tests": "@php tools/phpunit/vendor/bin/phpunit -c tools/phpunit/phpunit.xml.dist"
},
"version": "0.9.0"
}
3 changes: 3 additions & 0 deletions config/listener.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#config/listener.yaml
services:

3 changes: 3 additions & 0 deletions config/parameters.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#config/parameters.yaml
parameters:

15 changes: 15 additions & 0 deletions config/services.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# config/services.yaml
services:
_defaults:
autowire: true # Automatically injects dependencies in your services.
autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.
public: false # Allows optimizing the container by removing unused services; this also means
# fetching services directly from the container via $container->get() won't work.
# The best practice is to be explicit about your dependencies anyway.
bind:
#$projectDir: '%kernel.project_dir%'

W3Scout\ContaoGoogleBusinessReviews\:
resource: ../src/
exclude: ../src/{DependencyInjection,Model,Session}

14 changes: 14 additions & 0 deletions contao/config/config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

/*
* This file is part of GoogleBusinessReviews.
*
* (c) Darko Selesi 2023 <hallo@w3scouts.com>
* @license GPL-3.0-or-later
* For the full copyright and license information,
* please view the LICENSE file that was distributed with this source code.
* @link https://github.com/w3scout/contao-google-business-reviews
*/

$GLOBALS['TL_CSS'][] = 'bundles/w3scoutcontaogooglebusinessreviews/css/styles.css|static';
$GLOBALS['TL_JAVASCRIPT'][] = 'bundles/w3scoutcontaogooglebusinessreviews/js/script.js|static';
74 changes: 74 additions & 0 deletions contao/dca/tl_module.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<?php

declare(strict_types=1);

/*
* This file is part of GoogleBusinessReviews.
*
* (c) Darko Selesi 2023 <hallo@w3scouts.com>
* @license GPL-3.0-or-later
* For the full copyright and license information,
* please view the LICENSE file that was distributed with this source code.
* @link https://github.com/w3scout/contao-google-business-reviews
*/

use W3Scout\ContaoGoogleBusinessReviews\Controller\FrontendModule\GooglebusinessreviewsController;

/**
* Frontend module
*/
$GLOBALS['TL_DCA']['tl_module']['palettes'][GooglebusinessreviewsController::TYPE] = '{title_legend},name,headline,type;{config_legend},w3s_google_api_key,w3s_google_places_id,w3s_reviews_language,w3s_reviews_no_translations,w3s_reviews_sort,w3s_reviews_link2gbp,w3s_reviews_new_review_link;{template_legend:hide},customTpl;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID';

$GLOBALS['TL_DCA']['tl_module']['fields']['w3s_google_api_key'] = array
(
'exclude' => true,
'inputType' => 'text',
'eval' => array('maxlength'=>255, 'tl_class'=>'w50', 'mandatory'=>true),
'sql' => "varchar(255) NOT NULL default ''"
);
$GLOBALS['TL_DCA']['tl_module']['fields']['w3s_google_places_id'] = array
(
'exclude' => true,
'inputType' => 'text',
'eval' => array('maxlength'=>255, 'tl_class'=>'w50', 'mandatory'=>true),
'sql' => "varchar(255) NOT NULL default ''"
);
$GLOBALS['TL_DCA']['tl_module']['fields']['w3s_reviews_language'] = array
(
'exclude' => true,
'inputType' => 'text',
'eval' => array('maxlength'=>4, 'tl_class'=>'w50', 'mandatory'=>false),
'sql' => "varchar(4) NOT NULL default ''"
);
$GLOBALS['TL_DCA']['tl_module']['fields']['w3s_reviews_no_translations'] = array
(
'exclude' => true,
'inputType' => 'select',
'options' => array('true', 'false'),
'reference' => &$GLOBALS['TL_LANG']['tl_module'],
'eval' => array('tl_class'=>'w50'),
'sql' => "varchar(5) COLLATE ascii_bin NOT NULL default 'false'"
);
$GLOBALS['TL_DCA']['tl_module']['fields']['w3s_reviews_sort'] = array
(
'exclude' => true,
'inputType' => 'select',
'options' => array('most_relevant', 'newest'),
'reference' => &$GLOBALS['TL_LANG']['tl_module'],
'eval' => array('tl_class'=>'w50'),
'sql' => "varchar(13) COLLATE ascii_bin NOT NULL default 'most_relevant'"
);
$GLOBALS['TL_DCA']['tl_module']['fields']['w3s_reviews_link2gbp'] = array
(
'exclude' => true,
'inputType' => 'text',
'eval' => array('maxlength'=>255, 'tl_class'=>'clr w50', 'mandatory'=>false),
'sql' => "varchar(255) NOT NULL default ''"
);
$GLOBALS['TL_DCA']['tl_module']['fields']['w3s_reviews_new_review_link'] = array
(
'exclude' => true,
'inputType' => 'text',
'eval' => array('maxlength'=>255, 'tl_class'=>'w50', 'mandatory'=>false),
'sql' => "varchar(255) NOT NULL default ''"
);
19 changes: 19 additions & 0 deletions contao/languages/de/default.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

declare(strict_types=1);

/*
* This file is part of GoogleBusinessReviews-Bundle.
*
* (c) Darko Selesi 2023 <hallo@w3scouts.com>
* @license GPL-3.0-or-later
* For the full copyright and license information,
* please view the LICENSE file that was distributed with this source code.
* @link https://github.com/w3scout/contao-googlebusiness-reviews
*/

/**
* Miscellaneous
*/
$GLOBALS['TL_LANG']['MSC']['w3s_reviews_show_all_reviews'] = 'Alle Bewertungen auf Google ansehen';
$GLOBALS['TL_LANG']['MSC']['w3s_reviews_write_new_review'] = 'Eine Rezension schreiben';
21 changes: 21 additions & 0 deletions contao/languages/de/modules.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

declare(strict_types=1);

/*
* This file is part of GoogleBusinessReviews.
*
* (c) Darko Selesi 2023 <hallo@w3scouts.com>
* @license GPL-3.0-or-later
* For the full copyright and license information,
* please view the LICENSE file that was distributed with this source code.
* @link https://github.com/w3scout/contao-google-business-reviews
*/

use W3Scout\ContaoGoogleBusinessReviews\Controller\FrontendModule\GooglebusinessreviewsController;

/**
* Frontend modules
*/
$GLOBALS['TL_LANG']['FMD']['reviews'] = 'Google Business Rezensionen';
$GLOBALS['TL_LANG']['FMD'][GooglebusinessreviewsController::TYPE] = ['Google Business Reviews', 'Zeigt Google Business Rezensionen an.'];
28 changes: 28 additions & 0 deletions contao/languages/de/tl_module.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

declare(strict_types=1);

/*
* This file is part of GoogleBusinessReviews.
*
* (c) Darko Selesi 2023 <hallo@w3scouts.com>
* @license GPL-3.0-or-later
* For the full copyright and license information,
* please view the LICENSE file that was distributed with this source code.
* @link https://github.com/w3scout/contao-google-business-reviews
*/

/**
* Frontend modules
*/
$GLOBALS['TL_LANG']['tl_module']['w3s_google_api_key'] = ['Google API Key', 'Bitte geben Sie Ihren Google API Key ein.'];
$GLOBALS['TL_LANG']['tl_module']['w3s_google_places_id'] = ['Google Places ID', 'Bitte geben Sie Ihre Google Places ID ein.'];
$GLOBALS['TL_LANG']['tl_module']['w3s_reviews_language'] = ['Sprache', 'Bitte geben Sie den ISO-Code der Sprache (z.B. "de"). Wenn Sie keine Sprache angeben, werden die Rezensionen in der Originalsprache angezeigt.'];
$GLOBALS['TL_LANG']['tl_module']['w3s_reviews_no_translations'] = ['Rezensionen in der originalen Sprache anzeigen', 'Bitte wählen Sie, ob Rezensionen in der vom Rezensent verwendeten Sprache angezeigt werden sollen.'];
$GLOBALS['TL_LANG']['tl_module']['w3s_reviews_sort'] = ['Sortierung ', 'Bitte wählen Sie die Sortierung der Rezensionen.'];
$GLOBALS['TL_LANG']['tl_module']['true'] = 'Ja';
$GLOBALS['TL_LANG']['tl_module']['false'] = 'Nein';
$GLOBALS['TL_LANG']['tl_module']['most_relevant'] = 'Relevante zuerst (Standard)';
$GLOBALS['TL_LANG']['tl_module']['newest'] = 'Neueste zuerst';
$GLOBALS['TL_LANG']['tl_module']['w3s_reviews_link2gbp'] = ['Link zum Google Maps Business Profil', 'Bitte tragen Sie die URL zu Ihrem Google Maps Business Profil ein.'];
$GLOBALS['TL_LANG']['tl_module']['w3s_reviews_new_review_link'] = ['Link zum Formular "Rezension schreiben"', 'Bitte tragen Sie die URL zum Formular "Neue Rezension" ein.'];
19 changes: 19 additions & 0 deletions contao/languages/en/default.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

declare(strict_types=1);

/*
* This file is part of GoogleBusinessReviews-Bundle.
*
* (c) Darko Selesi 2023 <hallo@w3scouts.com>
* @license GPL-3.0-or-later
* For the full copyright and license information,
* please view the LICENSE file that was distributed with this source code.
* @link https://github.com/w3scout/contao-googlebusiness-reviews
*/

/**
* Miscellaneous
*/
$GLOBALS['TL_LANG']['MSC']['w3s_reviews_show_all_reviews'] = 'View all reviews on Google';
$GLOBALS['TL_LANG']['MSC']['w3s_reviews_write_new_review'] = 'Write a review';
21 changes: 21 additions & 0 deletions contao/languages/en/modules.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

declare(strict_types=1);

/*
* This file is part of GoogleBusinessReviews.
*
* (c) Darko Selesi 2023 <hallo@w3scouts.com>
* @license GPL-3.0-or-later
* For the full copyright and license information,
* please view the LICENSE file that was distributed with this source code.
* @link https://github.com/w3scout/contao-google-business-reviews
*/

use W3Scout\ContaoGoogleBusinessReviews\Controller\FrontendModule\GooglebusinessreviewsController;

/**
* Frontend modules
*/
$GLOBALS['TL_LANG']['FMD']['reviews'] = 'Google Business Reviews';
$GLOBALS['TL_LANG']['FMD'][GooglebusinessreviewsController::TYPE] = ['Google Business Reviews', 'Displays Google business reviews.'];
28 changes: 28 additions & 0 deletions contao/languages/en/tl_module.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

declare(strict_types=1);

/*
* This file is part of GoogleBusinessReviews.
*
* (c) Darko Selesi 2023 <hallo@w3scouts.com>
* @license GPL-3.0-or-later
* For the full copyright and license information,
* please view the LICENSE file that was distributed with this source code.
* @link https://github.com/w3scout/contao-google-business-reviews
*/

/**
* Frontend modules
*/
$GLOBALS['TL_LANG']['tl_module']['w3s_google_api_key'] = ['Google API Key', 'Please enter your Google API Key.'];
$GLOBALS['TL_LANG']['tl_module']['w3s_google_places_id'] = ['Google Places ID', 'Please enter your Google Places ID.'];
$GLOBALS['TL_LANG']['tl_module']['w3s_reviews_language'] = ['Language', 'Please enter the ISO code of the language (e.g. "en"). If you do not specify a language, the reviews will be displayed in the original language.'];
$GLOBALS['TL_LANG']['tl_module']['w3s_reviews_no_translations'] = ['Show reviews in the original language', 'Please select whether reviews should be displayed in the language used by the reviewer.'];
$GLOBALS['TL_LANG']['tl_module']['w3s_reviews_sort'] = ['Sorting ', 'Please choose the sorting of the reviews.'];
$GLOBALS['TL_LANG']['tl_module']['true'] = 'Yes';
$GLOBALS['TL_LANG']['tl_module']['false'] = 'No';
$GLOBALS['TL_LANG']['tl_module']['most_relevant'] = 'Relevant first (default)';
$GLOBALS['TL_LANG']['tl_module']['newest'] = 'Newest first';
$GLOBALS['TL_LANG']['tl_module']['w3s_reviews_link2gbp'] = ['Link to Google Maps Business Profile', 'Please enter the URL to your Google Maps Business profile.'];
$GLOBALS['TL_LANG']['tl_module']['w3s_reviews_new_review_link'] = ['Link to the "Write a review" form', 'Please enter the URL to the "New review" form.'];
Loading

0 comments on commit 0271529

Please sign in to comment.