From b1d3d540bbc9025e71e83d8a0464782b82b450ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carsten=20G=C3=B6tzinger?= Date: Wed, 14 Feb 2018 08:30:39 +0100 Subject: [PATCH] Umstellung auf Contao 4 Bundle --- composer.json | 55 ++- config/autoload.ini | 7 - config/autoload.php | 73 --- public/php/rateit-ajax.php | 139 ------ src/CgoITRateItBundle.php | 14 + src/ContaoManagerPlugin.php | 28 ++ .../Resources/contao/classes}/DcaHelper.php | 0 .../Resources/contao/classes/RateIt.php | 48 +- .../contao/classes}/RateItArticle.php | 72 +-- .../contao/classes}/RateItBackend.php | 8 +- .../contao/classes}/RateItBackendModule.php | 16 +- .../Resources/contao/classes}/RateItCE.php | 0 .../Resources/contao/classes}/RateItFaq.php | 80 ++-- .../contao/classes}/RateItFrontend.php | 0 .../contao/classes}/RateItHybrid.php | 10 +- .../contao/classes}/RateItModule.php | 0 .../Resources/contao/classes}/RateItNews.php | 10 +- .../Resources/contao/classes}/RateItPage.php | 42 +- .../contao/classes}/RateItRating.php | 0 .../classes}/RateItTopRatingsModule.php | 10 +- .../classes}/extern/simple_html_dom.php | 0 .../Resources/contao/config}/config.php | 18 +- .../Resources/contao/config}/runonce.php | 0 .../Resources/contao/dca}/tl_article.php | 0 .../Resources/contao/dca}/tl_content.php | 0 {dca => src/Resources/contao/dca}/tl_faq.php | 0 .../Resources/contao/dca}/tl_module.php | 0 {dca => src/Resources/contao/dca}/tl_news.php | 0 {dca => src/Resources/contao/dca}/tl_page.php | 0 .../Resources/contao/dca}/tl_rateit_items.php | 0 .../contao/dca}/tl_rateit_ratings.php | 0 .../Resources/contao/dca}/tl_settings.php | 18 - .../contao/languages}/de/default.xlf | 0 .../contao/languages}/de/modules.xlf | 0 .../contao/languages}/de/rateit_backend.xlf | 0 .../contao/languages}/de/tl_article.xlf | 0 .../contao/languages}/de/tl_content.xlf | 0 .../Resources/contao/languages}/de/tl_faq.xlf | 0 .../contao/languages}/de/tl_module.xlf | 0 .../contao/languages}/de/tl_news.xlf | 0 .../contao/languages}/de/tl_page.xlf | 0 .../contao/languages}/de/tl_settings.xlf | 0 .../contao/languages}/en/default.xlf | 0 .../contao/languages}/en/modules.xlf | 0 .../contao/languages}/en/rateit_backend.xlf | 0 .../contao/languages}/en/tl_article.xlf | 0 .../contao/languages}/en/tl_content.xlf | 0 .../Resources/contao/languages}/en/tl_faq.xlf | 0 .../contao/languages}/en/tl_module.xlf | 0 .../contao/languages}/en/tl_news.xlf | 0 .../contao/languages}/en/tl_page.xlf | 0 .../contao/languages}/en/tl_settings.xlf | 0 .../templates}/article_rateit_default.html5 | 0 .../templates}/article_rateit_default.xhtml | 0 .../article_rateit_default_microdata.html5 | 0 .../article_rateit_default_microdata.xhtml | 0 .../templates}/gallery_rateit_default.html5 | 0 .../templates}/gallery_rateit_default.xhtml | 0 .../contao/templates}/j_colorbox_rateit.html5 | 2 +- .../contao/templates}/j_colorbox_rateit.xhtml | 2 +- .../templates}/mod_article_list_rateit.html5 | 0 .../templates}/mod_article_list_rateit.xhtml | 0 ...icle_rateit_default_microdata_teaser.html5 | 0 ...icle_rateit_default_microdata_teaser.xhtml | 0 .../mod_article_rateit_default_teaser.html5 | 0 .../mod_article_rateit_default_teaser.xhtml | 0 .../templates}/mod_rateit_top_ratings.html5 | 0 .../templates}/mod_rateit_top_ratings.xhtml | 0 .../templates}/moo_mediabox_rateit.html5 | 2 +- .../templates}/moo_mediabox_rateit.xhtml | 2 +- .../contao/templates}/news_full_rateit.html5 | 0 .../contao/templates}/news_full_rateit.xhtml | 0 .../news_full_rateit_microdata.html5 | 0 .../news_full_rateit_microdata.xhtml | 0 .../templates}/news_latest_rateit.html5 | 0 .../templates}/news_latest_rateit.xhtml | 0 .../news_latest_rateit_microdata.html5 | 0 .../news_latest_rateit_microdata.xhtml | 0 .../contao/templates}/news_short_rateit.html5 | 0 .../contao/templates}/news_short_rateit.xhtml | 0 .../news_short_rateit_microdata.html5 | 0 .../news_short_rateit_microdata.xhtml | 0 .../templates}/news_simple_rateit.html5 | 0 .../templates}/news_simple_rateit.xhtml | 0 .../news_simple_rateit_microdata.html5 | 0 .../news_simple_rateit_microdata.xhtml | 0 .../contao/templates}/rateit_default.html5 | 0 .../contao/templates}/rateit_default.xhtml | 0 .../contao/templates}/rateit_microdata.html5 | 0 .../contao/templates}/rateit_microdata.xhtml | 0 .../templates}/rateitbe_ratinglist.html5 | 0 .../templates}/rateitbe_ratingview.html5 | 0 {public => src/Resources/public}/.htaccess | 0 .../Resources/public}/css/backend.css | 0 .../Resources/public}/css/heart.css | 0 .../Resources/public}/css/heart.min.css | 0 .../Resources/public}/css/rateit.css | 0 .../Resources/public}/css/rateit.min.css | 0 {public => src/Resources/public}/css/star.css | 0 .../Resources/public}/css/star.min.css | 0 .../Resources/public}/images/ajax-loading.gif | Bin .../Resources/public}/images/article.gif | Bin .../Resources/public}/images/exportEXCEL.gif | Bin .../Resources/public}/images/heart.gif | Bin .../Resources/public}/images/icon.png | Bin .../Resources/public}/images/info.gif | Bin .../Resources/public}/images/page.gif | Bin .../Resources/public}/images/star.gif | Bin .../Resources/public}/js/RateItBackend.js | 0 {public => src/Resources/public}/js/helper.js | 0 .../Resources/public}/js/helper.min.js | 0 .../public}/js/jquery-ui-effects.custom.js | 0 .../js/jquery-ui-effects.custom.min.js | 0 .../js/jquery/colorbox/colorbox-rateit.js | 0 .../js/jquery/colorbox/colorbox-rateit.min.js | 0 .../mediabox/mediabox-rateit-uncompressed.js | 0 .../js/mootools/mediabox/mediabox-rateit.js | 0 .../public}/js/onReadyRateIt-uncompressed.js | 0 .../Resources/public}/js/onReadyRateIt.js | 0 .../public}/js/rateit-uncompressed.js | 8 +- {public => src/Resources/public}/js/rateit.js | 4 +- vendor/autoload.php | 7 + vendor/composer/ClassLoader.php | 445 ++++++++++++++++++ vendor/composer/LICENSE | 21 + vendor/composer/autoload_classmap.php | 9 + vendor/composer/autoload_namespaces.php | 9 + vendor/composer/autoload_psr4.php | 9 + vendor/composer/autoload_real.php | 52 ++ vendor/composer/autoload_static.php | 15 + 129 files changed, 812 insertions(+), 423 deletions(-) delete mode 100644 config/autoload.ini delete mode 100644 config/autoload.php delete mode 100644 public/php/rateit-ajax.php create mode 100644 src/CgoITRateItBundle.php create mode 100644 src/ContaoManagerPlugin.php rename {classes => src/Resources/contao/classes}/DcaHelper.php (100%) rename public/php/rateit.php => src/Resources/contao/classes/RateIt.php (95%) rename {classes => src/Resources/contao/classes}/RateItArticle.php (86%) rename {classes => src/Resources/contao/classes}/RateItBackend.php (95%) rename {classes => src/Resources/contao/classes}/RateItBackendModule.php (99%) rename {classes => src/Resources/contao/classes}/RateItCE.php (100%) rename {classes => src/Resources/contao/classes}/RateItFaq.php (84%) rename {classes => src/Resources/contao/classes}/RateItFrontend.php (100%) rename {classes => src/Resources/contao/classes}/RateItHybrid.php (88%) rename {classes => src/Resources/contao/classes}/RateItModule.php (100%) rename {classes => src/Resources/contao/classes}/RateItNews.php (85%) rename {classes => src/Resources/contao/classes}/RateItPage.php (80%) rename {classes => src/Resources/contao/classes}/RateItRating.php (100%) rename {classes => src/Resources/contao/classes}/RateItTopRatingsModule.php (93%) rename {classes => src/Resources/contao/classes}/extern/simple_html_dom.php (100%) rename {config => src/Resources/contao/config}/config.php (63%) rename {config => src/Resources/contao/config}/runonce.php (100%) rename {dca => src/Resources/contao/dca}/tl_article.php (100%) rename {dca => src/Resources/contao/dca}/tl_content.php (100%) rename {dca => src/Resources/contao/dca}/tl_faq.php (100%) rename {dca => src/Resources/contao/dca}/tl_module.php (100%) rename {dca => src/Resources/contao/dca}/tl_news.php (100%) rename {dca => src/Resources/contao/dca}/tl_page.php (100%) rename {dca => src/Resources/contao/dca}/tl_rateit_items.php (100%) rename {dca => src/Resources/contao/dca}/tl_rateit_ratings.php (100%) rename {dca => src/Resources/contao/dca}/tl_settings.php (90%) rename {languages => src/Resources/contao/languages}/de/default.xlf (100%) rename {languages => src/Resources/contao/languages}/de/modules.xlf (100%) rename {languages => src/Resources/contao/languages}/de/rateit_backend.xlf (100%) rename {languages => src/Resources/contao/languages}/de/tl_article.xlf (100%) rename {languages => src/Resources/contao/languages}/de/tl_content.xlf (100%) rename {languages => src/Resources/contao/languages}/de/tl_faq.xlf (100%) rename {languages => src/Resources/contao/languages}/de/tl_module.xlf (100%) rename {languages => src/Resources/contao/languages}/de/tl_news.xlf (100%) rename {languages => src/Resources/contao/languages}/de/tl_page.xlf (100%) rename {languages => src/Resources/contao/languages}/de/tl_settings.xlf (100%) rename {languages => src/Resources/contao/languages}/en/default.xlf (100%) rename {languages => src/Resources/contao/languages}/en/modules.xlf (100%) rename {languages => src/Resources/contao/languages}/en/rateit_backend.xlf (100%) rename {languages => src/Resources/contao/languages}/en/tl_article.xlf (100%) rename {languages => src/Resources/contao/languages}/en/tl_content.xlf (100%) rename {languages => src/Resources/contao/languages}/en/tl_faq.xlf (100%) rename {languages => src/Resources/contao/languages}/en/tl_module.xlf (100%) rename {languages => src/Resources/contao/languages}/en/tl_news.xlf (100%) rename {languages => src/Resources/contao/languages}/en/tl_page.xlf (100%) rename {languages => src/Resources/contao/languages}/en/tl_settings.xlf (100%) rename {templates => src/Resources/contao/templates}/article_rateit_default.html5 (100%) rename {templates => src/Resources/contao/templates}/article_rateit_default.xhtml (100%) rename {templates => src/Resources/contao/templates}/article_rateit_default_microdata.html5 (100%) rename {templates => src/Resources/contao/templates}/article_rateit_default_microdata.xhtml (100%) rename {templates => src/Resources/contao/templates}/gallery_rateit_default.html5 (100%) rename {templates => src/Resources/contao/templates}/gallery_rateit_default.xhtml (100%) rename {templates => src/Resources/contao/templates}/j_colorbox_rateit.html5 (85%) rename {templates => src/Resources/contao/templates}/j_colorbox_rateit.xhtml (84%) rename {templates => src/Resources/contao/templates}/mod_article_list_rateit.html5 (100%) rename {templates => src/Resources/contao/templates}/mod_article_list_rateit.xhtml (100%) rename {templates => src/Resources/contao/templates}/mod_article_rateit_default_microdata_teaser.html5 (100%) rename {templates => src/Resources/contao/templates}/mod_article_rateit_default_microdata_teaser.xhtml (100%) rename {templates => src/Resources/contao/templates}/mod_article_rateit_default_teaser.html5 (100%) rename {templates => src/Resources/contao/templates}/mod_article_rateit_default_teaser.xhtml (100%) rename {templates => src/Resources/contao/templates}/mod_rateit_top_ratings.html5 (100%) rename {templates => src/Resources/contao/templates}/mod_rateit_top_ratings.xhtml (100%) rename {templates => src/Resources/contao/templates}/moo_mediabox_rateit.html5 (90%) rename {templates => src/Resources/contao/templates}/moo_mediabox_rateit.xhtml (90%) rename {templates => src/Resources/contao/templates}/news_full_rateit.html5 (100%) rename {templates => src/Resources/contao/templates}/news_full_rateit.xhtml (100%) rename {templates => src/Resources/contao/templates}/news_full_rateit_microdata.html5 (100%) rename {templates => src/Resources/contao/templates}/news_full_rateit_microdata.xhtml (100%) rename {templates => src/Resources/contao/templates}/news_latest_rateit.html5 (100%) rename {templates => src/Resources/contao/templates}/news_latest_rateit.xhtml (100%) rename {templates => src/Resources/contao/templates}/news_latest_rateit_microdata.html5 (100%) rename {templates => src/Resources/contao/templates}/news_latest_rateit_microdata.xhtml (100%) rename {templates => src/Resources/contao/templates}/news_short_rateit.html5 (100%) rename {templates => src/Resources/contao/templates}/news_short_rateit.xhtml (100%) rename {templates => src/Resources/contao/templates}/news_short_rateit_microdata.html5 (100%) rename {templates => src/Resources/contao/templates}/news_short_rateit_microdata.xhtml (100%) rename {templates => src/Resources/contao/templates}/news_simple_rateit.html5 (100%) rename {templates => src/Resources/contao/templates}/news_simple_rateit.xhtml (100%) rename {templates => src/Resources/contao/templates}/news_simple_rateit_microdata.html5 (100%) rename {templates => src/Resources/contao/templates}/news_simple_rateit_microdata.xhtml (100%) rename {templates => src/Resources/contao/templates}/rateit_default.html5 (100%) rename {templates => src/Resources/contao/templates}/rateit_default.xhtml (100%) rename {templates => src/Resources/contao/templates}/rateit_microdata.html5 (100%) rename {templates => src/Resources/contao/templates}/rateit_microdata.xhtml (100%) rename {templates => src/Resources/contao/templates}/rateitbe_ratinglist.html5 (100%) rename {templates => src/Resources/contao/templates}/rateitbe_ratingview.html5 (100%) rename {public => src/Resources/public}/.htaccess (100%) rename {public => src/Resources/public}/css/backend.css (100%) rename {public => src/Resources/public}/css/heart.css (100%) rename {public => src/Resources/public}/css/heart.min.css (100%) rename {public => src/Resources/public}/css/rateit.css (100%) rename {public => src/Resources/public}/css/rateit.min.css (100%) rename {public => src/Resources/public}/css/star.css (100%) rename {public => src/Resources/public}/css/star.min.css (100%) rename {public => src/Resources/public}/images/ajax-loading.gif (100%) rename {public => src/Resources/public}/images/article.gif (100%) rename {public => src/Resources/public}/images/exportEXCEL.gif (100%) rename {public => src/Resources/public}/images/heart.gif (100%) rename {public => src/Resources/public}/images/icon.png (100%) rename {public => src/Resources/public}/images/info.gif (100%) rename {public => src/Resources/public}/images/page.gif (100%) rename {public => src/Resources/public}/images/star.gif (100%) rename {public => src/Resources/public}/js/RateItBackend.js (100%) rename {public => src/Resources/public}/js/helper.js (100%) rename {public => src/Resources/public}/js/helper.min.js (100%) rename {public => src/Resources/public}/js/jquery-ui-effects.custom.js (100%) rename {public => src/Resources/public}/js/jquery-ui-effects.custom.min.js (100%) rename {public => src/Resources/public}/js/jquery/colorbox/colorbox-rateit.js (100%) rename {public => src/Resources/public}/js/jquery/colorbox/colorbox-rateit.min.js (100%) rename {public => src/Resources/public}/js/mootools/mediabox/mediabox-rateit-uncompressed.js (100%) rename {public => src/Resources/public}/js/mootools/mediabox/mediabox-rateit.js (100%) rename {public => src/Resources/public}/js/onReadyRateIt-uncompressed.js (100%) rename {public => src/Resources/public}/js/onReadyRateIt.js (100%) rename {public => src/Resources/public}/js/rateit-uncompressed.js (98%) rename {public => src/Resources/public}/js/rateit.js (92%) create mode 100644 vendor/autoload.php create mode 100644 vendor/composer/ClassLoader.php create mode 100644 vendor/composer/LICENSE create mode 100644 vendor/composer/autoload_classmap.php create mode 100644 vendor/composer/autoload_namespaces.php create mode 100644 vendor/composer/autoload_psr4.php create mode 100644 vendor/composer/autoload_real.php create mode 100644 vendor/composer/autoload_static.php diff --git a/composer.json b/composer.json index f2dce99..14dc23c 100644 --- a/composer.json +++ b/composer.json @@ -1,8 +1,9 @@ { - "name":"cgo-it/rate-it", - "description":"RateIt extension for the Contao Open Source CMS", - "keywords":["contao", "rating", "rateit", "bewertung"], - "type":"contao-module", + "name":"cgo-it/contao-rate-it-bundle", + "description":"RateIt extension for the Contao Open Source CMS as contao 4 bundle", + "keywords":["contao", "rating", "rateit", "bewertung", "bundle"], + "type":"contao-bundle", + "homepage":"https://cgo-it.de", "license":"LGPL-3.0+", "authors":[ { @@ -13,34 +14,38 @@ } ], "support": { - "email": "info@cgo-it.de", "issues": "https://git.cgo-it.de/contao/rate-it/issues", "forum": "https://community.contao.org/de/showthread.php?38471-Rate-It", "source": "https://git.cgo-it.de/contao/rate-it.git" }, "require":{ - "php":">=5.6", - "contao/core":">=3.0||<5", - "contao-community-alliance/composer-plugin": "~2.0", - "cgo-it/xls_export":"^3.1" + "php":">=7.0", + "contao/core-bundle": "^4.4", + "cgo-it/xls-export-bundle": "^4.0", + "richardhj/contao-simple-ajax": "^1.3" }, - "replace": { - "cgo-it/rate-it": "<3.5.4" + "require-dev": { + "contao/manager-plugin": "^2.0" }, - "conflict": { - "contao/core": "<3.0" + "conflict": { + "contao/core": "*", + "contao/manager-plugin": "<2.0 || >=3.0", }, - "extra":{ - "contao": { - "sources":{ - "":"system/modules/rateit" - }, - "transifex":{ - "project": "rateit", - "prefix": "core-", - "languages_cto": "languages", - "languages_tx": "languages" - } - } + "autoload": { + "psr-4": { + "cgoIT\\rateit\\": "src/" + }, + "classmap": [ + "src/Resources/contao/" + ], + "exclude-from-classmap": [ + "src/Resources/contao/config/", + "src/Resources/contao/dca/", + "src/Resources/contao/languages/", + "src/Resources/contao/templates/" + ] + }, + "extra": { + "contao-manager-plugin": "cgoIT\\rateit\\ContaoManagerPlugin" } } diff --git a/config/autoload.ini b/config/autoload.ini deleted file mode 100644 index 56a51b1..0000000 --- a/config/autoload.ini +++ /dev/null @@ -1,7 +0,0 @@ - -;; -; Configure what you want the autoload creator to register -;; -register_namespaces = true -register_classes = true -register_templates = true diff --git a/config/autoload.php b/config/autoload.php deleted file mode 100644 index 2709287..0000000 --- a/config/autoload.php +++ /dev/null @@ -1,73 +0,0 @@ - 'system/modules/rateit/classes/DcaHelper.php', - 'cgoIT\rateit\RateItArticle' => 'system/modules/rateit/classes/RateItArticle.php', - 'cgoIT\rateit\RateItBackend' => 'system/modules/rateit/classes/RateItBackend.php', - 'cgoIT\rateit\RateItCE' => 'system/modules/rateit/classes/RateItCE.php', - 'cgoIT\rateit\RateItFaq' => 'system/modules/rateit/classes/RateItFaq.php', - 'cgoIT\rateit\RateItFrontend' => 'system/modules/rateit/classes/RateItFrontend.php', - 'cgoIT\rateit\RateItHybrid' => 'system/modules/rateit/classes/RateItHybrid.php', - 'cgoIT\rateit\RateItModule' => 'system/modules/rateit/classes/RateItModule.php', - 'cgoIT\rateit\RateItNews' => 'system/modules/rateit/classes/RateItNews.php', - 'cgoIT\rateit\RateItPage' => 'system/modules/rateit/classes/RateItPage.php', - 'cgoIT\rateit\RateItRating' => 'system/modules/rateit/classes/RateItRating.php', - 'cgoIT\rateit\RateItBackendModule' => 'system/modules/rateit/classes/RateItBackendModule.php', - 'cgoIT\rateit\RateItTopRatingsModule' => 'system/modules/rateit/classes/RateItTopRatingsModule.php', - 'cgoIT\rateit\RateIt' => 'system/modules/rateit/public/php/rateit.php', - 'simple_html_dom' => 'system/modules/rateit/classes/extern/simple_html_dom.php', -)); - - -/** - * Register the templates - */ -TemplateLoader::addFiles(array -( - 'article_rateit_default' => 'system/modules/rateit/templates', - 'article_rateit_default_microdata' => 'system/modules/rateit/templates', - 'gallery_rateit_default' => 'system/modules/rateit/templates', - 'j_colorbox_rateit' => 'system/modules/rateit/templates', - 'mod_article_list_rateit' => 'system/modules/rateit/templates', - 'mod_article_rateit_default_microdata_teaser' => 'system/modules/rateit/templates', - 'mod_article_rateit_default_teaser' => 'system/modules/rateit/templates', - 'mod_rateit_top_ratings' => 'system/modules/rateit/templates', - 'moo_mediabox_rateit' => 'system/modules/rateit/templates', - 'news_full_rateit' => 'system/modules/rateit/templates', - 'news_full_rateit_microdata' => 'system/modules/rateit/templates', - 'news_latest_rateit' => 'system/modules/rateit/templates', - 'news_latest_rateit_microdata' => 'system/modules/rateit/templates', - 'news_short_rateit' => 'system/modules/rateit/templates', - 'news_short_rateit_microdata' => 'system/modules/rateit/templates', - 'news_simple_rateit' => 'system/modules/rateit/templates', - 'news_simple_rateit_microdata' => 'system/modules/rateit/templates', - 'rateitbe_ratinglist' => 'system/modules/rateit/templates', - 'rateitbe_ratingview' => 'system/modules/rateit/templates', - 'rateit_default' => 'system/modules/rateit/templates', - 'rateit_microdata' => 'system/modules/rateit/templates', -)); diff --git a/public/php/rateit-ajax.php b/public/php/rateit-ajax.php deleted file mode 100644 index 6936e0e..0000000 --- a/public/php/rateit-ajax.php +++ /dev/null @@ -1,139 +0,0 @@ -. - * - * PHP version 5 - * @copyright Leo Unglaub 2012 - * @author Leo Unglaub - * @package simple_ajax - * @license LGPL - */ - - -// simple trick for Contao < 2.10 -$arrPost = $_POST; -unset($_POST); - - -// inizialize the contao framework -define('TL_MODE', 'FE'); -require('../../../../initialize.php'); - - -// write the post data back into the array -$_POST = $arrPost; - - -/** - * Class RateitAjax - * Contain methods to catch ajax requests and send responses back to the client. - * - * Description - * ``````````` - * - * The usage of the RateitAjax extensions is very easy. The extension provides - * the hook $GLOBALS['TL_HOOKS']['rateitAjax'] for extension developers. You - * simply have to register your class/method and the extension will call - * your class if there is an incomming ajax request. - * - * You simply have to deside if it's an ajax request for your module and return - * the data you want. - * - * There are a few thinks you should know about the extension: - * * YOU have the full controll over the response. That also means - * that you have to set the correct header. - * * YOU have to terminate the request after you have send the response. - * * If the ajax request is not for your method you simply have nothing to - * * return. - * - * - * Usage - * ````` - * // config.php - * $GLOBALS['TL_HOOKS']['rateitAjax'][] = array('MyClass', 'myMethod'); - * - * // MyClass.php - * class MyClass extends System - * { - * public function myMethod() - * { - * if ($this->Input->get('acid') == 'myrequest') - * { - * $arrReturn = array('foo', 'bar', 'foobar'); - * - * header('Content-Type: application/json'); - * echo json_encode($arrReturn); - * exit; - * } - * } - * } - */ -class RateitAjax extends Controller -{ - /** - * Call the parent constructor. - * - * !!! DON'T REMOVE THIS !!! - * - * If you remove this you get the following error message: - * Fatal error: Call to protected System::__construct() from invalid - * context - * - * @param void - * @return void - */ - public function __construct() - { - parent::__construct(); - } - - - /** - * Get the ajax request and call all hooks - * - * @param void - * @return void - */ - public function run() - { - // check if a hook is registered - if (is_array($GLOBALS['TL_HOOKS']['rateitAjax']) && count($GLOBALS['TL_HOOKS']['rateitAjax']) > 0) - { - // execute every registered callback - foreach ($GLOBALS['TL_HOOKS']['rateitAjax'] as $callback) - { - $this->import($callback[0]); - $this->{$callback[0]}->{$callback[1]}(); - } - } - - // if there is no other output, we generate a 412 error response - header('HTTP/1.1 412 Precondition Failed'); - die('Rateit Ajax: Invalid AJAX call.'); - } -} - - -// create a rateit-ajax instance and run it -$objRateitAjax = new RateitAjax(); -$objRateitAjax->run(); - -?> diff --git a/src/CgoITRateItBundle.php b/src/CgoITRateItBundle.php new file mode 100644 index 0000000..f168ee8 --- /dev/null +++ b/src/CgoITRateItBundle.php @@ -0,0 +1,14 @@ +setLoadAfter([ContaoCoreBundle::class]) + ->setReplace(['rate-it']), + ]; + } +} diff --git a/classes/DcaHelper.php b/src/Resources/contao/classes/DcaHelper.php similarity index 100% rename from classes/DcaHelper.php rename to src/Resources/contao/classes/DcaHelper.php diff --git a/public/php/rateit.php b/src/Resources/contao/classes/RateIt.php similarity index 95% rename from public/php/rateit.php rename to src/Resources/contao/classes/RateIt.php index 23eb09b..934ed34 100644 --- a/public/php/rateit.php +++ b/src/Resources/contao/classes/RateIt.php @@ -30,18 +30,23 @@ namespace cgoIT\rateit; +use cgoIT\rateit\RateItFrontend; + define(RETURN_AJAX_HEADER, 'Content-Type: text/html'); -class RateIt extends \Frontend { - +class RateIt extends \Frontend { + var $allowDuplicates = false; - + var $rateItFrontend; + /** * Initialize the controller */ public function __construct() { parent::__construct(); + $this->rateItFrontend = new RateItFrontend(); + $this->loadLanguageFile('default'); $this->allowDuplicates = $GLOBALS['TL_CONFIG']['rating_allow_duplicate_ratings']; $this->allowDuplicatesForMembers = $GLOBALS['TL_CONFIG']['rating_allow_duplicate_ratings_for_members']; @@ -57,17 +62,17 @@ class RateIt extends \Frontend { * such, it unitlizes the die() function to display its errors. THIS * WOULD BE A VERY BAD FUNCTION TO CALL FROM WITHIN ANOTHER PAGE. * - * @param integer id - The id of key to register a rating for. + * @param integer id - The id of key to register a rating for. * @param integer percent - The rating in percentages. */ function doVote() { if ($this->Input->get('do') == 'rateit') { $ip = $_SERVER['REMOTE_ADDR']; - + $rkey = $this->Input->post('id'); $percent = $this->Input->post('vote'); $type = $this->Input->post('type'); - + //Make sure that the ratable ID is a number and not something crazy. if (strstr($rkey, '|')) { $arrRkey = explode('|', $rkey); @@ -78,7 +83,7 @@ class RateIt extends \Frontend { exit; } $id = $rkey; - } + } } else { if (is_numeric($rkey)) { $id = $rkey; @@ -88,7 +93,7 @@ class RateIt extends \Frontend { exit; } } - + //Make sure the percent is a number and under 100. if (is_numeric($percent) && $percent < 101) { $rating = $percent; @@ -97,32 +102,32 @@ class RateIt extends \Frontend { echo $GLOBALS['TL_LANG']['rateit']['error']['invalid_rating']; exit; } - + //Make sure that the ratable type is 'page' or 'ce' or 'module' if (!($type === 'page' || $type === 'article' || $type === 'ce' || $type === 'module' || $type === 'news' || $type === 'faq' || $type === 'galpic' || $type === 'news4ward')) { header(RETURN_AJAX_HEADER); echo $GLOBALS['TL_LANG']['rateit']['error']['invalid_type']; exit; } - + $strHash = sha1(session_id() . (!$GLOBALS['TL_CONFIG']['disableIpCheck'] ? \Environment::get('ip') : '') . 'FE_USER_AUTH'); - + // FrontendUser auslesen if (FE_USER_LOGGED_IN) { $objUser = $this->Database->prepare("SELECT pid FROM tl_session WHERE hash=?") ->limit(1) ->execute($strHash); - + if ($objUser->numRows) { $userId = $objUser->pid; } } - - + + $ratableKeyId = $this->Database->prepare('SELECT id FROM tl_rateit_items WHERE rkey=? and typ=?') ->execute($id, $type) ->fetchAssoc(); - + $canVote = false; if (isset($userId)) { $countUser = $this->Database->prepare('SELECT * FROM tl_rateit_ratings WHERE pid=? and memberid=?') @@ -132,7 +137,7 @@ class RateIt extends \Frontend { $countIp = $this->Database->prepare('SELECT * FROM tl_rateit_ratings WHERE pid=? and ip_address=?') ->execute($ratableKeyId['id'], $ip) ->count(); - + // Die with an error if the insert fails (duplicate IP or duplicate member id for a vote). if ((!$this->allowDuplicatesForMembers && (isset($countUser) ? $countUser == 0 : false)) || ($this->allowDuplicatesForMembers && isset($userId))) { // Insert the data. @@ -163,15 +168,14 @@ class RateIt extends \Frontend { echo $GLOBALS['TL_LANG']['rateit']['error']['duplicate_vote']; exit; } - - $this->import('rateit\\RateItFrontend', 'RateItFrontend'); - $rating = $this->RateItFrontend->loadRating($id, $type); - + + $rating = $this->rateItFrontend->loadRating($id, $type); + header(RETURN_AJAX_HEADER); - echo $this->RateItFrontend->getStarMessage($rating); + echo $this->rateItFrontend->getStarMessage($rating); exit; } } } -?> \ No newline at end of file +?> diff --git a/classes/RateItArticle.php b/src/Resources/contao/classes/RateItArticle.php similarity index 86% rename from classes/RateItArticle.php rename to src/Resources/contao/classes/RateItArticle.php index 647c588..a0e49a7 100644 --- a/classes/RateItArticle.php +++ b/src/Resources/contao/classes/RateItArticle.php @@ -90,15 +90,15 @@ class RateItArticle extends RateItFrontend { $objTemplate->rateit_rating_after = true; } - $GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/rateit/public/js/onReadyRateIt.js|static'; - $GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/rateit/public/js/rateit.js|static'; - $GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/rateit.min.css||static'; + $GLOBALS['TL_JAVASCRIPT'][] = 'bundles/cgoitrateit/public/js/onReadyRateIt.js|static'; + $GLOBALS['TL_JAVASCRIPT'][] = 'bundles/cgoitrateit/public/js/rateit.js|static'; + $GLOBALS['TL_CSS'][] = 'bundles/cgoitrateit/public/css/rateit.min.css||static'; switch ($GLOBALS['TL_CONFIG']['rating_type']) { case 'hearts' : - $GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/heart.min.css||static'; + $GLOBALS['TL_CSS'][] = 'bundles/cgoitrateit/public/css/heart.min.css||static'; break; default: - $GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/star.min.css||static'; + $GLOBALS['TL_CSS'][] = 'bundles/cgoitrateit/public/css/star.min.css||static'; } } @@ -114,7 +114,7 @@ class RateItArticle extends RateItFrontend { ->limit(1) ->execute($article['articleId']) ->fetchAssoc(); - + if ($arrArticle['addRating']) { if (!$bolTemplateFixed) { $objTemplate->setName($objTemplate->getName().'_rateit'); @@ -125,7 +125,7 @@ class RateItArticle extends RateItFrontend { $rating = $this->loadRating($ratingId, 'article'); $stars = !$rating ? 0 : $this->percentToStars($rating['rating']); $percent = round($rating['rating'], 0)."%"; - + $article['descriptionId'] = 'rateItRating-'.$ratingId.'-description'; $article['description'] = $this->getStarMessage($rating); $article['rateItID'] = 'rateItRating-'.$ratingId.'-article-'.$stars.'_'.$this->intStars; @@ -134,32 +134,32 @@ class RateItArticle extends RateItFrontend { $article['actRating'] = $this->percentToStars($rating['rating']); $article['maxRating'] = $this->intStars; $article['votes'] = $rating[totalRatings]; - + if ($this->strTextPosition == "before") { $article['showBefore'] = true; } else if ($this->strTextPosition == "after") { $article['showAfter'] = true; } - + if ($arrArticle['rateit_position'] == 'before') { $article['rateit_rating_before'] = true; } else if ($arrArticle['rateit_position'] == 'after') { $article['rateit_rating_after'] = true; } - - $GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/rateit/public/js/onReadyRateIt.js|static'; - $GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/rateit/public/js/rateit.js|static'; - $GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/rateit.min.css||static'; + + $GLOBALS['TL_JAVASCRIPT'][] = 'bundles/cgoitrateit/public/js/onReadyRateIt.js|static'; + $GLOBALS['TL_JAVASCRIPT'][] = 'bundles/cgoitrateit/public/js/rateit.js|static'; + $GLOBALS['TL_CSS'][] = 'bundles/cgoitrateit/public/css/rateit.min.css||static'; switch ($GLOBALS['TL_CONFIG']['rating_type']) { case 'hearts' : - $GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/heart.min.css||static'; + $GLOBALS['TL_CSS'][] = 'bundles/cgoitrateit/public/css/heart.min.css||static'; break; default: - $GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/star.min.css||static'; + $GLOBALS['TL_CSS'][] = 'bundles/cgoitrateit/public/css/star.min.css||static'; } } - + $arrArticles[] = $article; } $objTemplate->articles = $arrArticles; @@ -172,10 +172,10 @@ class RateItArticle extends RateItFrontend { ->limit(1) ->execute($objTemplate->id) ->fetchAssoc(); - + if ($arrGallery['rateit_active']) { $arrRating = array(); - + if (version_compare(VERSION, '3.2', '>=')) { $objFiles = \FilesModel::findMultipleByUuids(deserialize($arrGallery['multiSRC'])); } else { @@ -185,19 +185,19 @@ class RateItArticle extends RateItFrontend { if ($objFiles !== null) { // Get all images while ($objFiles->next()) { - // Continue if the files has been processed or does not exist + // Continue if the files has been processed or does not exist if (isset($arrRating[$objFiles->path]) || !file_exists(TL_ROOT . '/' . $objFiles->path)) { continue; } - + // Single files if ($objFiles->type == 'file') { $objFile = new \File($objFiles->path, true); - + if (!$objFile->isGdImage) { continue; } - + $this->addRatingForImage($arrRating, $arrGallery['id'], $objFiles->id, $objFile->path); } // Folders @@ -207,23 +207,23 @@ class RateItArticle extends RateItFrontend { } else { $objSubfiles = \FilesModel::findByPid($objFiles->id); } - + if ($objSubfiles === null) { continue; } - + while ($objSubfiles->next()) { // Skip subfolders if ($objSubfiles->type == 'folder') { continue; } - + $objFile = new \File($objSubfiles->path, true); - + if (!$objFile->isGdImage) { continue; } - + $this->addRatingForImage($arrRating, $arrGallery['id'], $objSubfiles->id, $objSubfiles->path); } } @@ -232,27 +232,27 @@ class RateItArticle extends RateItFrontend { $objTemplate->arrRating = $arrRating; - $GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/rateit/public/js/onReadyRateIt.js|static'; - $GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/rateit/public/js/rateit.js|static'; - $GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/rateit.min.css||static'; + $GLOBALS['TL_JAVASCRIPT'][] = 'bundles/cgoitrateit/public/js/onReadyRateIt.js|static'; + $GLOBALS['TL_JAVASCRIPT'][] = 'bundles/cgoitrateit/public/js/rateit.js|static'; + $GLOBALS['TL_CSS'][] = 'bundles/cgoitrateit/public/css/rateit.min.css||static'; switch ($GLOBALS['TL_CONFIG']['rating_type']) { case 'hearts' : - $GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/heart.min.css||static'; + $GLOBALS['TL_CSS'][] = 'bundles/cgoitrateit/public/css/heart.min.css||static'; break; default: - $GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/star.min.css||static'; + $GLOBALS['TL_CSS'][] = 'bundles/cgoitrateit/public/css/star.min.css||static'; } } return $objTemplate; } - + private function addRatingForImage(&$arrRating, $galleryId, $picId, $picPath) { $ratingId = $galleryId.'|'.$picId; $rating = $this->loadRating($ratingId, 'galpic'); $stars = !$rating ? 0 : $this->percentToStars($rating['rating']); $percent = round($rating['rating'], 0)."%"; - + $arrRating[$picPath] = array(); $arrRating[$picPath]['descriptionId'] = 'rateItRating-'.$ratingId.'-description'; $arrRating[$picPath]['description'] = $this->getStarMessage($rating); @@ -262,7 +262,7 @@ class RateItArticle extends RateItFrontend { $arrRating[$picPath]['actRating'] = $this->percentToStars($rating['rating']); $arrRating[$picPath]['maxRating'] = $this->intStars; $arrRating[$picPath]['votes'] = $rating[totalRatings]; - + if ($this->strTextPosition == "before") { $arrRating[$picPath]['showBefore'] = true; } @@ -271,4 +271,4 @@ class RateItArticle extends RateItFrontend { } } } -?> \ No newline at end of file +?> diff --git a/classes/RateItBackend.php b/src/Resources/contao/classes/RateItBackend.php similarity index 95% rename from classes/RateItBackend.php rename to src/Resources/contao/classes/RateItBackend.php index 3f2886f..b7f43f7 100644 --- a/classes/RateItBackend.php +++ b/src/Resources/contao/classes/RateItBackend.php @@ -32,7 +32,7 @@ namespace cgoIT\rateit; class RateItBackend { - const path = 'system/modules/rateit/'; + const path = 'bundles/cgoitrateit/'; /** * Get a css file. @@ -41,7 +41,7 @@ class RateItBackend */ public static function css($file) { - return self::path.'public/css/'. $file.'.css'; + return self::path.'css/'. $file.'.css'; } // file /** @@ -51,7 +51,7 @@ class RateItBackend */ public static function js($file) { - return self::path.'public/js/'. $file.'.js'; + return self::path.'js/'. $file.'.js'; } // file /** @@ -61,7 +61,7 @@ class RateItBackend */ public static function image($file) { - $url = self::path.'public/images/'; + $url = self::path.'images/'; if (is_file(TL_ROOT.'/'.$url.$file.'.png')) return $url.$file.'.png'; if (is_file(TL_ROOT.'/'.$url.$file.'.gif')) return $url.$file.'.gif'; return $url.'default.png'; diff --git a/classes/RateItBackendModule.php b/src/Resources/contao/classes/RateItBackendModule.php similarity index 99% rename from classes/RateItBackendModule.php rename to src/Resources/contao/classes/RateItBackendModule.php index ac1ede6..7db7902 100644 --- a/classes/RateItBackendModule.php +++ b/src/Resources/contao/classes/RateItBackendModule.php @@ -235,7 +235,7 @@ class rateitBackendModule extends \BackendModule */ protected function exportRatings() { - $this->import('String'); + $this->import('StringUtil'); $rateit = &$this->Template->rateit; $options['order'] = 'rating desc'; @@ -264,11 +264,11 @@ class rateitBackendModule extends \BackendModule // Werte setzen foreach($rateit->ratingitems as $item) { $arrItem = (array)$item; - + $intColCounter = 0; foreach(array_keys($this->arrExportHeader) as $key) { $strVal = $arrItem[$key]; - $strVal = $this->String->decodeEntities($strVal); + $strVal = $this->StringUtil->decodeEntities($strVal); $strVal = preg_replace(array('//si'), array("\n"), $strVal); $strVal = $this->convertEncoding($strVal, $GLOBALS['TL_CONFIG']['characterSet'], 'CP1252'); @@ -299,7 +299,7 @@ class rateitBackendModule extends \BackendModule $xls->setcell(array("sheetname" => $strXlsSheet,"row" => $intRowCounter, "col" => $intColCounter, "data" => $strVal, "type" => $cellType, "vallign" => XLSXF_VALLIGN_TOP, "fontfamily" => XLSFONT_FAMILY_NORMAL)); $intColCounter++; } - + $intRowCounter++; } @@ -449,7 +449,7 @@ class rateitBackendModule extends \BackendModule 'typ' => $typ ); - $this->import('String'); + $this->import('StringUtil'); $rateit = &$this->Template->rateit; // query ratings @@ -480,11 +480,11 @@ class rateitBackendModule extends \BackendModule // Werte setzen foreach($ext->ratings as $item) { $arrItem = (array)$item; - + $intColCounter = 0; foreach(array_keys($this->arrExportHeaderDetails) as $key) { $strVal = $arrItem[$key]; - $strVal = $this->String->decodeEntities($strVal); + $strVal = $this->StringUtil->decodeEntities($strVal); $strVal = preg_replace(array('//si'), array("\n"), $strVal); $strVal = $this->convertEncoding($strVal, $GLOBALS['TL_CONFIG']['characterSet'], 'CP1252'); @@ -509,7 +509,7 @@ class rateitBackendModule extends \BackendModule $xls->setcell(array("sheetname" => $strXlsSheet,"row" => $intRowCounter, "col" => $intColCounter, "data" => $strVal, "type" => $cellType, "vallign" => XLSXF_VALLIGN_TOP, "fontfamily" => XLSFONT_FAMILY_NORMAL)); $intColCounter++; } - + $intRowCounter++; } diff --git a/classes/RateItCE.php b/src/Resources/contao/classes/RateItCE.php similarity index 100% rename from classes/RateItCE.php rename to src/Resources/contao/classes/RateItCE.php diff --git a/classes/RateItFaq.php b/src/Resources/contao/classes/RateItFaq.php similarity index 84% rename from classes/RateItFaq.php rename to src/Resources/contao/classes/RateItFaq.php index daa912e..2406c7c 100644 --- a/classes/RateItFaq.php +++ b/src/Resources/contao/classes/RateItFaq.php @@ -30,64 +30,69 @@ namespace cgoIT\rateit; -class RateItFaq extends RateItFrontend { - +use cgoIT\rateit\RateItRating; + +class RateItFaq extends RateItFrontend { + + var $rateItRating; + /** * Initialize the controller */ public function __construct() { parent::__construct(); + $this->rateItRating = new RateItRating(); } - + public function getContentElementRateIt($objRow, $strBuffer) { if ($objRow->type == 'module') { $objModule = $this->Database->prepare("SELECT * FROM tl_module WHERE id=? AND type IN ('faqpage', 'faqreader')") ->limit(1) ->execute($objRow->module); - + if ($objModule->numRows == 1) { $this->faq_categories = deserialize($objModule->faq_categories); - + if ($objModule->type == 'faqreader') { $strBuffer = $this->generateForFaqReader($objModule, $strBuffer); } else { $strBuffer = $this->generateForFaqPage($objModule, $strBuffer); } - - $GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/rateit/public/js/onReadyRateIt.js|static'; - $GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/rateit/public/js/rateit.js|static'; - $GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/rateit.min.css||static'; + + $GLOBALS['TL_JAVASCRIPT'][] = 'bundles/cgoitrateit/public/js/onReadyRateIt.js|static'; + $GLOBALS['TL_JAVASCRIPT'][] = 'bundles/cgoitrateit/public/js/rateit.js|static'; + $GLOBALS['TL_CSS'][] = 'bundles/cgoitrateit/public/css/rateit.min.css||static'; switch ($GLOBALS['TL_CONFIG']['rating_type']) { case 'hearts' : - $GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/heart.min.css||static'; + $GLOBALS['TL_CSS'][] = 'bundles/cgoitrateit/public/css/heart.min.css||static'; break; default: - $GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/star.min.css||static'; + $GLOBALS['TL_CSS'][] = 'bundles/cgoitrateit/public/css/star.min.css||static'; } } } return $strBuffer; } - + private function generateForFaqPage($objModule, $strBuffer) { $objFaq = $this->Database ->execute("SELECT *, author AS authorId, (SELECT headline FROM tl_faq_category WHERE tl_faq_category.id=tl_faq.pid) AS category, (SELECT name FROM tl_user WHERE tl_user.id=tl_faq.author) AS author FROM tl_faq WHERE pid IN(" . implode(',', array_map('intval', $this->faq_categories)) . ")" . (!BE_USER_LOGGED_IN ? " AND published=1" : "")); - + if ($objFaq->numRows < 1) { return $strBuffer; } - + $htmlBuffer = new \simple_html_dom(); $htmlBuffer->load($strBuffer); - + $arrFaqs = $objFaq->fetchAllAssoc(); foreach ($arrFaqs as $arrFaq) { $rating = $this->generateSingle($arrFaq, $strBuffer); - + $h3 = $htmlBuffer->find('#'.$arrFaq['alias']); - if (is_array($h3) && count($h3) == 1) { + if (is_array($h3) && count($h3) == 1) { $section = $h3[0]->parent(); - + if ($arrFaq['rateit_position'] == 'before') { $section->innertext = $rating.$section->innertext; } else if ($arrFaq['rateit_position'] == 'after') { @@ -95,37 +100,37 @@ class RateItFaq extends RateItFrontend { } } } - + $strBuffer = $htmlBuffer->save(); - + // Aufräumen $htmlBuffer->clear(); unset($htmlBuffer); - + return $strBuffer; } - + private function generateForFaqReader($objModule, $strBuffer) { // Set the item from the auto_item parameter if ($GLOBALS['TL_CONFIG']['useAutoItem'] && isset($_GET['auto_item'])) { $this->Input->setGet('items', $this->Input->get('auto_item')); } - + // Do not index or cache the page if no FAQ has been specified if (!$this->Input->get('items')) { return $strBuffer; } - + $objFaq = $this->Database->prepare("SELECT *, author AS authorId, (SELECT title FROM tl_faq_category WHERE tl_faq_category.id=tl_faq.pid) AS category, (SELECT name FROM tl_user WHERE tl_user.id=tl_faq.author) AS author FROM tl_faq WHERE pid IN(" . implode(',', array_map('intval', $this->faq_categories)) . ") AND (id=? OR alias=?)" . (!BE_USER_LOGGED_IN ? " AND published=1" : "")) ->limit(1) ->execute((is_numeric($this->Input->get('items')) ? $this->Input->get('items') : 0), $this->Input->get('items')); - + if ($objFaq->numRows == 1) { $arrFaq = $objFaq->fetchAssoc(); - + $rating = $this->generateSingle($arrFaq, $strBuffer); } - + if ($arrFaq['rateit_position'] == 'before') { $strBuffer = $rating.$strBuffer; } else if ($arrFaq['rateit_position'] == 'after') { @@ -134,26 +139,25 @@ class RateItFaq extends RateItFrontend { return $strBuffer; } - + private function generateSingle($arrFaq, $strBuffer) { $rating = ''; - + if ($arrFaq['addRating']) { $actRecord = $this->Database->prepare("SELECT * FROM tl_rateit_items WHERE rkey=? and typ='faq'") ->execute($arrFaq['id']) ->fetchAssoc(); - + if ($actRecord['active']) { - $this->import('rateit\\RateItRating', 'RateItRating'); - $this->RateItRating->rkey = $arrFaq['id']; - $this->RateItRating->ratingType = 'faq'; - $this->RateItRating->generate(); - - $rating = $this->RateItRating->output(); + $this->rateItRating->rkey = $arrFaq['id']; + $this->rateItRating->ratingType = 'faq'; + $this->rateItRating->generate(); + + $rating = $this->rateItRating->output(); } } - + return $rating; } } -?> \ No newline at end of file +?> diff --git a/classes/RateItFrontend.php b/src/Resources/contao/classes/RateItFrontend.php similarity index 100% rename from classes/RateItFrontend.php rename to src/Resources/contao/classes/RateItFrontend.php diff --git a/classes/RateItHybrid.php b/src/Resources/contao/classes/RateItHybrid.php similarity index 88% rename from classes/RateItHybrid.php rename to src/Resources/contao/classes/RateItHybrid.php index 5c5ae7b..d2582bf 100644 --- a/classes/RateItHybrid.php +++ b/src/Resources/contao/classes/RateItHybrid.php @@ -66,15 +66,15 @@ abstract class RateItHybrid extends RateItFrontend $this->strType = $GLOBALS['TL_CONFIG']['rating_type']; $this->strTextPosition = $GLOBALS['TL_CONFIG']['rating_textposition']; - $GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/rateit/public/js/onReadyRateIt.js|static'; - $GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/rateit/public/js/rateit.js|static'; - $GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/rateit.min.css||static'; + $GLOBALS['TL_JAVASCRIPT'][] = 'bundles/cgoitrateit/public/js/onReadyRateIt.js|static'; + $GLOBALS['TL_JAVASCRIPT'][] = 'bundles/cgoitrateit/public/js/rateit.js|static'; + $GLOBALS['TL_CSS'][] = 'bundles/cgoitrateit/public/css/rateit.min.css||static'; switch ($this->strType) { case 'hearts' : - $GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/heart.min.css||static'; + $GLOBALS['TL_CSS'][] = 'bundles/cgoitrateit/public/css/heart.min.css||static'; break; default: - $GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/star.min.css||static'; + $GLOBALS['TL_CSS'][] = 'bundles/cgoitrateit/public/css/star.min.css||static'; } return parent::generate(); diff --git a/classes/RateItModule.php b/src/Resources/contao/classes/RateItModule.php similarity index 100% rename from classes/RateItModule.php rename to src/Resources/contao/classes/RateItModule.php diff --git a/classes/RateItNews.php b/src/Resources/contao/classes/RateItNews.php similarity index 85% rename from classes/RateItNews.php rename to src/Resources/contao/classes/RateItNews.php index 0a616fe..bbd9b10 100644 --- a/classes/RateItNews.php +++ b/src/Resources/contao/classes/RateItNews.php @@ -69,15 +69,15 @@ class RateItNews extends RateItFrontend { $objTemplate->rateit_rating_after = true; } - $GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/rateit/public/js/onReadyRateIt.js|static'; - $GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/rateit/public/js/rateit.js|static'; - $GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/rateit.min.css||static'; + $GLOBALS['TL_JAVASCRIPT'][] = 'bundles/cgoitrateit/public/js/onReadyRateIt.js|static'; + $GLOBALS['TL_JAVASCRIPT'][] = 'bundles/cgoitrateit/public/js/rateit.js|static'; + $GLOBALS['TL_CSS'][] = 'bundles/cgoitrateit/public/css/rateit.min.css||static'; switch ($GLOBALS['TL_CONFIG']['rating_type']) { case 'hearts' : - $GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/heart.min.css||static'; + $GLOBALS['TL_CSS'][] = 'bundles/cgoitrateit/public/css/heart.min.css||static'; break; default: - $GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/star.min.css||static'; + $GLOBALS['TL_CSS'][] = 'bundles/cgoitrateit/public/css/star.min.css||static'; } } } diff --git a/classes/RateItPage.php b/src/Resources/contao/classes/RateItPage.php similarity index 80% rename from classes/RateItPage.php rename to src/Resources/contao/classes/RateItPage.php index 9961bf3..c1cbdbe 100644 --- a/classes/RateItPage.php +++ b/src/Resources/contao/classes/RateItPage.php @@ -29,32 +29,36 @@ namespace cgoIT\rateit; +use cgoIT\rateit\RateItRating; + class RateItPage extends \Frontend { - + + var $rateItRating; + /** * Initialize the controller */ public function __construct() { parent::__construct(); + $this->rateItRating = new RateItRating(); $this->loadDataContainer('settings'); } - + public function generatePage($objPage, $objLayout, $objPageType) { if ($objPage->addRating) { $actRecord = $this->Database->prepare("SELECT * FROM tl_rateit_items WHERE rkey=? and typ='page'") ->execute($objPage->id) ->fetchAssoc(); - + if ($actRecord['active']) { - $this->import('rateit\\RateItRating', 'RateItRating'); - $this->RateItRating->rkey = $objPage->id; - $this->RateItRating->generate(); - - $rating = $this->RateItRating->output(); + $this->rateItRating->rkey = $objPage->id; + $this->rateItRating->generate(); + + $rating = $this->rateItRating->output(); $rating .= $this->includeJs(); $rating .= $this->includeCss(); - + $objTemplate = $objPageType->Template; if ($objTemplate) { if ($objPage->rateit_position == 'after') { @@ -72,7 +76,7 @@ class RateItPage extends \Frontend { $strHeadTags = ''; if (is_array($GLOBALS['TL_CSS'])) { foreach ($GLOBALS['TL_CSS'] as $script) { - if ($this->startsWith($script, 'system/modules/rateit/public/css/rateit') === true) { + if ($this->startsWith($script, 'bundles/cgoitrateit/public/css/rateit') === true) { $included = true; break; } @@ -80,24 +84,24 @@ class RateItPage extends \Frontend { } if (!$included) { - $strHeadTags = ''; + $strHeadTags = ''; switch ($GLOBALS['TL_CONFIG']['rating_type']) { case 'hearts' : - $strHeadTags .= ''; + $strHeadTags .= ''; break; default: - $strHeadTags .= ''; + $strHeadTags .= ''; } } return $strHeadTags; } - + private function includeJs() { $included = false; $strHeadTags = ''; if (is_array($GLOBALS['TL_JAVASCRIPT'])) { foreach ($GLOBALS['TL_JAVASCRIPT'] as $script) { - if ($this->startsWith($script, 'system/modules/rateit/public/js/rateit') === true) { + if ($this->startsWith($script, 'bundles/cgoitrateit/public/js/rateit') === true) { $included = true; break; } @@ -105,15 +109,15 @@ class RateItPage extends \Frontend { } if (!$included) { - $strHeadTags = 'outputFormat == 'xhtml') ? ' type="text/javascript"' : '') . ' src="' . $this->addStaticUrlTo('system/modules/rateit/public/js/onReadyRateIt.js') . '">' . "\n"; - $strHeadTags .= 'outputFormat == 'xhtml') ? ' type="text/javascript"' : '') . ' src="' . $this->addStaticUrlTo('system/modules/rateit/public/js/rateit.js') . '">' . "\n"; + $strHeadTags = 'outputFormat == 'xhtml') ? ' type="text/javascript"' : '') . ' src="' . $this->addStaticUrlTo('bundles/cgoitrateit/public/js/onReadyRateIt.js') . '">' . "\n"; + $strHeadTags .= 'outputFormat == 'xhtml') ? ' type="text/javascript"' : '') . ' src="' . $this->addStaticUrlTo('bundles/cgoitrateit/public/js/rateit.js') . '">' . "\n"; } return $strHeadTags; } - + function startsWith($haystack, $needle) { // search backwards starting from haystack length characters from the end return $needle === "" || strrpos($haystack, $needle, -strlen($haystack)) !== FALSE; } } -?> \ No newline at end of file +?> diff --git a/classes/RateItRating.php b/src/Resources/contao/classes/RateItRating.php similarity index 100% rename from classes/RateItRating.php rename to src/Resources/contao/classes/RateItRating.php diff --git a/classes/RateItTopRatingsModule.php b/src/Resources/contao/classes/RateItTopRatingsModule.php similarity index 93% rename from classes/RateItTopRatingsModule.php rename to src/Resources/contao/classes/RateItTopRatingsModule.php index e8e619b..a315e21 100644 --- a/classes/RateItTopRatingsModule.php +++ b/src/Resources/contao/classes/RateItTopRatingsModule.php @@ -67,15 +67,15 @@ class RateItTopRatingsModule extends RateItFrontend $this->arrTypes = deserialize($this->rateit_types); - $GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/rateit/public/js/onReadyRateIt.js|static'; - $GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/rateit/public/js/rateit.js|static'; - $GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/rateit.min.css||static'; + $GLOBALS['TL_JAVASCRIPT'][] = 'bundles/cgoitrateit/public/js/onReadyRateIt.js|static'; + $GLOBALS['TL_JAVASCRIPT'][] = 'bundles/cgoitrateit/public/js/rateit.js|static'; + $GLOBALS['TL_CSS'][] = 'bundles/cgoitrateit/public/css/rateit.min.css||static'; switch ($GLOBALS['TL_CONFIG']['rating_type']) { case 'hearts' : - $GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/heart.min.css||static'; + $GLOBALS['TL_CSS'][] = 'bundles/cgoitrateit/public/css/heart.min.css||static'; break; default: - $GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/star.min.css||static'; + $GLOBALS['TL_CSS'][] = 'bundles/cgoitrateit/public/css/star.min.css||static'; } return parent::generate(); diff --git a/classes/extern/simple_html_dom.php b/src/Resources/contao/classes/extern/simple_html_dom.php similarity index 100% rename from classes/extern/simple_html_dom.php rename to src/Resources/contao/classes/extern/simple_html_dom.php diff --git a/config/config.php b/src/Resources/contao/config/config.php similarity index 63% rename from config/config.php rename to src/Resources/contao/config/config.php index a6cb5fb..f8344fb 100644 --- a/config/config.php +++ b/src/Resources/contao/config/config.php @@ -33,18 +33,18 @@ use cgoIT\rateit\RateItBackend; /** * Hooks */ -$GLOBALS['TL_HOOKS']['generatePage'][] = array('rateit\\RateItPage', 'generatePage'); -$GLOBALS['TL_HOOKS']['rateitAjax'][] = array('rateit\\RateIt', 'doVote'); -$GLOBALS['TL_HOOKS']['parseArticles'][] = array('rateit\\RateItNews', 'parseArticle'); -$GLOBALS['TL_HOOKS']['getContentElement'][] = array('rateit\\RateItFaq', 'getContentElementRateIt'); -$GLOBALS['TL_HOOKS']['parseTemplate'][] = array('rateit\\RateItArticle', 'parseTemplateRateIt'); +$GLOBALS['TL_HOOKS']['generatePage'][] = array('cgoIT\\rateit\\RateItPage', 'generatePage'); +$GLOBALS['TL_HOOKS']['simpleAjax'][] = array('cgoIT\\rateit\\RateIt', 'doVote'); +$GLOBALS['TL_HOOKS']['parseArticles'][] = array('cgoIT\\rateit\\RateItNews', 'parseArticle'); +$GLOBALS['TL_HOOKS']['getContentElement'][] = array('cgoIT\\rateit\\RateItFaq', 'getContentElementRateIt'); +$GLOBALS['TL_HOOKS']['parseTemplate'][] = array('cgoIT\\rateit\\RateItArticle', 'parseTemplateRateIt'); /** * Back end modules */ array_insert($GLOBALS['BE_MOD']['content'], count($GLOBALS['BE_MOD']['content']), array('rateit' => array ( - 'callback' => 'rateit\\RateItBackendModule', + 'callback' => 'cgoIT\\rateit\\RateItBackendModule', 'icon' => rateit\RateItBackend::image('icon'), 'stylesheet' => rateit\RateItBackend::css('backend'), 'javascript' => rateit\RateItBackend::js('RateItBackend') @@ -54,12 +54,12 @@ array_insert($GLOBALS['BE_MOD']['content'], count($GLOBALS['BE_MOD']['content']) /** * frontend moduls */ -$GLOBALS['FE_MOD']['application']['rateit'] = 'rateit\\RateItModule'; -$GLOBALS['FE_MOD']['application']['rateit_top_ratings'] = 'rateit\\RateItTopRatingsModule'; +$GLOBALS['FE_MOD']['application']['rateit'] = 'cgoIT\\rateit\\RateItModule'; +$GLOBALS['FE_MOD']['application']['rateit_top_ratings'] = 'cgoIT\\rateit\\RateItTopRatingsModule'; /** * content elements */ -$GLOBALS['TL_CTE']['includes']['rateit'] = 'rateit\\RateItCE'; +$GLOBALS['TL_CTE']['includes']['rateit'] = 'cgoIT\\rateit\\RateItCE'; ?> diff --git a/config/runonce.php b/src/Resources/contao/config/runonce.php similarity index 100% rename from config/runonce.php rename to src/Resources/contao/config/runonce.php diff --git a/dca/tl_article.php b/src/Resources/contao/dca/tl_article.php similarity index 100% rename from dca/tl_article.php rename to src/Resources/contao/dca/tl_article.php diff --git a/dca/tl_content.php b/src/Resources/contao/dca/tl_content.php similarity index 100% rename from dca/tl_content.php rename to src/Resources/contao/dca/tl_content.php diff --git a/dca/tl_faq.php b/src/Resources/contao/dca/tl_faq.php similarity index 100% rename from dca/tl_faq.php rename to src/Resources/contao/dca/tl_faq.php diff --git a/dca/tl_module.php b/src/Resources/contao/dca/tl_module.php similarity index 100% rename from dca/tl_module.php rename to src/Resources/contao/dca/tl_module.php diff --git a/dca/tl_news.php b/src/Resources/contao/dca/tl_news.php similarity index 100% rename from dca/tl_news.php rename to src/Resources/contao/dca/tl_news.php diff --git a/dca/tl_page.php b/src/Resources/contao/dca/tl_page.php similarity index 100% rename from dca/tl_page.php rename to src/Resources/contao/dca/tl_page.php diff --git a/dca/tl_rateit_items.php b/src/Resources/contao/dca/tl_rateit_items.php similarity index 100% rename from dca/tl_rateit_items.php rename to src/Resources/contao/dca/tl_rateit_items.php diff --git a/dca/tl_rateit_ratings.php b/src/Resources/contao/dca/tl_rateit_ratings.php similarity index 100% rename from dca/tl_rateit_ratings.php rename to src/Resources/contao/dca/tl_rateit_ratings.php diff --git a/dca/tl_settings.php b/src/Resources/contao/dca/tl_settings.php similarity index 90% rename from dca/tl_settings.php rename to src/Resources/contao/dca/tl_settings.php index a78d4ee..0b5a88a 100644 --- a/dca/tl_settings.php +++ b/src/Resources/contao/dca/tl_settings.php @@ -112,22 +112,4 @@ $GLOBALS['TL_DCA']['tl_settings']['fields']['rating_description'] = array 'inputType' => 'text', 'eval' => array('mandatory'=>true, 'allowHtml'=>true, 'tl_class'=>'w50') ); - -class tl_settings_rateit extends rateit\DcaHelper -{ - public function getUserFullName() { - $this->import('jicw\\JICWHelper', 'JICWHelper'); - return $this->JICWHelper->getUserFullName(); - } - - public function getUserEmail() { - $this->import('jicw\\JICWHelper', 'JICWHelper'); - return $this->JICWHelper->getUserEmail(); - } - - public function getInstalledModules() { - $this->import('jicw\\JICWHelper', 'JICWHelper'); - return $this->JICWHelper->getInstalledModules(); - } -} ?> diff --git a/languages/de/default.xlf b/src/Resources/contao/languages/de/default.xlf similarity index 100% rename from languages/de/default.xlf rename to src/Resources/contao/languages/de/default.xlf diff --git a/languages/de/modules.xlf b/src/Resources/contao/languages/de/modules.xlf similarity index 100% rename from languages/de/modules.xlf rename to src/Resources/contao/languages/de/modules.xlf diff --git a/languages/de/rateit_backend.xlf b/src/Resources/contao/languages/de/rateit_backend.xlf similarity index 100% rename from languages/de/rateit_backend.xlf rename to src/Resources/contao/languages/de/rateit_backend.xlf diff --git a/languages/de/tl_article.xlf b/src/Resources/contao/languages/de/tl_article.xlf similarity index 100% rename from languages/de/tl_article.xlf rename to src/Resources/contao/languages/de/tl_article.xlf diff --git a/languages/de/tl_content.xlf b/src/Resources/contao/languages/de/tl_content.xlf similarity index 100% rename from languages/de/tl_content.xlf rename to src/Resources/contao/languages/de/tl_content.xlf diff --git a/languages/de/tl_faq.xlf b/src/Resources/contao/languages/de/tl_faq.xlf similarity index 100% rename from languages/de/tl_faq.xlf rename to src/Resources/contao/languages/de/tl_faq.xlf diff --git a/languages/de/tl_module.xlf b/src/Resources/contao/languages/de/tl_module.xlf similarity index 100% rename from languages/de/tl_module.xlf rename to src/Resources/contao/languages/de/tl_module.xlf diff --git a/languages/de/tl_news.xlf b/src/Resources/contao/languages/de/tl_news.xlf similarity index 100% rename from languages/de/tl_news.xlf rename to src/Resources/contao/languages/de/tl_news.xlf diff --git a/languages/de/tl_page.xlf b/src/Resources/contao/languages/de/tl_page.xlf similarity index 100% rename from languages/de/tl_page.xlf rename to src/Resources/contao/languages/de/tl_page.xlf diff --git a/languages/de/tl_settings.xlf b/src/Resources/contao/languages/de/tl_settings.xlf similarity index 100% rename from languages/de/tl_settings.xlf rename to src/Resources/contao/languages/de/tl_settings.xlf diff --git a/languages/en/default.xlf b/src/Resources/contao/languages/en/default.xlf similarity index 100% rename from languages/en/default.xlf rename to src/Resources/contao/languages/en/default.xlf diff --git a/languages/en/modules.xlf b/src/Resources/contao/languages/en/modules.xlf similarity index 100% rename from languages/en/modules.xlf rename to src/Resources/contao/languages/en/modules.xlf diff --git a/languages/en/rateit_backend.xlf b/src/Resources/contao/languages/en/rateit_backend.xlf similarity index 100% rename from languages/en/rateit_backend.xlf rename to src/Resources/contao/languages/en/rateit_backend.xlf diff --git a/languages/en/tl_article.xlf b/src/Resources/contao/languages/en/tl_article.xlf similarity index 100% rename from languages/en/tl_article.xlf rename to src/Resources/contao/languages/en/tl_article.xlf diff --git a/languages/en/tl_content.xlf b/src/Resources/contao/languages/en/tl_content.xlf similarity index 100% rename from languages/en/tl_content.xlf rename to src/Resources/contao/languages/en/tl_content.xlf diff --git a/languages/en/tl_faq.xlf b/src/Resources/contao/languages/en/tl_faq.xlf similarity index 100% rename from languages/en/tl_faq.xlf rename to src/Resources/contao/languages/en/tl_faq.xlf diff --git a/languages/en/tl_module.xlf b/src/Resources/contao/languages/en/tl_module.xlf similarity index 100% rename from languages/en/tl_module.xlf rename to src/Resources/contao/languages/en/tl_module.xlf diff --git a/languages/en/tl_news.xlf b/src/Resources/contao/languages/en/tl_news.xlf similarity index 100% rename from languages/en/tl_news.xlf rename to src/Resources/contao/languages/en/tl_news.xlf diff --git a/languages/en/tl_page.xlf b/src/Resources/contao/languages/en/tl_page.xlf similarity index 100% rename from languages/en/tl_page.xlf rename to src/Resources/contao/languages/en/tl_page.xlf diff --git a/languages/en/tl_settings.xlf b/src/Resources/contao/languages/en/tl_settings.xlf similarity index 100% rename from languages/en/tl_settings.xlf rename to src/Resources/contao/languages/en/tl_settings.xlf diff --git a/templates/article_rateit_default.html5 b/src/Resources/contao/templates/article_rateit_default.html5 similarity index 100% rename from templates/article_rateit_default.html5 rename to src/Resources/contao/templates/article_rateit_default.html5 diff --git a/templates/article_rateit_default.xhtml b/src/Resources/contao/templates/article_rateit_default.xhtml similarity index 100% rename from templates/article_rateit_default.xhtml rename to src/Resources/contao/templates/article_rateit_default.xhtml diff --git a/templates/article_rateit_default_microdata.html5 b/src/Resources/contao/templates/article_rateit_default_microdata.html5 similarity index 100% rename from templates/article_rateit_default_microdata.html5 rename to src/Resources/contao/templates/article_rateit_default_microdata.html5 diff --git a/templates/article_rateit_default_microdata.xhtml b/src/Resources/contao/templates/article_rateit_default_microdata.xhtml similarity index 100% rename from templates/article_rateit_default_microdata.xhtml rename to src/Resources/contao/templates/article_rateit_default_microdata.xhtml diff --git a/templates/gallery_rateit_default.html5 b/src/Resources/contao/templates/gallery_rateit_default.html5 similarity index 100% rename from templates/gallery_rateit_default.html5 rename to src/Resources/contao/templates/gallery_rateit_default.html5 diff --git a/templates/gallery_rateit_default.xhtml b/src/Resources/contao/templates/gallery_rateit_default.xhtml similarity index 100% rename from templates/gallery_rateit_default.xhtml rename to src/Resources/contao/templates/gallery_rateit_default.xhtml diff --git a/templates/j_colorbox_rateit.html5 b/src/Resources/contao/templates/j_colorbox_rateit.html5 similarity index 85% rename from templates/j_colorbox_rateit.html5 rename to src/Resources/contao/templates/j_colorbox_rateit.html5 index 0d686ab..73d372a 100644 --- a/templates/j_colorbox_rateit.html5 +++ b/src/Resources/contao/templates/j_colorbox_rateit.html5 @@ -2,7 +2,7 @@ // Add the colorbox style sheet and javascript $GLOBALS['TL_CSS'][] = 'assets/jquery/colorbox/'. COLORBOX .'/css/colorbox.min.css||static'; -$GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/rateit/public/js/jquery/colorbox/colorbox-rateit.min.js|static'; +$GLOBALS['TL_JAVASCRIPT'][] = 'bundles/cgoitrateit/public/js/jquery/colorbox/colorbox-rateit.min.js|static'; ?> diff --git a/templates/j_colorbox_rateit.xhtml b/src/Resources/contao/templates/j_colorbox_rateit.xhtml similarity index 84% rename from templates/j_colorbox_rateit.xhtml rename to src/Resources/contao/templates/j_colorbox_rateit.xhtml index 1311b64..1691d5d 100644 --- a/templates/j_colorbox_rateit.xhtml +++ b/src/Resources/contao/templates/j_colorbox_rateit.xhtml @@ -2,7 +2,7 @@ // Add the colorbox style sheet and javascript $GLOBALS['TL_CSS'][] = 'assets/jquery/colorbox/'. COLORBOX .'/css/colorbox.min.css||static'; -$GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/rateit/public/js/jquery/colorbox/colorbox-rateit.min.js|static'; +$GLOBALS['TL_JAVASCRIPT'][] = 'bundles/cgoitrateit/public/js/jquery/colorbox/colorbox-rateit.min.js|static'; ?> diff --git a/templates/mod_article_list_rateit.html5 b/src/Resources/contao/templates/mod_article_list_rateit.html5 similarity index 100% rename from templates/mod_article_list_rateit.html5 rename to src/Resources/contao/templates/mod_article_list_rateit.html5 diff --git a/templates/mod_article_list_rateit.xhtml b/src/Resources/contao/templates/mod_article_list_rateit.xhtml similarity index 100% rename from templates/mod_article_list_rateit.xhtml rename to src/Resources/contao/templates/mod_article_list_rateit.xhtml diff --git a/templates/mod_article_rateit_default_microdata_teaser.html5 b/src/Resources/contao/templates/mod_article_rateit_default_microdata_teaser.html5 similarity index 100% rename from templates/mod_article_rateit_default_microdata_teaser.html5 rename to src/Resources/contao/templates/mod_article_rateit_default_microdata_teaser.html5 diff --git a/templates/mod_article_rateit_default_microdata_teaser.xhtml b/src/Resources/contao/templates/mod_article_rateit_default_microdata_teaser.xhtml similarity index 100% rename from templates/mod_article_rateit_default_microdata_teaser.xhtml rename to src/Resources/contao/templates/mod_article_rateit_default_microdata_teaser.xhtml diff --git a/templates/mod_article_rateit_default_teaser.html5 b/src/Resources/contao/templates/mod_article_rateit_default_teaser.html5 similarity index 100% rename from templates/mod_article_rateit_default_teaser.html5 rename to src/Resources/contao/templates/mod_article_rateit_default_teaser.html5 diff --git a/templates/mod_article_rateit_default_teaser.xhtml b/src/Resources/contao/templates/mod_article_rateit_default_teaser.xhtml similarity index 100% rename from templates/mod_article_rateit_default_teaser.xhtml rename to src/Resources/contao/templates/mod_article_rateit_default_teaser.xhtml diff --git a/templates/mod_rateit_top_ratings.html5 b/src/Resources/contao/templates/mod_rateit_top_ratings.html5 similarity index 100% rename from templates/mod_rateit_top_ratings.html5 rename to src/Resources/contao/templates/mod_rateit_top_ratings.html5 diff --git a/templates/mod_rateit_top_ratings.xhtml b/src/Resources/contao/templates/mod_rateit_top_ratings.xhtml similarity index 100% rename from templates/mod_rateit_top_ratings.xhtml rename to src/Resources/contao/templates/mod_rateit_top_ratings.xhtml diff --git a/templates/moo_mediabox_rateit.html5 b/src/Resources/contao/templates/moo_mediabox_rateit.html5 similarity index 90% rename from templates/moo_mediabox_rateit.html5 rename to src/Resources/contao/templates/moo_mediabox_rateit.html5 index fce4834..b78b0f9 100644 --- a/templates/moo_mediabox_rateit.html5 +++ b/src/Resources/contao/templates/moo_mediabox_rateit.html5 @@ -2,7 +2,7 @@ // Add the mediabox style sheet and javascript $GLOBALS['TL_CSS'][] = 'assets/mootools/mediabox/'. MEDIABOX .'/css/mediaboxAdvBlack21.css||static'; -$GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/rateit/public/js/mootools/mediabox/mediabox-rateit.js|static'; +$GLOBALS['TL_JAVASCRIPT'][] = 'bundles/cgoitrateit/public/js/mootools/mediabox/mediabox-rateit.js|static'; ?> diff --git a/templates/moo_mediabox_rateit.xhtml b/src/Resources/contao/templates/moo_mediabox_rateit.xhtml similarity index 90% rename from templates/moo_mediabox_rateit.xhtml rename to src/Resources/contao/templates/moo_mediabox_rateit.xhtml index 9008297..1edc5e8 100644 --- a/templates/moo_mediabox_rateit.xhtml +++ b/src/Resources/contao/templates/moo_mediabox_rateit.xhtml @@ -2,7 +2,7 @@ // Add the mediabox style sheet $GLOBALS['TL_CSS'][] = 'assets/mootools/mediabox/'. MEDIABOX .'/css/mediaboxAdvBlack21.css||static'; -$GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/rateit/public/js/mootools/mediabox/mediabox-rateit.js|static'; +$GLOBALS['TL_JAVASCRIPT'][] = 'bundles/cgoitrateit/public/js/mootools/mediabox/mediabox-rateit.js|static'; ?> diff --git a/templates/news_full_rateit.html5 b/src/Resources/contao/templates/news_full_rateit.html5 similarity index 100% rename from templates/news_full_rateit.html5 rename to src/Resources/contao/templates/news_full_rateit.html5 diff --git a/templates/news_full_rateit.xhtml b/src/Resources/contao/templates/news_full_rateit.xhtml similarity index 100% rename from templates/news_full_rateit.xhtml rename to src/Resources/contao/templates/news_full_rateit.xhtml diff --git a/templates/news_full_rateit_microdata.html5 b/src/Resources/contao/templates/news_full_rateit_microdata.html5 similarity index 100% rename from templates/news_full_rateit_microdata.html5 rename to src/Resources/contao/templates/news_full_rateit_microdata.html5 diff --git a/templates/news_full_rateit_microdata.xhtml b/src/Resources/contao/templates/news_full_rateit_microdata.xhtml similarity index 100% rename from templates/news_full_rateit_microdata.xhtml rename to src/Resources/contao/templates/news_full_rateit_microdata.xhtml diff --git a/templates/news_latest_rateit.html5 b/src/Resources/contao/templates/news_latest_rateit.html5 similarity index 100% rename from templates/news_latest_rateit.html5 rename to src/Resources/contao/templates/news_latest_rateit.html5 diff --git a/templates/news_latest_rateit.xhtml b/src/Resources/contao/templates/news_latest_rateit.xhtml similarity index 100% rename from templates/news_latest_rateit.xhtml rename to src/Resources/contao/templates/news_latest_rateit.xhtml diff --git a/templates/news_latest_rateit_microdata.html5 b/src/Resources/contao/templates/news_latest_rateit_microdata.html5 similarity index 100% rename from templates/news_latest_rateit_microdata.html5 rename to src/Resources/contao/templates/news_latest_rateit_microdata.html5 diff --git a/templates/news_latest_rateit_microdata.xhtml b/src/Resources/contao/templates/news_latest_rateit_microdata.xhtml similarity index 100% rename from templates/news_latest_rateit_microdata.xhtml rename to src/Resources/contao/templates/news_latest_rateit_microdata.xhtml diff --git a/templates/news_short_rateit.html5 b/src/Resources/contao/templates/news_short_rateit.html5 similarity index 100% rename from templates/news_short_rateit.html5 rename to src/Resources/contao/templates/news_short_rateit.html5 diff --git a/templates/news_short_rateit.xhtml b/src/Resources/contao/templates/news_short_rateit.xhtml similarity index 100% rename from templates/news_short_rateit.xhtml rename to src/Resources/contao/templates/news_short_rateit.xhtml diff --git a/templates/news_short_rateit_microdata.html5 b/src/Resources/contao/templates/news_short_rateit_microdata.html5 similarity index 100% rename from templates/news_short_rateit_microdata.html5 rename to src/Resources/contao/templates/news_short_rateit_microdata.html5 diff --git a/templates/news_short_rateit_microdata.xhtml b/src/Resources/contao/templates/news_short_rateit_microdata.xhtml similarity index 100% rename from templates/news_short_rateit_microdata.xhtml rename to src/Resources/contao/templates/news_short_rateit_microdata.xhtml diff --git a/templates/news_simple_rateit.html5 b/src/Resources/contao/templates/news_simple_rateit.html5 similarity index 100% rename from templates/news_simple_rateit.html5 rename to src/Resources/contao/templates/news_simple_rateit.html5 diff --git a/templates/news_simple_rateit.xhtml b/src/Resources/contao/templates/news_simple_rateit.xhtml similarity index 100% rename from templates/news_simple_rateit.xhtml rename to src/Resources/contao/templates/news_simple_rateit.xhtml diff --git a/templates/news_simple_rateit_microdata.html5 b/src/Resources/contao/templates/news_simple_rateit_microdata.html5 similarity index 100% rename from templates/news_simple_rateit_microdata.html5 rename to src/Resources/contao/templates/news_simple_rateit_microdata.html5 diff --git a/templates/news_simple_rateit_microdata.xhtml b/src/Resources/contao/templates/news_simple_rateit_microdata.xhtml similarity index 100% rename from templates/news_simple_rateit_microdata.xhtml rename to src/Resources/contao/templates/news_simple_rateit_microdata.xhtml diff --git a/templates/rateit_default.html5 b/src/Resources/contao/templates/rateit_default.html5 similarity index 100% rename from templates/rateit_default.html5 rename to src/Resources/contao/templates/rateit_default.html5 diff --git a/templates/rateit_default.xhtml b/src/Resources/contao/templates/rateit_default.xhtml similarity index 100% rename from templates/rateit_default.xhtml rename to src/Resources/contao/templates/rateit_default.xhtml diff --git a/templates/rateit_microdata.html5 b/src/Resources/contao/templates/rateit_microdata.html5 similarity index 100% rename from templates/rateit_microdata.html5 rename to src/Resources/contao/templates/rateit_microdata.html5 diff --git a/templates/rateit_microdata.xhtml b/src/Resources/contao/templates/rateit_microdata.xhtml similarity index 100% rename from templates/rateit_microdata.xhtml rename to src/Resources/contao/templates/rateit_microdata.xhtml diff --git a/templates/rateitbe_ratinglist.html5 b/src/Resources/contao/templates/rateitbe_ratinglist.html5 similarity index 100% rename from templates/rateitbe_ratinglist.html5 rename to src/Resources/contao/templates/rateitbe_ratinglist.html5 diff --git a/templates/rateitbe_ratingview.html5 b/src/Resources/contao/templates/rateitbe_ratingview.html5 similarity index 100% rename from templates/rateitbe_ratingview.html5 rename to src/Resources/contao/templates/rateitbe_ratingview.html5 diff --git a/public/.htaccess b/src/Resources/public/.htaccess similarity index 100% rename from public/.htaccess rename to src/Resources/public/.htaccess diff --git a/public/css/backend.css b/src/Resources/public/css/backend.css similarity index 100% rename from public/css/backend.css rename to src/Resources/public/css/backend.css diff --git a/public/css/heart.css b/src/Resources/public/css/heart.css similarity index 100% rename from public/css/heart.css rename to src/Resources/public/css/heart.css diff --git a/public/css/heart.min.css b/src/Resources/public/css/heart.min.css similarity index 100% rename from public/css/heart.min.css rename to src/Resources/public/css/heart.min.css diff --git a/public/css/rateit.css b/src/Resources/public/css/rateit.css similarity index 100% rename from public/css/rateit.css rename to src/Resources/public/css/rateit.css diff --git a/public/css/rateit.min.css b/src/Resources/public/css/rateit.min.css similarity index 100% rename from public/css/rateit.min.css rename to src/Resources/public/css/rateit.min.css diff --git a/public/css/star.css b/src/Resources/public/css/star.css similarity index 100% rename from public/css/star.css rename to src/Resources/public/css/star.css diff --git a/public/css/star.min.css b/src/Resources/public/css/star.min.css similarity index 100% rename from public/css/star.min.css rename to src/Resources/public/css/star.min.css diff --git a/public/images/ajax-loading.gif b/src/Resources/public/images/ajax-loading.gif similarity index 100% rename from public/images/ajax-loading.gif rename to src/Resources/public/images/ajax-loading.gif diff --git a/public/images/article.gif b/src/Resources/public/images/article.gif similarity index 100% rename from public/images/article.gif rename to src/Resources/public/images/article.gif diff --git a/public/images/exportEXCEL.gif b/src/Resources/public/images/exportEXCEL.gif similarity index 100% rename from public/images/exportEXCEL.gif rename to src/Resources/public/images/exportEXCEL.gif diff --git a/public/images/heart.gif b/src/Resources/public/images/heart.gif similarity index 100% rename from public/images/heart.gif rename to src/Resources/public/images/heart.gif diff --git a/public/images/icon.png b/src/Resources/public/images/icon.png similarity index 100% rename from public/images/icon.png rename to src/Resources/public/images/icon.png diff --git a/public/images/info.gif b/src/Resources/public/images/info.gif similarity index 100% rename from public/images/info.gif rename to src/Resources/public/images/info.gif diff --git a/public/images/page.gif b/src/Resources/public/images/page.gif similarity index 100% rename from public/images/page.gif rename to src/Resources/public/images/page.gif diff --git a/public/images/star.gif b/src/Resources/public/images/star.gif similarity index 100% rename from public/images/star.gif rename to src/Resources/public/images/star.gif diff --git a/public/js/RateItBackend.js b/src/Resources/public/js/RateItBackend.js similarity index 100% rename from public/js/RateItBackend.js rename to src/Resources/public/js/RateItBackend.js diff --git a/public/js/helper.js b/src/Resources/public/js/helper.js similarity index 100% rename from public/js/helper.js rename to src/Resources/public/js/helper.js diff --git a/public/js/helper.min.js b/src/Resources/public/js/helper.min.js similarity index 100% rename from public/js/helper.min.js rename to src/Resources/public/js/helper.min.js diff --git a/public/js/jquery-ui-effects.custom.js b/src/Resources/public/js/jquery-ui-effects.custom.js similarity index 100% rename from public/js/jquery-ui-effects.custom.js rename to src/Resources/public/js/jquery-ui-effects.custom.js diff --git a/public/js/jquery-ui-effects.custom.min.js b/src/Resources/public/js/jquery-ui-effects.custom.min.js similarity index 100% rename from public/js/jquery-ui-effects.custom.min.js rename to src/Resources/public/js/jquery-ui-effects.custom.min.js diff --git a/public/js/jquery/colorbox/colorbox-rateit.js b/src/Resources/public/js/jquery/colorbox/colorbox-rateit.js similarity index 100% rename from public/js/jquery/colorbox/colorbox-rateit.js rename to src/Resources/public/js/jquery/colorbox/colorbox-rateit.js diff --git a/public/js/jquery/colorbox/colorbox-rateit.min.js b/src/Resources/public/js/jquery/colorbox/colorbox-rateit.min.js similarity index 100% rename from public/js/jquery/colorbox/colorbox-rateit.min.js rename to src/Resources/public/js/jquery/colorbox/colorbox-rateit.min.js diff --git a/public/js/mootools/mediabox/mediabox-rateit-uncompressed.js b/src/Resources/public/js/mootools/mediabox/mediabox-rateit-uncompressed.js similarity index 100% rename from public/js/mootools/mediabox/mediabox-rateit-uncompressed.js rename to src/Resources/public/js/mootools/mediabox/mediabox-rateit-uncompressed.js diff --git a/public/js/mootools/mediabox/mediabox-rateit.js b/src/Resources/public/js/mootools/mediabox/mediabox-rateit.js similarity index 100% rename from public/js/mootools/mediabox/mediabox-rateit.js rename to src/Resources/public/js/mootools/mediabox/mediabox-rateit.js diff --git a/public/js/onReadyRateIt-uncompressed.js b/src/Resources/public/js/onReadyRateIt-uncompressed.js similarity index 100% rename from public/js/onReadyRateIt-uncompressed.js rename to src/Resources/public/js/onReadyRateIt-uncompressed.js diff --git a/public/js/onReadyRateIt.js b/src/Resources/public/js/onReadyRateIt.js similarity index 100% rename from public/js/onReadyRateIt.js rename to src/Resources/public/js/onReadyRateIt.js diff --git a/public/js/rateit-uncompressed.js b/src/Resources/public/js/rateit-uncompressed.js similarity index 98% rename from public/js/rateit-uncompressed.js rename to src/Resources/public/js/rateit-uncompressed.js index 2613927..9db4672 100644 --- a/public/js/rateit-uncompressed.js +++ b/src/Resources/public/js/rateit-uncompressed.js @@ -271,7 +271,7 @@ function doRateIt() { }); window.addEvent('domready', function(e) { - RateItRating = new RateItRatings({url:'system/modules/rateit/public/php/rateit-ajax.php?do=rateit'}); + RateItRating = new RateItRatings({url:'bundles/cgoitrateit/public/php/rateit-ajax.php?do=rateit'}); }); } else if (window.jQuery) { // the rateit plugin as an Object @@ -567,19 +567,19 @@ function doRateIt() { jQuery(document).ready(function() { jQuery.ajax({ type: "GET", - url: "system/modules/rateit/public/js/jquery-ui-effects.custom.min.js", + url: "bundles/cgoitrateit/public/js/jquery-ui-effects.custom.min.js", dataType: "script", async: false, cache: true }); jQuery.ajax({ type: "GET", - url: "system/modules/rateit/public/js/helper.min.js", + url: "bundles/cgoitrateit/public/js/helper.min.js", dataType: "script", async: false, cache: true }); - RateItRating = Object.create(RateItRatings).initialize({url:'system/modules/rateit/public/php/rateit-ajax.php?do=rateit'}); + RateItRating = Object.create(RateItRatings).initialize({url:'bundles/cgoitrateit/public/php/rateit-ajax.php?do=rateit'}); }); var jEscape = function(jquery) { diff --git a/public/js/rateit.js b/src/Resources/public/js/rateit.js similarity index 92% rename from public/js/rateit.js rename to src/Resources/public/js/rateit.js index 8231abe..91dbf85 100644 --- a/public/js/rateit.js +++ b/src/Resources/public/js/rateit.js @@ -9,7 +9,7 @@ var votePercent=this.getVotePercent(el.newFill);if(this.options.url!=null){new R el.textEl.set('text',text);if(typeof($('.mbrateItRating'))!='undefined'&&el.id.indexOf('mb')==0){var mbid=el.getAttribute('id');mbid=mbid.replace('mb','');if(typeof(arrRatings)=='object'){for(var ri=0;ri100){el.newFill=this.getFillPercent(100);} -el.selected.setStyle('width',el.newFill);},getStarPercent:function(id){var stars=id.match(/(\d*\|?\d*)-(page|article|ce|module|news|faq|galpic|news4ward)-(\d*\.?\d+)_(\d*\.?\d+)$/);if(stars!=null){var score=stars[3].toFloat();var scale=stars[4].toFloat();var percent=(score/scale)*100;return percent;}else{return 0;}},getFillPercent:function(starPercent){return(starPercent/100)*(this.options.starwidth*this.options.max);},getVotePercent:function(actVote){var starsWidth=this.options.starwidth*this.options.max;var percent=(actVote/starsWidth*100).round(2);return percent;},getRatableId:function(id){var stars=id.match(/(\d*\|?\d*)-(page|article|ce|module|news|faq|galpic|news4ward)-(\d*\.?\d+)_(\d*\.?\d+)$/);return stars!=null?stars[1]:'';},getRatableType:function(id){var stars=id.match(/(\d*\|?\d*)-(page|article|ce|module|news|faq|galpic|news4ward)-(\d*\.?\d+)_(\d*\.?\d+)$/);return stars!=null?stars[2]:'';},getRatableMaxValue:function(id){var stars=id.match(/(\d*\|?\d*)-(page|article|ce|module|news|faq|galpic|news4ward)-(\d*\.?\d+)_(\d*\.?\d+)$/);return stars!=null?stars[4].toInt():0;},setBackgroundPosition:function(el,pos){el.setStyle('background-position','0% '+pos+'px');},getBackgroundImagePath:function(el){return el.getStyle('background-image');},getBackgroundImage:function(el){var reg_imgFile=/url\s*\(["']?(.*)["']?\)/i;var dummy=document.createElement('img');var string=this.getBackgroundImagePath(el);string=string.match(reg_imgFile)[1];string=string.replace('\"','');dummy.src=string;return dummy;}});window.addEvent('domready',function(e){RateItRating=new RateItRatings({url:'system/modules/rateit/public/php/rateit-ajax.php?do=rateit'});});}else if(window.jQuery){(function(){RateItRatings={options:{step:0.1,readonly:false,resetable:false},initialize:function(options){if(typeof options=='object'&&typeof options['url']!='undefined') +el.selected.setStyle('width',el.newFill);},getStarPercent:function(id){var stars=id.match(/(\d*\|?\d*)-(page|article|ce|module|news|faq|galpic|news4ward)-(\d*\.?\d+)_(\d*\.?\d+)$/);if(stars!=null){var score=stars[3].toFloat();var scale=stars[4].toFloat();var percent=(score/scale)*100;return percent;}else{return 0;}},getFillPercent:function(starPercent){return(starPercent/100)*(this.options.starwidth*this.options.max);},getVotePercent:function(actVote){var starsWidth=this.options.starwidth*this.options.max;var percent=(actVote/starsWidth*100).round(2);return percent;},getRatableId:function(id){var stars=id.match(/(\d*\|?\d*)-(page|article|ce|module|news|faq|galpic|news4ward)-(\d*\.?\d+)_(\d*\.?\d+)$/);return stars!=null?stars[1]:'';},getRatableType:function(id){var stars=id.match(/(\d*\|?\d*)-(page|article|ce|module|news|faq|galpic|news4ward)-(\d*\.?\d+)_(\d*\.?\d+)$/);return stars!=null?stars[2]:'';},getRatableMaxValue:function(id){var stars=id.match(/(\d*\|?\d*)-(page|article|ce|module|news|faq|galpic|news4ward)-(\d*\.?\d+)_(\d*\.?\d+)$/);return stars!=null?stars[4].toInt():0;},setBackgroundPosition:function(el,pos){el.setStyle('background-position','0% '+pos+'px');},getBackgroundImagePath:function(el){return el.getStyle('background-image');},getBackgroundImage:function(el){var reg_imgFile=/url\s*\(["']?(.*)["']?\)/i;var dummy=document.createElement('img');var string=this.getBackgroundImagePath(el);string=string.match(reg_imgFile)[1];string=string.replace('\"','');dummy.src=string;return dummy;}});window.addEvent('domready',function(e){RateItRating=new RateItRatings({url:'bundles/cgoitrateit/public/php/rateit-ajax.php?do=rateit'});});}else if(window.jQuery){(function(){RateItRatings={options:{step:0.1,readonly:false,resetable:false},initialize:function(options){if(typeof options=='object'&&typeof options['url']!='undefined') this.options.url=options['url'];var self=this;jQuery('.rateItRating').each(function(i,element){self.initMe(element);});return this;},initMe:function(element){var self=this;if(!Browser.Engine.trident4){var el=jQuery(element);el.data('id',el.attr('id'));el.data('rateable',el.attr('rel')=='not-rateable'?false:true);el.data('wrapper',el.find('.wrapper'));el.data('textEl',el.find('.ratingText'));el.data('selected',el.find('.rateItRating-selected'));el.data('hover',el.find('.rateItRating-hover'));jQuery.when(self.getBackgroundImage(el.data('wrapper'))).done(function(backgroundImageSize){self.options.starwidth=backgroundImageSize[0];self.options.starheight=backgroundImageSize[1]/3;});if(self.options.starwidth===undefined||self.options.starwidth<16){self.options.starwidth=16;} if(self.options.starheight===undefined||self.options.starheight<16){self.options.starheight=16;} self.setBackgroundPosition(el.data('selected'),-1*self.options.starheight);self.setBackgroundPosition(el.data('hover'),-1*2*self.options.starheight);el.data('starPercent',self.getStarPercent(el.data('id')));el.data('ratableId',self.getRatableId(el.data('id')));el.data('ratableType',self.getRatableType(el.data('id')));self.options.max=self.getRatableMaxValue(el.data('id'));el.data('selected').css('height',self.options.starheight);el.data('hover').css('height',self.options.starheight);el.data('wrapper').css('width',self.options.starwidth*self.options.max);el.data('wrapper').css('height',self.options.starheight);self.fillVote(el.data('starPercent'),el);el.data('currentFill',self.getFillPercent(el.data('starPercent')));if(el.data('rateable')){el.data('wrapper').mouseenter(function(event){el.data('selected').hide(500,"easeInOutQuad");el.data('hover').show();el.data('wrapper').mousemove({'el':el,'self':self},self.mouseCrap);});el.data('wrapper').mouseleave(function(event){el.data('wrapper').unbind('mousemove');el.data('hover').hide();el.data('selected').show();el.data('selected').animate({width:el.data('currentFill')},500);});el.data('wrapper').click(function(event){el.data('currentFill',el.data('newFill'));el.data('wrapper').unbind();el.data('oldTxt',el.data('textEl').text());el.data('textEl').html('          ');el.data('textEl').addClass('loading');if(typeof(jQuery('.mbrateItRating'))!='undefined'&&el.data('id').indexOf('mb')==0){var mbid=el.data('id');mbid=mbid.replace('mb','');if(typeof(arrRatings)=='object'){for(var ri=0;ri').attr('src',string).load(function(){backgroundImageSize.push(this.width);backgroundImageSize.push(this.height);dfd.resolve(backgroundImageSize);});return dfd.promise();},updateText:function(el,text){error=text.split('ERROR:')[1];el.data('textEl').removeClass('loading');if(error){this.RateItRating.showError(el,error);return false;} el.data('textEl').text(text);if(typeof(jQuery('.mbrateItRating'))!='undefined'&&el.data('id').indexOf('mb')==0){var mbid=el.attr('id');mbid=mbid.replace('mb','');if(typeof(arrRatings)=='object'){for(var ri=0;ri + * Jordi Boggiano + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Composer\Autoload; + +/** + * ClassLoader implements a PSR-0, PSR-4 and classmap class loader. + * + * $loader = new \Composer\Autoload\ClassLoader(); + * + * // register classes with namespaces + * $loader->add('Symfony\Component', __DIR__.'/component'); + * $loader->add('Symfony', __DIR__.'/framework'); + * + * // activate the autoloader + * $loader->register(); + * + * // to enable searching the include path (eg. for PEAR packages) + * $loader->setUseIncludePath(true); + * + * In this example, if you try to use a class in the Symfony\Component + * namespace or one of its children (Symfony\Component\Console for instance), + * the autoloader will first look for the class under the component/ + * directory, and it will then fallback to the framework/ directory if not + * found before giving up. + * + * This class is loosely based on the Symfony UniversalClassLoader. + * + * @author Fabien Potencier + * @author Jordi Boggiano + * @see http://www.php-fig.org/psr/psr-0/ + * @see http://www.php-fig.org/psr/psr-4/ + */ +class ClassLoader +{ + // PSR-4 + private $prefixLengthsPsr4 = array(); + private $prefixDirsPsr4 = array(); + private $fallbackDirsPsr4 = array(); + + // PSR-0 + private $prefixesPsr0 = array(); + private $fallbackDirsPsr0 = array(); + + private $useIncludePath = false; + private $classMap = array(); + private $classMapAuthoritative = false; + private $missingClasses = array(); + private $apcuPrefix; + + public function getPrefixes() + { + if (!empty($this->prefixesPsr0)) { + return call_user_func_array('array_merge', $this->prefixesPsr0); + } + + return array(); + } + + public function getPrefixesPsr4() + { + return $this->prefixDirsPsr4; + } + + public function getFallbackDirs() + { + return $this->fallbackDirsPsr0; + } + + public function getFallbackDirsPsr4() + { + return $this->fallbackDirsPsr4; + } + + public function getClassMap() + { + return $this->classMap; + } + + /** + * @param array $classMap Class to filename map + */ + public function addClassMap(array $classMap) + { + if ($this->classMap) { + $this->classMap = array_merge($this->classMap, $classMap); + } else { + $this->classMap = $classMap; + } + } + + /** + * Registers a set of PSR-0 directories for a given prefix, either + * appending or prepending to the ones previously set for this prefix. + * + * @param string $prefix The prefix + * @param array|string $paths The PSR-0 root directories + * @param bool $prepend Whether to prepend the directories + */ + public function add($prefix, $paths, $prepend = false) + { + if (!$prefix) { + if ($prepend) { + $this->fallbackDirsPsr0 = array_merge( + (array) $paths, + $this->fallbackDirsPsr0 + ); + } else { + $this->fallbackDirsPsr0 = array_merge( + $this->fallbackDirsPsr0, + (array) $paths + ); + } + + return; + } + + $first = $prefix[0]; + if (!isset($this->prefixesPsr0[$first][$prefix])) { + $this->prefixesPsr0[$first][$prefix] = (array) $paths; + + return; + } + if ($prepend) { + $this->prefixesPsr0[$first][$prefix] = array_merge( + (array) $paths, + $this->prefixesPsr0[$first][$prefix] + ); + } else { + $this->prefixesPsr0[$first][$prefix] = array_merge( + $this->prefixesPsr0[$first][$prefix], + (array) $paths + ); + } + } + + /** + * Registers a set of PSR-4 directories for a given namespace, either + * appending or prepending to the ones previously set for this namespace. + * + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param array|string $paths The PSR-4 base directories + * @param bool $prepend Whether to prepend the directories + * + * @throws \InvalidArgumentException + */ + public function addPsr4($prefix, $paths, $prepend = false) + { + if (!$prefix) { + // Register directories for the root namespace. + if ($prepend) { + $this->fallbackDirsPsr4 = array_merge( + (array) $paths, + $this->fallbackDirsPsr4 + ); + } else { + $this->fallbackDirsPsr4 = array_merge( + $this->fallbackDirsPsr4, + (array) $paths + ); + } + } elseif (!isset($this->prefixDirsPsr4[$prefix])) { + // Register directories for a new namespace. + $length = strlen($prefix); + if ('\\' !== $prefix[$length - 1]) { + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); + } + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; + $this->prefixDirsPsr4[$prefix] = (array) $paths; + } elseif ($prepend) { + // Prepend directories for an already registered namespace. + $this->prefixDirsPsr4[$prefix] = array_merge( + (array) $paths, + $this->prefixDirsPsr4[$prefix] + ); + } else { + // Append directories for an already registered namespace. + $this->prefixDirsPsr4[$prefix] = array_merge( + $this->prefixDirsPsr4[$prefix], + (array) $paths + ); + } + } + + /** + * Registers a set of PSR-0 directories for a given prefix, + * replacing any others previously set for this prefix. + * + * @param string $prefix The prefix + * @param array|string $paths The PSR-0 base directories + */ + public function set($prefix, $paths) + { + if (!$prefix) { + $this->fallbackDirsPsr0 = (array) $paths; + } else { + $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths; + } + } + + /** + * Registers a set of PSR-4 directories for a given namespace, + * replacing any others previously set for this namespace. + * + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param array|string $paths The PSR-4 base directories + * + * @throws \InvalidArgumentException + */ + public function setPsr4($prefix, $paths) + { + if (!$prefix) { + $this->fallbackDirsPsr4 = (array) $paths; + } else { + $length = strlen($prefix); + if ('\\' !== $prefix[$length - 1]) { + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); + } + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; + $this->prefixDirsPsr4[$prefix] = (array) $paths; + } + } + + /** + * Turns on searching the include path for class files. + * + * @param bool $useIncludePath + */ + public function setUseIncludePath($useIncludePath) + { + $this->useIncludePath = $useIncludePath; + } + + /** + * Can be used to check if the autoloader uses the include path to check + * for classes. + * + * @return bool + */ + public function getUseIncludePath() + { + return $this->useIncludePath; + } + + /** + * Turns off searching the prefix and fallback directories for classes + * that have not been registered with the class map. + * + * @param bool $classMapAuthoritative + */ + public function setClassMapAuthoritative($classMapAuthoritative) + { + $this->classMapAuthoritative = $classMapAuthoritative; + } + + /** + * Should class lookup fail if not found in the current class map? + * + * @return bool + */ + public function isClassMapAuthoritative() + { + return $this->classMapAuthoritative; + } + + /** + * APCu prefix to use to cache found/not-found classes, if the extension is enabled. + * + * @param string|null $apcuPrefix + */ + public function setApcuPrefix($apcuPrefix) + { + $this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null; + } + + /** + * The APCu prefix in use, or null if APCu caching is not enabled. + * + * @return string|null + */ + public function getApcuPrefix() + { + return $this->apcuPrefix; + } + + /** + * Registers this instance as an autoloader. + * + * @param bool $prepend Whether to prepend the autoloader or not + */ + public function register($prepend = false) + { + spl_autoload_register(array($this, 'loadClass'), true, $prepend); + } + + /** + * Unregisters this instance as an autoloader. + */ + public function unregister() + { + spl_autoload_unregister(array($this, 'loadClass')); + } + + /** + * Loads the given class or interface. + * + * @param string $class The name of the class + * @return bool|null True if loaded, null otherwise + */ + public function loadClass($class) + { + if ($file = $this->findFile($class)) { + includeFile($file); + + return true; + } + } + + /** + * Finds the path to the file where the class is defined. + * + * @param string $class The name of the class + * + * @return string|false The path if found, false otherwise + */ + public function findFile($class) + { + // class map lookup + if (isset($this->classMap[$class])) { + return $this->classMap[$class]; + } + if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) { + return false; + } + if (null !== $this->apcuPrefix) { + $file = apcu_fetch($this->apcuPrefix.$class, $hit); + if ($hit) { + return $file; + } + } + + $file = $this->findFileWithExtension($class, '.php'); + + // Search for Hack files if we are running on HHVM + if (false === $file && defined('HHVM_VERSION')) { + $file = $this->findFileWithExtension($class, '.hh'); + } + + if (null !== $this->apcuPrefix) { + apcu_add($this->apcuPrefix.$class, $file); + } + + if (false === $file) { + // Remember that this class does not exist. + $this->missingClasses[$class] = true; + } + + return $file; + } + + private function findFileWithExtension($class, $ext) + { + // PSR-4 lookup + $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; + + $first = $class[0]; + if (isset($this->prefixLengthsPsr4[$first])) { + $subPath = $class; + while (false !== $lastPos = strrpos($subPath, '\\')) { + $subPath = substr($subPath, 0, $lastPos); + $search = $subPath.'\\'; + if (isset($this->prefixDirsPsr4[$search])) { + $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); + foreach ($this->prefixDirsPsr4[$search] as $dir) { + if (file_exists($file = $dir . $pathEnd)) { + return $file; + } + } + } + } + } + + // PSR-4 fallback dirs + foreach ($this->fallbackDirsPsr4 as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { + return $file; + } + } + + // PSR-0 lookup + if (false !== $pos = strrpos($class, '\\')) { + // namespaced class name + $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1) + . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); + } else { + // PEAR-like class name + $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; + } + + if (isset($this->prefixesPsr0[$first])) { + foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { + if (0 === strpos($class, $prefix)) { + foreach ($dirs as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { + return $file; + } + } + } + } + } + + // PSR-0 fallback dirs + foreach ($this->fallbackDirsPsr0 as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { + return $file; + } + } + + // PSR-0 include paths. + if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) { + return $file; + } + + return false; + } +} + +/** + * Scope isolated include. + * + * Prevents access to $this/self from included files. + */ +function includeFile($file) +{ + include $file; +} diff --git a/vendor/composer/LICENSE b/vendor/composer/LICENSE new file mode 100644 index 0000000..f27399a --- /dev/null +++ b/vendor/composer/LICENSE @@ -0,0 +1,21 @@ + +Copyright (c) Nils Adermann, Jordi Boggiano + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php new file mode 100644 index 0000000..7a91153 --- /dev/null +++ b/vendor/composer/autoload_classmap.php @@ -0,0 +1,9 @@ += 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); + if ($useStaticLoader) { + require_once __DIR__ . '/autoload_static.php'; + + call_user_func(\Composer\Autoload\ComposerStaticInit36717b67703aeeb9fbf654ae4d3947d4::getInitializer($loader)); + } else { + $map = require __DIR__ . '/autoload_namespaces.php'; + foreach ($map as $namespace => $path) { + $loader->set($namespace, $path); + } + + $map = require __DIR__ . '/autoload_psr4.php'; + foreach ($map as $namespace => $path) { + $loader->setPsr4($namespace, $path); + } + + $classMap = require __DIR__ . '/autoload_classmap.php'; + if ($classMap) { + $loader->addClassMap($classMap); + } + } + + $loader->register(true); + + return $loader; + } +} diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php new file mode 100644 index 0000000..fe3c2b7 --- /dev/null +++ b/vendor/composer/autoload_static.php @@ -0,0 +1,15 @@ +