{"id":20729559,"url":"https://github.com/nicolasgraph/oui_cookie","last_synced_at":"2025-08-28T08:06:53.178Z","repository":{"id":8787288,"uuid":"59703932","full_name":"NicolasGraph/oui_cookie","owner":"NicolasGraph","description":"Cookie management plugin for @Textpattern","archived":false,"fork":false,"pushed_at":"2019-10-21T14:33:15.000Z","size":85,"stargazers_count":4,"open_issues_count":2,"forks_count":3,"subscribers_count":2,"default_branch":"dev","last_synced_at":"2025-04-23T20:18:30.250Z","etag":null,"topics":["cookie","cookies","textpattern","textpattern-plugin"],"latest_commit_sha":null,"homepage":"http://forum.textpattern.com/viewtopic.php?id=47048","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NicolasGraph.png","metadata":{"files":{"readme":"README.textile","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-05-25T23:12:32.000Z","updated_at":"2024-10-09T04:01:54.000Z","dependencies_parsed_at":"2022-08-03T03:15:47.871Z","dependency_job_id":null,"html_url":"https://github.com/NicolasGraph/oui_cookie","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NicolasGraph%2Foui_cookie","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NicolasGraph%2Foui_cookie/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NicolasGraph%2Foui_cookie/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NicolasGraph%2Foui_cookie/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NicolasGraph","download_url":"https://codeload.github.com/NicolasGraph/oui_cookie/tar.gz/refs/heads/dev","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250506147,"owners_count":21441723,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cookie","cookies","textpattern","textpattern-plugin"],"created_at":"2024-11-17T04:43:27.598Z","updated_at":"2025-04-23T20:18:54.071Z","avatar_url":"https://github.com/NicolasGraph.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"h1. oui_cookie\n\nh2. Introduction\n\nSet, check, read, reset or delete cookies manually or through GET/POST parameters.\n\np(alert-block warning). %(ui-icon ui-icon-alert).% According to the \"EU legislation\":http://ec.europa.eu/ipg/basics/legal/cookies/index_en.htm#section_2, some cookies need the user consent before to be set.\n\nh3. Plugin requirements\n\noui_cookie's minimum requirements:\n\n* \"Textpattern CMS\":http://textpattern.com/ 4.6+.\n\nh2. Plugin management\n\nh3. Installation\n\nh4. From the admin interface\n\n# \"Download\":https://github.com/NicolasGraph/oui_cookie/releases the compiled plugin file or the source to compile a customized file.\n# Paste the content of the compiled plugin file under the \"Admin \u003e Plugins\":?event=plugin tab and click the _Upload_ button.\n# Confirm the plugin install by clicking the _Install_ button on the plugin preview page.\n# Enable the plugin.\n\nh4. Via Composer\n\nAfter \"installing Composer\":https://getcomposer.org/doc/00-intro.md…\n\n# Target your project directory:\n@$ cd /path/to/your/textpattern/installation/dir@\n# If it's not already done, lock your version of Txp:\n@$ composer require textpattern/lock:4.6.2@, where @4.6.2@ is the Txp version in use.\n# Install oui_cookie:\n@$ composer require oui/oui_cookie@\n\nh3. Update\n\nh4. From the admin interface\n\n# Follow the installation instruction above.\n\nh4. Via Composer\n\nbc. $ composer update oui/oui_cookie\n\nh3. Uninstall\n\nh4. From the admin interface\n\n# Check the box on the left of the plugin row under the \"Admin \u003e Plugins\":?event=plugin.\n# open the select list at the bottom of the plugins table and choose _Delete_.\n# confirm the plugin deletion.\n\nh4. Via Composer\n\nbc. $ composer remove oui/oui_cookie\n\nh2. Tags\n\nh3(#oui_cookie). oui_cookie\n\nbc(language-markup). \u003ctxp:oui_cookie name=\"…\" /\u003e\n\nor\n\nbc(language-markup).. \u003ctxp:oui_cookie name=\"…\"\u003e\n    […]\n\u003c/txp:oui_cookie\u003e\n\nh4. Attributes\n\nh5. Required\n\n- @name@ :=\n*Value:* string; none by default.\nThe cookie (and GET/POST parmater) name you want to use. If no other attibutes are defined, the tag will read and display the related value. =:\n\nh5. Manually set a cookie\n\n- @value@ :=\n*Value:* string; none by default.\nA value to manually set the named cookie.\nYou can also set the cookie value by using a continer tag like you would for a variable. =:\n\nh5. Set a cookie through a GET/POST parameter\n\n- @values@ :=\n*Value:* comma separated list of strings; none by default.\nA comma separated list of accepted values for the GET/POST parameter and its cookie. =:\n- @default@ :=\n*Value:* string; none by default.\nA default value.\nIf set, the plugin conditional tag will always be true if not check against a defined value. =:\n- @delete@ :=\n*Value:* string; none by default.\nAn GET/POST parameter value used to delete the cookie. =:\n\nh5. Optional cookie settings\n\n- @duration@ :=\n*Value:* \"strtotime\":http://php.net/manual/fr/function.strtotime.php value, @+1 day@ by default.\nThe duration of the cookie. =:\n\nh5. Delete a cookie\n\n- @delete@ :=\n*Value:* @0@ or @1@; @0@ by default.\nIf set to @1@ this attribute will delete the named cookie. =:\n\nh3(#oui_cookie). oui_if_cookie\n\nbc(language-markup).. \u003ctxp:oui_if_cookie name=\"…\"\u003e\n    […]\n\u003ctxp:else /\u003e\n    […]\n\u003c/txp:oui_if_cookie\u003e\n\np. This tag checks the status or the value of the cookie (and/or the related GET/POST parameter) defined by the @name@ attribute.\n\nh4. Attributes\n\nh5. Required\n\n- *@name@* :=\n*Value:* string; none by default.\nThe cookie (and GET/POST parameter) name you want to use. =:\n\nh5. Optional\n\n- @value@ :=\n*Value:* string; none by default.\nA value to check against the cookie (and/or the GET/POST parameter) value. =:\n\nh2. Examples\n\nh3. Front-end articles sorting\n\nList the sort options you want to use:\n\nbc(language-html).. \u003cform action=\"#\" method=\"post\"\u003e\n    \u003cselect name=\"sort_by\"\u003e\n        \u003coption value=\"custom_1\"\u003ctxp:oui_if_cookie name=\"sort_by\" value=\"custom_1\"\u003e disabled selected\u003c/txp:oui_if_cookie\u003e\u003eSize\u003c/option\u003e\n        \u003coption value=\"custom_2\"\u003ctxp:oui_if_cookie name=\"sort_by\" value=\"custom_2\"\u003e disabled selected\u003c/txp:oui_if_cookie\u003e\u003eWeight\u003c/option\u003e\n    \u003c/select\u003e\n    \u003cinput type=\"submit\" value=\"Sort\"\u003e\n\u003c/form\u003e\n\np. Then, catch the GET/POST parameter sent by this list to store it (useful to keep the sort order pages after pages).\n\nbc(language-markup). \u003ctxp:oui_cookie name=\"sort_by\" values=\"custom_1, custom_2\" default=\"custom_1\" /\u003e\n\nNow use the new value as the value of the @sort@ attribute of your article tag.\n\nbc(language-markup). \u003ctxp:article sort='\u003ctxp:oui_cookie name=\"sort_by\" /\u003e' /\u003e\n\nh3. Last viewed article\n\nStore the current article id in a cookie:\n\nbc(language-markup). \u003ctxp:if_individual_article\u003e\n    \u003ctxp:oui_cookie name=\"last_article\" value='\u003ctxp:article_id /\u003e' /\u003e\n\u003c/txp:if_individual_article\u003e\n\nNow, use the following code anywhere you want to display the last viewed article.\n\nbc(language-markup). \u003ctxp:if_cookie name=\"last_article\"\u003e\n    \u003ctxp:article_custom id='\u003ctxp:oui_cookie name=\"last_article\" /\u003e' /\u003e\n\u003c/txp:if_cookie\u003e\n\nh3. EU cookies Warning\n\nbc(language-markup).. \u003ctxp:oui_cookie name=\"accept_cookies\" values=\"yes\" /\u003e\n\n\u003ctxp:oui_if_cookie name=\"accept_cookies\"\u003e\n\u003ctxp:else /\u003e\n    \u003cdiv id=\"cookies-warning\"\u003e\n        \u003cp\u003eThis website uses cookies. \u003ca id=\"accept_cookies\" href=\"?accept_cookies=yes\"\u003eI agree, remove this message!\u003c/a\u003e\u003c/p\u003e\n    \u003c/div\u003e\n\u003c/txp:oui_if_cookie\u003e\n\np. Now, you can add some progressive enhancement to avoid to refresh the page if javascript is on.\nHowever, note that it wouldn't instantaneously display a potential alternative content placed before the @\u003ctxp:else /\u003e@ tag if the cookie is not set/setting.\n\nbc(language-javascript).. \u003cscript\u003e\n    (function() {\n        // Get the link which should remove the warning.\n        var accept = document.getElementById('accept_cookies');\n\n        // If it exists, listen it…\n        if (accept) {\n            accept.addEventListener('click', removeWarning);\n        }\n\n        // It is clicked!\n        function removeWarning(e){\n            document.cookie = 'accept_cookies=yes;path=/;expires=864e2'; // Set the cookie for the whole domain for 1 day.\n            var warning = document.getElementById('cookies-warning'); // Get the warning message to remove.\n            warning.remove(); // Remove the message.\n            e.preventDefault(); // Do not follow the link; everything's already done!\n        };\n    }());\n\u003c/script\u003e\n\nh2. Credits\n\nh3. Author\n\n\"Nicolas Morand\":https://twitter.com/NicolasGraph\n_Thank you to the Textpattern community and the core team._\n\nh3. License\n\nThis plugin is distributed under \"GPL v2.0\":https://www.gnu.org/licenses/gpl-2.0.txt.\n\noui_cookie version 1.0.0-BETA3, Copyright (C) 2018 Nicolas Morand\nThis Textpattern plugin comes with ABSOLUTELY \"NO WARRANTY\":https://www.gnu.org/licenses/gpl-2.0.html#section11.\nThis is free software, and you are welcome to redistribute it \"under certain conditions\":https://www.gnu.org/licenses/gpl-2.0.html#SEC3.\n\nh3. Changelog\n\n* *1.0.0-beta3* (2018-07-06)\n** Changed: OOP related code rework;\n** Removed: Txp 4.5 support;\n** Adds \"Composer\":https://getcomposer.org/ support for \"textpattern/installer\":https://packagist.org/packages/textpattern/installer.\n* *0.2.3* (2016-06-21)\n** Code rewrite;\n** manual cookie setting added;\n** @display@ attribute removed (setting and reading are now separated);\n** deletion process changed.\n* *0.1.3* (2016-05-29)\n** improves conditional tag results;\n** @delete@ attribute unset by default (but any none valid value for a defined GET/POST parameter will delete the related cookie).\n* *0.1.2* (2016-05-26)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnicolasgraph%2Foui_cookie","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnicolasgraph%2Foui_cookie","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnicolasgraph%2Foui_cookie/lists"}