Skip to content
Snippets Groups Projects
Commit d28eacb9 authored by Liam Morland's avatar Liam Morland
Browse files

Issue #2877483: Coding standards

parent 9c95d6ee
No related branches found
No related tags found
No related merge requests found
Installation
------------
See the full installation documentation on drupal.org: https://drupal.org/node/1431610
See the full installation documentation on drupal.org:
https://drupal.org/node/1431610
......@@ -105,6 +105,7 @@ function fillpdf_settings($form, &$form_state) {
* Suitable for use with FAPI radio buttons.
*
* @return array
* Array of acceptable file scheme options as identifyer => translated title.
*/
function _fillpdf_scheme_options() {
return array(
......@@ -209,7 +210,8 @@ function fillpdf_forms_admin_validate($form, &$form_state) {
*
*/
function _fillpdf_validate_upload($file) {
// From includes/file.inc, line 634, but can't use that function because file not an object yet.
// From includes/file.inc, line 634, but can't use that function because file
// not an object yet.
if (!preg_match('/\.pdf$/i', $file)) {
return array(
'#error' => TRUE,
......@@ -282,7 +284,8 @@ function _fillpdf_save_upload($form_key, $fid = NULL) {
return $fid;
}
else {
// Commented out because even though error if file doesn't upload right, not error if they dont' upload a file (& this is still triggered).
// Commented out because even though error if file doesn't upload right, not
// error if they dont' upload a file (& this is still triggered).
drupal_set_message(t('Error saving file to @destination', array('@destination' => $destination)), 'error');
}
}
......@@ -345,10 +348,10 @@ function fillpdf_form_edit($form, &$form_state, $fid) {
'#default_value' => $pdf_form->default_nid,
);
// @todo:
// They can upload a PDF any time, but fields will only be generated on add. Don't want to purge existing fields,
// however a user might have accidently uploaded an old template and discover much later (if it's substantially different, just
// create a new Form
// @todo: They can upload a PDF any time, but fields will only be generated on
// add. Don't want to purge existing fields, however a user might have
// accidently uploaded an old template and discover much later (if it's
// substantially different, just create a new Form.
$form['pdf_info'] = array(
'#type' => 'fieldset',
'#title' => 'PDF Form information',
......@@ -381,7 +384,7 @@ function fillpdf_form_edit($form, &$form_state, $fid) {
$form['pdf_info']['form_id'] = array(
'#type' => 'item',
'#title' => 'Form Info',
'#description' => "Form ID: [$fid]. Populate this form with node IDs, such as /fillpdf?fid=$fid&nid=10<br/>",
'#description' => "Form ID: [$fid]. Populate this form with node IDs, such as /fillpdf?fid=$fid&nid=10<br/>",
);
$form['extra'] = array(
'#type' => 'fieldset',
......@@ -457,10 +460,15 @@ function fillpdf_form_edit($form, &$form_state, $fid) {
// @todo: order by weight, and add dragable ala http://www.computerminds.co.uk/quick-guide-using-drupal-add-tabledrag-and-enjoying-jquery-drag-and-drop-loveliness
$q = db_query('SELECT * FROM {fillpdf_fields} WHERE fid = :fid', array(':fid' => $fid));
$header = array(t('Label'), t('PDF-field key'), t('Prefix'), t('Value'), t('Suffix'), t('Transformed'), array(
'data' => t('Operations'),
'colspan' => 2,
));
$header = array(
t('Label'),
t('PDF-field key'),
t('Prefix'),
t('Value'),
t('Suffix'),
t('Transformed'),
array('data' => t('Operations'), 'colspan' => 2),
);
$rows = array();
foreach ($q as $field) {
$row = array(
......@@ -605,8 +613,9 @@ function fillpdf_form_delete_confirm_submit($form, &$form_state) {
/**
* Export an importable array of PDF field key -> Label, Value mappings.
* The array key is the PDF field key and the value is another array containing the label and
* the value (properly keyed).
*
* The array key is the PDF field key and the value is another array containing
* the label and the value (properly keyed).
*
* @param mixed $pdf_form
* The FillPDF form ID.
......@@ -657,8 +666,11 @@ function fillpdf_export_form($form, $form_state, $code) {
}
/**
* Based loosely on Node Export's import form. Import the code and configure the DB settings.
* Import the code and configure the DB settings.
*
* Based loosely on Node Export's import form.
*
* @param mixed $form
* @param mixed $form_state
* @param mixed $pdf_form
*/
......@@ -801,7 +813,7 @@ function fillpdf_field_edit($form, &$form_state, $pdf_form, $field) {
'#type' => 'textarea',
'#title' => t('Prefix'),
'#default_value' => $field->prefix,
'#description' => t('<p>If there is some text you always want to appear before the main value if it isn\'t empty, enter it here. <strong>This value only appears if the token pattern in <em>Value</em> doesn\'t result in blank text.</strong></p>'),
'#description' => t("<p>If there is some text you always want to appear before the main value if it isn't empty, enter it here. <strong>This value only appears if the token pattern in <em>Value</em> doesn't result in blank text.</strong></p>"),
'#weight' => 3,
);
$form['value'] = array(
......@@ -827,7 +839,7 @@ function fillpdf_field_edit($form, &$form_state, $pdf_form, $field) {
'#type' => 'textarea',
'#title' => t('Suffix'),
'#default_value' => $field->suffix,
'#description' => t('<p>If there is some text you always want to appear after the main value if it isn\'t empty, enter it here. <strong>This value only appears if the token pattern in <em>Value</em> doesn\'t result in blank text.</strong></p>'),
'#description' => t("<p>If there is some text you always want to appear after the main value if it isn't empty, enter it here. <strong>This value only appears if the token pattern in <em>Value</em> doesn't result in blank text.</strong></p>"),
'#weight' => 6,
);
$form['extra'] = array(
......@@ -876,7 +888,14 @@ function fillpdf_field_edit_submit($form, &$form_state) {
*
*/
function _fillpdf_admin_token_form() {
$token_types = array('node', 'webform-tokens', 'submission', 'uc_order', 'uc_order_product', 'random');
$token_types = array(
'node',
'webform-tokens',
'submission',
'uc_order',
'uc_order_product',
'random',
);
// If not using Webform Rules, then show potential Webform Tokens
// webform:-namespaced tokens.
......
......@@ -8,15 +8,13 @@
/**
* Figure out what to do with the PDF and do it.
*
* @deprecated fillpdf_merge_execute_pdf_action().
*
* @param object $pdf_info
* An object containing the loaded record from {fillpdf_forms}.
* @param string $pdf_data
* A string containing the content of the merged PDF.
* @param array $token_objects
* An array of objects to be used in replacing tokens. Here, specifically,
* it's for generating the filename of the handled PDF.
* An array|null of objects to be used in replacing tokens. Here,
* specifically, it's for generating the filename of the handled PDF.
* @param string $action
* One of the following keywords: default, download, save, redirect. These
* correspond to performing the configured action (from
......@@ -28,6 +26,8 @@
* to the user's browser.
*
* @throws Exception
*
* @deprecated Use fillpdf_merge_execute_pdf_action() instead.
*/
function fillpdf_merge_handle_pdf($pdf_info, $pdf_data, $token_objects, $action = 'download', $force_download = FALSE) {
if ($pdf_info->scheme === 'private') {
......@@ -81,21 +81,23 @@ function fillpdf_merge_handle_pdf($pdf_info, $pdf_data, $token_objects, $action
}
/**
* @deprecated Use fillpdf_action_save_to_file() instead.
* Saves a PDF to a file.
*
* @param object $pdf_info
* @param string $pdf_data
* @param array $token_objects
* @param $output_name
* @param string $output_name
* @param bool $redirect
* @param bool $redirect_to_file
* @param null $destination_path_override
* @param string|null $destination_path_override
*
* @return bool|string|void
* Nothing (if redirected), the path to the file (if saving the file
* succeeded), or FALSE (if it didn't).
*
* @throws \Exception
*
* @deprecated Use fillpdf_action_save_to_file() instead.
*/
function fillpdf_save_to_file($pdf_info, $pdf_data, $token_objects, $output_name, $redirect = TRUE, $redirect_to_file = FALSE, $destination_path_override = NULL) {
if ($pdf_info->scheme === 'private') {
......
......@@ -128,8 +128,10 @@ function fillpdf_install() {
}
/**
* Allow anyone to fill Completed orders by default, subject to having other
* required permissions such as view own orders. Only do this once, ever.
* Allow anyone to fill Completed orders by default.
*
* This is subject to having other required permissions such as view own orders.
* Only do this once, ever.
*/
function _fillpdf_add_publish_completed_orders_permission() {
if (module_exists('uc_order') && module_exists('user') && !variable_get('fillpdf_uc_order_initialized', FALSE)) {
......@@ -188,7 +190,7 @@ function fillpdf_update_7002() {
}
/**
* Convert legacy configuration variables to new fillpdf_service variable and delete.
* Convert legacy config variables to new fillpdf_service variable and delete.
*/
function fillpdf_update_7003() {
$default = FALSE;
......@@ -255,8 +257,9 @@ function fillpdf_update_7101() {
}
/**
* Let all roles use completed order data to fill PDFs by default,
* assuming they otherwise are allowed.
* Let all roles use completed order data to fill PDFs by default.
*
* This is assuming they otherwise are allowed.
*/
function fillpdf_update_7102() {
_fillpdf_add_publish_completed_orders_permission();
......@@ -327,10 +330,12 @@ function fillpdf_update_7106() {
}
/**
* Load a context object.
*
* @param int $fcid
* The fcid of the context object to load.
*
* @return stdClass|bool
* @return object|bool
* Returns the decoded context object or FALSE if the fcid cannot be found.
*/
function _fillpdf_old_file_context_load($fcid) {
......
This diff is collapsed.
......@@ -203,7 +203,9 @@ function fillpdf_rules_action_save_to_file($fillpdf) {
}
/**
* Perform the default action on the PDF. This always ends in a drupal_goto() or a drupal_exit().
* Perform the default action on the PDF.
*
* This always ends in a drupal_goto() or a drupal_exit().
*/
function fillpdf_rules_action_handle_default($fillpdf) {
fillpdf_merge_perform_pdf_action($fillpdf, 'default');
......
......@@ -2,6 +2,8 @@
/**
* @file
* Provides additional tokens for use in FillPDF mappings.
*
* This module is intended to provide token support for token types that we need
* but aren't available in the module from which the data comes yet. This is a
* rare need, and currently this module only needs to be enabled for Ubercart
......
......@@ -11,7 +11,7 @@
function fillpdf_ubercart_starter_field_default_field_bases() {
$field_bases = array();
// Exported field_base: 'field_fillpdf_fid'
// Exported field_base: 'field_fillpdf_fid'.
$field_bases['field_fillpdf_fid'] = array(
'active' => 1,
'cardinality' => 1,
......
......@@ -11,7 +11,7 @@
function fillpdf_ubercart_starter_field_default_field_instances() {
$field_instances = array();
// Exported field_instance: 'node-product-field_fillpdf_fid'
// Exported field_instance: 'node-product-field_fillpdf_fid'.
$field_instances['node-product-field_fillpdf_fid'] = array(
'bundle' => 'product',
'default_value' => NULL,
......
<?php
/**
* @file
* Drupal needs this blank file.
......
<?php
/**
* @file
* fillpdf_ubercart_starter.rules_defaults.inc
......
<?php
/**
* @file
* Module fillpdf_test.
*/
/**
* Implements hook_node_access().
*/
......
......@@ -14,7 +14,8 @@
* @param array $info
* Key/value pairs of the field data.
* @param string $enc
* The character encoding. Must match server output: default_charset in php.ini.
* The character encoding. Must match server output: default_charset in
* php.ini.
*
* @return string
* The contents of the XFDF file.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment