1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-11 17:24:46 +02:00

Initial commit to new repo (carried over from: https://github.com/ryancramerdesign/ProcessWire/tree/devns)

This commit is contained in:
Ryan Cramer
2016-09-02 14:55:17 -04:00
parent cfae5fc6f3
commit bac5b0de5d
1691 changed files with 279091 additions and 1 deletions

View File

@@ -0,0 +1,122 @@
<?php namespace ProcessWire;
/**
* ProcessWire 'Hello world' demonstration module
*
* Demonstrates the Module interface and how to add hooks.
*
* See README file for further links regarding module development.
*
* This file is licensed under the MIT license
* https://processwire.com/about/license/mit/
*
* ProcessWire 3.x, Copyright 2016 by Ryan Cramer
* https://processwire.com
*
*/
class Helloworld extends WireData implements Module {
/**
* getModuleInfo is a module required by all modules to tell ProcessWire about them
*
* @return array
*
*/
public static function getModuleInfo() {
return array(
// The module'ss title, typically a little more descriptive than the class name
'title' => 'Hello World',
// version number
'version' => 2,
// summary is brief description of what this module is
'summary' => 'An example module used for demonstration purposes. See the /site/modules/Helloworld.module file for details.',
// Optional URL to more information about the module
'href' => 'http://processwire.com',
// singular=true: indicates that only one instance of the module is allowed.
// This is usually what you want for modules that attach hooks.
'singular' => true,
// autoload=true: indicates the module should be started with ProcessWire.
// This is necessary for any modules that attach runtime hooks, otherwise those
// hooks won't get attached unless some other code calls the module on it's own.
// Note that autoload modules are almost always also 'singular' (seen above).
'autoload' => true,
// Optional font-awesome icon name, minus the 'fa-' part
'icon' => 'smile-o',
);
}
/**
* Initialize the module
*
* ProcessWire calls this when the module is loaded. For 'autoload' modules, this will be called
* when ProcessWire's API is ready. As a result, this is a good place to attach hooks.
*
*/
public function init() {
// add a hook after the $pages->save, to issue a notice every time a page is saved
$this->pages->addHookAfter('save', $this, 'example1');
// add a hook after each page is rendered and modify the output
$this->addHookAfter('Page::render', $this, 'example2');
// add a 'hello' method to every page that returns "Hello World"
// use "echo $page->hello();" in your template file to display output
$this->addHook('Page::hello', $this, 'example3');
// add a 'hello_world' property to every page that returns "Hello [user]"
// use "echo $page->hello_world;" in your template file to display output
$this->addHookProperty('Page::hello_world', $this, 'example4');
}
/**
* Example1 hooks into the pages->save method and displays a notice every time a page is saved
*
*/
public function example1($event) {
$page = $event->arguments[0];
$this->message("Hello World! You saved {$page->path}.");
}
/**
* Example2 hooks into every page after it's rendered and adds "Hello World" text at the bottom
*
*/
public function example2($event) {
$page = $event->object;
// don't add this to the admin pages
if($page->template == 'admin') return;
// add a "Hello World" paragraph right before the closing body tag
$event->return = str_replace("</body>", "<p>Hello World!</p></body>", $event->return);
}
/**
* Example3 adds a 'hello' method (not property) to every page that simply returns "Hello World"
*
*/
public function example3($event) {
$event->return = "Hello World";
}
/**
* Example 4 adds a 'hello_world' property (not method) to every page that returns "Hello [user]"
*
*/
public function example4($event) {
$event->return = "Hello " . $this->user->name;
}
}

View File

@@ -0,0 +1,40 @@
This InputfieldCKEditor directory is here to provide optional extra configuration options
and plugins to the CKEditor Inputfield module.
plugins/
========
Directory to place additional CKEditor plugins in. You can then activate them
from your CKEditor field settings.
contents.css
============
Example CSS file for the admin editor. To make CKEditor use this file, go to your CKEditor
field settings and specify /site/modules/InputfieldCKEditor/contents.css as the regular
mode Contents CSS file.
contents-inline.css
===================
Same as contents.css but for the inline mode editor.
mystyles.js
===========
Optional configuration for the CKEditor Styles option. To use this file, go to your
CKEditor field settings and set the Custom Styles Set to be this file.
config.js
=========
Custom config file used by all CKEditor instances (except instances configured by their
own custom config file, see below...)
config-body.js
==============
Example of field-specific custom config file. This one applies to a field named "body".
Note that these config settings can also be specified directly in your CKEditor field
settings in the admin, which many may prefer.

View File

@@ -0,0 +1,24 @@
/**
* CKEditor field-specific (body) custom config file for ProcessWire
*
* Use this file to specify additional config options to a field named "body".
* This is here just for example purposes. If you wanted to create a config
* specific to some other field, like "sidebar", you would create another file
* exactly like this named: config-sidebar.js
*
* If you wanted to use the same config.js for all of your CKEditor fields,
* you would remove this file and just use the config.js file instead. Meaning,
* this file completely overrides config.js if the field being edited is named
* "body". The regular config.js file is not loaded when this one is loaded.
*
*/
/**
* @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.editorConfig = function( config ) {
// Define changes to default configuration here. For example:
// config.uiColor = '#AADC6E';
};

View File

@@ -0,0 +1,18 @@
/**
* CKEditor custom config file for ProcessWire
*
* Use this file to specify additional config options to all CKEditor instances,
* except those that have field-specific config files, i.e. config-body.js for
* config specific to a field named "body".
*
*/
/**
* @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.editorConfig = function( config ) {
// Define changes to default configuration here. For example:
// config.uiColor = '#AADC6E';
};

View File

@@ -0,0 +1,121 @@
/**
* contents-inline.css
*
* CKEditor editor styles for inline mode editor
*
* See also: contents-inline.scss
*
* PLEASE NOTE:
*
* It's possible this file may be out of date since it is in /site/ rather than /wire/,
* and the version of this file will reflect whatever version you had when you first
* installed this copy of ProcessWire.
*
* If you intend to use this, you may first want to get the newest copy out of:
* /wire/modules/Inputfield/InputfieldCKEditor/contents-inline.css
*
* Original file copyright (as included with CKEditor):
* Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.html or http://ckeditor.com/license
*
*/
.InputfieldForm .InputfieldCKEditorInline {
font-family: Arial, sans-serif;
}
.InputfieldForm .InputfieldCKEditorInline p,
.InputfieldForm .InputfieldCKEditorInline li,
.InputfieldForm .InputfieldCKEditorInline dl,
.InputfieldForm .InputfieldCKEditorInline td {
font-size: 1em;
color: #333333;
background: white;
}
.InputfieldForm .InputfieldCKEditorInline a {
color: #444444;
background: none;
text-decoration: underline;
}
.InputfieldForm .InputfieldCKEditorInline a:hover {
color: #222222;
background: #ffffdd;
}
.InputfieldForm .InputfieldCKEditorInline i,
.InputfieldForm .InputfieldCKEditorInline em {
font-style: italic;
}
.InputfieldForm .InputfieldCKEditorInline b,
.InputfieldForm .InputfieldCKEditorInline strong {
font-weight: bold;
}
.InputfieldForm .InputfieldCKEditorInline strong em,
.InputfieldForm .InputfieldCKEditorInline em strong {
font-weight: bold;
font-style: italic;
}
.InputfieldForm .InputfieldCKEditorInline small {
font-size: 0.875em;
}
.InputfieldForm .InputfieldCKEditorInline pre,
.InputfieldForm .InputfieldCKEditorInline code {
font-family: Menlo, Monaco, 'Andale Mono', 'Lucida Console', 'Courier New', monospace;
}
.InputfieldForm .InputfieldCKEditorInline code {
display: inline;
background: #fff2a8;
}
.InputfieldForm .InputfieldCKEditorInline ul li,
.InputfieldForm .InputfieldCKEditorInline ol li {
list-style: disc;
display: list-item;
margin: 0 0 0 2em;
}
.InputfieldForm .InputfieldCKEditorInline ol li {
list-style: decimal;
}
.InputfieldForm .InputfieldCKEditorInline blockquote {
padding-left: 1em;
border-left: 3px solid #ccc;
}
.InputfieldForm .InputfieldCKEditorInline h1,
.InputfieldForm .InputfieldCKEditorInline h2,
.InputfieldForm .InputfieldCKEditorInline h3,
.InputfieldForm .InputfieldCKEditorInline h4,
.InputfieldForm .InputfieldCKEditorInline h5 {
color: #222222;
font-family: Arial, sans-serif;
font-weight: normal;
text-transform: none;
}
.InputfieldForm .InputfieldCKEditorInline h1 {
font-size: 2.0em;
}
.InputfieldForm .InputfieldCKEditorInline h2 {
font-size: 1.7em;
}
.InputfieldForm .InputfieldCKEditorInline h3 {
font-size: 1.5em;
}
.InputfieldForm .InputfieldCKEditorInline h4 {
font-size: 1.3em;
}
.InputfieldForm .InputfieldCKEditorInline h5 {
font-size: 1.2em;
}
.InputfieldForm .InputfieldCKEditorInline h6 {
font-size: 1.1em;
}
.InputfieldForm .InputfieldCKEditorInline table td,
.InputfieldForm .InputfieldCKEditorInline table th {
padding: 3px;
}
.InputfieldForm .InputfieldCKEditorInline table th {
font-weight: bold;
}
.InputfieldForm .InputfieldCKEditorInline img {
max-width: 100%;
}
.InputfieldForm .InputfieldCKEditorInline img.cke_anchor {
display: inline;
}

View File

@@ -0,0 +1,169 @@
/**
* contents.css
*
* CKEditor editor styles for regular (non-inline) editor
* See contents-inline.css for inline editor styles.
*
* Note that this file is not in use unless you configure your editor settings to use it
* in the "Custom Editor CSS File (regular mode)" option. As a result, this file is here
* primarily as a placeholder and for instructions, though you may certainly modify and
* use it as-is.
*
* PLEASE NOTE:
*
* It's possible this file may be out of date since it is in /site/ rather than /wire/,
* and the version of this file will reflect whatever version you had when you first
* installed this copy of ProcessWire.
*
* If you intend to use this, you may first want to get the newest copy out of:
* /wire/modules/Inputfield/InputfieldCKEditor/contents.css
*
* Original file copyright (as included with CKEditor):
* Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.html or http://ckeditor.com/license
*
*/
body {
/* Font */
font-family: sans-serif, Arial, Verdana, "Trebuchet MS";
font-size: 14px;
/* Text color */
color: #333;
/* Remove the background color to make it transparent */
background-color: #fff;
margin: 10px;
}
.cke_editable {
font-size: 14px;
line-height: 1.6em;
}
blockquote {
font-style: italic;
font-family: Georgia, Times, "Times New Roman", serif;
padding: 2px 0;
border-style: solid;
border-color: #ccc;
border-width: 0;
}
.cke_contents_ltr blockquote {
padding-left: 20px;
padding-right: 8px;
border-left-width: 5px;
}
.cke_contents_rtl blockquote {
padding-left: 8px;
padding-right: 20px;
border-right-width: 5px;
}
a {
color: #0782C1;
}
ol,ul,dl {
/* IE7: reset rtl list margin. (#7334) */
*margin-right: 0px;
/* preserved spaces for list items with text direction other than the list. (#6249,#8049)*/
padding: 0 40px;
}
h1,h2,h3,h4,h5,h6 {
font-weight: bold;
line-height: 1.2em;
}
hr {
border: 0px;
border-top: 1px solid #ccc;
}
img {
max-width: 100%;
}
img.right,
img.align_right,
img.align-right {
/* RCD */
border: 1px solid #ccc;
float: right;
margin-left: 15px;
padding: 5px;
}
img.left,
img.align_left,
img.align-left {
/* RCD */
border: 1px solid #ccc;
float: left;
margin-right: 15px;
padding: 5px;
}
img.align_center,
img.align-center {
/* RCD */
display: block;
margin-left: auto;
margin-right: auto;
}
img:hover {
opacity: .9;
filter: alpha(opacity = 90);
}
pre {
white-space: pre-wrap;
word-wrap: break-word;
-moz-tab-size: 4;
-o-tab-size: 4;
-webkit-tab-size: 4;
tab-size: 4;
}
.marker {
background-color: Yellow;
}
span[lang] {
font-style: italic;
}
figure {
text-align: center;
border: solid 1px #ccc;
border-radius: 2px;
background: rgba(0,0,0,0.05);
padding: 10px;
margin: 10px 20px;
display: inline-block;
}
figure > figcaption {
text-align: center;
display: block; /* For IE8 */
}
code {
/* RCD */
background: #fff2a8;
}
a > img {
padding: 1px;
margin: 1px;
border: none;
outline: 1px solid #0782C1;
}

View File

@@ -0,0 +1,32 @@
/**
* mystyles.js - for ProcessWire CKEditor "Custom Editor Styles Set" option
*
* Example file for "Custom Editor Styles Set" as seen in your CKEditor field config.
* This file is not in use unless you specify it for that configuration item.
*
* PLEASE NOTE:
*
* It's possible this file may be out of date since it is in /site/ rather than /wire/,
* and the version of this file will reflect whatever version you had when you first
* installed this copy of ProcessWire.
*
* If you intend to use this, you may first want to get the newest copy out of:
* /wire/modules/Inputfield/InputfieldCKEditor/mystyles.js
*
* For a more comprehensive example, see:
* /wire/modules/Inputfield/InputfieldCKEditor/ckeditor-[version]/styles.js
*
*/
CKEDITOR.stylesSet.add( 'mystyles', [
{ name: 'Inline Code', element: 'code' },
{ name: 'Inline Quotation', element: 'q' },
{ name: 'Left Aligned Photo', element: 'img', attributes: { 'class': 'align_left' } },
{ name: 'Right Aligned Photo', element: 'img', attributes: { 'class': 'align_right' } },
{ name: 'Centered Photo', element: 'img', attributes: { 'class': 'align_center' } },
{ name: 'Small', element: 'small' },
{ name: 'Deleted Text', element: 'del' },
{ name: 'Inserted Text', element: 'ins' },
{ name: 'Cited Work', element: 'cite' }
]);

View File

@@ -0,0 +1,3 @@
Directory to place additional CKEditor plugins in. You can then activate them
from your CKEditor field settings. Place each plugin in its own directory
having the same name as the plugin.

View File

@@ -0,0 +1,88 @@
ABOUT /SITE/MODULES/
====================
This directory /site/modules/ is where you may install additional plugin modules.
These modules are specific to your site only. There is also a corresponding
/wire/modules/ directory, which contains ProcessWire's core modules (and best to
leave those alone).
If safe for your hosting environment, you may wish to make this directory
writable to PHP so that the installation of your modules can be managed from
ProcessWire's admin. However, this is not necessarily safe in all shared hosting
environments and is completely optional.
Where to get modules?
---------------------
Visit the modules directory at: http://modules.processwire.com
Installing modules from the ProcessWire admin
---------------------------------------------
If your /site/modules/ directory is writable, you can install modules from
ProcessWire's admin directly from the Modules Directory, from a ZIP file or from
a URL to a ZIP file. In your ProcessWire admin, see Modules > New for
installation options.
Installing modules from the file system
---------------------------------------
Each module (and any related files) should live in a directory of its own. The
directory should generally carry the same name as the module. For instance, if
you are installing a module named ProcessDatabaseBackups.module, then it should
live in the directory /site/modules/ProcessDatabaseBackups/.
Once you have placed a new module in this directory, you need to let ProcessWire
know about it. Login to the admin and click "Modules". Then click the "Check for
new modules" button. It will find your new module(s). Click the "Install" button
next to any new modules that you want to install.
Removing modules
----------------
The first step in removing a module is to uninstall it from ProcessWire (if it
isn't already). You do this by going to the "Modules" page, and "Site" tab in
your ProcessWire admin. Click the "Uninstall" button next to the module you
want to remove.
After the module is uninstalled, you may remove the module files. If your
modules file system is writable to ProcessWire, it will give you a "Delete"
button next to the module in your "Modules" admin page. You may click that to
remove the module files.
If your file system is not writable, you may remove the module files manually
from the file system (via SFTP or whatever tool you are using to manage your
files on the server).
Interested in learning how to make your own modules?
----------------------------------------------------
We've created two "Hello World" modules as examples for those interested in
learning module development:
- Helloworld.module demonstrates the basics of modules and hooks.
http://modules.processwire.com/modules/helloworld/
- ProcessHello.module demonstrates the basics of how to create a Process
module. Process modules are those that create applications in the admin.
http://modules.processwire.com/modules/process-hello/
There is a module development forum located at:
https://processwire.com/talk/forum/19-moduleplugin-development/
For a tutorial on how to create modules, see:
http://wiki.processwire.com/index.php/Module_Creation
Additional resources
--------------------
To find and download new modules, see the modules directory at:
http://modules.processwire.com/
For more information about modules, see the documentation at:
http://processwire.com/api/modules/
For discussion and support of modules, see:
http://processwire.com/talk/forum/4-modulesplugins/