Compare commits
77 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1dfe246e0f | ||
|
|
d64e40ca2c | ||
|
|
6810c030e8 | ||
|
|
d7a6abd5b9 | ||
|
|
2a2221af31 | ||
|
|
03be3a317f | ||
|
|
bdcd83c579 | ||
|
|
f4f84bdd67 | ||
|
|
86535c23f1 | ||
|
|
5d146c1dfd | ||
|
|
82ca78d8b3 | ||
|
|
55f35868bd | ||
|
|
e0805c9dc6 | ||
|
|
a2129f91c5 | ||
|
|
adf46f620b | ||
|
|
31bef7a531 | ||
|
|
20b134231e | ||
|
|
236a415fb4 | ||
|
|
1551df058d | ||
|
|
f980b1e76a | ||
|
|
8de868fe4a | ||
|
|
a20df16c2c | ||
|
|
939ff2e4a5 | ||
|
|
1c3cc95fdb | ||
|
|
115e9ad700 | ||
|
|
3aaa9b3f0d | ||
|
|
799cff4e00 | ||
|
|
72ef4a24c5 | ||
|
|
0f44aaf3e4 | ||
|
|
795f69050a | ||
|
|
1c5bb8aebe | ||
|
|
36f19e64d0 | ||
|
|
19a1081197 | ||
|
|
45974a9e30 | ||
|
|
f1247efd34 | ||
|
|
c38346b97c | ||
|
|
3c26adb493 | ||
|
|
4458f366f9 | ||
|
|
805330638a | ||
|
|
86cd04f862 | ||
|
|
a182834985 | ||
|
|
0ce1432513 | ||
|
|
a447fc2ef6 | ||
|
|
8160d05d25 | ||
|
|
647dd52c92 | ||
|
|
b2fdbc0571 | ||
|
|
5a1c9f87c2 | ||
|
|
aa73634d95 | ||
|
|
b831924f58 | ||
|
|
ae1ef182ef | ||
|
|
d67a4231c3 | ||
|
|
64dbe31898 | ||
|
|
75c809381a | ||
|
|
6e81dc5f33 | ||
|
|
c4c3b68ec7 | ||
|
|
b4d9b061af | ||
|
|
947497767d | ||
|
|
57fb0b808d | ||
|
|
2f27bd1537 | ||
|
|
474d6810f4 | ||
|
|
54521c0e2d | ||
|
|
0dc53ee214 | ||
|
|
c1dca67176 | ||
|
|
49835eedfb | ||
|
|
79e3c052e2 | ||
|
|
c6709f6782 | ||
|
|
fa6856eb2a | ||
|
|
8c4527cf4a | ||
|
|
deff15cc71 | ||
|
|
dd4dc12ed4 | ||
|
|
96224d0d1e | ||
|
|
9bae54af71 | ||
|
|
b12ded8ae3 | ||
|
|
1aa8f80409 | ||
|
|
c88f9236e9 | ||
|
|
a828af6a81 | ||
|
|
9e9770d3ef |
@@ -1,6 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# $Id: create_default_trigger.sh 3158 2010-09-02 02:49:00Z gullevek $
|
|
||||||
# creates the default on update trigger for the inherited generic tables (date/name)
|
# creates the default on update trigger for the inherited generic tables (date/name)
|
||||||
|
|
||||||
orig_file="../tmpl/trigger.tmpl"
|
orig_file="../tmpl/trigger.tmpl"
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# $Id: drop_data.sh 3158 2010-09-02 02:49:00Z gullevek $
|
|
||||||
# quick hack for import
|
# quick hack for import
|
||||||
|
|
||||||
#echo "EXIT";
|
#echo "EXIT";
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# $Id: drop_reload.sh 3158 2010-09-02 02:49:00Z gullevek $
|
|
||||||
|
|
||||||
rm error;
|
rm error;
|
||||||
rm output;
|
rm output;
|
||||||
bin/drop_data.sh;
|
bin/drop_data.sh;
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# $Id: import_data.sh 4382 2013-02-18 07:27:24Z gullevek $
|
|
||||||
# quick hack for import
|
# quick hack for import
|
||||||
|
|
||||||
#echo "EXIT";
|
#echo "EXIT";
|
||||||
|
|||||||
28
4dev/database/function/edit_set_access_uid.sql
Normal file
28
4dev/database/function/edit_set_access_uid.sql
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
-- add uid add for edit_access table
|
||||||
|
|
||||||
|
CREATE OR REPLACE FUNCTION set_edit_access_uid() RETURNS TRIGGER AS
|
||||||
|
$$
|
||||||
|
DECLARE
|
||||||
|
myrec RECORD;
|
||||||
|
v_uid VARCHAR;
|
||||||
|
BEGIN
|
||||||
|
-- skip if NEW.name is not set
|
||||||
|
IF NEW.name IS NOT NULL AND NEW.name <> '' THEN
|
||||||
|
-- use NEW.name as base, remove all spaces
|
||||||
|
-- name data is already unique, so we do not need to worry about this here
|
||||||
|
v_uid := REPLACE(NEW.name, ' ', '');
|
||||||
|
IF TG_OP = 'INSERT' THEN
|
||||||
|
-- always set
|
||||||
|
NEW.uid := v_uid;
|
||||||
|
ELSIF TG_OP = 'UPDATE' THEN
|
||||||
|
-- check if not set, then set
|
||||||
|
SELECT INTO myrec t.* FROM edit_access t WHERE edit_access_id = NEW.edit_access_id;
|
||||||
|
IF FOUND THEN
|
||||||
|
NEW.uid := v_uid;
|
||||||
|
END IF;
|
||||||
|
END IF;
|
||||||
|
END IF;
|
||||||
|
RETURN NEW;
|
||||||
|
END;
|
||||||
|
$$
|
||||||
|
LANGUAGE 'plpgsql';
|
||||||
12
4dev/database/function/set_generic.sql
Normal file
12
4dev/database/function/set_generic.sql
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
-- adds the created or updated date tags
|
||||||
|
|
||||||
|
CREATE OR REPLACE FUNCTION set_generic() RETURNS TRIGGER AS '
|
||||||
|
BEGIN
|
||||||
|
IF TG_OP = ''INSERT'' THEN
|
||||||
|
NEW.date_created := ''now'';
|
||||||
|
ELSIF TG_OP = ''UPDATE'' THEN
|
||||||
|
NEW.date_updated := ''now'';
|
||||||
|
END IF;
|
||||||
|
RETURN NEW;
|
||||||
|
END;
|
||||||
|
' LANGUAGE 'plpgsql';
|
||||||
@@ -1,13 +1,12 @@
|
|||||||
-- $Id: update_function.sql 3158 2010-09-02 02:49:00Z gullevek $
|
|
||||||
-- adds the created or updated date tags
|
-- adds the created or updated date tags
|
||||||
|
|
||||||
CREATE OR REPLACE FUNCTION set_generic() RETURNS TRIGGER AS '
|
CREATE OR REPLACE FUNCTION set_generic() RETURNS TRIGGER AS '
|
||||||
BEGIN
|
BEGIN
|
||||||
IF TG_OP = ''INSERT'' THEN
|
IF TG_OP = ''INSERT'' THEN
|
||||||
NEW.date_created := ''now'';
|
NEW.date_created := clock_timestamp();
|
||||||
NEW.user_created := current_user;
|
NEW.user_created := current_user;
|
||||||
ELSIF TG_OP = ''UPDATE'' THEN
|
ELSIF TG_OP = ''UPDATE'' THEN
|
||||||
NEW.date_updated := ''now'';
|
NEW.date_updated := clock_timestamp();
|
||||||
NEW.user_updated := current_user;
|
NEW.user_updated := current_user;
|
||||||
END IF;
|
END IF;
|
||||||
RETURN NEW;
|
RETURN NEW;
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
-- $Id: edit_access.sql 4382 2013-02-18 07:27:24Z gullevek $
|
|
||||||
-- AUTHOR: Clemens Schwaighofer
|
-- AUTHOR: Clemens Schwaighofer
|
||||||
-- DATE: 2005/07/05
|
-- DATE: 2005/07/05
|
||||||
-- DESCRIPTION:
|
-- DESCRIPTION:
|
||||||
|
|||||||
16
4dev/database/table/edit_access_data.sql
Normal file
16
4dev/database/table/edit_access_data.sql
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
-- AUTHOR: Clemens Schwaighofer
|
||||||
|
-- DATE: 2016/7/15
|
||||||
|
-- DESCRIPTION:
|
||||||
|
-- sub table to edit access, holds additional data for access group
|
||||||
|
-- TABLE: edit_access_data
|
||||||
|
-- HISTORY:
|
||||||
|
|
||||||
|
-- DROP TABLE edit_access_data;
|
||||||
|
CREATE TABLE edit_access_data (
|
||||||
|
edit_access_data_id SERIAL PRIMARY KEY,
|
||||||
|
edit_access_id INT NOT NULL,
|
||||||
|
name VARCHAR,
|
||||||
|
value VARCHAR,
|
||||||
|
enabled SMALLINT NOT NULL DEFAULT 0,
|
||||||
|
FOREIGN KEY (edit_access_id) REFERENCES edit_access (edit_access_id) MATCH FULL ON DELETE CASCADE ON UPDATE CASCADE
|
||||||
|
) INHERITS (edit_generic) WITHOUT OIDS;
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
-- $Id: edit_access_right.sql 4382 2013-02-18 07:27:24Z gullevek $
|
|
||||||
-- AUTHOR: Clemens Schwaighofer
|
-- AUTHOR: Clemens Schwaighofer
|
||||||
-- DATE: 2005/07/05
|
-- DATE: 2005/07/05
|
||||||
-- DESCRIPTION:
|
-- DESCRIPTION:
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
-- $Id: edit_access_user.sql 3158 2010-09-02 02:49:00Z gullevek $
|
|
||||||
-- AUTHOR: Clemens Schwaighofer
|
-- AUTHOR: Clemens Schwaighofer
|
||||||
-- DATE: 2005/07/05
|
-- DATE: 2005/07/05
|
||||||
-- DESCRIPTION:
|
-- DESCRIPTION:
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
-- $Id: edit_generic.sql 3158 2010-09-02 02:49:00Z gullevek $
|
|
||||||
-- AUTHOR: Clemens Schwaighofer
|
-- AUTHOR: Clemens Schwaighofer
|
||||||
-- DATE: 2005/07/05
|
-- DATE: 2005/07/05
|
||||||
-- DESCRIPTION:
|
-- DESCRIPTION:
|
||||||
@@ -9,8 +8,6 @@
|
|||||||
-- DROP TABLE edit_generic;
|
-- DROP TABLE edit_generic;
|
||||||
CREATE TABLE edit_generic (
|
CREATE TABLE edit_generic (
|
||||||
eg_status INT,
|
eg_status INT,
|
||||||
date_created TIMESTAMP WITHOUT TIME ZONE DEFAULT CURRENT_TIMESTAMP,
|
date_created TIMESTAMP WITHOUT TIME ZONE DEFAULT clock_timestamp(),
|
||||||
date_updated TIMESTAMP WITHOUT TIME ZONE,
|
date_updated TIMESTAMP WITHOUT TIME ZONE
|
||||||
user_created VARCHAR(25) DEFAULT CURRENT_USER,
|
|
||||||
user_updated VARCHAR(25)
|
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
-- $Id: edit_group.sql 3158 2010-09-02 02:49:00Z gullevek $
|
|
||||||
-- AUTHOR: Clemens Schwaighofer
|
-- AUTHOR: Clemens Schwaighofer
|
||||||
-- DATE: 2005/07/05
|
-- DATE: 2005/07/05
|
||||||
-- DESCRIPTION:
|
-- DESCRIPTION:
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
-- $Id: edit_language.sql 3158 2010-09-02 02:49:00Z gullevek $
|
|
||||||
-- AUTHOR: Clemens Schwaighofer
|
-- AUTHOR: Clemens Schwaighofer
|
||||||
-- DATE: 2005/07/05
|
-- DATE: 2005/07/05
|
||||||
-- DESCRIPTION:
|
-- DESCRIPTION:
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
-- $Id: edit_log.sql 4382 2013-02-18 07:27:24Z gullevek $
|
|
||||||
-- AUTHOR: Clemens Schwaighofer
|
-- AUTHOR: Clemens Schwaighofer
|
||||||
-- DATE: 2005/07/05
|
-- DATE: 2005/07/05
|
||||||
-- DESCRIPTION:
|
-- DESCRIPTION:
|
||||||
@@ -11,7 +10,7 @@ CREATE TABLE edit_log (
|
|||||||
edit_log_id SERIAL PRIMARY KEY,
|
edit_log_id SERIAL PRIMARY KEY,
|
||||||
username VARCHAR,
|
username VARCHAR,
|
||||||
password VARCHAR,
|
password VARCHAR,
|
||||||
event_date TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT CURRENT_TIMESTAMP,
|
event_date TIMESTAMP WITHOUT TIME ZONE DEFAULT CURRENT_TIMESTAMP,
|
||||||
ip VARCHAR,
|
ip VARCHAR,
|
||||||
error TEXT,
|
error TEXT,
|
||||||
event TEXT,
|
event TEXT,
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
-- $Id: edit_menu_group.sql 4382 2013-02-18 07:27:24Z gullevek $
|
|
||||||
-- AUTHOR: Clemens Schwaighofer
|
-- AUTHOR: Clemens Schwaighofer
|
||||||
-- DATE: 2005/07/05
|
-- DATE: 2005/07/05
|
||||||
-- DESCRIPTION:
|
-- DESCRIPTION:
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
-- $Id: edit_page.sql 4382 2013-02-18 07:27:24Z gullevek $
|
|
||||||
-- AUTHOR: Clemens Schwaighofer
|
-- AUTHOR: Clemens Schwaighofer
|
||||||
-- DATE: 2005/07/05
|
-- DATE: 2005/07/05
|
||||||
-- DESCRIPTION:
|
-- DESCRIPTION:
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
-- $Id: edit_page_access.sql 4382 2013-02-18 07:27:24Z gullevek $
|
|
||||||
-- AUTHOR: Clemens Schwaighofer
|
-- AUTHOR: Clemens Schwaighofer
|
||||||
-- DATE: 2005/07/05
|
-- DATE: 2005/07/05
|
||||||
-- DESCRIPTION:
|
-- DESCRIPTION:
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
-- $Id: edit_page_menu_group.sql 3158 2010-09-02 02:49:00Z gullevek $
|
|
||||||
-- AUTHOR: Clemens Schwaighofer
|
-- AUTHOR: Clemens Schwaighofer
|
||||||
-- DATE: 2005/07/05
|
-- DATE: 2005/07/05
|
||||||
-- DESCRIPTION:
|
-- DESCRIPTION:
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
-- $Id: edit_page_visible_group.sql 3158 2010-09-02 02:49:00Z gullevek $
|
|
||||||
-- AUTHOR: Clemens Schwaighofer
|
-- AUTHOR: Clemens Schwaighofer
|
||||||
-- DATE: 2005/07/05
|
-- DATE: 2005/07/05
|
||||||
-- DESCRIPTION:
|
-- DESCRIPTION:
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
-- $Id: edit_query_string.sql 3158 2010-09-02 02:49:00Z gullevek $
|
|
||||||
-- AUTHOR: Clemens Schwaighofer
|
-- AUTHOR: Clemens Schwaighofer
|
||||||
-- DATE: 2005/07/05
|
-- DATE: 2005/07/05
|
||||||
-- DESCRIPTION:
|
-- DESCRIPTION:
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
-- $Id: edit_scheme.sql 3158 2010-09-02 02:49:00Z gullevek $
|
|
||||||
-- AUTHOR: Clemens Schwaighofer
|
-- AUTHOR: Clemens Schwaighofer
|
||||||
-- DATE: 2005/07/05
|
-- DATE: 2005/07/05
|
||||||
-- DESCRIPTION:
|
-- DESCRIPTION:
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
-- $Id: edit_temp_files.sql 4382 2013-02-18 07:27:24Z gullevek $
|
|
||||||
-- AUTHOR: Clemens Schwaighofer
|
-- AUTHOR: Clemens Schwaighofer
|
||||||
-- DATE: 2005/07/08
|
-- DATE: 2005/07/08
|
||||||
-- DESCRIPTION:
|
-- DESCRIPTION:
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
-- $Id: edit_user.sql 4226 2012-11-02 07:19:57Z gullevek $
|
|
||||||
-- AUTHOR: Clemens Schwaighofer
|
-- AUTHOR: Clemens Schwaighofer
|
||||||
-- DATE: 2005/07/06
|
-- DATE: 2005/07/06
|
||||||
-- DESCRIPTION:
|
-- DESCRIPTION:
|
||||||
@@ -21,6 +20,13 @@ CREATE TABLE edit_user (
|
|||||||
edit_group_id INT NOT NULL,
|
edit_group_id INT NOT NULL,
|
||||||
edit_scheme_id INT,
|
edit_scheme_id INT,
|
||||||
edit_access_right_id INT NOT NULL,
|
edit_access_right_id INT NOT NULL,
|
||||||
|
login_error_count INT,
|
||||||
|
login_error_date_last TIMESTAMP WTIHOUT TIME ZONE,
|
||||||
|
login_error_date_first TIMESTAMP WTIHOUT TIME ZONE,
|
||||||
|
strict SMALLINT DEFAULT 0,
|
||||||
|
locked SMALLINT DEFAULT 0,
|
||||||
|
password_change_date TIMESTAMP WITHOUT TIME ZONE, -- only when password is first set or changed
|
||||||
|
password_change_interval INTERVAL, -- null if no change is needed, or d/m/y time interval
|
||||||
FOREIGN KEY (edit_language_id) REFERENCES edit_language (edit_language_id) MATCH FULL ON DELETE CASCADE ON UPDATE CASCADE,
|
FOREIGN KEY (edit_language_id) REFERENCES edit_language (edit_language_id) MATCH FULL ON DELETE CASCADE ON UPDATE CASCADE,
|
||||||
FOREIGN KEY (edit_group_id) REFERENCES edit_group (edit_group_id) MATCH FULL ON DELETE CASCADE ON UPDATE CASCADE,
|
FOREIGN KEY (edit_group_id) REFERENCES edit_group (edit_group_id) MATCH FULL ON DELETE CASCADE ON UPDATE CASCADE,
|
||||||
FOREIGN KEY (edit_scheme_id) REFERENCES edit_scheme (edit_scheme_id) MATCH FULL ON DELETE CASCADE ON UPDATE CASCADE,
|
FOREIGN KEY (edit_scheme_id) REFERENCES edit_scheme (edit_scheme_id) MATCH FULL ON DELETE CASCADE ON UPDATE CASCADE,
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
-- $Id: edit_visible_group.sql 4382 2013-02-18 07:27:24Z gullevek $
|
|
||||||
-- AUTHOR: Clemens Schwaighofer
|
-- AUTHOR: Clemens Schwaighofer
|
||||||
-- DATE: 2005/07/05
|
-- DATE: 2005/07/05
|
||||||
-- DESCRIPTION:
|
-- DESCRIPTION:
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
-- $Id: generic.sql 3158 2010-09-02 02:49:00Z gullevek $
|
|
||||||
-- AUTHOR: Clemens Schwaighofer
|
-- AUTHOR: Clemens Schwaighofer
|
||||||
-- DATE: 2005/07/05
|
-- DATE: 2005/07/05
|
||||||
-- DESCRIPTION:
|
-- DESCRIPTION:
|
||||||
@@ -8,9 +7,6 @@
|
|||||||
|
|
||||||
-- DROP TABLE edit_generic;
|
-- DROP TABLE edit_generic;
|
||||||
CREATE TABLE generic (
|
CREATE TABLE generic (
|
||||||
row_status INT,
|
date_created TIMESTAMP WITHOUT TIME ZONE DEFAULT clock_timestamp(),
|
||||||
date_created TIMESTAMP WITHOUT TIME ZONE DEFAULT CURRENT_TIMESTAMP,
|
date_updated TIMESTAMP WITHOUT TIME ZONE
|
||||||
date_updated TIMESTAMP WITHOUT TIME ZONE,
|
|
||||||
user_created VARCHAR(25) DEFAULT CURRENT_USER,
|
|
||||||
user_updated VARCHAR(25)
|
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
-- $Id: trg_edit_access.sql 3158 2010-09-02 02:49:00Z gullevek $
|
|
||||||
|
|
||||||
-- DROP TRIGGER trg_edit_access ON edit_access;
|
-- DROP TRIGGER trg_edit_access ON edit_access;
|
||||||
CREATE TRIGGER trg_edit_access
|
CREATE TRIGGER trg_edit_access
|
||||||
BEFORE INSERT OR UPDATE ON edit_access
|
BEFORE INSERT OR UPDATE ON edit_access
|
||||||
|
|||||||
4
4dev/database/trigger/trg_edit_access_data.sql
Normal file
4
4dev/database/trigger/trg_edit_access_data.sql
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
-- DROP TRIGGER trg_edit_access_data ON edit_access_data;
|
||||||
|
CREATE TRIGGER trg_edit_access_data
|
||||||
|
BEFORE INSERT OR UPDATE ON edit_access_data
|
||||||
|
FOR EACH ROW EXECUTE PROCEDURE set_generic();
|
||||||
@@ -1,5 +1,3 @@
|
|||||||
-- $Id: trg_edit_access_right.sql 3158 2010-09-02 02:49:00Z gullevek $
|
|
||||||
|
|
||||||
-- DROP TRIGGER trg_edit_access_right ON edit_access_right;
|
-- DROP TRIGGER trg_edit_access_right ON edit_access_right;
|
||||||
CREATE TRIGGER trg_edit_access_right
|
CREATE TRIGGER trg_edit_access_right
|
||||||
BEFORE INSERT OR UPDATE ON edit_access_right
|
BEFORE INSERT OR UPDATE ON edit_access_right
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
-- $Id: trg_edit_access_user.sql 3158 2010-09-02 02:49:00Z gullevek $
|
|
||||||
|
|
||||||
-- DROP TRIGGER trg_edit_access_user ON edit_access_user;
|
-- DROP TRIGGER trg_edit_access_user ON edit_access_user;
|
||||||
CREATE TRIGGER trg_edit_access_user
|
CREATE TRIGGER trg_edit_access_user
|
||||||
BEFORE INSERT OR UPDATE ON edit_access_user
|
BEFORE INSERT OR UPDATE ON edit_access_user
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
-- $Id: trg_edit_group.sql 3158 2010-09-02 02:49:00Z gullevek $
|
|
||||||
|
|
||||||
-- DROP TRIGGER trg_edit_group ON edit_group;
|
-- DROP TRIGGER trg_edit_group ON edit_group;
|
||||||
CREATE TRIGGER trg_edit_group
|
CREATE TRIGGER trg_edit_group
|
||||||
BEFORE INSERT OR UPDATE ON edit_group
|
BEFORE INSERT OR UPDATE ON edit_group
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
-- $Id: trg_edit_language.sql 3158 2010-09-02 02:49:00Z gullevek $
|
|
||||||
|
|
||||||
-- DROP TRIGGER trg_edit_language ON edit_language;
|
-- DROP TRIGGER trg_edit_language ON edit_language;
|
||||||
CREATE TRIGGER trg_edit_language
|
CREATE TRIGGER trg_edit_language
|
||||||
BEFORE INSERT OR UPDATE ON edit_language
|
BEFORE INSERT OR UPDATE ON edit_language
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
-- $Id: trg_edit_log.sql 3158 2010-09-02 02:49:00Z gullevek $
|
|
||||||
|
|
||||||
-- DROP TRIGGER trg_edit_log ON edit_log;
|
-- DROP TRIGGER trg_edit_log ON edit_log;
|
||||||
CREATE TRIGGER trg_edit_log
|
CREATE TRIGGER trg_edit_log
|
||||||
BEFORE INSERT OR UPDATE ON edit_log
|
BEFORE INSERT OR UPDATE ON edit_log
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
-- $Id: trg_edit_menu_group.sql 3158 2010-09-02 02:49:00Z gullevek $
|
|
||||||
|
|
||||||
-- DROP TRIGGER trg_edit_visible_group ON edit_visible_group;
|
-- DROP TRIGGER trg_edit_visible_group ON edit_visible_group;
|
||||||
CREATE TRIGGER trg_edit_menu_group
|
CREATE TRIGGER trg_edit_menu_group
|
||||||
BEFORE INSERT OR UPDATE ON edit_menu_group
|
BEFORE INSERT OR UPDATE ON edit_menu_group
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
-- $Id: trg_edit_page.sql 3158 2010-09-02 02:49:00Z gullevek $
|
|
||||||
|
|
||||||
-- DROP TRIGGER trg_edit_page ON edit_page;
|
-- DROP TRIGGER trg_edit_page ON edit_page;
|
||||||
CREATE TRIGGER trg_edit_page
|
CREATE TRIGGER trg_edit_page
|
||||||
BEFORE INSERT OR UPDATE ON edit_page
|
BEFORE INSERT OR UPDATE ON edit_page
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
-- $Id: trg_edit_page_access.sql 3158 2010-09-02 02:49:00Z gullevek $
|
|
||||||
|
|
||||||
-- DROP TRIGGER trg_edit_page_access ON edit_page_access;
|
-- DROP TRIGGER trg_edit_page_access ON edit_page_access;
|
||||||
CREATE TRIGGER trg_edit_page_access
|
CREATE TRIGGER trg_edit_page_access
|
||||||
BEFORE INSERT OR UPDATE ON edit_page_access
|
BEFORE INSERT OR UPDATE ON edit_page_access
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
-- $Id: trg_edit_query_string.sql 3158 2010-09-02 02:49:00Z gullevek $
|
|
||||||
|
|
||||||
-- DROP TRIGGER trg_edit_query_string ON edit_query_string;
|
-- DROP TRIGGER trg_edit_query_string ON edit_query_string;
|
||||||
CREATE TRIGGER trg_edit_query_string
|
CREATE TRIGGER trg_edit_query_string
|
||||||
BEFORE INSERT OR UPDATE ON edit_query_string
|
BEFORE INSERT OR UPDATE ON edit_query_string
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
-- $Id: trg_edit_scheme.sql 3158 2010-09-02 02:49:00Z gullevek $
|
|
||||||
|
|
||||||
-- DROP TRIGGER trg_edit_scheme ON edit_scheme;
|
-- DROP TRIGGER trg_edit_scheme ON edit_scheme;
|
||||||
CREATE TRIGGER trg_edit_scheme
|
CREATE TRIGGER trg_edit_scheme
|
||||||
BEFORE INSERT OR UPDATE ON edit_scheme
|
BEFORE INSERT OR UPDATE ON edit_scheme
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
-- $Id: trg_edit_user.sql 3158 2010-09-02 02:49:00Z gullevek $
|
|
||||||
|
|
||||||
-- DROP TRIGGER trg_edit_user ON edit_user;
|
-- DROP TRIGGER trg_edit_user ON edit_user;
|
||||||
CREATE TRIGGER trg_edit_user
|
CREATE TRIGGER trg_edit_user
|
||||||
BEFORE INSERT OR UPDATE ON edit_user
|
BEFORE INSERT OR UPDATE ON edit_user
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
-- $Id: trg_edit_visible_group.sql 3158 2010-09-02 02:49:00Z gullevek $
|
|
||||||
|
|
||||||
-- DROP TRIGGER trg_edit_visible_group ON edit_visible_group;
|
-- DROP TRIGGER trg_edit_visible_group ON edit_visible_group;
|
||||||
CREATE TRIGGER trg_edit_visible_group
|
CREATE TRIGGER trg_edit_visible_group
|
||||||
BEFORE INSERT OR UPDATE ON edit_visible_group
|
BEFORE INSERT OR UPDATE ON edit_visible_group
|
||||||
|
|||||||
4
4dev/database/trigger/trg_set_edit_access_uid.sql
Normal file
4
4dev/database/trigger/trg_set_edit_access_uid.sql
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
-- DROP TRIGGER trg_set_edit_access_uid ON edit_access;
|
||||||
|
CREATE TRIGGER trg_set_edit_access_uid
|
||||||
|
BEFORE INSERT OR UPDATE ON edit_access
|
||||||
|
FOR EACH ROW EXECUTE PROCEDURE set_edit_access_uid();
|
||||||
1
4dev/debug/jquery-3.1.0.min.map
Normal file
1
4dev/debug/jquery-3.1.0.min.map
Normal file
File diff suppressed because one or more lines are too long
54
4dev/sync/sync_template.sh
Executable file
54
4dev/sync/sync_template.sh
Executable file
@@ -0,0 +1,54 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# create path
|
||||||
|
path=`pwd`"/"$0;
|
||||||
|
|
||||||
|
LOCAL_BASE_DIR="";
|
||||||
|
LOCAL_DIR=$LOCAL_BASE_DIR"";
|
||||||
|
REMOTE_WEB="";
|
||||||
|
TARGET_HOST_WEB="developer@10.76.32.25";
|
||||||
|
TMP_DIR=$LOCAL_BASE_DIR"/4dev/";
|
||||||
|
tmpf_web=$TMP_DIR"tmp.web";
|
||||||
|
|
||||||
|
# for web (ika)
|
||||||
|
rm -f $tmpf_web;
|
||||||
|
echo ".*.swp" >> $tmpf_web;
|
||||||
|
echo "._*" >> $tmpf_web;
|
||||||
|
echo ".DS_Store" >> $tmpf_web;
|
||||||
|
echo ".svn" >> $tmpf_web;
|
||||||
|
echo ".svnignore" >> $tmpf_web;
|
||||||
|
echo ".git" >> $tmpf_web;
|
||||||
|
echo ".gitignore" >> $tmpf_web;
|
||||||
|
echo ".htaccess" >> $tmpf_web;
|
||||||
|
echo "tmp/*" >> $tmpf_web;
|
||||||
|
echo "templates_c/*" >> $tmpf_web;
|
||||||
|
echo "cache/*" >> $tmpf_web;
|
||||||
|
echo "statistics/*" >> $tmpf_web;
|
||||||
|
echo "media/uploads/*" >> $tmpf_web;
|
||||||
|
echo "media/csv/*" >> $tmpf_web;
|
||||||
|
echo "4dev/*" >> $tmpf_web;
|
||||||
|
echo "log/*" >> $tmpf_web;
|
||||||
|
|
||||||
|
echo "Exclude List:"
|
||||||
|
echo "WEB:";
|
||||||
|
cat $tmpf_web;
|
||||||
|
|
||||||
|
echo "($1) Syncing from $LOCAL_DIR/* to $TARGET_HOST_WEB:$REMOTE_WEB";
|
||||||
|
echo "You hav 5 seconds to abort (<ctrl> + c)";
|
||||||
|
#c=0;until [ $c -eq 10 ];do echo -n "#"; sleep 1; c=`expr $c + 1`;done;
|
||||||
|
for ((i=5;i>=1;i--));
|
||||||
|
do
|
||||||
|
echo -n $i" ";
|
||||||
|
sleep 1;
|
||||||
|
done;
|
||||||
|
|
||||||
|
if [ "$1" = "live" ];
|
||||||
|
then
|
||||||
|
# ika sync
|
||||||
|
rsync -Plzvrupt --stats --include ".htaccess" --exclude-from=$tmpf_web --delete -e ssh $LOCAL_DIR/* $TARGET_HOST_WEB:$REMOTE_WEB
|
||||||
|
else
|
||||||
|
# ika sync
|
||||||
|
rsync -n -Plzvrupt --stats --include ".htaccess" --exclude-from=$tmpf_web --delete -e ssh $LOCAL_DIR/* $TARGET_HOST_WEB:$REMOTE_WEB
|
||||||
|
fi;
|
||||||
|
|
||||||
|
# END
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# $Id: sync_web.sh 3158 2010-09-02 02:49:00Z gullevek $
|
|
||||||
|
|
||||||
exit 0;
|
|
||||||
|
|
||||||
# create path
|
|
||||||
path=`pwd`"/"$0;
|
|
||||||
|
|
||||||
LOCAL_DIR="/home/developer/html/adidas/20060912_shoplocator/";
|
|
||||||
REMOTE_DIR="/var/www/adidas/shoplocator/";
|
|
||||||
|
|
||||||
echo "Syncing from '$LOCAL_DIR' to '$REMOTE_DIR'";
|
|
||||||
echo "You hav 5 seconds to abort (<ctrl> + c)";
|
|
||||||
for ((i=5;i>=1;i--));
|
|
||||||
do
|
|
||||||
echo -n $i" ";
|
|
||||||
sleep 1;
|
|
||||||
done;
|
|
||||||
|
|
||||||
# see man rsync for flag explenation
|
|
||||||
rsync -Plzvrpt --stats --include ".htaccess" --exclude ".*.swp" --exclude "._*" --exclude ".DS_Store" --exclude ".svn" --exclude ".svnignore" --exclude "tmp/*" --exclude "cache/*" --exclude "templates_c/*" --exclude "media/*" --delete -e ssh $LOCAL_DIR/ developer@somen.tokyo.tequila.jp:/$REMOTE_DIR/
|
|
||||||
11
4dev/update/20140822_edit_update/edit_tables.sql
Normal file
11
4dev/update/20140822_edit_update/edit_tables.sql
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
-- update edit tables
|
||||||
|
-- add login error count and last login error
|
||||||
|
|
||||||
|
-- count login errors
|
||||||
|
ALTER TABLE edit_user ADD login_error_count INT DEFAULT 0;
|
||||||
|
-- last login error date
|
||||||
|
ALTER TABLE edit_user ADD login_error_date_last TIMESTAMP WITHOUT TIME ZONE;
|
||||||
|
ALTER TABLE edit_user ADD login_error_date_first TIMESTAMP WITHOUT TIME ZONE;
|
||||||
|
-- if this is set to true, this user gets locked after max login errors are reached
|
||||||
|
ALTER TABLE edit_user ADD strict SMALLINT DEFAULT 0;
|
||||||
|
ALTER TABLE edit_user ADD locked SMALLINT DEFAULT 0;
|
||||||
9
4dev/update/smarty_update.txt
Normal file
9
4dev/update/smarty_update.txt
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
The following files need to be copied:
|
||||||
|
block.t.php
|
||||||
|
block.textform.php
|
||||||
|
function.popup.php
|
||||||
|
function.popup_init.php
|
||||||
|
|
||||||
|
The following files need in code update/or copy:
|
||||||
|
function.html_checkboxes.php
|
||||||
|
function.html_options.php
|
||||||
10
README
Normal file
10
README
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
PHP Core Library
|
||||||
|
================
|
||||||
|
|
||||||
|
Base PHP class files to setup any project
|
||||||
|
* login
|
||||||
|
* database wrapper
|
||||||
|
* basic helper class for debugging and other features
|
||||||
|
* admin/frontend split
|
||||||
|
* domain controlled database/settings split
|
||||||
|
* dynamic layout groups
|
||||||
6
www/SMARTY_UPDATE
Normal file
6
www/SMARTY_UPDATE
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
* copy
|
||||||
|
plugins/block.t.php
|
||||||
|
plugins/function.popup*.php
|
||||||
|
* check & copy
|
||||||
|
plugins/function.html_checkboxes.php
|
||||||
|
plugins/function.html_options.php
|
||||||
@@ -1 +1 @@
|
|||||||
Smarty-3.1.15/
|
smarty-3.1.27/
|
||||||
@@ -1,133 +0,0 @@
|
|||||||
{capture name='_smarty_debug' assign=debug_output}
|
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
|
|
||||||
<head>
|
|
||||||
<title>Smarty Debug Console</title>
|
|
||||||
<style type="text/css">
|
|
||||||
{literal}
|
|
||||||
body, h1, h2, td, th, p {
|
|
||||||
font-family: sans-serif;
|
|
||||||
font-weight: normal;
|
|
||||||
font-size: 0.9em;
|
|
||||||
margin: 1px;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
h1 {
|
|
||||||
margin: 0;
|
|
||||||
text-align: left;
|
|
||||||
padding: 2px;
|
|
||||||
background-color: #f0c040;
|
|
||||||
color: black;
|
|
||||||
font-weight: bold;
|
|
||||||
font-size: 1.2em;
|
|
||||||
}
|
|
||||||
|
|
||||||
h2 {
|
|
||||||
background-color: #9B410E;
|
|
||||||
color: white;
|
|
||||||
text-align: left;
|
|
||||||
font-weight: bold;
|
|
||||||
padding: 2px;
|
|
||||||
border-top: 1px solid black;
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
|
||||||
background: black;
|
|
||||||
}
|
|
||||||
|
|
||||||
p, table, div {
|
|
||||||
background: #f0ead8;
|
|
||||||
}
|
|
||||||
|
|
||||||
p {
|
|
||||||
margin: 0;
|
|
||||||
font-style: italic;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
table {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
th, td {
|
|
||||||
font-family: monospace;
|
|
||||||
vertical-align: top;
|
|
||||||
text-align: left;
|
|
||||||
width: 50%;
|
|
||||||
}
|
|
||||||
|
|
||||||
td {
|
|
||||||
color: green;
|
|
||||||
}
|
|
||||||
|
|
||||||
.odd {
|
|
||||||
background-color: #eeeeee;
|
|
||||||
}
|
|
||||||
|
|
||||||
.even {
|
|
||||||
background-color: #fafafa;
|
|
||||||
}
|
|
||||||
|
|
||||||
.exectime {
|
|
||||||
font-size: 0.8em;
|
|
||||||
font-style: italic;
|
|
||||||
}
|
|
||||||
|
|
||||||
#table_assigned_vars th {
|
|
||||||
color: blue;
|
|
||||||
}
|
|
||||||
|
|
||||||
#table_config_vars th {
|
|
||||||
color: maroon;
|
|
||||||
}
|
|
||||||
{/literal}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<h1>Smarty Debug Console - {if isset($template_name)}{$template_name|debug_print_var nofilter}{else}Total Time {$execution_time|string_format:"%.5f"}{/if}</h1>
|
|
||||||
|
|
||||||
{if !empty($template_data)}
|
|
||||||
<h2>included templates & config files (load time in seconds)</h2>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
{foreach $template_data as $template}
|
|
||||||
<font color=brown>{$template.name}</font>
|
|
||||||
<span class="exectime">
|
|
||||||
(compile {$template['compile_time']|string_format:"%.5f"}) (render {$template['render_time']|string_format:"%.5f"}) (cache {$template['cache_time']|string_format:"%.5f"})
|
|
||||||
</span>
|
|
||||||
<br>
|
|
||||||
{/foreach}
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
<h2>assigned template variables</h2>
|
|
||||||
|
|
||||||
<table id="table_assigned_vars">
|
|
||||||
{foreach $assigned_vars as $vars}
|
|
||||||
<tr class="{if $vars@iteration % 2 eq 0}odd{else}even{/if}">
|
|
||||||
<th>${$vars@key|escape:'html'}</th>
|
|
||||||
<td>{$vars|debug_print_var nofilter}</td></tr>
|
|
||||||
{/foreach}
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<h2>assigned config file variables (outer template scope)</h2>
|
|
||||||
|
|
||||||
<table id="table_config_vars">
|
|
||||||
{foreach $config_vars as $vars}
|
|
||||||
<tr class="{if $vars@iteration % 2 eq 0}odd{else}even{/if}">
|
|
||||||
<th>{$vars@key|escape:'html'}</th>
|
|
||||||
<td>{$vars|debug_print_var nofilter}</td></tr>
|
|
||||||
{/foreach}
|
|
||||||
|
|
||||||
</table>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
{/capture}
|
|
||||||
<script type="text/javascript">
|
|
||||||
{$id = $template_name|default:''|md5}
|
|
||||||
_smarty_console = window.open("","console{$id}","width=680,height=600,resizable,scrollbars=yes");
|
|
||||||
_smarty_console.document.write("{$debug_output|escape:'javascript' nofilter}");
|
|
||||||
_smarty_console.document.close();
|
|
||||||
</script>
|
|
||||||
@@ -1,277 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* Smarty Internal Plugin CacheResource File
|
|
||||||
*
|
|
||||||
* @package Smarty
|
|
||||||
* @subpackage Cacher
|
|
||||||
* @author Uwe Tews
|
|
||||||
* @author Rodney Rehm
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This class does contain all necessary methods for the HTML cache on file system
|
|
||||||
*
|
|
||||||
* Implements the file system as resource for the HTML cache Version ussing nocache inserts.
|
|
||||||
*
|
|
||||||
* @package Smarty
|
|
||||||
* @subpackage Cacher
|
|
||||||
*/
|
|
||||||
class Smarty_Internal_CacheResource_File extends Smarty_CacheResource
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* populate Cached Object with meta data from Resource
|
|
||||||
*
|
|
||||||
* @param Smarty_Template_Cached $cached cached object
|
|
||||||
* @param Smarty_Internal_Template $_template template object
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function populate(Smarty_Template_Cached $cached, Smarty_Internal_Template $_template)
|
|
||||||
{
|
|
||||||
$_source_file_path = str_replace(':', '.', $_template->source->filepath);
|
|
||||||
$_cache_id = isset($_template->cache_id) ? preg_replace('![^\w\|]+!', '_', $_template->cache_id) : null;
|
|
||||||
$_compile_id = isset($_template->compile_id) ? preg_replace('![^\w\|]+!', '_', $_template->compile_id) : null;
|
|
||||||
$_filepath = $_template->source->uid;
|
|
||||||
// if use_sub_dirs, break file into directories
|
|
||||||
if ($_template->smarty->use_sub_dirs) {
|
|
||||||
$_filepath = substr($_filepath, 0, 2) . DS
|
|
||||||
. substr($_filepath, 2, 2) . DS
|
|
||||||
. substr($_filepath, 4, 2) . DS
|
|
||||||
. $_filepath;
|
|
||||||
}
|
|
||||||
$_compile_dir_sep = $_template->smarty->use_sub_dirs ? DS : '^';
|
|
||||||
if (isset($_cache_id)) {
|
|
||||||
$_cache_id = str_replace('|', $_compile_dir_sep, $_cache_id) . $_compile_dir_sep;
|
|
||||||
} else {
|
|
||||||
$_cache_id = '';
|
|
||||||
}
|
|
||||||
if (isset($_compile_id)) {
|
|
||||||
$_compile_id = $_compile_id . $_compile_dir_sep;
|
|
||||||
} else {
|
|
||||||
$_compile_id = '';
|
|
||||||
}
|
|
||||||
$_cache_dir = $_template->smarty->getCacheDir();
|
|
||||||
if ($_template->smarty->cache_locking) {
|
|
||||||
// create locking file name
|
|
||||||
// relative file name?
|
|
||||||
if (!preg_match('/^([\/\\\\]|[a-zA-Z]:[\/\\\\])/', $_cache_dir)) {
|
|
||||||
$_lock_dir = rtrim(getcwd(), '/\\') . DS . $_cache_dir;
|
|
||||||
} else {
|
|
||||||
$_lock_dir = $_cache_dir;
|
|
||||||
}
|
|
||||||
$cached->lock_id = $_lock_dir.sha1($_cache_id.$_compile_id.$_template->source->uid).'.lock';
|
|
||||||
}
|
|
||||||
$cached->filepath = $_cache_dir . $_cache_id . $_compile_id . $_filepath . '.' . basename($_source_file_path) . '.php';
|
|
||||||
$cached->timestamp = @filemtime($cached->filepath);
|
|
||||||
$cached->exists = !!$cached->timestamp;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* populate Cached Object with timestamp and exists from Resource
|
|
||||||
*
|
|
||||||
* @param Smarty_Template_Cached $cached cached object
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function populateTimestamp(Smarty_Template_Cached $cached)
|
|
||||||
{
|
|
||||||
$cached->timestamp = @filemtime($cached->filepath);
|
|
||||||
$cached->exists = !!$cached->timestamp;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Read the cached template and process its header
|
|
||||||
*
|
|
||||||
* @param Smarty_Internal_Template $_template template object
|
|
||||||
* @param Smarty_Template_Cached $cached cached object
|
|
||||||
* @return booelan true or false if the cached content does not exist
|
|
||||||
*/
|
|
||||||
public function process(Smarty_Internal_Template $_template, Smarty_Template_Cached $cached=null)
|
|
||||||
{
|
|
||||||
$_smarty_tpl = $_template;
|
|
||||||
|
|
||||||
return @include $_template->cached->filepath;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Write the rendered template output to cache
|
|
||||||
*
|
|
||||||
* @param Smarty_Internal_Template $_template template object
|
|
||||||
* @param string $content content to cache
|
|
||||||
* @return boolean success
|
|
||||||
*/
|
|
||||||
public function writeCachedContent(Smarty_Internal_Template $_template, $content)
|
|
||||||
{
|
|
||||||
if (Smarty_Internal_Write_File::writeFile($_template->cached->filepath, $content, $_template->smarty) === true) {
|
|
||||||
$_template->cached->timestamp = @filemtime($_template->cached->filepath);
|
|
||||||
$_template->cached->exists = !!$_template->cached->timestamp;
|
|
||||||
if ($_template->cached->exists) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Empty cache
|
|
||||||
*
|
|
||||||
* @param Smarty_Internal_Template $_template template object
|
|
||||||
* @param integer $exp_time expiration time (number of seconds, not timestamp)
|
|
||||||
* @return integer number of cache files deleted
|
|
||||||
*/
|
|
||||||
public function clearAll(Smarty $smarty, $exp_time = null)
|
|
||||||
{
|
|
||||||
return $this->clear($smarty, null, null, null, $exp_time);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Empty cache for a specific template
|
|
||||||
*
|
|
||||||
* @param Smarty $_template template object
|
|
||||||
* @param string $resource_name template name
|
|
||||||
* @param string $cache_id cache id
|
|
||||||
* @param string $compile_id compile id
|
|
||||||
* @param integer $exp_time expiration time (number of seconds, not timestamp)
|
|
||||||
* @return integer number of cache files deleted
|
|
||||||
*/
|
|
||||||
public function clear(Smarty $smarty, $resource_name, $cache_id, $compile_id, $exp_time)
|
|
||||||
{
|
|
||||||
$_cache_id = isset($cache_id) ? preg_replace('![^\w\|]+!', '_', $cache_id) : null;
|
|
||||||
$_compile_id = isset($compile_id) ? preg_replace('![^\w\|]+!', '_', $compile_id) : null;
|
|
||||||
$_dir_sep = $smarty->use_sub_dirs ? '/' : '^';
|
|
||||||
$_compile_id_offset = $smarty->use_sub_dirs ? 3 : 0;
|
|
||||||
$_dir = $smarty->getCacheDir();
|
|
||||||
$_dir_length = strlen($_dir);
|
|
||||||
if (isset($_cache_id)) {
|
|
||||||
$_cache_id_parts = explode('|', $_cache_id);
|
|
||||||
$_cache_id_parts_count = count($_cache_id_parts);
|
|
||||||
if ($smarty->use_sub_dirs) {
|
|
||||||
foreach ($_cache_id_parts as $id_part) {
|
|
||||||
$_dir .= $id_part . DS;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (isset($resource_name)) {
|
|
||||||
$_save_stat = $smarty->caching;
|
|
||||||
$smarty->caching = true;
|
|
||||||
$tpl = new $smarty->template_class($resource_name, $smarty);
|
|
||||||
$smarty->caching = $_save_stat;
|
|
||||||
|
|
||||||
// remove from template cache
|
|
||||||
$tpl->source; // have the template registered before unset()
|
|
||||||
if ($smarty->allow_ambiguous_resources) {
|
|
||||||
$_templateId = $tpl->source->unique_resource . $tpl->cache_id . $tpl->compile_id;
|
|
||||||
} else {
|
|
||||||
$_templateId = $smarty->joined_template_dir . '#' . $resource_name . $tpl->cache_id . $tpl->compile_id;
|
|
||||||
}
|
|
||||||
if (isset($_templateId[150])) {
|
|
||||||
$_templateId = sha1($_templateId);
|
|
||||||
}
|
|
||||||
unset($smarty->template_objects[$_templateId]);
|
|
||||||
|
|
||||||
if ($tpl->source->exists) {
|
|
||||||
$_resourcename_parts = basename(str_replace('^', '/', $tpl->cached->filepath));
|
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$_count = 0;
|
|
||||||
$_time = time();
|
|
||||||
if (file_exists($_dir)) {
|
|
||||||
$_cacheDirs = new RecursiveDirectoryIterator($_dir);
|
|
||||||
$_cache = new RecursiveIteratorIterator($_cacheDirs, RecursiveIteratorIterator::CHILD_FIRST);
|
|
||||||
foreach ($_cache as $_file) {
|
|
||||||
if (substr(basename($_file->getPathname()),0,1) == '.' || strpos($_file, '.svn') !== false) continue;
|
|
||||||
// directory ?
|
|
||||||
if ($_file->isDir()) {
|
|
||||||
if (!$_cache->isDot()) {
|
|
||||||
// delete folder if empty
|
|
||||||
@rmdir($_file->getPathname());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$_parts = explode($_dir_sep, str_replace('\\', '/', substr((string) $_file, $_dir_length)));
|
|
||||||
$_parts_count = count($_parts);
|
|
||||||
// check name
|
|
||||||
if (isset($resource_name)) {
|
|
||||||
if ($_parts[$_parts_count-1] != $_resourcename_parts) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// check compile id
|
|
||||||
if (isset($_compile_id) && (!isset($_parts[$_parts_count-2 - $_compile_id_offset]) || $_parts[$_parts_count-2 - $_compile_id_offset] != $_compile_id)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
// check cache id
|
|
||||||
if (isset($_cache_id)) {
|
|
||||||
// count of cache id parts
|
|
||||||
$_parts_count = (isset($_compile_id)) ? $_parts_count - 2 - $_compile_id_offset : $_parts_count - 1 - $_compile_id_offset;
|
|
||||||
if ($_parts_count < $_cache_id_parts_count) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
for ($i = 0; $i < $_cache_id_parts_count; $i++) {
|
|
||||||
if ($_parts[$i] != $_cache_id_parts[$i]) continue 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// expired ?
|
|
||||||
if (isset($exp_time)) {
|
|
||||||
if ($exp_time < 0) {
|
|
||||||
preg_match('#\'cache_lifetime\' =>\s*(\d*)#', file_get_contents($_file), $match);
|
|
||||||
if ($_time < (@filemtime($_file) + $match[1])) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if ($_time - @filemtime($_file) < $exp_time) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$_count += @unlink((string) $_file) ? 1 : 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $_count;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check is cache is locked for this template
|
|
||||||
*
|
|
||||||
* @param Smarty $smarty Smarty object
|
|
||||||
* @param Smarty_Template_Cached $cached cached object
|
|
||||||
* @return booelan true or false if cache is locked
|
|
||||||
*/
|
|
||||||
public function hasLock(Smarty $smarty, Smarty_Template_Cached $cached)
|
|
||||||
{
|
|
||||||
if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
|
|
||||||
clearstatcache(true, $cached->lock_id);
|
|
||||||
} else {
|
|
||||||
clearstatcache();
|
|
||||||
}
|
|
||||||
$t = @filemtime($cached->lock_id);
|
|
||||||
|
|
||||||
return $t && (time() - $t < $smarty->locking_timeout);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Lock cache for this template
|
|
||||||
*
|
|
||||||
* @param Smarty $smarty Smarty object
|
|
||||||
* @param Smarty_Template_Cached $cached cached object
|
|
||||||
*/
|
|
||||||
public function acquireLock(Smarty $smarty, Smarty_Template_Cached $cached)
|
|
||||||
{
|
|
||||||
$cached->is_locked = true;
|
|
||||||
touch($cached->lock_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Unlock cache for this template
|
|
||||||
*
|
|
||||||
* @param Smarty $smarty Smarty object
|
|
||||||
* @param Smarty_Template_Cached $cached cached object
|
|
||||||
*/
|
|
||||||
public function releaseLock(Smarty $smarty, Smarty_Template_Cached $cached)
|
|
||||||
{
|
|
||||||
$cached->is_locked = false;
|
|
||||||
@unlink($cached->lock_id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,80 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* Smarty Internal Plugin Resource Stream
|
|
||||||
*
|
|
||||||
* Implements the streams as resource for Smarty template
|
|
||||||
*
|
|
||||||
* @package Smarty
|
|
||||||
* @subpackage TemplateResources
|
|
||||||
* @author Uwe Tews
|
|
||||||
* @author Rodney Rehm
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Smarty Internal Plugin Resource Stream
|
|
||||||
*
|
|
||||||
* Implements the streams as resource for Smarty template
|
|
||||||
*
|
|
||||||
* @link http://php.net/streams
|
|
||||||
* @package Smarty
|
|
||||||
* @subpackage TemplateResources
|
|
||||||
*/
|
|
||||||
class Smarty_Internal_Resource_Stream extends Smarty_Resource_Recompiled
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* populate Source Object with meta data from Resource
|
|
||||||
*
|
|
||||||
* @param Smarty_Template_Source $source source object
|
|
||||||
* @param Smarty_Internal_Template $_template template object
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template=null)
|
|
||||||
{
|
|
||||||
if (strpos($source->resource, '://') !== false) {
|
|
||||||
$source->filepath = $source->resource;
|
|
||||||
} else {
|
|
||||||
$source->filepath = str_replace(':', '://', $source->resource);
|
|
||||||
}
|
|
||||||
$source->uid = false;
|
|
||||||
$source->content = $this->getContent($source);
|
|
||||||
$source->timestamp = false;
|
|
||||||
$source->exists = !!$source->content;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Load template's source from stream into current template object
|
|
||||||
*
|
|
||||||
* @param Smarty_Template_Source $source source object
|
|
||||||
* @return string template source
|
|
||||||
* @throws SmartyException if source cannot be loaded
|
|
||||||
*/
|
|
||||||
public function getContent(Smarty_Template_Source $source)
|
|
||||||
{
|
|
||||||
$t = '';
|
|
||||||
// the availability of the stream has already been checked in Smarty_Resource::fetch()
|
|
||||||
$fp = fopen($source->filepath, 'r+');
|
|
||||||
if ($fp) {
|
|
||||||
while (!feof($fp) && ($current_line = fgets($fp)) !== false) {
|
|
||||||
$t .= $current_line;
|
|
||||||
}
|
|
||||||
fclose($fp);
|
|
||||||
|
|
||||||
return $t;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* modify resource_name according to resource handlers specifications
|
|
||||||
*
|
|
||||||
* @param Smarty $smarty Smarty instance
|
|
||||||
* @param string $resource_name resource_name to make unique
|
|
||||||
* @param boolean $is_config flag for config resource
|
|
||||||
* @return string unique resource name
|
|
||||||
*/
|
|
||||||
protected function buildUniqueResourceName(Smarty $smarty, $resource_name, $is_config = false)
|
|
||||||
{
|
|
||||||
return get_class($this) . '#' . $resource_name;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -2,22 +2,18 @@
|
|||||||
/**
|
/**
|
||||||
* Project: Smarty: the PHP compiling template engine
|
* Project: Smarty: the PHP compiling template engine
|
||||||
* File: Smarty.class.php
|
* File: Smarty.class.php
|
||||||
* SVN: $Id: Smarty.class.php 4737 2013-12-11 06:29:51Z gullevek $
|
* SVN: $Id: Smarty.class.php 4897 2014-10-14 22:29:58Z Uwe.Tews@googlemail.com $
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
* License as published by the Free Software Foundation; either
|
* License as published by the Free Software Foundation; either
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Lesser General Public License for more details.
|
* Lesser General Public License for more details.
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
* License along with this library; if not, write to the Free Software
|
* License along with this library; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*
|
|
||||||
* For questions, help, comments, discussion, etc., please join the
|
* For questions, help, comments, discussion, etc., please join the
|
||||||
* Smarty mailing list. Send a blank e-mail to
|
* Smarty mailing list. Send a blank e-mail to
|
||||||
* smarty-discussion-subscribe@googlegroups.com
|
* smarty-discussion-subscribe@googlegroups.com
|
||||||
@@ -28,7 +24,7 @@
|
|||||||
* @author Uwe Tews
|
* @author Uwe Tews
|
||||||
* @author Rodney Rehm
|
* @author Rodney Rehm
|
||||||
* @package Smarty
|
* @package Smarty
|
||||||
* @version 3.1.15
|
* @version 3.1.21
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -102,6 +98,7 @@ include_once SMARTY_SYSPLUGINS_DIR.'smarty_internal_cacheresource_file.php';
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the main Smarty class
|
* This is the main Smarty class
|
||||||
|
*
|
||||||
* @package Smarty
|
* @package Smarty
|
||||||
*/
|
*/
|
||||||
class Smarty extends Smarty_Internal_TemplateBase
|
class Smarty extends Smarty_Internal_TemplateBase
|
||||||
@@ -113,7 +110,7 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
/**
|
/**
|
||||||
* smarty version
|
* smarty version
|
||||||
*/
|
*/
|
||||||
const SMARTY_VERSION = 'Smarty-3.1.15';
|
const SMARTY_VERSION = 'Smarty-3.1.21-dev';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* define variable scopes
|
* define variable scopes
|
||||||
@@ -206,106 +203,133 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* auto literal on delimiters with whitspace
|
* auto literal on delimiters with whitspace
|
||||||
|
*
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
public $auto_literal = true;
|
public $auto_literal = true;
|
||||||
/**
|
/**
|
||||||
* display error on not assigned variables
|
* display error on not assigned variables
|
||||||
|
*
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
public $error_unassigned = false;
|
public $error_unassigned = false;
|
||||||
/**
|
/**
|
||||||
* look up relative filepaths in include_path
|
* look up relative filepaths in include_path
|
||||||
|
*
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
public $use_include_path = false;
|
public $use_include_path = false;
|
||||||
/**
|
/**
|
||||||
* template directory
|
* template directory
|
||||||
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
private $template_dir = array();
|
private $template_dir = array();
|
||||||
/**
|
/**
|
||||||
* joined template directory string used in cache keys
|
* joined template directory string used in cache keys
|
||||||
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $joined_template_dir = null;
|
public $joined_template_dir = null;
|
||||||
/**
|
/**
|
||||||
* joined config directory string used in cache keys
|
* joined config directory string used in cache keys
|
||||||
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $joined_config_dir = null;
|
public $joined_config_dir = null;
|
||||||
/**
|
/**
|
||||||
* default template handler
|
* default template handler
|
||||||
|
*
|
||||||
* @var callable
|
* @var callable
|
||||||
*/
|
*/
|
||||||
public $default_template_handler_func = null;
|
public $default_template_handler_func = null;
|
||||||
/**
|
/**
|
||||||
* default config handler
|
* default config handler
|
||||||
|
*
|
||||||
* @var callable
|
* @var callable
|
||||||
*/
|
*/
|
||||||
public $default_config_handler_func = null;
|
public $default_config_handler_func = null;
|
||||||
/**
|
/**
|
||||||
* default plugin handler
|
* default plugin handler
|
||||||
|
*
|
||||||
* @var callable
|
* @var callable
|
||||||
*/
|
*/
|
||||||
public $default_plugin_handler_func = null;
|
public $default_plugin_handler_func = null;
|
||||||
/**
|
/**
|
||||||
* compile directory
|
* compile directory
|
||||||
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $compile_dir = null;
|
private $compile_dir = null;
|
||||||
/**
|
/**
|
||||||
* plugins directory
|
* plugins directory
|
||||||
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
private $plugins_dir = array();
|
private $plugins_dir = array();
|
||||||
/**
|
/**
|
||||||
* cache directory
|
* cache directory
|
||||||
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $cache_dir = null;
|
private $cache_dir = null;
|
||||||
/**
|
/**
|
||||||
* config directory
|
* config directory
|
||||||
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
private $config_dir = array();
|
private $config_dir = array();
|
||||||
/**
|
/**
|
||||||
* force template compiling?
|
* force template compiling?
|
||||||
|
*
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
public $force_compile = false;
|
public $force_compile = false;
|
||||||
/**
|
/**
|
||||||
* check template for modifications?
|
* check template for modifications?
|
||||||
|
*
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
public $compile_check = true;
|
public $compile_check = true;
|
||||||
/**
|
/**
|
||||||
* use sub dirs for compiled/cached files?
|
* use sub dirs for compiled/cached files?
|
||||||
|
*
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
public $use_sub_dirs = false;
|
public $use_sub_dirs = false;
|
||||||
/**
|
/**
|
||||||
* allow ambiguous resources (that are made unique by the resource handler)
|
* allow ambiguous resources (that are made unique by the resource handler)
|
||||||
|
*
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
public $allow_ambiguous_resources = false;
|
public $allow_ambiguous_resources = false;
|
||||||
/**
|
/**
|
||||||
* caching enabled
|
* caching enabled
|
||||||
|
*
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
public $caching = false;
|
public $caching = false;
|
||||||
/**
|
/**
|
||||||
* merge compiled includes
|
* merge compiled includes
|
||||||
|
*
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
public $merge_compiled_includes = false;
|
public $merge_compiled_includes = false;
|
||||||
|
/**
|
||||||
|
* template inheritance merge compiled includes
|
||||||
|
*
|
||||||
|
* @var boolean
|
||||||
|
*/
|
||||||
|
public $inheritance_merge_compiled_includes = true;
|
||||||
/**
|
/**
|
||||||
* cache lifetime in seconds
|
* cache lifetime in seconds
|
||||||
|
*
|
||||||
* @var integer
|
* @var integer
|
||||||
*/
|
*/
|
||||||
public $cache_lifetime = 3600;
|
public $cache_lifetime = 3600;
|
||||||
/**
|
/**
|
||||||
* force cache file creation
|
* force cache file creation
|
||||||
|
*
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
public $force_cache = false;
|
public $force_cache = false;
|
||||||
@@ -325,11 +349,13 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
public $compile_id = null;
|
public $compile_id = null;
|
||||||
/**
|
/**
|
||||||
* template left-delimiter
|
* template left-delimiter
|
||||||
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $left_delimiter = "{";
|
public $left_delimiter = "{";
|
||||||
/**
|
/**
|
||||||
* template right-delimiter
|
* template right-delimiter
|
||||||
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $right_delimiter = "}";
|
public $right_delimiter = "}";
|
||||||
@@ -338,7 +364,6 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* class name
|
* class name
|
||||||
*
|
|
||||||
* This should be instance of Smarty_Security.
|
* This should be instance of Smarty_Security.
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
@@ -365,7 +390,6 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
public $allow_php_templates = false;
|
public $allow_php_templates = false;
|
||||||
/**
|
/**
|
||||||
* Should compiled-templates be prevented from being called directly?
|
* Should compiled-templates be prevented from being called directly?
|
||||||
*
|
|
||||||
* {@internal
|
* {@internal
|
||||||
* Currently used by Smarty_Internal_Template only.
|
* Currently used by Smarty_Internal_Template only.
|
||||||
* }}
|
* }}
|
||||||
@@ -376,7 +400,6 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
/**#@-*/
|
/**#@-*/
|
||||||
/**
|
/**
|
||||||
* debug mode
|
* debug mode
|
||||||
*
|
|
||||||
* Setting this to true enables the debug-console.
|
* Setting this to true enables the debug-console.
|
||||||
*
|
*
|
||||||
* @var boolean
|
* @var boolean
|
||||||
@@ -388,12 +411,12 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
* <li>NONE => no debugging control allowed</li>
|
* <li>NONE => no debugging control allowed</li>
|
||||||
* <li>URL => enable debugging when SMARTY_DEBUG is found in the URL.</li>
|
* <li>URL => enable debugging when SMARTY_DEBUG is found in the URL.</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $debugging_ctrl = 'NONE';
|
public $debugging_ctrl = 'NONE';
|
||||||
/**
|
/**
|
||||||
* Name of debugging URL-param.
|
* Name of debugging URL-param.
|
||||||
*
|
|
||||||
* Only used when $debugging_ctrl is set to 'URL'.
|
* Only used when $debugging_ctrl is set to 'URL'.
|
||||||
* The name of the URL-parameter that activates debugging.
|
* The name of the URL-parameter that activates debugging.
|
||||||
*
|
*
|
||||||
@@ -402,16 +425,19 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
public $smarty_debug_id = 'SMARTY_DEBUG';
|
public $smarty_debug_id = 'SMARTY_DEBUG';
|
||||||
/**
|
/**
|
||||||
* Path of debug template.
|
* Path of debug template.
|
||||||
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $debug_tpl = null;
|
public $debug_tpl = null;
|
||||||
/**
|
/**
|
||||||
* When set, smarty uses this value as error_reporting-level.
|
* When set, smarty uses this value as error_reporting-level.
|
||||||
|
*
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
public $error_reporting = null;
|
public $error_reporting = null;
|
||||||
/**
|
/**
|
||||||
* Internal flag for getTags()
|
* Internal flag for getTags()
|
||||||
|
*
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
public $get_used_tags = false;
|
public $get_used_tags = false;
|
||||||
@@ -422,16 +448,19 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Controls whether variables with the same name overwrite each other.
|
* Controls whether variables with the same name overwrite each other.
|
||||||
|
*
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
public $config_overwrite = true;
|
public $config_overwrite = true;
|
||||||
/**
|
/**
|
||||||
* Controls whether config values of on/true/yes and off/false/no get converted to boolean.
|
* Controls whether config values of on/true/yes and off/false/no get converted to boolean.
|
||||||
|
*
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
public $config_booleanize = true;
|
public $config_booleanize = true;
|
||||||
/**
|
/**
|
||||||
* Controls whether hidden config sections/vars are read from the file.
|
* Controls whether hidden config sections/vars are read from the file.
|
||||||
|
*
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
public $config_read_hidden = false;
|
public $config_read_hidden = false;
|
||||||
@@ -444,16 +473,19 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* locking concurrent compiles
|
* locking concurrent compiles
|
||||||
|
*
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
public $compile_locking = true;
|
public $compile_locking = true;
|
||||||
/**
|
/**
|
||||||
* Controls whether cache resources should emply locking mechanism
|
* Controls whether cache resources should emply locking mechanism
|
||||||
|
*
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
public $cache_locking = false;
|
public $cache_locking = false;
|
||||||
/**
|
/**
|
||||||
* seconds to wait for acquiring a lock before ignoring the write lock
|
* seconds to wait for acquiring a lock before ignoring the write lock
|
||||||
|
*
|
||||||
* @var float
|
* @var float
|
||||||
*/
|
*/
|
||||||
public $locking_timeout = 10;
|
public $locking_timeout = 10;
|
||||||
@@ -462,19 +494,19 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* global template functions
|
* global template functions
|
||||||
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public $template_functions = array();
|
public $template_functions = array();
|
||||||
/**
|
/**
|
||||||
* resource type used if none given
|
* resource type used if none given
|
||||||
*
|
|
||||||
* Must be an valid key of $registered_resources.
|
* Must be an valid key of $registered_resources.
|
||||||
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $default_resource_type = 'file';
|
public $default_resource_type = 'file';
|
||||||
/**
|
/**
|
||||||
* caching type
|
* caching type
|
||||||
*
|
|
||||||
* Must be an element of $cache_resource_types.
|
* Must be an element of $cache_resource_types.
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
@@ -482,121 +514,145 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
public $caching_type = 'file';
|
public $caching_type = 'file';
|
||||||
/**
|
/**
|
||||||
* internal config properties
|
* internal config properties
|
||||||
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public $properties = array();
|
public $properties = array();
|
||||||
/**
|
/**
|
||||||
* config type
|
* config type
|
||||||
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $default_config_type = 'file';
|
public $default_config_type = 'file';
|
||||||
/**
|
/**
|
||||||
* cached template objects
|
* cached template objects
|
||||||
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public $template_objects = array();
|
public $template_objects = array();
|
||||||
/**
|
/**
|
||||||
* check If-Modified-Since headers
|
* check If-Modified-Since headers
|
||||||
|
*
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
public $cache_modified_check = false;
|
public $cache_modified_check = false;
|
||||||
/**
|
/**
|
||||||
* registered plugins
|
* registered plugins
|
||||||
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public $registered_plugins = array();
|
public $registered_plugins = array();
|
||||||
/**
|
/**
|
||||||
* plugin search order
|
* plugin search order
|
||||||
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public $plugin_search_order = array('function', 'block', 'compiler', 'class');
|
public $plugin_search_order = array('function', 'block', 'compiler', 'class');
|
||||||
/**
|
/**
|
||||||
* registered objects
|
* registered objects
|
||||||
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public $registered_objects = array();
|
public $registered_objects = array();
|
||||||
/**
|
/**
|
||||||
* registered classes
|
* registered classes
|
||||||
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public $registered_classes = array();
|
public $registered_classes = array();
|
||||||
/**
|
/**
|
||||||
* registered filters
|
* registered filters
|
||||||
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public $registered_filters = array();
|
public $registered_filters = array();
|
||||||
/**
|
/**
|
||||||
* registered resources
|
* registered resources
|
||||||
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public $registered_resources = array();
|
public $registered_resources = array();
|
||||||
/**
|
/**
|
||||||
* resource handler cache
|
* resource handler cache
|
||||||
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public $_resource_handlers = array();
|
public $_resource_handlers = array();
|
||||||
/**
|
/**
|
||||||
* registered cache resources
|
* registered cache resources
|
||||||
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public $registered_cache_resources = array();
|
public $registered_cache_resources = array();
|
||||||
/**
|
/**
|
||||||
* cache resource handler cache
|
* cache resource handler cache
|
||||||
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public $_cacheresource_handlers = array();
|
public $_cacheresource_handlers = array();
|
||||||
/**
|
/**
|
||||||
* autoload filter
|
* autoload filter
|
||||||
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public $autoload_filters = array();
|
public $autoload_filters = array();
|
||||||
/**
|
/**
|
||||||
* default modifier
|
* default modifier
|
||||||
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public $default_modifiers = array();
|
public $default_modifiers = array();
|
||||||
/**
|
/**
|
||||||
* autoescape variable output
|
* autoescape variable output
|
||||||
|
*
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
public $escape_html = false;
|
public $escape_html = false;
|
||||||
/**
|
/**
|
||||||
* global internal smarty vars
|
* global internal smarty vars
|
||||||
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public static $_smarty_vars = array();
|
public static $_smarty_vars = array();
|
||||||
/**
|
/**
|
||||||
* start time for execution time calculation
|
* start time for execution time calculation
|
||||||
|
*
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
public $start_time = 0;
|
public $start_time = 0;
|
||||||
/**
|
/**
|
||||||
* default file permissions
|
* default file permissions
|
||||||
|
*
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
public $_file_perms = 0644;
|
public $_file_perms = 0644;
|
||||||
/**
|
/**
|
||||||
* default dir permissions
|
* default dir permissions
|
||||||
|
*
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
public $_dir_perms = 0771;
|
public $_dir_perms = 0771;
|
||||||
/**
|
/**
|
||||||
* block tag hierarchy
|
* block tag hierarchy
|
||||||
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public $_tag_stack = array();
|
public $_tag_stack = array();
|
||||||
/**
|
/**
|
||||||
* self pointer to Smarty object
|
* self pointer to Smarty object
|
||||||
|
*
|
||||||
* @var Smarty
|
* @var Smarty
|
||||||
*/
|
*/
|
||||||
public $smarty;
|
public $smarty;
|
||||||
/**
|
/**
|
||||||
* required by the compiler for BC
|
* required by the compiler for BC
|
||||||
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $_current_file = null;
|
public $_current_file = null;
|
||||||
/**
|
/**
|
||||||
* internal flag to enable parser debugging
|
* internal flag to enable parser debugging
|
||||||
|
*
|
||||||
* @var bool
|
* @var bool
|
||||||
*/
|
*/
|
||||||
public $_parserdebug = false;
|
public $_parserdebug = false;
|
||||||
@@ -606,11 +662,19 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public $merged_templates_func = array();
|
public $merged_templates_func = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cache of is_file results of loadPlugin()
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
public static $_is_file_cache= array();
|
||||||
|
|
||||||
/**#@-*/
|
/**#@-*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize new Smarty object
|
* Initialize new Smarty object
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
@@ -651,11 +715,11 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* <<magic>> Generic getter.
|
* <<magic>> Generic getter.
|
||||||
*
|
|
||||||
* Calls the appropriate getter function.
|
* Calls the appropriate getter function.
|
||||||
* Issues an E_USER_NOTICE if no valid getter is found.
|
* Issues an E_USER_NOTICE if no valid getter is found.
|
||||||
*
|
*
|
||||||
* @param string $name property name
|
* @param string $name property name
|
||||||
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function __get($name)
|
public function __get($name)
|
||||||
@@ -677,7 +741,6 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* <<magic>> Generic setter.
|
* <<magic>> Generic setter.
|
||||||
*
|
|
||||||
* Calls the appropriate setter function.
|
* Calls the appropriate setter function.
|
||||||
* Issues an E_USER_NOTICE if no valid setter is found.
|
* Issues an E_USER_NOTICE if no valid setter is found.
|
||||||
*
|
*
|
||||||
@@ -705,6 +768,7 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
* Check if a template resource exists
|
* Check if a template resource exists
|
||||||
*
|
*
|
||||||
* @param string $resource_name template name
|
* @param string $resource_name template name
|
||||||
|
*
|
||||||
* @return boolean status
|
* @return boolean status
|
||||||
*/
|
*/
|
||||||
public function templateExists($resource_name)
|
public function templateExists($resource_name)
|
||||||
@@ -722,8 +786,8 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
/**
|
/**
|
||||||
* Returns a single or all global variables
|
* Returns a single or all global variables
|
||||||
*
|
*
|
||||||
* @param object $smarty
|
|
||||||
* @param string $varname variable name or null
|
* @param string $varname variable name or null
|
||||||
|
*
|
||||||
* @return string variable value or or array of variables
|
* @return string variable value or or array of variables
|
||||||
*/
|
*/
|
||||||
public function getGlobal($varname = null)
|
public function getGlobal($varname = null)
|
||||||
@@ -749,6 +813,7 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
*
|
*
|
||||||
* @param integer $exp_time expiration time
|
* @param integer $exp_time expiration time
|
||||||
* @param string $type resource type
|
* @param string $type resource type
|
||||||
|
*
|
||||||
* @return integer number of cache files deleted
|
* @return integer number of cache files deleted
|
||||||
*/
|
*/
|
||||||
public function clearAllCache($exp_time = null, $type = null)
|
public function clearAllCache($exp_time = null, $type = null)
|
||||||
@@ -768,6 +833,7 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
* @param string $compile_id compile id
|
* @param string $compile_id compile id
|
||||||
* @param integer $exp_time expiration time
|
* @param integer $exp_time expiration time
|
||||||
* @param string $type resource type
|
* @param string $type resource type
|
||||||
|
*
|
||||||
* @return integer number of cache files deleted
|
* @return integer number of cache files deleted
|
||||||
*/
|
*/
|
||||||
public function clearCache($template_name, $cache_id = null, $compile_id = null, $exp_time = null, $type = null)
|
public function clearCache($template_name, $cache_id = null, $compile_id = null, $exp_time = null, $type = null)
|
||||||
@@ -783,6 +849,7 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
* Loads security class and enables security
|
* Loads security class and enables security
|
||||||
*
|
*
|
||||||
* @param string|Smarty_Security $security_class if a string is used, it must be class-name
|
* @param string|Smarty_Security $security_class if a string is used, it must be class-name
|
||||||
|
*
|
||||||
* @return Smarty current Smarty instance for chaining
|
* @return Smarty current Smarty instance for chaining
|
||||||
* @throws SmartyException when an invalid class name is provided
|
* @throws SmartyException when an invalid class name is provided
|
||||||
*/
|
*/
|
||||||
@@ -811,6 +878,7 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Disable security
|
* Disable security
|
||||||
|
*
|
||||||
* @return Smarty current Smarty instance for chaining
|
* @return Smarty current Smarty instance for chaining
|
||||||
*/
|
*/
|
||||||
public function disableSecurity()
|
public function disableSecurity()
|
||||||
@@ -824,13 +892,14 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
* Set template directory
|
* Set template directory
|
||||||
*
|
*
|
||||||
* @param string|array $template_dir directory(s) of template sources
|
* @param string|array $template_dir directory(s) of template sources
|
||||||
|
*
|
||||||
* @return Smarty current Smarty instance for chaining
|
* @return Smarty current Smarty instance for chaining
|
||||||
*/
|
*/
|
||||||
public function setTemplateDir($template_dir)
|
public function setTemplateDir($template_dir)
|
||||||
{
|
{
|
||||||
$this->template_dir = array();
|
$this->template_dir = array();
|
||||||
foreach ((array) $template_dir as $k => $v) {
|
foreach ((array) $template_dir as $k => $v) {
|
||||||
$this->template_dir[$k] = rtrim($v, '/\\') . DS;
|
$this->template_dir[$k] = preg_replace('#(\w+)(/|\\\\){1,}#', '$1$2', rtrim($v, '/\\')) . DS;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->joined_template_dir = join(DIRECTORY_SEPARATOR, $this->template_dir);
|
$this->joined_template_dir = join(DIRECTORY_SEPARATOR, $this->template_dir);
|
||||||
@@ -843,6 +912,7 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
*
|
*
|
||||||
* @param string|array $template_dir directory(s) of template sources
|
* @param string|array $template_dir directory(s) of template sources
|
||||||
* @param string $key of the array element to assign the template dir to
|
* @param string $key of the array element to assign the template dir to
|
||||||
|
*
|
||||||
* @return Smarty current Smarty instance for chaining
|
* @return Smarty current Smarty instance for chaining
|
||||||
* @throws SmartyException when the given template directory is not valid
|
* @throws SmartyException when the given template directory is not valid
|
||||||
*/
|
*/
|
||||||
@@ -853,20 +923,24 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
|
|
||||||
if (is_array($template_dir)) {
|
if (is_array($template_dir)) {
|
||||||
foreach ($template_dir as $k => $v) {
|
foreach ($template_dir as $k => $v) {
|
||||||
|
$v = preg_replace('#(\w+)(/|\\\\){1,}#', '$1$2', rtrim($v, '/\\')) . DS;
|
||||||
if (is_int($k)) {
|
if (is_int($k)) {
|
||||||
// indexes are not merged but appended
|
// indexes are not merged but appended
|
||||||
$this->template_dir[] = rtrim($v, '/\\') . DS;
|
$this->template_dir[] = $v;
|
||||||
} else {
|
} else {
|
||||||
// string indexes are overridden
|
// string indexes are overridden
|
||||||
$this->template_dir[$k] = rtrim($v, '/\\') . DS;
|
$this->template_dir[$k] = $v;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} elseif ($key !== null) {
|
} else {
|
||||||
|
$v = preg_replace('#(\w+)(/|\\\\){1,}#', '$1$2', rtrim($template_dir, '/\\')) . DS;
|
||||||
|
if ($key !== null) {
|
||||||
// override directory at specified index
|
// override directory at specified index
|
||||||
$this->template_dir[$key] = rtrim($template_dir, '/\\') . DS;
|
$this->template_dir[$key] = $v;
|
||||||
} else {
|
} else {
|
||||||
// append new directory
|
// append new directory
|
||||||
$this->template_dir[] = rtrim($template_dir, '/\\') . DS;
|
$this->template_dir[] = $v;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$this->joined_template_dir = join(DIRECTORY_SEPARATOR, $this->template_dir);
|
$this->joined_template_dir = join(DIRECTORY_SEPARATOR, $this->template_dir);
|
||||||
|
|
||||||
@@ -876,7 +950,8 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
/**
|
/**
|
||||||
* Get template directories
|
* Get template directories
|
||||||
*
|
*
|
||||||
* @param mixed index of directory to get, null to get all
|
* @param mixed $index index of directory to get, null to get all
|
||||||
|
*
|
||||||
* @return array|string list of template directories, or directory of $index
|
* @return array|string list of template directories, or directory of $index
|
||||||
*/
|
*/
|
||||||
public function getTemplateDir($index = null)
|
public function getTemplateDir($index = null)
|
||||||
@@ -891,14 +966,15 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
/**
|
/**
|
||||||
* Set config directory
|
* Set config directory
|
||||||
*
|
*
|
||||||
* @param string|array $template_dir directory(s) of configuration sources
|
* @param $config_dir
|
||||||
|
*
|
||||||
* @return Smarty current Smarty instance for chaining
|
* @return Smarty current Smarty instance for chaining
|
||||||
*/
|
*/
|
||||||
public function setConfigDir($config_dir)
|
public function setConfigDir($config_dir)
|
||||||
{
|
{
|
||||||
$this->config_dir = array();
|
$this->config_dir = array();
|
||||||
foreach ((array) $config_dir as $k => $v) {
|
foreach ((array) $config_dir as $k => $v) {
|
||||||
$this->config_dir[$k] = rtrim($v, '/\\') . DS;
|
$this->config_dir[$k] = preg_replace('#(\w+)(/|\\\\){1,}#', '$1$2', rtrim($v, '/\\')) . DS;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->joined_config_dir = join(DIRECTORY_SEPARATOR, $this->config_dir);
|
$this->joined_config_dir = join(DIRECTORY_SEPARATOR, $this->config_dir);
|
||||||
@@ -910,7 +986,8 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
* Add config directory(s)
|
* Add config directory(s)
|
||||||
*
|
*
|
||||||
* @param string|array $config_dir directory(s) of config sources
|
* @param string|array $config_dir directory(s) of config sources
|
||||||
* @param string key of the array element to assign the config dir to
|
* @param mixed $key key of the array element to assign the config dir to
|
||||||
|
*
|
||||||
* @return Smarty current Smarty instance for chaining
|
* @return Smarty current Smarty instance for chaining
|
||||||
*/
|
*/
|
||||||
public function addConfigDir($config_dir, $key = null)
|
public function addConfigDir($config_dir, $key = null)
|
||||||
@@ -920,20 +997,24 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
|
|
||||||
if (is_array($config_dir)) {
|
if (is_array($config_dir)) {
|
||||||
foreach ($config_dir as $k => $v) {
|
foreach ($config_dir as $k => $v) {
|
||||||
|
$v = preg_replace('#(\w+)(/|\\\\){1,}#', '$1$2', rtrim($v, '/\\')) . DS;
|
||||||
if (is_int($k)) {
|
if (is_int($k)) {
|
||||||
// indexes are not merged but appended
|
// indexes are not merged but appended
|
||||||
$this->config_dir[] = rtrim($v, '/\\') . DS;
|
$this->config_dir[] = $v;
|
||||||
} else {
|
} else {
|
||||||
// string indexes are overridden
|
// string indexes are overridden
|
||||||
$this->config_dir[$k] = rtrim($v, '/\\') . DS;
|
$this->config_dir[$k] = $v;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} elseif ($key !== null) {
|
} else {
|
||||||
|
$v = preg_replace('#(\w+)(/|\\\\){1,}#', '$1$2', rtrim($config_dir, '/\\')) . DS;
|
||||||
|
if ($key !== null) {
|
||||||
// override directory at specified index
|
// override directory at specified index
|
||||||
$this->config_dir[$key] = rtrim($config_dir, '/\\') . DS;
|
$this->config_dir[$key] = rtrim($v, '/\\') . DS;
|
||||||
} else {
|
} else {
|
||||||
// append new directory
|
// append new directory
|
||||||
$this->config_dir[] = rtrim($config_dir, '/\\') . DS;
|
$this->config_dir[] = rtrim($v, '/\\') . DS;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->joined_config_dir = join(DIRECTORY_SEPARATOR, $this->config_dir);
|
$this->joined_config_dir = join(DIRECTORY_SEPARATOR, $this->config_dir);
|
||||||
@@ -944,7 +1025,8 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
/**
|
/**
|
||||||
* Get config directory
|
* Get config directory
|
||||||
*
|
*
|
||||||
* @param mixed index of directory to get, null to get all
|
* @param mixed $index index of directory to get, null to get all
|
||||||
|
*
|
||||||
* @return array|string configuration directory
|
* @return array|string configuration directory
|
||||||
*/
|
*/
|
||||||
public function getConfigDir($index = null)
|
public function getConfigDir($index = null)
|
||||||
@@ -960,6 +1042,7 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
* Set plugins directory
|
* Set plugins directory
|
||||||
*
|
*
|
||||||
* @param string|array $plugins_dir directory(s) of plugins
|
* @param string|array $plugins_dir directory(s) of plugins
|
||||||
|
*
|
||||||
* @return Smarty current Smarty instance for chaining
|
* @return Smarty current Smarty instance for chaining
|
||||||
*/
|
*/
|
||||||
public function setPluginsDir($plugins_dir)
|
public function setPluginsDir($plugins_dir)
|
||||||
@@ -975,8 +1058,8 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
/**
|
/**
|
||||||
* Adds directory of plugin files
|
* Adds directory of plugin files
|
||||||
*
|
*
|
||||||
* @param object $smarty
|
* @param $plugins_dir
|
||||||
* @param string $ |array $ plugins folder
|
*
|
||||||
* @return Smarty current Smarty instance for chaining
|
* @return Smarty current Smarty instance for chaining
|
||||||
*/
|
*/
|
||||||
public function addPluginsDir($plugins_dir)
|
public function addPluginsDir($plugins_dir)
|
||||||
@@ -1018,6 +1101,7 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
* Set compile directory
|
* Set compile directory
|
||||||
*
|
*
|
||||||
* @param string $compile_dir directory to store compiled templates in
|
* @param string $compile_dir directory to store compiled templates in
|
||||||
|
*
|
||||||
* @return Smarty current Smarty instance for chaining
|
* @return Smarty current Smarty instance for chaining
|
||||||
*/
|
*/
|
||||||
public function setCompileDir($compile_dir)
|
public function setCompileDir($compile_dir)
|
||||||
@@ -1044,6 +1128,7 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
* Set cache directory
|
* Set cache directory
|
||||||
*
|
*
|
||||||
* @param string $cache_dir directory to store cached templates in
|
* @param string $cache_dir directory to store cached templates in
|
||||||
|
*
|
||||||
* @return Smarty current Smarty instance for chaining
|
* @return Smarty current Smarty instance for chaining
|
||||||
*/
|
*/
|
||||||
public function setCacheDir($cache_dir)
|
public function setCacheDir($cache_dir)
|
||||||
@@ -1070,6 +1155,7 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
* Set default modifiers
|
* Set default modifiers
|
||||||
*
|
*
|
||||||
* @param array|string $modifiers modifier or list of modifiers to set
|
* @param array|string $modifiers modifier or list of modifiers to set
|
||||||
|
*
|
||||||
* @return Smarty current Smarty instance for chaining
|
* @return Smarty current Smarty instance for chaining
|
||||||
*/
|
*/
|
||||||
public function setDefaultModifiers($modifiers)
|
public function setDefaultModifiers($modifiers)
|
||||||
@@ -1083,6 +1169,7 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
* Add default modifiers
|
* Add default modifiers
|
||||||
*
|
*
|
||||||
* @param array|string $modifiers modifier or list of modifiers to add
|
* @param array|string $modifiers modifier or list of modifiers to add
|
||||||
|
*
|
||||||
* @return Smarty current Smarty instance for chaining
|
* @return Smarty current Smarty instance for chaining
|
||||||
*/
|
*/
|
||||||
public function addDefaultModifiers($modifiers)
|
public function addDefaultModifiers($modifiers)
|
||||||
@@ -1106,12 +1193,12 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
return $this->default_modifiers;
|
return $this->default_modifiers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set autoload filters
|
* Set autoload filters
|
||||||
*
|
*
|
||||||
* @param array $filters filters to load automatically
|
* @param array $filters filters to load automatically
|
||||||
* @param string $type "pre", "output", … specify the filter type to set. Defaults to none treating $filters' keys as the appropriate types
|
* @param string $type "pre", "output", … specify the filter type to set. Defaults to none treating $filters' keys as the appropriate types
|
||||||
|
*
|
||||||
* @return Smarty current Smarty instance for chaining
|
* @return Smarty current Smarty instance for chaining
|
||||||
*/
|
*/
|
||||||
public function setAutoloadFilters($filters, $type = null)
|
public function setAutoloadFilters($filters, $type = null)
|
||||||
@@ -1130,6 +1217,7 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
*
|
*
|
||||||
* @param array $filters filters to load automatically
|
* @param array $filters filters to load automatically
|
||||||
* @param string $type "pre", "output", … specify the filter type to set. Defaults to none treating $filters' keys as the appropriate types
|
* @param string $type "pre", "output", … specify the filter type to set. Defaults to none treating $filters' keys as the appropriate types
|
||||||
|
*
|
||||||
* @return Smarty current Smarty instance for chaining
|
* @return Smarty current Smarty instance for chaining
|
||||||
*/
|
*/
|
||||||
public function addAutoloadFilters($filters, $type = null)
|
public function addAutoloadFilters($filters, $type = null)
|
||||||
@@ -1157,6 +1245,7 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
* Get autoload filters
|
* Get autoload filters
|
||||||
*
|
*
|
||||||
* @param string $type type of filter to get autoloads for. Defaults to all autoload filters
|
* @param string $type type of filter to get autoloads for. Defaults to all autoload filters
|
||||||
|
*
|
||||||
* @return array array( 'type1' => array( 'filter1', 'filter2', … ) ) or array( 'filter1', 'filter2', …) if $type was specified
|
* @return array array( 'type1' => array( 'filter1', 'filter2', … ) ) or array( 'filter1', 'filter2', …) if $type was specified
|
||||||
*/
|
*/
|
||||||
public function getAutoloadFilters($type = null)
|
public function getAutoloadFilters($type = null)
|
||||||
@@ -1182,6 +1271,7 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
* set the debug template
|
* set the debug template
|
||||||
*
|
*
|
||||||
* @param string $tpl_name
|
* @param string $tpl_name
|
||||||
|
*
|
||||||
* @return Smarty current Smarty instance for chaining
|
* @return Smarty current Smarty instance for chaining
|
||||||
* @throws SmartyException if file is not readable
|
* @throws SmartyException if file is not readable
|
||||||
*/
|
*/
|
||||||
@@ -1203,15 +1293,16 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
* @param mixed $compile_id compile id to be used with this template
|
* @param mixed $compile_id compile id to be used with this template
|
||||||
* @param object $parent next higher level of Smarty variables
|
* @param object $parent next higher level of Smarty variables
|
||||||
* @param boolean $do_clone flag is Smarty object shall be cloned
|
* @param boolean $do_clone flag is Smarty object shall be cloned
|
||||||
|
*
|
||||||
* @return object template object
|
* @return object template object
|
||||||
*/
|
*/
|
||||||
public function createTemplate($template, $cache_id = null, $compile_id = null, $parent = null, $do_clone = true)
|
public function createTemplate($template, $cache_id = null, $compile_id = null, $parent = null, $do_clone = true)
|
||||||
{
|
{
|
||||||
if (!empty($cache_id) && (is_object($cache_id) || is_array($cache_id))) {
|
if ($cache_id !== null && (is_object($cache_id) || is_array($cache_id))) {
|
||||||
$parent = $cache_id;
|
$parent = $cache_id;
|
||||||
$cache_id = null;
|
$cache_id = null;
|
||||||
}
|
}
|
||||||
if (!empty($parent) && is_array($parent)) {
|
if ($parent !== null && is_array($parent)) {
|
||||||
$data = $parent;
|
$data = $parent;
|
||||||
$parent = null;
|
$parent = null;
|
||||||
} else {
|
} else {
|
||||||
@@ -1262,7 +1353,6 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
return $tpl;
|
return $tpl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Takes unknown classes and loads plugin files for them
|
* Takes unknown classes and loads plugin files for them
|
||||||
* class name format: Smarty_PluginType_PluginName
|
* class name format: Smarty_PluginType_PluginName
|
||||||
@@ -1270,6 +1360,8 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
*
|
*
|
||||||
* @param string $plugin_name class plugin name to load
|
* @param string $plugin_name class plugin name to load
|
||||||
* @param bool $check check if already loaded
|
* @param bool $check check if already loaded
|
||||||
|
*
|
||||||
|
* @throws SmartyException
|
||||||
* @return string |boolean filepath of loaded file or false
|
* @return string |boolean filepath of loaded file or false
|
||||||
*/
|
*/
|
||||||
public function loadPlugin($plugin_name, $check = true)
|
public function loadPlugin($plugin_name, $check = true)
|
||||||
@@ -1284,15 +1376,12 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
// count($_name_parts) < 3 === !isset($_name_parts[2])
|
// count($_name_parts) < 3 === !isset($_name_parts[2])
|
||||||
if (!isset($_name_parts[2]) || strtolower($_name_parts[0]) !== 'smarty') {
|
if (!isset($_name_parts[2]) || strtolower($_name_parts[0]) !== 'smarty') {
|
||||||
throw new SmartyException("plugin {$plugin_name} is not a valid name format");
|
throw new SmartyException("plugin {$plugin_name} is not a valid name format");
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
// if type is "internal", get plugin from sysplugins
|
// if type is "internal", get plugin from sysplugins
|
||||||
if (strtolower($_name_parts[1]) == 'internal') {
|
if (strtolower($_name_parts[1]) == 'internal') {
|
||||||
$file = SMARTY_SYSPLUGINS_DIR . strtolower($plugin_name) . '.php';
|
$file = SMARTY_SYSPLUGINS_DIR . strtolower($plugin_name) . '.php';
|
||||||
if (file_exists($file)) {
|
if (isset(self::$_is_file_cache[$file]) ? self::$_is_file_cache[$file] : self::$_is_file_cache[$file] = is_file($file)) {
|
||||||
require_once($file);
|
require_once($file);
|
||||||
|
|
||||||
return $file;
|
return $file;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
@@ -1310,9 +1399,8 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
$_plugin_dir . strtolower($_plugin_filename),
|
$_plugin_dir . strtolower($_plugin_filename),
|
||||||
);
|
);
|
||||||
foreach ($names as $file) {
|
foreach ($names as $file) {
|
||||||
if (file_exists($file)) {
|
if (isset(self::$_is_file_cache[$file]) ? self::$_is_file_cache[$file] : self::$_is_file_cache[$file] = is_file($file)) {
|
||||||
require_once($file);
|
require_once($file);
|
||||||
|
|
||||||
return $file;
|
return $file;
|
||||||
}
|
}
|
||||||
if ($this->use_include_path && !preg_match('/^([\/\\\\]|[a-zA-Z]:[\/\\\\])/', $_plugin_dir)) {
|
if ($this->use_include_path && !preg_match('/^([\/\\\\]|[a-zA-Z]:[\/\\\\])/', $_plugin_dir)) {
|
||||||
@@ -1342,6 +1430,7 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
* @param bool $force_compile force all to recompile
|
* @param bool $force_compile force all to recompile
|
||||||
* @param int $time_limit
|
* @param int $time_limit
|
||||||
* @param int $max_errors
|
* @param int $max_errors
|
||||||
|
*
|
||||||
* @return integer number of template files recompiled
|
* @return integer number of template files recompiled
|
||||||
*/
|
*/
|
||||||
public function compileAllTemplates($extension = '.tpl', $force_compile = false, $time_limit = 0, $max_errors = null)
|
public function compileAllTemplates($extension = '.tpl', $force_compile = false, $time_limit = 0, $max_errors = null)
|
||||||
@@ -1356,6 +1445,7 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
* @param bool $force_compile force all to recompile
|
* @param bool $force_compile force all to recompile
|
||||||
* @param int $time_limit
|
* @param int $time_limit
|
||||||
* @param int $max_errors
|
* @param int $max_errors
|
||||||
|
*
|
||||||
* @return integer number of template files recompiled
|
* @return integer number of template files recompiled
|
||||||
*/
|
*/
|
||||||
public function compileAllConfig($extension = '.conf', $force_compile = false, $time_limit = 0, $max_errors = null)
|
public function compileAllConfig($extension = '.conf', $force_compile = false, $time_limit = 0, $max_errors = null)
|
||||||
@@ -1369,6 +1459,7 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
* @param string $resource_name template name
|
* @param string $resource_name template name
|
||||||
* @param string $compile_id compile id
|
* @param string $compile_id compile id
|
||||||
* @param integer $exp_time expiration time
|
* @param integer $exp_time expiration time
|
||||||
|
*
|
||||||
* @return integer number of template files deleted
|
* @return integer number of template files deleted
|
||||||
*/
|
*/
|
||||||
public function clearCompiledTemplate($resource_name = null, $compile_id = null, $exp_time = null)
|
public function clearCompiledTemplate($resource_name = null, $compile_id = null, $exp_time = null)
|
||||||
@@ -1376,11 +1467,11 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
return Smarty_Internal_Utility::clearCompiledTemplate($resource_name, $compile_id, $exp_time, $this);
|
return Smarty_Internal_Utility::clearCompiledTemplate($resource_name, $compile_id, $exp_time, $this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return array of tag/attributes of all tags used by an template
|
* Return array of tag/attributes of all tags used by an template
|
||||||
*
|
*
|
||||||
* @param object $templae template object
|
* @param Smarty_Internal_Template $template
|
||||||
|
*
|
||||||
* @return array of tag/attributes
|
* @return array of tag/attributes
|
||||||
*/
|
*/
|
||||||
public function getTags(Smarty_Internal_Template $template)
|
public function getTags(Smarty_Internal_Template $template)
|
||||||
@@ -1392,6 +1483,7 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
* Run installation test
|
* Run installation test
|
||||||
*
|
*
|
||||||
* @param array $errors Array to write errors into, rather than outputting them
|
* @param array $errors Array to write errors into, rather than outputting them
|
||||||
|
*
|
||||||
* @return boolean true if setup is fine, false if something is wrong
|
* @return boolean true if setup is fine, false if something is wrong
|
||||||
*/
|
*/
|
||||||
public function testInstall(&$errors = null)
|
public function testInstall(&$errors = null)
|
||||||
@@ -1403,7 +1495,13 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
* Error Handler to mute expected messages
|
* Error Handler to mute expected messages
|
||||||
*
|
*
|
||||||
* @link http://php.net/set_error_handler
|
* @link http://php.net/set_error_handler
|
||||||
|
*
|
||||||
* @param integer $errno Error level
|
* @param integer $errno Error level
|
||||||
|
* @param $errstr
|
||||||
|
* @param $errfile
|
||||||
|
* @param $errline
|
||||||
|
* @param $errcontext
|
||||||
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public static function mutingErrorHandler($errno, $errstr, $errfile, $errline, $errcontext)
|
public static function mutingErrorHandler($errno, $errstr, $errfile, $errline, $errcontext)
|
||||||
@@ -1506,6 +1604,7 @@ if (Smarty::$_CHARSET !== 'UTF-8') {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Smarty exception class
|
* Smarty exception class
|
||||||
|
*
|
||||||
* @package Smarty
|
* @package Smarty
|
||||||
*/
|
*/
|
||||||
class SmartyException extends Exception
|
class SmartyException extends Exception
|
||||||
@@ -1520,6 +1619,7 @@ class SmartyException extends Exception
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Smarty compiler exception class
|
* Smarty compiler exception class
|
||||||
|
*
|
||||||
* @package Smarty
|
* @package Smarty
|
||||||
*/
|
*/
|
||||||
class SmartyCompilerException extends SmartyException
|
class SmartyCompilerException extends SmartyException
|
||||||
@@ -1528,23 +1628,28 @@ class SmartyCompilerException extends SmartyException
|
|||||||
{
|
{
|
||||||
return ' --> Smarty Compiler: ' . $this->message . ' <-- ';
|
return ' --> Smarty Compiler: ' . $this->message . ' <-- ';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The line number of the template error
|
* The line number of the template error
|
||||||
|
*
|
||||||
* @type int|null
|
* @type int|null
|
||||||
*/
|
*/
|
||||||
public $line = null;
|
public $line = null;
|
||||||
/**
|
/**
|
||||||
* The template source snippet relating to the error
|
* The template source snippet relating to the error
|
||||||
|
*
|
||||||
* @type string|null
|
* @type string|null
|
||||||
*/
|
*/
|
||||||
public $source = null;
|
public $source = null;
|
||||||
/**
|
/**
|
||||||
* The raw text of the error message
|
* The raw text of the error message
|
||||||
|
*
|
||||||
* @type string|null
|
* @type string|null
|
||||||
*/
|
*/
|
||||||
public $desc = null;
|
public $desc = null;
|
||||||
/**
|
/**
|
||||||
* The resource identifier or template name
|
* The resource identifier or template name
|
||||||
|
*
|
||||||
* @type string|null
|
* @type string|null
|
||||||
*/
|
*/
|
||||||
public $template = null;
|
public $template = null;
|
||||||
@@ -1573,5 +1678,3 @@ function smartyAutoload($class)
|
|||||||
include SMARTY_SYSPLUGINS_DIR . $_class . '.php';
|
include SMARTY_SYSPLUGINS_DIR . $_class . '.php';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
|
||||||
@@ -2,22 +2,18 @@
|
|||||||
/**
|
/**
|
||||||
* Project: Smarty: the PHP compiling template engine
|
* Project: Smarty: the PHP compiling template engine
|
||||||
* File: SmartyBC.class.php
|
* File: SmartyBC.class.php
|
||||||
* SVN: $Id: SmartyBC.class.php 4737 2013-12-11 06:29:51Z gullevek $
|
* SVN: $Id: $
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
* License as published by the Free Software Foundation; either
|
* License as published by the Free Software Foundation; either
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Lesser General Public License for more details.
|
* Lesser General Public License for more details.
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
* License along with this library; if not, write to the Free Software
|
* License along with this library; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*
|
|
||||||
* For questions, help, comments, discussion, etc., please join the
|
* For questions, help, comments, discussion, etc., please join the
|
||||||
* Smarty mailing list. Send a blank e-mail to
|
* Smarty mailing list. Send a blank e-mail to
|
||||||
* smarty-discussion-subscribe@googlegroups.com
|
* smarty-discussion-subscribe@googlegroups.com
|
||||||
@@ -32,7 +28,7 @@
|
|||||||
/**
|
/**
|
||||||
* @ignore
|
* @ignore
|
||||||
*/
|
*/
|
||||||
require(dirname(__FILE__) . '/Smarty.class.php');
|
require_once(dirname(__FILE__) . '/Smarty.class.php');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Smarty Backward Compatability Wrapper Class
|
* Smarty Backward Compatability Wrapper Class
|
||||||
@@ -43,6 +39,7 @@ class SmartyBC extends Smarty
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Smarty 2 BC
|
* Smarty 2 BC
|
||||||
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $_version = self::SMARTY_VERSION;
|
public $_version = self::SMARTY_VERSION;
|
||||||
@@ -122,7 +119,10 @@ class SmartyBC extends Smarty
|
|||||||
* @param object $object_impl the referenced PHP object to register
|
* @param object $object_impl the referenced PHP object to register
|
||||||
* @param array $allowed list of allowed methods (empty = all)
|
* @param array $allowed list of allowed methods (empty = all)
|
||||||
* @param boolean $smarty_args smarty argument format, else traditional
|
* @param boolean $smarty_args smarty argument format, else traditional
|
||||||
* @param array $block_functs list of methods that are block format
|
* @param array $block_methods list of methods that are block format
|
||||||
|
*
|
||||||
|
* @throws SmartyException
|
||||||
|
* @internal param array $block_functs list of methods that are block format
|
||||||
*/
|
*/
|
||||||
public function register_object($object, $object_impl, $allowed = array(), $smarty_args = true, $block_methods = array())
|
public function register_object($object, $object_impl, $allowed = array(), $smarty_args = true, $block_methods = array())
|
||||||
{
|
{
|
||||||
@@ -309,6 +309,7 @@ class SmartyBC extends Smarty
|
|||||||
* @param string $cache_id name of cache_id
|
* @param string $cache_id name of cache_id
|
||||||
* @param string $compile_id name of compile_id
|
* @param string $compile_id name of compile_id
|
||||||
* @param string $exp_time expiration time
|
* @param string $exp_time expiration time
|
||||||
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function clear_cache($tpl_file = null, $cache_id = null, $compile_id = null, $exp_time = null)
|
public function clear_cache($tpl_file = null, $cache_id = null, $compile_id = null, $exp_time = null)
|
||||||
@@ -320,6 +321,7 @@ class SmartyBC extends Smarty
|
|||||||
* clear the entire contents of cache (all templates)
|
* clear the entire contents of cache (all templates)
|
||||||
*
|
*
|
||||||
* @param string $exp_time expire time
|
* @param string $exp_time expire time
|
||||||
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function clear_all_cache($exp_time = null)
|
public function clear_all_cache($exp_time = null)
|
||||||
@@ -333,6 +335,7 @@ class SmartyBC extends Smarty
|
|||||||
* @param string $tpl_file name of template file
|
* @param string $tpl_file name of template file
|
||||||
* @param string $cache_id
|
* @param string $cache_id
|
||||||
* @param string $compile_id
|
* @param string $compile_id
|
||||||
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function is_cached($tpl_file, $cache_id = null, $compile_id = null)
|
public function is_cached($tpl_file, $cache_id = null, $compile_id = null)
|
||||||
@@ -356,6 +359,7 @@ class SmartyBC extends Smarty
|
|||||||
* @param string $tpl_file
|
* @param string $tpl_file
|
||||||
* @param string $compile_id
|
* @param string $compile_id
|
||||||
* @param string $exp_time
|
* @param string $exp_time
|
||||||
|
*
|
||||||
* @return boolean results of {@link smarty_core_rm_auto()}
|
* @return boolean results of {@link smarty_core_rm_auto()}
|
||||||
*/
|
*/
|
||||||
public function clear_compiled_tpl($tpl_file = null, $compile_id = null, $exp_time = null)
|
public function clear_compiled_tpl($tpl_file = null, $compile_id = null, $exp_time = null)
|
||||||
@@ -367,6 +371,7 @@ class SmartyBC extends Smarty
|
|||||||
* Checks whether requested template exists.
|
* Checks whether requested template exists.
|
||||||
*
|
*
|
||||||
* @param string $tpl_file
|
* @param string $tpl_file
|
||||||
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function template_exists($tpl_file)
|
public function template_exists($tpl_file)
|
||||||
@@ -378,6 +383,7 @@ class SmartyBC extends Smarty
|
|||||||
* Returns an array containing template variables
|
* Returns an array containing template variables
|
||||||
*
|
*
|
||||||
* @param string $name
|
* @param string $name
|
||||||
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function get_template_vars($name = null)
|
public function get_template_vars($name = null)
|
||||||
@@ -389,6 +395,7 @@ class SmartyBC extends Smarty
|
|||||||
* Returns an array containing config variables
|
* Returns an array containing config variables
|
||||||
*
|
*
|
||||||
* @param string $name
|
* @param string $name
|
||||||
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function get_config_vars($name = null)
|
public function get_config_vars($name = null)
|
||||||
@@ -412,6 +419,7 @@ class SmartyBC extends Smarty
|
|||||||
* return a reference to a registered object
|
* return a reference to a registered object
|
||||||
*
|
*
|
||||||
* @param string $name
|
* @param string $name
|
||||||
|
*
|
||||||
* @return object
|
* @return object
|
||||||
*/
|
*/
|
||||||
public function get_registered_object($name)
|
public function get_registered_object($name)
|
||||||
@@ -439,7 +447,6 @@ class SmartyBC extends Smarty
|
|||||||
{
|
{
|
||||||
trigger_error("Smarty error: $error_msg", $error_type);
|
trigger_error("Smarty error: $error_msg", $error_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -449,6 +456,7 @@ class SmartyBC extends Smarty
|
|||||||
* @param string $content contents of the block
|
* @param string $content contents of the block
|
||||||
* @param object $template template object
|
* @param object $template template object
|
||||||
* @param boolean &$repeat repeat flag
|
* @param boolean &$repeat repeat flag
|
||||||
|
*
|
||||||
* @return string content re-formatted
|
* @return string content re-formatted
|
||||||
*/
|
*/
|
||||||
function smarty_php_tag($params, $content, $template, &$repeat)
|
function smarty_php_tag($params, $content, $template, &$repeat)
|
||||||
@@ -457,5 +465,3 @@ function smarty_php_tag($params, $content, $template, &$repeat)
|
|||||||
|
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
|
||||||
137
www/Smarty-3.1.21/debug.tpl
Normal file
137
www/Smarty-3.1.21/debug.tpl
Normal file
@@ -0,0 +1,137 @@
|
|||||||
|
{capture name='_smarty_debug' assign=debug_output}
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
|
||||||
|
<head>
|
||||||
|
<title>Smarty Debug Console</title>
|
||||||
|
<style type="text/css">
|
||||||
|
{literal}
|
||||||
|
body, h1, h2, td, th, p {
|
||||||
|
font-family: sans-serif;
|
||||||
|
font-weight: normal;
|
||||||
|
font-size: 0.9em;
|
||||||
|
margin: 1px;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
margin: 0;
|
||||||
|
text-align: left;
|
||||||
|
padding: 2px;
|
||||||
|
background-color: #f0c040;
|
||||||
|
color: black;
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 1.2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
background-color: #9B410E;
|
||||||
|
color: white;
|
||||||
|
text-align: left;
|
||||||
|
font-weight: bold;
|
||||||
|
padding: 2px;
|
||||||
|
border-top: 1px solid black;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
background: black;
|
||||||
|
}
|
||||||
|
|
||||||
|
p, table, div {
|
||||||
|
background: #f0ead8;
|
||||||
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
margin: 0;
|
||||||
|
font-style: italic;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
table {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
th, td {
|
||||||
|
font-family: monospace;
|
||||||
|
vertical-align: top;
|
||||||
|
text-align: left;
|
||||||
|
width: 50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
td {
|
||||||
|
color: green;
|
||||||
|
}
|
||||||
|
|
||||||
|
.odd {
|
||||||
|
background-color: #eeeeee;
|
||||||
|
}
|
||||||
|
|
||||||
|
.even {
|
||||||
|
background-color: #fafafa;
|
||||||
|
}
|
||||||
|
|
||||||
|
.exectime {
|
||||||
|
font-size: 0.8em;
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
|
#table_assigned_vars th {
|
||||||
|
color: blue;
|
||||||
|
}
|
||||||
|
|
||||||
|
#table_config_vars th {
|
||||||
|
color: maroon;
|
||||||
|
}
|
||||||
|
|
||||||
|
{/literal}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<h1>Smarty Debug Console
|
||||||
|
- {if isset($template_name)}{$template_name|debug_print_var nofilter}{else}Total Time {$execution_time|string_format:"%.5f"}{/if}</h1>
|
||||||
|
|
||||||
|
{if !empty($template_data)}
|
||||||
|
<h2>included templates & config files (load time in seconds)</h2>
|
||||||
|
<div>
|
||||||
|
{foreach $template_data as $template}
|
||||||
|
<font color=brown>{$template.name}</font>
|
||||||
|
<span class="exectime">
|
||||||
|
(compile {$template['compile_time']|string_format:"%.5f"}) (render {$template['render_time']|string_format:"%.5f"}) (cache {$template['cache_time']|string_format:"%.5f"}
|
||||||
|
)
|
||||||
|
</span>
|
||||||
|
<br>
|
||||||
|
{/foreach}
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<h2>assigned template variables</h2>
|
||||||
|
|
||||||
|
<table id="table_assigned_vars">
|
||||||
|
{foreach $assigned_vars as $vars}
|
||||||
|
<tr class="{if $vars@iteration % 2 eq 0}odd{else}even{/if}">
|
||||||
|
<th>${$vars@key|escape:'html'}</th>
|
||||||
|
<td>{$vars|debug_print_var nofilter}</td>
|
||||||
|
</tr>
|
||||||
|
{/foreach}
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<h2>assigned config file variables (outer template scope)</h2>
|
||||||
|
|
||||||
|
<table id="table_config_vars">
|
||||||
|
{foreach $config_vars as $vars}
|
||||||
|
<tr class="{if $vars@iteration % 2 eq 0}odd{else}even{/if}">
|
||||||
|
<th>{$vars@key|escape:'html'}</th>
|
||||||
|
<td>{$vars|debug_print_var nofilter}</td>
|
||||||
|
</tr>
|
||||||
|
{/foreach}
|
||||||
|
|
||||||
|
</table>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
{/capture}
|
||||||
|
<script type="text/javascript">
|
||||||
|
{$id = $template_name|default:''|md5}
|
||||||
|
_smarty_console = window.open("", "console{$id}", "width=680,height=600,resizable,scrollbars=yes");
|
||||||
|
_smarty_console.document.write("{$debug_output|escape:'javascript' nofilter}");
|
||||||
|
_smarty_console.document.close();
|
||||||
|
</script>
|
||||||
@@ -8,7 +8,6 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Smarty {textformat}{/textformat} block plugin
|
* Smarty {textformat}{/textformat} block plugin
|
||||||
*
|
|
||||||
* Type: block function<br>
|
* Type: block function<br>
|
||||||
* Name: textformat<br>
|
* Name: textformat<br>
|
||||||
* Purpose: format text a certain way with preset styles
|
* Purpose: format text a certain way with preset styles
|
||||||
@@ -25,10 +24,12 @@
|
|||||||
*
|
*
|
||||||
* @link http://www.smarty.net/manual/en/language.function.textformat.php {textformat}
|
* @link http://www.smarty.net/manual/en/language.function.textformat.php {textformat}
|
||||||
* (Smarty online manual)
|
* (Smarty online manual)
|
||||||
|
*
|
||||||
* @param array $params parameters
|
* @param array $params parameters
|
||||||
* @param string $content contents of the block
|
* @param string $content contents of the block
|
||||||
* @param Smarty_Internal_Template $template template object
|
* @param Smarty_Internal_Template $template template object
|
||||||
* @param boolean &$repeat repeat flag
|
* @param boolean &$repeat repeat flag
|
||||||
|
*
|
||||||
* @return string content re-formatted
|
* @return string content re-formatted
|
||||||
* @author Monte Ohrt <monte at ohrt dot com>
|
* @author Monte Ohrt <monte at ohrt dot com>
|
||||||
*/
|
*/
|
||||||
@@ -76,7 +77,6 @@ function smarty_block_textformat($params, $content, $template, &$repeat)
|
|||||||
}
|
}
|
||||||
// split into paragraphs
|
// split into paragraphs
|
||||||
$_paragraphs = preg_split('![\r\n]{2}!', $content);
|
$_paragraphs = preg_split('![\r\n]{2}!', $content);
|
||||||
$_output = '';
|
|
||||||
|
|
||||||
foreach ($_paragraphs as &$_paragraph) {
|
foreach ($_paragraphs as &$_paragraph) {
|
||||||
if (!$_paragraph) {
|
if (!$_paragraph) {
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Smarty plugin
|
* Smarty plugin
|
||||||
|
*
|
||||||
* @package Smarty
|
* @package Smarty
|
||||||
* @subpackage PluginsFunction
|
* @subpackage PluginsFunction
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Smarty {counter} function plugin
|
* Smarty {counter} function plugin
|
||||||
*
|
|
||||||
* Type: function<br>
|
* Type: function<br>
|
||||||
* Name: counter<br>
|
* Name: counter<br>
|
||||||
* Purpose: print out a counter value
|
* Purpose: print out a counter value
|
||||||
@@ -15,8 +15,10 @@
|
|||||||
* @author Monte Ohrt <monte at ohrt dot com>
|
* @author Monte Ohrt <monte at ohrt dot com>
|
||||||
* @link http://www.smarty.net/manual/en/language.function.counter.php {counter}
|
* @link http://www.smarty.net/manual/en/language.function.counter.php {counter}
|
||||||
* (Smarty online manual)
|
* (Smarty online manual)
|
||||||
|
*
|
||||||
* @param array $params parameters
|
* @param array $params parameters
|
||||||
* @param Smarty_Internal_Template $template template object
|
* @param Smarty_Internal_Template $template template object
|
||||||
|
*
|
||||||
* @return string|null
|
* @return string|null
|
||||||
*/
|
*/
|
||||||
function smarty_function_counter($params, $template)
|
function smarty_function_counter($params, $template)
|
||||||
@@ -66,11 +68,11 @@ function smarty_function_counter($params, $template)
|
|||||||
$counter['direction'] = $params['direction'];
|
$counter['direction'] = $params['direction'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($counter['direction'] == "down")
|
if ($counter['direction'] == "down") {
|
||||||
$counter['count'] -= $counter['skip'];
|
$counter['count'] -= $counter['skip'];
|
||||||
else
|
} else {
|
||||||
$counter['count'] += $counter['skip'];
|
$counter['count'] += $counter['skip'];
|
||||||
|
}
|
||||||
|
|
||||||
return $retval;
|
return $retval;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -8,7 +8,6 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Smarty {cycle} function plugin
|
* Smarty {cycle} function plugin
|
||||||
*
|
|
||||||
* Type: function<br>
|
* Type: function<br>
|
||||||
* Name: cycle<br>
|
* Name: cycle<br>
|
||||||
* Date: May 3, 2002<br>
|
* Date: May 3, 2002<br>
|
||||||
@@ -38,8 +37,10 @@
|
|||||||
* @author credit to Gerard <gerard@interfold.com>
|
* @author credit to Gerard <gerard@interfold.com>
|
||||||
* @author credit to Jason Sweat <jsweat_php@yahoo.com>
|
* @author credit to Jason Sweat <jsweat_php@yahoo.com>
|
||||||
* @version 1.3
|
* @version 1.3
|
||||||
|
*
|
||||||
* @param array $params parameters
|
* @param array $params parameters
|
||||||
* @param Smarty_Internal_Template $template template object
|
* @param Smarty_Internal_Template $template template object
|
||||||
|
*
|
||||||
* @return string|null
|
* @return string|null
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -60,7 +61,8 @@ function smarty_function_cycle($params, $template)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (isset($cycle_vars[$name]['values'])
|
if (isset($cycle_vars[$name]['values'])
|
||||||
&& $cycle_vars[$name]['values'] != $params['values'] ) {
|
&& $cycle_vars[$name]['values'] != $params['values']
|
||||||
|
) {
|
||||||
$cycle_vars[$name]['index'] = 0;
|
$cycle_vars[$name]['index'] = 0;
|
||||||
}
|
}
|
||||||
$cycle_vars[$name]['values'] = $params['values'];
|
$cycle_vars[$name]['values'] = $params['values'];
|
||||||
@@ -8,7 +8,6 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Smarty {fetch} plugin
|
* Smarty {fetch} plugin
|
||||||
*
|
|
||||||
* Type: function<br>
|
* Type: function<br>
|
||||||
* Name: fetch<br>
|
* Name: fetch<br>
|
||||||
* Purpose: fetch file, web or ftp data and display results
|
* Purpose: fetch file, web or ftp data and display results
|
||||||
@@ -16,8 +15,11 @@
|
|||||||
* @link http://www.smarty.net/manual/en/language.function.fetch.php {fetch}
|
* @link http://www.smarty.net/manual/en/language.function.fetch.php {fetch}
|
||||||
* (Smarty online manual)
|
* (Smarty online manual)
|
||||||
* @author Monte Ohrt <monte at ohrt dot com>
|
* @author Monte Ohrt <monte at ohrt dot com>
|
||||||
|
*
|
||||||
* @param array $params parameters
|
* @param array $params parameters
|
||||||
* @param Smarty_Internal_Template $template template object
|
* @param Smarty_Internal_Template $template template object
|
||||||
|
*
|
||||||
|
* @throws SmartyException
|
||||||
* @return string|null if the assign parameter is passed, Smarty assigns the result to a template variable
|
* @return string|null if the assign parameter is passed, Smarty assigns the result to a template variable
|
||||||
*/
|
*/
|
||||||
function smarty_function_fetch($params, $template)
|
function smarty_function_fetch($params, $template)
|
||||||
@@ -8,7 +8,6 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Smarty {html_checkboxes} function plugin
|
* Smarty {html_checkboxes} function plugin
|
||||||
*
|
|
||||||
* File: function.html_checkboxes.php<br>
|
* File: function.html_checkboxes.php<br>
|
||||||
* Type: function<br>
|
* Type: function<br>
|
||||||
* Name: html_checkboxes<br>
|
* Name: html_checkboxes<br>
|
||||||
@@ -37,8 +36,10 @@
|
|||||||
* @author Christopher Kvarme <christopher.kvarme@flashjab.com>
|
* @author Christopher Kvarme <christopher.kvarme@flashjab.com>
|
||||||
* @author credits to Monte Ohrt <monte at ohrt dot com>
|
* @author credits to Monte Ohrt <monte at ohrt dot com>
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
|
*
|
||||||
* @param array $params parameters
|
* @param array $params parameters
|
||||||
* @param object $template template object
|
* @param object $template template object
|
||||||
|
*
|
||||||
* @return string
|
* @return string
|
||||||
* @uses smarty_function_escape_special_chars()
|
* @uses smarty_function_escape_special_chars()
|
||||||
*/
|
*/
|
||||||
@@ -121,7 +122,8 @@ function smarty_function_html_checkboxes($params, $template)
|
|||||||
$$_key = array_values((array)$_val);
|
$$_key = array_values((array)$_val);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'strict': break;
|
case 'strict':
|
||||||
|
break;
|
||||||
|
|
||||||
case 'disabled':
|
case 'disabled':
|
||||||
case 'readonly':
|
case 'readonly':
|
||||||
@@ -148,8 +150,9 @@ function smarty_function_html_checkboxes($params, $template)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($options) && !isset($values))
|
if (!isset($options) && !isset($values)) {
|
||||||
return ''; /* raise error here? */
|
return '';
|
||||||
|
} /* raise error here? */
|
||||||
|
|
||||||
$_html_result = array();
|
$_html_result = array();
|
||||||
|
|
||||||
@@ -171,10 +174,10 @@ function smarty_function_html_checkboxes($params, $template)
|
|||||||
} else {
|
} else {
|
||||||
return implode("\n", $_html_result);
|
return implode("\n", $_html_result);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function smarty_function_html_checkboxes_output($name, $value, $output, $selected, $extra, $separator, $labels, $label_ids, $pos, $escape=true) {
|
function smarty_function_html_checkboxes_output($name, $value, $output, $selected, $extra, $separator, $labels, $label_ids, $pos, $escape = true)
|
||||||
|
{
|
||||||
$_output = '';
|
$_output = '';
|
||||||
|
|
||||||
if (is_object($value)) {
|
if (is_object($value)) {
|
||||||
@@ -182,6 +185,7 @@ function smarty_function_html_checkboxes_output($name, $value, $output, $selecte
|
|||||||
$value = (string) $value->__toString();
|
$value = (string) $value->__toString();
|
||||||
} else {
|
} else {
|
||||||
trigger_error("html_options: value is an object of class '" . get_class($value) . "' without __toString() method", E_USER_NOTICE);
|
trigger_error("html_options: value is an object of class '" . get_class($value) . "' without __toString() method", E_USER_NOTICE);
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -193,6 +197,7 @@ function smarty_function_html_checkboxes_output($name, $value, $output, $selecte
|
|||||||
$output = (string) $output->__toString();
|
$output = (string) $output->__toString();
|
||||||
} else {
|
} else {
|
||||||
trigger_error("html_options: output is an object of class '" . get_class($output) . "' without __toString() method", E_USER_NOTICE);
|
trigger_error("html_options: output is an object of class '" . get_class($output) . "' without __toString() method", E_USER_NOTICE);
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -234,7 +239,6 @@ function smarty_function_html_checkboxes_output($name, $value, $output, $selecte
|
|||||||
}
|
}
|
||||||
|
|
||||||
$_output .= $separator;
|
$_output .= $separator;
|
||||||
|
|
||||||
return $_output;
|
return $_output;
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
|
||||||
@@ -8,7 +8,6 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Smarty {html_image} function plugin
|
* Smarty {html_image} function plugin
|
||||||
*
|
|
||||||
* Type: function<br>
|
* Type: function<br>
|
||||||
* Name: html_image<br>
|
* Name: html_image<br>
|
||||||
* Date: Feb 24, 2003<br>
|
* Date: Feb 24, 2003<br>
|
||||||
@@ -29,8 +28,11 @@
|
|||||||
* @author Monte Ohrt <monte at ohrt dot com>
|
* @author Monte Ohrt <monte at ohrt dot com>
|
||||||
* @author credits to Duda <duda@big.hu>
|
* @author credits to Duda <duda@big.hu>
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
|
*
|
||||||
* @param array $params parameters
|
* @param array $params parameters
|
||||||
* @param Smarty_Internal_Template $template template object
|
* @param Smarty_Internal_Template $template template object
|
||||||
|
*
|
||||||
|
* @throws SmartyException
|
||||||
* @return string
|
* @return string
|
||||||
* @uses smarty_function_escape_special_chars()
|
* @uses smarty_function_escape_special_chars()
|
||||||
*/
|
*/
|
||||||
@@ -112,7 +114,7 @@ function smarty_function_html_image($params, $template)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// local file
|
// local file
|
||||||
if (!$template->smarty->security_policy->isTrustedResourceDir($params['file'])) {
|
if (!$template->smarty->security_policy->isTrustedResourceDir($_image_path)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -8,7 +8,6 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Smarty {html_options} function plugin
|
* Smarty {html_options} function plugin
|
||||||
*
|
|
||||||
* Type: function<br>
|
* Type: function<br>
|
||||||
* Name: html_options<br>
|
* Name: html_options<br>
|
||||||
* Purpose: Prints the list of <option> tags generated from
|
* Purpose: Prints the list of <option> tags generated from
|
||||||
@@ -28,12 +27,13 @@
|
|||||||
* (Smarty online manual)
|
* (Smarty online manual)
|
||||||
* @author Monte Ohrt <monte at ohrt dot com>
|
* @author Monte Ohrt <monte at ohrt dot com>
|
||||||
* @author Ralf Strehle (minor optimization) <ralf dot strehle at yahoo dot de>
|
* @author Ralf Strehle (minor optimization) <ralf dot strehle at yahoo dot de>
|
||||||
|
*
|
||||||
* @param array $params parameters
|
* @param array $params parameters
|
||||||
* @param Smarty_Internal_Template $template template object
|
*
|
||||||
* @return string
|
* @return string
|
||||||
* @uses smarty_function_escape_special_chars()
|
* @uses smarty_function_escape_special_chars()
|
||||||
*/
|
*/
|
||||||
function smarty_function_html_options($params, $template)
|
function smarty_function_html_options($params)
|
||||||
{
|
{
|
||||||
require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php');
|
require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php');
|
||||||
|
|
||||||
@@ -97,7 +97,8 @@ function smarty_function_html_options($params, $template)
|
|||||||
$$_key = (string)$_val;
|
$$_key = (string)$_val;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'strict': break;
|
case 'strict':
|
||||||
|
break;
|
||||||
|
|
||||||
case 'disabled':
|
case 'disabled':
|
||||||
case 'readonly':
|
case 'readonly':
|
||||||
@@ -126,6 +127,7 @@ function smarty_function_html_options($params, $template)
|
|||||||
|
|
||||||
if (!isset($options) && !isset($values)) {
|
if (!isset($options) && !isset($values)) {
|
||||||
/* raise error here? */
|
/* raise error here? */
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -171,6 +173,7 @@ function smarty_function_html_options_optoutput($key, $value, $selected, $id, $c
|
|||||||
$value = smarty_function_escape_special_chars((string) $value->__toString());
|
$value = smarty_function_escape_special_chars((string) $value->__toString());
|
||||||
} else {
|
} else {
|
||||||
trigger_error("html_options: value is an object of class '" . get_class($value) . "' without __toString() method", E_USER_NOTICE);
|
trigger_error("html_options: value is an object of class '" . get_class($value) . "' without __toString() method", E_USER_NOTICE);
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -180,9 +183,10 @@ function smarty_function_html_options_optoutput($key, $value, $selected, $id, $c
|
|||||||
$idx ++;
|
$idx ++;
|
||||||
} else {
|
} else {
|
||||||
$_idx = 0;
|
$_idx = 0;
|
||||||
$_html_result = smarty_function_html_options_optgroup($key, $value, $selected, !empty($id) ? ($id.'-'.$idx) : null, $class, $label, $_idx);
|
$_html_result = smarty_function_html_options_optgroup($key, $value, $selected, !empty($id) ? ($id . '-' . $idx) : null, $class, $_idx);
|
||||||
$idx ++;
|
$idx ++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $_html_result;
|
return $_html_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -193,7 +197,6 @@ function smarty_function_html_options_optgroup($key, $values, $selected, $id, $c
|
|||||||
$optgroup_html .= smarty_function_html_options_optoutput($key, $value, $selected, $id, $class, $label, $idx);
|
$optgroup_html .= smarty_function_html_options_optoutput($key, $value, $selected, $id, $class, $label, $idx);
|
||||||
}
|
}
|
||||||
$optgroup_html .= "</optgroup>\n";
|
$optgroup_html .= "</optgroup>\n";
|
||||||
|
|
||||||
return $optgroup_html;
|
return $optgroup_html;
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
|
||||||
@@ -8,7 +8,6 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Smarty {html_radios} function plugin
|
* Smarty {html_radios} function plugin
|
||||||
*
|
|
||||||
* File: function.html_radios.php<br>
|
* File: function.html_radios.php<br>
|
||||||
* Type: function<br>
|
* Type: function<br>
|
||||||
* Name: html_radios<br>
|
* Name: html_radios<br>
|
||||||
@@ -37,8 +36,10 @@
|
|||||||
* @author Christopher Kvarme <christopher.kvarme@flashjab.com>
|
* @author Christopher Kvarme <christopher.kvarme@flashjab.com>
|
||||||
* @author credits to Monte Ohrt <monte at ohrt dot com>
|
* @author credits to Monte Ohrt <monte at ohrt dot com>
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
|
*
|
||||||
* @param array $params parameters
|
* @param array $params parameters
|
||||||
* @param Smarty_Internal_Template $template template object
|
* @param Smarty_Internal_Template $template template object
|
||||||
|
*
|
||||||
* @return string
|
* @return string
|
||||||
* @uses smarty_function_escape_special_chars()
|
* @uses smarty_function_escape_special_chars()
|
||||||
*/
|
*/
|
||||||
@@ -102,7 +103,8 @@ function smarty_function_html_radios($params, $template)
|
|||||||
case 'assign':
|
case 'assign':
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'strict': break;
|
case 'strict':
|
||||||
|
break;
|
||||||
|
|
||||||
case 'disabled':
|
case 'disabled':
|
||||||
case 'readonly':
|
case 'readonly':
|
||||||
@@ -17,11 +17,9 @@ require_once(SMARTY_PLUGINS_DIR . 'shared.make_timestamp.php');
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Smarty {html_select_date} plugin
|
* Smarty {html_select_date} plugin
|
||||||
*
|
|
||||||
* Type: function<br>
|
* Type: function<br>
|
||||||
* Name: html_select_date<br>
|
* Name: html_select_date<br>
|
||||||
* Purpose: Prints the dropdowns for date selection.
|
* Purpose: Prints the dropdowns for date selection.
|
||||||
*
|
|
||||||
* ChangeLog:
|
* ChangeLog:
|
||||||
* <pre>
|
* <pre>
|
||||||
* - 1.0 initial release
|
* - 1.0 initial release
|
||||||
@@ -47,11 +45,12 @@ require_once(SMARTY_PLUGINS_DIR . 'shared.make_timestamp.php');
|
|||||||
* @author Andrei Zmievski
|
* @author Andrei Zmievski
|
||||||
* @author Monte Ohrt <monte at ohrt dot com>
|
* @author Monte Ohrt <monte at ohrt dot com>
|
||||||
* @author Rodney Rehm
|
* @author Rodney Rehm
|
||||||
|
*
|
||||||
* @param array $params parameters
|
* @param array $params parameters
|
||||||
* @param Smarty_Internal_Template $template template object
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function smarty_function_html_select_date($params, $template)
|
function smarty_function_html_select_date($params)
|
||||||
{
|
{
|
||||||
// generate timestamps used for month names only
|
// generate timestamps used for month names only
|
||||||
static $_month_timestamps = null;
|
static $_month_timestamps = null;
|
||||||
@@ -187,7 +186,6 @@ function smarty_function_html_select_date($params, $template)
|
|||||||
? $params['time'][$prefix . $_elementName]
|
? $params['time'][$prefix . $_elementName]
|
||||||
: date($_elementKey);
|
: date($_elementKey);
|
||||||
}
|
}
|
||||||
$time = mktime(0, 0, 0, $_month, $_day, $_year);
|
|
||||||
} elseif (isset($params['time'][$field_array][$prefix . 'Year'])) {
|
} elseif (isset($params['time'][$field_array][$prefix . 'Year'])) {
|
||||||
// $_REQUEST given
|
// $_REQUEST given
|
||||||
foreach (array('Y' => 'Year', 'm' => 'Month', 'd' => 'Day') as $_elementKey => $_elementName) {
|
foreach (array('Y' => 'Year', 'm' => 'Month', 'd' => 'Day') as $_elementKey => $_elementName) {
|
||||||
@@ -196,7 +194,6 @@ function smarty_function_html_select_date($params, $template)
|
|||||||
? $params['time'][$field_array][$prefix . $_elementName]
|
? $params['time'][$field_array][$prefix . $_elementName]
|
||||||
: date($_elementKey);
|
: date($_elementKey);
|
||||||
}
|
}
|
||||||
$time = mktime(0, 0, 0, $_month, $_day, $_year);
|
|
||||||
} else {
|
} else {
|
||||||
// no date found, use NOW
|
// no date found, use NOW
|
||||||
list($_year, $_month, $_day) = $time = explode('-', date('Y-m-d'));
|
list($_year, $_month, $_day) = $time = explode('-', date('Y-m-d'));
|
||||||
@@ -219,9 +216,9 @@ function smarty_function_html_select_date($params, $template)
|
|||||||
if ($t === null) {
|
if ($t === null) {
|
||||||
$$key = (int) $_current_year;
|
$$key = (int) $_current_year;
|
||||||
} elseif ($t[0] == '+') {
|
} elseif ($t[0] == '+') {
|
||||||
$$key = (int) ($_current_year + trim(substr($t, 1)));
|
$$key = (int) ($_current_year + (int)trim(substr($t, 1)));
|
||||||
} elseif ($t[0] == '-') {
|
} elseif ($t[0] == '-') {
|
||||||
$$key = (int) ($_current_year - trim(substr($t, 1)));
|
$$key = (int) ($_current_year - (int)trim(substr($t, 1)));
|
||||||
} else {
|
} else {
|
||||||
$$key = (int) $$key;
|
$$key = (int) $$key;
|
||||||
}
|
}
|
||||||
@@ -236,7 +233,6 @@ function smarty_function_html_select_date($params, $template)
|
|||||||
|
|
||||||
// generate year <select> or <input>
|
// generate year <select> or <input>
|
||||||
if ($display_years) {
|
if ($display_years) {
|
||||||
$_html_years = '';
|
|
||||||
$_extra = '';
|
$_extra = '';
|
||||||
$_name = $field_array ? ($field_array . '[' . $prefix . 'Year]') : ($prefix . 'Year');
|
$_name = $field_array ? ($field_array . '[' . $prefix . 'Year]') : ($prefix . 'Year');
|
||||||
if ($all_extra) {
|
if ($all_extra) {
|
||||||
@@ -277,7 +273,6 @@ function smarty_function_html_select_date($params, $template)
|
|||||||
|
|
||||||
// generate month <select> or <input>
|
// generate month <select> or <input>
|
||||||
if ($display_months) {
|
if ($display_months) {
|
||||||
$_html_month = '';
|
|
||||||
$_extra = '';
|
$_extra = '';
|
||||||
$_name = $field_array ? ($field_array . '[' . $prefix . 'Month]') : ($prefix . 'Month');
|
$_name = $field_array ? ($field_array . '[' . $prefix . 'Month]') : ($prefix . 'Month');
|
||||||
if ($all_extra) {
|
if ($all_extra) {
|
||||||
@@ -316,7 +311,6 @@ function smarty_function_html_select_date($params, $template)
|
|||||||
|
|
||||||
// generate day <select> or <input>
|
// generate day <select> or <input>
|
||||||
if ($display_days) {
|
if ($display_days) {
|
||||||
$_html_day = '';
|
|
||||||
$_extra = '';
|
$_extra = '';
|
||||||
$_name = $field_array ? ($field_array . '[' . $prefix . 'Day]') : ($prefix . 'Day');
|
$_name = $field_array ? ($field_array . '[' . $prefix . 'Day]') : ($prefix . 'Day');
|
||||||
if ($all_extra) {
|
if ($all_extra) {
|
||||||
@@ -17,7 +17,6 @@ require_once(SMARTY_PLUGINS_DIR . 'shared.make_timestamp.php');
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Smarty {html_select_time} function plugin
|
* Smarty {html_select_time} function plugin
|
||||||
*
|
|
||||||
* Type: function<br>
|
* Type: function<br>
|
||||||
* Name: html_select_time<br>
|
* Name: html_select_time<br>
|
||||||
* Purpose: Prints the dropdowns for time selection
|
* Purpose: Prints the dropdowns for time selection
|
||||||
@@ -26,12 +25,13 @@ require_once(SMARTY_PLUGINS_DIR . 'shared.make_timestamp.php');
|
|||||||
* (Smarty online manual)
|
* (Smarty online manual)
|
||||||
* @author Roberto Berto <roberto@berto.net>
|
* @author Roberto Berto <roberto@berto.net>
|
||||||
* @author Monte Ohrt <monte AT ohrt DOT com>
|
* @author Monte Ohrt <monte AT ohrt DOT com>
|
||||||
|
*
|
||||||
* @param array $params parameters
|
* @param array $params parameters
|
||||||
* @param Smarty_Internal_Template $template template object
|
*
|
||||||
* @return string
|
* @return string
|
||||||
* @uses smarty_make_timestamp()
|
* @uses smarty_make_timestamp()
|
||||||
*/
|
*/
|
||||||
function smarty_function_html_select_time($params, $template)
|
function smarty_function_html_select_time($params)
|
||||||
{
|
{
|
||||||
$prefix = "Time_";
|
$prefix = "Time_";
|
||||||
$field_array = null;
|
$field_array = null;
|
||||||
@@ -8,7 +8,6 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Smarty {html_table} function plugin
|
* Smarty {html_table} function plugin
|
||||||
*
|
|
||||||
* Type: function<br>
|
* Type: function<br>
|
||||||
* Name: html_table<br>
|
* Name: html_table<br>
|
||||||
* Date: Feb 17, 2003<br>
|
* Date: Feb 17, 2003<br>
|
||||||
@@ -43,11 +42,12 @@
|
|||||||
* @version 1.1
|
* @version 1.1
|
||||||
* @link http://www.smarty.net/manual/en/language.function.html.table.php {html_table}
|
* @link http://www.smarty.net/manual/en/language.function.html.table.php {html_table}
|
||||||
* (Smarty online manual)
|
* (Smarty online manual)
|
||||||
|
*
|
||||||
* @param array $params parameters
|
* @param array $params parameters
|
||||||
* @param Smarty_Internal_Template $template template object
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function smarty_function_html_table($params, $template)
|
function smarty_function_html_table($params)
|
||||||
{
|
{
|
||||||
$table_attr = 'border="1"';
|
$table_attr = 'border="1"';
|
||||||
$tr_attr = '';
|
$tr_attr = '';
|
||||||
@@ -8,7 +8,6 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Smarty {mailto} function plugin
|
* Smarty {mailto} function plugin
|
||||||
*
|
|
||||||
* Type: function<br>
|
* Type: function<br>
|
||||||
* Name: mailto<br>
|
* Name: mailto<br>
|
||||||
* Date: May 21, 2002
|
* Date: May 21, 2002
|
||||||
@@ -44,11 +43,12 @@
|
|||||||
* @version 1.2
|
* @version 1.2
|
||||||
* @author Monte Ohrt <monte at ohrt dot com>
|
* @author Monte Ohrt <monte at ohrt dot com>
|
||||||
* @author credits to Jason Sweat (added cc, bcc and subject functionality)
|
* @author credits to Jason Sweat (added cc, bcc and subject functionality)
|
||||||
|
*
|
||||||
* @param array $params parameters
|
* @param array $params parameters
|
||||||
* @param Smarty_Internal_Template $template template object
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function smarty_function_mailto($params, $template)
|
function smarty_function_mailto($params)
|
||||||
{
|
{
|
||||||
static $_allowed_encoding = array('javascript' => true, 'javascript_charcode' => true, 'hex' => true, 'none' => true);
|
static $_allowed_encoding = array('javascript' => true, 'javascript_charcode' => true, 'hex' => true, 'none' => true);
|
||||||
$extra = '';
|
$extra = '';
|
||||||
@@ -72,8 +72,9 @@ function smarty_function_mailto($params, $template)
|
|||||||
case 'cc':
|
case 'cc':
|
||||||
case 'bcc':
|
case 'bcc':
|
||||||
case 'followupto':
|
case 'followupto':
|
||||||
if (!empty($value))
|
if (!empty($value)) {
|
||||||
$mail_parms[] = $var . '=' . str_replace($search, $replace, rawurlencode($value));
|
$mail_parms[] = $var . '=' . str_replace($search, $replace, rawurlencode($value));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'subject':
|
case 'subject':
|
||||||
@@ -1,15 +1,14 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Smarty plugin
|
* Smarty plugin
|
||||||
*
|
|
||||||
* This plugin is only for Smarty2 BC
|
* This plugin is only for Smarty2 BC
|
||||||
|
*
|
||||||
* @package Smarty
|
* @package Smarty
|
||||||
* @subpackage PluginsFunction
|
* @subpackage PluginsFunction
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Smarty {math} function plugin
|
* Smarty {math} function plugin
|
||||||
*
|
|
||||||
* Type: function<br>
|
* Type: function<br>
|
||||||
* Name: math<br>
|
* Name: math<br>
|
||||||
* Purpose: handle math computations in template
|
* Purpose: handle math computations in template
|
||||||
@@ -17,8 +16,10 @@
|
|||||||
* @link http://www.smarty.net/manual/en/language.function.math.php {math}
|
* @link http://www.smarty.net/manual/en/language.function.math.php {math}
|
||||||
* (Smarty online manual)
|
* (Smarty online manual)
|
||||||
* @author Monte Ohrt <monte at ohrt dot com>
|
* @author Monte Ohrt <monte at ohrt dot com>
|
||||||
|
*
|
||||||
* @param array $params parameters
|
* @param array $params parameters
|
||||||
* @param Smarty_Internal_Template $template template object
|
* @param Smarty_Internal_Template $template template object
|
||||||
|
*
|
||||||
* @return string|null
|
* @return string|null
|
||||||
*/
|
*/
|
||||||
function smarty_function_math($params, $template)
|
function smarty_function_math($params, $template)
|
||||||
@@ -8,16 +8,15 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Smarty capitalize modifier plugin
|
* Smarty capitalize modifier plugin
|
||||||
*
|
|
||||||
* Type: modifier<br>
|
* Type: modifier<br>
|
||||||
* Name: capitalize<br>
|
* Name: capitalize<br>
|
||||||
* Purpose: capitalize words in the string
|
* Purpose: capitalize words in the string
|
||||||
*
|
|
||||||
* {@internal {$string|capitalize:true:true} is the fastest option for MBString enabled systems }}
|
* {@internal {$string|capitalize:true:true} is the fastest option for MBString enabled systems }}
|
||||||
*
|
*
|
||||||
* @param string $string string to capitalize
|
* @param string $string string to capitalize
|
||||||
* @param boolean $uc_digits also capitalize "x123" to "X123"
|
* @param boolean $uc_digits also capitalize "x123" to "X123"
|
||||||
* @param boolean $lc_rest capitalize first letters, lowercase all following letters "aAa" to "Aaa"
|
* @param boolean $lc_rest capitalize first letters, lowercase all following letters "aAa" to "Aaa"
|
||||||
|
*
|
||||||
* @return string capitalized string
|
* @return string capitalized string
|
||||||
* @author Monte Ohrt <monte at ohrt dot com>
|
* @author Monte Ohrt <monte at ohrt dot com>
|
||||||
* @author Rodney Rehm
|
* @author Rodney Rehm
|
||||||
@@ -30,7 +29,7 @@ function smarty_modifier_capitalize($string, $uc_digits = false, $lc_rest = fals
|
|||||||
$upper_string = mb_convert_case($string, MB_CASE_TITLE, Smarty::$_CHARSET);
|
$upper_string = mb_convert_case($string, MB_CASE_TITLE, Smarty::$_CHARSET);
|
||||||
} else {
|
} else {
|
||||||
// uppercase word breaks
|
// uppercase word breaks
|
||||||
$upper_string = preg_replace_callback("!(^|[^\p{L}'])([\p{Ll}])!S" . Smarty::$_UTF8_MODIFIER, create_function ('$matches', 'return stripslashes($matches[1]).mb_convert_case(stripslashes($matches[2]),MB_CASE_UPPER, "' . addslashes(Smarty::$_CHARSET) . '");'), $string);
|
$upper_string = preg_replace_callback("!(^|[^\p{L}'])([\p{Ll}])!S" . Smarty::$_UTF8_MODIFIER, 'smarty_mod_cap_mbconvert_cb', $string);
|
||||||
}
|
}
|
||||||
// check uc_digits case
|
// check uc_digits case
|
||||||
if (!$uc_digits) {
|
if (!$uc_digits) {
|
||||||
@@ -40,8 +39,7 @@ function smarty_modifier_capitalize($string, $uc_digits = false, $lc_rest = fals
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$upper_string = preg_replace_callback("!((^|\s)['\"])(\w)!" . Smarty::$_UTF8_MODIFIER, create_function ('$matches', 'return stripslashes($matches[1]).mb_convert_case(stripslashes($matches[3]),MB_CASE_UPPER, "' . addslashes(Smarty::$_CHARSET) . '");'), $upper_string);
|
$upper_string = preg_replace_callback("!((^|\s)['\"])(\w)!" . Smarty::$_UTF8_MODIFIER, 'smarty_mod_cap_mbconvert2_cb', $upper_string);
|
||||||
|
|
||||||
return $upper_string;
|
return $upper_string;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,7 +48,7 @@ function smarty_modifier_capitalize($string, $uc_digits = false, $lc_rest = fals
|
|||||||
$string = strtolower($string);
|
$string = strtolower($string);
|
||||||
}
|
}
|
||||||
// uppercase (including hyphenated words)
|
// uppercase (including hyphenated words)
|
||||||
$upper_string = preg_replace_callback("!(^|[^\p{L}'])([\p{Ll}])!S" . Smarty::$_UTF8_MODIFIER, create_function ('$matches', 'return stripslashes($matches[1]).ucfirst(stripslashes($matches[2]));'), $string);
|
$upper_string = preg_replace_callback("!(^|[^\p{L}'])([\p{Ll}])!S" . Smarty::$_UTF8_MODIFIER, 'smarty_mod_cap_ucfirst_cb', $string);
|
||||||
// check uc_digits case
|
// check uc_digits case
|
||||||
if (!$uc_digits) {
|
if (!$uc_digits) {
|
||||||
if (preg_match_all("!\b([\p{L}]*[\p{N}]+[\p{L}]*)\b!" . Smarty::$_UTF8_MODIFIER, $string, $matches, PREG_OFFSET_CAPTURE)) {
|
if (preg_match_all("!\b([\p{L}]*[\p{N}]+[\p{L}]*)\b!" . Smarty::$_UTF8_MODIFIER, $string, $matches, PREG_OFFSET_CAPTURE)) {
|
||||||
@@ -59,7 +57,34 @@ function smarty_modifier_capitalize($string, $uc_digits = false, $lc_rest = fals
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$upper_string = preg_replace_callback("!((^|\s)['\"])(\w)!" . Smarty::$_UTF8_MODIFIER, create_function ('$matches', 'return stripslashes($matches[1]).ucfirst(stripslashes($matches[3]));'), $upper_string);
|
$upper_string = preg_replace_callback("!((^|\s)['\"])(\w)!" . Smarty::$_UTF8_MODIFIER, 'smarty_mod_cap_ucfirst2_cb', $upper_string);
|
||||||
|
|
||||||
return $upper_string;
|
return $upper_string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* Bug: create_function() use exhausts memory when used in long loops
|
||||||
|
* Fix: use declared functions for callbacks instead of using create_function()
|
||||||
|
* Note: This can be fixed using anonymous functions instead, but that requires PHP >= 5.3
|
||||||
|
*
|
||||||
|
* @author Kyle Renfrow
|
||||||
|
*/
|
||||||
|
function smarty_mod_cap_mbconvert_cb($matches)
|
||||||
|
{
|
||||||
|
return stripslashes($matches[1]) . mb_convert_case(stripslashes($matches[2]), MB_CASE_UPPER, Smarty::$_CHARSET);
|
||||||
|
}
|
||||||
|
|
||||||
|
function smarty_mod_cap_mbconvert2_cb($matches)
|
||||||
|
{
|
||||||
|
return stripslashes($matches[1]) . mb_convert_case(stripslashes($matches[3]), MB_CASE_UPPER, Smarty::$_CHARSET);
|
||||||
|
}
|
||||||
|
|
||||||
|
function smarty_mod_cap_ucfirst_cb($matches)
|
||||||
|
{
|
||||||
|
return stripslashes($matches[1]) . ucfirst(stripslashes($matches[2]));
|
||||||
|
}
|
||||||
|
|
||||||
|
function smarty_mod_cap_ucfirst2_cb($matches)
|
||||||
|
{
|
||||||
|
return stripslashes($matches[1]) . ucfirst(stripslashes($matches[3]));
|
||||||
|
}
|
||||||
@@ -8,7 +8,6 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Smarty date_format modifier plugin
|
* Smarty date_format modifier plugin
|
||||||
*
|
|
||||||
* Type: modifier<br>
|
* Type: modifier<br>
|
||||||
* Name: date_format<br>
|
* Name: date_format<br>
|
||||||
* Purpose: format datestamps via strftime<br>
|
* Purpose: format datestamps via strftime<br>
|
||||||
@@ -19,10 +18,12 @@
|
|||||||
*
|
*
|
||||||
* @link http://www.smarty.net/manual/en/language.modifier.date.format.php date_format (Smarty online manual)
|
* @link http://www.smarty.net/manual/en/language.modifier.date.format.php date_format (Smarty online manual)
|
||||||
* @author Monte Ohrt <monte at ohrt dot com>
|
* @author Monte Ohrt <monte at ohrt dot com>
|
||||||
|
*
|
||||||
* @param string $string input date string
|
* @param string $string input date string
|
||||||
* @param string $format strftime format for output
|
* @param string $format strftime format for output
|
||||||
* @param string $default_date default date if $string is empty
|
* @param string $default_date default date if $string is empty
|
||||||
* @param string $formatter either 'strftime' or 'auto'
|
* @param string $formatter either 'strftime' or 'auto'
|
||||||
|
*
|
||||||
* @return string |void
|
* @return string |void
|
||||||
* @uses smarty_make_timestamp()
|
* @uses smarty_make_timestamp()
|
||||||
*/
|
*/
|
||||||
@@ -8,15 +8,16 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Smarty debug_print_var modifier plugin
|
* Smarty debug_print_var modifier plugin
|
||||||
*
|
|
||||||
* Type: modifier<br>
|
* Type: modifier<br>
|
||||||
* Name: debug_print_var<br>
|
* Name: debug_print_var<br>
|
||||||
* Purpose: formats variable contents for display in the console
|
* Purpose: formats variable contents for display in the console
|
||||||
*
|
*
|
||||||
* @author Monte Ohrt <monte at ohrt dot com>
|
* @author Monte Ohrt <monte at ohrt dot com>
|
||||||
|
*
|
||||||
* @param array|object $var variable to be formatted
|
* @param array|object $var variable to be formatted
|
||||||
* @param integer $depth maximum recursion depth if $var is an array
|
* @param integer $depth maximum recursion depth if $var is an array
|
||||||
* @param integer $length maximum string length if $var is a string
|
* @param integer $length maximum string length if $var is a string
|
||||||
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function smarty_modifier_debug_print_var($var, $depth = 0, $length = 40)
|
function smarty_modifier_debug_print_var($var, $depth = 0, $length = 40)
|
||||||
@@ -8,17 +8,18 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Smarty escape modifier plugin
|
* Smarty escape modifier plugin
|
||||||
*
|
|
||||||
* Type: modifier<br>
|
* Type: modifier<br>
|
||||||
* Name: escape<br>
|
* Name: escape<br>
|
||||||
* Purpose: escape string for output
|
* Purpose: escape string for output
|
||||||
*
|
*
|
||||||
* @link http://www.smarty.net/manual/en/language.modifier.count.characters.php count_characters (Smarty online manual)
|
* @link http://www.smarty.net/docs/en/language.modifier.escape
|
||||||
* @author Monte Ohrt <monte at ohrt dot com>
|
* @author Monte Ohrt <monte at ohrt dot com>
|
||||||
|
*
|
||||||
* @param string $string input string
|
* @param string $string input string
|
||||||
* @param string $esc_type escape type
|
* @param string $esc_type escape type
|
||||||
* @param string $char_set character set, used for htmlspecialchars() or htmlentities()
|
* @param string $char_set character set, used for htmlspecialchars() or htmlentities()
|
||||||
* @param boolean $double_encode encode already encoded entitites again, used for htmlspecialchars() or htmlentities()
|
* @param boolean $double_encode encode already encoded entitites again, used for htmlspecialchars() or htmlentities()
|
||||||
|
*
|
||||||
* @return string escaped input string
|
* @return string escaped input string
|
||||||
*/
|
*/
|
||||||
function smarty_modifier_escape($string, $esc_type = 'html', $char_set = null, $double_encode = true)
|
function smarty_modifier_escape($string, $esc_type = 'html', $char_set = null, $double_encode = true)
|
||||||
@@ -8,7 +8,6 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Smarty regex_replace modifier plugin
|
* Smarty regex_replace modifier plugin
|
||||||
*
|
|
||||||
* Type: modifier<br>
|
* Type: modifier<br>
|
||||||
* Name: regex_replace<br>
|
* Name: regex_replace<br>
|
||||||
* Purpose: regular expression search/replace
|
* Purpose: regular expression search/replace
|
||||||
@@ -16,9 +15,11 @@
|
|||||||
* @link http://smarty.php.net/manual/en/language.modifier.regex.replace.php
|
* @link http://smarty.php.net/manual/en/language.modifier.regex.replace.php
|
||||||
* regex_replace (Smarty online manual)
|
* regex_replace (Smarty online manual)
|
||||||
* @author Monte Ohrt <monte at ohrt dot com>
|
* @author Monte Ohrt <monte at ohrt dot com>
|
||||||
|
*
|
||||||
* @param string $string input string
|
* @param string $string input string
|
||||||
* @param string|array $search regular expression(s) to search for
|
* @param string|array $search regular expression(s) to search for
|
||||||
* @param string|array $replace string(s) that should be replaced
|
* @param string|array $replace string(s) that should be replaced
|
||||||
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function smarty_modifier_regex_replace($string, $search, $replace)
|
function smarty_modifier_regex_replace($string, $search, $replace)
|
||||||
@@ -36,6 +37,7 @@ function smarty_modifier_regex_replace($string, $search, $replace)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $search string(s) that should be replaced
|
* @param string $search string(s) that should be replaced
|
||||||
|
*
|
||||||
* @return string
|
* @return string
|
||||||
* @ignore
|
* @ignore
|
||||||
*/
|
*/
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Smarty plugin
|
* Smarty plugin
|
||||||
|
*
|
||||||
* @package Smarty
|
* @package Smarty
|
||||||
* @subpackage PluginsModifier
|
* @subpackage PluginsModifier
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Smarty replace modifier plugin
|
* Smarty replace modifier plugin
|
||||||
*
|
|
||||||
* Type: modifier<br>
|
* Type: modifier<br>
|
||||||
* Name: replace<br>
|
* Name: replace<br>
|
||||||
* Purpose: simple search/replace
|
* Purpose: simple search/replace
|
||||||
@@ -15,9 +15,11 @@
|
|||||||
* @link http://smarty.php.net/manual/en/language.modifier.replace.php replace (Smarty online manual)
|
* @link http://smarty.php.net/manual/en/language.modifier.replace.php replace (Smarty online manual)
|
||||||
* @author Monte Ohrt <monte at ohrt dot com>
|
* @author Monte Ohrt <monte at ohrt dot com>
|
||||||
* @author Uwe Tews
|
* @author Uwe Tews
|
||||||
|
*
|
||||||
* @param string $string input string
|
* @param string $string input string
|
||||||
* @param string $search text to search for
|
* @param string $search text to search for
|
||||||
* @param string $replace replacement text
|
* @param string $replace replacement text
|
||||||
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function smarty_modifier_replace($string, $search, $replace)
|
function smarty_modifier_replace($string, $search, $replace)
|
||||||
@@ -1,21 +1,23 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Smarty plugin
|
* Smarty plugin
|
||||||
|
*
|
||||||
* @package Smarty
|
* @package Smarty
|
||||||
* @subpackage PluginsModifier
|
* @subpackage PluginsModifier
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Smarty spacify modifier plugin
|
* Smarty spacify modifier plugin
|
||||||
*
|
|
||||||
* Type: modifier<br>
|
* Type: modifier<br>
|
||||||
* Name: spacify<br>
|
* Name: spacify<br>
|
||||||
* Purpose: add spaces between characters in a string
|
* Purpose: add spaces between characters in a string
|
||||||
*
|
*
|
||||||
* @link http://smarty.php.net/manual/en/language.modifier.spacify.php spacify (Smarty online manual)
|
* @link http://smarty.php.net/manual/en/language.modifier.spacify.php spacify (Smarty online manual)
|
||||||
* @author Monte Ohrt <monte at ohrt dot com>
|
* @author Monte Ohrt <monte at ohrt dot com>
|
||||||
|
*
|
||||||
* @param string $string input string
|
* @param string $string input string
|
||||||
* @param string $spacify_char string to insert between characters.
|
* @param string $spacify_char string to insert between characters.
|
||||||
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function smarty_modifier_spacify($string, $spacify_char = ' ')
|
function smarty_modifier_spacify($string, $spacify_char = ' ')
|
||||||
@@ -8,7 +8,6 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Smarty truncate modifier plugin
|
* Smarty truncate modifier plugin
|
||||||
*
|
|
||||||
* Type: modifier<br>
|
* Type: modifier<br>
|
||||||
* Name: truncate<br>
|
* Name: truncate<br>
|
||||||
* Purpose: Truncate a string to a certain length if necessary,
|
* Purpose: Truncate a string to a certain length if necessary,
|
||||||
@@ -17,17 +16,20 @@
|
|||||||
*
|
*
|
||||||
* @link http://smarty.php.net/manual/en/language.modifier.truncate.php truncate (Smarty online manual)
|
* @link http://smarty.php.net/manual/en/language.modifier.truncate.php truncate (Smarty online manual)
|
||||||
* @author Monte Ohrt <monte at ohrt dot com>
|
* @author Monte Ohrt <monte at ohrt dot com>
|
||||||
|
*
|
||||||
* @param string $string input string
|
* @param string $string input string
|
||||||
* @param integer $length length of truncated text
|
* @param integer $length length of truncated text
|
||||||
* @param string $etc end string
|
* @param string $etc end string
|
||||||
* @param boolean $break_words truncate at word boundary
|
* @param boolean $break_words truncate at word boundary
|
||||||
* @param boolean $middle truncate in the middle of text
|
* @param boolean $middle truncate in the middle of text
|
||||||
|
*
|
||||||
* @return string truncated string
|
* @return string truncated string
|
||||||
*/
|
*/
|
||||||
function smarty_modifier_truncate($string, $length = 80, $etc = '...', $break_words = false, $middle = false)
|
function smarty_modifier_truncate($string, $length = 80, $etc = '...', $break_words = false, $middle = false)
|
||||||
{
|
{
|
||||||
if ($length == 0)
|
if ($length == 0) {
|
||||||
return '';
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
if (Smarty::$_MBSTRING) {
|
if (Smarty::$_MBSTRING) {
|
||||||
if (mb_strlen($string, Smarty::$_CHARSET) > $length) {
|
if (mb_strlen($string, Smarty::$_CHARSET) > $length) {
|
||||||
@@ -8,7 +8,6 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Smarty cat modifier plugin
|
* Smarty cat modifier plugin
|
||||||
*
|
|
||||||
* Type: modifier<br>
|
* Type: modifier<br>
|
||||||
* Name: cat<br>
|
* Name: cat<br>
|
||||||
* Date: Feb 24, 2003<br>
|
* Date: Feb 24, 2003<br>
|
||||||
@@ -19,10 +18,12 @@
|
|||||||
* @link http://smarty.php.net/manual/en/language.modifier.cat.php cat
|
* @link http://smarty.php.net/manual/en/language.modifier.cat.php cat
|
||||||
* (Smarty online manual)
|
* (Smarty online manual)
|
||||||
* @author Uwe Tews
|
* @author Uwe Tews
|
||||||
|
*
|
||||||
* @param array $params parameters
|
* @param array $params parameters
|
||||||
|
*
|
||||||
* @return string with compiled code
|
* @return string with compiled code
|
||||||
*/
|
*/
|
||||||
function smarty_modifiercompiler_cat($params, $compiler)
|
function smarty_modifiercompiler_cat($params)
|
||||||
{
|
{
|
||||||
return '(' . implode(').(', $params) . ')';
|
return '(' . implode(').(', $params) . ')';
|
||||||
}
|
}
|
||||||
@@ -8,17 +8,18 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Smarty count_characters modifier plugin
|
* Smarty count_characters modifier plugin
|
||||||
*
|
|
||||||
* Type: modifier<br>
|
* Type: modifier<br>
|
||||||
* Name: count_characteres<br>
|
* Name: count_characteres<br>
|
||||||
* Purpose: count the number of characters in a text
|
* Purpose: count the number of characters in a text
|
||||||
*
|
*
|
||||||
* @link http://www.smarty.net/manual/en/language.modifier.count.characters.php count_characters (Smarty online manual)
|
* @link http://www.smarty.net/manual/en/language.modifier.count.characters.php count_characters (Smarty online manual)
|
||||||
* @author Uwe Tews
|
* @author Uwe Tews
|
||||||
|
*
|
||||||
* @param array $params parameters
|
* @param array $params parameters
|
||||||
|
*
|
||||||
* @return string with compiled code
|
* @return string with compiled code
|
||||||
*/
|
*/
|
||||||
function smarty_modifiercompiler_count_characters($params, $compiler)
|
function smarty_modifiercompiler_count_characters($params)
|
||||||
{
|
{
|
||||||
if (!isset($params[1]) || $params[1] != 'true') {
|
if (!isset($params[1]) || $params[1] != 'true') {
|
||||||
return 'preg_match_all(\'/[^\s]/' . Smarty::$_UTF8_MODIFIER . '\',' . $params[0] . ', $tmp)';
|
return 'preg_match_all(\'/[^\s]/' . Smarty::$_UTF8_MODIFIER . '\',' . $params[0] . ', $tmp)';
|
||||||
@@ -8,7 +8,6 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Smarty count_paragraphs modifier plugin
|
* Smarty count_paragraphs modifier plugin
|
||||||
*
|
|
||||||
* Type: modifier<br>
|
* Type: modifier<br>
|
||||||
* Name: count_paragraphs<br>
|
* Name: count_paragraphs<br>
|
||||||
* Purpose: count the number of paragraphs in a text
|
* Purpose: count the number of paragraphs in a text
|
||||||
@@ -16,10 +15,12 @@
|
|||||||
* @link http://www.smarty.net/manual/en/language.modifier.count.paragraphs.php
|
* @link http://www.smarty.net/manual/en/language.modifier.count.paragraphs.php
|
||||||
* count_paragraphs (Smarty online manual)
|
* count_paragraphs (Smarty online manual)
|
||||||
* @author Uwe Tews
|
* @author Uwe Tews
|
||||||
|
*
|
||||||
* @param array $params parameters
|
* @param array $params parameters
|
||||||
|
*
|
||||||
* @return string with compiled code
|
* @return string with compiled code
|
||||||
*/
|
*/
|
||||||
function smarty_modifiercompiler_count_paragraphs($params, $compiler)
|
function smarty_modifiercompiler_count_paragraphs($params)
|
||||||
{
|
{
|
||||||
// count \r or \n characters
|
// count \r or \n characters
|
||||||
return '(preg_match_all(\'#[\r\n]+#\', ' . $params[0] . ', $tmp)+1)';
|
return '(preg_match_all(\'#[\r\n]+#\', ' . $params[0] . ', $tmp)+1)';
|
||||||
@@ -8,7 +8,6 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Smarty count_sentences modifier plugin
|
* Smarty count_sentences modifier plugin
|
||||||
*
|
|
||||||
* Type: modifier<br>
|
* Type: modifier<br>
|
||||||
* Name: count_sentences
|
* Name: count_sentences
|
||||||
* Purpose: count the number of sentences in a text
|
* Purpose: count the number of sentences in a text
|
||||||
@@ -16,10 +15,12 @@
|
|||||||
* @link http://www.smarty.net/manual/en/language.modifier.count.paragraphs.php
|
* @link http://www.smarty.net/manual/en/language.modifier.count.paragraphs.php
|
||||||
* count_sentences (Smarty online manual)
|
* count_sentences (Smarty online manual)
|
||||||
* @author Uwe Tews
|
* @author Uwe Tews
|
||||||
|
*
|
||||||
* @param array $params parameters
|
* @param array $params parameters
|
||||||
|
*
|
||||||
* @return string with compiled code
|
* @return string with compiled code
|
||||||
*/
|
*/
|
||||||
function smarty_modifiercompiler_count_sentences($params, $compiler)
|
function smarty_modifiercompiler_count_sentences($params)
|
||||||
{
|
{
|
||||||
// find periods, question marks, exclamation marks with a word before but not after.
|
// find periods, question marks, exclamation marks with a word before but not after.
|
||||||
return 'preg_match_all("#\w[\.\?\!](\W|$)#S' . Smarty::$_UTF8_MODIFIER . '", ' . $params[0] . ', $tmp)';
|
return 'preg_match_all("#\w[\.\?\!](\W|$)#S' . Smarty::$_UTF8_MODIFIER . '", ' . $params[0] . ', $tmp)';
|
||||||
@@ -8,17 +8,18 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Smarty count_words modifier plugin
|
* Smarty count_words modifier plugin
|
||||||
*
|
|
||||||
* Type: modifier<br>
|
* Type: modifier<br>
|
||||||
* Name: count_words<br>
|
* Name: count_words<br>
|
||||||
* Purpose: count the number of words in a text
|
* Purpose: count the number of words in a text
|
||||||
*
|
*
|
||||||
* @link http://www.smarty.net/manual/en/language.modifier.count.words.php count_words (Smarty online manual)
|
* @link http://www.smarty.net/manual/en/language.modifier.count.words.php count_words (Smarty online manual)
|
||||||
* @author Uwe Tews
|
* @author Uwe Tews
|
||||||
|
*
|
||||||
* @param array $params parameters
|
* @param array $params parameters
|
||||||
|
*
|
||||||
* @return string with compiled code
|
* @return string with compiled code
|
||||||
*/
|
*/
|
||||||
function smarty_modifiercompiler_count_words($params, $compiler)
|
function smarty_modifiercompiler_count_words($params)
|
||||||
{
|
{
|
||||||
if (Smarty::$_MBSTRING) {
|
if (Smarty::$_MBSTRING) {
|
||||||
// return 'preg_match_all(\'#[\w\pL]+#' . Smarty::$_UTF8_MODIFIER . '\', ' . $params[0] . ', $tmp)';
|
// return 'preg_match_all(\'#[\w\pL]+#' . Smarty::$_UTF8_MODIFIER . '\', ' . $params[0] . ', $tmp)';
|
||||||
@@ -8,17 +8,18 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Smarty default modifier plugin
|
* Smarty default modifier plugin
|
||||||
*
|
|
||||||
* Type: modifier<br>
|
* Type: modifier<br>
|
||||||
* Name: default<br>
|
* Name: default<br>
|
||||||
* Purpose: designate default value for empty variables
|
* Purpose: designate default value for empty variables
|
||||||
*
|
*
|
||||||
* @link http://www.smarty.net/manual/en/language.modifier.default.php default (Smarty online manual)
|
* @link http://www.smarty.net/manual/en/language.modifier.default.php default (Smarty online manual)
|
||||||
* @author Uwe Tews
|
* @author Uwe Tews
|
||||||
|
*
|
||||||
* @param array $params parameters
|
* @param array $params parameters
|
||||||
|
*
|
||||||
* @return string with compiled code
|
* @return string with compiled code
|
||||||
*/
|
*/
|
||||||
function smarty_modifiercompiler_default ($params, $compiler)
|
function smarty_modifiercompiler_default($params)
|
||||||
{
|
{
|
||||||
$output = $params[0];
|
$output = $params[0];
|
||||||
if (!isset($params[1])) {
|
if (!isset($params[1])) {
|
||||||
@@ -13,14 +13,16 @@ require_once( SMARTY_PLUGINS_DIR .'shared.literal_compiler_param.php' );
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Smarty escape modifier plugin
|
* Smarty escape modifier plugin
|
||||||
*
|
|
||||||
* Type: modifier<br>
|
* Type: modifier<br>
|
||||||
* Name: escape<br>
|
* Name: escape<br>
|
||||||
* Purpose: escape string for output
|
* Purpose: escape string for output
|
||||||
*
|
*
|
||||||
* @link http://www.smarty.net/docsv2/en/language.modifier.escape count_characters (Smarty online manual)
|
* @link http://www.smarty.net/docsv2/en/language.modifier.escape count_characters (Smarty online manual)
|
||||||
* @author Rodney Rehm
|
* @author Rodney Rehm
|
||||||
|
*
|
||||||
* @param array $params parameters
|
* @param array $params parameters
|
||||||
|
* @param $compiler
|
||||||
|
*
|
||||||
* @return string with compiled code
|
* @return string with compiled code
|
||||||
*/
|
*/
|
||||||
function smarty_modifiercompiler_escape($params, $compiler)
|
function smarty_modifiercompiler_escape($params, $compiler)
|
||||||
@@ -105,9 +107,9 @@ function smarty_modifiercompiler_escape($params, $compiler)
|
|||||||
case 'javascript':
|
case 'javascript':
|
||||||
// escape quotes and backslashes, newlines, etc.
|
// escape quotes and backslashes, newlines, etc.
|
||||||
return 'strtr(' . $params[0] . ', array("\\\\" => "\\\\\\\\", "\'" => "\\\\\'", "\"" => "\\\\\"", "\\r" => "\\\\r", "\\n" => "\\\n", "</" => "<\/" ))';
|
return 'strtr(' . $params[0] . ', array("\\\\" => "\\\\\\\\", "\'" => "\\\\\'", "\"" => "\\\\\"", "\\r" => "\\\\r", "\\n" => "\\\n", "</" => "<\/" ))';
|
||||||
|
|
||||||
}
|
}
|
||||||
} catch (SmartyException $e) {
|
}
|
||||||
|
catch (SmartyException $e) {
|
||||||
// pass through to regular plugin fallback
|
// pass through to regular plugin fallback
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -8,16 +8,17 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Smarty from_charset modifier plugin
|
* Smarty from_charset modifier plugin
|
||||||
*
|
|
||||||
* Type: modifier<br>
|
* Type: modifier<br>
|
||||||
* Name: from_charset<br>
|
* Name: from_charset<br>
|
||||||
* Purpose: convert character encoding from $charset to internal encoding
|
* Purpose: convert character encoding from $charset to internal encoding
|
||||||
*
|
*
|
||||||
* @author Rodney Rehm
|
* @author Rodney Rehm
|
||||||
|
*
|
||||||
* @param array $params parameters
|
* @param array $params parameters
|
||||||
|
*
|
||||||
* @return string with compiled code
|
* @return string with compiled code
|
||||||
*/
|
*/
|
||||||
function smarty_modifiercompiler_from_charset($params, $compiler)
|
function smarty_modifiercompiler_from_charset($params)
|
||||||
{
|
{
|
||||||
if (!Smarty::$_MBSTRING) {
|
if (!Smarty::$_MBSTRING) {
|
||||||
// FIXME: (rodneyrehm) shouldn't this throw an error?
|
// FIXME: (rodneyrehm) shouldn't this throw an error?
|
||||||
@@ -1,24 +1,26 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Smarty plugin
|
* Smarty plugin
|
||||||
|
*
|
||||||
* @package Smarty
|
* @package Smarty
|
||||||
* @subpackage PluginsModifierCompiler
|
* @subpackage PluginsModifierCompiler
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Smarty indent modifier plugin
|
* Smarty indent modifier plugin
|
||||||
*
|
|
||||||
* Type: modifier<br>
|
* Type: modifier<br>
|
||||||
* Name: indent<br>
|
* Name: indent<br>
|
||||||
* Purpose: indent lines of text
|
* Purpose: indent lines of text
|
||||||
*
|
*
|
||||||
* @link http://www.smarty.net/manual/en/language.modifier.indent.php indent (Smarty online manual)
|
* @link http://www.smarty.net/manual/en/language.modifier.indent.php indent (Smarty online manual)
|
||||||
* @author Uwe Tews
|
* @author Uwe Tews
|
||||||
|
*
|
||||||
* @param array $params parameters
|
* @param array $params parameters
|
||||||
|
*
|
||||||
* @return string with compiled code
|
* @return string with compiled code
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function smarty_modifiercompiler_indent($params, $compiler)
|
function smarty_modifiercompiler_indent($params)
|
||||||
{
|
{
|
||||||
if (!isset($params[1])) {
|
if (!isset($params[1])) {
|
||||||
$params[1] = 4;
|
$params[1] = 4;
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Smarty plugin
|
* Smarty plugin
|
||||||
|
*
|
||||||
* @package Smarty
|
* @package Smarty
|
||||||
* @subpackage PluginsModifierCompiler
|
* @subpackage PluginsModifierCompiler
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Smarty lower modifier plugin
|
* Smarty lower modifier plugin
|
||||||
*
|
|
||||||
* Type: modifier<br>
|
* Type: modifier<br>
|
||||||
* Name: lower<br>
|
* Name: lower<br>
|
||||||
* Purpose: convert string to lowercase
|
* Purpose: convert string to lowercase
|
||||||
@@ -15,11 +15,13 @@
|
|||||||
* @link http://www.smarty.net/manual/en/language.modifier.lower.php lower (Smarty online manual)
|
* @link http://www.smarty.net/manual/en/language.modifier.lower.php lower (Smarty online manual)
|
||||||
* @author Monte Ohrt <monte at ohrt dot com>
|
* @author Monte Ohrt <monte at ohrt dot com>
|
||||||
* @author Uwe Tews
|
* @author Uwe Tews
|
||||||
|
*
|
||||||
* @param array $params parameters
|
* @param array $params parameters
|
||||||
|
*
|
||||||
* @return string with compiled code
|
* @return string with compiled code
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function smarty_modifiercompiler_lower($params, $compiler)
|
function smarty_modifiercompiler_lower($params)
|
||||||
{
|
{
|
||||||
if (Smarty::$_MBSTRING) {
|
if (Smarty::$_MBSTRING) {
|
||||||
return 'mb_strtolower(' . $params[0] . ', \'' . addslashes(Smarty::$_CHARSET) . '\')';
|
return 'mb_strtolower(' . $params[0] . ', \'' . addslashes(Smarty::$_CHARSET) . '\')';
|
||||||
@@ -8,16 +8,14 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Smarty noprint modifier plugin
|
* Smarty noprint modifier plugin
|
||||||
*
|
|
||||||
* Type: modifier<br>
|
* Type: modifier<br>
|
||||||
* Name: noprint<br>
|
* Name: noprint<br>
|
||||||
* Purpose: return an empty string
|
* Purpose: return an empty string
|
||||||
*
|
*
|
||||||
* @author Uwe Tews
|
* @author Uwe Tews
|
||||||
* @param array $params parameters
|
|
||||||
* @return string with compiled code
|
* @return string with compiled code
|
||||||
*/
|
*/
|
||||||
function smarty_modifiercompiler_noprint($params, $compiler)
|
function smarty_modifiercompiler_noprint()
|
||||||
{
|
{
|
||||||
return "''";
|
return "''";
|
||||||
}
|
}
|
||||||
@@ -8,17 +8,18 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Smarty string_format modifier plugin
|
* Smarty string_format modifier plugin
|
||||||
*
|
|
||||||
* Type: modifier<br>
|
* Type: modifier<br>
|
||||||
* Name: string_format<br>
|
* Name: string_format<br>
|
||||||
* Purpose: format strings via sprintf
|
* Purpose: format strings via sprintf
|
||||||
*
|
*
|
||||||
* @link http://www.smarty.net/manual/en/language.modifier.string.format.php string_format (Smarty online manual)
|
* @link http://www.smarty.net/manual/en/language.modifier.string.format.php string_format (Smarty online manual)
|
||||||
* @author Uwe Tews
|
* @author Uwe Tews
|
||||||
|
*
|
||||||
* @param array $params parameters
|
* @param array $params parameters
|
||||||
|
*
|
||||||
* @return string with compiled code
|
* @return string with compiled code
|
||||||
*/
|
*/
|
||||||
function smarty_modifiercompiler_string_format($params, $compiler)
|
function smarty_modifiercompiler_string_format($params)
|
||||||
{
|
{
|
||||||
return 'sprintf(' . $params[1] . ',' . $params[0] . ')';
|
return 'sprintf(' . $params[1] . ',' . $params[0] . ')';
|
||||||
}
|
}
|
||||||
@@ -8,7 +8,6 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Smarty strip modifier plugin
|
* Smarty strip modifier plugin
|
||||||
*
|
|
||||||
* Type: modifier<br>
|
* Type: modifier<br>
|
||||||
* Name: strip<br>
|
* Name: strip<br>
|
||||||
* Purpose: Replace all repeated spaces, newlines, tabs
|
* Purpose: Replace all repeated spaces, newlines, tabs
|
||||||
@@ -18,11 +17,13 @@
|
|||||||
*
|
*
|
||||||
* @link http://www.smarty.net/manual/en/language.modifier.strip.php strip (Smarty online manual)
|
* @link http://www.smarty.net/manual/en/language.modifier.strip.php strip (Smarty online manual)
|
||||||
* @author Uwe Tews
|
* @author Uwe Tews
|
||||||
|
*
|
||||||
* @param array $params parameters
|
* @param array $params parameters
|
||||||
|
*
|
||||||
* @return string with compiled code
|
* @return string with compiled code
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function smarty_modifiercompiler_strip($params, $compiler)
|
function smarty_modifiercompiler_strip($params)
|
||||||
{
|
{
|
||||||
if (!isset($params[1])) {
|
if (!isset($params[1])) {
|
||||||
$params[1] = "' '";
|
$params[1] = "' '";
|
||||||
@@ -8,17 +8,18 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Smarty strip_tags modifier plugin
|
* Smarty strip_tags modifier plugin
|
||||||
*
|
|
||||||
* Type: modifier<br>
|
* Type: modifier<br>
|
||||||
* Name: strip_tags<br>
|
* Name: strip_tags<br>
|
||||||
* Purpose: strip html tags from text
|
* Purpose: strip html tags from text
|
||||||
*
|
*
|
||||||
* @link http://www.smarty.net/manual/en/language.modifier.strip.tags.php strip_tags (Smarty online manual)
|
* @link http://www.smarty.net/manual/en/language.modifier.strip.tags.php strip_tags (Smarty online manual)
|
||||||
* @author Uwe Tews
|
* @author Uwe Tews
|
||||||
|
*
|
||||||
* @param array $params parameters
|
* @param array $params parameters
|
||||||
|
*
|
||||||
* @return string with compiled code
|
* @return string with compiled code
|
||||||
*/
|
*/
|
||||||
function smarty_modifiercompiler_strip_tags($params, $compiler)
|
function smarty_modifiercompiler_strip_tags($params)
|
||||||
{
|
{
|
||||||
if (!isset($params[1]) || $params[1] === true || trim($params[1], '"') == 'true') {
|
if (!isset($params[1]) || $params[1] === true || trim($params[1], '"') == 'true') {
|
||||||
return "preg_replace('!<[^>]*?>!', ' ', {$params[0]})";
|
return "preg_replace('!<[^>]*?>!', ' ', {$params[0]})";
|
||||||
@@ -8,16 +8,17 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Smarty to_charset modifier plugin
|
* Smarty to_charset modifier plugin
|
||||||
*
|
|
||||||
* Type: modifier<br>
|
* Type: modifier<br>
|
||||||
* Name: to_charset<br>
|
* Name: to_charset<br>
|
||||||
* Purpose: convert character encoding from internal encoding to $charset
|
* Purpose: convert character encoding from internal encoding to $charset
|
||||||
*
|
*
|
||||||
* @author Rodney Rehm
|
* @author Rodney Rehm
|
||||||
|
*
|
||||||
* @param array $params parameters
|
* @param array $params parameters
|
||||||
|
*
|
||||||
* @return string with compiled code
|
* @return string with compiled code
|
||||||
*/
|
*/
|
||||||
function smarty_modifiercompiler_to_charset($params, $compiler)
|
function smarty_modifiercompiler_to_charset($params)
|
||||||
{
|
{
|
||||||
if (!Smarty::$_MBSTRING) {
|
if (!Smarty::$_MBSTRING) {
|
||||||
// FIXME: (rodneyrehm) shouldn't this throw an error?
|
// FIXME: (rodneyrehm) shouldn't this throw an error?
|
||||||
@@ -8,16 +8,17 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Smarty unescape modifier plugin
|
* Smarty unescape modifier plugin
|
||||||
*
|
|
||||||
* Type: modifier<br>
|
* Type: modifier<br>
|
||||||
* Name: unescape<br>
|
* Name: unescape<br>
|
||||||
* Purpose: unescape html entities
|
* Purpose: unescape html entities
|
||||||
*
|
*
|
||||||
* @author Rodney Rehm
|
* @author Rodney Rehm
|
||||||
|
*
|
||||||
* @param array $params parameters
|
* @param array $params parameters
|
||||||
|
*
|
||||||
* @return string with compiled code
|
* @return string with compiled code
|
||||||
*/
|
*/
|
||||||
function smarty_modifiercompiler_unescape($params, $compiler)
|
function smarty_modifiercompiler_unescape($params)
|
||||||
{
|
{
|
||||||
if (!isset($params[1])) {
|
if (!isset($params[1])) {
|
||||||
$params[1] = 'html';
|
$params[1] = 'html';
|
||||||
@@ -8,17 +8,18 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Smarty upper modifier plugin
|
* Smarty upper modifier plugin
|
||||||
*
|
|
||||||
* Type: modifier<br>
|
* Type: modifier<br>
|
||||||
* Name: lower<br>
|
* Name: lower<br>
|
||||||
* Purpose: convert string to uppercase
|
* Purpose: convert string to uppercase
|
||||||
*
|
*
|
||||||
* @link http://smarty.php.net/manual/en/language.modifier.upper.php lower (Smarty online manual)
|
* @link http://smarty.php.net/manual/en/language.modifier.upper.php lower (Smarty online manual)
|
||||||
* @author Uwe Tews
|
* @author Uwe Tews
|
||||||
|
*
|
||||||
* @param array $params parameters
|
* @param array $params parameters
|
||||||
|
*
|
||||||
* @return string with compiled code
|
* @return string with compiled code
|
||||||
*/
|
*/
|
||||||
function smarty_modifiercompiler_upper($params, $compiler)
|
function smarty_modifiercompiler_upper($params)
|
||||||
{
|
{
|
||||||
if (Smarty::$_MBSTRING) {
|
if (Smarty::$_MBSTRING) {
|
||||||
return 'mb_strtoupper(' . $params[0] . ', \'' . addslashes(Smarty::$_CHARSET) . '\')';
|
return 'mb_strtoupper(' . $params[0] . ', \'' . addslashes(Smarty::$_CHARSET) . '\')';
|
||||||
@@ -8,14 +8,16 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Smarty wordwrap modifier plugin
|
* Smarty wordwrap modifier plugin
|
||||||
*
|
|
||||||
* Type: modifier<br>
|
* Type: modifier<br>
|
||||||
* Name: wordwrap<br>
|
* Name: wordwrap<br>
|
||||||
* Purpose: wrap a string of text at a given length
|
* Purpose: wrap a string of text at a given length
|
||||||
*
|
*
|
||||||
* @link http://smarty.php.net/manual/en/language.modifier.wordwrap.php wordwrap (Smarty online manual)
|
* @link http://smarty.php.net/manual/en/language.modifier.wordwrap.php wordwrap (Smarty online manual)
|
||||||
* @author Uwe Tews
|
* @author Uwe Tews
|
||||||
|
*
|
||||||
* @param array $params parameters
|
* @param array $params parameters
|
||||||
|
* @param $compiler
|
||||||
|
*
|
||||||
* @return string with compiled code
|
* @return string with compiled code
|
||||||
*/
|
*/
|
||||||
function smarty_modifiercompiler_wordwrap($params, $compiler)
|
function smarty_modifiercompiler_wordwrap($params, $compiler)
|
||||||
@@ -8,16 +8,16 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Smarty trimwhitespace outputfilter plugin
|
* Smarty trimwhitespace outputfilter plugin
|
||||||
*
|
|
||||||
* Trim unnecessary whitespace from HTML markup.
|
* Trim unnecessary whitespace from HTML markup.
|
||||||
*
|
*
|
||||||
* @author Rodney Rehm
|
* @author Rodney Rehm
|
||||||
|
*
|
||||||
* @param string $source input string
|
* @param string $source input string
|
||||||
* @param Smarty_Internal_Template $smarty Smarty object
|
*
|
||||||
* @return string filtered output
|
* @return string filtered output
|
||||||
* @todo substr_replace() is not overloaded by mbstring.func_overload - so this function might fail!
|
* @todo substr_replace() is not overloaded by mbstring.func_overload - so this function might fail!
|
||||||
*/
|
*/
|
||||||
function smarty_outputfilter_trimwhitespace($source, Smarty_Internal_Template $smarty)
|
function smarty_outputfilter_trimwhitespace($source)
|
||||||
{
|
{
|
||||||
$store = array();
|
$store = array();
|
||||||
$_store = 0;
|
$_store = 0;
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user