Skip to content

Commit

Permalink
simpler version without much js, just vanilla pure simple php (with s…
Browse files Browse the repository at this point in the history
…ome libs)
  • Loading branch information
synox committed Jan 8, 2018
1 parent e70f536 commit e7f3446
Show file tree
Hide file tree
Showing 47 changed files with 1,915 additions and 363 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.idea
*.patch
*.patch
node_modules
13 changes: 7 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"require": {
"php-imap/php-imap": "~2.0"
},
"config": {
"vendor-dir": "src/backend-libs"
}
"require": {
"php-imap/php-imap": "~2.0",
"gnugat/PronounceableWord": "*"
},
"config": {
"vendor-dir": "src/backend-libs"
}
}
46 changes: 44 additions & 2 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/backend-libs/autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

// autoload.php @generated by Composer

require_once __DIR__ . '/composer' . '/autoload_real.php';
require_once __DIR__ . '/composer/autoload_real.php';

return ComposerAutoloaderInit125dddd280a32cf75b181166154246ec::getLoader();
1 change: 1 addition & 0 deletions src/backend-libs/composer/autoload_namespaces.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
$baseDir = dirname(dirname($vendorDir));

return array(
'PronounceableWord_' => array($vendorDir . '/gnugat/PronounceableWord/src'),
'PhpImap' => array($vendorDir . '/php-imap/php-imap/src'),
);
4 changes: 4 additions & 0 deletions src/backend-libs/composer/autoload_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ class ComposerStaticInit125dddd280a32cf75b181166154246ec
public static $prefixesPsr0 = array (
'P' =>
array (
'PronounceableWord_' =>
array (
0 => __DIR__ . '/..' . '/gnugat/PronounceableWord/src',
),
'PhpImap' =>
array (
0 => __DIR__ . '/..' . '/php-imap/php-imap/src',
Expand Down
44 changes: 44 additions & 0 deletions src/backend-libs/composer/installed.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,49 @@
"mail",
"php"
]
},
{
"name": "gnugat/PronounceableWord",
"version": "2.0.0",
"version_normalized": "2.0.0.0",
"source": {
"type": "git",
"url": "[email protected]:gnugat/PronounceableWord.git",
"reference": "60a19dc7148e92de35ea536b9f873b86365d48f0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/gnugat/PronounceableWord/zipball/60a19dc7148e92de35ea536b9f873b86365d48f0",
"reference": "60a19dc7148e92de35ea536b9f873b86365d48f0",
"shasum": ""
},
"require": {
"php": ">=5.2"
},
"time": "2012-01-08 19:36:58",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-0": {
"PronounceableWord_": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Loïc Chardonnet"
}
],
"description": "A light, customizable and simple library generating random and pronounceable words without using dictionaries or Markov chains.",
"homepage": "https://github.com/gnugat/PronounceableWord",
"keywords": [
"generator",
"pronounceable",
"word"
],
"abandoned": true
}
]
1 change: 1 addition & 0 deletions src/backend-libs/gnugat/PronounceableWord/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/nbproject
35 changes: 35 additions & 0 deletions src/backend-libs/gnugat/PronounceableWord/CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
Change log
==========

This file will provide the main changes between each new versions.

To get the diff for a specific change, go to https://github.com/gnugat/PronounceableWord/commit/XXX
where XXX is the change hash.

To get the diff between two versions, go to https://github.com/gnugat/PronounceableWord/compare/X.Y.Z...A.B.C
where X.Y.Z and A.B.C are the tag names.

2.0.0 (2012-01-08)
------------------

* b9b3583: compatibility woth composer;
* 01a495a: using lower probability for LinkedLetters configuration;
* 8b27028: using a dependency injection container;
* 24bd26c: using dependency injection pattern;
* fe00216: complying to PSR-0 standard;
* c6c7ea1: importing documentation from wiki.

1.0.2 (2012-01-03)
------------------

* 1e34020: updating the version number.

1.0.1 (2012-01-03)
------------------

* 3af0bff: copyright extended to 2012.

1.0.0 (2011-12-17)
------------------

* a86dcea: Initial stable release.
27 changes: 27 additions & 0 deletions src/backend-libs/gnugat/PronounceableWord/LICENSE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
LICENSE
=======

License for the PronounceableWord PHP library

The MIT license
---------------

Copyright (c) 2011-2012 Loic Chardonnet

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.
107 changes: 107 additions & 0 deletions src/backend-libs/gnugat/PronounceableWord/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
PronounceableWord PHP library
=============================

A light, customizable and simple PHP (>= 5.2) library, used to generate
randomly pronounceable words, names and passwords without using database of
existing words or big samples of text like with Markov chains.

**Warning**

