Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added the EE2 version.

  • Loading branch information...
commit aac8be6165b4beddd618f18882e61ad15ac6b47d 1 parent 870b073
benjamin authored
View
0  js/jquery.charcounter.js → EE1/js/jquery.charcounter.js
File renamed without changes
View
0  extensions/ext.md_character_count.php → ...tem/extensions/ext.md_character_count.php
File renamed without changes
View
0  language/english/lang.md_character_count.php → ...guage/english/lang.md_character_count.php
File renamed without changes
View
483 EE2/system/expressionengine/third_party/md_character_count/ext.md_character_count.php
@@ -0,0 +1,483 @@
+<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+
+/**
+ * ExpressionEngine - by EllisLab
+ *
+ * @package ExpressionEngine
+ * @author ExpressionEngine Dev Team
+ * @copyright Copyright (c) 2003 - 2011, EllisLab, Inc.
+ * @license http://expressionengine.com/user_guide/license.html
+ * @link http://expressionengine.com
+ * @since Version 2.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * MD Character Count Extension
+ *
+ * @package ExpressionEngine
+ * @subpackage Addons
+ * @category Extension
+ * @author Benjamin Kohl
+ * @link
+ */
+
+// TODO : the 'addslashes' and 'stripslashes' were causing errors in the unserialization. Look into an alternative.
+
+class Md_character_count_ext {
+
+ public $settings = array();
+ public $description = 'Add a customizable character count to CP publish form fields (Textareas, text inputs and MD Markitup fields)';
+ public $docs_url = '';
+ public $name = 'MD Character Count';
+ public $settings_exist = 'y';
+ public $version = '2.0';
+
+ private $EE;
+
+ // ----------------------------------------------------------------------
+
+ /**
+ * Constructor
+ *
+ * @param mixed Settings array or empty string if none exist.
+ */
+ public function __construct($settings = '')
+ {
+ $this->EE =& get_instance();
+
+ if(isset($this->EE->session->cache['mdesign']) === FALSE)
+ $this->EE->session->cache['mdesign'] = array();
+
+ if ( ! defined('MD_CC_version')){
+ define("MD_CC_version", "1.0.5");
+ define("MD_CC_docs_url", "http://masugadesign.com/the-lab/scripts/md-character-count/");
+ define("MD_CC_addon_id", "MD Character Count");
+ define("MD_CC_extension_class", "Md_character_count_ext");
+ define("MD_CC_cache_name", "mdesign_cache");
+ }
+
+ $this->settings = $this->_get_settings();
+ $this->debug = $this->EE->input->get_post('debug');
+ }
+
+ // ----------------------------------------------------------------------
+
+ /**
+ * Get the site specific settings from the extensions table
+ *
+ * @param $force_refresh bool Get the settings from the DB even if they are in the session
+ * @param $return_all bool Return the full array of settings for the installation rather than just this site
+ * @return array If settings are found otherwise false. Site settings are returned by default.
+ * Installation settings can be returned is $return_all is set to true
+ * @since Version 2.0.0
+ */
+ protected function _get_settings($force_refresh = FALSE, $return_all = FALSE)
+ {
+ // assume there are no settings
+ $settings = FALSE;
+ $this->EE->load->helper('string'); // For 'strip_slashes'
+
+ // Get the settings for the extension
+ if(isset($this->EE->session->cache['mdesign'][MD_CC_addon_id]['settings']) === FALSE || $force_refresh === TRUE)
+ {
+ // check the db for extension settings
+ $this->EE->db->select('settings');
+ $query = $this->EE->db->get_where("exp_extensions", array('enabled' => 'y', 'class' => MD_CC_extension_class), 1);
+ // if there is a row and the row has settings
+ if ($query->num_rows > 0 && $query->row('settings') != '')
+ {
+ // save them to the cache
+ $this->EE->session->cache['mdesign'][MD_CC_addon_id]['settings'] = unserialize($query->row('settings'));
+ }
+ }
+
+ // check to see if the session has been set
+ // if it has return the session
+ // if not return false
+ if(empty($this->EE->session->cache['mdesign'][MD_CC_addon_id]['settings']) !== TRUE)
+ {
+ @$settings = ($return_all === TRUE) ? $this->EE->session->cache['mdesign'][MD_CC_addon_id]['settings'] : $this->EE->session->cache['mdesign'][MD_CC_addon_id]['settings'][$this->EE->config->item('site_id')];
+ }
+ return $settings;
+ }
+
+ // ----------------------------------------------------------------------
+
+ /**
+ * Returns the default settings for this extension
+ * This is used when the extension is activated or when a new site is installed
+ * It returns the default settings for the CURRENT site only.
+ */
+ function _build_default_settings()
+ {
+
+ $default_settings = array(
+ 'enable' => 'y',
+ 'field_defaults' => array(),
+ 'jquery_core_path' => "http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js",
+ 'charcounter_plugin_path' => $this->EE->config->item('site_url')."/js/jquery.charcounter.js",
+ 'check_for_updates' => 'y',
+ 'css' => '
+.charcounter {
+ font-size: 11px;
+ float: left;
+ clear: left;
+ padding: 6px 0 0 2px;
+ }
+
+.charcounter_err {
+ color: #933;
+ font-weight: bold;
+ }'
+
+ );
+
+ // get all the sites
+ $query = $this->EE->db->get_where("exp_channels", array("site_id" => $this->EE->config->item('site_id')));
+
+ // if there are channels
+ if ($query->num_rows() > 0)
+ {
+ // for each of the channelss
+ foreach($query->result() as $row)
+ {
+ // duplicate the default settings for this site
+ // that way nothing will break unexpectedly
+ $default_settings['field_defaults'][$row->site_id][$row->channel_id] = array(
+ 'count_max' => '',
+ 'count_type' => 'false', //a string
+ 'count_format' => ''
+ );
+ }
+ }
+ return $default_settings;
+ }
+
+ // ----------------------------------------------------------------------
+
+ /**
+ * Settings Form (written much like a controller action with a view)
+ *
+ * @param Array Settings
+ * @return void
+ */
+ public function settings_form($current)
+ {
+ $this->EE->load->helper('html');
+ $this->EE->load->helper('form');
+
+ $settings = $this->_get_settings();
+
+ $query = $this->EE->db->query("SELECT c.field_id, g.group_name, c.field_label, c.site_id FROM exp_channel_fields c, exp_field_groups g WHERE c.site_id = ".
+ $this->EE->config->item('site_id')." AND c.group_id = g.group_id AND field_type IN ( 'textarea', 'text', 'markitup' ) ORDER BY g.group_id, c.field_order");
+
+ $channel_fields = $query->result();
+
+ $values = array(
+ 'ext_settings' => $settings,
+ 'version_number' => $this->version,
+ 'channel_fields' => $channel_fields,
+ 'lang_extension_title' => $this->EE->lang->line('extension_title'),
+ 'lang_access_rights' => $this->EE->lang->line('access_rights'),
+ 'lang_enable_ext' => $this->EE->lang->line('enable_extension_for_this_site'),
+ 'lang_scripts_title' => $this->EE->lang->line('scripts_title'),
+ 'lang_scripts_info' => $this->EE->lang->line('scripts_info'),
+ 'lang_jquery_path_lbl' => $this->EE->lang->line('jquery_core_path_label'),
+ 'lang_cc_pi_path_lbl' => $this->EE->lang->line('charcounter_plugin_path_label'),
+ 'lang_fields_title' => $this->EE->lang->line('fields_title'),
+ 'lang_fields_info' => $this->EE->lang->line('fields_info'),
+ 'lang_ct_count' => $this->EE->lang->line('coltitle_count'),
+ 'lang_ct_count_type' => $this->EE->lang->line('coltitle_count_type'),
+ 'lang_ct_count_format' => $this->EE->lang->line('coltitle_count_format'),
+ 'lang_css_title' => $this->EE->lang->line('css_title'),
+ 'lang_css_info' => $this->EE->lang->line('css_info')
+ );
+
+ return $this->EE->load->view('settings_form', $values, TRUE);
+ }
+
+
+ // ----------------------------------------------------------------------
+
+ /**
+ * Save Settings
+ *
+ * This function provides a little extra processing and validation
+ * than the generic settings form.
+ *
+ * @return void
+ */
+ public function save_settings()
+ {
+ $this->settings = $this->_get_settings(TRUE, TRUE);
+
+ // unset the name
+ unset($_POST['name']);
+
+ $good = array("", "", "","", ""); // This is where all this really comes in handy...
+ $bad = array("\'", '\"', '\\', ";", ":"); // These 2 items help keep bad information from being entered into the format string.
+
+ if (isset($_POST['field_defaults'])) {
+ foreach ($_POST['field_defaults'] as $key => $value)
+ {
+ unset($_POST['field_defaults_' . $key]);
+ $_POST['field_defaults'][$key]['count_max'] = preg_replace("[^0-9]", "", $_POST['field_defaults'][$key]['count_max']);
+ $_POST['field_defaults'][$key]['count_format'] = str_replace($bad, $good, $_POST['field_defaults'][$key]['count_format']);
+ }
+ }
+ // add the posted values to the settings
+ $this->settings[$this->EE->config->item('site_id')] = $_POST;
+
+ // update the settings
+ /*
+ $query = $this->EE->db->query($sql =
+ "UPDATE exp_extensions
+ SET settings = '" . serialize($this->settings) . "' WHERE class = '" . MD_CC_extension_class . "'"
+ );
+ */
+ $ext_class = __CLASS__;
+ $query = $this->EE->db->update('exp_extensions', array('settings'=>serialize($this->settings)), "class = '$ext_class'");
+ }
+
+ // ----------------------------------------------------------------------
+
+ /**
+ * Activate Extension
+ *
+ * This function enters the extension into the exp_extensions table
+ *
+ * @see http://codeigniter.com/user_guide/database/index.html for
+ * more information on the db class.
+ *
+ * @return void
+ */
+ public function activate_extension()
+ {
+ // Setup custom settings in this array.
+ $default_settings = $this->_build_default_settings();
+
+
+ // get the list of installed sites
+ $query = $this->EE->db->get("exp_sites");
+ // if there are sites - we know there will be at least one but do it anyway
+ if ($query->num_rows > 0)
+ {
+ // for each of the sites
+ foreach($query->result_array() as $row)
+ {
+ // build a multi dimensional array for the settings
+ $settings[$row['site_id']] = $default_settings;
+ }
+ }
+
+ // get all the sites
+ $query = $this->EE->db->get("exp_channels");
+
+ // if there are weblogs
+ if ($query->num_rows > 0)
+ {
+ // for each of the sweblogs
+ foreach($query->result_array() as $row)
+ {
+ // duplicate the default settings for this site
+ // that way nothing will break unexpectedly
+ $default_settings['field_defaults'][$row['site_id']][$row['channel_id']] = array(
+ 'count_max' => '',
+ 'count_type' => 'false',
+ 'count_format' => ''
+ );
+ }
+ }
+ // No hooks selected, add in your own hooks installation code here.
+
+ $hooks = array(
+ 'cp_js_end' => 'cp_js_end',
+ 'cp_css_end' => 'cp_css_end',
+ 'cp_menu_array' => 'cp_menu_array'
+ );
+
+ foreach ($hooks as $hook => $method)
+ {
+ $record_data = array('extension_id' => '',
+ 'class' => __CLASS__,
+ 'method' => $method,
+ 'hook' => $hook,
+ 'settings' => serialize($settings),
+ 'priority' => 10,
+ 'version' => $this->version,
+ 'enabled' => "y"
+ );
+ $this->EE->db->insert('exp_extensions', $record_data);
+ }
+
+ }
+
+ // ----------------------------------------------------------------------
+
+ /**
+ * Disable Extension
+ *
+ * This method removes information from the exp_extensions table
+ *
+ * @return void
+ */
+ function disable_extension()
+ {
+ $this->EE->db->where('class', __CLASS__);
+ $this->EE->db->delete('extensions');
+ }
+
+ // ----------------------------------------------------------------------
+
+ /**
+ * Update Extension
+ *
+ * This function performs any necessary db updates when the extension
+ * page is visited
+ *
+ * @return mixed void on update / false if none
+ */
+ public function update_extension($current = '')
+ {
+ if ($current == '' OR $current == $this->version)
+ {
+ return FALSE;
+ }
+ }
+
+ // ----------------------------------------------------------------------
+
+ /**
+ * This function uses the 'cp_js_end' hook to add the needed JS to the Control Panel.
+ */
+ function cp_js_end()
+ {
+ $this->EE->session->cache['mdesign'][MD_CC_addon_id]['require_scripts'] = TRUE;
+
+ // Check if we're not the only one using this hook
+ $js = null;
+ if($this->EE->extensions->last_call !== FALSE)
+ {
+ $js = $this->EE->extensions->last_call;
+ }
+
+ // This block was made possible by Rob Sanchez (https://gist.github.com/1198583)
+ $this->EE->load->helper('array');
+ parse_str(parse_url(@$_SERVER['HTTP_REFERER'], PHP_URL_QUERY), $get);
+ $controller = element('C', $get);
+
+ //mail("ben@masugadesign.com", "The Controller", "The Referring Controller is : $controller"); // TEMP
+
+ // if we are on a publish or edit page
+ if (isset($this->EE->session->cache['mdesign'][MD_CC_addon_id]['require_scripts']) === TRUE && ($controller == 'content_publish' || $controller == 'content_edit'))
+ {
+ if($this->settings['enable'] == 'y')
+ {
+ $ccstuff = '';
+ $s = '';
+
+ //$this->EE->cp->load_package_js('jquery.charcounter');
+
+ $count_settings = $this->settings['field_defaults'];
+ // // Not really needed here, but it's a redundant act of good measure to keep out the bad characters.
+ $good = array("", "", "","", "");
+ // It's really only necessary in the $_POST of the settings, but using it here just for safety sake.
+ // These 2 items help keep bad information from being entered into the format string.
+ $bad = array("\'", '\"', '\\', ";", ":");
+
+ foreach ( $count_settings as $key => $val )
+ {
+ $count_max = preg_replace("[^0-9]", "", $val['count_max']);
+ $count_type = $val['count_type'];
+ $count_format = str_replace($bad, $good, $val['count_format']);
+
+ // only output those that have something in them
+ if ($count_max !== "")
+ {
+ // output the jquery for the field(s)
+ $s .= '$("#field_id_'.$key.'").charCounter('.$count_max.','."\n";
+
+ // if user has entered something in count_format, set the format to the user's input
+ if ($count_format !== "")
+ {
+ $s .= "\t".'{'."\n\t".'format: "'. $count_format .'",';
+ }
+ // otherwise, output the default format
+ else
+ {
+ $s .= "\t".'{'."\n\t".'format: "%1/'. $count_max .' characters remaining",';
+ }
+
+ // add the softcount
+ $s .= "\n\t".'softcount: ' .$count_type."\n\t".'}'."\n".');'."\n\n";
+ }
+ }
+
+ if ( $s != '' )
+ {
+ // BEN
+ //$ccstuff .= '<script type="text/javascript">'."\n".'$(document).ready( function(){' . "\n\n" . $s . "\n" . '});'."\n".'</script>'."\n\n";
+ $ccstuff .= '$(document).ready( function(){' . "\n\n" . $s . "\n" . '});'."\n\n";
+ }
+
+ // add the script string before the closing head tag
+ //$out = str_replace("</head>", $ccstuff . "</head>", $out);
+ $js .= $ccstuff;
+ }
+ }
+ return $js;
+
+ }
+
+
+ // ----------------------------------------------------------------------
+
+ /**
+ *
+ */
+ function cp_menu_array()
+ {
+ $menu = null;
+ if($this->EE->extensions->last_call !== FALSE)
+ {
+ $menu = $this->EE->extensions->last_call;
+ }
+
+ $add_to_head_string = '<script type="text/javascript" src="'.trim($this->settings['charcounter_plugin_path']).'"></script> <!-- Required for '.__CLASS__.' -->'."\n";
+ $this->EE->cp->add_to_head($add_to_head_string);
+
+ return $menu;
+ }
+
+
+ // ----------------------------------------------------------------------
+
+
+ /**
+ * This function uses the 'cp_css_end' hook to append the needed CSS styles to the Control Panel.
+ */
+ function cp_css_end($out)
+ {
+ // Check if other extensions have used this hook.
+
+ $css = null;
+ if($this->EE->extensions->last_call !== FALSE)
+ {
+ $css = $this->EE->extensions->last_call;
+ }
+
+ $out = $this->settings['css']."\n";
+ $css .= $out;
+
+ return $css;
+ }
+
+} // END Md_character_count_ext class
+
+
+
+/* End of file ext.md_character_count.php */
+/* Location: /system/expressionengine/third_party/md_character_count/ext.md_character_count.php */
View
98 EE2/system/expressionengine/third_party/md_character_count/js/jquery.charcounter.js
@@ -0,0 +1,98 @@
+/**
+ *
+ * Copyright (c) 2007 Tom Deater (http://www.tomdeater.com)
+ * Licensed under the MIT License:
+ * http://www.opensource.org/licenses/mit-license.php
+ *
+ */
+
+(function($) {
+ /**
+ * attaches a character counter to each textarea element in the jQuery object
+ * usage: $("#myTextArea").charCounter(max, settings);
+ */
+
+ $.fn.charCounter = function (max, settings) {
+ max = max || 100;
+ settings = $.extend({
+ container: "<span></span>",
+ classname: "charcounter",
+ format: "(%1 characters remaining)",
+ pulse: false,
+ softcount: false,
+ delay: 0
+ }, settings);
+ var p, timeout;
+
+ function count(el, container) {
+ el = $(el);
+ if (el.val().length > max) {
+
+ if (!settings.softcount){
+ el.val(el.val().substring(0, max));
+ }
+
+ container.addClass('charcounter_err');
+
+ if (settings.pulse && !p) {
+ pulse(container, true);
+ };
+ } else {
+ container.removeClass('charcounter_err');
+ };
+
+
+
+
+
+
+ if (settings.delay > 0) {
+ if (timeout) {
+ window.clearTimeout(timeout);
+ }
+ timeout = window.setTimeout(function () {
+ container.html(settings.format.replace(/%1/, (max - el.val().length)));
+ }, settings.delay);
+ } else {
+ container.html(settings.format.replace(/%1/, (max - el.val().length)));
+ }
+ };
+
+ function pulse(el, again) {
+ if (p) {
+ window.clearTimeout(p);
+ p = null;
+ };
+ el.animate({ opacity: 0.1 }, 100, function () {
+ $(this).animate({ opacity: 1.0 }, 100);
+ });
+ if (again) {
+ p = window.setTimeout(function () { pulse(el) }, 200);
+ };
+ };
+
+ return this.each(function () {
+ var container = (!settings.container.match(/^<.+>$/))
+ ? $(settings.container)
+ : $(settings.container)
+ .insertAfter(this)
+ .addClass(settings.classname);
+ $(this)
+ .bind("keydown", function () { count(this, container); })
+ .bind("keypress", function () { count(this, container); })
+ .bind("keyup", function () { count(this, container); })
+ .bind("focus", function () { count(this, container); })
+ .bind("mouseover", function () { count(this, container); })
+ .bind("mouseout", function () { count(this, container); })
+ .bind("paste", function () {
+ var me = this;
+ setTimeout(function () { count(me, container); }, 10);
+ });
+ if (this.addEventListener) {
+ this.addEventListener('input', function () { count(this, container); }, false);
+ };
+ count(this, container);
+ });
+ };
+
+})(jQuery);
View
52 ...ressionengine/third_party/md_character_count/language/english/md_character_count_lang.php
@@ -0,0 +1,52 @@
+<?php
+/*
+Extension: ext.md_character_count.php
+Created: May 18 2008
+Last Modified: Nov 14 2008
+=================================================
+ryan masuga, masugadesign.com
+ryan@masugadesign.com | Copyright 2008
+================================================= */
+$lang = array(
+
+'extension_title' => 'MD Character Count',
+'access_rights' => 'Extension Access',
+'enable_extension_for_this_site' => 'Enable MD Character Count for this site?',
+
+'scripts_title' => 'Scripts',
+'scripts_info' => 'MD Character Count requires a modified version of <a href="http://www.tomdeater.com/jquery/character_counter/">the jQuery Charcounter Plugin</a> (modified version is bundled with the extension).',
+'jquery_core_path_label' => 'jQuery Core v1.2.6',
+'charcounter_plugin_path_label' => '<b>Path to Charcounter jQuery Plugin</b> <span style="font-weight: normal" >(note this is a modified version for MD Character Count that adds the \'softcount\' setting.)</span>',
+
+'css_title' => 'CSS',
+'css_info' => 'The CSS style information for the counter. The ".charcounter_err" class is added to fields that are set to "soft" counts where the character count goes over the max.',
+
+'fields_title' => 'Character Count Fields',
+'fields_info' => '<strong>Count</strong><br />
+If field is left blank then no count will display or be imposed.<br /><br />
+<strong>Count Type</strong><br />
+A "soft" count allows the user to type beyond the max set in "Count". When the max is exceeded, the Count Format will change style (specified in CSS below) as a warning. A hard count will cap the text entry so that the Count cannot be exceeded. <strong>NOTE:</strong> Be careful assigning a field that already has data in it to a "hard" count, as you will lose the characters beyond the number in your Count field.
+<br /><br />
+<strong>Count Format</strong><br />
+If nothing is entered, the format will default to: "<strong>%1/{count} characters remaining</strong>" where "%1" is the number of typed characters, and {count} is the number entered in the Count field. You can enter anything here (note that {count} is not a real variable. If you need the max shown in the Count Format, you have to enter it manually). Using "20" for a sample count, you might try:<br /><br />
+<ol style="padding-left: 25px" >
+<li><strong>20 max (%1 left) Hard count.</strong></li>
+<li><strong>(%1/20)</strong></li>
+<li><strong>20 characters suggested. You have %1 left. (Soft count).</strong></li>
+</ol>
+',
+
+'coltitle_count' => 'Count',
+'coltitle_count_type' => 'Count Type',
+'coltitle_count_format' => 'Count Format',
+
+'check_for_updates_title' => 'Check for updates?',
+'check_for_updates_info' => 'MD Character Count can call home (<a href="http://masugadesign.com/">http://masugadesign.com</a>) and check for recent updates. <em>(Requires the <a href="http://leevigraham.com/cms-customisation/expressionengine/lg-addon-updater/">LG Addon Updater</a> Extension)</em>',
+'check_for_updates_error' => 'Your php ini must have <code>allow_url_fopen</code> enabled to use this feature.',
+'check_for_updates_label' => 'Would you like this extension to check for updates and display them on your CP homepage?',
+'cache_refresh_label' => 'How many minutes you like the update check cached for?',
+
+// END
+''=>''
+);
+?>
View
125 EE2/system/expressionengine/third_party/md_character_count/views/settings_form.php
@@ -0,0 +1,125 @@
+<?php
+//$this->EE-cp->set_variable('cp_page_title', $this->EE->lang->line('extension_settings'));
+
+// TODO : The breadcrumbs
+//echo "<pre>"; print_r($ext_settings); echo "</pre>";
+echo heading($lang_extension_title. " <small>$version_number</small>");
+echo form_open('C=addons_extensions'.AMP.'M=save_extension_settings'.AMP.'file=md_character_count');
+?>
+<table class="mainTable padTable" border="0" style="margin-top:18px; width:100%" >
+ <thead>
+ <tr>
+ <th colspan='2'><?php echo $lang_access_rights; ?></th>
+ </tr>
+ </thead>
+ <tr class="odd" >
+ <td class='tableCellOne' style='width:30%;'>
+ <div class='defaultBold' ><?php echo $lang_enable_ext; ?></div>
+ </td>
+ <td>
+ <?php
+ echo form_dropdown('enable', array('y' => 'Yes', 'n' => 'No'), $ext_settings['enable']);
+ ?>
+ </td>
+ </tr>
+</table>
+
+<table class="mainTable padTable" border="0" style="margin-top:18px; width:100%" >
+ <thead>
+ <tr>
+ <th colspan='2' ><?php echo $lang_scripts_title; ?></th>
+ </tr>
+ </thead>
+ <tr class="odd" >
+ <td colspan="2" ><div class='box' style='border-width:0 0 1px 0; margin:0; padding:10px 5px'><p><?php echo $lang_scripts_info; ?></p></div></td>
+ </tr>
+ <!--
+ <tr class="even" >
+ <td style="width: 40%" ><b><?php echo $lang_jquery_path_lbl; ?></b></td>
+ <td>
+ <?php
+ echo form_input(array(
+ 'name' => 'jquery_core_path',
+ 'id' => 'jquery_core_path',
+ 'value' => $ext_settings['jquery_core_path'],
+
+ ));
+ ?>
+ </td>
+ </tr>
+ -->
+ <tr class="odd" >
+ <td style="width: 40%" ><b><?php echo $lang_cc_pi_path_lbl; ?></b></td>
+ <td>
+ <?php
+ echo form_input(array(
+ 'name' => 'charcounter_plugin_path',
+ 'id' => 'charcounter_plugin_path',
+ 'value' =>$ext_settings['charcounter_plugin_path']
+ ));
+ ?>
+ </td>
+ </tr>
+</table>
+
+<table class="mainTable padTable" border="0" style="margin-top:18px; width:100%" >
+ <thead>
+ <tr>
+ <th colspan='4' ><?php echo $lang_fields_title; ?></th>
+ </tr>
+ </thead>
+ <tr class="odd" >
+ <td colspan='4' ><?php echo $lang_fields_info; ?></td>
+ </tr>
+<?php
+ $i = 0; $group_name = null;
+ foreach($channel_fields as $row)
+ {
+ $count_max = @$ext_settings['field_defaults'][$row->field_id]['count_max'];
+ $count_type = @$ext_settings['field_defaults'][$row->field_id]['count_type'];
+ $count_format = @$ext_settings['field_defaults'][$row->field_id]['count_format'];
+
+ $row_class = ($i++ % 2) ? 'odd' : 'even';
+ if ($group_name != $row->group_name)
+ {
+ echo '<tr>'
+ .' <td colspan="4" style="background-color:#BECED5" ><b>Channel : '.$row->group_name.'</b></td>'
+ .'</tr>'
+ .'<tr style="font-weight: bold;" >'
+ .' <td style="width: 25%" ><div>&nbsp;</div></td>'
+ .' <td>'.$lang_ct_count.'</td>'
+ .' <td>'.$lang_ct_count_type.'</td>'
+ .' <td>'.$lang_ct_count_format.'</td>'
+ .'</tr>';
+
+ $group_name = $row->group_name;
+ }
+
+ echo '<tr>'
+ .' <td>'.$row->field_label.'</td>'
+ .' <td>'.form_input(array('name' => 'field_defaults['.$row->field_id.'][count_max]', 'value' => $count_max, "style" => "width:80px")).'</td>'
+ .' <td>'.form_dropdown('field_defaults['.$row->field_id.'][count_type]', array('true' => 'Soft', 'false' => 'Hard'), $count_type).'</td>'
+ .' <td>'.form_input(array('name' => 'field_defaults['.$row->field_id.'][count_format]', 'value' => $count_format, "style" => "width: 200px")).'</td>'
+ .'</tr>';
+
+ }
+?>
+</table>
+<table class="mainTable padTable" border="0" style="margin-top:18px; width:100%" >
+ <thead>
+ <tr>
+ <th colspan='2' ><?php echo $lang_css_title; ?></th>
+ </tr>
+ </thead>
+ <tr>
+ <td style="width:40%" ><?php echo $lang_css_info; ?></td>
+ <td><?php echo form_textarea(array('id' => 'css', 'name' => 'css', 'rows' => '18', 'value' => $ext_settings['css'])); ?></td>
+ </tr>
+
+</table>
+<div><?php echo form_submit("Submit", "Update Settings"); ?></div>
+<?php echo form_close()?> <!-- END settings_form -->
+<?php
+/* End of file settings_form.php */
+/* Location ./system/expressionengine/third_party/md_character_count/views/settings_form.php */
+?>
Please sign in to comment.
Something went wrong with that request. Please try again.