/** * The setup function can be used to perform setup actions on a field. * * In this case we are using it to include library files and add a validation rule * * @param object $f field * @return void */ function setup($f) { // include the recaptcha libs include_once tina_mvc_folder() . '/3rd_party/recaptcha/recaptchalib.php'; $f->add_validation(array('recaptcha' => NULL)); }
<?php /** * Pagination Helper class file * * Builds a paginated, sortable HTML table of results from data or SQL * * @package Tina-MVC * @subpackage Core */ namespace TINA_MVC; /** * Include the base class */ require_once tina_mvc_folder() . '/3rd_party/paginator/paginator.class.2.php'; /** * Pagination Helper class file * * Builds a paginated, sortable HTML table of results from SQL * * @package Tina-MVC * @subpackage Core */ class pagination extends Paginator { /** * All variables are protected. Use setters and getters to access properties. Direct * access to object properties is not supported. */ protected $sort_by, $sort_ord, $default_sort_by, $default_sort_ord, $pager_id, $sql_results, $custom_html_rows, $custom_html_headings, $suppress_sort, $do_not_allow_sort_on_these_columns;
/** * Searches for a file in the standard Tina MVC application folders * * In case of error the locations we looked in are stored in $find_app_file_error for * use in an error message later. * * @param string $filename * @param string $tina_mvc_page the page the controller is accessed through * @param string $called_from PAGE_FILTER, WIDGET, SHORTCODE, CALLABLE_CONTROLLER * @param array $find_app_file_error contains a list of places searched (for use in case of error) * @return mixed FALSE or the full path and filename to the file to be included */ function find_app_file($filename = '', $tina_mvc_page = '', $called_from = 'PAGE_FILTER', &$find_app_file_error) { $find_app_file_error = array(); $looked_for = array(); if ($called_from == 'PAGE_FILTER') { // this is left empty if a custom folder location is used if ($tina_mvc_page) { $page_folder = $tina_mvc_page . '/'; } /** * Is demo mode enabled? */ if (get_tina_mvc_setting('demo_mode')) { if (file_exists($f = plugin_folder() . "/demo/pages/tina_mvc_demo_and_docs/{$filename}")) { return $f; } $looked_for[] = $f; } if (file_exists($f = app_folder() . '/pages/' . $page_folder . $filename)) { return $f; } $looked_for[] = $f; // don't bother looking if there is no $tina_mvc_page - we've already looked in the location in the check above if ($tina_mvc_page and get_tina_mvc_setting('app_cascade')) { if (file_exists($f = app_folder() . '/pages/' . $filename)) { return $f; } $looked_for[] = $f; } if ($secondary_folder = app_folder(TRUE)) { // multisite and multisite app cascade enabled if (file_exists($f = $secondary_folder . '/pages/' . $page_folder . $filename)) { return $f; } $looked_for[] = $f; if (get_tina_mvc_setting('app_cascade')) { if (file_exists($f = $secondary_folder . '/pages/' . $filename)) { return $f; } } $looked_for[] = $f; } if (file_exists($f = tina_mvc_folder() . '/pages/' . $filename)) { return $f; } $looked_for[] = $f; } elseif ($called_from == 'WIDGET' or $called_from == 'SHORTCODE' or $called_from == 'CALLABLE_CONTROLLER') { $search_folder = strtolower($called_from) . 's'; // i.e. "widget" -> "widgets", etc if (file_exists($f = app_folder() . "/{$search_folder}/{$filename}")) { return $f; } $looked_for[] = $f; if ($secondary_folder = app_folder(TRUE)) { // multisite and multisite app cascade enabled if (file_exists($f = $secondary_folder . "/{$search_folder}/{$filename}")) { return $f; } $looked_for[] = $f; } } else { error("Invalid parameter. No action for '\$called_from' == '{$called_from}'"); } // we have an error $find_app_file_error = $looked_for; return FALSE; }