Offensive or insulting words might be generated because of the random nature
of the generator (see how to manage them in
``./doc/manageOffensiveAndInsultingWords.rst``).

Installation and usage
======================

First, get the last stable version, and put it in an accessible directory.

You can use composer to do so (http://packagist.org/), by adding in the
``require`` of your file ``./composer.json`` the following entry:
``"gnugat/PronounceableWord": "*"``.

You should have a fully operationnal pronounceable word generator::

<?php
// File "/index.php".
require_once dirname(__FILE__) . '/vendor/PronounceableWord/src/PronounceableWord/DependencyInjectionContainer.php';

define('MINIMUM_LENGTH', 5);
define('MAXIMUM_LENGTH', 11);

$length = rand(MINIMUM_LENGTH, MAXIMUM_LENGTH);

$container = new PronounceableWord_DependencyInjectionContainer();
$generator = $container->getGenerator();
$word = $generator->generateWordOfGivenLength($length);

Configuration
-------------

To customize the algorithm, the letters used, the linked letters or the types,
just copy and modify as you wish the files in the
``./src/PronounceableWord/Configuration`` directory and then pass your
configuration classes to the container (see how to configure in
``./doc/configuration.rst``).

Tests
-----

Tests are done using PHPUnit (https://github.com/sebastianbergmann/phpunit/)
(>=3.5) in the ``./test`` directory (see how to test in ``./doc/tests.rst``).

Examples
--------

Here is a sample of examples that can be generated (use the
``./bin/generateExamples.php`` script for more):

======= ====== ======= ======== =========
Length 5 6 7 8
======= ====== ======= ======== =========
1 vicas panori eropops absugrit
2 ramsa verifu simbous nimpiowi
3 kiclu impriar rubleru entumecu
4 posup bivary kitocra vemolior
5 utler rugisi kanomev pactabie
======= ====== ======= ======== =========

Algorithm
=========

Basically, the library will generate a word following these rules:

1. Choose randomly a letter;
2. choose randomly a linked letter of different type;
3. choose randomly a linked letter, of different type if the last letter is
of consecutive types.

Where:

* "linked letter" is an arbitrary chosen letter that is expected to follow
well the previous letter;
* "types" would be voyels and consonants;
* "consecutive" would be a group of two letters from the same "type".

The step 3 is repeated as many times as necessary.

Documentation
=============

You can find more documentation at the following links:

* Copyright and MIT license: ``./LICENSE.rst``;
* version and change log: ``./VERSION.rst`` and ``CHANGELOG.rst``;
* technical and usage documentation: ``./doc/``.

Contributing
============

1. Fork it: https://github.com/gnugat/PronounceableWord/fork_select ;
2. create a branch (``git checkout -b my_branch``);
3. commit your changes (``git commit -am "Changes description message"``);
4. push to the branch (``git push origin my_branch``);
5. create an Issue (https://github.com/gnugat/PronounceableWord/issues) with a
link to your branch;
6. wait for it to be accepted/argued.
10 changes: 10 additions & 0 deletions src/backend-libs/gnugat/PronounceableWord/VERSION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
VERSION
=======

The purpose of this file is to point out the version of the PronounceableWord
library.

Current version
---------------

2.0.0
26 changes: 26 additions & 0 deletions src/backend-libs/gnugat/PronounceableWord/bin/generateExamples.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env php

<?php
/*
* This file is part of the PronounceableWord library.
*
* (c) Loic Chardonnet
*
* For the full copyright and license information, please view the LICENSE.txt
* file that was distributed with this source code.
*/

require_once dirname(__FILE__) . '/../src/PronounceableWord/DependencyInjectionContainer.php';

define('MINIMUM_LENGTH', 4);
define('MAXIMUM_LENGTH', 9);

$container = new PronounceableWord_DependencyInjectionContainer();
$generator = $container->getGenerator();

$maximumGenerationNumber = 20;
for ($generationNumber = 0; $generationNumber < $maximumGenerationNumber; $generationNumber++) {
$length = rand(MINIMUM_LENGTH, MAXIMUM_LENGTH);

echo $generator->generateWordOfGivenLength($length) . "\n";
}
21 changes: 21 additions & 0 deletions src/backend-libs/gnugat/PronounceableWord/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "gnugat/PronounceableWord",
"type": "library",
"description": "A light, customizable and simple library generating random and pronounceable words without using dictionaries or Markov chains.",
"keywords": ["generator", "pronounceable", "word"],
"homepage": "https://github.com/gnugat/PronounceableWord",
"license": "MIT",
"authors": [
{
"name": "Loic Chardonnet"
}
],
"require": {
"php": ">=5.2"
},
"autoload": {
"psr-0": {
"PronounceableWord_": "src/"
}
}
}
Loading

0 comments on commit e7f3446

Please sign in to comment.