diff --git a/apply.html b/apply.html index 8ecad88..4c98c14 100644 --- a/apply.html +++ b/apply.html @@ -1,35 +1,63 @@ - - CoderSpace - - - - - - - - - - - - - - - - - - +
+ - - - -
- - -
-
- -
- -
- -
- - - - - -
- -
- -
- -
- -

Summer 2016

- -

- In our intensive 8-week program students learn the basic coding languages that power the web (HTML, CSS and JS). Through hands on training, CoderSpace youth work in teams to design and build websites for local clients while gaining real world experience in web development, teamwork and leadership. -

- -

- In addition to providing coding instruction, CoderSpace hosts weekly business trips to local tech companies that expose youth to opportunities in the technology sector. The summer culminates in a Demo Day where student teams show off their client projects to family, friends and supporters. -

- -

Schedule

- -

- June 26 - August 19, 2016
- Monday - Friday, 10:00am-4:00pm -

- -

Eligibility

+
+ +
+ +
+ +
+ +
+ + + +
+ +
+ +

CoderSpace 2018 Summer Apprenticeship

+ +

+ CoderSpace creates engaging learning experiences to inspire a new generation of leaders and innovators. CoderSpace youth learn to code and develop leadership skills for a changing world. +

-

- High school students are eligible to join CoderSpace. Priority will be given to students who live in the following community areas: -

+

+ In our intensive 8-week summer apprenticeship students learn computer languages that power the web. Through hands on training, + CoderSpace youth work in teams to build real-world projects while gaining experience in programming, web development, teamwork and leadership. +

+ +

+ Throughout the summer CoderSpace youth participate in regular business trips to explore a range of tech-related career opportunities. The program culminates in a Demo Day where student teams show off their summer projects to family, friends and supporters. +

+ +

More than a summer program

+ +

+ We are interested in working with youth who are committed to launching a CoderSpace at their school. Participants will take the skills they learn during the summer and share them with their peers. For youth interested in this unique leadership opportunity, CoderSpace provides resources, support and ongoing training at weekly Saturday sessions during the academic year. +

+ +

Apply today!

+ +

+ The application deadline is June 15, 2018. CoderSpace accepts students on an ongoing basis until all seats are filled. The earlier you apply, the better your chances of being accepted. Submit your application for the 2018 Summer Apprenticeship today! +

+ +
+ +

+ Apply +

+ + + +
+ +
+ +
+ +
+ +
+ +
+ +
+

Learn to code

+

Learn computer languages that power the web: Javascript, HTML, CSS and more!

+
+
+ +
+ +
+
+ +
+

Build cool projects

+

Create a project portfolio to showcase your work and show off your new skills.

+
+
+
+ +
+
+ +
+

Lead your team

+

Hone your leadership skills while working collaboratively with your peers.

+
+
+
+ +
+ +
+ +
+
+ +
+

Visit tech companies

+

Explore tech-related career opportunities at companies and organizations throughout Chicago.

+
+
+
+ +
+
+ +
+

Tell your story

+

Celebrate your success with family, friends and supporters at CoderSpace Demo Day.

+
+
+
+ +
+
+ +
+

Share your skills

+

Launch a CoderSpace at your school and teach your friends to code!

+
+
+
+ +
+ +
+ +
+ +

Schedule

+ +

+ June 25 - August 17, 2018
Monday - Friday, 10am - 4pm +

+ +

Eligibility

+ +

+ Students attending high school in the 2018-2019 academic year are eligible to join CoderSpace. +

+ +

Apply Today!

-
    -
  • Douglas
  • -
  • Englewood
  • -
  • Grand Boulevard
  • -
  • Greater Grand Crossing
  • -
  • Hyde Park
  • -
  • Kenwood
  • -
  • Oakland
  • -
  • South Shore
  • -
  • Washington Park
  • -
  • West Englewood
  • -
  • Woodlawn
  • -
+

Apply to CoderSpace in two simple steps:

+ +
    +
  1. Online application
  2. +
  3. Interview
  4. +
-

Apply Today!

- -
    -
  1. Submit an online application by Friday April 29, 2016
  2. -
  3. Selected applicants will be contacted for an interview
  4. -
  5. Admitted applicants will be notified by the CoderSpace team
  6. -
- -
- -
- Fill out my online form. +

The application deadline is June 15, 2018. CoderSpace accepts students on an ongoing basis until all seats are filled. The earlier you apply, the better your chances of being accepted. Submit your application for the 2018 Summer Apprenticeship today!

+ +
+ +

+ Apply +

+ + + +
+
- - - +
- -
-
-
-
- - -
- - - - - - - - - \ No newline at end of file +
+ + + + + + + + + + + + diff --git a/first-class.html b/first-class.html new file mode 100644 index 0000000..d8c5f33 --- /dev/null +++ b/first-class.html @@ -0,0 +1,358 @@ + + + + CoderSpace | Summer 2015 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

#FirstClass

+ +
+
+
+
+ +

CoderSpace has inspired me to consider a career in Technology; something I would not have thought of before hand

+
+
+ +

Whitney

+ +
+
+
+ +
+
+
+ + +

CoderSpace is a place where a black community can come together and learn how to code.

+
+
+ +

Jameer

+ +
+
+
+ + +
+
+
+ +

Technology is changing the world in many ways everyday, that is something I want to be a part of.

+
+
+ +

Nychia

+ +
+
+
+ + +
+
+
+ +

Code is advancing the world and we must learn how to code to keep up with it. CoderSpace gives us that ability.

+
+
+ +

Derek

+ +
+
+
+
+ +
+
+
+
+ +

Learning how to code has been one of the greatest experiences in my life.

+ +
+
+ +

Marquis

+ +
+
+
+ +
+
+
+ +

CoderSpace was a great opportunity to learn how to code. Now that I can, I can help and teach others.

+
+
+ +

Imani

+ +
+
+
+ + +
+
+
+ +

CoderSpace is about teamwork and leadership

+
+
+ +

Samara

+ +
+
+
+ +
+
+
+ + +

"Only a fool goes thirsty in an abundance of water". In my case coding was my thirst, CoderSpace was my abundance of water, and I refused to go thirsty.

+
+
+ +

Jonathan

+ +
+
+
+ +
+ +
+
+
+
+ +

I really appreciate all the skills I learned from CoderSpace and having the chance to meet other web developers!

+
+
+ +

Briana

+ +
+
+
+
+
+
+ +

CoderSpace is a program that allows you to have fun while learning about front end code.

+
+
+

Serenity

+ +
+
+
+
+
+
+ +

CoderSpace is where you not only come to have fun but also make Chicago competitive as a city.

+
+
+ +

Ameena

+ +
+
+
+
+
+
+ +

CoderSpace was a Great experience and it felt like a family.

+
+
+ +

Justin C.

+ +
+
+
+ +
+ +
+
+
+
+ +

Working with my team members and learning code helped make this experience even better.

+
+
+ +

Imari

+ +
+
+
+
+
+
+ +

When you're coding details matter.

+
+
+ +

Diamond

+ +
+
+
+ +
+
+
+ +

An experience as great as CoderSpace should never be passed up.

+
+ +
+ +

Justin B.

+ +
+
+
+
+
+
+ +

We are not just a team, but a front-end website family.

+
+
+ +

Siobhan

+ +
+
+
+
+
+ + + + +
+ + + + + + + \ No newline at end of file diff --git a/images/0000.jpg b/images/0000.jpg deleted file mode 100644 index f2c97dd..0000000 Binary files a/images/0000.jpg and /dev/null differ diff --git a/images/134.jpg b/images/134.jpg deleted file mode 100644 index 421ec32..0000000 Binary files a/images/134.jpg and /dev/null differ diff --git a/images/20390982922_829fa50e7a_o.jpg b/images/20390982922_829fa50e7a_o.jpg deleted file mode 100644 index f2c97dd..0000000 Binary files a/images/20390982922_829fa50e7a_o.jpg and /dev/null differ diff --git a/images/Ameena.jpg b/images/Ameena.jpg deleted file mode 100644 index 8bd1f92..0000000 Binary files a/images/Ameena.jpg and /dev/null differ diff --git a/images/Ameenna.jpg b/images/Ameenna.jpg deleted file mode 100644 index 8bd1f92..0000000 Binary files a/images/Ameenna.jpg and /dev/null differ diff --git a/images/Bhann.jpg b/images/Bhann.jpg deleted file mode 100644 index cd15a7b..0000000 Binary files a/images/Bhann.jpg and /dev/null differ diff --git a/images/Justin C..jpg b/images/Justin C..jpg deleted file mode 100644 index d90b4b3..0000000 Binary files a/images/Justin C..jpg and /dev/null differ diff --git a/images/Person.jpeg b/images/Person.jpeg deleted file mode 100644 index 9adf332..0000000 Binary files a/images/Person.jpeg and /dev/null differ diff --git a/images/Whitney.jpg b/images/Whitney.jpg deleted file mode 100644 index 3c90f15..0000000 Binary files a/images/Whitney.jpg and /dev/null differ diff --git a/images/accelerator.jpg b/images/accelerator.jpg deleted file mode 100644 index d4167b9..0000000 Binary files a/images/accelerator.jpg and /dev/null differ diff --git a/images/ameena.jpg b/images/ameena.jpg deleted file mode 100644 index 9067e00..0000000 Binary files a/images/ameena.jpg and /dev/null differ diff --git a/images/baldridge.jpg b/images/baldridge.jpg deleted file mode 100644 index 449288b..0000000 Binary files a/images/baldridge.jpg and /dev/null differ diff --git a/images/book.png b/images/book.png deleted file mode 100644 index efebbe8..0000000 Binary files a/images/book.png and /dev/null differ diff --git a/images/briana.jpg b/images/briana.jpg deleted file mode 100644 index 9f438c7..0000000 Binary files a/images/briana.jpg and /dev/null differ diff --git a/images/coderspace-preview.png b/images/clients/coderspace-preview.png similarity index 100% rename from images/coderspace-preview.png rename to images/clients/coderspace-preview.png diff --git a/images/778.png b/images/clients/kusanya.png similarity index 100% rename from images/778.png rename to images/clients/kusanya.png diff --git a/images/tailorite-preview.png b/images/clients/tailorite-preview.png similarity index 100% rename from images/tailorite-preview.png rename to images/clients/tailorite-preview.png diff --git a/images/wecan-preview.png b/images/clients/wecan-preview.png similarity index 100% rename from images/wecan-preview.png rename to images/clients/wecan-preview.png diff --git a/images/coderspace-2017.jpg b/images/coderspace-2017.jpg new file mode 100644 index 0000000..aec781f Binary files /dev/null and b/images/coderspace-2017.jpg differ diff --git a/images/coderspace-build.jpg b/images/coderspace-build.jpg new file mode 100644 index 0000000..3870e35 Binary files /dev/null and b/images/coderspace-build.jpg differ diff --git a/images/coderspace-codeworld-1.jpg b/images/coderspace-codeworld-1.jpg new file mode 100644 index 0000000..933be6b Binary files /dev/null and b/images/coderspace-codeworld-1.jpg differ diff --git a/images/coderspace-learn.jpg b/images/coderspace-learn.jpg new file mode 100644 index 0000000..4669718 Binary files /dev/null and b/images/coderspace-learn.jpg differ diff --git a/images/coderspace-tell.jpg b/images/coderspace-tell.jpg new file mode 100644 index 0000000..87c226e Binary files /dev/null and b/images/coderspace-tell.jpg differ diff --git a/images/coderspace-visit.jpg b/images/coderspace-visit.jpg new file mode 100644 index 0000000..a562af5 Binary files /dev/null and b/images/coderspace-visit.jpg differ diff --git a/images/codeworld.jpg b/images/coderspace-work.jpg similarity index 100% rename from images/codeworld.jpg rename to images/coderspace-work.jpg diff --git a/images/cs-web.png b/images/cs-web.png deleted file mode 100644 index 582309e..0000000 Binary files a/images/cs-web.png and /dev/null differ diff --git a/images/cs-web2.png b/images/cs-web2.png deleted file mode 100644 index 8723087..0000000 Binary files a/images/cs-web2.png and /dev/null differ diff --git a/images/cs-web3.png b/images/cs-web3.png deleted file mode 100644 index e7ca819..0000000 Binary files a/images/cs-web3.png and /dev/null differ diff --git a/images/derek.jpg b/images/derek.jpg deleted file mode 100644 index efb8077..0000000 Binary files a/images/derek.jpg and /dev/null differ diff --git a/images/diamond.jpg b/images/diamond.jpg deleted file mode 100644 index 5da7982..0000000 Binary files a/images/diamond.jpg and /dev/null differ diff --git a/images/drummer2.jpg b/images/drummer2.jpg deleted file mode 100644 index a3bf76e..0000000 Binary files a/images/drummer2.jpg and /dev/null differ diff --git a/images/face.jpg b/images/face.jpg deleted file mode 100644 index 243d4bb..0000000 Binary files a/images/face.jpg and /dev/null differ diff --git a/images/first-class/ameena.jpg b/images/first-class/ameena.jpg new file mode 100644 index 0000000..ef97e0f Binary files /dev/null and b/images/first-class/ameena.jpg differ diff --git a/images/first-class/baldridge.jpg b/images/first-class/baldridge.jpg new file mode 100644 index 0000000..c254966 Binary files /dev/null and b/images/first-class/baldridge.jpg differ diff --git a/images/first-class/briana.jpg b/images/first-class/briana.jpg new file mode 100644 index 0000000..d069a56 Binary files /dev/null and b/images/first-class/briana.jpg differ diff --git a/images/first-class/crawford.jpg b/images/first-class/crawford.jpg new file mode 100644 index 0000000..3e4f43a Binary files /dev/null and b/images/first-class/crawford.jpg differ diff --git a/images/first-class/derek.jpg b/images/first-class/derek.jpg new file mode 100644 index 0000000..03e2c74 Binary files /dev/null and b/images/first-class/derek.jpg differ diff --git a/images/first-class/diamond.jpg b/images/first-class/diamond.jpg new file mode 100644 index 0000000..7987d7a Binary files /dev/null and b/images/first-class/diamond.jpg differ diff --git a/images/first-class/first-class.jpg b/images/first-class/first-class.jpg new file mode 100644 index 0000000..90c238b Binary files /dev/null and b/images/first-class/first-class.jpg differ diff --git a/images/first-class/imani.jpg b/images/first-class/imani.jpg new file mode 100644 index 0000000..0679009 Binary files /dev/null and b/images/first-class/imani.jpg differ diff --git a/images/first-class/imari.jpg b/images/first-class/imari.jpg new file mode 100644 index 0000000..91cc820 Binary files /dev/null and b/images/first-class/imari.jpg differ diff --git a/images/Jamal.jpg b/images/first-class/jamal.jpg similarity index 100% rename from images/Jamal.jpg rename to images/first-class/jamal.jpg diff --git a/images/first-class/jonathon.jpg b/images/first-class/jonathon.jpg new file mode 100644 index 0000000..6189a94 Binary files /dev/null and b/images/first-class/jonathon.jpg differ diff --git a/images/first-class/marquis.jpg b/images/first-class/marquis.jpg new file mode 100644 index 0000000..f777843 Binary files /dev/null and b/images/first-class/marquis.jpg differ diff --git a/images/first-class/nychia.jpg b/images/first-class/nychia.jpg new file mode 100644 index 0000000..13fa47f Binary files /dev/null and b/images/first-class/nychia.jpg differ diff --git a/images/first-class/samara.jpg b/images/first-class/samara.jpg new file mode 100644 index 0000000..6804e34 Binary files /dev/null and b/images/first-class/samara.jpg differ diff --git a/images/first-class/serenity.jpg b/images/first-class/serenity.jpg new file mode 100644 index 0000000..33501b7 Binary files /dev/null and b/images/first-class/serenity.jpg differ diff --git a/images/first-class/siobhann.jpg b/images/first-class/siobhann.jpg new file mode 100644 index 0000000..0f51626 Binary files /dev/null and b/images/first-class/siobhann.jpg differ diff --git a/images/first-class/whitney.jpg b/images/first-class/whitney.jpg new file mode 100644 index 0000000..1fa63b2 Binary files /dev/null and b/images/first-class/whitney.jpg differ diff --git a/images/bk.png b/images/footer/facebook.png similarity index 100% rename from images/bk.png rename to images/footer/facebook.png diff --git a/images/flickr.png b/images/footer/flickr.png similarity index 100% rename from images/flickr.png rename to images/footer/flickr.png diff --git a/images/github.png b/images/footer/github.png similarity index 100% rename from images/github.png rename to images/footer/github.png diff --git a/images/dagram.png b/images/footer/instagram.png similarity index 100% rename from images/dagram.png rename to images/footer/instagram.png diff --git a/images/tweety.png b/images/footer/twitter.png similarity index 100% rename from images/tweety.png rename to images/footer/twitter.png diff --git a/images/gram.png b/images/gram.png deleted file mode 100644 index a49fbae..0000000 Binary files a/images/gram.png and /dev/null differ diff --git a/images/gre.jpg b/images/gre.jpg deleted file mode 100644 index 99f7f50..0000000 Binary files a/images/gre.jpg and /dev/null differ diff --git a/images/black-linen.png b/images/hero-image-overlay.png similarity index 100% rename from images/black-linen.png rename to images/hero-image-overlay.png diff --git a/images/hero-image.jpg b/images/hero-image.jpg new file mode 100644 index 0000000..0c2da65 Binary files /dev/null and b/images/hero-image.jpg differ diff --git a/images/imani.jpg b/images/imani.jpg deleted file mode 100644 index d3e1d5f..0000000 Binary files a/images/imani.jpg and /dev/null differ diff --git a/images/imari.jpg b/images/imari.jpg deleted file mode 100644 index 8f32cf3..0000000 Binary files a/images/imari.jpg and /dev/null differ diff --git a/images/insta.jpg b/images/insta.jpg deleted file mode 100644 index e959b9f..0000000 Binary files a/images/insta.jpg and /dev/null differ diff --git a/images/jameer.jpg b/images/jameer.jpg deleted file mode 100644 index 81eb5bd..0000000 Binary files a/images/jameer.jpg and /dev/null differ diff --git a/images/jameerr.jpg b/images/jameerr.jpg deleted file mode 100644 index 312a60b..0000000 Binary files a/images/jameerr.jpg and /dev/null differ diff --git a/images/jonathon.jpg b/images/jonathon.jpg deleted file mode 100644 index 09f1fc3..0000000 Binary files a/images/jonathon.jpg and /dev/null differ diff --git a/images/justin-craw.jpg b/images/justin-craw.jpg deleted file mode 100644 index 6ebd642..0000000 Binary files a/images/justin-craw.jpg and /dev/null differ diff --git a/images/lol.jpg b/images/lol.jpg deleted file mode 100644 index 3914dee..0000000 Binary files a/images/lol.jpg and /dev/null differ diff --git a/images/mar.jpg b/images/mar.jpg deleted file mode 100644 index 9dcd935..0000000 Binary files a/images/mar.jpg and /dev/null differ diff --git a/images/marquis.jpg b/images/marquis.jpg deleted file mode 100644 index 05916fc..0000000 Binary files a/images/marquis.jpg and /dev/null differ diff --git a/images/me.jpg b/images/me.jpg deleted file mode 100644 index b024b08..0000000 Binary files a/images/me.jpg and /dev/null differ diff --git a/images/meermeer.jpg b/images/meermeer.jpg deleted file mode 100644 index 52c35b4..0000000 Binary files a/images/meermeer.jpg and /dev/null differ diff --git a/images/ny.jpg b/images/ny.jpg deleted file mode 100644 index d07482a..0000000 Binary files a/images/ny.jpg and /dev/null differ diff --git a/images/nychia.jpg b/images/nychia.jpg deleted file mode 100644 index 5827dfb..0000000 Binary files a/images/nychia.jpg and /dev/null differ diff --git a/images/partners/accelerator.jpg b/images/partners/accelerator.jpg new file mode 100644 index 0000000..97faec7 Binary files /dev/null and b/images/partners/accelerator.jpg differ diff --git a/images/partners/careerbuilder.png b/images/partners/careerbuilder.png new file mode 100644 index 0000000..6e8bcc1 Binary files /dev/null and b/images/partners/careerbuilder.png differ diff --git a/images/partners/cie-logo.jpg b/images/partners/cie-logo.jpg new file mode 100644 index 0000000..7f29f3e Binary files /dev/null and b/images/partners/cie-logo.jpg differ diff --git a/images/partners/cps-logo.png b/images/partners/cps-logo.png new file mode 100644 index 0000000..9313105 Binary files /dev/null and b/images/partners/cps-logo.png differ diff --git a/images/partners/partners-resilience.png b/images/partners/partners-resilience.png new file mode 100644 index 0000000..62b4dba Binary files /dev/null and b/images/partners/partners-resilience.png differ diff --git a/images/person.png b/images/person.png deleted file mode 100644 index 477cc18..0000000 Binary files a/images/person.png and /dev/null differ diff --git a/images/person2.jpg b/images/person2.jpg deleted file mode 100644 index 027ddf3..0000000 Binary files a/images/person2.jpg and /dev/null differ diff --git a/images/picc.jpg b/images/picc.jpg deleted file mode 100644 index d02af90..0000000 Binary files a/images/picc.jpg and /dev/null differ diff --git a/images/pl.jpg b/images/pl.jpg deleted file mode 100644 index 8b9d471..0000000 Binary files a/images/pl.jpg and /dev/null differ diff --git a/images/samara.jpg b/images/samara.jpg deleted file mode 100644 index 289405f..0000000 Binary files a/images/samara.jpg and /dev/null differ diff --git a/images/season2/alexandria.jpg b/images/season2/alexandria.jpg new file mode 100644 index 0000000..b65e747 Binary files /dev/null and b/images/season2/alexandria.jpg differ diff --git a/images/season2/amira.JPG b/images/season2/amira.JPG new file mode 100644 index 0000000..af8d686 Binary files /dev/null and b/images/season2/amira.JPG differ diff --git a/images/season2/austin.JPG b/images/season2/austin.JPG new file mode 100644 index 0000000..82d393f Binary files /dev/null and b/images/season2/austin.JPG differ diff --git a/images/season2/brian.JPG b/images/season2/brian.JPG new file mode 100644 index 0000000..7602f26 Binary files /dev/null and b/images/season2/brian.JPG differ diff --git a/images/season2/bryauna.JPG b/images/season2/bryauna.JPG new file mode 100644 index 0000000..34ed33e Binary files /dev/null and b/images/season2/bryauna.JPG differ diff --git a/images/season2/eden.JPG b/images/season2/eden.JPG new file mode 100644 index 0000000..b28611d Binary files /dev/null and b/images/season2/eden.JPG differ diff --git a/images/season2/elijah.JPG b/images/season2/elijah.JPG new file mode 100644 index 0000000..b90ee2a Binary files /dev/null and b/images/season2/elijah.JPG differ diff --git a/images/season2/gene.JPG b/images/season2/gene.JPG new file mode 100644 index 0000000..7215535 Binary files /dev/null and b/images/season2/gene.JPG differ diff --git a/images/season2/genesis.JPG b/images/season2/genesis.JPG new file mode 100644 index 0000000..7b9a86d Binary files /dev/null and b/images/season2/genesis.JPG differ diff --git a/images/season2/jalen.JPG b/images/season2/jalen.JPG new file mode 100644 index 0000000..de0801b Binary files /dev/null and b/images/season2/jalen.JPG differ diff --git a/images/season2/jeremy.JPG b/images/season2/jeremy.JPG new file mode 100644 index 0000000..1fcab09 Binary files /dev/null and b/images/season2/jeremy.JPG differ diff --git a/images/season2/joanmarie.JPG b/images/season2/joanmarie.JPG new file mode 100644 index 0000000..3ea353c Binary files /dev/null and b/images/season2/joanmarie.JPG differ diff --git a/images/season2/joshua.JPG b/images/season2/joshua.JPG new file mode 100644 index 0000000..6943852 Binary files /dev/null and b/images/season2/joshua.JPG differ diff --git a/images/season2/kallatt.JPG b/images/season2/kallatt.JPG new file mode 100644 index 0000000..c8c63d4 Binary files /dev/null and b/images/season2/kallatt.JPG differ diff --git a/images/season2/lastasha.JPG b/images/season2/lastasha.JPG new file mode 100644 index 0000000..ee370e9 Binary files /dev/null and b/images/season2/lastasha.JPG differ diff --git a/images/season2/latisha.png b/images/season2/latisha.png new file mode 100644 index 0000000..fa29ee0 Binary files /dev/null and b/images/season2/latisha.png differ diff --git a/images/season2/neeco.JPG b/images/season2/neeco.JPG new file mode 100644 index 0000000..fef1728 Binary files /dev/null and b/images/season2/neeco.JPG differ diff --git a/images/season2/ruth.JPG b/images/season2/ruth.JPG new file mode 100644 index 0000000..0b4435e Binary files /dev/null and b/images/season2/ruth.JPG differ diff --git a/images/season2/season2.jpg b/images/season2/season2.jpg new file mode 100644 index 0000000..2053464 Binary files /dev/null and b/images/season2/season2.jpg differ diff --git a/images/season2/tyreke.JPG b/images/season2/tyreke.JPG new file mode 100644 index 0000000..5c35761 Binary files /dev/null and b/images/season2/tyreke.JPG differ diff --git a/images/season2/tyresha.JPG b/images/season2/tyresha.JPG new file mode 100644 index 0000000..a3cf013 Binary files /dev/null and b/images/season2/tyresha.JPG differ diff --git a/images/season2/william.JPG b/images/season2/william.JPG new file mode 100644 index 0000000..9498e50 Binary files /dev/null and b/images/season2/william.JPG differ diff --git a/images/serenity.jpg b/images/serenity.jpg deleted file mode 100644 index 7f4c57c..0000000 Binary files a/images/serenity.jpg and /dev/null differ diff --git a/images/siobhan.jpg b/images/siobhan.jpg deleted file mode 100644 index 2310e58..0000000 Binary files a/images/siobhan.jpg and /dev/null differ diff --git a/images/ss.JPG b/images/ss.JPG deleted file mode 100644 index 9eef8a0..0000000 Binary files a/images/ss.JPG and /dev/null differ diff --git a/images/talor.png b/images/talor.png deleted file mode 100644 index bae3d2e..0000000 Binary files a/images/talor.png and /dev/null differ diff --git a/images/thought.png b/images/thought.png deleted file mode 100644 index 9caa7e6..0000000 Binary files a/images/thought.png and /dev/null differ diff --git a/images/thth.jpg b/images/thth.jpg deleted file mode 100644 index dce2552..0000000 Binary files a/images/thth.jpg and /dev/null differ diff --git a/images/tweet.png b/images/tweet.png deleted file mode 100644 index c4a907d..0000000 Binary files a/images/tweet.png and /dev/null differ diff --git a/images/twitter.jpg b/images/twitter.jpg deleted file mode 100644 index 3c5d6ae..0000000 Binary files a/images/twitter.jpg and /dev/null differ diff --git a/images/university.png b/images/university.png deleted file mode 100644 index af456ea..0000000 Binary files a/images/university.png and /dev/null differ diff --git a/images/weecan.png b/images/weecan.png deleted file mode 100644 index 4ee5d9a..0000000 Binary files a/images/weecan.png and /dev/null differ diff --git a/images/weecan2.png b/images/weecan2.png deleted file mode 100644 index 23fcfdd..0000000 Binary files a/images/weecan2.png and /dev/null differ diff --git a/images/yes.jpg b/images/yes.jpg deleted file mode 100644 index daec342..0000000 Binary files a/images/yes.jpg and /dev/null differ diff --git a/index.html b/index.html index 199a7b1..4b00421 100644 --- a/index.html +++ b/index.html @@ -3,20 +3,20 @@ CoderSpace - + - - + + - + - + @@ -66,57 +66,60 @@ - + -
-
+

CoderSpace - CoderSpace youth learn how to code and build websites for clients in their communities. + CoderSpace youth learn to code, collaborate on local client projects and develop leadership skills for a digital world.

- - - - - - - - - - - \ No newline at end of file diff --git a/season2.html b/season2.html new file mode 100644 index 0000000..09fb6cf --- /dev/null +++ b/season2.html @@ -0,0 +1,417 @@ + + + + CoderSpace | Summer 2016 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

#Season2

+ +
+
+
+
+ +

CoderSpace is the best space to learn how to code and build website with teams.

+
+
+ +

Latasha

+ +
+
+
+ +
+
+
+ + +

CoderSpace is a great place for young minds to blossom and learn new things that will help them in the real world.

+
+
+ +

Brian

+ +
+
+
+ + +
+
+
+ + +

A different environment filled with positive feedback, supportive staff, and amazing cooperation are what teamwork & CoderSpace are built on.

+
+
+ +

Tyresha

+ +
+
+
+ + +
+
+
+ +

CoderSpace was a great opportunity for me and helps me work closer to my gaming career.

+
+
+ +

Neeco

+ +
+
+
+
+
+
+
+
+ +

Practice does not make perfect, but through the weeks I spent attending CoderSpace I became a little closer to perfect everyday.

+ +
+
+ +

Elijah

+ +
+
+
+ +
+
+
+ +

When there is something new go for it even if it's new.

+
+
+ +

JoanMarie

+ +
+
+
+ + +
+
+
+ +

CoderSpace is a place where I learned things I never knew existed.

+
+
+ +

Alexandria

+ +
+
+
+ +
+
+
+ + +

A once in a lifetime opportunity to learn how to code for free.

+
+
+ +

Joshua

+ +
+
+
+ +
+ +
+
+
+
+ +

A great experience where I learned more about a profession that I am interested in surrounded by people who look like me.

+
+
+ +

Genesis

+ +
+
+
+
+
+
+ +

CoderSpace opened my eyes to the many career options that involve technology.

+
+
+

Amira

+ +
+
+
+
+
+
+ +

CoderSpace was fun to me because we got to go on trips, learn different things, and meet new people.

+
+
+ +

Jalen

+ +
+
+
+
+
+
+ +

The CoderSpace program is a better experience for me because I don't have to go online and watch videos to learn coding the hard way.

+
+
+ +

William

+ +
+
+
+ +
+ +
+
+
+
+ +

+CoderSpace is good environment to learn the basics of front-end web development.

+
+
+ +

Kallatt

+ +
+
+
+
+
+
+ +

Its an amazing way for me to learn more about technology and to see if I want to do this in college.

+
+
+ +

Ruth

+ +
+
+
+ +
+
+
+ +

CoderSpace has taught me a alot and afforded me numerous opportunities that I never would have had access to otherwise.

+
+ +
+ +

Eden

+ +
+
+
+
+
+
+ +

Coderspace is a way for me to get out and try new things like coding.

+
+
+ +

Tyreke

+ +
+
+
+
+
+
+
+
+ +

Take pride in what you do with your team

+
+
+ +

Bryauna

+ +
+
+
+
+
+
+ +

Coding is a new experience and I'm always improving.

+
+
+ +

Jeremy

+ +
+
+
+ +
+
+
+ +

Coderspace has opened doors to my career in computers.

+
+ +
+ +

Gene

+ +
+
+
+
+
+
+ +

Everyday was an exciting experience.

+
+
+ +

Austin

+ +
+
+
+
+
+ + + + +
+ + + + + + + + + + diff --git a/sitecake-temp/r55d4ea904ce1c/draft/404.html b/sitecake-temp/r55d4ea904ce1c/draft/404.html deleted file mode 100644 index 4e399c3..0000000 --- a/sitecake-temp/r55d4ea904ce1c/draft/404.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - -

CODERSPACE WILL BE RETURNING SHORTLY

- - diff --git a/sitecake-temp/r55d4ea904ce1c/draft/draft.mkr b/sitecake-temp/r55d4ea904ce1c/draft/draft.mkr deleted file mode 100644 index e69de29..0000000 diff --git a/sitecake-temp/r55d4ea904ce1c/draft/index.html b/sitecake-temp/r55d4ea904ce1c/draft/index.html deleted file mode 100644 index 3f14de6..0000000 --- a/sitecake-temp/r55d4ea904ce1c/draft/index.html +++ /dev/null @@ -1,504 +0,0 @@ - - - - - -CoderSpace Website - - - - - - - -
- -
- - - -

CoderSpace creates engaging learning experiences along a clear path of skill development to inspire a new generation of tech leaders.

- - Responsive image

CoderSpace

- - - - - -

Marzipan pastry chocolate chocolate cake jujubes. Cotton candy dragee marshmallow marshmallow croissant gummies caramels cupcake. Brownie tart chocolate cake candy canes I love apple pie I love wafer. Toffee pudding chocolate cake chocolate cake cupcake. - Chocolate cake cotton candy I love jujubes. Pastry marshmallow danish jelly candy canes danish gummies danish. Sugar plum brownie chocolate bar ice cream candy canes. Souffle danish chocolate bar jujubes muffin sweet tiramisu donut. Tiramisu cake - lollipop. Powder brownie donut dragee jelly beans. Cupcake chocolate bar pie donut cake muffin. Pudding sugar plum macaroon bear claw chocolate bar ice cream marzipan carrot cake.

- - - - -
-
- - -
-

Our Story

- - - - - -

In the summer of 2011, Demond Drummer led a small program to teach youth in Englewood how to write HTML and CSS code. When the program ended, he didn't have the capacity or resources to continue offering the classes. But when a few young men came - to him eager to learn, he couldn't resist pulling out some used laptops. That's when he decided to launch Englewood Codes. After three successful summers of programming, Drummer wants to take his efforts to scale with a new concept: CoderSpace.

- -

To date, Demond has introduced more than 60 youth between the ages of 11 and 17 to the world of coding through after-school clubs and summer camps. With CoderSpace, he wants to build an organization that has strong institutional partnerships in order - to provide projectbased learning opportunities, internships, and professional mentors, as well as college and career guidance for youth interested in pursuing technology careers. These activities will advance the group's mission to develop the next - generation of tech leaders by creating learning experiences that are not only engaging, but have a clear path forward.

- -

This summer, Drummer coached a team to build a website for a neighborhood coffee shop in Englewood. "Together we demonstrated that youth on the South Side have the capacity to solve real world business problems with code and deliver direct economic - value to their communities," he said.

- -

"Through my work as an organizer, I became aware of an underserved market of small businesses that have neither the money to hire an experienced developer nor the time to create an online presence themselves,” Drummer added. "After training neighborhood - youth to meet this market, I've had a number of local small businesses approach me about retaining their talent - and they're willing to pay the youth."

- -

&nbsp &nbsp &nbsp &nbsp Drummer's five-year plan for CoderSpace is to develop deep relationships with Chicago Public Schools, other coding programs, college-level computer science departments, and technology companies. The goal is to build a broad - base of tech talent throughout the city.

- -

&nbsp &nbsp &nbsp &nbsp Drummer - who recently returned to the University as a Graduate Student-at-Large to complete an M.A. at the Divinity School -- applied to the Community Programs Accelerator for technical assistance on establishing an organizational - infrastructure for CoderSpace, everything from developing a sustainable business model and resource stream, to vetting a curriculum and metrics, to filing for incorporation and forming a board of directors.

- - -
- - -
-

Our Team

- - -
-
- -
-
-

Coderspace Student Quote

-
-
- -

Name

- -
- -
-
- -
-
-
-

Coderspace Student Quote

-
-
- -

Name

- -
-
-
- -
-
-
-

Coderspace Student Quote

-
-
- -

Name

- -
-
-
- -
-
-
-

Coderspace Student Quote

-
-
- -

Demond Drummer

- -
-
-
-
-
- - -
- -

Our Students

- -
-
-
-
-

I make bad Jokes

-
-
- -

Whitney Dubose

- -
-
-
- -
-
-
-

Coderspace is a place where a black community can come together and learn how to code.

-
-
- -

Jameer Harris

- -
-
-
- - -
-
-
-

*Sigh*

-
-
- -

Nychia Turner

- -
-
-
- - -
-
-
-

Eboneezer Scrouge

-
-
- -

Derek Townsend

- -
-
-
-
- -
-
-
-
-

I am code

-
-
- -

Marquis Sewell

- -
-
-
- -
-
-
-

BIRDS

-
-
- -

Imani Bowdre

- -
-
-
- - -
-
-
-

What was my name

-
-
- -

Samara Myrickes

- -
-
-
- -
-
-
-

I may be here

-
-
- -

Johnathon Highsmith

- -
-
-
- -
- -
-
-
-
-

BUY THE LIT MAG

-
-
- -

Briana Washington

- -
-
-
-
-
-
-

Go speed racer

-
-
-

Serenity Wilson

- -
-
-
-
-
-
-

Sleep

-
-
- -

Ameena Garrett

- -
-
-
-
-
-
-

I'm not Justin :(

-
-
- -

Justin Crawford (The one thats still Here)

- -
-
-
- -
- -
-
-
-
-

I made the logo

-
-
- -

Imari Jones

- -
-
-
-
-
-
-

Phantastic 4 was a terrible movie

-
-
- -

Diamond Williams

- -
-
-
- -
-
-
-

I am Slackbot

-
-
- -

Justin Baldridge

- -
-
-
-
-
-
-

My hair has gone rogue

-
-
- -

Siobhan Kelsie

- -
-
-
-
-
- - -
- - -
-

Our Partner

- -
-
-

-
-
-
- - -
-

Our Projects

- -
-
-
-

- Kusanya Cafe -

- -

Kusanya (v.), Swahili: to gather, collect, accumulate. Our mission is to be a place of empowerment and encouragement to the residents of Englewood The premise of Kusanya is simple: provide a place for people to gather, and empowerment will occur. -

-
-
- -
-
-

- Kusanya Cafe -

- -

Kusanya (v.), Swahili: to gather, collect, accumulate. Our mission is to be a place of empowerment and encouragement to the residents of Englewood The premise of Kusanya is simple: provide a place for people to gather, and empowerment will occur. -

-
-
-
-
-
-

- Kusanya Cafe -

- -

Kusanya (v.), Swahili: to gather, collect, accumulate. Our mission is to be a place of empowerment and encouragement to the residents of Englewood The premise of Kusanya is simple: provide a place for people to gather, and empowerment will - occur.

-
-
-
-
-

- Kusanya Cafe -

- -

Kusanya (v.), Swahili: to gather, collect, accumulate. Our mission is to be a place of empowerment and encouragement to the residents of Englewood The premise of Kusanya is simple: provide a place for people to gather, and empowerment will - occur.

-
-
-
-
-
- - - - - - - - diff --git a/sitecake-temp/r55d4ea904ce1c/draft/registration.html b/sitecake-temp/r55d4ea904ce1c/draft/registration.html deleted file mode 100644 index 78c371a..0000000 --- a/sitecake-temp/r55d4ea904ce1c/draft/registration.html +++ /dev/null @@ -1,351 +0,0 @@ - - - - - -CoderSpace Website - - - - - - -
-
- -
-

Registration

- - - - - - -
- -
    -
  • -

    - Student Information -

    -
    -
  • - - - -
  • - - - - - - - -
  • - - - -
  • - -
    - -
    -
  • - - -
  • -
    - - Gender - * - - - -
    - - - - - - -
    -
    -
  • - - - -
  • - -
    - -
    -
  • - - -
  • -
    - - Grade (2015-2016) - * - - - -
    - - - - - - - - - - - - -
    -
    -
  • - - - -
  • - - - - - - - - - - - - - - -
  • - - - -
  • - -
    - -
    -
  • - - - -
  • - - - - - - -
    - - -
    - - -
    - -
    - - - -
    - -
    - - - -
    - -
    - - - -
    - -
    - - - -
    - -
    - - - -
    - -
    - - - -
    - -
    - -
  • - - - - - - - -
  • -

    - Parent/Guardian Information -

    -
    -
  • - - - -
  • - - - - - - - -
  • - - - -
  • - - - - - - - - - - - - - - -
  • - - - -
  • - -
    - -
    -
  • - - - - - -
  • -
    - -
    -
  • - -
  • - - -
  • -
-
-
- - - - - diff --git a/sitecake.php b/sitecake.php deleted file mode 100644 index a233e0e..0000000 --- a/sitecake.php +++ /dev/null @@ -1 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sitecake/2.2.9/client/contentmanager/7C153C2ACD34029693A94DE16C69F397.cache.html b/sitecake/2.2.9/client/contentmanager/7C153C2ACD34029693A94DE16C69F397.cache.html deleted file mode 100644 index 04bf57b..0000000 --- a/sitecake/2.2.9/client/contentmanager/7C153C2ACD34029693A94DE16C69F397.cache.html +++ /dev/null @@ -1,33205 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sitecake/2.2.9/client/contentmanager/C8EE3471187AAF65679115887C3CEBD0.cache.html b/sitecake/2.2.9/client/contentmanager/C8EE3471187AAF65679115887C3CEBD0.cache.html deleted file mode 100644 index 560c4b7..0000000 --- a/sitecake/2.2.9/client/contentmanager/C8EE3471187AAF65679115887C3CEBD0.cache.html +++ /dev/null @@ -1,33265 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sitecake/2.2.9/client/contentmanager/D0AB0F34D4B4BEB3BE9040997421C04A.cache.html b/sitecake/2.2.9/client/contentmanager/D0AB0F34D4B4BEB3BE9040997421C04A.cache.html deleted file mode 100644 index 0f00230..0000000 --- a/sitecake/2.2.9/client/contentmanager/D0AB0F34D4B4BEB3BE9040997421C04A.cache.html +++ /dev/null @@ -1,1874 +0,0 @@ - - - - - - - - diff --git a/sitecake/2.2.9/client/contentmanager/clear.cache.gif b/sitecake/2.2.9/client/contentmanager/clear.cache.gif deleted file mode 100644 index e565824..0000000 Binary files a/sitecake/2.2.9/client/contentmanager/clear.cache.gif and /dev/null differ diff --git a/sitecake/2.2.9/client/contentmanager/contentmanager.nocache.js b/sitecake/2.2.9/client/contentmanager/contentmanager.nocache.js deleted file mode 100644 index a8923eb..0000000 --- a/sitecake/2.2.9/client/contentmanager/contentmanager.nocache.js +++ /dev/null @@ -1,330 +0,0 @@ -function contentmanager(){ - var $intern_0 = '', $intern_34 = '" for "gwt:onLoadErrorFn"', $intern_32 = '" for "gwt:onPropertyErrorFn"', $intern_15 = '"><\/script>', $intern_17 = '#', $intern_62 = '.cache.html', $intern_19 = '/', $intern_64 = '//platform.twitter.com/widgets.js', $intern_56 = '5BA269C90F474A2111BF4DF95B9BA2D6', $intern_57 = '7C153C2ACD34029693A94DE16C69F397', $intern_61 = ':', $intern_58 = ':1', $intern_26 = '::', $intern_66 = ' - -This html file is for hosted mode support. - diff --git a/sitecake/2.2.9/client/publicmanager/0A9476898799A150D840F0B1C3672921.cache.png b/sitecake/2.2.9/client/publicmanager/0A9476898799A150D840F0B1C3672921.cache.png deleted file mode 100644 index 08671ce..0000000 Binary files a/sitecake/2.2.9/client/publicmanager/0A9476898799A150D840F0B1C3672921.cache.png and /dev/null differ diff --git a/sitecake/2.2.9/client/publicmanager/25794F0F1C3B5EE12E1A79F7EA1D3A5C.cache.html b/sitecake/2.2.9/client/publicmanager/25794F0F1C3B5EE12E1A79F7EA1D3A5C.cache.html deleted file mode 100644 index 05697bd..0000000 --- a/sitecake/2.2.9/client/publicmanager/25794F0F1C3B5EE12E1A79F7EA1D3A5C.cache.html +++ /dev/null @@ -1,10548 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sitecake/2.2.9/client/publicmanager/37BEFFC7D91450C609E36D1D8FCB57A4.cache.html b/sitecake/2.2.9/client/publicmanager/37BEFFC7D91450C609E36D1D8FCB57A4.cache.html deleted file mode 100644 index a3857b6..0000000 --- a/sitecake/2.2.9/client/publicmanager/37BEFFC7D91450C609E36D1D8FCB57A4.cache.html +++ /dev/null @@ -1,10375 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sitecake/2.2.9/client/publicmanager/396F806CD63ABD414BFBB9D57429F05B.cache.png b/sitecake/2.2.9/client/publicmanager/396F806CD63ABD414BFBB9D57429F05B.cache.png deleted file mode 100644 index 009e987..0000000 Binary files a/sitecake/2.2.9/client/publicmanager/396F806CD63ABD414BFBB9D57429F05B.cache.png and /dev/null differ diff --git a/sitecake/2.2.9/client/publicmanager/5E0D259F6C74FB98FC27FE5259EEFD14.cache.png b/sitecake/2.2.9/client/publicmanager/5E0D259F6C74FB98FC27FE5259EEFD14.cache.png deleted file mode 100644 index 08f67a5..0000000 Binary files a/sitecake/2.2.9/client/publicmanager/5E0D259F6C74FB98FC27FE5259EEFD14.cache.png and /dev/null differ diff --git a/sitecake/2.2.9/client/publicmanager/9957AEB865BFF6944E468B1E13642BE5.cache.html b/sitecake/2.2.9/client/publicmanager/9957AEB865BFF6944E468B1E13642BE5.cache.html deleted file mode 100644 index 0720469..0000000 --- a/sitecake/2.2.9/client/publicmanager/9957AEB865BFF6944E468B1E13642BE5.cache.html +++ /dev/null @@ -1,10289 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sitecake/2.2.9/client/publicmanager/9A0A93C4047717CF00B6A16FA832490D.cache.gif b/sitecake/2.2.9/client/publicmanager/9A0A93C4047717CF00B6A16FA832490D.cache.gif deleted file mode 100644 index aadc27a..0000000 Binary files a/sitecake/2.2.9/client/publicmanager/9A0A93C4047717CF00B6A16FA832490D.cache.gif and /dev/null differ diff --git a/sitecake/2.2.9/client/publicmanager/9D9887AECFA808F0BFE613B13E44CBD1.cache.html b/sitecake/2.2.9/client/publicmanager/9D9887AECFA808F0BFE613B13E44CBD1.cache.html deleted file mode 100644 index db9ed78..0000000 --- a/sitecake/2.2.9/client/publicmanager/9D9887AECFA808F0BFE613B13E44CBD1.cache.html +++ /dev/null @@ -1,10384 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sitecake/2.2.9/client/publicmanager/DF7764EEC1903CD03C9545B354D8D8E4.cache.png b/sitecake/2.2.9/client/publicmanager/DF7764EEC1903CD03C9545B354D8D8E4.cache.png deleted file mode 100644 index fbae947..0000000 Binary files a/sitecake/2.2.9/client/publicmanager/DF7764EEC1903CD03C9545B354D8D8E4.cache.png and /dev/null differ diff --git a/sitecake/2.2.9/client/publicmanager/E44767377485D18D6B6864F65BA8EF73.cache.png b/sitecake/2.2.9/client/publicmanager/E44767377485D18D6B6864F65BA8EF73.cache.png deleted file mode 100644 index 030ffab..0000000 Binary files a/sitecake/2.2.9/client/publicmanager/E44767377485D18D6B6864F65BA8EF73.cache.png and /dev/null differ diff --git a/sitecake/2.2.9/client/publicmanager/EBBE13FEA83353E60A4FA3A2F97FC250.cache.html b/sitecake/2.2.9/client/publicmanager/EBBE13FEA83353E60A4FA3A2F97FC250.cache.html deleted file mode 100644 index a9c4696..0000000 --- a/sitecake/2.2.9/client/publicmanager/EBBE13FEA83353E60A4FA3A2F97FC250.cache.html +++ /dev/null @@ -1,10382 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sitecake/2.2.9/client/publicmanager/EBDE4BDD1C095759B90B3354368171DF.cache.html b/sitecake/2.2.9/client/publicmanager/EBDE4BDD1C095759B90B3354368171DF.cache.html deleted file mode 100644 index fea7f7e..0000000 --- a/sitecake/2.2.9/client/publicmanager/EBDE4BDD1C095759B90B3354368171DF.cache.html +++ /dev/null @@ -1,10620 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sitecake/2.2.9/client/publicmanager/EDC7827FEEA59EE44AD790B1C6430C45.cache.png b/sitecake/2.2.9/client/publicmanager/EDC7827FEEA59EE44AD790B1C6430C45.cache.png deleted file mode 100644 index 714cbb1..0000000 Binary files a/sitecake/2.2.9/client/publicmanager/EDC7827FEEA59EE44AD790B1C6430C45.cache.png and /dev/null differ diff --git a/sitecake/2.2.9/client/publicmanager/FE9F62F1BAC64B492B86AEEA791B52E8.cache.png b/sitecake/2.2.9/client/publicmanager/FE9F62F1BAC64B492B86AEEA791B52E8.cache.png deleted file mode 100644 index 619e765..0000000 Binary files a/sitecake/2.2.9/client/publicmanager/FE9F62F1BAC64B492B86AEEA791B52E8.cache.png and /dev/null differ diff --git a/sitecake/2.2.9/client/publicmanager/clear.cache.gif b/sitecake/2.2.9/client/publicmanager/clear.cache.gif deleted file mode 100644 index e565824..0000000 Binary files a/sitecake/2.2.9/client/publicmanager/clear.cache.gif and /dev/null differ diff --git a/sitecake/2.2.9/client/publicmanager/hosted.html b/sitecake/2.2.9/client/publicmanager/hosted.html deleted file mode 100644 index 8c2830f..0000000 --- a/sitecake/2.2.9/client/publicmanager/hosted.html +++ /dev/null @@ -1,350 +0,0 @@ - - - -This html file is for hosted mode support. - diff --git a/sitecake/2.2.9/client/publicmanager/publicmanager.nocache.js b/sitecake/2.2.9/client/publicmanager/publicmanager.nocache.js deleted file mode 100644 index 1e457ff..0000000 --- a/sitecake/2.2.9/client/publicmanager/publicmanager.nocache.js +++ /dev/null @@ -1,311 +0,0 @@ -function publicmanager(){ - var $intern_0 = '', $intern_34 = '" for "gwt:onLoadErrorFn"', $intern_32 = '" for "gwt:onPropertyErrorFn"', $intern_15 = '"><\/script>', $intern_17 = '#', $intern_59 = '.cache.html', $intern_19 = '/', $intern_52 = '25794F0F1C3B5EE12E1A79F7EA1D3A5C', $intern_53 = '37BEFFC7D91450C609E36D1D8FCB57A4', $intern_54 = '9957AEB865BFF6944E468B1E13642BE5', $intern_55 = '9D9887AECFA808F0BFE613B13E44CBD1', $intern_58 = ':', $intern_26 = '::', $intern_61 = ''; - } - - /** - * Returns a '; - } - - /** - * Returns a phpQueryObject document created of the given HTML code. - * @param string $html HTML code - * @return phpQueryObject the resulting phpQueryObject instance - */ - public static function strToDoc($html) { - return phpQuery::newDocument($html); - } - - /** - * Converts the given HTML document into a phpQueryObject document if not - * already. - * - * @param string|phpQueryObject $obj the input HTML document. It could be a HTML string or already - * a phpQueryObject - * @return phpQueryObject the resulting HTML document - */ - public static function toDoc($obj) { - return is_object($obj) ? $obj : HtmlUtils::strToDoc($obj); - } - - /** - * Tests if the given URL is an absolute URL. - * - * @param string $url an URL to be tested - * @return boolean the test result - */ - public static function isAbsoluteURL($url) { - return (strpos($url, 'http://') === 0) || (strpos($url, 'https://') === 0); - } - - /** - * Tests if the given URL is an relative URL. - * - * @param string $url an URL to be tested - * @return boolean the test result - */ - public static function isRelativeURL($url) { - return !((strpos($url, 'http://') === 0) || (strpos($url, 'https://') === 0)); - } - - /** - * Prefix the given node's attribute with a prefix if its value satisfies - * the test. In case the test is not provided, *HtmlUtils::isRelativeURL* - * will be used. - * - * @param DOMNode $node reference to a DOMNode - * @param string $attr name of a node attribute - * @param string $prefix a string value that the attr value would be prefixed with - * @param function|undefined $test a test function (callable) that tests - * if the provided attr value should be modified by returing - * a boolean value - * @return DOMNode the input node reference - */ - public static function prefixNodeAttr($node, $attr, $prefix, $test = false) { - if ($node->hasAttribute($attr)) { - $val = $node->getAttribute($attr); - $val = preg_replace_callback('/([^\s,]+)(\s?[^,]*)/', - function ($match) use($prefix, $test) { - $shouldPrefix = is_callable($test) ? $test($match[1]) : self::isRelativeURL($match[1]); - return ($shouldPrefix ? $prefix : '') . $match[1] . $match[2]; - } - , $val); - $node->setAttribute($attr, $val); - } - return $node; - } - - /** - * Removes the given prefix from the give node's attribute if the attribute - * value starts with the prefix and if the provided test function returns *true*. - * - * @param DOMNode $node reference to a DOMNode node - * @param string $attr a node attribute name - * @param string $prefix a prefix that should be stripped from the begining of the attr value - * @param function|undefined $test a test function (callable) that controls if - * the attribute value should be modified by returning a boolean value - * @return DOMNode the input node reference - */ - public static function unprefixNodeAttr($node, $attr, $prefix, $test = false) { - if ($node->hasAttribute($attr)) { - $val = $node->getAttribute($attr); - $val = preg_replace_callback('/([^\s,]+)(\s?[^,]*)/', - function ($match) use($prefix, $test) { - $shouldUnprefix = (strpos($match[1], $prefix) === 0) && - (is_callable($test) ? $test($match[1]) : true); - return ($shouldUnprefix ? substr($match[1], strlen($prefix)) : $match[1]) . $match[2]; - } - , $val); - $node->setAttribute($attr, $val); - } - return $node; - } - - /** - * Prefixes all given node attributes with the specified value. - * - * @see HtmlUtils::prefixNodeAttr - * - * @param DOMNode $node [description] - * @param string|array $attrs attribute name, comma-separated list or array of attribute names - * @param string $prefix a value to prefix the attribute with - * @param function|undefined $test change condition function - * @return DOMNode the input node reference - */ - public static function prefixNodeAttrs($node, $attrs, $prefix, $test = false) { - $attrs = is_string($attrs) ? explode(",", $attrs) : $attr; - foreach ($attrs as $attr) { - self::prefixNodeAttr($node, trim($attr), $prefix, $test); - } - return $node; - } - - /** - * Removes the given prefix from all specified node attributes. - * - * @see HtmlUtils::unprefixNodeAttr - * - * @param DOMNode $node reference to a DOMNode node - * @param string|array $attrs attribute name, a comma-separated list or an array of attribute names - * @param string $prefix a prefix that should be stripped from the begining of the attr value - * @param function|undefined $test a test function (callable) that controls if - * the attribute value should be modified by returning a boolean value - * @return DOMNode the input node reference - */ - public static function unprefixNodeAttrs($node, $attrs, $prefix, $test = false) { - $attrs = is_string($attrs) ? explode(",", $attrs) : $attr; - foreach ($attrs as $attr) { - self::unprefixNodeAttr($node, trim($attr), $prefix, $test); - } - return $node; - } -} \ No newline at end of file diff --git a/sitecake/2.2.9/server/Sitecake/ImageTool.php b/sitecake/2.2.9/server/Sitecake/ImageTool.php deleted file mode 100644 index 1b8e0a7..0000000 --- a/sitecake/2.2.9/server/Sitecake/ImageTool.php +++ /dev/null @@ -1,178 +0,0 @@ - 'image/jpg', - 'jpg' => 'image/jpeg', - 'jpg' => 'image/pjpeg', - 'gif' => 'image/gif', - 'png' => 'image/png' - ); - - protected $fs; - - protected $imagesDir; - - public function __construct($fs, $imagesDir) { - $this->fs = $fs; - $this->imagesDir = $imagesDir; - } - - public function image($uri, $x = '0%', $y = '0%', $w = '100%', $h = '100%') { - if (Utils::isURL($uri)) { - list($image, $extension) = $this->loadFromURL($uri); - //$this->transform(Utils::nameFromURL($uri), $extension, WideImage::loadFromString($image), $x, $y, $w, $h) : - } else { - $imageName = $this->imageName($uri); - $this->transform($imageName['name'], $imageName['extension'], WideImage::loadFromString($this->fs->read($uri)), $x, $y, $w, $h); - } - } - - protected function parseImgPathSet($id) { - $pathPattern = - $this->fs->listPatternPaths($pathPattern); - } - - protected function imageName($uri) { - $info = pathinfo($uri); - return array('name' => $info['filename'], 'extension' => $info['extension']); - } - - protected function loadFromURL($url) { - $image = file_get_contents($url); - $headers = http_parse_headers(implode("\r\n", $http_response_header)); - $ext = array_search($headers['Content-Type'], $mimeExtensions); - return array($image, $ext); - } - - protected function transform($name, $extension, $img, $x, $y, $w, $h) { - $origWidth = $img->getWidth(); - - $img->crop($x, $y, $w, $h); - } - - static function transform1($params) { - $url = $params['image']; - $data = $params['data']; - $info = image::image_info($url); - $path = $info['path']; - - if (!io::file_exists($path)) - throw new \Exception(resources::message('FILE_NOT_EXISTS', $path)); - - if (meta::exists($info['id'])) { - $meta = meta::get($info['id']); - $spath = util::apath($meta['orig']); - $data = isset($meta['data']) ? - image::combine_transform($meta['data'], $data) : $data; - } else { - $spath = $path; - } - - $id = util::id(); - $name = $id . '.' . $info['ext']; - $dpath = DRAFT_CONTENT_DIR . '/' . $name; - image::transform_image($spath, $dpath, $data); - meta::put($id, array( - 'orig' => util::rpath($spath), - 'oid' => $info['id'], - 'path' => util::rpath($dpath), - 'name' => $name, - 'data' => $data, - 'image' => true - )); - return array('status' => 0, - 'url' => DRAFT_CONTENT_URL . '/' . $name); - } - - static function image_info($url) { - return array( - 'id' => reset(explode('.', end(explode('/', $url)))), - 'ext' => end(explode('.', end(explode('/', $url)))), - 'path' => SC_ROOT . '/' . $url, - 'name' => basename(SC_ROOT . '/' . $url) - ); - } - - static function combine_transform($old, $new) { - list($osw, $osh, $osx, $osy, $odw, $odh) = explode(':', $old); - list($sw, $sh, $sx, $sy, $dw, $dh) = explode(':', $new); - $dx = $sw/$odw; - $dy = $sh/$odh; - - return implode(':', array($dx*$osw, $dy*$osh, - $dx*$osx + abs($sx), $dy*$osy + abs($sy), $dw, $dh)); - } - - static function transform_image($spath, $dpath, $data) { - $datas = explode(':', $data); - $srcWidth = $datas[0]; - $srcHeight = $datas[1]; - $srcX = $datas[2]; - $srcY = $datas[3]; - $dstWidth = $datas[4]; - $dstHeight = $datas[5]; - - img::load($spath); - - $origWidth = img::getWidth(); - $origHeight = img::getHeight(); - - $xRatio = $origWidth / $srcWidth; - $yRatio = $origHeight / $srcHeight; - - $srcWidth = $dstWidth * $xRatio; - $srcHeight= $dstHeight * $yRatio; - $srcX = $srcX * $xRatio; - $srcY = $srcY * $yRatio; - - img::transform($srcX, $srcY, $srcWidth, $srcHeight, - $dstWidth, $dstHeight); - img::save($dpath); - img::unload(); - } - - static function resizeToHeight($height) { - self::$image = self::$image->resize(null, $height); - } - - static function resizeToWidth($width) { - self::$image = self::$image->resize($width,null); - } - - static function resizeToDimension($dimension) { - if (self::$image->getWidth() >= self::$image->getHeight()) { - self::resizeToWidth($dimension); - } else { - self::resizeToHeight($dimension); - } - } - - static function scale($scale) { - $width = self::getWidth() * $scale/100; - $height = self::getHeight() * $scale/100; - self::$image = self::$image->resize($width, $height); - } - - static function resize($width, $height) { - self::$image = self::$image->resize( $width, $height ); - } - - static function _transform($sx, $sy, $swidth, $sheight, $dwidth, $dheight) { - if ($dwidth == null) { - $dwidth = self::getWidth(); - } - - if ($dheight == null) { - $dheight = self::getHeight(); - } - - self::$image = self::$image->crop($sx, $sy, $swidth, $sheight)-> - resize($dwidth, $dheight); - } -} \ No newline at end of file diff --git a/sitecake/2.2.9/server/Sitecake/Page.php b/sitecake/2.2.9/server/Sitecake/Page.php deleted file mode 100644 index 48c5c81..0000000 --- a/sitecake/2.2.9/server/Sitecake/Page.php +++ /dev/null @@ -1,305 +0,0 @@ -id] = $wrapper; - phpQuery::selectDocument($wrapper->id); - return new phpQueryObject($wrapper->id); - } - - public function __construct($html) { - $this->sourceHtml = $html; - $this->doc = $this->createPhpQueryDocSafe($html); - } - - public function __toString() { - return (string)$this->doc; - } - - public function render() { - $this->adjustNavLinks(); - return $this->doc; - } - - public function prefixResourceUrls($prefix) { - foreach (phpQuery::pq('a, img', $this->doc) as $node) { - HtmlUtils::prefixNodeAttrs($node, 'src,href,srcset', $prefix, function($url) { - return Utils::isResourceUrl($url); - }); - } - } - - public function unprefixResourceUrls($prefix) { - foreach (phpQuery::pq('a, img', $this->doc) as $node) { - HtmlUtils::unprefixNodeAttrs($node, 'src,href,srcset', $prefix, function($url) { - return Utils::isResourceUrl($url); - }); - } - } - - public function listResourceUrls() { - $urls = array(); - foreach ($this->containerNodes() as $container) { - $urls = array_merge($urls, $this->listContainerResourceUrls($container)); - } - return $urls; - } - - /** - * Lists URLs (href attribute values) from selected nav items. - * - * @param string $selector CSS selector for nav items - * @return array list of URLs in nav items - */ - public function listNavUrls($selector) { - $urls = array(); - foreach (phpQuery::pq($selector, $this->doc) as $node) { - $el = phpQuery::pq($node, $this->doc); - $urls[$el->attr('href')] = $el->text(); - } - return $urls; - } - - /** - * Sets the given nav HTML content into element(s) referenced by the - * given CSS selector. - * - * @param string $selector one or more nav elements to set the HTML to - * @param string $html the nav HTML content to set - */ - public function setNav($selector, $html) { - foreach (phpQuery::pq($selector, $this->doc) as $node) { - $el = phpQuery::pq($node, $this->doc); - $el->html($html); - } - } - - /** - * Adds the 'noindex' meta tag in the page header, if not present. - */ - public function addRobotsNoIndex() { - if (phpQuery::pq('meta[content="noindex"]', $this->doc)->count() === 0) { - phpQuery::pq('head', $this->doc)->prepend(''); - } - } - - /** - * Removes the 'noindex' meta tag from the page header, if present. - */ - public function removeRobotsNoIndex() { - phpQuery::pq('meta[content="noindex"]', $this->doc)->remove(); - } - - /** - * Checks if the 'noindex' metatag is present. - * @return boolean true if the 'noindex' meta tag is present - */ - public function isRobotsNoIndex() { - return (phpQuery::pq('meta[content="noindex"]', $this->doc)->count() > 0); - } - - /** - * Reads the page description meta tag. - * - * @return string current description text - */ - public function getPageDescription() { - $text = ''; - $tag = phpQuery::pq('meta[name="description"]', $this->doc); - if ($tag->count() > 0) { - $text = phpQuery::pq($tag->elements[0])->attr('content'); - } - return $text; - } - - /** - * Sets the page description meta tag with the given content. - */ - public function setPageDescription($text) { - $meta = phpQuery::pq('meta[name="description"]', $this->doc); - if ($text === '') { - $meta->remove(); - } else { - if ($meta->count() > 0) { - $meta->attr('content', $text); - } else { - phpQuery::pq('head', $this->doc)->prepend(''); - } - } - } - - public function setContainerContent($containerName, $content) { - foreach (phpQuery::pq('.sc-content-' . $containerName, $this->doc) as $node) { - $container = phpQuery::pq($node, $this->doc); - $container->html($content); - } - } - - public function addMetadata() { - if (phpQuery::pq('meta[content="sitecake"]', $this->doc)->count() === 0) { - phpQuery::pq('head', $this->doc)->prepend(''); - } - } - - public function removeMetadata() { - phpQuery::pq('meta[content="sitecake"]', $this->doc)->remove(); - } - - /** - * Adds an attribute to the sitecake metadata tag. If the metadata tag does not - * exists it will be created. - * - * @param string $attr attribute name - * @param string $value attribute value - */ - public function addMetadataAttr($attr, $value) { - $this->addMetadata(); - phpQuery::pq('meta[content="sitecake"]', $this->doc)->attr('data-'.$attr, $value); - } - - /** - * Removes the specified attribute of the sitecake meta tag. - * - * @param string $attr attribute name - */ - public function removeMetadataAttr($attr) { - phpQuery::pq('meta[content="sitecake"]', $this->doc)->removeAttr('data-'.$attr); - } - - /** - * Reads the metadata attribute value. - * - * @param string $attr attribute name - * @return string returns the attribute value or an empty string if attribute is not present - */ - public function getMetadataAttr($attr) { - return phpQuery::pq('meta[content="sitecake"]', $this->doc)->attr('data-'.$attr); - } - - /** - * Sets the page title (the title tag). - */ - public function setPageTitle($val) { - $title = phpQuery::pq('title', $this->doc); - if ($title->count() > 0) { - $title->html($val); - } else { - phpQuery::pq('head', $this->doc)->prepend(''.$val.''); - } - } - - /** - * Returns the page title (the title tag). - * - * @return string the current value of the title tag - */ - public function getPageTitle() { - return phpQuery::pq('title', $this->doc)->html(); - } - - public function ensurePageId() { - if ('' == $this->getMetadataAttr('pageid')) { - $this->addMetadataAttr('pageid', Utils::id()); - } - } - - public function pageId() { - return $this->getMetadataAttr('pageid'); - } - - public function removePageId() { - $this->removeMetadataAttr('pageid'); - } - - public function appendCodeToHead($code) { - HtmlUtils::appendToHead($this->doc, $code); - } - - protected function listContainerResourceUrls($container) { - $urls = array(); - $html = (string)phpQuery::pq($container, $this->doc); - preg_match_all("/[^\\s\"',]*(?:files|images)\\/[^\\s]*\\-sc[0-9a-f]{13}[^\.]*\\.[0-9a-zA-Z]+/", - $html, $matches); - foreach ($matches[0] as $match) { - if (Utils::isResourceUrl($match)) { - array_push($urls, $match); - } - } - return $urls; - } - - protected function containerNodes() { - $containers = array(); - foreach (phpQuery::pq('[class*="sc-content"]', $this->doc) as $node) { - $container = phpQuery::pq($node, $this->doc); - $class = $container->attr('class'); - if (preg_match('/(^|\s)sc\-content(\-[^\s]+)*(\s|$)/', $class, $matches)) { - array_push($containers, $container); - } - } - return $containers; - } - - public function normalizeContainerNames() { - foreach ($this->containerNodes() as $node) { - $container = phpQuery::pq($node, $this->doc); - $class = $container->attr('class'); - if (preg_match('/(^|\s)sc\-content($|\s)/', $class, $matches)) { - $container->addClass('sc-content-_cnt_' . mt_rand() . mt_rand()); - } - } - } - - public function cleanupContainerNames() { - foreach ($this->containerNodes() as $node) { - $container = phpQuery::pq($node, $this->doc); - $class = $container->attr('class'); - if (preg_match('/(^|\s)(sc\-content\-_cnt_[^\s]+)/', - $class, $matches)) { - $container->removeClass($matches[2]); - } - } - } - - /** - * Returns a list of container names. - * - * @return array a list of container names - */ - public function containers() { - if (!$this->_containers) { - $this->_containers = array(); - foreach ($this->containerNodes() as $container) { - preg_match('/(^|\s)sc-content-([^\s]+)/', - $container->attr('class'), $matches); - if (isset($matches[2])) { - array_push($this->_containers, $matches[2]); - } - } - } - return $this->_containers; - } - - protected function adjustNavLinks() { - foreach (phpQuery::pq('a', $this->doc) as $node) { - $href = $node->getAttribute('href'); - if (!Utils::isExternalNavLink($href)) { - $node->setAttribute('href', 'sitecake.php?page=' . $href); - } - } - } -} \ No newline at end of file diff --git a/sitecake/2.2.9/server/Sitecake/Renderer.php b/sitecake/2.2.9/server/Sitecake/Renderer.php deleted file mode 100644 index cbd9cbb..0000000 --- a/sitecake/2.2.9/server/Sitecake/Renderer.php +++ /dev/null @@ -1,68 +0,0 @@ -site = $site; - $this->options = $options; - } - - public function loginResponse() { - return $this->injectLoginDialog($this->site->getDefaultPublicPage()); - } - - public function editResponse($page) { - $this->site->startEdit(); - return $this->injectEditorCode( - $this->site->getPage($this->pageUri($page)), - $this->site->isDraftClean() - ); - } - - protected function injectLoginDialog($page) { - $page->appendCodeToHead($this->clientCodeLogin()); - return $page->render(); - } - - protected function pageUri($page) { - return $page ? $page : 'index.html'; - } - - protected function injectEditorCode($page, $published) { - $page->appendCodeToHead($this->clientCodeEditor($published)); - return $page->render(); - } - - protected function clientCodeLogin() { - $globals = "var sitecakeGlobals = {". - "editMode: false, " . - 'serverVersionId: "SiteCake CMS 2.2.9", ' . - "serviceUrl:'" . $this->options['SERVICE_URL'] . "', " . - "configUrl:'" . $this->options['EDITOR_CONFIG_URL'] . "', " . - "forceLoginDialog: true" . - "};"; - - return HtmlUtils::wrapToScriptTag($globals) . - HtmlUtils::scriptTag($this->options['EDITOR_LOGIN_URL']); - } - - protected function clientCodeEditor($published) { - $globals = "var sitecakeGlobals = {". - "editMode: true, " . - 'serverVersionId: "SiteCake CMS 2.2.9", ' . - "serviceUrl:'" . $this->options['SERVICE_URL'] . "', " . - "configUrl:'" . $this->options['EDITOR_CONFIG_URL'] . "', " . - "draftPublished: " . ($published ? 'true' : 'false') . - "};"; - - return HtmlUtils::wrapToScriptTag($globals) . - HtmlUtils::scriptTag($this->options['EDITOR_EDIT_URL']); - } -} \ No newline at end of file diff --git a/sitecake/2.2.9/server/Sitecake/Router.php b/sitecake/2.2.9/server/Sitecake/Router.php deleted file mode 100644 index ad132af..0000000 --- a/sitecake/2.2.9/server/Sitecake/Router.php +++ /dev/null @@ -1,61 +0,0 @@ -sm = $sm; - $this->services = $services; - } - - public function route($req) { - if (!$req->query->has('service')) { - $renderer = $this->services['renderer']; - $page = $req->query->has('page') ? $req->query->get('page') : 'index.html'; - return $this->sm->isLoggedIn() ? - $renderer->editResponse($page) : $renderer->loginResponse(); - } else { - $service = $req->query->get('service'); - $action = $req->query->has('action') ? $req->query->get('action') : null; - return $this->execute($service, $action, $req); - } - } - - protected function execute($service, $action, $request) { - if (!isset($this->services[$service]) || - !($this->services[$service] instanceof \Sitecake\Services\Service)) { - return new Response('Invalid service referenced: ' . $service, 400); - } - - $srv = $this->services[$service]; - if (!$srv->actionExists($action)) { - return new Response('Invalid action requested: ' . $action, 400); - } - - if ($srv->isAuthRequired($action) && !$this->sm->isLoggedIn()) { - return new Response('Unauthorized access', 401); - } - - return $this->response($srv, $action, $request); - } - - protected function response($service, $action, $request) { - try { - $res = $service->$action($request); - if ($res instanceof Response) { - return $res; - } else { - return new Response($res); - } - } catch(\Exception $e) { - return new Response("Exception: " . $e->getMessage() . "\n\r" . $e->getTraceAsString(), 500); - } - } - -} diff --git a/sitecake/2.2.9/server/Sitecake/Services.php b/sitecake/2.2.9/server/Sitecake/Services.php deleted file mode 100644 index d20c4fc..0000000 --- a/sitecake/2.2.9/server/Sitecake/Services.php +++ /dev/null @@ -1,27 +0,0 @@ -ctx = $ctx; - } - - public function load() { - $this->loadService('\Sitecake\Services\Session\SessionService'); - $this->loadService('\Sitecake\Services\Upload\UploadService'); - $this->loadService('\Sitecake\Services\Image\ImageService'); - $this->loadService('\Sitecake\Services\Pages\PagesService'); - $this->loadService('\Sitecake\Services\Content\ContentService'); - } - - protected function loadService($class) { - $name = $class::name(); - $this->ctx[$name] = $this->ctx->share(function($ctx) use ($class) { - return new $class($ctx); - }); - } -} \ No newline at end of file diff --git a/sitecake/2.2.9/server/Sitecake/Services/Content/Content.php b/sitecake/2.2.9/server/Sitecake/Services/Content/Content.php deleted file mode 100644 index 54b002d..0000000 --- a/sitecake/2.2.9/server/Sitecake/Services/Content/Content.php +++ /dev/null @@ -1,82 +0,0 @@ -site = $site; - } - - public function save($data) { - foreach ($data as $container => $content) { - // remove slashes - if (get_magic_quotes_gpc()) - $content = stripcslashes($content); - $content = base64_decode($content); - $this->setContainerContent($container, $content); - } - $this->savePages(); - return 0; - } - - protected function pages() { - if (!$this->_pages) { - $this->_pages = $this->site->getAllPages(); - } - return $this->_pages; - } - - protected function containers() { - if (!$this->_containers) { - $this->initContainers(); - } - return $this->_containers; - } - - protected function initContainers() { - $this->_containers = array(); - $pages = $this->pages(); - foreach ($pages as $page) { - $pageContainers = $page['page']->containers(); - foreach ($pageContainers as $container) { - if (array_key_exists($container, $this->_containers)) { - array_push($this->_containers[$container], $page); - } else { - $this->_containers[$container] = array($page); - } - } - } - } - - protected function setContainerContent($container, $content) { - $containers = $this->containers(); - if (isset($containers[$container])) { - foreach ($containers[$container] as $page) { - $this->setPageDirty($page); - $page['page']->setContainerContent($container, $content); - } - } - } - - protected function setPageDirty($page) { - foreach ($this->_pages as &$p) { - if ($page['path'] === $p['path']) { - $p['dirty'] = true; - } - } - } - - protected function savePages() { - foreach ($this->pages() as $page) { - if (isset($page['dirty']) && $page['dirty'] === true) { - $this->site->savePage($page['path'], $page['page']); - } - } - } -} \ No newline at end of file diff --git a/sitecake/2.2.9/server/Sitecake/Services/Content/ContentService.php b/sitecake/2.2.9/server/Sitecake/Services/Content/ContentService.php deleted file mode 100644 index 65a21ad..0000000 --- a/sitecake/2.2.9/server/Sitecake/Services/Content/ContentService.php +++ /dev/null @@ -1,40 +0,0 @@ -ctx = $ctx; - $this->content = new Content($ctx['site']); - } - - public function save($request) { - $id = $request->request->get('scpageid'); - if (is_null($id)) { - return new Response('Page ID is missing', 400); - } - $request->request->remove('scpageid'); - $this->content->save($request->request->all()); - return $this->json($request, array('status' => 0), 200); - } - - public function publish($request) { - $this->ctx['site']->publishDraft(); - return $this->json($request, array('status' => 0), 200); - } - -} \ No newline at end of file diff --git a/sitecake/2.2.9/server/Sitecake/Services/Image/ImageService.php b/sitecake/2.2.9/server/Sitecake/Services/Image/ImageService.php deleted file mode 100644 index 6ca26ab..0000000 --- a/sitecake/2.2.9/server/Sitecake/Services/Image/ImageService.php +++ /dev/null @@ -1,192 +0,0 @@ -ctx = $ctx; - } - - public function upload($request) { - - // obtain the uploaded file, load image and get its details (filename, extension) - if (!$request->headers->has('x-filename')) { - return new Response('Filename is missing (header X-FILENAME)', 400); - } - $filename = $request->headers->get('x-filename'); - - $pathinfo = pathinfo($filename); - if (!in_array(strtolower($pathinfo['extension']), self::$imageExtensions)) { - return $this->json($request, array('status' => 1, - 'errMessage' => "$filename is not an image file" ), 200); - } - - $filename = $pathinfo['filename']; - $ext = $pathinfo['extension']; - $img = WideImage::load("php://input"); - - // generate image set - $res = $this->generateImageSet($img, $filename, $ext); - - $res = array( - 'status' => 0, - 'srcset' => $res['srcset'], - 'ratio' => $res['ratio'] - ); - - return $this->json($request, $res, 200); - } - - public function uploadExternal($request) { - if (!$request->request->has('src')) { - return new Response('Image URI is missing', 400); - } - $uri = $request->request->get('src'); - $referer = substr($uri, 0, strrpos($uri, '/')); - $ch = curl_init($uri); - curl_setopt($ch, CURLOPT_HEADER, 0); - curl_setopt($ch, CURLOPT_REFERER, $referer); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); - curl_setopt($ch, CURLOPT_BINARYTRANSFER,1); - $output = curl_exec($ch); - curl_close($ch); - - try { - $img = WideImage::loadFromString($output); - } catch (\Exception $e) { - return new Response('Unable to load image from ' . $uri . ' (referer: ' . substr($uri, 0, strrchr($uri, '/')) . ')', 400); - } - unset($output); - - $urlinfo = parse_url($uri); - $pathinfo = pathinfo($urlinfo['path']); - $filename = $pathinfo['filename']; - $ext = $pathinfo['extension']; - - // generate image set - $res = $this->generateImageSet($img, $filename, $ext); - - $res = array( - 'status' => 0, - 'srcset' => $res['srcset'], - 'ratio' => $res['ratio'] - ); - - return $this->json($request, $res, 200); - } - - public function image($request) { - if (!$request->request->has('image')) { - return new Response('Image URI is missing', 400); - } - $uri = $request->request->get('image'); - - if (!$request->request->has('data')) { - return new Response('Image transformation data is missing', 400); - } - $data = $request->request->get('data'); - - if (!$this->ctx['fs']->has($uri)) { - return new Response("Source image not found ($uri)", 400); - } - $img = WideImage::loadFromString($this->ctx['fs']->read($uri)); - - if (Utils::isResourceUrl($uri)) { - $info = Utils::resurlinfo($uri); - } else { - $pathinfo = pathinfo($uri); - $info = array('name' => $pathinfo['filename'], 'ext' => $pathinfo['extension']); - } - - $datas = explode(':', $data); - $left = $datas[0]; - $top = $datas[1]; - $width = $datas[2]; - $height = $datas[3]; - $filename = $info['name']; - $ext = $info['ext']; - - $img = $this->transform_image($img, $top, $left, $width, $height); - - // generate image set - $res = $this->generateImageSet($img, $filename, $ext); - - $res = array( - 'status' => 0, - 'srcset' => $res['srcset'], - 'ratio' => $res['ratio'] - ); - - return $this->json($request, $res, 200); - } - - protected function generateImageSet($img, $filename, $ext) { - $width = $img->getWidth(); - $ratio = $width/$img->getHeight(); - - $widths = $this->ctx['image.srcset_widths']; - $maxDiff = $this->ctx['image.srcset_width_maxdiff']; - rsort($widths); - - $maxWidth = $widths[0]; - if ($width > $maxWidth) { - $width = $maxWidth; - } - - $id = uniqid(); - - $srcset = array(); - foreach ($this->neededWidths($width, $widths, $maxDiff) as $targetWidth) { - $tpath = Utils::resurl($this->imgDir(), $filename, $id, '-'.$targetWidth, $ext); - $timg = $img->resize($targetWidth); - $targetHeight = $timg->getHeight(); - $this->ctx['fs']->write($tpath, $timg->asString($ext)); - unset($timg); - array_push($srcset, array('width' => $targetWidth, 'height' => $targetHeight, 'url' => $tpath)); - } - - return array('srcset' => $srcset, 'ratio' => $ratio); - } - - private function neededWidths($startWidth, $widths, $maxDiff) { - $res = array($startWidth); - rsort($widths); - $first = true; - foreach ($widths as $i => $width) { - if (!$first || ($first && ($startWidth - $width)/$startWidth > $maxDiff/100)) { - array_push($res, $width); - $first = false; - } - } - return $res; - } - - private function imgDir() { - return $this->ctx['site']->draftPath().'/images'; - } - - protected function transform_image($img, $top, $left, $width, $height) { - return $img->crop($left.'%', $top.'%', $width.'%', $height.'%'); - } - - -} \ No newline at end of file diff --git a/sitecake/2.2.9/server/Sitecake/Services/Pages/Pages.php b/sitecake/2.2.9/server/Sitecake/Services/Pages/Pages.php deleted file mode 100644 index f521136..0000000 --- a/sitecake/2.2.9/server/Sitecake/Services/Pages/Pages.php +++ /dev/null @@ -1,254 +0,0 @@ -site = $site; - $this->conf = $conf; - } - - public function read() { - $draftPages = $this->site->getAllPages(); - - if ($draftPages['index.html']) { - $navUrls = $draftPages['index.html']['page']->listNavUrls(); - } else { - $navUrls = $draftPages; - } - } - - - - static function get($full = false) { - $pages = array(); - $pageFiles = pages::page_files(); - - $homeHtml = io::file_get_contents($pageFiles['index.html']); - $homeDoc = phpQuery::newDocument($homeHtml); - $nav = pages::nav_urls($homeDoc); - $nav_urls = array_keys($nav); - - foreach ($pageFiles as $rpath => $path) { - $url = pages::rpath2url($rpath); - $home = ($url == 'index.html'); - $html = $home ? $homeHtml : io::file_get_contents($path); - $doc = $home ? $homeDoc : phpQuery::newDocument($html); - $idx = array_search($url, $nav_urls); - $navtitle = ($idx === FALSE) ? phpQuery::pq('meta[name="navtitle"]', - $doc)->attr('content') : $nav[$url]; - $navtitle = empty($navtitle) ? pages::url2navtitle($url) : - $navtitle; - $page = array( - 'id' => pages::page_id($html), - 'idx' => ($idx === FALSE) ? -1 : $idx, - 'title' => phpQuery::pq('title', $doc)->text(), - 'navtitle' => $navtitle, - 'desc' => phpQuery::pq( - 'meta[name="description"]', $doc)->attr('content'), - 'keywords' => phpQuery::pq( - 'meta[name="keywords"]', $doc)->attr('content'), - 'home' => $home, - 'url' => $url - ); - if ($full) { - $page['path'] = pages::rpath2path($rpath); - $page['html'] = $html; - $page['doc'] = $doc; - } - array_push($pages, $page); - } - return array('status' => 0, 'pages' => $pages); - } - - static function update($newPages) { - $pages = pages::get(true); - pages::sanity_check($pages, $newPages); - $pages = $pages['pages']; - $navPages = pages::nav_pages($newPages); - pages::update_pages($pages, $newPages, $navPages); - pages::save_pages($newPages); - pages::remove_deleted_pages($pages, $newPages); - pages::sitemap($navPages); - return array('status' => 0, 'pages' => pages::reduce_pages($newPages)); - } - - static function sanity_check($pages, $newPages) { - $homePages = util::array_filter_prop($newPages, 'home', true); - if (!(is_array($homePages) && count($homePages) == 1)) - throw new \Exception( - 'One and only one page should be marked as the home page'); - - $homePage = util::array_find_prop($newPages, 'home', true); - if (!(isset($homePage['url']) && $homePage['url'] == 'index.html')) - throw new \Exception( - 'The URL of the home page has to be index.html'); - - array_walk($newPages, function($page) { - if (!util::str_endswith('.html', $page['url'])) - throw new \Exception('The page URL has to end with .html'); - }); - } - - static function update_pages($pages, &$newPages, $navPages) { - array_walk($newPages, - function(&$newPage) use($pages, $newPages, $navPages) { - $nav = pages::gen_nav($navPages, $newPage['url']); - if (isset($newPage['id'])) { - pages::update_page($newPage, util::array_find_prop($pages, - 'id', $newPage['id']), $nav); - } else { - pages::create_page($newPage, util::array_find_prop($pages, - 'id', $newPage['tid']), $nav); - } - }); - } - - static function save_pages($newPages) { - array_walk($newPages, function($page) { - io::file_put_contents($page['path'], $page['html']); - }); - } - - static function remove_deleted_pages($oldPages, $newPages) { - - array_walk(util::array_diff(util::array_map_prop($oldPages, 'id'), - util::array_map_prop($newPages, 'id')), function($id) { - draft::delete($id); - }); - - array_walk(util::array_diff(util::array_map_prop($oldPages, 'path'), - util::array_map_prop($newPages, 'path')), function($path) { - io::unlink($path); - }); - } - - static function update_page(&$newPage, $page, $nav) { - $newPage['url'] = $newPage['home'] ? - 'index.html' : pages::page_url_slug($newPage['url']); - $newPage['path'] = pages::rpath2path(pages::url2rpath($newPage['url'])); - $newPage['doc'] = $page['doc']; - phpQuery::pq('ul.sc-nav', $newPage['doc'])->html($nav); - phpQuery::pq('title', $newPage['doc'])->html($newPage['title']); - phpQuery::pq('meta[name="navtitle"]', $newPage['doc'])->remove(); - if ($newPage['idx'] == -1) { - phpQuery::pq('title', $newPage['doc'])->after( - ''); - } - phpQuery::pq('meta[name="description"]', $newPage['doc'])->remove(); - if ($newPage['desc']) { - phpQuery::pq('title', $newPage['doc'])-> - after(''); - } - phpQuery::pq('meta[name="keywords"]', $newPage['doc'])->remove(); - if ($newPage['keywords']) { - phpQuery::pq('title', $newPage['doc'])-> - after(''); - } - $newPage['html'] = (string)($newPage['doc']); - } - - static function create_page(&$newPage, $page, $nav) { - $newPage['id'] = util::id(); - $newPage['url'] = $newPage['home'] ? - 'index.html' : pages::page_url_slug($newPage['url']); - $newPage['path'] = pages::rpath2path(pages::url2rpath($newPage['url'])); - $newPage['doc'] = phpQuery::newDocument(preg_replace( - '/scpageid[\s\n]*=[\s\n]*["\'][^"\']+["\']/', 'scpageid="' . - $newPage['id'] . '"', $page['html'])); - phpQuery::pq('ul.sc-nav', $newPage['doc'])->html($nav); - phpQuery::pq('title', $newPage['doc'])->html($newPage['title']); - phpQuery::pq('meta[name="navtitle"]', $newPage['doc'])->remove(); - if ($newPage['idx'] == -1) { - phpQuery::pq('title', $newPage['doc'])->after( - ''); - } - phpQuery::pq('meta[name="description"]', $newPage['doc'])->remove(); - if ($newPage['desc']) { - phpQuery::pq('title', $newPage['doc'])-> - after(''); - } - phpQuery::pq('meta[name="keywords"]', $newPage['doc'])->remove(); - if ($newPage['keywords']) { - phpQuery::pq('title', $newPage['doc'])-> - after(''); - } - $newPage['html'] = (string)($newPage['doc']); - } - - static function reduce_pages($pages) { - return array_map(function($page) { - unset($page['html']); - unset($page['doc']); - unset($page['path']); - return $page; - }, $pages); - } - - /** - * Returns a list of page urls present in the navigation menu. - * - * @param phpQueryObject $doc a page document - * @return array of page urls - */ - static function nav_urls($doc) { - $pages = array(); - foreach (phpQuery::pq('ul.sc-nav:first li a', $doc) as $node) { - $pages[$node->getAttribute('href')] = $node->textContent; - } - return $pages; - } - - static function nav_pages($pages) { - $navItems = array_filter($pages, function($page) { - return ($page['idx'] >= 0); - }); - usort($navItems, function($a, $b) { - return ($a['idx'] - $b['idx']); - }); - return $navItems; - } - - static function gen_nav($pages, $url) { - $html = ''; - foreach ($pages as $page) { - $html .= '' : '>') . - '' . $page['navtitle'] . - ''; - } - return $html; - } - - /** - * Returns the page ID. - * - * @param string $html the page html - * @return string the page ID or FALSE if not found - */ - static function page_id($html) { - return (preg_match('/\s+scpageid[\s\n]*=[\s\n]*["\']([^"]+)["\']/s', - $html, $matches)) ? $matches[1] : FALSE; - } - - static function page_url_slug($url) { - return util::slug(substr_replace($url, '', -strlen('.html'))).'.html'; - } - - static function url2navtitle($url) { - $nt = preg_replace('/-/', '', - substr_replace($url, '', -strlen('.html'))); - $nt[0] = strtoupper($nt[0]); - return $nt; - } -} \ No newline at end of file diff --git a/sitecake/2.2.9/server/Sitecake/Services/Pages/PagesService.php b/sitecake/2.2.9/server/Sitecake/Services/Pages/PagesService.php deleted file mode 100644 index d8416d3..0000000 --- a/sitecake/2.2.9/server/Sitecake/Services/Pages/PagesService.php +++ /dev/null @@ -1,28 +0,0 @@ -ctx = $ctx; - //$this->pages = new Pages($ctx['site'], $ctx); - } - - public function pages($req) { - return $this->json($req, array('status' => 0, 'pages' => []), 200); - } - -} \ No newline at end of file diff --git a/sitecake/2.2.9/server/Sitecake/Services/Service.php b/sitecake/2.2.9/server/Sitecake/Services/Service.php deleted file mode 100644 index 3cc77b8..0000000 --- a/sitecake/2.2.9/server/Sitecake/Services/Service.php +++ /dev/null @@ -1,28 +0,0 @@ -query->has('callback')) { - $resp->setCallback($req->query->get('callback')); - } - - return $resp; - } -} \ No newline at end of file diff --git a/sitecake/2.2.9/server/Sitecake/Services/Session/SessionService.php b/sitecake/2.2.9/server/Sitecake/Services/Session/SessionService.php deleted file mode 100644 index f7f04f9..0000000 --- a/sitecake/2.2.9/server/Sitecake/Services/Session/SessionService.php +++ /dev/null @@ -1,58 +0,0 @@ -ctx = $ctx; - } - - public function isAuthRequired($action) { - return !($action === 'login' || $action === 'change'); - } - - public function login($request) { - $credentials = $request->query->get('credentials'); - $status = $this->ctx['sm']->login($credentials); - return $this->json($request, array('status' => $status), 200); - } - - public function change($request) { - $credentials = $request->query->get('credentials'); - $newCredentials = $request->query->get('newCredentials'); - - if (is_null($credentials) || is_null($newCredentials)) { - return new Response(null, 400); - } - - if ($this->ctx['auth']->authenticate($credentials)) { - $this->ctx['auth']->setCredentials($newCredentials); - $status = 0; - } else { - $status = 1; - } - return $this->json($request, array('status' => $status), 200); - } - - public function logout($request) { - $this->ctx['sm']->logout(); - return $this->json($request, array('status' => 0), 200); - } - - public function alive($request) { - $this->ctx['sm']->alive(); - return $this->json($request, array('status' => 0), 200); - } -} \ No newline at end of file diff --git a/sitecake/2.2.9/server/Sitecake/Services/Upload/UploadService.php b/sitecake/2.2.9/server/Sitecake/Services/Upload/UploadService.php deleted file mode 100644 index 1dd2068..0000000 --- a/sitecake/2.2.9/server/Sitecake/Services/Upload/UploadService.php +++ /dev/null @@ -1,53 +0,0 @@ -fs = $ctx['fs']; - $this->draftPath = $ctx['site']->draftPath(); - } - - public function upload($request) { - if (!$request->headers->has('x-filename')) { - return new Response('Filename is missing (header X-FILENAME)', 400); - } - $filename = $request->headers->get('x-filename'); - $pathinfo = pathinfo($filename); - $dpath = Utils::resurl($this->draftPath.'/files', - $pathinfo['filename'], null, null, $pathinfo['extension']); - - if (!$this->isSafeExtension($pathinfo['extension'])) { - return $this->json($request, array('status' => 1, - 'errMessage' => 'Forbidden file extension '.$pathinfo['extension']), 200); - } - - $res = $this->fs->writeStream($dpath, fopen("php://input", 'r')); - - if ($res === false) { - return $this->json($request, array('status' => 1, - 'errMessage' => 'Unable to upload file '.$pathinfo['filename'].'.'.$pathinfo['extension']), 200); - } else { - return $this->json($request, array('status' => 0, 'url' => $res), 200); - } - } - - protected function isSafeExtension($ext) { - return !in_array(strtolower($ext), self::$forbidden); - } -} \ No newline at end of file diff --git a/sitecake/2.2.9/server/Sitecake/SessionManager.php b/sitecake/2.2.9/server/Sitecake/SessionManager.php deleted file mode 100644 index 7cdd4bb..0000000 --- a/sitecake/2.2.9/server/Sitecake/SessionManager.php +++ /dev/null @@ -1,65 +0,0 @@ -session = $session; - $this->fileLock = $fileLock; - $this->auth = $auth; - $this->site = $site; - } - - /** - * Checks if the current user is logged in. - * - * @return boolean returns true if user is logged in. - */ - public function isLoggedIn() { - return $this->session->has('loggedin'); - } - - public function login($credentials) { - if ($this->isLoggedIn()) { - return 0; - } - - if ($this->auth->authenticate($credentials)) { - if ($this->fileLock->exists('login')) { - return 2; - } else { - $this->session->set('loggedin', true); - $this->fileLock->set('login', self::SESSION_TIMEOUT); - $this->site->editSessionStart(); - return 0; - } - } else { - return 1; - } - } - - public function logout() { - $this->session->invalidate(0); - $this->fileLock->remove('login'); - } - - public function alive() { - if ($this->isLoggedIn()) { - $this->fileLock->set('login', self::SESSION_TIMEOUT); - } - } - -} \ No newline at end of file diff --git a/sitecake/2.2.9/server/Sitecake/SessionManagerInterface.php b/sitecake/2.2.9/server/Sitecake/SessionManagerInterface.php deleted file mode 100644 index dadc473..0000000 --- a/sitecake/2.2.9/server/Sitecake/SessionManagerInterface.php +++ /dev/null @@ -1,19 +0,0 @@ -ctx = $ctx; - $this->fs = $fs; - - $this->ensureDirs(); - - $this->ignores = array(); - $this->loadIgnorePatterns(); - } - - private function ensureDirs() { - // check/create directory images - try { - if (!$this->fs->ensureDir('images')) { - throw new LogicException('Could not ensure that the directory /images is present and writtable.'); - } - } catch (RuntimeException $e) { - throw new LogicException('Could not ensure that the directory /images is present and writtable.'); - } - // check/create files - try { - if (!$this->fs->ensureDir('files')) { - throw new LogicException('Could not ensure that the directory /files is present and writtable.'); - } - } catch (RuntimeException $e) { - throw new LogicException('Could not ensure that the directory /files is present and writtable.'); - } - // check/create sitecake-content - try { - if (!$this->fs->ensureDir('sitecake-temp')) { - throw new LogicException('Could not ensure that the directory /sitecake-temp is present and writtable.'); - } - } catch (RuntimeException $e) { - throw new LogicException('Could not ensure that the directory /sitecake-temp is present and writtable.'); - } - // check/create sitecake-temp/ - try { - $work = $this->fs->randomDir('sitecake-temp'); - if ($work === false) { - throw new LogicException('Could not ensure that the work directory in /sitecake-temp is present and writtable.'); - } - } catch (RuntimeException $e) { - throw new LogicException('Could not ensure that the work directory in /sitecake-temp is present and writtable.'); - } - // check/create sitecake-temp//tmp - try { - $this->tmp = $this->fs->ensureDir($work . '/tmp'); - if ($this->tmp === false) { - throw new LogicException('Could not ensure that the directory ' . $work . '/tmp is present and writtable.'); - } - } catch (RuntimeException $e) { - throw new LogicException('Could not ensure that the directory ' . $work . '/tmp is present and writtable.'); - } - // check/create sitecake-temp//draft - try { - $this->draft = $this->fs->ensureDir($work . '/draft'); - if ($this->draft === false) { - throw new LogicException('Could not ensure that the directory ' . $work . '/draft is present and writtable.'); - } - } catch (RuntimeException $e) { - throw new LogicException('Could not ensure that the directory ' . $work . '/draft is present and writtable.'); - } - - // check/create sitecake-backup - try { - if (!$this->fs->ensureDir('sitecake-backup')) { - throw new LogicException('Could not ensure that the directory /sitecake-backup is present and writtable.'); - } - } catch (RuntimeException $e) { - throw new LogicException('Could not ensure that the directory /sitecake-backup is present and writtable.'); - } - // check/create sitecake-backup/ - try { - $this->backup = $this->fs->randomDir('sitecake-backup'); - if ($work === false) { - throw new LogicException('Could not ensure that the work directory in /sitecake-backup is present and writtable.'); - } - } catch (RuntimeException $e) { - throw new LogicException('Could not ensure that the work directory in /sitecake-backup is present and writtable.'); - } - } - - private function loadIgnorePatterns() { - $ignores = array(); - if ($this->fs->has('.scignore')) { - $this->ignores = preg_split('/\R/', $this->fs->read('.scignore')); - } - $ignores = array_merge($this->ignores, array( - 'sitecake/', - 'sitecake-temp/', - 'sitecake-backup/' - )); - } - - /** - * Returns the path of the temporary directory. - * @return string the tmp dir path - */ - public function tmpPath() { - return $this->tmp; - } - - /** - * Returns the path of the draft directory. - * @return string the draft dir path - */ - public function draftPath() { - return $this->draft; - } - - /** - * Returns the path of the backup directory. - * @return string the backup dir path - */ - public function backupPath() { - return $this->backup; - } - - /** - * Returns a list of paths of CMS related files from the given - * directory. It looks for HTML files, images and uploaded files. - * It ignores entries from .scignore filter the output list. - * - * @param string $directory the root directory to start search into - * @param boolean pagesOnly wether only pages should be returned - * @return array the output paths list - */ - public function listScPaths($directory = '', $pagesOnly = false) { - $ignores = $this->ignores; - return array_filter(array_merge( - $this->fs->listPatternPaths($directory, '/^.*\.html?$/'), - ($pagesOnly ? [] : $this->fs->listPatternPaths($directory . '/images', '/^.*\-sc[0-9a-f]{13}[^\.]*\..+$/')), - ($pagesOnly ? [] : $this->fs->listPatternPaths($directory . '/files', '/^.*\-sc[0-9a-f]{13}[^\.]*\..+$/'))), - function($path) use ($ignores) { - foreach ($ignores as $ignore) { - if ($ignore !== '' && strpos($path, $ignore) === 0) { - return false; - } - } - return true; - }); - } - - /** - * Returns a list of CMS related page file paths from the - * given directory. - * - * @param string $directory a directory to read from - * @return array a list of page file paths - */ - public function listScPagesPaths($directory = '') { - return $this->listScPaths($directory, true); - } - - /** - * Returns a list of draft page file paths. - * - * @return array a list of draft page file paths - */ - public function listDraftPagePaths() { - return $this->listScPaths($this->draftPath(), true); - } - - /** - * Starts the site draft out of the public content. - * It copies public pages and resources into the draft folder. - */ - public function startEdit() { - if (!$this->draftExists()) { - $this->startDraft(); - } else { - $this->cleanupDraft(); - } - } - - public function restore($version = 0) { - - } - - public function getDefaultPage($directory = '') { - $paths = $this->listScPagesPaths($directory); - if (in_array('index.html', $paths)) { - return new Page($this->fs->read('index.html')); - } else if (count($paths) > 0) { - return new Page($this->fs->read($paths[0])); - } else { - throw new FileNotFoundException('No HTML page found'); - } - } - - public function getDefaultPublicPage() { - return $this->getDefaultPage(); - } - - public function getDefaultDraftPage() { - return $this->getDefaultPage($this->draftPath()); - } - - public function getPage($uri) { - $draftPagePaths = $this->listDraftPagePaths(); - $pagePath = $this->draftPath() . '/' . $uri; - if (in_array($pagePath, $draftPagePaths)) { - return new Page($this->fs->read($pagePath)); - } else { - throw new FileNotFoundException($pagePath); - } - } - - public function getAllPages() { - $pages = array(); - $draftPagePaths = $this->listDraftPagePaths(); - foreach ($draftPagePaths as $pagePath) { - array_push($pages, array('path' => $pagePath, 'page' => new Page($this->fs->read($pagePath)))); - } - return $pages; - } - - public function savePage($path, $page) { - $this->markDraftDirty(); - $this->fs->update($path, (string)$page); - } - - public function publishDraft() { - if ($this->draftExists()) { - $this->backup(); - - $draftResources = $this->draftResources(); - $publicResources = $this->listScPaths(); - - $forDeletion = array(); - foreach ($publicResources as $publicResource) { - if (!in_array($this->draftPath().'/'.$publicResource, $draftResources)) { - array_push($forDeletion, $publicResource); - } - } - $this->fs->deletePaths($publicResources); - $this->fs->copyPaths($draftResources, $this->draftPath(), '/'); - $this->cleanupPublic(); - $this->markDraftClean(); - } - } - - public function isDraftClean() { - return !$this->fs->has($this->draftDirtyMarkerPath()); - } - - public function markDraftDirty() { - if (!$this->fs->has($this->draftDirtyMarkerPath())) { - $this->fs->write($this->draftDirtyMarkerPath(), ''); - } - } - - public function markDraftClean() { - $this->fs->delete($this->draftDirtyMarkerPath()); - } - - protected function draftDirtyMarkerPath() { - return $this->draftPath().'/draft.drt'; - } - - protected function draftMarkerPath() { - return $this->draftPath().'/draft.mkr'; - } - - protected function draftExists() { - return $this->fs->has($this->draftMarkerPath()); - } - - protected function startDraft() { - $this->fs->copyPaths($this->listScPaths(), '', $this->draftPath()); - $this->fs->write($this->draftMarkerPath(), ''); - $this->decorateDraft(); - } - - protected function removeDraft() { - $this->fs->deletePaths($this->listScPaths($this->draftPath())); - $this->fs->delete($this->draftMarkerPath()); - } - - protected function newBackupContainerPath() { - $path = $this->backupPath() . '/' . date('Y-m-d-H.i.s') . '-' . substr(uniqid(), -2); - return $path; - } - - /** - * Remove all backups except for the last recent five. - */ - protected function cleanupBackup() { - $backups = $this->fs->listContents($this->backupPath()); - usort($backups, function($a, $b) { - if ($a['timestamp'] < $b['timestamp']) { - return -1; - } else if ($a['timestamp'] == $b['timestamp']) { - return 0; - } else { - return 1; - } - }); - $backups = array_reverse($backups); - foreach ($backups as $idx => $backup) { - if ($idx >= $this->ctx['site.number_of_backups']) { - $this->fs->deleteDir($backup['path']); - } - } - } - - public function backup() { - $backupPath = $this->newBackupContainerPath(); - $this->fs->createDir($backupPath); - $this->fs->createDir($backupPath.'/images'); - $this->fs->createDir($backupPath.'/files'); - $this->fs->copyPaths($this->listScPaths(), '', $backupPath); - $this->cleanupBackup(); - } - - public function editSessionStart() { - - } - - protected function draftBaseUrl() { - return $this->draftPath() . '/'; - } - - protected function decorateDraft() { - $draftPagePaths = $this->listDraftPagePaths(); - foreach ($draftPagePaths as $pagePath) { - $page = new Page($this->fs->read($pagePath)); - $page->ensurePageId(); - $page->normalizeContainerNames(); - $page->prefixResourceUrls($this->draftBaseUrl()); - $this->fs->update($pagePath, (string)$page); - } - } - - protected function cleanupPublic() { - $pagePaths = $this->listScPagesPaths(); - foreach ($pagePaths as $pagePath) { - $page = new Page($this->fs->read($pagePath)); - $page->removePageId(); - $page->cleanupContainerNames(); - $page->removeMetadata(); - $page->unprefixResourceUrls($this->draftBaseUrl()); - $this->fs->update($pagePath, (string)$page); - } - } - - protected function cleanupDraft() { - $draftResources = $this->draftResources(); - $allResources = $this->listScPaths($this->draftPath()); - foreach ($allResources as $resource) { - if (!in_array($resource, $draftResources)) { - $this->fs->delete($resource); - } - } - } - - protected function draftResources() { - $draftPagePaths = $this->listDraftPagePaths(); - $resources = array_merge(array(), $draftPagePaths); - foreach ($draftPagePaths as $pagePath) { - $page = new Page($this->fs->read($pagePath)); - $resources = array_merge($resources, $page->listResourceUrls()); - } - return array_unique($resources); - } -} diff --git a/sitecake/2.2.9/server/Sitecake/Utils.php b/sitecake/2.2.9/server/Sitecake/Utils.php deleted file mode 100644 index c693611..0000000 --- a/sitecake/2.2.9/server/Sitecake/Utils.php +++ /dev/null @@ -1,286 +0,0 @@ - strlen($haystack)) ? false : - (substr($haystack, -$len) === $needle); - } - - public static function isURL($uri) { - return (preg_match('/^https?:\/\/.*$/', $uri) === 1); - } - - public static function nameFromURL($url) { - $path = parse_url($url, PHP_URL_PATH); - $dot = strrpos($path, '.'); - if ($dot !== false) { - $path = substr($path, 0, $dot); - } - if (strpos($path, '/') === 0) { - $path = substr($path, 1); - } - return preg_replace('/[^0-9a-zA-Z\.\-_]+/', '-', $path); - } - - /** - * Create a web friendly URL slug from a string. - * - * Although supported, transliteration is discouraged because - * 1) most web browsers support UTF-8 characters in URLs - * 2) transliteration causes a loss of information - * - * @author Sean Murphy - * @copyright Copyright 2012 Sean Murphy. All rights reserved. - * @license http://creativecommons.org/publicdomain/zero/1.0/ - * - * @param string $str - * @param array $options - * @return string - */ - static function slug($str, $options = array()) { - // Make sure string is in UTF-8 and strip invalid UTF-8 characters - $str = mb_convert_encoding((string)$str, 'UTF-8', mb_list_encodings()); - - $defaults = array( - 'delimiter' => '-', - 'limit' => null, - 'lowercase' => true, - 'replacements' => array(), - 'transliterate' => false, - ); - - // Merge options - $options = array_merge($defaults, $options); - - $char_map = array( - // Latin - 'À' => 'A', 'Á' => 'A', 'Â' => 'A', 'Ã' => 'A', 'Ä' => 'A', 'Å' => 'A', 'Æ' => 'AE', 'Ç' => 'C', - 'È' => 'E', 'É' => 'E', 'Ê' => 'E', 'Ë' => 'E', 'Ì' => 'I', 'Í' => 'I', 'Î' => 'I', 'Ï' => 'I', - 'Ð' => 'D', 'Ñ' => 'N', 'Ò' => 'O', 'Ó' => 'O', 'Ô' => 'O', 'Õ' => 'O', 'Ö' => 'O', 'Ő' => 'O', - 'Ø' => 'O', 'Ù' => 'U', 'Ú' => 'U', 'Û' => 'U', 'Ü' => 'U', 'Ű' => 'U', 'Ý' => 'Y', 'Þ' => 'TH', - 'ß' => 'ss', - 'à' => 'a', 'á' => 'a', 'â' => 'a', 'ã' => 'a', 'ä' => 'a', 'å' => 'a', 'æ' => 'ae', 'ç' => 'c', - 'è' => 'e', 'é' => 'e', 'ê' => 'e', 'ë' => 'e', 'ì' => 'i', 'í' => 'i', 'î' => 'i', 'ï' => 'i', - 'ð' => 'd', 'ñ' => 'n', 'ò' => 'o', 'ó' => 'o', 'ô' => 'o', 'õ' => 'o', 'ö' => 'o', 'ő' => 'o', - 'ø' => 'o', 'ù' => 'u', 'ú' => 'u', 'û' => 'u', 'ü' => 'u', 'ű' => 'u', 'ý' => 'y', 'þ' => 'th', - 'ÿ' => 'y', - - // Latin symbols - '©' => '(c)', - - // Greek - 'Α' => 'A', 'Β' => 'B', 'Γ' => 'G', 'Δ' => 'D', 'Ε' => 'E', 'Ζ' => 'Z', 'Η' => 'H', 'Θ' => '8', - 'Ι' => 'I', 'Κ' => 'K', 'Λ' => 'L', 'Μ' => 'M', 'Ν' => 'N', 'Ξ' => '3', 'Ο' => 'O', 'Π' => 'P', - 'Ρ' => 'R', 'Σ' => 'S', 'Τ' => 'T', 'Υ' => 'Y', 'Φ' => 'F', 'Χ' => 'X', 'Ψ' => 'PS', 'Ω' => 'W', - 'Ά' => 'A', 'Έ' => 'E', 'Ί' => 'I', 'Ό' => 'O', 'Ύ' => 'Y', 'Ή' => 'H', 'Ώ' => 'W', 'Ϊ' => 'I', - 'Ϋ' => 'Y', - 'α' => 'a', 'β' => 'b', 'γ' => 'g', 'δ' => 'd', 'ε' => 'e', 'ζ' => 'z', 'η' => 'h', 'θ' => '8', - 'ι' => 'i', 'κ' => 'k', 'λ' => 'l', 'μ' => 'm', 'ν' => 'n', 'ξ' => '3', 'ο' => 'o', 'π' => 'p', - 'ρ' => 'r', 'σ' => 's', 'τ' => 't', 'υ' => 'y', 'φ' => 'f', 'χ' => 'x', 'ψ' => 'ps', 'ω' => 'w', - 'ά' => 'a', 'έ' => 'e', 'ί' => 'i', 'ό' => 'o', 'ύ' => 'y', 'ή' => 'h', 'ώ' => 'w', 'ς' => 's', - 'ϊ' => 'i', 'ΰ' => 'y', 'ϋ' => 'y', 'ΐ' => 'i', - - // Turkish - 'Ş' => 'S', 'İ' => 'I', 'Ç' => 'C', 'Ü' => 'U', 'Ö' => 'O', 'Ğ' => 'G', - 'ş' => 's', 'ı' => 'i', 'ç' => 'c', 'ü' => 'u', 'ö' => 'o', 'ğ' => 'g', - - // Russian - 'А' => 'A', 'Б' => 'B', 'В' => 'V', 'Г' => 'G', 'Д' => 'D', 'Е' => 'E', 'Ё' => 'Yo', 'Ж' => 'Zh', - 'З' => 'Z', 'И' => 'I', 'Й' => 'J', 'К' => 'K', 'Л' => 'L', 'М' => 'M', 'Н' => 'N', 'О' => 'O', - 'П' => 'P', 'Р' => 'R', 'С' => 'S', 'Т' => 'T', 'У' => 'U', 'Ф' => 'F', 'Х' => 'H', 'Ц' => 'C', - 'Ч' => 'Ch', 'Ш' => 'Sh', 'Щ' => 'Sh', 'Ъ' => '', 'Ы' => 'Y', 'Ь' => '', 'Э' => 'E', 'Ю' => 'Yu', - 'Я' => 'Ya', - 'а' => 'a', 'б' => 'b', 'в' => 'v', 'г' => 'g', 'д' => 'd', 'е' => 'e', 'ё' => 'yo', 'ж' => 'zh', - 'з' => 'z', 'и' => 'i', 'й' => 'j', 'к' => 'k', 'л' => 'l', 'м' => 'm', 'н' => 'n', 'о' => 'o', - 'п' => 'p', 'р' => 'r', 'с' => 's', 'т' => 't', 'у' => 'u', 'ф' => 'f', 'х' => 'h', 'ц' => 'c', - 'ч' => 'ch', 'ш' => 'sh', 'щ' => 'sh', 'ъ' => '', 'ы' => 'y', 'ь' => '', 'э' => 'e', 'ю' => 'yu', - 'я' => 'ya', - - // Ukrainian - 'Є' => 'Ye', 'І' => 'I', 'Ї' => 'Yi', 'Ґ' => 'G', - 'є' => 'ye', 'і' => 'i', 'ї' => 'yi', 'ґ' => 'g', - - // Czech - 'Č' => 'C', 'Ď' => 'D', 'Ě' => 'E', 'Ň' => 'N', 'Ř' => 'R', 'Š' => 'S', 'Ť' => 'T', 'Ů' => 'U', - 'Ž' => 'Z', - 'č' => 'c', 'ď' => 'd', 'ě' => 'e', 'ň' => 'n', 'ř' => 'r', 'š' => 's', 'ť' => 't', 'ů' => 'u', - 'ž' => 'z', - - // Polish - 'Ą' => 'A', 'Ć' => 'C', 'Ę' => 'e', 'Ł' => 'L', 'Ń' => 'N', 'Ó' => 'o', 'Ś' => 'S', 'Ź' => 'Z', - 'Ż' => 'Z', - 'ą' => 'a', 'ć' => 'c', 'ę' => 'e', 'ł' => 'l', 'ń' => 'n', 'ó' => 'o', 'ś' => 's', 'ź' => 'z', - 'ż' => 'z', - - // Latvian - 'Ā' => 'A', 'Č' => 'C', 'Ē' => 'E', 'Ģ' => 'G', 'Ī' => 'i', 'Ķ' => 'k', 'Ļ' => 'L', 'Ņ' => 'N', - 'Š' => 'S', 'Ū' => 'u', 'Ž' => 'Z', - 'ā' => 'a', 'č' => 'c', 'ē' => 'e', 'ģ' => 'g', 'ī' => 'i', 'ķ' => 'k', 'ļ' => 'l', 'ņ' => 'n', - 'š' => 's', 'ū' => 'u', 'ž' => 'z' - ); - - // Make custom replacements - $str = preg_replace(array_keys($options['replacements']), $options['replacements'], $str); - - // Transliterate characters to ASCII - if ($options['transliterate']) { - $str = str_replace(array_keys($char_map), $char_map, $str); - } - - // Replace non-alphanumeric characters with our delimiter - $str = preg_replace('/[^\p{L}\p{Nd}]+/u', $options['delimiter'], $str); - - // Remove duplicate delimiters - $str = preg_replace('/(' . preg_quote($options['delimiter'], '/') . '){2,}/', '$1', $str); - - // Truncate slug to max. characters - $str = mb_substr($str, 0, ($options['limit'] ? $options['limit'] : mb_strlen($str, 'UTF-8')), 'UTF-8'); - - // Remove delimiter from ends - $str = trim($str, $options['delimiter']); - - return $options['lowercase'] ? mb_strtolower($str, 'UTF-8') : $str; - } - - /** - * Creates a resource URL out of the given components. - * - * @param string $path resource path prefix (directory) or full resource path (dir, name, ext) - * @param string $name resource name - * @param string $id 13-digit resource ID (uniqid) - * @param string $subid resource additional id (classifier, subid) - * @param string $ext extension - * @return string calculated resource path - */ - public static function resurl($path, $name = null, $id = null, $subid = null, $ext = null) { - $id = ($id == null) ? uniqid() : $id; - $subid = ($subid == null) ? '' : $subid; - if ($name == null || $ext == null) { - $pathinfo = pathinfo($path); - $name = ($name == null) ? $pathinfo['filename'] : $name; - $ext = ($ext == null) ? $pathinfo['extension'] : $ext; - $path = ($pathinfo['dirname'] === '.') ? '' : $pathinfo['dirname']; - } - $path = $path . (($path === '' || substr($path, -1) === '/') ? '' : '/'); - $name = str_replace(' ', '_', $name); - $ext = strtolower($ext); - return $path.$name.'-sc'.$id.$subid.'.'.$ext; - } - - /** - * Checks if the given URL is a Sitecake resource URL. - * - * @param string $url a URL to be tested - * @return boolean true if the URL is a Sitecake resource URL - */ - public static function isResourceUrl($url) { - $re = '/^.*(files|images)\/.*\-sc[0-9a-f]{13}[^\.]*\..+$/'; - - return HtmlUtils::isRelativeURL($url) && - preg_match($re, $url) && - (strpos($url, 'javascript:') !== 0) && - (strpos($url, '#') !== 0); - } - - private static function _resurlinfo($url) { - preg_match('/((.*)\/)?([^\/]+)-sc([0-9a-fA-F]{13})([^\.]*)\.([^\.]+)$/', $url, $match); - return array( - 'path' => $match[2], - 'name' => $match[3], - 'id' => $match[4], - 'subid' => $match[5], - 'ext' => $match[6] - ); - } - - /** - * Extracts information from a resource URL. - * It returns path, name, id, subid and extension. - * - * @param string|array $url a URL to be deconstructed or a list of URLs - * @return array URL components (path, name, id, subid, ext) or a list of URL components - */ - public static function resurlinfo($urls) { - if (is_array($urls)) { - $res = array(); - foreach ($urls as $url) { - array_push($res, self::_resurlinfo($url)); - } - return $res; - } else { - return self::_resurlinfo($urls); - } - } - - /** - * Checks if the given URL is a URL to a resource that is not a local HTML page. - * - * @param string $url URL to be checked - * @return boolean true if the link is a URL to a resource that is not a local HTML page - */ - public static function isExternalNavLink($url) { - return (strpos($url, '/') !== false) || (strpos($url, 'http://') === 0) || - (substr($url, -5) !== '.html'); - } - -} \ No newline at end of file diff --git a/sitecake/2.2.9/server/Sitecake/upgrade.php b/sitecake/2.2.9/server/Sitecake/upgrade.php deleted file mode 100644 index ead71ec..0000000 --- a/sitecake/2.2.9/server/Sitecake/upgrade.php +++ /dev/null @@ -1,106 +0,0 @@ - $current) ? - upgrade::upgrade_to(upgrade::to_version($latest)) : - array('status' => 0, 'upgrade' => 0); - } - - static function latest_remote() { - $resp = client::get('http://sitecake.com/dl/upgrade/latest.txt'); - if ($resp->isSuccess()) { - return upgrade::version($resp->getBody()); - } else { - return -1; - } - } - - static function latest_local() { - $versions = io::glob(SC_ROOT . '/' . 'sitecake' . '/' . - '*.*.*', GLOB_ONLYDIR); - return array_reduce($versions, function($latest, $item) { - $curr = upgrade::version($item); - return ($curr > $latest) ? $curr : $latest; - }, -1); - } - - static function upgrade_to($ver) { - $file = upgrade::download($ver); - if (is_array($file)) { - $res = $file; - } else { - $res = upgrade::extract($ver, $file); - io::unlink($file); - } - if ($res['status'] == 0) { - upgrade::switch_to($ver); - } - return $res; - } - - static function download($ver) { - $url = 'http://sitecake.com/dl/upgrade/sitecake-' . - $ver . '-upgrade.zip'; - $resp = client::get($url); - if ($resp->isSuccess()) { - $file = TEMP_DIR . '/' . 'sitecake-' . $ver . '-upgrade.zip'; - io::file_put_contents($file, $resp->getBody()); - return $file; - } else { - return array('status' => -1, - 'errorMessage' => 'Unable to download upgrade from ' . $url); - } - } - - static function extract($ver, $file) { - $dir = SC_ROOT . '/' . 'sitecake'; - if (class_exists('ZipArchive')) { - $res = upgrade::extract_ziparchive($file, $dir); - } else { - $res = pclzip::extract($file, $dir); - } - return $res ? - array('status' => 0, 'upgrade' => 1, 'latest' => $ver) : - array('status' => -1, - 'errorMessage' => 'Unable to extract the upgrade archive'); - } - - static function switch_to($ver) { - io::file_put_contents( - SC_ROOT . '/' . 'sitecake.php', - "open($zipfile) === true) { - return $z->extractTo($dest); - } else { - return false; - } - } - - static function version($str) { - if (preg_match('/([0-9]+)\.([0-9]+)\.([0-9]+)/', trim($str), $matches) > - 0) { - return $matches[1]*1000000 + $matches[2]*1000 + $matches[3]; - } else { - return -1; - } - } - - static function to_version($num) { - $major = floor($num/1000000); - $minor = floor(($num - $major*1000000)/1000); - $rev = $num - $major*1000000 - $minor*1000; - return "$major.$minor.$rev"; - } -} \ No newline at end of file diff --git a/sitecake/2.2.9/server/admin-full.php b/sitecake/2.2.9/server/admin-full.php deleted file mode 100644 index 0b06a2d..0000000 --- a/sitecake/2.2.9/server/admin-full.php +++ /dev/null @@ -1,118 +0,0 @@ -error(function (\LogicException $e, $code) { - return new Response("Exception: " . $e->getMessage() . "\n\r" . $e->getTraceAsString(), 500); -}); - -// configure the abstract file system -if ($app['filesystem.adapter'] == 'local') { - $app['fs'] = $app->share(function($app) { - return new Filesystem(new AdapterLocal($app['BASE_DIR'])); - }); -} else if ($app['filesystem.adapter'] == 'ftp') { - $app['fs'] = $app->share(function($app) { - return new Filesystem(new AdapterFtp($app['filesystem.adapter.config'])); - }); -} else { - dia('Unsupported filesystem.adapter ' + $app['filesystem.adapter'] + '. Supported types are local and ftp. Please check the configuration.'); -} - -// add application specific filesystem plugins -$app['fs']->addPlugin(new Sitecake\Filesystem\EnsureDirectory); -$app['fs']->addPlugin(new Sitecake\Filesystem\ListPatternPaths); -$app['fs']->addPlugin(new Sitecake\Filesystem\RandomDirectory); -$app['fs']->addPlugin(new Sitecake\Filesystem\CopyPaths); -$app['fs']->addPlugin(new Sitecake\Filesystem\DeletePaths); - -$app->register(new Silex\Provider\SessionServiceProvider()); - -$app->register(new Silex\Provider\TranslationServiceProvider(), array( - 'locale_fallbacks' => array('en'), -)); - -$app['translator'] = $app->share($app->extend('translator', function($translator, $app) { - $translator->addLoader('yaml', new Symfony\Component\Translation\Loader\YamlFileLoader()); - $translator->addResource('yaml', __DIR__.'/locales/en.yml', 'en'); - return $translator; -})); - -$app['auth'] = $app->share(function($app) { - return new Sitecake\Auth($app['fs'], '/sitecake/credentials.php'); -}); - -$app['site'] = $app->share(function($app) { - return new Sitecake\Site($app['fs'], $app); -}); - -$app['flock'] = $app->share(function($app) { - return new Sitecake\FileLock($app['fs'], $app['site']->tmpPath()); -}); - -$app['sm'] = $app->share(function($app) { - return new Sitecake\SessionManager($app['session'], $app['flock'], $app['auth'], $app['site']); -}); - -$app['renderer'] = $app->share(function($app) { - return new Sitecake\Renderer($app['site'], $app); -}); - -$app['services'] = $app->share(function($app) { - return new Sitecake\Services($app); -}); - -$app['router'] = $app->share(function($app) { - return new Sitecake\Router($app['sm'], $app); -}); - -$hndlr = function(Application $app, Request $request) { - // check if GD is present - if (!extension_loaded('gd')) { - throw new \Exception("GD lib (PHP extension) is required, but it's not loaded."); - } - - $app['services']->load(); - return $app['router']->route($request); -}; - -$app->match('/', $hndlr)->method("GET"); -$app->match('/', $hndlr)->method("POST"); - -$app->register(new CorsServiceProvider(), array()); -$app->after($app["cors"]); - -$app->run(); diff --git a/sitecake/2.2.9/server/admin.php b/sitecake/2.2.9/server/admin.php deleted file mode 100644 index aa576a4..0000000 --- a/sitecake/2.2.9/server/admin.php +++ /dev/null @@ -1,35 +0,0 @@ - 21, - //'root' => '/path/to/root', - //'passive' => true, - //'ssl' => true, - //'timeout' => 30, - - 'host' => 'ftp.example.com', - 'username' => 'username', - 'password' => 'password', - 'port' => 21 -); -*/ - -// the number of the recent site versions to be kept -$app['site.number_of_backups'] = 2; - -// a list of image widths in pixels that would be used for generating -// images for srcset -$app['image.srcset_widths'] = array(1280, 960, 640, 320); -// a max relative diff (in percents) between two image widths in pixels -// so they could be considered similar -$app['image.srcset_width_maxdiff'] = 20; - -// CSS selector for an element that contains site top nav menu. -// If it selects more than one element, all menue elements will have the same content -$app['pages.nav.container_selector'] = 'nav.sc-nav'; -// The top nav item CSS selector -$app['pages.nav.item_selector'] = 'nav.sc-nav:first a'; -// The top nav item template -$app['pages.nav.item'] = '${title}'; - -// An alternative nav configuration example, using
    tag as the container and
  • tags -// for menu items -//$app['pages.nav.container_selector'] = 'ul.sc-nav'; -//$app['pages.nav.item_template'] = '
  • ${title}
  • '; \ No newline at end of file diff --git a/sitecake/2.2.9/server/vendor/autoload.php b/sitecake/2.2.9/server/vendor/autoload.php deleted file mode 100644 index 5027c68..0000000 --- a/sitecake/2.2.9/server/vendor/autoload.php +++ /dev/null @@ -1,7 +0,0 @@ - - * Jordi Boggiano - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Composer\Autoload; - -/** - * ClassLoader implements a PSR-0 class loader - * - * See https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md - * - * $loader = new \Composer\Autoload\ClassLoader(); - * - * // register classes with namespaces - * $loader->add('Symfony\Component', __DIR__.'/component'); - * $loader->add('Symfony', __DIR__.'/framework'); - * - * // activate the autoloader - * $loader->register(); - * - * // to enable searching the include path (eg. for PEAR packages) - * $loader->setUseIncludePath(true); - * - * In this example, if you try to use a class in the Symfony\Component - * namespace or one of its children (Symfony\Component\Console for instance), - * the autoloader will first look for the class under the component/ - * directory, and it will then fallback to the framework/ directory if not - * found before giving up. - * - * This class is loosely based on the Symfony UniversalClassLoader. - * - * @author Fabien Potencier - * @author Jordi Boggiano - */ -class ClassLoader -{ - // PSR-4 - private $prefixLengthsPsr4 = array(); - private $prefixDirsPsr4 = array(); - private $fallbackDirsPsr4 = array(); - - // PSR-0 - private $prefixesPsr0 = array(); - private $fallbackDirsPsr0 = array(); - - private $useIncludePath = false; - private $classMap = array(); - - private $classMapAuthoritative = false; - - public function getPrefixes() - { - if (!empty($this->prefixesPsr0)) { - return call_user_func_array('array_merge', $this->prefixesPsr0); - } - - return array(); - } - - public function getPrefixesPsr4() - { - return $this->prefixDirsPsr4; - } - - public function getFallbackDirs() - { - return $this->fallbackDirsPsr0; - } - - public function getFallbackDirsPsr4() - { - return $this->fallbackDirsPsr4; - } - - public function getClassMap() - { - return $this->classMap; - } - - /** - * @param array $classMap Class to filename map - */ - public function addClassMap(array $classMap) - { - if ($this->classMap) { - $this->classMap = array_merge($this->classMap, $classMap); - } else { - $this->classMap = $classMap; - } - } - - /** - * Registers a set of PSR-0 directories for a given prefix, either - * appending or prepending to the ones previously set for this prefix. - * - * @param string $prefix The prefix - * @param array|string $paths The PSR-0 root directories - * @param bool $prepend Whether to prepend the directories - */ - public function add($prefix, $paths, $prepend = false) - { - if (!$prefix) { - if ($prepend) { - $this->fallbackDirsPsr0 = array_merge( - (array) $paths, - $this->fallbackDirsPsr0 - ); - } else { - $this->fallbackDirsPsr0 = array_merge( - $this->fallbackDirsPsr0, - (array) $paths - ); - } - - return; - } - - $first = $prefix[0]; - if (!isset($this->prefixesPsr0[$first][$prefix])) { - $this->prefixesPsr0[$first][$prefix] = (array) $paths; - - return; - } - if ($prepend) { - $this->prefixesPsr0[$first][$prefix] = array_merge( - (array) $paths, - $this->prefixesPsr0[$first][$prefix] - ); - } else { - $this->prefixesPsr0[$first][$prefix] = array_merge( - $this->prefixesPsr0[$first][$prefix], - (array) $paths - ); - } - } - - /** - * Registers a set of PSR-4 directories for a given namespace, either - * appending or prepending to the ones previously set for this namespace. - * - * @param string $prefix The prefix/namespace, with trailing '\\' - * @param array|string $paths The PSR-0 base directories - * @param bool $prepend Whether to prepend the directories - * - * @throws \InvalidArgumentException - */ - public function addPsr4($prefix, $paths, $prepend = false) - { - if (!$prefix) { - // Register directories for the root namespace. - if ($prepend) { - $this->fallbackDirsPsr4 = array_merge( - (array) $paths, - $this->fallbackDirsPsr4 - ); - } else { - $this->fallbackDirsPsr4 = array_merge( - $this->fallbackDirsPsr4, - (array) $paths - ); - } - } elseif (!isset($this->prefixDirsPsr4[$prefix])) { - // Register directories for a new namespace. - $length = strlen($prefix); - if ('\\' !== $prefix[$length - 1]) { - throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); - } - $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; - $this->prefixDirsPsr4[$prefix] = (array) $paths; - } elseif ($prepend) { - // Prepend directories for an already registered namespace. - $this->prefixDirsPsr4[$prefix] = array_merge( - (array) $paths, - $this->prefixDirsPsr4[$prefix] - ); - } else { - // Append directories for an already registered namespace. - $this->prefixDirsPsr4[$prefix] = array_merge( - $this->prefixDirsPsr4[$prefix], - (array) $paths - ); - } - } - - /** - * Registers a set of PSR-0 directories for a given prefix, - * replacing any others previously set for this prefix. - * - * @param string $prefix The prefix - * @param array|string $paths The PSR-0 base directories - */ - public function set($prefix, $paths) - { - if (!$prefix) { - $this->fallbackDirsPsr0 = (array) $paths; - } else { - $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths; - } - } - - /** - * Registers a set of PSR-4 directories for a given namespace, - * replacing any others previously set for this namespace. - * - * @param string $prefix The prefix/namespace, with trailing '\\' - * @param array|string $paths The PSR-4 base directories - * - * @throws \InvalidArgumentException - */ - public function setPsr4($prefix, $paths) - { - if (!$prefix) { - $this->fallbackDirsPsr4 = (array) $paths; - } else { - $length = strlen($prefix); - if ('\\' !== $prefix[$length - 1]) { - throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); - } - $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; - $this->prefixDirsPsr4[$prefix] = (array) $paths; - } - } - - /** - * Turns on searching the include path for class files. - * - * @param bool $useIncludePath - */ - public function setUseIncludePath($useIncludePath) - { - $this->useIncludePath = $useIncludePath; - } - - /** - * Can be used to check if the autoloader uses the include path to check - * for classes. - * - * @return bool - */ - public function getUseIncludePath() - { - return $this->useIncludePath; - } - - /** - * Turns off searching the prefix and fallback directories for classes - * that have not been registered with the class map. - * - * @param bool $classMapAuthoritative - */ - public function setClassMapAuthoritative($classMapAuthoritative) - { - $this->classMapAuthoritative = $classMapAuthoritative; - } - - /** - * Should class lookup fail if not found in the current class map? - * - * @return bool - */ - public function isClassMapAuthoritative() - { - return $this->classMapAuthoritative; - } - - /** - * Registers this instance as an autoloader. - * - * @param bool $prepend Whether to prepend the autoloader or not - */ - public function register($prepend = false) - { - spl_autoload_register(array($this, 'loadClass'), true, $prepend); - } - - /** - * Unregisters this instance as an autoloader. - */ - public function unregister() - { - spl_autoload_unregister(array($this, 'loadClass')); - } - - /** - * Loads the given class or interface. - * - * @param string $class The name of the class - * @return bool|null True if loaded, null otherwise - */ - public function loadClass($class) - { - if ($file = $this->findFile($class)) { - includeFile($file); - - return true; - } - } - - /** - * Finds the path to the file where the class is defined. - * - * @param string $class The name of the class - * - * @return string|false The path if found, false otherwise - */ - public function findFile($class) - { - // work around for PHP 5.3.0 - 5.3.2 https://bugs.php.net/50731 - if ('\\' == $class[0]) { - $class = substr($class, 1); - } - - // class map lookup - if (isset($this->classMap[$class])) { - return $this->classMap[$class]; - } - if ($this->classMapAuthoritative) { - return false; - } - - $file = $this->findFileWithExtension($class, '.php'); - - // Search for Hack files if we are running on HHVM - if ($file === null && defined('HHVM_VERSION')) { - $file = $this->findFileWithExtension($class, '.hh'); - } - - if ($file === null) { - // Remember that this class does not exist. - return $this->classMap[$class] = false; - } - - return $file; - } - - private function findFileWithExtension($class, $ext) - { - // PSR-4 lookup - $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; - - $first = $class[0]; - if (isset($this->prefixLengthsPsr4[$first])) { - foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) { - if (0 === strpos($class, $prefix)) { - foreach ($this->prefixDirsPsr4[$prefix] as $dir) { - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) { - return $file; - } - } - } - } - } - - // PSR-4 fallback dirs - foreach ($this->fallbackDirsPsr4 as $dir) { - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { - return $file; - } - } - - // PSR-0 lookup - if (false !== $pos = strrpos($class, '\\')) { - // namespaced class name - $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1) - . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); - } else { - // PEAR-like class name - $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; - } - - if (isset($this->prefixesPsr0[$first])) { - foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { - if (0 === strpos($class, $prefix)) { - foreach ($dirs as $dir) { - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { - return $file; - } - } - } - } - } - - // PSR-0 fallback dirs - foreach ($this->fallbackDirsPsr0 as $dir) { - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { - return $file; - } - } - - // PSR-0 include paths. - if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) { - return $file; - } - } -} - -/** - * Scope isolated include. - * - * Prevents access to $this/self from included files. - */ -function includeFile($file) -{ - include $file; -} diff --git a/sitecake/2.2.9/server/vendor/composer/autoload_classmap.php b/sitecake/2.2.9/server/vendor/composer/autoload_classmap.php deleted file mode 100644 index c6ebaab..0000000 --- a/sitecake/2.2.9/server/vendor/composer/autoload_classmap.php +++ /dev/null @@ -1,30 +0,0 @@ - $vendorDir . '/electrolinux/phpquery/phpQuery/phpQuery/Callback.php', - 'CallbackBody' => $vendorDir . '/electrolinux/phpquery/phpQuery/phpQuery/Callback.php', - 'CallbackParam' => $vendorDir . '/electrolinux/phpquery/phpQuery/phpQuery/Callback.php', - 'CallbackParameterToReference' => $vendorDir . '/electrolinux/phpquery/phpQuery/phpQuery/Callback.php', - 'CallbackReturnReference' => $vendorDir . '/electrolinux/phpquery/phpQuery/phpQuery/Callback.php', - 'CallbackReturnValue' => $vendorDir . '/electrolinux/phpquery/phpQuery/phpQuery/Callback.php', - 'DOMDocumentWrapper' => $vendorDir . '/electrolinux/phpquery/phpQuery/phpQuery/DOMDocumentWrapper.php', - 'DOMEvent' => $vendorDir . '/electrolinux/phpquery/phpQuery/phpQuery/DOMEvent.php', - 'ICallbackNamed' => $vendorDir . '/electrolinux/phpquery/phpQuery/phpQuery/Callback.php', - 'PclZip' => $vendorDir . '/pclzip/pclzip/pclzip.lib.php', - 'SessionHandlerInterface' => $vendorDir . '/symfony/http-foundation/Resources/stubs/SessionHandlerInterface.php', - 'phpQuery' => $vendorDir . '/electrolinux/phpquery/phpQuery/phpQuery.php', - 'phpQueryEvents' => $vendorDir . '/electrolinux/phpquery/phpQuery/phpQuery/phpQueryEvents.php', - 'phpQueryObject' => $vendorDir . '/electrolinux/phpquery/phpQuery/phpQuery/phpQueryObject.php', - 'phpQueryObjectPlugin_Scripts' => $vendorDir . '/electrolinux/phpquery/phpQuery/phpQuery/plugins/Scripts.php', - 'phpQueryObjectPlugin_WebBrowser' => $vendorDir . '/electrolinux/phpquery/phpQuery/phpQuery/plugins/WebBrowser.php', - 'phpQueryObjectPlugin_example' => $vendorDir . '/electrolinux/phpquery/phpQuery/phpQuery/plugins/example.php', - 'phpQueryPlugin_Scripts' => $vendorDir . '/electrolinux/phpquery/phpQuery/phpQuery/plugins/Scripts.php', - 'phpQueryPlugin_WebBrowser' => $vendorDir . '/electrolinux/phpquery/phpQuery/phpQuery/plugins/WebBrowser.php', - 'phpQueryPlugin_example' => $vendorDir . '/electrolinux/phpquery/phpQuery/phpQuery/plugins/example.php', - 'phpQueryPlugins' => $vendorDir . '/electrolinux/phpquery/phpQuery/phpQuery.php', -); diff --git a/sitecake/2.2.9/server/vendor/composer/autoload_namespaces.php b/sitecake/2.2.9/server/vendor/composer/autoload_namespaces.php deleted file mode 100644 index b0b4371..0000000 --- a/sitecake/2.2.9/server/vendor/composer/autoload_namespaces.php +++ /dev/null @@ -1,12 +0,0 @@ - array($vendorDir . '/smottt/wideimage/lib'), - 'Psr\\Log\\' => array($vendorDir . '/psr/log'), - 'Pimple' => array($vendorDir . '/pimple/pimple/lib'), -); diff --git a/sitecake/2.2.9/server/vendor/composer/autoload_psr4.php b/sitecake/2.2.9/server/vendor/composer/autoload_psr4.php deleted file mode 100644 index 27a2047..0000000 --- a/sitecake/2.2.9/server/vendor/composer/autoload_psr4.php +++ /dev/null @@ -1,22 +0,0 @@ - array($vendorDir . '/symfony/yaml'), - 'Symfony\\Component\\Translation\\' => array($vendorDir . '/symfony/translation'), - 'Symfony\\Component\\Routing\\' => array($vendorDir . '/symfony/routing'), - 'Symfony\\Component\\HttpKernel\\' => array($vendorDir . '/symfony/http-kernel'), - 'Symfony\\Component\\HttpFoundation\\' => array($vendorDir . '/symfony/http-foundation'), - 'Symfony\\Component\\Filesystem\\' => array($vendorDir . '/symfony/filesystem'), - 'Symfony\\Component\\EventDispatcher\\' => array($vendorDir . '/symfony/event-dispatcher'), - 'Symfony\\Component\\Debug\\' => array($vendorDir . '/symfony/debug'), - 'Symfony\\Component\\Config\\' => array($vendorDir . '/symfony/config'), - 'Sitecake\\' => array($baseDir . '/Sitecake'), - 'Silex\\' => array($vendorDir . '/silex/silex/src/Silex'), - 'League\\Flysystem\\' => array($vendorDir . '/league/flysystem/src'), - 'JDesrosiers\\Silex\\Provider\\' => array($vendorDir . '/jdesrosiers/silex-cors-provider/src'), -); diff --git a/sitecake/2.2.9/server/vendor/composer/autoload_real.php b/sitecake/2.2.9/server/vendor/composer/autoload_real.php deleted file mode 100644 index 46b2dc7..0000000 --- a/sitecake/2.2.9/server/vendor/composer/autoload_real.php +++ /dev/null @@ -1,50 +0,0 @@ - $path) { - $loader->set($namespace, $path); - } - - $map = require __DIR__ . '/autoload_psr4.php'; - foreach ($map as $namespace => $path) { - $loader->setPsr4($namespace, $path); - } - - $classMap = require __DIR__ . '/autoload_classmap.php'; - if ($classMap) { - $loader->addClassMap($classMap); - } - - $loader->register(true); - - return $loader; - } -} - -function composerRequiree617f73dc75afd56126c1f15172ab00a($file) -{ - require $file; -} diff --git a/sitecake/2.2.9/server/vendor/composer/installed.json b/sitecake/2.2.9/server/vendor/composer/installed.json deleted file mode 100644 index fa3540f..0000000 --- a/sitecake/2.2.9/server/vendor/composer/installed.json +++ /dev/null @@ -1,973 +0,0 @@ -[ - { - "name": "pclzip/pclzip", - "version": "dev-master", - "version_normalized": "9999999-dev", - "source": { - "type": "git", - "url": "https://github.com/ivanlanin/pclzip.git", - "reference": "19dd1de9d3f5fc4d7d70175b4c344dee329f45fd" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/ivanlanin/pclzip/zipball/19dd1de9d3f5fc4d7d70175b4c344dee329f45fd", - "reference": "19dd1de9d3f5fc4d7d70175b4c344dee329f45fd", - "shasum": "" - }, - "time": "2014-06-05 11:42:24", - "type": "library", - "installation-source": "dist", - "autoload": { - "classmap": [ - "pclzip.lib.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "LGPL-2.1" - ], - "authors": [ - { - "name": "Vincent Blavet" - } - ], - "description": "A PHP library that offers compression and extraction functions for Zip formatted archives", - "homepage": "http://www.phpconcept.net/pclzip", - "keywords": [ - "php", - "zip" - ] - }, - { - "name": "electrolinux/phpquery", - "version": "dev-master", - "version_normalized": "9999999-dev", - "source": { - "type": "git", - "url": "https://github.com/electrolinux/phpquery.git", - "reference": "aa09e7af2e8d9a965102cf50d9b657aca96fd013" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/electrolinux/phpquery/zipball/aa09e7af2e8d9a965102cf50d9b657aca96fd013", - "reference": "aa09e7af2e8d9a965102cf50d9b657aca96fd013", - "shasum": "" - }, - "time": "2014-08-08 09:03:54", - "type": "library", - "installation-source": "dist", - "autoload": { - "classmap": [ - "phpQuery/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Tobiasz Cudnik", - "email": "tobiasz.cudnik@gmail.com", - "homepage": "https://github.com/TobiaszCudnik", - "role": "Developer" - }, - { - "name": "didier Belot", - "role": "Packager" - } - ], - "description": "phpQuery is a server-side, chainable, CSS3 selector driven Document Object Model (DOM) API based on jQuery JavaScript Library", - "homepage": "http://code.google.com/p/phpquery/" - }, - { - "name": "smottt/wideimage", - "version": "dev-master", - "version_normalized": "9999999-dev", - "source": { - "type": "git", - "url": "https://github.com/smottt/WideImage.git", - "reference": "669f63f1452c7fc70120fff4bc457727714a0834" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/smottt/WideImage/zipball/669f63f1452c7fc70120fff4bc457727714a0834", - "reference": "669f63f1452c7fc70120fff4bc457727714a0834", - "shasum": "" - }, - "time": "2015-05-27 09:42:22", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-0": { - "WideImage": "lib/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "GPL-2.0", - "LGPL-2.1" - ], - "description": "An open-source PHP library for image manipulation. (With namespaces, PHP 5.3+)", - "homepage": "http://wideimage.sourceforge.net" - }, - { - "name": "symfony/routing", - "version": "v2.7.1", - "version_normalized": "2.7.1.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/Routing.git", - "reference": "5581be29185b8fb802398904555f70da62f6d50d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/Routing/zipball/5581be29185b8fb802398904555f70da62f6d50d", - "reference": "5581be29185b8fb802398904555f70da62f6d50d", - "shasum": "" - }, - "require": { - "php": ">=5.3.9" - }, - "conflict": { - "symfony/config": "<2.7" - }, - "require-dev": { - "doctrine/annotations": "~1.0", - "doctrine/common": "~2.2", - "psr/log": "~1.0", - "symfony/config": "~2.7", - "symfony/expression-language": "~2.4", - "symfony/http-foundation": "~2.3", - "symfony/phpunit-bridge": "~2.7", - "symfony/yaml": "~2.0,>=2.0.5" - }, - "suggest": { - "doctrine/annotations": "For using the annotation loader", - "symfony/config": "For using the all-in-one router or any loader", - "symfony/expression-language": "For using expression matching", - "symfony/yaml": "For using the YAML loader" - }, - "time": "2015-06-11 17:20:40", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.7-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Symfony\\Component\\Routing\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Routing Component", - "homepage": "https://symfony.com", - "keywords": [ - "router", - "routing", - "uri", - "url" - ] - }, - { - "name": "psr/log", - "version": "1.0.0", - "version_normalized": "1.0.0.0", - "source": { - "type": "git", - "url": "https://github.com/php-fig/log.git", - "reference": "fe0936ee26643249e916849d48e3a51d5f5e278b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/fe0936ee26643249e916849d48e3a51d5f5e278b", - "reference": "fe0936ee26643249e916849d48e3a51d5f5e278b", - "shasum": "" - }, - "time": "2012-12-21 11:40:51", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-0": { - "Psr\\Log\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interface for logging libraries", - "keywords": [ - "log", - "psr", - "psr-3" - ] - }, - { - "name": "symfony/debug", - "version": "v2.7.1", - "version_normalized": "2.7.1.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/Debug.git", - "reference": "075070230c5bbc65abde8241191655bbce0716e2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/Debug/zipball/075070230c5bbc65abde8241191655bbce0716e2", - "reference": "075070230c5bbc65abde8241191655bbce0716e2", - "shasum": "" - }, - "require": { - "php": ">=5.3.9", - "psr/log": "~1.0" - }, - "conflict": { - "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" - }, - "require-dev": { - "symfony/class-loader": "~2.2", - "symfony/http-foundation": "~2.1", - "symfony/http-kernel": "~2.3.24|~2.5.9|~2.6,>=2.6.2", - "symfony/phpunit-bridge": "~2.7" - }, - "suggest": { - "symfony/http-foundation": "", - "symfony/http-kernel": "" - }, - "time": "2015-06-08 09:37:21", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.7-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Symfony\\Component\\Debug\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Debug Component", - "homepage": "https://symfony.com" - }, - { - "name": "symfony/http-foundation", - "version": "v2.7.1", - "version_normalized": "2.7.1.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/HttpFoundation.git", - "reference": "4f363c426b0ced57e3d14460022feb63937980ff" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/HttpFoundation/zipball/4f363c426b0ced57e3d14460022feb63937980ff", - "reference": "4f363c426b0ced57e3d14460022feb63937980ff", - "shasum": "" - }, - "require": { - "php": ">=5.3.9" - }, - "require-dev": { - "symfony/expression-language": "~2.4", - "symfony/phpunit-bridge": "~2.7" - }, - "time": "2015-06-10 15:30:22", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.7-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Symfony\\Component\\HttpFoundation\\": "" - }, - "classmap": [ - "Resources/stubs" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony HttpFoundation Component", - "homepage": "https://symfony.com" - }, - { - "name": "symfony/event-dispatcher", - "version": "v2.7.1", - "version_normalized": "2.7.1.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/EventDispatcher.git", - "reference": "be3c5ff8d503c46768aeb78ce6333051aa6f26d9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/be3c5ff8d503c46768aeb78ce6333051aa6f26d9", - "reference": "be3c5ff8d503c46768aeb78ce6333051aa6f26d9", - "shasum": "" - }, - "require": { - "php": ">=5.3.9" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/config": "~2.0,>=2.0.5", - "symfony/dependency-injection": "~2.6", - "symfony/expression-language": "~2.6", - "symfony/phpunit-bridge": "~2.7", - "symfony/stopwatch": "~2.3" - }, - "suggest": { - "symfony/dependency-injection": "", - "symfony/http-kernel": "" - }, - "time": "2015-06-08 09:37:21", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.7-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Symfony\\Component\\EventDispatcher\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony EventDispatcher Component", - "homepage": "https://symfony.com" - }, - { - "name": "symfony/http-kernel", - "version": "v2.7.1", - "version_normalized": "2.7.1.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/HttpKernel.git", - "reference": "208101c7a11e31933183bd2a380486e528c74302" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/HttpKernel/zipball/208101c7a11e31933183bd2a380486e528c74302", - "reference": "208101c7a11e31933183bd2a380486e528c74302", - "shasum": "" - }, - "require": { - "php": ">=5.3.9", - "psr/log": "~1.0", - "symfony/debug": "~2.6,>=2.6.2", - "symfony/event-dispatcher": "~2.5.9|~2.6,>=2.6.2", - "symfony/http-foundation": "~2.5,>=2.5.4" - }, - "conflict": { - "symfony/config": "<2.7" - }, - "require-dev": { - "symfony/browser-kit": "~2.3", - "symfony/class-loader": "~2.1", - "symfony/config": "~2.7", - "symfony/console": "~2.3", - "symfony/css-selector": "~2.0,>=2.0.5", - "symfony/dependency-injection": "~2.2", - "symfony/dom-crawler": "~2.0,>=2.0.5", - "symfony/expression-language": "~2.4", - "symfony/finder": "~2.0,>=2.0.5", - "symfony/phpunit-bridge": "~2.7", - "symfony/process": "~2.0,>=2.0.5", - "symfony/routing": "~2.2", - "symfony/stopwatch": "~2.3", - "symfony/templating": "~2.2", - "symfony/translation": "~2.0,>=2.0.5", - "symfony/var-dumper": "~2.6" - }, - "suggest": { - "symfony/browser-kit": "", - "symfony/class-loader": "", - "symfony/config": "", - "symfony/console": "", - "symfony/dependency-injection": "", - "symfony/finder": "", - "symfony/var-dumper": "" - }, - "time": "2015-06-11 21:15:28", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.7-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Symfony\\Component\\HttpKernel\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony HttpKernel Component", - "homepage": "https://symfony.com" - }, - { - "name": "pimple/pimple", - "version": "v1.1.1", - "version_normalized": "1.1.1.0", - "source": { - "type": "git", - "url": "https://github.com/silexphp/Pimple.git", - "reference": "2019c145fe393923f3441b23f29bbdfaa5c58c4d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/silexphp/Pimple/zipball/2019c145fe393923f3441b23f29bbdfaa5c58c4d", - "reference": "2019c145fe393923f3441b23f29bbdfaa5c58c4d", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "time": "2013-11-22 08:30:29", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-0": { - "Pimple": "lib/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - } - ], - "description": "Pimple is a simple Dependency Injection Container for PHP 5.3", - "homepage": "http://pimple.sensiolabs.org", - "keywords": [ - "container", - "dependency injection" - ] - }, - { - "name": "silex/silex", - "version": "v1.3.0", - "version_normalized": "1.3.0.0", - "source": { - "type": "git", - "url": "https://github.com/silexphp/Silex.git", - "reference": "2d623a4853c37005d3790e5e7897a2c30b492caf" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/silexphp/Silex/zipball/2d623a4853c37005d3790e5e7897a2c30b492caf", - "reference": "2d623a4853c37005d3790e5e7897a2c30b492caf", - "shasum": "" - }, - "require": { - "php": ">=5.3.9", - "pimple/pimple": "~1.0", - "symfony/event-dispatcher": "~2.3,<3.0", - "symfony/http-foundation": "~2.3,<3.0", - "symfony/http-kernel": "~2.3,<3.0", - "symfony/routing": "~2.3,<3.0" - }, - "require-dev": { - "doctrine/dbal": "~2.2", - "monolog/monolog": "~1.4,>=1.4.1", - "swiftmailer/swiftmailer": "5.*", - "symfony/browser-kit": "~2.3,<3.0", - "symfony/config": "~2.3,<3.0", - "symfony/css-selector": "~2.3,<3.0", - "symfony/debug": "~2.3,<3.0", - "symfony/dom-crawler": "~2.3,<3.0", - "symfony/finder": "~2.3,<3.0", - "symfony/form": "~2.3,<3.0", - "symfony/locale": "~2.3,<3.0", - "symfony/monolog-bridge": "~2.3,<3.0", - "symfony/options-resolver": "~2.3,<3.0", - "symfony/process": "~2.3,<3.0", - "symfony/security": "~2.3,<3.0", - "symfony/serializer": "~2.3,<3.0", - "symfony/translation": "~2.3,<3.0", - "symfony/twig-bridge": "~2.3,<3.0", - "symfony/validator": "~2.3,<3.0", - "twig/twig": ">=1.8.0,<2.0-dev" - }, - "suggest": { - "symfony/browser-kit": "~2.3", - "symfony/css-selector": "~2.3", - "symfony/dom-crawler": "~2.3", - "symfony/form": "~2.3" - }, - "time": "2015-06-04 21:27:48", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Silex\\": "src/Silex" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Igor Wiedler", - "email": "igor@wiedler.ch" - } - ], - "description": "The PHP micro-framework based on the Symfony2 Components", - "homepage": "http://silex.sensiolabs.org", - "keywords": [ - "microframework" - ] - }, - { - "name": "jdesrosiers/silex-cors-provider", - "version": "v0.1.4", - "version_normalized": "0.1.4.0", - "source": { - "type": "git", - "url": "https://github.com/jdesrosiers/silex-cors-provider.git", - "reference": "4a7a918f2cd4541fe56f407e271c4dd446688fa9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/jdesrosiers/silex-cors-provider/zipball/4a7a918f2cd4541fe56f407e271c4dd446688fa9", - "reference": "4a7a918f2cd4541fe56f407e271c4dd446688fa9", - "shasum": "" - }, - "require": { - "silex/silex": "~1.0" - }, - "require-dev": { - "phpunit/phpunit": "3.7.*", - "symfony/browser-kit": "2.3.*" - }, - "time": "2015-06-11 04:23:36", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "JDesrosiers\\Silex\\Provider\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jason Desrosiers", - "email": "jdesrosi@gmail.com" - } - ], - "description": "A silex service provider that adds CORS services to silex", - "keywords": [ - "cors", - "cross", - "origin", - "provider", - "resource", - "service", - "sharing", - "silex" - ] - }, - { - "name": "symfony/translation", - "version": "v2.7.1", - "version_normalized": "2.7.1.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/Translation.git", - "reference": "8349a2b0d11bd0311df9e8914408080912983a0b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/Translation/zipball/8349a2b0d11bd0311df9e8914408080912983a0b", - "reference": "8349a2b0d11bd0311df9e8914408080912983a0b", - "shasum": "" - }, - "require": { - "php": ">=5.3.9" - }, - "conflict": { - "symfony/config": "<2.7" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/config": "~2.7", - "symfony/intl": "~2.3", - "symfony/phpunit-bridge": "~2.7", - "symfony/yaml": "~2.2" - }, - "suggest": { - "psr/log": "To use logging capability in translator", - "symfony/config": "", - "symfony/yaml": "" - }, - "time": "2015-06-11 17:26:34", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.7-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Symfony\\Component\\Translation\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Translation Component", - "homepage": "https://symfony.com" - }, - { - "name": "symfony/filesystem", - "version": "v2.7.1", - "version_normalized": "2.7.1.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/Filesystem.git", - "reference": "a0d43eb3e17d4f4c6990289805a488a0482a07f3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/Filesystem/zipball/a0d43eb3e17d4f4c6990289805a488a0482a07f3", - "reference": "a0d43eb3e17d4f4c6990289805a488a0482a07f3", - "shasum": "" - }, - "require": { - "php": ">=5.3.9" - }, - "require-dev": { - "symfony/phpunit-bridge": "~2.7" - }, - "time": "2015-06-08 09:37:21", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.7-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Symfony\\Component\\Filesystem\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Filesystem Component", - "homepage": "https://symfony.com" - }, - { - "name": "symfony/config", - "version": "v2.7.1", - "version_normalized": "2.7.1.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/Config.git", - "reference": "58ded81f1f582a87c528ef3dae9a859f78b5f374" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/Config/zipball/58ded81f1f582a87c528ef3dae9a859f78b5f374", - "reference": "58ded81f1f582a87c528ef3dae9a859f78b5f374", - "shasum": "" - }, - "require": { - "php": ">=5.3.9", - "symfony/filesystem": "~2.3" - }, - "require-dev": { - "symfony/phpunit-bridge": "~2.7" - }, - "time": "2015-06-11 14:06:56", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.7-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Symfony\\Component\\Config\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Config Component", - "homepage": "https://symfony.com" - }, - { - "name": "symfony/yaml", - "version": "v2.7.1", - "version_normalized": "2.7.1.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/Yaml.git", - "reference": "9808e75c609a14f6db02f70fccf4ca4aab53c160" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/Yaml/zipball/9808e75c609a14f6db02f70fccf4ca4aab53c160", - "reference": "9808e75c609a14f6db02f70fccf4ca4aab53c160", - "shasum": "" - }, - "require": { - "php": ">=5.3.9" - }, - "require-dev": { - "symfony/phpunit-bridge": "~2.7" - }, - "time": "2015-06-10 15:30:22", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.7-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Symfony\\Component\\Yaml\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Yaml Component", - "homepage": "https://symfony.com" - }, - { - "name": "league/flysystem", - "version": "1.0.4", - "version_normalized": "1.0.4.0", - "source": { - "type": "git", - "url": "https://github.com/thephpleague/flysystem.git", - "reference": "56862959b45131ad33e5a7727a25db19f2cf090b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/56862959b45131ad33e5a7727a25db19f2cf090b", - "reference": "56862959b45131ad33e5a7727a25db19f2cf090b", - "shasum": "" - }, - "require": { - "ext-mbstring": "*", - "php": ">=5.4.0" - }, - "require-dev": { - "ext-fileinfo": "*", - "league/phpunit-coverage-listener": "~1.1", - "mockery/mockery": "~0.9", - "phpspec/phpspec": "~2.0", - "phpspec/prophecy-phpunit": "~1.0", - "phpunit/phpunit": "~4.1", - "predis/predis": "~1.0", - "tedivm/stash": "~0.12.0" - }, - "suggest": { - "ext-fileinfo": "Required for MimeType", - "league/flysystem-aws-s3-v2": "Allows you to use S3 storage with AWS SDK v2", - "league/flysystem-aws-s3-v3": "Allows you to use S3 storage with AWS SDK v3", - "league/flysystem-azure": "Allows you to use Windows Azure Blob storage", - "league/flysystem-cached-adapter": "Flysystem adapter decorator for metadata caching", - "league/flysystem-copy": "Allows you to use Copy.com storage", - "league/flysystem-dropbox": "Allows you to use Dropbox storage", - "league/flysystem-eventable-filesystem": "Allows you to use EventableFilesystem", - "league/flysystem-rackspace": "Allows you to use Rackspace Cloud Files", - "league/flysystem-sftp": "Allows you to use SFTP server storage via phpseclib", - "league/flysystem-webdav": "Allows you to use WebDAV storage", - "league/flysystem-ziparchive": "Allows you to use ZipArchive adapter", - "predis/predis": "Allows you to use Predis for caching" - }, - "time": "2015-06-07 21:27:37", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "League\\Flysystem\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Frank de Jonge", - "email": "info@frenky.net" - } - ], - "description": "Many filesystems, one API.", - "keywords": [ - "Cloud Files", - "WebDAV", - "aws", - "cloud", - "copy.com", - "dropbox", - "file systems", - "files", - "filesystem", - "ftp", - "rackspace", - "remote", - "s3", - "sftp", - "storage" - ] - } -] diff --git a/sitecake/2.2.9/server/vendor/electrolinux/phpquery/phpQuery/phpQuery.php b/sitecake/2.2.9/server/vendor/electrolinux/phpquery/phpQuery/phpQuery.php deleted file mode 100644 index 08f22fc..0000000 --- a/sitecake/2.2.9/server/vendor/electrolinux/phpquery/phpQuery/phpQuery.php +++ /dev/null @@ -1,1344 +0,0 @@ - - * @license http://www.opensource.org/licenses/mit-license.php MIT License - * @package phpQuery - */ - -// class names for instanceof -// TODO move them as class constants into phpQuery -define('DOMDOCUMENT', 'DOMDocument'); -define('DOMELEMENT', 'DOMElement'); -define('DOMNODELIST', 'DOMNodeList'); -define('DOMNODE', 'DOMNode'); -require_once(dirname(__FILE__).'/phpQuery/DOMEvent.php'); -require_once(dirname(__FILE__).'/phpQuery/DOMDocumentWrapper.php'); -require_once(dirname(__FILE__).'/phpQuery/phpQueryEvents.php'); -require_once(dirname(__FILE__).'/phpQuery/Callback.php'); -require_once(dirname(__FILE__).'/phpQuery/phpQueryObject.php'); -require_once(dirname(__FILE__).'/phpQuery/compat/mbstring.php'); -/** - * Static namespace for phpQuery functions. - * - * @author Tobiasz Cudnik - * @package phpQuery - */ -abstract class phpQuery { - /** - * XXX: Workaround for mbstring problems - * - * @var bool - */ - public static $mbstringSupport = true; - public static $debug = false; - public static $documents = array(); - public static $defaultDocumentID = null; -// public static $defaultDoctype = 'html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"'; - /** - * Applies only to HTML. - * - * @var unknown_type - */ - public static $defaultDoctype = ''; - public static $defaultCharset = 'UTF-8'; - /** - * Static namespace for plugins. - * - * @var object - */ - public static $plugins = array(); - /** - * List of loaded plugins. - * - * @var unknown_type - */ - public static $pluginsLoaded = array(); - public static $pluginsMethods = array(); - public static $pluginsStaticMethods = array(); - public static $extendMethods = array(); - /** - * @TODO implement - */ - public static $extendStaticMethods = array(); - /** - * Hosts allowed for AJAX connections. - * Dot '.' means $_SERVER['HTTP_HOST'] (if any). - * - * @var array - */ - public static $ajaxAllowedHosts = array( - '.' - ); - /** - * AJAX settings. - * - * @var array - * XXX should it be static or not ? - */ - public static $ajaxSettings = array( - 'url' => '',//TODO - 'global' => true, - 'type' => "GET", - 'timeout' => null, - 'contentType' => "application/x-www-form-urlencoded", - 'processData' => true, -// 'async' => true, - 'data' => null, - 'username' => null, - 'password' => null, - 'dataType' => null, - 'ifModified' => null, - 'accepts' => array( - 'xml' => "application/xml, text/xml", - 'html' => "text/html", - 'script' => "text/javascript, application/javascript", - 'json' => "application/json, text/javascript", - 'text' => "text/plain", - '_default' => "*/*" - ) - ); - public static $lastModified = null; - public static $active = 0; - public static $dumpCount = 0; - /** - * Multi-purpose function. - * Use pq() as shortcut. - * - * In below examples, $pq is any result of pq(); function. - * - * 1. Import markup into existing document (without any attaching): - * - Import into selected document: - * pq('
    ') // DOESNT accept text nodes at beginning of input string ! - * - Import into document with ID from $pq->getDocumentID(): - * pq('
    ', $pq->getDocumentID()) - * - Import into same document as DOMNode belongs to: - * pq('
    ', DOMNode) - * - Import into document from phpQuery object: - * pq('
    ', $pq) - * - * 2. Run query: - * - Run query on last selected document: - * pq('div.myClass') - * - Run query on document with ID from $pq->getDocumentID(): - * pq('div.myClass', $pq->getDocumentID()) - * - Run query on same document as DOMNode belongs to and use node(s)as root for query: - * pq('div.myClass', DOMNode) - * - Run query on document from phpQuery object - * and use object's stack as root node(s) for query: - * pq('div.myClass', $pq) - * - * @param string|DOMNode|DOMNodeList|array $arg1 HTML markup, CSS Selector, DOMNode or array of DOMNodes - * @param string|phpQueryObject|DOMNode $context DOM ID from $pq->getDocumentID(), phpQuery object (determines also query root) or DOMNode (determines also query root) - * - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery|QueryTemplatesPhpQuery|false - * phpQuery object or false in case of error. - */ - public static function pq($arg1, $context = null) { - if ($arg1 instanceof DOMNODE && ! isset($context)) { - foreach(phpQuery::$documents as $documentWrapper) { - $compare = $arg1 instanceof DOMDocument - ? $arg1 : $arg1->ownerDocument; - if ($documentWrapper->document->isSameNode($compare)) - $context = $documentWrapper->id; - } - } - if (! $context) { - $domId = self::$defaultDocumentID; - if (! $domId) - throw new Exception("Can't use last created DOM, because there isn't any. Use phpQuery::newDocument() first."); -// } else if (is_object($context) && ($context instanceof PHPQUERY || is_subclass_of($context, 'phpQueryObject'))) - } else if (is_object($context) && $context instanceof phpQueryObject) - $domId = $context->getDocumentID(); - else if ($context instanceof DOMDOCUMENT) { - $domId = self::getDocumentID($context); - if (! $domId) { - //throw new Exception('Orphaned DOMDocument'); - $domId = self::newDocument($context)->getDocumentID(); - } - } else if ($context instanceof DOMNODE) { - $domId = self::getDocumentID($context); - if (! $domId) { - throw new Exception('Orphaned DOMNode'); -// $domId = self::newDocument($context->ownerDocument); - } - } else - $domId = $context; - if ($arg1 instanceof phpQueryObject) { -// if (is_object($arg1) && (get_class($arg1) == 'phpQueryObject' || $arg1 instanceof PHPQUERY || is_subclass_of($arg1, 'phpQueryObject'))) { - /** - * Return $arg1 or import $arg1 stack if document differs: - * pq(pq('
    ')) - */ - if ($arg1->getDocumentID() == $domId) - return $arg1; - $class = get_class($arg1); - // support inheritance by passing old object to overloaded constructor - $phpQuery = $class != 'phpQuery' - ? new $class($arg1, $domId) - : new phpQueryObject($domId); - $phpQuery->elements = array(); - foreach($arg1->elements as $node) - $phpQuery->elements[] = $phpQuery->document->importNode($node, true); - return $phpQuery; - } else if ($arg1 instanceof DOMNODE || (is_array($arg1) && isset($arg1[0]) && $arg1[0] instanceof DOMNODE)) { - /* - * Wrap DOM nodes with phpQuery object, import into document when needed: - * pq(array($domNode1, $domNode2)) - */ - $phpQuery = new phpQueryObject($domId); - if (!($arg1 instanceof DOMNODELIST) && ! is_array($arg1)) - $arg1 = array($arg1); - $phpQuery->elements = array(); - foreach($arg1 as $node) { - $sameDocument = $node->ownerDocument instanceof DOMDOCUMENT - && ! $node->ownerDocument->isSameNode($phpQuery->document); - $phpQuery->elements[] = $sameDocument - ? $phpQuery->document->importNode($node, true) - : $node; - } - return $phpQuery; - } else if (self::isMarkup($arg1)) { - /** - * Import HTML: - * pq('
    ') - */ - $phpQuery = new phpQueryObject($domId); - return $phpQuery->newInstance( - $phpQuery->documentWrapper->import($arg1) - ); - } else { - /** - * Run CSS query: - * pq('div.myClass') - */ - $phpQuery = new phpQueryObject($domId); -// if ($context && ($context instanceof PHPQUERY || is_subclass_of($context, 'phpQueryObject'))) - if ($context && $context instanceof phpQueryObject) - $phpQuery->elements = $context->elements; - else if ($context && $context instanceof DOMNODELIST) { - $phpQuery->elements = array(); - foreach($context as $node) - $phpQuery->elements[] = $node; - } else if ($context && $context instanceof DOMNODE) - $phpQuery->elements = array($context); - return $phpQuery->find($arg1); - } - } - /** - * Sets default document to $id. Document has to be loaded prior - * to using this method. - * $id can be retrived via getDocumentID() or getDocumentIDRef(). - * - * @param unknown_type $id - */ - public static function selectDocument($id) { - $id = self::getDocumentID($id); - self::debug("Selecting document '$id' as default one"); - self::$defaultDocumentID = self::getDocumentID($id); - } - /** - * Returns document with id $id or last used as phpQueryObject. - * $id can be retrived via getDocumentID() or getDocumentIDRef(). - * Chainable. - * - * @see phpQuery::selectDocument() - * @param unknown_type $id - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - */ - public static function getDocument($id = null) { - if ($id) - phpQuery::selectDocument($id); - else - $id = phpQuery::$defaultDocumentID; - return new phpQueryObject($id); - } - /** - * Creates new document from markup. - * Chainable. - * - * @param unknown_type $markup - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - */ - public static function newDocument($markup = null, $contentType = null) { - if (! $markup) - $markup = ''; - $documentID = phpQuery::createDocumentWrapper($markup, $contentType); - return new phpQueryObject($documentID); - } - /** - * Creates new document from markup. - * Chainable. - * - * @param unknown_type $markup - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - */ - public static function newDocumentHTML($markup = null, $charset = null) { - $contentType = $charset - ? ";charset=$charset" - : ''; - return self::newDocument($markup, "text/html{$contentType}"); - } - /** - * Creates new document from markup. - * Chainable. - * - * @param unknown_type $markup - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - */ - public static function newDocumentXML($markup = null, $charset = null) { - $contentType = $charset - ? ";charset=$charset" - : ''; - return self::newDocument($markup, "text/xml{$contentType}"); - } - /** - * Creates new document from markup. - * Chainable. - * - * @param unknown_type $markup - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - */ - public static function newDocumentXHTML($markup = null, $charset = null) { - $contentType = $charset - ? ";charset=$charset" - : ''; - return self::newDocument($markup, "application/xhtml+xml{$contentType}"); - } - /** - * Creates new document from markup. - * Chainable. - * - * @param unknown_type $markup - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - */ - public static function newDocumentPHP($markup = null, $contentType = "text/html") { - // TODO pass charset to phpToMarkup if possible (use DOMDocumentWrapper function) - $markup = phpQuery::phpToMarkup($markup, self::$defaultCharset); - return self::newDocument($markup, $contentType); - } - public static function phpToMarkup($php, $charset = 'utf-8') { - $regexes = array( - '@(<(?!\\?)(?:[^>]|\\?>)+\\w+\\s*=\\s*)(\')([^\']*)<'.'?php?(.*?)(?:\\?>)([^\']*)\'@s', - '@(<(?!\\?)(?:[^>]|\\?>)+\\w+\\s*=\\s*)(")([^"]*)<'.'?php?(.*?)(?:\\?>)([^"]*)"@s', - ); - foreach($regexes as $regex) - while (preg_match($regex, $php, $matches)) { - $php = preg_replace_callback( - $regex, -// create_function('$m, $charset = "'.$charset.'"', -// 'return $m[1].$m[2] -// .htmlspecialchars("<"."?php".$m[4]."?".">", ENT_QUOTES|ENT_NOQUOTES, $charset) -// .$m[5].$m[2];' -// ), - array('phpQuery', '_phpToMarkupCallback'), - $php - ); - } - $regex = '@(^|>[^<]*)+?(<\?php(.*?)(\?>))@s'; -//preg_match_all($regex, $php, $matches); -//var_dump($matches); - $php = preg_replace($regex, '\\1', $php); - return $php; - } - public static function _phpToMarkupCallback($php, $charset = 'utf-8') { - return $m[1].$m[2] - .htmlspecialchars("<"."?php".$m[4]."?".">", ENT_QUOTES|ENT_NOQUOTES, $charset) - .$m[5].$m[2]; - } - public static function _markupToPHPCallback($m) { - return "<"."?php ".htmlspecialchars_decode($m[1])." ?".">"; - } - /** - * Converts document markup containing PHP code generated by phpQuery::php() - * into valid (executable) PHP code syntax. - * - * @param string|phpQueryObject $content - * @return string PHP code. - */ - public static function markupToPHP($content) { - if ($content instanceof phpQueryObject) - $content = $content->markupOuter(); - /* ... to */ - $content = preg_replace_callback( - '@\s*\s*@s', -// create_function('$m', -// 'return "<'.'?php ".htmlspecialchars_decode($m[1])." ?'.'>";' -// ), - array('phpQuery', '_markupToPHPCallback'), - $content - ); - /* extra space added to save highlighters */ - $regexes = array( - '@(<(?!\\?)(?:[^>]|\\?>)+\\w+\\s*=\\s*)(\')([^\']*)(?:<|%3C)\\?(?:php)?(.*?)(?:\\?(?:>|%3E))([^\']*)\'@s', - '@(<(?!\\?)(?:[^>]|\\?>)+\\w+\\s*=\\s*)(")([^"]*)(?:<|%3C)\\?(?:php)?(.*?)(?:\\?(?:>|%3E))([^"]*)"@s', - ); - foreach($regexes as $regex) - while (preg_match($regex, $content)) - $content = preg_replace_callback( - $regex, - create_function('$m', - 'return $m[1].$m[2].$m[3]."", " ", "\n", " ", "{", "$", "}", \'"\', "[", "]"), - htmlspecialchars_decode($m[4]) - ) - ." ?>".$m[5].$m[2];' - ), - $content - ); - return $content; - } - /** - * Creates new document from file $file. - * Chainable. - * - * @param string $file URLs allowed. See File wrapper page at php.net for more supported sources. - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - */ - public static function newDocumentFile($file, $contentType = null) { - $documentID = self::createDocumentWrapper( - file_get_contents($file), $contentType - ); - return new phpQueryObject($documentID); - } - /** - * Creates new document from markup. - * Chainable. - * - * @param unknown_type $markup - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - */ - public static function newDocumentFileHTML($file, $charset = null) { - $contentType = $charset - ? ";charset=$charset" - : ''; - return self::newDocumentFile($file, "text/html{$contentType}"); - } - /** - * Creates new document from markup. - * Chainable. - * - * @param unknown_type $markup - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - */ - public static function newDocumentFileXML($file, $charset = null) { - $contentType = $charset - ? ";charset=$charset" - : ''; - return self::newDocumentFile($file, "text/xml{$contentType}"); - } - /** - * Creates new document from markup. - * Chainable. - * - * @param unknown_type $markup - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - */ - public static function newDocumentFileXHTML($file, $charset = null) { - $contentType = $charset - ? ";charset=$charset" - : ''; - return self::newDocumentFile($file, "application/xhtml+xml{$contentType}"); - } - /** - * Creates new document from markup. - * Chainable. - * - * @param unknown_type $markup - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - */ - public static function newDocumentFilePHP($file, $contentType = null) { - return self::newDocumentPHP(file_get_contents($file), $contentType); - } - /** - * Reuses existing DOMDocument object. - * Chainable. - * - * @param $document DOMDocument - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - * @TODO support DOMDocument - */ - public static function loadDocument($document) { - // TODO - die('TODO loadDocument'); - } - /** - * Enter description here... - * - * @param unknown_type $html - * @param unknown_type $domId - * @return unknown New DOM ID - * @todo support PHP tags in input - * @todo support passing DOMDocument object from self::loadDocument - */ - protected static function createDocumentWrapper($html, $contentType = null, $documentID = null) { - if (function_exists('domxml_open_mem')) - throw new Exception("Old PHP4 DOM XML extension detected. phpQuery won't work until this extension is enabled."); -// $id = $documentID -// ? $documentID -// : md5(microtime()); - $document = null; - if ($html instanceof DOMDOCUMENT) { - if (self::getDocumentID($html)) { - // document already exists in phpQuery::$documents, make a copy - $document = clone $html; - } else { - // new document, add it to phpQuery::$documents - $wrapper = new DOMDocumentWrapper($html, $contentType, $documentID); - } - } else { - $wrapper = new DOMDocumentWrapper($html, $contentType, $documentID); - } -// $wrapper->id = $id; - // bind document - phpQuery::$documents[$wrapper->id] = $wrapper; - // remember last loaded document - phpQuery::selectDocument($wrapper->id); - return $wrapper->id; - } - /** - * Extend class namespace. - * - * @param string|array $target - * @param array $source - * @TODO support string $source - * @return unknown_type - */ - public static function extend($target, $source) { - switch($target) { - case 'phpQueryObject': - $targetRef = &self::$extendMethods; - $targetRef2 = &self::$pluginsMethods; - break; - case 'phpQuery': - $targetRef = &self::$extendStaticMethods; - $targetRef2 = &self::$pluginsStaticMethods; - break; - default: - throw new Exception("Unsupported \$target type"); - } - if (is_string($source)) - $source = array($source => $source); - foreach($source as $method => $callback) { - if (isset($targetRef[$method])) { -// throw new Exception - self::debug("Duplicate method '{$method}', can\'t extend '{$target}'"); - continue; - } - if (isset($targetRef2[$method])) { -// throw new Exception - self::debug("Duplicate method '{$method}' from plugin '{$targetRef2[$method]}'," - ." can\'t extend '{$target}'"); - continue; - } - $targetRef[$method] = $callback; - } - return true; - } - /** - * Extend phpQuery with $class from $file. - * - * @param string $class Extending class name. Real class name can be prepended phpQuery_. - * @param string $file Filename to include. Defaults to "{$class}.php". - */ - public static function plugin($class, $file = null) { - // TODO $class checked agains phpQuery_$class -// if (strpos($class, 'phpQuery') === 0) -// $class = substr($class, 8); - if (in_array($class, self::$pluginsLoaded)) - return true; - if (! $file) - $file = $class.'.php'; - $objectClassExists = class_exists('phpQueryObjectPlugin_'.$class); - $staticClassExists = class_exists('phpQueryPlugin_'.$class); - if (! $objectClassExists && ! $staticClassExists) - require_once($file); - self::$pluginsLoaded[] = $class; - // static methods - if (class_exists('phpQueryPlugin_'.$class)) { - $realClass = 'phpQueryPlugin_'.$class; - $vars = get_class_vars($realClass); - $loop = isset($vars['phpQueryMethods']) - && ! is_null($vars['phpQueryMethods']) - ? $vars['phpQueryMethods'] - : get_class_methods($realClass); - foreach($loop as $method) { - if ($method == '__initialize') - continue; - if (! is_callable(array($realClass, $method))) - continue; - if (isset(self::$pluginsStaticMethods[$method])) { - throw new Exception("Duplicate method '{$method}' from plugin '{$c}' conflicts with same method from plugin '".self::$pluginsStaticMethods[$method]."'"); - return; - } - self::$pluginsStaticMethods[$method] = $class; - } - if (method_exists($realClass, '__initialize')) - call_user_func_array(array($realClass, '__initialize'), array()); - } - // object methods - if (class_exists('phpQueryObjectPlugin_'.$class)) { - $realClass = 'phpQueryObjectPlugin_'.$class; - $vars = get_class_vars($realClass); - $loop = isset($vars['phpQueryMethods']) - && ! is_null($vars['phpQueryMethods']) - ? $vars['phpQueryMethods'] - : get_class_methods($realClass); - foreach($loop as $method) { - if (! is_callable(array($realClass, $method))) - continue; - if (isset(self::$pluginsMethods[$method])) { - throw new Exception("Duplicate method '{$method}' from plugin '{$c}' conflicts with same method from plugin '".self::$pluginsMethods[$method]."'"); - continue; - } - self::$pluginsMethods[$method] = $class; - } - } - return true; - } - /** - * Unloades all or specified document from memory. - * - * @param mixed $documentID @see phpQuery::getDocumentID() for supported types. - */ - public static function unloadDocuments($id = null) { - if (isset($id)) { - if ($id = self::getDocumentID($id)) - unset(phpQuery::$documents[$id]); - } else { - foreach(phpQuery::$documents as $k => $v) { - unset(phpQuery::$documents[$k]); - } - } - } - /** - * Parses phpQuery object or HTML result against PHP tags and makes them active. - * - * @param phpQuery|string $content - * @deprecated - * @return string - */ - public static function unsafePHPTags($content) { - return self::markupToPHP($content); - } - public static function DOMNodeListToArray($DOMNodeList) { - $array = array(); - if (! $DOMNodeList) - return $array; - foreach($DOMNodeList as $node) - $array[] = $node; - return $array; - } - /** - * Checks if $input is HTML string, which has to start with '<'. - * - * @deprecated - * @param String $input - * @return Bool - * @todo still used ? - */ - public static function isMarkup($input) { - return ! is_array($input) && substr(trim($input), 0, 1) == '<'; - } - public static function debug($text) { - if (self::$debug) - print var_dump($text); - } - /** - * Make an AJAX request. - * - * @param array See $options http://docs.jquery.com/Ajax/jQuery.ajax#toptions - * Additional options are: - * 'document' - document for global events, @see phpQuery::getDocumentID() - * 'referer' - implemented - * 'requested_with' - TODO; not implemented (X-Requested-With) - * @return Zend_Http_Client - * @link http://docs.jquery.com/Ajax/jQuery.ajax - * - * @TODO $options['cache'] - * @TODO $options['processData'] - * @TODO $options['xhr'] - * @TODO $options['data'] as string - * @TODO XHR interface - */ - public static function ajax($options = array(), $xhr = null) { - $options = array_merge( - self::$ajaxSettings, $options - ); - $documentID = isset($options['document']) - ? self::getDocumentID($options['document']) - : null; - if ($xhr) { - // reuse existing XHR object, but clean it up - $client = $xhr; -// $client->setParameterPost(null); -// $client->setParameterGet(null); - $client->setAuth(false); - $client->setHeaders("If-Modified-Since", null); - $client->setHeaders("Referer", null); - $client->resetParameters(); - } else { - // create new XHR object - require_once('Zend/Http/Client.php'); - $client = new Zend_Http_Client(); - $client->setCookieJar(); - } - if (isset($options['timeout'])) - $client->setConfig(array( - 'timeout' => $options['timeout'], - )); -// 'maxredirects' => 0, - foreach(self::$ajaxAllowedHosts as $k => $host) - if ($host == '.' && isset($_SERVER['HTTP_HOST'])) - self::$ajaxAllowedHosts[$k] = $_SERVER['HTTP_HOST']; - $host = parse_url($options['url'], PHP_URL_HOST); - if (! in_array($host, self::$ajaxAllowedHosts)) { - throw new Exception("Request not permitted, host '$host' not present in " - ."phpQuery::\$ajaxAllowedHosts"); - } - // JSONP - $jsre = "/=\\?(&|$)/"; - if (isset($options['dataType']) && $options['dataType'] == 'jsonp') { - $jsonpCallbackParam = $options['jsonp'] - ? $options['jsonp'] : 'callback'; - if (strtolower($options['type']) == 'get') { - if (! preg_match($jsre, $options['url'])) { - $sep = strpos($options['url'], '?') - ? '&' : '?'; - $options['url'] .= "$sep$jsonpCallbackParam=?"; - } - } else if ($options['data']) { - $jsonp = false; - foreach($options['data'] as $n => $v) { - if ($v == '?') - $jsonp = true; - } - if (! $jsonp) { - $options['data'][$jsonpCallbackParam] = '?'; - } - } - $options['dataType'] = 'json'; - } - if (isset($options['dataType']) && $options['dataType'] == 'json') { - $jsonpCallback = 'json_'.md5(microtime()); - $jsonpData = $jsonpUrl = false; - if ($options['data']) { - foreach($options['data'] as $n => $v) { - if ($v == '?') - $jsonpData = $n; - } - } - if (preg_match($jsre, $options['url'])) - $jsonpUrl = true; - if ($jsonpData !== false || $jsonpUrl) { - // remember callback name for httpData() - $options['_jsonp'] = $jsonpCallback; - if ($jsonpData !== false) - $options['data'][$jsonpData] = $jsonpCallback; - if ($jsonpUrl) - $options['url'] = preg_replace($jsre, "=$jsonpCallback\\1", $options['url']); - } - } - $client->setUri($options['url']); - $client->setMethod(strtoupper($options['type'])); - if (isset($options['referer']) && $options['referer']) - $client->setHeaders('Referer', $options['referer']); - $client->setHeaders(array( -// 'content-type' => $options['contentType'], - 'User-Agent' => 'Mozilla/5.0 (X11; U; Linux x86; en-US; rv:1.9.0.5) Gecko' - .'/2008122010 Firefox/3.0.5', - // TODO custom charset - 'Accept-Charset' => 'ISO-8859-1,utf-8;q=0.7,*;q=0.7', -// 'Connection' => 'keep-alive', -// 'Accept' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', - 'Accept-Language' => 'en-us,en;q=0.5', - )); - if ($options['username']) - $client->setAuth($options['username'], $options['password']); - if (isset($options['ifModified']) && $options['ifModified']) - $client->setHeaders("If-Modified-Since", - self::$lastModified - ? self::$lastModified - : "Thu, 01 Jan 1970 00:00:00 GMT" - ); - $client->setHeaders("Accept", - isset($options['dataType']) - && isset(self::$ajaxSettings['accepts'][ $options['dataType'] ]) - ? self::$ajaxSettings['accepts'][ $options['dataType'] ].", */*" - : self::$ajaxSettings['accepts']['_default'] - ); - // TODO $options['processData'] - if ($options['data'] instanceof phpQueryObject) { - $serialized = $options['data']->serializeArray($options['data']); - $options['data'] = array(); - foreach($serialized as $r) - $options['data'][ $r['name'] ] = $r['value']; - } - if (strtolower($options['type']) == 'get') { - $client->setParameterGet($options['data']); - } else if (strtolower($options['type']) == 'post') { - $client->setEncType($options['contentType']); - $client->setParameterPost($options['data']); - } - if (self::$active == 0 && $options['global']) - phpQueryEvents::trigger($documentID, 'ajaxStart'); - self::$active++; - // beforeSend callback - if (isset($options['beforeSend']) && $options['beforeSend']) - phpQuery::callbackRun($options['beforeSend'], array($client)); - // ajaxSend event - if ($options['global']) - phpQueryEvents::trigger($documentID, 'ajaxSend', array($client, $options)); - if (phpQuery::$debug) { - self::debug("{$options['type']}: {$options['url']}\n"); - self::debug("Options:
    ".var_export($options, true)."
    \n"); -// if ($client->getCookieJar()) -// self::debug("Cookies:
    ".var_export($client->getCookieJar()->getMatchingCookies($options['url']), true)."
    \n"); - } - // request - $response = $client->request(); - if (phpQuery::$debug) { - self::debug('Status: '.$response->getStatus().' / '.$response->getMessage()); - self::debug($client->getLastRequest()); - self::debug($response->getHeaders()); - } - if ($response->isSuccessful()) { - // XXX tempolary - self::$lastModified = $response->getHeader('Last-Modified'); - $data = self::httpData($response->getBody(), $options['dataType'], $options); - if (isset($options['success']) && $options['success']) - phpQuery::callbackRun($options['success'], array($data, $response->getStatus(), $options)); - if ($options['global']) - phpQueryEvents::trigger($documentID, 'ajaxSuccess', array($client, $options)); - } else { - if (isset($options['error']) && $options['error']) - phpQuery::callbackRun($options['error'], array($client, $response->getStatus(), $response->getMessage())); - if ($options['global']) - phpQueryEvents::trigger($documentID, 'ajaxError', array($client, /*$response->getStatus(),*/$response->getMessage(), $options)); - } - if (isset($options['complete']) && $options['complete']) - phpQuery::callbackRun($options['complete'], array($client, $response->getStatus())); - if ($options['global']) - phpQueryEvents::trigger($documentID, 'ajaxComplete', array($client, $options)); - if ($options['global'] && ! --self::$active) - phpQueryEvents::trigger($documentID, 'ajaxStop'); - return $client; -// if (is_null($domId)) -// $domId = self::$defaultDocumentID ? self::$defaultDocumentID : false; -// return new phpQueryAjaxResponse($response, $domId); - } - protected static function httpData($data, $type, $options) { - if (isset($options['dataFilter']) && $options['dataFilter']) - $data = self::callbackRun($options['dataFilter'], array($data, $type)); - if (is_string($data)) { - if ($type == "json") { - if (isset($options['_jsonp']) && $options['_jsonp']) { - $data = preg_replace('/^\s*\w+\((.*)\)\s*$/s', '$1', $data); - } - $data = self::parseJSON($data); - } - } - return $data; - } - /** - * Enter description here... - * - * @param array|phpQuery $data - * - */ - public static function param($data) { - return http_build_query($data, null, '&'); - } - public static function get($url, $data = null, $callback = null, $type = null) { - if (!is_array($data)) { - $callback = $data; - $data = null; - } - // TODO some array_values on this shit - return phpQuery::ajax(array( - 'type' => 'GET', - 'url' => $url, - 'data' => $data, - 'success' => $callback, - 'dataType' => $type, - )); - } - public static function post($url, $data = null, $callback = null, $type = null) { - if (!is_array($data)) { - $callback = $data; - $data = null; - } - return phpQuery::ajax(array( - 'type' => 'POST', - 'url' => $url, - 'data' => $data, - 'success' => $callback, - 'dataType' => $type, - )); - } - public static function getJSON($url, $data = null, $callback = null) { - if (!is_array($data)) { - $callback = $data; - $data = null; - } - // TODO some array_values on this shit - return phpQuery::ajax(array( - 'type' => 'GET', - 'url' => $url, - 'data' => $data, - 'success' => $callback, - 'dataType' => 'json', - )); - } - public static function ajaxSetup($options) { - self::$ajaxSettings = array_merge( - self::$ajaxSettings, - $options - ); - } - public static function ajaxAllowHost($host1, $host2 = null, $host3 = null) { - $loop = is_array($host1) - ? $host1 - : func_get_args(); - foreach($loop as $host) { - if ($host && ! in_array($host, phpQuery::$ajaxAllowedHosts)) { - phpQuery::$ajaxAllowedHosts[] = $host; - } - } - } - public static function ajaxAllowURL($url1, $url2 = null, $url3 = null) { - $loop = is_array($url1) - ? $url1 - : func_get_args(); - foreach($loop as $url) - phpQuery::ajaxAllowHost(parse_url($url, PHP_URL_HOST)); - } - /** - * Returns JSON representation of $data. - * - * @static - * @param mixed $data - * @return string - */ - public static function toJSON($data) { - if (function_exists('json_encode')) - return json_encode($data); - require_once('Zend/Json/Encoder.php'); - return Zend_Json_Encoder::encode($data); - } - /** - * Parses JSON into proper PHP type. - * - * @static - * @param string $json - * @return mixed - */ - public static function parseJSON($json) { - if (function_exists('json_decode')) { - $return = json_decode(trim($json), true); - // json_decode and UTF8 issues - if (isset($return)) - return $return; - } - require_once('Zend/Json/Decoder.php'); - return Zend_Json_Decoder::decode($json); - } - /** - * Returns source's document ID. - * - * @param $source DOMNode|phpQueryObject - * @return string - */ - public static function getDocumentID($source) { - if ($source instanceof DOMDOCUMENT) { - foreach(phpQuery::$documents as $id => $document) { - if ($source->isSameNode($document->document)) - return $id; - } - } else if ($source instanceof DOMNODE) { - foreach(phpQuery::$documents as $id => $document) { - if ($source->ownerDocument->isSameNode($document->document)) - return $id; - } - } else if ($source instanceof phpQueryObject) - return $source->getDocumentID(); - else if (is_string($source) && isset(phpQuery::$documents[$source])) - return $source; - } - /** - * Get DOMDocument object related to $source. - * Returns null if such document doesn't exist. - * - * @param $source DOMNode|phpQueryObject|string - * @return string - */ - public static function getDOMDocument($source) { - if ($source instanceof DOMDOCUMENT) - return $source; - $source = self::getDocumentID($source); - return $source - ? self::$documents[$id]['document'] - : null; - } - - // UTILITIES - // http://docs.jquery.com/Utilities - - /** - * - * @return unknown_type - * @link http://docs.jquery.com/Utilities/jQuery.makeArray - */ - public static function makeArray($obj) { - $array = array(); - if (is_object($object) && $object instanceof DOMNODELIST) { - foreach($object as $value) - $array[] = $value; - } else if (is_object($object) && ! ($object instanceof Iterator)) { - foreach(get_object_vars($object) as $name => $value) - $array[0][$name] = $value; - } else { - foreach($object as $name => $value) - $array[0][$name] = $value; - } - return $array; - } - public static function inArray($value, $array) { - return in_array($value, $array); - } - /** - * - * @param $object - * @param $callback - * @return unknown_type - * @link http://docs.jquery.com/Utilities/jQuery.each - */ - public static function each($object, $callback, $param1 = null, $param2 = null, $param3 = null) { - $paramStructure = null; - if (func_num_args() > 2) { - $paramStructure = func_get_args(); - $paramStructure = array_slice($paramStructure, 2); - } - if (is_object($object) && ! ($object instanceof Iterator)) { - foreach(get_object_vars($object) as $name => $value) - phpQuery::callbackRun($callback, array($name, $value), $paramStructure); - } else { - foreach($object as $name => $value) - phpQuery::callbackRun($callback, array($name, $value), $paramStructure); - } - } - /** - * - * @link http://docs.jquery.com/Utilities/jQuery.map - */ - public static function map($array, $callback, $param1 = null, $param2 = null, $param3 = null) { - $result = array(); - $paramStructure = null; - if (func_num_args() > 2) { - $paramStructure = func_get_args(); - $paramStructure = array_slice($paramStructure, 2); - } - foreach($array as $v) { - $vv = phpQuery::callbackRun($callback, array($v), $paramStructure); -// $callbackArgs = $args; -// foreach($args as $i => $arg) { -// $callbackArgs[$i] = $arg instanceof CallbackParam -// ? $v -// : $arg; -// } -// $vv = call_user_func_array($callback, $callbackArgs); - if (is_array($vv)) { - foreach($vv as $vvv) - $result[] = $vvv; - } else if ($vv !== null) { - $result[] = $vv; - } - } - return $result; - } - /** - * - * @param $callback Callback - * @param $params - * @param $paramStructure - * @return unknown_type - */ - public static function callbackRun($callback, $params = array(), $paramStructure = null) { - if (! $callback) - return; - if ($callback instanceof CallbackParameterToReference) { - // TODO support ParamStructure to select which $param push to reference - if (isset($params[0])) - $callback->callback = $params[0]; - return true; - } - if ($callback instanceof Callback) { - $paramStructure = $callback->params; - $callback = $callback->callback; - } - if (! $paramStructure) - return call_user_func_array($callback, $params); - $p = 0; - foreach($paramStructure as $i => $v) { - $paramStructure[$i] = $v instanceof CallbackParam - ? $params[$p++] - : $v; - } - return call_user_func_array($callback, $paramStructure); - } - /** - * Merge 2 phpQuery objects. - * @param array $one - * @param array $two - * @protected - * @todo node lists, phpQueryObject - */ - public static function merge($one, $two) { - $elements = $one->elements; - foreach($two->elements as $node) { - $exists = false; - foreach($elements as $node2) { - if ($node2->isSameNode($node)) - $exists = true; - } - if (! $exists) - $elements[] = $node; - } - return $elements; -// $one = $one->newInstance(); -// $one->elements = $elements; -// return $one; - } - /** - * - * @param $array - * @param $callback - * @param $invert - * @return unknown_type - * @link http://docs.jquery.com/Utilities/jQuery.grep - */ - public static function grep($array, $callback, $invert = false) { - $result = array(); - foreach($array as $k => $v) { - $r = call_user_func_array($callback, array($v, $k)); - if ($r === !(bool)$invert) - $result[] = $v; - } - return $result; - } - public static function unique($array) { - return array_unique($array); - } - /** - * - * @param $function - * @return unknown_type - * @TODO there are problems with non-static methods, second parameter pass it - * but doesnt verify is method is really callable - */ - public static function isFunction($function) { - return is_callable($function); - } - public static function trim($str) { - return trim($str); - } - /* PLUGINS NAMESPACE */ - /** - * - * @param $url - * @param $callback - * @param $param1 - * @param $param2 - * @param $param3 - * @return phpQueryObject - */ - public static function browserGet($url, $callback, $param1 = null, $param2 = null, $param3 = null) { - if (self::plugin('WebBrowser')) { - $params = func_get_args(); - return self::callbackRun(array(self::$plugins, 'browserGet'), $params); - } else { - self::debug('WebBrowser plugin not available...'); - } - } - /** - * - * @param $url - * @param $data - * @param $callback - * @param $param1 - * @param $param2 - * @param $param3 - * @return phpQueryObject - */ - public static function browserPost($url, $data, $callback, $param1 = null, $param2 = null, $param3 = null) { - if (self::plugin('WebBrowser')) { - $params = func_get_args(); - return self::callbackRun(array(self::$plugins, 'browserPost'), $params); - } else { - self::debug('WebBrowser plugin not available...'); - } - } - /** - * - * @param $ajaxSettings - * @param $callback - * @param $param1 - * @param $param2 - * @param $param3 - * @return phpQueryObject - */ - public static function browser($ajaxSettings, $callback, $param1 = null, $param2 = null, $param3 = null) { - if (self::plugin('WebBrowser')) { - $params = func_get_args(); - return self::callbackRun(array(self::$plugins, 'browser'), $params); - } else { - self::debug('WebBrowser plugin not available...'); - } - } - /** - * - * @param $code - * @return string - */ - public static function php($code) { - return self::code('php', $code); - } - /** - * - * @param $type - * @param $code - * @return string - */ - public static function code($type, $code) { - return "<$type>"; - } - - public static function __callStatic($method, $params) { - return call_user_func_array( - array(phpQuery::$plugins, $method), - $params - ); - } - protected static function dataSetupNode($node, $documentID) { - // search are return if alredy exists - foreach(phpQuery::$documents[$documentID]->dataNodes as $dataNode) { - if ($node->isSameNode($dataNode)) - return $dataNode; - } - // if doesn't, add it - phpQuery::$documents[$documentID]->dataNodes[] = $node; - return $node; - } - protected static function dataRemoveNode($node, $documentID) { - // search are return if alredy exists - foreach(phpQuery::$documents[$documentID]->dataNodes as $k => $dataNode) { - if ($node->isSameNode($dataNode)) { - unset(self::$documents[$documentID]->dataNodes[$k]); - unset(self::$documents[$documentID]->data[ $dataNode->dataID ]); - } - } - } - public static function data($node, $name, $data, $documentID = null) { - if (! $documentID) - // TODO check if this works - $documentID = self::getDocumentID($node); - $document = phpQuery::$documents[$documentID]; - $node = self::dataSetupNode($node, $documentID); - if (! isset($node->dataID)) - $node->dataID = ++phpQuery::$documents[$documentID]->uuid; - $id = $node->dataID; - if (! isset($document->data[$id])) - $document->data[$id] = array(); - if (! is_null($data)) - $document->data[$id][$name] = $data; - if ($name) { - if (isset($document->data[$id][$name])) - return $document->data[$id][$name]; - } else - return $id; - } - public static function removeData($node, $name, $documentID) { - if (! $documentID) - // TODO check if this works - $documentID = self::getDocumentID($node); - $document = phpQuery::$documents[$documentID]; - $node = self::dataSetupNode($node, $documentID); - $id = $node->dataID; - if ($name) { - if (isset($document->data[$id][$name])) - unset($document->data[$id][$name]); - $name = null; - foreach($document->data[$id] as $name) - break; - if (! $name) - self::removeData($node, $name, $documentID); - } else { - self::dataRemoveNode($node, $documentID); - } - } -} -/** - * Plugins static namespace class. - * - * @author Tobiasz Cudnik - * @package phpQuery - * @todo move plugin methods here (as statics) - */ -class phpQueryPlugins { - public function __call($method, $args) { - if (isset(phpQuery::$extendStaticMethods[$method])) { - $return = call_user_func_array( - phpQuery::$extendStaticMethods[$method], - $args - ); - } else if (isset(phpQuery::$pluginsStaticMethods[$method])) { - $class = phpQuery::$pluginsStaticMethods[$method]; - $realClass = "phpQueryPlugin_$class"; - $return = call_user_func_array( - array($realClass, $method), - $args - ); - return isset($return) - ? $return - : $this; - } else - throw new Exception("Method '{$method}' doesnt exist"); - } -} -/** - * Shortcut to phpQuery::pq($arg1, $context) - * Chainable. - * - * @see phpQuery::pq() - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - * @author Tobiasz Cudnik - * @package phpQuery - */ -function pq($arg1, $context = null) { - $args = func_get_args(); - return call_user_func_array( - array('phpQuery', 'pq'), - $args - ); -} -// add plugins dir and Zend framework to include path -set_include_path( - get_include_path() - .PATH_SEPARATOR.dirname(__FILE__).'/phpQuery/' - .PATH_SEPARATOR.dirname(__FILE__).'/phpQuery/plugins/' -); -// why ? no __call nor __get for statics in php... -// XXX __callStatic will be available in PHP 5.3 -phpQuery::$plugins = new phpQueryPlugins(); -// include bootstrap file (personal library config) -if (file_exists(dirname(__FILE__).'/phpQuery/bootstrap.php')) - require_once dirname(__FILE__).'/phpQuery/bootstrap.php'; \ No newline at end of file diff --git a/sitecake/2.2.9/server/vendor/electrolinux/phpquery/phpQuery/phpQuery/Callback.php b/sitecake/2.2.9/server/vendor/electrolinux/phpquery/phpQuery/phpQuery/Callback.php deleted file mode 100644 index d9a90ea..0000000 --- a/sitecake/2.2.9/server/vendor/electrolinux/phpquery/phpQuery/phpQuery/Callback.php +++ /dev/null @@ -1,152 +0,0 @@ - - * - * @TODO??? return fake forwarding function created via create_function - * @TODO honor paramStructure - */ -class Callback - implements ICallbackNamed { - public $callback = null; - public $params = null; - protected $name; - public function __construct($callback, $param1 = null, $param2 = null, - $param3 = null) { - $params = func_get_args(); - $params = array_slice($params, 1); - if ($callback instanceof Callback) { - // TODO implement recurention - } else { - $this->callback = $callback; - $this->params = $params; - } - } - public function getName() { - return 'Callback: '.$this->name; - } - public function hasName() { - return isset($this->name) && $this->name; - } - public function setName($name) { - $this->name = $name; - return $this; - } - // TODO test me -// public function addParams() { -// $params = func_get_args(); -// return new Callback($this->callback, $this->params+$params); -// } -} -/** - * Shorthand for new Callback(create_function(...), ...); - * - * @author Tobiasz Cudnik - */ -class CallbackBody extends Callback { - public function __construct($paramList, $code, $param1 = null, $param2 = null, - $param3 = null) { - $params = func_get_args(); - $params = array_slice($params, 2); - $this->callback = create_function($paramList, $code); - $this->params = $params; - } -} -/** - * Callback type which on execution returns reference passed during creation. - * - * @author Tobiasz Cudnik - */ -class CallbackReturnReference extends Callback - implements ICallbackNamed { - protected $reference; - public function __construct(&$reference, $name = null){ - $this->reference =& $reference; - $this->callback = array($this, 'callback'); - } - public function callback() { - return $this->reference; - } - public function getName() { - return 'Callback: '.$this->name; - } - public function hasName() { - return isset($this->name) && $this->name; - } -} -/** - * Callback type which on execution returns value passed during creation. - * - * @author Tobiasz Cudnik - */ -class CallbackReturnValue extends Callback - implements ICallbackNamed { - protected $value; - protected $name; - public function __construct($value, $name = null){ - $this->value =& $value; - $this->name = $name; - $this->callback = array($this, 'callback'); - } - public function callback() { - return $this->value; - } - public function __toString() { - return $this->getName(); - } - public function getName() { - return 'Callback: '.$this->name; - } - public function hasName() { - return isset($this->name) && $this->name; - } -} -/** - * CallbackParameterToReference can be used when we don't really want a callback, - * only parameter passed to it. CallbackParameterToReference takes first - * parameter's value and passes it to reference. - * - * @author Tobiasz Cudnik - */ -class CallbackParameterToReference extends Callback { - /** - * @param $reference - * @TODO implement $paramIndex; - * param index choose which callback param will be passed to reference - */ - public function __construct(&$reference){ - $this->callback =& $reference; - } -} -//class CallbackReference extends Callback { -// /** -// * -// * @param $reference -// * @param $paramIndex -// * @todo implement $paramIndex; param index choose which callback param will be passed to reference -// */ -// public function __construct(&$reference, $name = null){ -// $this->callback =& $reference; -// } -//} -class CallbackParam {} \ No newline at end of file diff --git a/sitecake/2.2.9/server/vendor/electrolinux/phpquery/phpQuery/phpQuery/DOMDocumentWrapper.php b/sitecake/2.2.9/server/vendor/electrolinux/phpquery/phpQuery/phpQuery/DOMDocumentWrapper.php deleted file mode 100644 index a58b1f3..0000000 --- a/sitecake/2.2.9/server/vendor/electrolinux/phpquery/phpQuery/phpQuery/DOMDocumentWrapper.php +++ /dev/null @@ -1,681 +0,0 @@ - changes to
    - * - * @todo check XML catalogs compatibility - * @author Tobiasz Cudnik - * @package phpQuery - */ -class DOMDocumentWrapper { - /** - * @var DOMDocument - */ - public $document; - public $id; - /** - * @todo Rewrite as method and quess if null. - * @var unknown_type - */ - public $contentType = ''; - public $xpath; - public $uuid = 0; - public $data = array(); - public $dataNodes = array(); - public $events = array(); - public $eventsNodes = array(); - public $eventsGlobal = array(); - /** - * @TODO iframes support http://code.google.com/p/phpquery/issues/detail?id=28 - * @var unknown_type - */ - public $frames = array(); - /** - * Document root, by default equals to document itself. - * Used by documentFragments. - * - * @var DOMNode - */ - public $root; - public $isDocumentFragment; - public $isXML = false; - public $isXHTML = false; - public $isHTML = false; - public $charset; - public function __construct($markup = null, $contentType = null, $newDocumentID = null) { - if (isset($markup)) - $this->load($markup, $contentType, $newDocumentID); - $this->id = $newDocumentID - ? $newDocumentID - : md5(microtime()); - } - public function load($markup, $contentType = null, $newDocumentID = null) { -// phpQuery::$documents[$id] = $this; - $this->contentType = strtolower($contentType); - if ($markup instanceof DOMDOCUMENT) { - $this->document = $markup; - $this->root = $this->document; - $this->charset = $this->document->encoding; - // TODO isDocumentFragment - $loaded = true; - } else { - $loaded = $this->loadMarkup($markup); - } - if ($loaded) { -// $this->document->formatOutput = true; - $this->document->preserveWhiteSpace = true; - $this->xpath = new DOMXPath($this->document); - $this->afterMarkupLoad(); - return true; - // remember last loaded document -// return phpQuery::selectDocument($id); - } - return false; - } - protected function afterMarkupLoad() { - if ($this->isXHTML) { - $this->xpath->registerNamespace("html", "http://www.w3.org/1999/xhtml"); - } - } - protected function loadMarkup($markup) { - $loaded = false; - if ($this->contentType) { - self::debug("Load markup for content type {$this->contentType}"); - // content determined by contentType - list($contentType, $charset) = $this->contentTypeToArray($this->contentType); - switch($contentType) { - case 'text/html': - phpQuery::debug("Loading HTML, content type '{$this->contentType}'"); - $loaded = $this->loadMarkupHTML($markup, $charset); - break; - case 'text/xml': - case 'application/xhtml+xml': - phpQuery::debug("Loading XML, content type '{$this->contentType}'"); - $loaded = $this->loadMarkupXML($markup, $charset); - break; - default: - // for feeds or anything that sometimes doesn't use text/xml - if (strpos('xml', $this->contentType) !== false) { - phpQuery::debug("Loading XML, content type '{$this->contentType}'"); - $loaded = $this->loadMarkupXML($markup, $charset); - } else - phpQuery::debug("Could not determine document type from content type '{$this->contentType}'"); - } - } else { - // content type autodetection - if ($this->isXML($markup)) { - phpQuery::debug("Loading XML, isXML() == true"); - $loaded = $this->loadMarkupXML($markup); - if (! $loaded && $this->isXHTML) { - phpQuery::debug('Loading as XML failed, trying to load as HTML, isXHTML == true'); - $loaded = $this->loadMarkupHTML($markup); - } - } else { - phpQuery::debug("Loading HTML, isXML() == false"); - $loaded = $this->loadMarkupHTML($markup); - } - } - return $loaded; - } - protected function loadMarkupReset() { - $this->isXML = $this->isXHTML = $this->isHTML = false; - } - protected function documentCreate($charset, $version = '1.0') { - if (! $version) - $version = '1.0'; - $this->document = new DOMDocument($version, $charset); - $this->charset = $this->document->encoding; -// $this->document->encoding = $charset; - $this->document->formatOutput = true; - $this->document->preserveWhiteSpace = true; - } - protected function loadMarkupHTML($markup, $requestedCharset = null) { - if (phpQuery::$debug) - phpQuery::debug('Full markup load (HTML): '.substr($markup, 0, 250)); - $this->loadMarkupReset(); - $this->isHTML = true; - if (!isset($this->isDocumentFragment)) - $this->isDocumentFragment = self::isDocumentFragmentHTML($markup); - $charset = null; - $documentCharset = $this->charsetFromHTML($markup); - $addDocumentCharset = false; - if ($documentCharset) { - $charset = $documentCharset; - $markup = $this->charsetFixHTML($markup); - } else if ($requestedCharset) { - $charset = $requestedCharset; - } - if (! $charset) - $charset = phpQuery::$defaultCharset; - // HTTP 1.1 says that the default charset is ISO-8859-1 - // @see http://www.w3.org/International/O-HTTP-charset - if (! $documentCharset) { - $documentCharset = 'ISO-8859-1'; - $addDocumentCharset = true; - } - // Should be careful here, still need 'magic encoding detection' since lots of pages have other 'default encoding' - // Worse, some pages can have mixed encodings... we'll try not to worry about that - $requestedCharset = strtoupper($requestedCharset); - $documentCharset = strtoupper($documentCharset); - phpQuery::debug("DOC: $documentCharset REQ: $requestedCharset"); - if ($requestedCharset && $documentCharset && $requestedCharset !== $documentCharset) { - phpQuery::debug("CHARSET CONVERT"); - // Document Encoding Conversion - // http://code.google.com/p/phpquery/issues/detail?id=86 - if (function_exists('mb_detect_encoding')) { - $possibleCharsets = array($documentCharset, $requestedCharset, 'AUTO'); - $docEncoding = mb_detect_encoding($markup, implode(', ', $possibleCharsets)); - if (! $docEncoding) - $docEncoding = $documentCharset; // ok trust the document - phpQuery::debug("DETECTED '$docEncoding'"); - // Detected does not match what document says... - if ($docEncoding !== $documentCharset) { - // Tricky.. - } - if ($docEncoding !== $requestedCharset) { - phpQuery::debug("CONVERT $docEncoding => $requestedCharset"); - $markup = mb_convert_encoding($markup, $requestedCharset, $docEncoding); - $markup = $this->charsetAppendToHTML($markup, $requestedCharset); - $charset = $requestedCharset; - } - } else { - phpQuery::debug("TODO: charset conversion without mbstring..."); - } - } - $return = false; - if ($this->isDocumentFragment) { - phpQuery::debug("Full markup load (HTML), DocumentFragment detected, using charset '$charset'"); - $return = $this->documentFragmentLoadMarkup($this, $charset, $markup); - } else { - if ($addDocumentCharset) { - phpQuery::debug("Full markup load (HTML), appending charset: '$charset'"); - $markup = $this->charsetAppendToHTML($markup, $charset); - } - phpQuery::debug("Full markup load (HTML), documentCreate('$charset')"); - $this->documentCreate($charset); - $return = phpQuery::$debug === 2 - ? $this->document->loadHTML($markup) - : @$this->document->loadHTML($markup); - if ($return) - $this->root = $this->document; - } - if ($return && ! $this->contentType) - $this->contentType = 'text/html'; - return $return; - } - protected function loadMarkupXML($markup, $requestedCharset = null) { - if (phpQuery::$debug) - phpQuery::debug('Full markup load (XML): '.substr($markup, 0, 250)); - $this->loadMarkupReset(); - $this->isXML = true; - // check agains XHTML in contentType or markup - $isContentTypeXHTML = $this->isXHTML(); - $isMarkupXHTML = $this->isXHTML($markup); - if ($isContentTypeXHTML || $isMarkupXHTML) { - self::debug('Full markup load (XML), XHTML detected'); - $this->isXHTML = true; - } - // determine document fragment - if (! isset($this->isDocumentFragment)) - $this->isDocumentFragment = $this->isXHTML - ? self::isDocumentFragmentXHTML($markup) - : self::isDocumentFragmentXML($markup); - // this charset will be used - $charset = null; - // charset from XML declaration @var string - $documentCharset = $this->charsetFromXML($markup); - if (! $documentCharset) { - if ($this->isXHTML) { - // this is XHTML, try to get charset from content-type meta header - $documentCharset = $this->charsetFromHTML($markup); - if ($documentCharset) { - phpQuery::debug("Full markup load (XML), appending XHTML charset '$documentCharset'"); - $this->charsetAppendToXML($markup, $documentCharset); - $charset = $documentCharset; - } - } - if (! $documentCharset) { - // if still no document charset... - $charset = $requestedCharset; - } - } else if ($requestedCharset) { - $charset = $requestedCharset; - } - if (! $charset) { - $charset = phpQuery::$defaultCharset; - } - if ($requestedCharset && $documentCharset && $requestedCharset != $documentCharset) { - // TODO place for charset conversion -// $charset = $requestedCharset; - } - $return = false; - if ($this->isDocumentFragment) { - phpQuery::debug("Full markup load (XML), DocumentFragment detected, using charset '$charset'"); - $return = $this->documentFragmentLoadMarkup($this, $charset, $markup); - } else { - // FIXME ??? - if ($isContentTypeXHTML && ! $isMarkupXHTML) - if (! $documentCharset) { - phpQuery::debug("Full markup load (XML), appending charset '$charset'"); - $markup = $this->charsetAppendToXML($markup, $charset); - } - // see http://pl2.php.net/manual/en/book.dom.php#78929 - // LIBXML_DTDLOAD (>= PHP 5.1) - // does XML ctalogues works with LIBXML_NONET - // $this->document->resolveExternals = true; - // TODO test LIBXML_COMPACT for performance improvement - // create document - $this->documentCreate($charset); - if (phpversion() < 5.1) { - $this->document->resolveExternals = true; - $return = phpQuery::$debug === 2 - ? $this->document->loadXML($markup) - : @$this->document->loadXML($markup); - } else { - /** @link http://pl2.php.net/manual/en/libxml.constants.php */ - $libxmlStatic = phpQuery::$debug === 2 - ? LIBXML_DTDLOAD|LIBXML_DTDATTR|LIBXML_NONET - : LIBXML_DTDLOAD|LIBXML_DTDATTR|LIBXML_NONET|LIBXML_NOWARNING|LIBXML_NOERROR; - $return = $this->document->loadXML($markup, $libxmlStatic); -// if (! $return) -// $return = $this->document->loadHTML($markup); - } - if ($return) - $this->root = $this->document; - } - if ($return) { - if (! $this->contentType) { - if ($this->isXHTML) - $this->contentType = 'application/xhtml+xml'; - else - $this->contentType = 'text/xml'; - } - return $return; - } else { - throw new Exception("Error loading XML markup"); - } - } - protected function isXHTML($markup = null) { - if (! isset($markup)) { - return strpos($this->contentType, 'xhtml') !== false; - } - // XXX ok ? - return strpos($markup, "doctype) && is_object($dom->doctype) -// ? $dom->doctype->publicId -// : self::$defaultDoctype; - } - protected function isXML($markup) { -// return strpos($markup, ']+http-equiv\\s*=\\s*(["|\'])Content-Type\\1([^>]+?)>@i', - $markup, $matches - ); - if (! isset($matches[0])) - return array(null, null); - // get attr 'content' - preg_match('@content\\s*=\\s*(["|\'])(.+?)\\1@', $matches[0], $matches); - if (! isset($matches[0])) - return array(null, null); - return $this->contentTypeToArray($matches[2]); - } - protected function charsetFromHTML($markup) { - $contentType = $this->contentTypeFromHTML($markup); - return $contentType[1]; - } - protected function charsetFromXML($markup) { - $matches; - // find declaration - preg_match('@<'.'?xml[^>]+encoding\\s*=\\s*(["|\'])(.*?)\\1@i', - $markup, $matches - ); - return isset($matches[2]) - ? strtolower($matches[2]) - : null; - } - /** - * Repositions meta[type=charset] at the start of head. Bypasses DOMDocument bug. - * - * @link http://code.google.com/p/phpquery/issues/detail?id=80 - * @param $html - */ - protected function charsetFixHTML($markup) { - $matches = array(); - // find meta tag - preg_match('@\s*]+http-equiv\\s*=\\s*(["|\'])Content-Type\\1([^>]+?)>@i', - $markup, $matches, PREG_OFFSET_CAPTURE - ); - if (! isset($matches[0])) - return; - $metaContentType = $matches[0][0]; - $markup = substr($markup, 0, $matches[0][1]) - .substr($markup, $matches[0][1]+strlen($metaContentType)); - $headStart = stripos($markup, ''); - $markup = substr($markup, 0, $headStart+6).$metaContentType - .substr($markup, $headStart+6); - return $markup; - } - protected function charsetAppendToHTML($html, $charset, $xhtml = false) { - // remove existing meta[type=content-type] - $html = preg_replace('@\s*]+http-equiv\\s*=\\s*(["|\'])Content-Type\\1([^>]+?)>@i', '', $html); - $meta = ''; - if (strpos($html, ')@s', - "{$meta}", - $html - ); - } - } else { - return preg_replace( - '@)@s', - ''.$meta, - $html - ); - } - } - protected function charsetAppendToXML($markup, $charset) { - $declaration = '<'.'?xml version="1.0" encoding="'.$charset.'"?'.'>'; - return $declaration.$markup; - } - public static function isDocumentFragmentHTML($markup) { - return stripos($markup, 'documentFragmentCreate($node, $sourceCharset); -// if ($fake === false) -// throw new Exception("Error loading documentFragment markup"); -// else -// $return = array_merge($return, -// $this->import($fake->root->childNodes) -// ); -// } else { -// $return[] = $this->document->importNode($node, true); -// } -// } -// return $return; -// } else { -// // string markup -// $fake = $this->documentFragmentCreate($source, $sourceCharset); -// if ($fake === false) -// throw new Exception("Error loading documentFragment markup"); -// else -// return $this->import($fake->root->childNodes); -// } - if (is_array($source) || $source instanceof DOMNODELIST) { - // dom nodes - self::debug('Importing nodes to document'); - foreach($source as $node) - $return[] = $this->document->importNode($node, true); - } else { - // string markup - $fake = $this->documentFragmentCreate($source, $sourceCharset); - if ($fake === false) - throw new Exception("Error loading documentFragment markup"); - else - return $this->import($fake->root->childNodes); - } - return $return; - } - /** - * Creates new document fragment. - * - * @param $source - * @return DOMDocumentWrapper - */ - protected function documentFragmentCreate($source, $charset = null) { - $fake = new DOMDocumentWrapper(); - $fake->contentType = $this->contentType; - $fake->isXML = $this->isXML; - $fake->isHTML = $this->isHTML; - $fake->isXHTML = $this->isXHTML; - $fake->root = $fake->document; - if (! $charset) - $charset = $this->charset; -// $fake->documentCreate($this->charset); - if ($source instanceof DOMNODE && !($source instanceof DOMNODELIST)) - $source = array($source); - if (is_array($source) || $source instanceof DOMNODELIST) { - // dom nodes - // load fake document - if (! $this->documentFragmentLoadMarkup($fake, $charset)) - return false; - $nodes = $fake->import($source); - foreach($nodes as $node) - $fake->root->appendChild($node); - } else { - // string markup - $this->documentFragmentLoadMarkup($fake, $charset, $source); - } - return $fake; - } - /** - * - * @param $document DOMDocumentWrapper - * @param $markup - * @return $document - */ - private function documentFragmentLoadMarkup($fragment, $charset, $markup = null) { - // TODO error handling - // TODO copy doctype - // tempolary turn off - $fragment->isDocumentFragment = false; - if ($fragment->isXML) { - if ($fragment->isXHTML) { - // add FAKE element to set default namespace - $fragment->loadMarkupXML('' - .'' - .''.$markup.''); - $fragment->root = $fragment->document->firstChild->nextSibling; - } else { - $fragment->loadMarkupXML(''.$markup.''); - $fragment->root = $fragment->document->firstChild; - } - } else { - $markup2 = phpQuery::$defaultDoctype.''; - $noBody = strpos($markup, 'loadMarkupHTML($markup2); - // TODO resolv body tag merging issue - $fragment->root = $noBody - ? $fragment->document->firstChild->nextSibling->firstChild->nextSibling - : $fragment->document->firstChild->nextSibling->firstChild->nextSibling; - } - if (! $fragment->root) - return false; - $fragment->isDocumentFragment = true; - return true; - } - protected function documentFragmentToMarkup($fragment) { - phpQuery::debug('documentFragmentToMarkup'); - $tmp = $fragment->isDocumentFragment; - $fragment->isDocumentFragment = false; - $markup = $fragment->markup(); - if ($fragment->isXML) { - $markup = substr($markup, 0, strrpos($markup, '')); - if ($fragment->isXHTML) { - $markup = substr($markup, strpos($markup, '')+6); - } - } else { - $markup = substr($markup, strpos($markup, '')+6); - $markup = substr($markup, 0, strrpos($markup, '')); - } - $fragment->isDocumentFragment = $tmp; - if (phpQuery::$debug) - phpQuery::debug('documentFragmentToMarkup: '.substr($markup, 0, 150)); - return $markup; - } - /** - * Return document markup, starting with optional $nodes as root. - * - * @param $nodes DOMNode|DOMNodeList - * @return string - */ - public function markup($nodes = null, $innerMarkup = false) { - if (isset($nodes) && count($nodes) == 1 && $nodes[0] instanceof DOMDOCUMENT) - $nodes = null; - if (isset($nodes)) { - $markup = ''; - if (!is_array($nodes) && !($nodes instanceof DOMNODELIST) ) - $nodes = array($nodes); - if ($this->isDocumentFragment && ! $innerMarkup) - foreach($nodes as $i => $node) - if ($node->isSameNode($this->root)) { - // var_dump($node); - $nodes = array_slice($nodes, 0, $i) - + phpQuery::DOMNodeListToArray($node->childNodes) - + array_slice($nodes, $i+1); - } - if ($this->isXML && ! $innerMarkup) { - self::debug("Getting outerXML with charset '{$this->charset}'"); - // we need outerXML, so we can benefit from - // $node param support in saveXML() - foreach($nodes as $node) - $markup .= $this->document->saveXML($node); - } else { - $loop = array(); - if ($innerMarkup) - foreach($nodes as $node) { - if ($node->childNodes) - foreach($node->childNodes as $child) - $loop[] = $child; - else - $loop[] = $node; - } - else - $loop = $nodes; - self::debug("Getting markup, moving selected nodes (".count($loop).") to new DocumentFragment"); - $fake = $this->documentFragmentCreate($loop); - $markup = $this->documentFragmentToMarkup($fake); - } - if ($this->isXHTML) { - self::debug("Fixing XHTML"); - $markup = self::markupFixXHTML($markup); - } - self::debug("Markup: ".substr($markup, 0, 250)); - return $markup; - } else { - if ($this->isDocumentFragment) { - // documentFragment, html only... - self::debug("Getting markup, DocumentFragment detected"); -// return $this->markup( -//// $this->document->getElementsByTagName('body')->item(0) -// $this->document->root, true -// ); - $markup = $this->documentFragmentToMarkup($this); - // no need for markupFixXHTML, as it's done thought markup($nodes) method - return $markup; - } else { - self::debug("Getting markup (".($this->isXML?'XML':'HTML')."), final with charset '{$this->charset}'"); - $markup = $this->isXML - ? $this->document->saveXML() - : $this->document->saveHTML(); - if ($this->isXHTML) { - self::debug("Fixing XHTML"); - $markup = self::markupFixXHTML($markup); - } - self::debug("Markup: ".substr($markup, 0, 250)); - return $markup; - } - } - } - protected static function markupFixXHTML($markup) { - $markup = self::expandEmptyTag('script', $markup); - $markup = self::expandEmptyTag('select', $markup); - $markup = self::expandEmptyTag('textarea', $markup); - return $markup; - } - public static function debug($text) { - phpQuery::debug($text); - } - /** - * expandEmptyTag - * - * @param $tag - * @param $xml - * @return string - * @author mjaque at ilkebenson dot com - * @link http://php.net/manual/en/domdocument.savehtml.php#81256 - */ - public static function expandEmptyTag($tag, $xml){ - $indice = 0; - while ($indice< strlen($xml)){ - $pos = strpos($xml, "<$tag ", $indice); - if ($pos){ - $posCierre = strpos($xml, ">", $pos); - if ($xml[$posCierre-1] == "/"){ - $xml = substr_replace($xml, ">", $posCierre-1, 2); - } - $indice = $posCierre; - } - else break; - } - return $xml; - } -} diff --git a/sitecake/2.2.9/server/vendor/electrolinux/phpquery/phpQuery/phpQuery/DOMEvent.php b/sitecake/2.2.9/server/vendor/electrolinux/phpquery/phpQuery/phpQuery/DOMEvent.php deleted file mode 100644 index 0cb0c46..0000000 --- a/sitecake/2.2.9/server/vendor/electrolinux/phpquery/phpQuery/phpQuery/DOMEvent.php +++ /dev/null @@ -1,107 +0,0 @@ - - * @package phpQuery - * @todo implement ArrayAccess ? - */ -class DOMEvent { - /** - * Returns a boolean indicating whether the event bubbles up through the DOM or not. - * - * @var unknown_type - */ - public $bubbles = true; - /** - * Returns a boolean indicating whether the event is cancelable. - * - * @var unknown_type - */ - public $cancelable = true; - /** - * Returns a reference to the currently registered target for the event. - * - * @var unknown_type - */ - public $currentTarget; - /** - * Returns detail about the event, depending on the type of event. - * - * @var unknown_type - * @link http://developer.mozilla.org/en/DOM/event.detail - */ - public $detail; // ??? - /** - * Used to indicate which phase of the event flow is currently being evaluated. - * - * NOT IMPLEMENTED - * - * @var unknown_type - * @link http://developer.mozilla.org/en/DOM/event.eventPhase - */ - public $eventPhase; // ??? - /** - * The explicit original target of the event (Mozilla-specific). - * - * NOT IMPLEMENTED - * - * @var unknown_type - */ - public $explicitOriginalTarget; // moz only - /** - * The original target of the event, before any retargetings (Mozilla-specific). - * - * NOT IMPLEMENTED - * - * @var unknown_type - */ - public $originalTarget; // moz only - /** - * Identifies a secondary target for the event. - * - * @var unknown_type - */ - public $relatedTarget; - /** - * Returns a reference to the target to which the event was originally dispatched. - * - * @var unknown_type - */ - public $target; - /** - * Returns the time that the event was created. - * - * @var unknown_type - */ - public $timeStamp; - /** - * Returns the name of the event (case-insensitive). - */ - public $type; - public $runDefault = true; - public $data = null; - public function __construct($data) { - foreach($data as $k => $v) { - $this->$k = $v; - } - if (! $this->timeStamp) - $this->timeStamp = time(); - } - /** - * Cancels the event (if it is cancelable). - * - */ - public function preventDefault() { - $this->runDefault = false; - } - /** - * Stops the propagation of events further along in the DOM. - * - */ - public function stopPropagation() { - $this->bubbles = false; - } -} diff --git a/sitecake/2.2.9/server/vendor/electrolinux/phpquery/phpQuery/phpQuery/bootstrap.example.php b/sitecake/2.2.9/server/vendor/electrolinux/phpquery/phpQuery/phpQuery/bootstrap.example.php deleted file mode 100644 index 4fafe1a..0000000 --- a/sitecake/2.2.9/server/vendor/electrolinux/phpquery/phpQuery/phpQuery/bootstrap.example.php +++ /dev/null @@ -1,14 +0,0 @@ - \ No newline at end of file diff --git a/sitecake/2.2.9/server/vendor/electrolinux/phpquery/phpQuery/phpQuery/compat/mbstring.php b/sitecake/2.2.9/server/vendor/electrolinux/phpquery/phpQuery/phpQuery/compat/mbstring.php deleted file mode 100644 index 409129e..0000000 --- a/sitecake/2.2.9/server/vendor/electrolinux/phpquery/phpQuery/phpQuery/compat/mbstring.php +++ /dev/null @@ -1,88 +0,0 @@ -document) - $pq->find('*')->add($pq->document) - ->trigger($type, $data); - } - } else { - if (isset($data[0]) && $data[0] instanceof DOMEvent) { - $event = $data[0]; - $event->relatedTarget = $event->target; - $event->target = $node; - $data = array_slice($data, 1); - } else { - $event = new DOMEvent(array( - 'type' => $type, - 'target' => $node, - 'timeStamp' => time(), - )); - } - $i = 0; - while($node) { - // TODO whois - phpQuery::debug("Triggering ".($i?"bubbled ":'')."event '{$type}' on " - ."node \n");//.phpQueryObject::whois($node)."\n"); - $event->currentTarget = $node; - $eventNode = self::getNode($documentID, $node); - if (isset($eventNode->eventHandlers)) { - foreach($eventNode->eventHandlers as $eventType => $handlers) { - $eventNamespace = null; - if (strpos($type, '.') !== false) - list($eventName, $eventNamespace) = explode('.', $eventType); - else - $eventName = $eventType; - if ($name != $eventName) - continue; - if ($namespace && $eventNamespace && $namespace != $eventNamespace) - continue; - foreach($handlers as $handler) { - phpQuery::debug("Calling event handler\n"); - $event->data = $handler['data'] - ? $handler['data'] - : null; - $params = array_merge(array($event), $data); - $return = phpQuery::callbackRun($handler['callback'], $params); - if ($return === false) { - $event->bubbles = false; - } - } - } - } - // to bubble or not to bubble... - if (! $event->bubbles) - break; - $node = $node->parentNode; - $i++; - } - } - } - /** - * Binds a handler to one or more events (like click) for each matched element. - * Can also bind custom events. - * - * @param DOMNode|phpQueryObject|string $document - * @param unknown_type $type - * @param unknown_type $data Optional - * @param unknown_type $callback - * - * @TODO support '!' (exclusive) events - * @TODO support more than event in $type (space-separated) - * @TODO support binding to global events - */ - public static function add($document, $node, $type, $data, $callback = null) { - phpQuery::debug("Binding '$type' event"); - $documentID = phpQuery::getDocumentID($document); -// if (is_null($callback) && is_callable($data)) { -// $callback = $data; -// $data = null; -// } - $eventNode = self::getNode($documentID, $node); - if (! $eventNode) - $eventNode = self::setNode($documentID, $node); - if (!isset($eventNode->eventHandlers[$type])) - $eventNode->eventHandlers[$type] = array(); - $eventNode->eventHandlers[$type][] = array( - 'callback' => $callback, - 'data' => $data, - ); - } - /** - * Enter description here... - * - * @param DOMNode|phpQueryObject|string $document - * @param unknown_type $type - * @param unknown_type $callback - * - * @TODO namespace events - * @TODO support more than event in $type (space-separated) - */ - public static function remove($document, $node, $type = null, $callback = null) { - $documentID = phpQuery::getDocumentID($document); - $eventNode = self::getNode($documentID, $node); - if (is_object($eventNode) && isset($eventNode->eventHandlers[$type])) { - if ($callback) { - foreach($eventNode->eventHandlers[$type] as $k => $handler) - if ($handler['callback'] == $callback) - unset($eventNode->eventHandlers[$type][$k]); - } else { - unset($eventNode->eventHandlers[$type]); - } - } - } - protected static function getNode($documentID, $node) { - foreach(phpQuery::$documents[$documentID]->eventsNodes as $eventNode) { - if ($node->isSameNode($eventNode)) - return $eventNode; - } - } - protected static function setNode($documentID, $node) { - phpQuery::$documents[$documentID]->eventsNodes[] = $node; - return phpQuery::$documents[$documentID]->eventsNodes[ - count(phpQuery::$documents[$documentID]->eventsNodes)-1 - ]; - } - protected static function issetGlobal($documentID, $type) { - return isset(phpQuery::$documents[$documentID]) - ? in_array($type, phpQuery::$documents[$documentID]->eventsGlobal) - : false; - } -} diff --git a/sitecake/2.2.9/server/vendor/electrolinux/phpquery/phpQuery/phpQuery/phpQueryObject.php b/sitecake/2.2.9/server/vendor/electrolinux/phpquery/phpQuery/phpQuery/phpQueryObject.php deleted file mode 100644 index ece90b6..0000000 --- a/sitecake/2.2.9/server/vendor/electrolinux/phpquery/phpQuery/phpQuery/phpQueryObject.php +++ /dev/null @@ -1,3213 +0,0 @@ - - * @package phpQuery - * @method phpQueryObject clone() clone() - * @method phpQueryObject empty() empty() - * @method phpQueryObject next() next($selector = null) - * @method phpQueryObject prev() prev($selector = null) - * @property Int $length - */ -class phpQueryObject - implements Iterator, Countable, ArrayAccess { - public $documentID = null; - /** - * DOMDocument class. - * - * @var DOMDocument - */ - public $document = null; - public $charset = null; - /** - * - * @var DOMDocumentWrapper - */ - public $documentWrapper = null; - /** - * XPath interface. - * - * @var DOMXPath - */ - public $xpath = null; - /** - * Stack of selected elements. - * @TODO refactor to ->nodes - * @var array - */ - public $elements = array(); - /** - * @access private - */ - protected $elementsBackup = array(); - /** - * @access private - */ - protected $previous = null; - /** - * @access private - * @TODO deprecate - */ - protected $root = array(); - /** - * Indicated if doument is just a fragment (no tag). - * - * Every document is realy a full document, so even documentFragments can - * be queried against , but getDocument(id)->htmlOuter() will return - * only contents of . - * - * @var bool - */ - public $documentFragment = true; - /** - * Iterator interface helper - * @access private - */ - protected $elementsInterator = array(); - /** - * Iterator interface helper - * @access private - */ - protected $valid = false; - /** - * Iterator interface helper - * @access private - */ - protected $current = null; - /** - * Enter description here... - * - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - */ - public function __construct($documentID) { -// if ($documentID instanceof self) -// var_dump($documentID->getDocumentID()); - $id = $documentID instanceof self - ? $documentID->getDocumentID() - : $documentID; -// var_dump($id); - if (! isset(phpQuery::$documents[$id] )) { -// var_dump(phpQuery::$documents); - throw new Exception("Document with ID '{$id}' isn't loaded. Use phpQuery::newDocument(\$html) or phpQuery::newDocumentFile(\$file) first."); - } - $this->documentID = $id; - $this->documentWrapper =& phpQuery::$documents[$id]; - $this->document =& $this->documentWrapper->document; - $this->xpath =& $this->documentWrapper->xpath; - $this->charset =& $this->documentWrapper->charset; - $this->documentFragment =& $this->documentWrapper->isDocumentFragment; - // TODO check $this->DOM->documentElement; -// $this->root = $this->document->documentElement; - $this->root =& $this->documentWrapper->root; -// $this->toRoot(); - $this->elements = array($this->root); - } - /** - * - * @access private - * @param $attr - * @return unknown_type - */ - public function __get($attr) { - switch($attr) { - // FIXME doesnt work at all ? - case 'length': - return $this->size(); - break; - default: - return $this->$attr; - } - } - /** - * Saves actual object to $var by reference. - * Useful when need to break chain. - * @param phpQueryObject $var - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - */ - public function toReference(&$var) { - return $var = $this; - } - public function documentFragment($state = null) { - if ($state) { - phpQuery::$documents[$this->getDocumentID()]['documentFragment'] = $state; - return $this; - } - return $this->documentFragment; - } - /** - * @access private - * @TODO documentWrapper - */ - protected function isRoot( $node) { -// return $node instanceof DOMDOCUMENT || $node->tagName == 'html'; - return $node instanceof DOMDOCUMENT - || ($node instanceof DOMELEMENT && $node->tagName == 'html') - || $this->root->isSameNode($node); - } - /** - * @access private - */ - protected function stackIsRoot() { - return $this->size() == 1 && $this->isRoot($this->elements[0]); - } - /** - * Enter description here... - * NON JQUERY METHOD - * - * Watch out, it doesn't creates new instance, can be reverted with end(). - * - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - */ - public function toRoot() { - $this->elements = array($this->root); - return $this; -// return $this->newInstance(array($this->root)); - } - /** - * Saves object's DocumentID to $var by reference. - * - * $myDocumentId; - * phpQuery::newDocument('
    ') - * ->getDocumentIDRef($myDocumentId) - * ->find('div')->... - * - * - * @param unknown_type $domId - * @see phpQuery::newDocument - * @see phpQuery::newDocumentFile - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - */ - public function getDocumentIDRef(&$documentID) { - $documentID = $this->getDocumentID(); - return $this; - } - /** - * Returns object with stack set to document root. - * - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - */ - public function getDocument() { - return phpQuery::getDocument($this->getDocumentID()); - } - /** - * - * @return DOMDocument - */ - public function getDOMDocument() { - return $this->document; - } - /** - * Get object's Document ID. - * - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - */ - public function getDocumentID() { - return $this->documentID; - } - /** - * Unloads whole document from memory. - * CAUTION! None further operations will be possible on this document. - * All objects refering to it will be useless. - * - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - */ - public function unloadDocument() { - phpQuery::unloadDocuments($this->getDocumentID()); - } - public function isHTML() { - return $this->documentWrapper->isHTML; - } - public function isXHTML() { - return $this->documentWrapper->isXHTML; - } - public function isXML() { - return $this->documentWrapper->isXML; - } - /** - * Enter description here... - * - * @link http://docs.jquery.com/Ajax/serialize - * @return string - */ - public function serialize() { - return phpQuery::param($this->serializeArray()); - } - /** - * Enter description here... - * - * @link http://docs.jquery.com/Ajax/serializeArray - * @return array - */ - public function serializeArray($submit = null) { - $source = $this->filter('form, input, select, textarea') - ->find('input, select, textarea') - ->andSelf() - ->not('form'); - $return = array(); -// $source->dumpDie(); - foreach($source as $input) { - $input = phpQuery::pq($input); - if ($input->is('[disabled]')) - continue; - if (!$input->is('[name]')) - continue; - if ($input->is('[type=checkbox]') && !$input->is('[checked]')) - continue; - // jquery diff - if ($submit && $input->is('[type=submit]')) { - if ($submit instanceof DOMELEMENT && ! $input->elements[0]->isSameNode($submit)) - continue; - else if (is_string($submit) && $input->attr('name') != $submit) - continue; - } - $return[] = array( - 'name' => $input->attr('name'), - 'value' => $input->val(), - ); - } - return $return; - } - /** - * @access private - */ - protected function debug($in) { - if (! phpQuery::$debug ) - return; - print('
    ');
    -		print_r($in);
    -		// file debug
    -//		file_put_contents(dirname(__FILE__).'/phpQuery.log', print_r($in, true)."\n", FILE_APPEND);
    -		// quite handy debug trace
    -//		if ( is_array($in))
    -//			print_r(array_slice(debug_backtrace(), 3));
    -		print("
    \n"); - } - /** - * @access private - */ - protected function isRegexp($pattern) { - return in_array( - $pattern[ mb_strlen($pattern)-1 ], - array('^','*','$') - ); - } - /** - * Determines if $char is really a char. - * - * @param string $char - * @return bool - * @todo rewrite me to charcode range ! ;) - * @access private - */ - protected function isChar($char) { - return extension_loaded('mbstring') && phpQuery::$mbstringSupport - ? mb_eregi('\w', $char) - : preg_match('@\w@', $char); - } - /** - * @access private - */ - protected function parseSelector($query) { - // clean spaces - // TODO include this inside parsing ? - $query = trim( - preg_replace('@\s+@', ' ', - preg_replace('@\s*(>|\\+|~)\s*@', '\\1', $query) - ) - ); - $queries = array(array()); - if (! $query) - return $queries; - $return =& $queries[0]; - $specialChars = array('>',' '); -// $specialCharsMapping = array('/' => '>'); - $specialCharsMapping = array(); - $strlen = mb_strlen($query); - $classChars = array('.', '-'); - $pseudoChars = array('-'); - $tagChars = array('*', '|', '-'); - // split multibyte string - // http://code.google.com/p/phpquery/issues/detail?id=76 - $_query = array(); - for ($i=0; $i<$strlen; $i++) - $_query[] = mb_substr($query, $i, 1); - $query = $_query; - // it works, but i dont like it... - $i = 0; - while( $i < $strlen) { - $c = $query[$i]; - $tmp = ''; - // TAG - if ($this->isChar($c) || in_array($c, $tagChars)) { - while(isset($query[$i]) - && ($this->isChar($query[$i]) || in_array($query[$i], $tagChars))) { - $tmp .= $query[$i]; - $i++; - } - $return[] = $tmp; - // IDs - } else if ( $c == '#') { - $i++; - while( isset($query[$i]) && ($this->isChar($query[$i]) || $query[$i] == '-')) { - $tmp .= $query[$i]; - $i++; - } - $return[] = '#'.$tmp; - // SPECIAL CHARS - } else if (in_array($c, $specialChars)) { - $return[] = $c; - $i++; - // MAPPED SPECIAL MULTICHARS -// } else if ( $c.$query[$i+1] == '//') { -// $return[] = ' '; -// $i = $i+2; - // MAPPED SPECIAL CHARS - } else if ( isset($specialCharsMapping[$c])) { - $return[] = $specialCharsMapping[$c]; - $i++; - // COMMA - } else if ( $c == ',') { - $queries[] = array(); - $return =& $queries[ count($queries)-1 ]; - $i++; - while( isset($query[$i]) && $query[$i] == ' ') - $i++; - // CLASSES - } else if ($c == '.') { - while( isset($query[$i]) && ($this->isChar($query[$i]) || in_array($query[$i], $classChars))) { - $tmp .= $query[$i]; - $i++; - } - $return[] = $tmp; - // ~ General Sibling Selector - } else if ($c == '~') { - $spaceAllowed = true; - $tmp .= $query[$i++]; - while( isset($query[$i]) - && ($this->isChar($query[$i]) - || in_array($query[$i], $classChars) - || $query[$i] == '*' - || ($query[$i] == ' ' && $spaceAllowed) - )) { - if ($query[$i] != ' ') - $spaceAllowed = false; - $tmp .= $query[$i]; - $i++; - } - $return[] = $tmp; - // + Adjacent sibling selectors - } else if ($c == '+') { - $spaceAllowed = true; - $tmp .= $query[$i++]; - while( isset($query[$i]) - && ($this->isChar($query[$i]) - || in_array($query[$i], $classChars) - || $query[$i] == '*' - || ($spaceAllowed && $query[$i] == ' ') - )) { - if ($query[$i] != ' ') - $spaceAllowed = false; - $tmp .= $query[$i]; - $i++; - } - $return[] = $tmp; - // ATTRS - } else if ($c == '[') { - $stack = 1; - $tmp .= $c; - while( isset($query[++$i])) { - $tmp .= $query[$i]; - if ( $query[$i] == '[') { - $stack++; - } else if ( $query[$i] == ']') { - $stack--; - if (! $stack ) - break; - } - } - $return[] = $tmp; - $i++; - // PSEUDO CLASSES - } else if ($c == ':') { - $stack = 1; - $tmp .= $query[$i++]; - while( isset($query[$i]) && ($this->isChar($query[$i]) || in_array($query[$i], $pseudoChars))) { - $tmp .= $query[$i]; - $i++; - } - // with arguments ? - if ( isset($query[$i]) && $query[$i] == '(') { - $tmp .= $query[$i]; - $stack = 1; - while( isset($query[++$i])) { - $tmp .= $query[$i]; - if ( $query[$i] == '(') { - $stack++; - } else if ( $query[$i] == ')') { - $stack--; - if (! $stack ) - break; - } - } - $return[] = $tmp; - $i++; - } else { - $return[] = $tmp; - } - } else { - $i++; - } - } - foreach($queries as $k => $q) { - if (isset($q[0])) { - if (isset($q[0][0]) && $q[0][0] == ':') - array_unshift($queries[$k], '*'); - if ($q[0] != '>') - array_unshift($queries[$k], ' '); - } - } - return $queries; - } - /** - * Return matched DOM nodes. - * - * @param int $index - * @return array|DOMElement Single DOMElement or array of DOMElement. - */ - public function get($index = null, $callback1 = null, $callback2 = null, $callback3 = null) { - $return = isset($index) - ? (isset($this->elements[$index]) ? $this->elements[$index] : null) - : $this->elements; - // pass thou callbacks - $args = func_get_args(); - $args = array_slice($args, 1); - foreach($args as $callback) { - if (is_array($return)) - foreach($return as $k => $v) - $return[$k] = phpQuery::callbackRun($callback, array($v)); - else - $return = phpQuery::callbackRun($callback, array($return)); - } - return $return; - } - /** - * Return matched DOM nodes. - * jQuery difference. - * - * @param int $index - * @return array|string Returns string if $index != null - * @todo implement callbacks - * @todo return only arrays ? - * @todo maybe other name... - */ - public function getString($index = null, $callback1 = null, $callback2 = null, $callback3 = null) { - if ($index) - $return = $this->eq($index)->text(); - else { - $return = array(); - for($i = 0; $i < $this->size(); $i++) { - $return[] = $this->eq($i)->text(); - } - } - // pass thou callbacks - $args = func_get_args(); - $args = array_slice($args, 1); - foreach($args as $callback) { - $return = phpQuery::callbackRun($callback, array($return)); - } - return $return; - } - /** - * Return matched DOM nodes. - * jQuery difference. - * - * @param int $index - * @return array|string Returns string if $index != null - * @todo implement callbacks - * @todo return only arrays ? - * @todo maybe other name... - */ - public function getStrings($index = null, $callback1 = null, $callback2 = null, $callback3 = null) { - if ($index) - $return = $this->eq($index)->text(); - else { - $return = array(); - for($i = 0; $i < $this->size(); $i++) { - $return[] = $this->eq($i)->text(); - } - // pass thou callbacks - $args = func_get_args(); - $args = array_slice($args, 1); - } - foreach($args as $callback) { - if (is_array($return)) - foreach($return as $k => $v) - $return[$k] = phpQuery::callbackRun($callback, array($v)); - else - $return = phpQuery::callbackRun($callback, array($return)); - } - return $return; - } - /** - * Returns new instance of actual class. - * - * @param array $newStack Optional. Will replace old stack with new and move old one to history.c - */ - public function newInstance($newStack = null) { - $class = get_class($this); - // support inheritance by passing old object to overloaded constructor - $new = $class != 'phpQuery' - ? new $class($this, $this->getDocumentID()) - : new phpQueryObject($this->getDocumentID()); - $new->previous = $this; - if (is_null($newStack)) { - $new->elements = $this->elements; - if ($this->elementsBackup) - $this->elements = $this->elementsBackup; - } else if (is_string($newStack)) { - $new->elements = phpQuery::pq($newStack, $this->getDocumentID())->stack(); - } else { - $new->elements = $newStack; - } - return $new; - } - /** - * Enter description here... - * - * In the future, when PHP will support XLS 2.0, then we would do that this way: - * contains(tokenize(@class, '\s'), "something") - * @param unknown_type $class - * @param unknown_type $node - * @return boolean - * @access private - */ - protected function matchClasses($class, $node) { - // multi-class - if ( mb_strpos($class, '.', 1)) { - $classes = explode('.', substr($class, 1)); - $classesCount = count( $classes ); - $nodeClasses = explode(' ', $node->getAttribute('class') ); - $nodeClassesCount = count( $nodeClasses ); - if ( $classesCount > $nodeClassesCount ) - return false; - $diff = count( - array_diff( - $classes, - $nodeClasses - ) - ); - if (! $diff ) - return true; - // single-class - } else { - return in_array( - // strip leading dot from class name - substr($class, 1), - // get classes for element as array - explode(' ', $node->getAttribute('class') ) - ); - } - } - /** - * @access private - */ - protected function runQuery($XQuery, $selector = null, $compare = null) { - if ($compare && ! method_exists($this, $compare)) - return false; - $stack = array(); - if (! $this->elements) - $this->debug('Stack empty, skipping...'); -// var_dump($this->elements[0]->nodeType); - // element, document - foreach($this->stack(array(1, 9, 13)) as $k => $stackNode) { - $detachAfter = false; - // to work on detached nodes we need temporary place them somewhere - // thats because context xpath queries sucks ;] - $testNode = $stackNode; - while ($testNode) { - if (! $testNode->parentNode && ! $this->isRoot($testNode)) { - $this->root->appendChild($testNode); - $detachAfter = $testNode; - break; - } - $testNode = isset($testNode->parentNode) - ? $testNode->parentNode - : null; - } - // XXX tmp ? - $xpath = $this->documentWrapper->isXHTML - ? $this->getNodeXpath($stackNode, 'html') - : $this->getNodeXpath($stackNode); - // FIXME pseudoclasses-only query, support XML - $query = $XQuery == '//' && $xpath == '/html[1]' - ? '//*' - : $xpath.$XQuery; - $this->debug("XPATH: {$query}"); - // run query, get elements - $nodes = $this->xpath->query($query); - $this->debug("QUERY FETCHED"); - if (! $nodes->length ) - $this->debug('Nothing found'); - $debug = array(); - foreach($nodes as $node) { - $matched = false; - if ( $compare) { - phpQuery::$debug ? - $this->debug("Found: ".$this->whois( $node ).", comparing with {$compare}()") - : null; - $phpQueryDebug = phpQuery::$debug; - phpQuery::$debug = false; - // TODO ??? use phpQuery::callbackRun() - if (call_user_func_array(array($this, $compare), array($selector, $node))) - $matched = true; - phpQuery::$debug = $phpQueryDebug; - } else { - $matched = true; - } - if ( $matched) { - if (phpQuery::$debug) - $debug[] = $this->whois( $node ); - $stack[] = $node; - } - } - if (phpQuery::$debug) { - $this->debug("Matched ".count($debug).": ".implode(', ', $debug)); - } - if ($detachAfter) - $this->root->removeChild($detachAfter); - } - $this->elements = $stack; - } - /** - * Enter description here... - * - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - */ - public function find($selectors, $context = null, $noHistory = false) { - if (!$noHistory) - // backup last stack /for end()/ - $this->elementsBackup = $this->elements; - // allow to define context - // TODO combine code below with phpQuery::pq() context guessing code - // as generic function - if ($context) { - if (! is_array($context) && $context instanceof DOMELEMENT) - $this->elements = array($context); - else if (is_array($context)) { - $this->elements = array(); - foreach ($context as $c) - if ($c instanceof DOMELEMENT) - $this->elements[] = $c; - } else if ( $context instanceof self ) - $this->elements = $context->elements; - } - $queries = $this->parseSelector($selectors); - $this->debug(array('FIND', $selectors, $queries)); - $XQuery = ''; - // remember stack state because of multi-queries - $oldStack = $this->elements; - // here we will be keeping found elements - $stack = array(); - foreach($queries as $selector) { - $this->elements = $oldStack; - $delimiterBefore = false; - foreach($selector as $s) { - // TAG - $isTag = extension_loaded('mbstring') && phpQuery::$mbstringSupport - ? mb_ereg_match('^[\w|\||-]+$', $s) || $s == '*' - : preg_match('@^[\w|\||-]+$@', $s) || $s == '*'; - if ($isTag) { - if ($this->isXML()) { - // namespace support - if (mb_strpos($s, '|') !== false) { - $ns = $tag = null; - list($ns, $tag) = explode('|', $s); - $XQuery .= "$ns:$tag"; - } else if ($s == '*') { - $XQuery .= "*"; - } else { - $XQuery .= "*[local-name()='$s']"; - } - } else { - $XQuery .= $s; - } - // ID - } else if ($s[0] == '#') { - if ($delimiterBefore) - $XQuery .= '*'; - $XQuery .= "[@id='".substr($s, 1)."']"; - // ATTRIBUTES - } else if ($s[0] == '[') { - if ($delimiterBefore) - $XQuery .= '*'; - // strip side brackets - $attr = trim($s, ']['); - $execute = false; - // attr with specifed value - if (mb_strpos($s, '=')) { - $value = null; - list($attr, $value) = explode('=', $attr); - $value = trim($value, "'\""); - if ($this->isRegexp($attr)) { - // cut regexp character - $attr = substr($attr, 0, -1); - $execute = true; - $XQuery .= "[@{$attr}]"; - } else { - $XQuery .= "[@{$attr}='{$value}']"; - } - // attr without specified value - } else { - $XQuery .= "[@{$attr}]"; - } - if ($execute) { - $this->runQuery($XQuery, $s, 'is'); - $XQuery = ''; - if (! $this->length()) - break; - } - // CLASSES - } else if ($s[0] == '.') { - // TODO use return $this->find("./self::*[contains(concat(\" \",@class,\" \"), \" $class \")]"); - // thx wizDom ;) - if ($delimiterBefore) - $XQuery .= '*'; - $XQuery .= '[@class]'; - $this->runQuery($XQuery, $s, 'matchClasses'); - $XQuery = ''; - if (! $this->length() ) - break; - // ~ General Sibling Selector - } else if ($s[0] == '~') { - $this->runQuery($XQuery); - $XQuery = ''; - $this->elements = $this - ->siblings( - substr($s, 1) - )->elements; - if (! $this->length() ) - break; - // + Adjacent sibling selectors - } else if ($s[0] == '+') { - // TODO /following-sibling:: - $this->runQuery($XQuery); - $XQuery = ''; - $subSelector = substr($s, 1); - $subElements = $this->elements; - $this->elements = array(); - foreach($subElements as $node) { - // search first DOMElement sibling - $test = $node->nextSibling; - while($test && ! ($test instanceof DOMELEMENT)) - $test = $test->nextSibling; - if ($test && $this->is($subSelector, $test)) - $this->elements[] = $test; - } - if (! $this->length() ) - break; - // PSEUDO CLASSES - } else if ($s[0] == ':') { - // TODO optimization for :first :last - if ($XQuery) { - $this->runQuery($XQuery); - $XQuery = ''; - } - if (! $this->length()) - break; - $this->pseudoClasses($s); - if (! $this->length()) - break; - // DIRECT DESCENDANDS - } else if ($s == '>') { - $XQuery .= '/'; - $delimiterBefore = 2; - // ALL DESCENDANDS - } else if ($s == ' ') { - $XQuery .= '//'; - $delimiterBefore = 2; - // ERRORS - } else { - phpQuery::debug("Unrecognized token '$s'"); - } - $delimiterBefore = $delimiterBefore === 2; - } - // run query if any - if ($XQuery && $XQuery != '//') { - $this->runQuery($XQuery); - $XQuery = ''; - } - foreach($this->elements as $node) - if (! $this->elementsContainsNode($node, $stack)) - $stack[] = $node; - } - $this->elements = $stack; - return $this->newInstance(); - } - /** - * @todo create API for classes with pseudoselectors - * @access private - */ - protected function pseudoClasses($class) { - // TODO clean args parsing ? - $class = ltrim($class, ':'); - $haveArgs = mb_strpos($class, '('); - if ($haveArgs !== false) { - $args = substr($class, $haveArgs+1, -1); - $class = substr($class, 0, $haveArgs); - } - switch($class) { - case 'even': - case 'odd': - $stack = array(); - foreach($this->elements as $i => $node) { - if ($class == 'even' && ($i%2) == 0) - $stack[] = $node; - else if ( $class == 'odd' && $i % 2 ) - $stack[] = $node; - } - $this->elements = $stack; - break; - case 'eq': - $k = intval($args); - $this->elements = isset( $this->elements[$k] ) - ? array( $this->elements[$k] ) - : array(); - break; - case 'gt': - $this->elements = array_slice($this->elements, $args+1); - break; - case 'lt': - $this->elements = array_slice($this->elements, 0, $args+1); - break; - case 'first': - if (isset($this->elements[0])) - $this->elements = array($this->elements[0]); - break; - case 'last': - if ($this->elements) - $this->elements = array($this->elements[count($this->elements)-1]); - break; - /*case 'parent': - $stack = array(); - foreach($this->elements as $node) { - if ( $node->childNodes->length ) - $stack[] = $node; - } - $this->elements = $stack; - break;*/ - case 'contains': - $text = trim($args, "\"'"); - $stack = array(); - foreach($this->elements as $node) { - if (mb_stripos($node->textContent, $text) === false) - continue; - $stack[] = $node; - } - $this->elements = $stack; - break; - case 'not': - $selector = self::unQuote($args); - $this->elements = $this->not($selector)->stack(); - break; - case 'slice': - // TODO jQuery difference ? - $args = explode(',', - str_replace(', ', ',', trim($args, "\"'")) - ); - $start = $args[0]; - $end = isset($args[1]) - ? $args[1] - : null; - if ($end > 0) - $end = $end-$start; - $this->elements = array_slice($this->elements, $start, $end); - break; - case 'has': - $selector = trim($args, "\"'"); - $stack = array(); - foreach($this->stack(1) as $el) { - if ($this->find($selector, $el, true)->length) - $stack[] = $el; - } - $this->elements = $stack; - break; - case 'submit': - case 'reset': - $this->elements = phpQuery::merge( - $this->map(array($this, 'is'), - "input[type=$class]", new CallbackParam() - ), - $this->map(array($this, 'is'), - "button[type=$class]", new CallbackParam() - ) - ); - break; -// $stack = array(); -// foreach($this->elements as $node) -// if ($node->is('input[type=submit]') || $node->is('button[type=submit]')) -// $stack[] = $el; -// $this->elements = $stack; - case 'input': - $this->elements = $this->map( - array($this, 'is'), - 'input', new CallbackParam() - )->elements; - break; - case 'password': - case 'checkbox': - case 'radio': - case 'hidden': - case 'image': - case 'file': - $this->elements = $this->map( - array($this, 'is'), - "input[type=$class]", new CallbackParam() - )->elements; - break; - case 'parent': - $this->elements = $this->map( - create_function('$node', ' - return $node instanceof DOMELEMENT && $node->childNodes->length - ? $node : null;') - )->elements; - break; - case 'empty': - $this->elements = $this->map( - create_function('$node', ' - return $node instanceof DOMELEMENT && $node->childNodes->length - ? null : $node;') - )->elements; - break; - case 'disabled': - case 'selected': - case 'checked': - $this->elements = $this->map( - array($this, 'is'), - "[$class]", new CallbackParam() - )->elements; - break; - case 'enabled': - $this->elements = $this->map( - create_function('$node', ' - return pq($node)->not(":disabled") ? $node : null;') - )->elements; - break; - case 'header': - $this->elements = $this->map( - create_function('$node', - '$isHeader = isset($node->tagName) && in_array($node->tagName, array( - "h1", "h2", "h3", "h4", "h5", "h6", "h7" - )); - return $isHeader - ? $node - : null;') - )->elements; -// $this->elements = $this->map( -// create_function('$node', '$node = pq($node); -// return $node->is("h1") -// || $node->is("h2") -// || $node->is("h3") -// || $node->is("h4") -// || $node->is("h5") -// || $node->is("h6") -// || $node->is("h7") -// ? $node -// : null;') -// )->elements; - break; - case 'only-child': - $this->elements = $this->map( - create_function('$node', - 'return pq($node)->siblings()->size() == 0 ? $node : null;') - )->elements; - break; - case 'first-child': - $this->elements = $this->map( - create_function('$node', 'return pq($node)->prevAll()->size() == 0 ? $node : null;') - )->elements; - break; - case 'last-child': - $this->elements = $this->map( - create_function('$node', 'return pq($node)->nextAll()->size() == 0 ? $node : null;') - )->elements; - break; - case 'nth-child': - $param = trim($args, "\"'"); - if (! $param) - break; - // nth-child(n+b) to nth-child(1n+b) - if ($param{0} == 'n') - $param = '1'.$param; - // :nth-child(index/even/odd/equation) - if ($param == 'even' || $param == 'odd') - $mapped = $this->map( - create_function('$node, $param', - '$index = pq($node)->prevAll()->size()+1; - if ($param == "even" && ($index%2) == 0) - return $node; - else if ($param == "odd" && $index%2 == 1) - return $node; - else - return null;'), - new CallbackParam(), $param - ); - else if (mb_strlen($param) > 1 && preg_match('/^(\d*)n([-+]?)(\d*)/', $param) === 1) - // an+b - $mapped = $this->map( - create_function('$node, $param', - '$prevs = pq($node)->prevAll()->size(); - $index = 1+$prevs; - - preg_match("/^(\d*)n([-+]?)(\d*)/", $param, $matches); - $a = intval($matches[1]); - $b = intval($matches[3]); - if( $matches[2] === "-" ) { - $b = -$b; - } - - if ($a > 0) { - return ($index-$b)%$a == 0 - ? $node - : null; - phpQuery::debug($a."*".floor($index/$a)."+$b-1 == ".($a*floor($index/$a)+$b-1)." ?= $prevs"); - return $a*floor($index/$a)+$b-1 == $prevs - ? $node - : null; - } else if ($a == 0) - return $index == $b - ? $node - : null; - else - // negative value - return $index <= $b - ? $node - : null; -// if (! $b) -// return $index%$a == 0 -// ? $node -// : null; -// else -// return ($index-$b)%$a == 0 -// ? $node -// : null; - '), - new CallbackParam(), $param - ); - else - // index - $mapped = $this->map( - create_function('$node, $index', - '$prevs = pq($node)->prevAll()->size(); - if ($prevs && $prevs == $index-1) - return $node; - else if (! $prevs && $index == 1) - return $node; - else - return null;'), - new CallbackParam(), $param - ); - $this->elements = $mapped->elements; - break; - default: - $this->debug("Unknown pseudoclass '{$class}', skipping..."); - } - } - /** - * @access private - */ - protected function __pseudoClassParam($paramsString) { - // TODO; - } - /** - * Enter description here... - * - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - */ - public function is($selector, $nodes = null) { - phpQuery::debug(array("Is:", $selector)); - if (! $selector) - return false; - $oldStack = $this->elements; - $returnArray = false; - if ($nodes && is_array($nodes)) { - $this->elements = $nodes; - } else if ($nodes) - $this->elements = array($nodes); - $this->filter($selector, true); - $stack = $this->elements; - $this->elements = $oldStack; - if ($nodes) - return $stack ? $stack : null; - return (bool)count($stack); - } - /** - * Enter description here... - * jQuery difference. - * - * Callback: - * - $index int - * - $node DOMNode - * - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - * @link http://docs.jquery.com/Traversing/filter - */ - public function filterCallback($callback, $_skipHistory = false) { - if (! $_skipHistory) { - $this->elementsBackup = $this->elements; - $this->debug("Filtering by callback"); - } - $newStack = array(); - foreach($this->elements as $index => $node) { - $result = phpQuery::callbackRun($callback, array($index, $node)); - if (is_null($result) || (! is_null($result) && $result)) - $newStack[] = $node; - } - $this->elements = $newStack; - return $_skipHistory - ? $this - : $this->newInstance(); - } - /** - * Enter description here... - * - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - * @link http://docs.jquery.com/Traversing/filter - */ - public function filter($selectors, $_skipHistory = false) { - if ($selectors instanceof Callback OR $selectors instanceof Closure) - return $this->filterCallback($selectors, $_skipHistory); - if (! $_skipHistory) - $this->elementsBackup = $this->elements; - $notSimpleSelector = array(' ', '>', '~', '+', '/'); - if (! is_array($selectors)) - $selectors = $this->parseSelector($selectors); - if (! $_skipHistory) - $this->debug(array("Filtering:", $selectors)); - $finalStack = array(); - foreach($selectors as $selector) { - $stack = array(); - if (! $selector) - break; - // avoid first space or / - if (in_array($selector[0], $notSimpleSelector)) - $selector = array_slice($selector, 1); - // PER NODE selector chunks - foreach($this->stack() as $node) { - $break = false; - foreach($selector as $s) { - if (!($node instanceof DOMELEMENT)) { - // all besides DOMElement - if ( $s[0] == '[') { - $attr = trim($s, '[]'); - if ( mb_strpos($attr, '=')) { - list( $attr, $val ) = explode('=', $attr); - if ($attr == 'nodeType' && $node->nodeType != $val) - $break = true; - } - } else - $break = true; - } else { - // DOMElement only - // ID - if ( $s[0] == '#') { - if ( $node->getAttribute('id') != substr($s, 1) ) - $break = true; - // CLASSES - } else if ( $s[0] == '.') { - if (! $this->matchClasses( $s, $node ) ) - $break = true; - // ATTRS - } else if ( $s[0] == '[') { - // strip side brackets - $attr = trim($s, '[]'); - if (mb_strpos($attr, '=')) { - list($attr, $val) = explode('=', $attr); - $val = self::unQuote($val); - if ($attr == 'nodeType') { - if ($val != $node->nodeType) - $break = true; - } else if ($this->isRegexp($attr)) { - $val = extension_loaded('mbstring') && phpQuery::$mbstringSupport - ? quotemeta(trim($val, '"\'')) - : preg_quote(trim($val, '"\''), '@'); - // switch last character - switch( substr($attr, -1)) { - // quotemeta used insted of preg_quote - // http://code.google.com/p/phpquery/issues/detail?id=76 - case '^': - $pattern = '^'.$val; - break; - case '*': - $pattern = '.*'.$val.'.*'; - break; - case '$': - $pattern = '.*'.$val.'$'; - break; - } - // cut last character - $attr = substr($attr, 0, -1); - $isMatch = extension_loaded('mbstring') && phpQuery::$mbstringSupport - ? mb_ereg_match($pattern, $node->getAttribute($attr)) - : preg_match("@{$pattern}@", $node->getAttribute($attr)); - if (! $isMatch) - $break = true; - } else if ($node->getAttribute($attr) != $val) - $break = true; - } else if (! $node->hasAttribute($attr)) - $break = true; - // PSEUDO CLASSES - } else if ( $s[0] == ':') { - // skip - // TAG - } else if (trim($s)) { - if ($s != '*') { - // TODO namespaces - if (isset($node->tagName)) { - if ($node->tagName != $s) - $break = true; - } else if ($s == 'html' && ! $this->isRoot($node)) - $break = true; - } - // AVOID NON-SIMPLE SELECTORS - } else if (in_array($s, $notSimpleSelector)) { - $break = true; - $this->debug(array('Skipping non simple selector', $selector)); - } - } - if ($break) - break; - } - // if element passed all chunks of selector - add it to new stack - if (! $break ) - $stack[] = $node; - } - $tmpStack = $this->elements; - $this->elements = $stack; - // PER ALL NODES selector chunks - foreach($selector as $s) - // PSEUDO CLASSES - if ($s[0] == ':') - $this->pseudoClasses($s); - foreach($this->elements as $node) - // XXX it should be merged without duplicates - // but jQuery doesnt do that - $finalStack[] = $node; - $this->elements = $tmpStack; - } - $this->elements = $finalStack; - if ($_skipHistory) { - return $this; - } else { - $this->debug("Stack length after filter(): ".count($finalStack)); - return $this->newInstance(); - } - } - /** - * - * @param $value - * @return unknown_type - * @TODO implement in all methods using passed parameters - */ - protected static function unQuote($value) { - return $value[0] == '\'' || $value[0] == '"' - ? substr($value, 1, -1) - : $value; - } - /** - * Enter description here... - * - * @link http://docs.jquery.com/Ajax/load - * @return phpQuery|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - * @todo Support $selector - */ - public function load($url, $data = null, $callback = null) { - if ($data && ! is_array($data)) { - $callback = $data; - $data = null; - } - if (mb_strpos($url, ' ') !== false) { - $matches = null; - if (extension_loaded('mbstring') && phpQuery::$mbstringSupport) - mb_ereg('^([^ ]+) (.*)$', $url, $matches); - else - preg_match('@^([^ ]+) (.*)$@', $url, $matches); - $url = $matches[1]; - $selector = $matches[2]; - // FIXME this sucks, pass as callback param - $this->_loadSelector = $selector; - } - $ajax = array( - 'url' => $url, - 'type' => $data ? 'POST' : 'GET', - 'data' => $data, - 'complete' => $callback, - 'success' => array($this, '__loadSuccess') - ); - phpQuery::ajax($ajax); - return $this; - } - /** - * @access private - * @param $html - * @return unknown_type - */ - public function __loadSuccess($html) { - if ($this->_loadSelector) { - $html = phpQuery::newDocument($html)->find($this->_loadSelector); - unset($this->_loadSelector); - } - foreach($this->stack(1) as $node) { - phpQuery::pq($node, $this->getDocumentID()) - ->markup($html); - } - } - /** - * Enter description here... - * - * @return phpQuery|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - * @todo - */ - public function css() { - // TODO - return $this; - } - /** - * @todo - * - */ - public function show(){ - // TODO - return $this; - } - /** - * @todo - * - */ - public function hide(){ - // TODO - return $this; - } - /** - * Trigger a type of event on every matched element. - * - * @param unknown_type $type - * @param unknown_type $data - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - * @TODO support more than event in $type (space-separated) - */ - public function trigger($type, $data = array()) { - foreach($this->elements as $node) - phpQueryEvents::trigger($this->getDocumentID(), $type, $data, $node); - return $this; - } - /** - * This particular method triggers all bound event handlers on an element (for a specific event type) WITHOUT executing the browsers default actions. - * - * @param unknown_type $type - * @param unknown_type $data - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - * @TODO - */ - public function triggerHandler($type, $data = array()) { - // TODO; - } - /** - * Binds a handler to one or more events (like click) for each matched element. - * Can also bind custom events. - * - * @param unknown_type $type - * @param unknown_type $data Optional - * @param unknown_type $callback - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - * @TODO support '!' (exclusive) events - * @TODO support more than event in $type (space-separated) - */ - public function bind($type, $data, $callback = null) { - // TODO check if $data is callable, not using is_callable - if (! isset($callback)) { - $callback = $data; - $data = null; - } - foreach($this->elements as $node) - phpQueryEvents::add($this->getDocumentID(), $node, $type, $data, $callback); - return $this; - } - /** - * Enter description here... - * - * @param unknown_type $type - * @param unknown_type $callback - * @return unknown - * @TODO namespace events - * @TODO support more than event in $type (space-separated) - */ - public function unbind($type = null, $callback = null) { - foreach($this->elements as $node) - phpQueryEvents::remove($this->getDocumentID(), $node, $type, $callback); - return $this; - } - /** - * Enter description here... - * - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - */ - public function change($callback = null) { - if ($callback) - return $this->bind('change', $callback); - return $this->trigger('change'); - } - /** - * Enter description here... - * - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - */ - public function submit($callback = null) { - if ($callback) - return $this->bind('submit', $callback); - return $this->trigger('submit'); - } - /** - * Enter description here... - * - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - */ - public function click($callback = null) { - if ($callback) - return $this->bind('click', $callback); - return $this->trigger('click'); - } - /** - * Enter description here... - * - * @param String|phpQuery - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - */ - public function wrapAllOld($wrapper) { - $wrapper = pq($wrapper)->_clone(); - if (! $wrapper->length() || ! $this->length() ) - return $this; - $wrapper->insertBefore($this->elements[0]); - $deepest = $wrapper->elements[0]; - while($deepest->firstChild && $deepest->firstChild instanceof DOMELEMENT) - $deepest = $deepest->firstChild; - pq($deepest)->append($this); - return $this; - } - /** - * Enter description here... - * - * TODO testme... - * @param String|phpQuery - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - */ - public function wrapAll($wrapper) { - if (! $this->length()) - return $this; - return phpQuery::pq($wrapper, $this->getDocumentID()) - ->clone() - ->insertBefore($this->get(0)) - ->map(array($this, '___wrapAllCallback')) - ->append($this); - } - /** - * - * @param $node - * @return unknown_type - * @access private - */ - public function ___wrapAllCallback($node) { - $deepest = $node; - while($deepest->firstChild && $deepest->firstChild instanceof DOMELEMENT) - $deepest = $deepest->firstChild; - return $deepest; - } - /** - * Enter description here... - * NON JQUERY METHOD - * - * @param String|phpQuery - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - */ - public function wrapAllPHP($codeBefore, $codeAfter) { - return $this - ->slice(0, 1) - ->beforePHP($codeBefore) - ->end() - ->slice(-1) - ->afterPHP($codeAfter) - ->end(); - } - /** - * Enter description here... - * - * @param String|phpQuery - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - */ - public function wrap($wrapper) { - foreach($this->stack() as $node) - phpQuery::pq($node, $this->getDocumentID())->wrapAll($wrapper); - return $this; - } - /** - * Enter description here... - * - * @param String|phpQuery - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - */ - public function wrapPHP($codeBefore, $codeAfter) { - foreach($this->stack() as $node) - phpQuery::pq($node, $this->getDocumentID())->wrapAllPHP($codeBefore, $codeAfter); - return $this; - } - /** - * Enter description here... - * - * @param String|phpQuery - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - */ - public function wrapInner($wrapper) { - foreach($this->stack() as $node) - phpQuery::pq($node, $this->getDocumentID())->contents()->wrapAll($wrapper); - return $this; - } - /** - * Enter description here... - * - * @param String|phpQuery - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - */ - public function wrapInnerPHP($codeBefore, $codeAfter) { - foreach($this->stack(1) as $node) - phpQuery::pq($node, $this->getDocumentID())->contents() - ->wrapAllPHP($codeBefore, $codeAfter); - return $this; - } - /** - * Enter description here... - * - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - * @testme Support for text nodes - */ - public function contents() { - $stack = array(); - foreach($this->stack(1) as $el) { - // FIXME (fixed) http://code.google.com/p/phpquery/issues/detail?id=56 -// if (! isset($el->childNodes)) -// continue; - foreach($el->childNodes as $node) { - $stack[] = $node; - } - } - return $this->newInstance($stack); - } - /** - * Enter description here... - * - * jQuery difference. - * - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - */ - public function contentsUnwrap() { - foreach($this->stack(1) as $node) { - if (! $node->parentNode ) - continue; - $childNodes = array(); - // any modification in DOM tree breaks childNodes iteration, so cache them first - foreach($node->childNodes as $chNode ) - $childNodes[] = $chNode; - foreach($childNodes as $chNode ) -// $node->parentNode->appendChild($chNode); - $node->parentNode->insertBefore($chNode, $node); - $node->parentNode->removeChild($node); - } - return $this; - } - /** - * Enter description here... - * - * jQuery difference. - */ - public function switchWith($markup) { - $markup = pq($markup, $this->getDocumentID()); - $content = null; - foreach($this->stack(1) as $node) { - pq($node) - ->contents()->toReference($content)->end() - ->replaceWith($markup->clone()->append($content)); - } - return $this; - } - /** - * Enter description here... - * - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - */ - public function eq($num) { - $oldStack = $this->elements; - $this->elementsBackup = $this->elements; - $this->elements = array(); - if ( isset($oldStack[$num]) ) - $this->elements[] = $oldStack[$num]; - return $this->newInstance(); - } - /** - * Enter description here... - * - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - */ - public function size() { - return count($this->elements); - } - /** - * Enter description here... - * - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - * @deprecated Use length as attribute - */ - public function length() { - return $this->size(); - } - public function count() { - return $this->size(); - } - /** - * Enter description here... - * - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - * @todo $level - */ - public function end($level = 1) { -// $this->elements = array_pop( $this->history ); -// return $this; -// $this->previous->DOM = $this->DOM; -// $this->previous->XPath = $this->XPath; - return $this->previous - ? $this->previous - : $this; - } - /** - * Enter description here... - * Normal use ->clone() . - * - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - * @access private - */ - public function _clone() { - $newStack = array(); - //pr(array('copy... ', $this->whois())); - //$this->dumpHistory('copy'); - $this->elementsBackup = $this->elements; - foreach($this->elements as $node) { - $newStack[] = $node->cloneNode(true); - } - $this->elements = $newStack; - return $this->newInstance(); - } - /** - * Enter description here... - * - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - */ - public function replaceWithPHP($code) { - return $this->replaceWith(phpQuery::php($code)); - } - /** - * Enter description here... - * - * @param String|phpQuery $content - * @link http://docs.jquery.com/Manipulation/replaceWith#content - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - */ - public function replaceWith($content) { - return $this->after($content)->remove(); - } - /** - * Enter description here... - * - * @param String $selector - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - * @todo this works ? - */ - public function replaceAll($selector) { - foreach(phpQuery::pq($selector, $this->getDocumentID()) as $node) - phpQuery::pq($node, $this->getDocumentID()) - ->after($this->_clone()) - ->remove(); - return $this; - } - /** - * Enter description here... - * - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - */ - public function remove($selector = null) { - $loop = $selector - ? $this->filter($selector)->elements - : $this->elements; - foreach($loop as $node) { - if (! $node->parentNode ) - continue; - if (isset($node->tagName)) - $this->debug("Removing '{$node->tagName}'"); - $node->parentNode->removeChild($node); - // Mutation event - $event = new DOMEvent(array( - 'target' => $node, - 'type' => 'DOMNodeRemoved' - )); - phpQueryEvents::trigger($this->getDocumentID(), - $event->type, array($event), $node - ); - } - return $this; - } - protected function markupEvents($newMarkup, $oldMarkup, $node) { - if ($node->tagName == 'textarea' && $newMarkup != $oldMarkup) { - $event = new DOMEvent(array( - 'target' => $node, - 'type' => 'change' - )); - phpQueryEvents::trigger($this->getDocumentID(), - $event->type, array($event), $node - ); - } - } - /** - * jQuey difference - * - * @param $markup - * @return unknown_type - * @TODO trigger change event for textarea - */ - public function markup($markup = null, $callback1 = null, $callback2 = null, $callback3 = null) { - $args = func_get_args(); - if ($this->documentWrapper->isXML) - return call_user_func_array(array($this, 'xml'), $args); - else - return call_user_func_array(array($this, 'html'), $args); - } - /** - * jQuey difference - * - * @param $markup - * @return unknown_type - */ - public function markupOuter($callback1 = null, $callback2 = null, $callback3 = null) { - $args = func_get_args(); - if ($this->documentWrapper->isXML) - return call_user_func_array(array($this, 'xmlOuter'), $args); - else - return call_user_func_array(array($this, 'htmlOuter'), $args); - } - /** - * Enter description here... - * - * @param unknown_type $html - * @return string|phpQuery|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - * @TODO force html result - */ - public function html($html = null, $callback1 = null, $callback2 = null, $callback3 = null) { - if (isset($html)) { - // INSERT - $nodes = $this->documentWrapper->import($html); - $this->empty(); - foreach($this->stack(1) as $alreadyAdded => $node) { - // for now, limit events for textarea - if (($this->isXHTML() || $this->isHTML()) && $node->tagName == 'textarea') - $oldHtml = pq($node, $this->getDocumentID())->markup(); - foreach($nodes as $newNode) { - $node->appendChild($alreadyAdded - ? $newNode->cloneNode(true) - : $newNode - ); - } - // for now, limit events for textarea - if (($this->isXHTML() || $this->isHTML()) && $node->tagName == 'textarea') - $this->markupEvents($html, $oldHtml, $node); - } - return $this; - } else { - // FETCH - $return = $this->documentWrapper->markup($this->elements, true); - $args = func_get_args(); - foreach(array_slice($args, 1) as $callback) { - $return = phpQuery::callbackRun($callback, array($return)); - } - return $return; - } - } - /** - * @TODO force xml result - */ - public function xml($xml = null, $callback1 = null, $callback2 = null, $callback3 = null) { - $args = func_get_args(); - return call_user_func_array(array($this, 'html'), $args); - } - /** - * Enter description here... - * @TODO force html result - * - * @return String - */ - public function htmlOuter($callback1 = null, $callback2 = null, $callback3 = null) { - $markup = $this->documentWrapper->markup($this->elements); - // pass thou callbacks - $args = func_get_args(); - foreach($args as $callback) { - $markup = phpQuery::callbackRun($callback, array($markup)); - } - return $markup; - } - /** - * @TODO force xml result - */ - public function xmlOuter($callback1 = null, $callback2 = null, $callback3 = null) { - $args = func_get_args(); - return call_user_func_array(array($this, 'htmlOuter'), $args); - } - public function __toString() { - return $this->markupOuter(); - } - /** - * Just like html(), but returns markup with VALID (dangerous) PHP tags. - * - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - * @todo support returning markup with PHP tags when called without param - */ - public function php($code = null) { - return $this->markupPHP($code); - } - /** - * Enter description here... - * - * @param $code - * @return unknown_type - */ - public function markupPHP($code = null) { - return isset($code) - ? $this->markup(phpQuery::php($code)) - : phpQuery::markupToPHP($this->markup()); - } - /** - * Enter description here... - * - * @param $code - * @return unknown_type - */ - public function markupOuterPHP() { - return phpQuery::markupToPHP($this->markupOuter()); - } - /** - * Enter description here... - * - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - */ - public function children($selector = null) { - $stack = array(); - foreach($this->stack(1) as $node) { -// foreach($node->getElementsByTagName('*') as $newNode) { - foreach($node->childNodes as $newNode) { - if ($newNode->nodeType != 1) - continue; - if ($selector && ! $this->is($selector, $newNode)) - continue; - if ($this->elementsContainsNode($newNode, $stack)) - continue; - $stack[] = $newNode; - } - } - $this->elementsBackup = $this->elements; - $this->elements = $stack; - return $this->newInstance(); - } - /** - * Enter description here... - * - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - */ - public function ancestors($selector = null) { - return $this->children( $selector ); - } - /** - * Enter description here... - * - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - */ - public function append( $content) { - return $this->insert($content, __FUNCTION__); - } - /** - * Enter description here... - * - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - */ - public function appendPHP( $content) { - return $this->insert("", 'append'); - } - /** - * Enter description here... - * - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - */ - public function appendTo( $seletor) { - return $this->insert($seletor, __FUNCTION__); - } - /** - * Enter description here... - * - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - */ - public function prepend( $content) { - return $this->insert($content, __FUNCTION__); - } - /** - * Enter description here... - * - * @todo accept many arguments, which are joined, arrays maybe also - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - */ - public function prependPHP( $content) { - return $this->insert("", 'prepend'); - } - /** - * Enter description here... - * - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - */ - public function prependTo( $seletor) { - return $this->insert($seletor, __FUNCTION__); - } - /** - * Enter description here... - * - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - */ - public function before($content) { - return $this->insert($content, __FUNCTION__); - } - /** - * Enter description here... - * - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - */ - public function beforePHP( $content) { - return $this->insert("", 'before'); - } - /** - * Enter description here... - * - * @param String|phpQuery - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - */ - public function insertBefore( $seletor) { - return $this->insert($seletor, __FUNCTION__); - } - /** - * Enter description here... - * - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - */ - public function after( $content) { - return $this->insert($content, __FUNCTION__); - } - /** - * Enter description here... - * - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - */ - public function afterPHP( $content) { - return $this->insert("", 'after'); - } - /** - * Enter description here... - * - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - */ - public function insertAfter( $seletor) { - return $this->insert($seletor, __FUNCTION__); - } - /** - * Internal insert method. Don't use it. - * - * @param unknown_type $target - * @param unknown_type $type - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - * @access private - */ - public function insert($target, $type) { - $this->debug("Inserting data with '{$type}'"); - $to = false; - switch( $type) { - case 'appendTo': - case 'prependTo': - case 'insertBefore': - case 'insertAfter': - $to = true; - } - switch(gettype($target)) { - case 'string': - $insertFrom = $insertTo = array(); - if ($to) { - // INSERT TO - $insertFrom = $this->elements; - if (phpQuery::isMarkup($target)) { - // $target is new markup, import it - $insertTo = $this->documentWrapper->import($target); - // insert into selected element - } else { - // $tagret is a selector - $thisStack = $this->elements; - $this->toRoot(); - $insertTo = $this->find($target)->elements; - $this->elements = $thisStack; - } - } else { - // INSERT FROM - $insertTo = $this->elements; - $insertFrom = $this->documentWrapper->import($target); - } - break; - case 'object': - $insertFrom = $insertTo = array(); - // phpQuery - if ($target instanceof self) { - if ($to) { - $insertTo = $target->elements; - if ($this->documentFragment && $this->stackIsRoot()) - // get all body children -// $loop = $this->find('body > *')->elements; - // TODO test it, test it hard... -// $loop = $this->newInstance($this->root)->find('> *')->elements; - $loop = $this->root->childNodes; - else - $loop = $this->elements; - // import nodes if needed - $insertFrom = $this->getDocumentID() == $target->getDocumentID() - ? $loop - : $target->documentWrapper->import($loop); - } else { - $insertTo = $this->elements; - if ( $target->documentFragment && $target->stackIsRoot() ) - // get all body children -// $loop = $target->find('body > *')->elements; - $loop = $target->root->childNodes; - else - $loop = $target->elements; - // import nodes if needed - $insertFrom = $this->getDocumentID() == $target->getDocumentID() - ? $loop - : $this->documentWrapper->import($loop); - } - // DOMNODE - } elseif ($target instanceof DOMNODE) { - // import node if needed -// if ( $target->ownerDocument != $this->DOM ) -// $target = $this->DOM->importNode($target, true); - if ( $to) { - $insertTo = array($target); - if ($this->documentFragment && $this->stackIsRoot()) - // get all body children - $loop = $this->root->childNodes; -// $loop = $this->find('body > *')->elements; - else - $loop = $this->elements; - foreach($loop as $fromNode) - // import nodes if needed - $insertFrom[] = ! $fromNode->ownerDocument->isSameNode($target->ownerDocument) - ? $target->ownerDocument->importNode($fromNode, true) - : $fromNode; - } else { - // import node if needed - if (! $target->ownerDocument->isSameNode($this->document)) - $target = $this->document->importNode($target, true); - $insertTo = $this->elements; - $insertFrom[] = $target; - } - } - break; - } - phpQuery::debug("From ".count($insertFrom)."; To ".count($insertTo)." nodes"); - foreach($insertTo as $insertNumber => $toNode) { - // we need static relative elements in some cases - switch( $type) { - case 'prependTo': - case 'prepend': - $firstChild = $toNode->firstChild; - break; - case 'insertAfter': - case 'after': - $nextSibling = $toNode->nextSibling; - break; - } - foreach($insertFrom as $fromNode) { - // clone if inserted already before - $insert = $insertNumber - ? $fromNode->cloneNode(true) - : $fromNode; - switch($type) { - case 'appendTo': - case 'append': -// $toNode->insertBefore( -// $fromNode, -// $toNode->lastChild->nextSibling -// ); - $toNode->appendChild($insert); - $eventTarget = $insert; - break; - case 'prependTo': - case 'prepend': - $toNode->insertBefore( - $insert, - $firstChild - ); - break; - case 'insertBefore': - case 'before': - if (! $toNode->parentNode) - throw new Exception("No parentNode, can't do {$type}()"); - else - $toNode->parentNode->insertBefore( - $insert, - $toNode - ); - break; - case 'insertAfter': - case 'after': - if (! $toNode->parentNode) - throw new Exception("No parentNode, can't do {$type}()"); - else - $toNode->parentNode->insertBefore( - $insert, - $nextSibling - ); - break; - } - // Mutation event - $event = new DOMEvent(array( - 'target' => $insert, - 'type' => 'DOMNodeInserted' - )); - phpQueryEvents::trigger($this->getDocumentID(), - $event->type, array($event), $insert - ); - } - } - return $this; - } - /** - * Enter description here... - * - * @return Int - */ - public function index($subject) { - $index = -1; - $subject = $subject instanceof phpQueryObject - ? $subject->elements[0] - : $subject; - foreach($this->newInstance() as $k => $node) { - if ($node->isSameNode($subject)) - $index = $k; - } - return $index; - } - /** - * Enter description here... - * - * @param unknown_type $start - * @param unknown_type $end - * - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - * @testme - */ - public function slice($start, $end = null) { -// $last = count($this->elements)-1; -// $end = $end -// ? min($end, $last) -// : $last; -// if ($start < 0) -// $start = $last+$start; -// if ($start > $last) -// return array(); - if ($end > 0) - $end = $end-$start; - return $this->newInstance( - array_slice($this->elements, $start, $end) - ); - } - /** - * Enter description here... - * - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - */ - public function reverse() { - $this->elementsBackup = $this->elements; - $this->elements = array_reverse($this->elements); - return $this->newInstance(); - } - /** - * Return joined text content. - * @return String - */ - public function text($text = null, $callback1 = null, $callback2 = null, $callback3 = null) { - if (isset($text)) - return $this->html(htmlspecialchars($text)); - $args = func_get_args(); - $args = array_slice($args, 1); - $return = ''; - foreach($this->elements as $node) { - $text = $node->textContent; - if (count($this->elements) > 1 && $text) - $text .= "\n"; - foreach($args as $callback) { - $text = phpQuery::callbackRun($callback, array($text)); - } - $return .= $text; - } - return $return; - } - - /** - * @return The text content of each matching element, like - * text() but returns an array with one entry per matched element. - * Read only. - */ - public function texts($attr = null) { - $results = array(); - foreach($this->elements as $node) { - $results[] = $node->textContent; - } - return $results; - } - - /** - * Enter description here... - * - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - */ - public function plugin($class, $file = null) { - phpQuery::plugin($class, $file); - return $this; - } - /** - * Deprecated, use $pq->plugin() instead. - * - * @deprecated - * @param $class - * @param $file - * @return unknown_type - */ - public static function extend($class, $file = null) { - return $this->plugin($class, $file); - } - /** - * - * @access private - * @param $method - * @param $args - * @return unknown_type - */ - public function __call($method, $args) { - $aliasMethods = array('clone', 'empty'); - if (isset(phpQuery::$extendMethods[$method])) { - array_unshift($args, $this); - return phpQuery::callbackRun( - phpQuery::$extendMethods[$method], $args - ); - } else if (isset(phpQuery::$pluginsMethods[$method])) { - array_unshift($args, $this); - $class = phpQuery::$pluginsMethods[$method]; - $realClass = "phpQueryObjectPlugin_$class"; - $return = call_user_func_array( - array($realClass, $method), - $args - ); - // XXX deprecate ? - return is_null($return) - ? $this - : $return; - } else if (in_array($method, $aliasMethods)) { - return call_user_func_array(array($this, '_'.$method), $args); - } else - throw new Exception("Method '{$method}' doesnt exist"); - } - /** - * Safe rename of next(). - * - * Use it ONLY when need to call next() on an iterated object (in same time). - * Normaly there is no need to do such thing ;) - * - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - * @access private - */ - public function _next($selector = null) { - return $this->newInstance( - $this->getElementSiblings('nextSibling', $selector, true) - ); - } - /** - * Use prev() and next(). - * - * @deprecated - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - * @access private - */ - public function _prev($selector = null) { - return $this->prev($selector); - } - /** - * Enter description here... - * - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - */ - public function prev($selector = null) { - return $this->newInstance( - $this->getElementSiblings('previousSibling', $selector, true) - ); - } - /** - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - * @todo - */ - public function prevAll($selector = null) { - return $this->newInstance( - $this->getElementSiblings('previousSibling', $selector) - ); - } - /** - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - * @todo FIXME: returns source elements insted of next siblings - */ - public function nextAll($selector = null) { - return $this->newInstance( - $this->getElementSiblings('nextSibling', $selector) - ); - } - /** - * @access private - */ - protected function getElementSiblings($direction, $selector = null, $limitToOne = false) { - $stack = array(); - $count = 0; - foreach($this->stack() as $node) { - $test = $node; - while( isset($test->{$direction}) && $test->{$direction}) { - $test = $test->{$direction}; - if (! $test instanceof DOMELEMENT) - continue; - $stack[] = $test; - if ($limitToOne) - break; - } - } - if ($selector) { - $stackOld = $this->elements; - $this->elements = $stack; - $stack = $this->filter($selector, true)->stack(); - $this->elements = $stackOld; - } - return $stack; - } - /** - * Enter description here... - * - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - */ - public function siblings($selector = null) { - $stack = array(); - $siblings = array_merge( - $this->getElementSiblings('previousSibling', $selector), - $this->getElementSiblings('nextSibling', $selector) - ); - foreach($siblings as $node) { - if (! $this->elementsContainsNode($node, $stack)) - $stack[] = $node; - } - return $this->newInstance($stack); - } - /** - * Enter description here... - * - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - */ - public function not($selector = null) { - if (is_string($selector)) - phpQuery::debug(array('not', $selector)); - else - phpQuery::debug('not'); - $stack = array(); - if ($selector instanceof self || $selector instanceof DOMNODE) { - foreach($this->stack() as $node) { - if ($selector instanceof self) { - $matchFound = false; - foreach($selector->stack() as $notNode) { - if ($notNode->isSameNode($node)) - $matchFound = true; - } - if (! $matchFound) - $stack[] = $node; - } else if ($selector instanceof DOMNODE) { - if (! $selector->isSameNode($node)) - $stack[] = $node; - } else { - if (! $this->is($selector)) - $stack[] = $node; - } - } - } else { - $orgStack = $this->stack(); - $matched = $this->filter($selector, true)->stack(); -// $matched = array(); -// // simulate OR in filter() instead of AND 5y -// foreach($this->parseSelector($selector) as $s) { -// $matched = array_merge($matched, -// $this->filter(array($s))->stack() -// ); -// } - foreach($orgStack as $node) - if (! $this->elementsContainsNode($node, $matched)) - $stack[] = $node; - } - return $this->newInstance($stack); - } - /** - * Enter description here... - * - * @param string|phpQueryObject - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - */ - public function add($selector = null) { - if (! $selector) - return $this; - $stack = array(); - $this->elementsBackup = $this->elements; - $found = phpQuery::pq($selector, $this->getDocumentID()); - $this->merge($found->elements); - return $this->newInstance(); - } - /** - * @access private - */ - protected function merge() { - foreach(func_get_args() as $nodes) - foreach($nodes as $newNode ) - if (! $this->elementsContainsNode($newNode) ) - $this->elements[] = $newNode; - } - /** - * @access private - * TODO refactor to stackContainsNode - */ - protected function elementsContainsNode($nodeToCheck, $elementsStack = null) { - $loop = ! is_null($elementsStack) - ? $elementsStack - : $this->elements; - foreach($loop as $node) { - if ( $node->isSameNode( $nodeToCheck ) ) - return true; - } - return false; - } - /** - * Enter description here... - * - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - */ - public function parent($selector = null) { - $stack = array(); - foreach($this->elements as $node ) - if ( $node->parentNode && ! $this->elementsContainsNode($node->parentNode, $stack) ) - $stack[] = $node->parentNode; - $this->elementsBackup = $this->elements; - $this->elements = $stack; - if ( $selector ) - $this->filter($selector, true); - return $this->newInstance(); - } - /** - * Enter description here... - * - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - */ - public function parents($selector = null) { - $stack = array(); - if (! $this->elements ) - $this->debug('parents() - stack empty'); - foreach($this->elements as $node) { - $test = $node; - while( $test->parentNode) { - $test = $test->parentNode; - if ($this->isRoot($test)) - break; - if (! $this->elementsContainsNode($test, $stack)) { - $stack[] = $test; - continue; - } - } - } - $this->elementsBackup = $this->elements; - $this->elements = $stack; - if ( $selector ) - $this->filter($selector, true); - return $this->newInstance(); - } - /** - * Internal stack iterator. - * - * @access private - * @return {Array.} - */ - public function stack($nodeTypes = null) { - if (!isset($nodeTypes)) - return $this->elements; - if (!is_array($nodeTypes)) - $nodeTypes = array($nodeTypes); - $return = array(); - foreach($this->elements as $node) { - if (in_array($node->nodeType, $nodeTypes)) - $return[] = $node; - } - return $return; - } - // TODO phpdoc; $oldAttr is result of hasAttribute, before any changes - protected function attrEvents($attr, $oldAttr, $oldValue, $node) { - // skip events for XML documents - if (! $this->isXHTML() && ! $this->isHTML()) - return; - $event = null; - // identify - $isInputValue = $node->tagName == 'input' - && ( - in_array($node->getAttribute('type'), - array('text', 'password', 'hidden')) - || !$node->getAttribute('type') - ); - $isRadio = $node->tagName == 'input' - && $node->getAttribute('type') == 'radio'; - $isCheckbox = $node->tagName == 'input' - && $node->getAttribute('type') == 'checkbox'; - $isOption = $node->tagName == 'option'; - if ($isInputValue && $attr == 'value' && $oldValue != $node->getAttribute($attr)) { - $event = new DOMEvent(array( - 'target' => $node, - 'type' => 'change' - )); - } else if (($isRadio || $isCheckbox) && $attr == 'checked' && ( - // check - (! $oldAttr && $node->hasAttribute($attr)) - // un-check - || (! $node->hasAttribute($attr) && $oldAttr) - )) { - $event = new DOMEvent(array( - 'target' => $node, - 'type' => 'change' - )); - } else if ($isOption && $node->parentNode && $attr == 'selected' && ( - // select - (! $oldAttr && $node->hasAttribute($attr)) - // un-select - || (! $node->hasAttribute($attr) && $oldAttr) - )) { - $event = new DOMEvent(array( - 'target' => $node->parentNode, - 'type' => 'change' - )); - } - if ($event) { - phpQueryEvents::trigger($this->getDocumentID(), - $event->type, array($event), $node - ); - } - } - public function attr($attr = null, $value = null) { - foreach($this->stack(1) as $node) { - if (! is_null($value)) { - $loop = $attr == '*' - ? $this->getNodeAttrs($node) - : array($attr); - foreach($loop as $a) { - $oldValue = $node->getAttribute($a); - $oldAttr = $node->hasAttribute($a); - // TODO raises an error when charset other than UTF-8 - // while document's charset is also not UTF-8 - @$node->setAttribute($a, $value); - $this->attrEvents($a, $oldAttr, $oldValue, $node); - } - } else if ($attr == '*') { - // jQuery difference - $return = array(); - foreach($node->attributes as $n => $v) - $return[$n] = $v->value; - return $return; - } else - return $node->hasAttribute($attr) - ? $node->getAttribute($attr) - : null; - } - return is_null($value) - ? '' : $this; - } - - /** - * @return The same attribute of each matching element, like - * attr() but returns an array with one entry per matched element. - * Read only. - */ - public function attrs($attr = null) { - $results = array(); - foreach($this->stack(1) as $node) { - $results[] = $node->hasAttribute($attr) - ? $node->getAttribute($attr) - : null; - } - return $results; - } - - /** - * @access private - */ - protected function getNodeAttrs($node) { - $return = array(); - foreach($node->attributes as $n => $o) - $return[] = $n; - return $return; - } - /** - * Enter description here... - * - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - * @todo check CDATA ??? - */ - public function attrPHP($attr, $code) { - if (! is_null($code)) { - $value = '<'.'?php '.$code.' ?'.'>'; - // TODO tempolary solution - // http://code.google.com/p/phpquery/issues/detail?id=17 -// if (function_exists('mb_detect_encoding') && mb_detect_encoding($value) == 'ASCII') -// $value = mb_convert_encoding($value, 'UTF-8', 'HTML-ENTITIES'); - } - foreach($this->stack(1) as $node) { - if (! is_null($code)) { -// $attrNode = $this->DOM->createAttribute($attr); - $node->setAttribute($attr, $value); -// $attrNode->value = $value; -// $node->appendChild($attrNode); - } else if ( $attr == '*') { - // jQuery diff - $return = array(); - foreach($node->attributes as $n => $v) - $return[$n] = $v->value; - return $return; - } else - return $node->getAttribute($attr); - } - return $this; - } - /** - * Enter description here... - * - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - */ - public function removeAttr($attr) { - foreach($this->stack(1) as $node) { - $loop = $attr == '*' - ? $this->getNodeAttrs($node) - : array($attr); - foreach($loop as $a) { - $oldValue = $node->getAttribute($a); - $node->removeAttribute($a); - $this->attrEvents($a, $oldValue, null, $node); - } - } - return $this; - } - /** - * Return form element value. - * - * @return String Fields value. - */ - public function val($val = null) { - if (! isset($val)) { - if ($this->eq(0)->is('select')) { - $selected = $this->eq(0)->find('option[selected=selected]'); - if ($selected->is('[value]')) - return $selected->attr('value'); - else - return $selected->text(); - } else if ($this->eq(0)->is('textarea')) - return $this->eq(0)->markup(); - else - return $this->eq(0)->attr('value'); - } else { - $_val = null; - foreach($this->stack(1) as $node) { - $node = pq($node, $this->getDocumentID()); - if (is_array($val) && in_array($node->attr('type'), array('checkbox', 'radio'))) { - $isChecked = in_array($node->attr('value'), $val) - || in_array($node->attr('name'), $val); - if ($isChecked) - $node->attr('checked', 'checked'); - else - $node->removeAttr('checked'); - } else if ($node->get(0)->tagName == 'select') { - if (! isset($_val)) { - $_val = array(); - if (! is_array($val)) - $_val = array((string)$val); - else - foreach($val as $v) - $_val[] = $v; - } - foreach($node['option']->stack(1) as $option) { - $option = pq($option, $this->getDocumentID()); - $selected = false; - // XXX: workaround for string comparsion, see issue #96 - // http://code.google.com/p/phpquery/issues/detail?id=96 - $selected = is_null($option->attr('value')) - ? in_array($option->markup(), $_val) - : in_array($option->attr('value'), $_val); -// $optionValue = $option->attr('value'); -// $optionText = $option->text(); -// $optionTextLenght = mb_strlen($optionText); -// foreach($_val as $v) -// if ($optionValue == $v) -// $selected = true; -// else if ($optionText == $v && $optionTextLenght == mb_strlen($v)) -// $selected = true; - if ($selected) - $option->attr('selected', 'selected'); - else - $option->removeAttr('selected'); - } - } else if ($node->get(0)->tagName == 'textarea') - $node->markup($val); - else - $node->attr('value', $val); - } - } - return $this; - } - /** - * Enter description here... - * - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - */ - public function andSelf() { - if ( $this->previous ) - $this->elements = array_merge($this->elements, $this->previous->elements); - return $this; - } - /** - * Enter description here... - * - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - */ - public function addClass( $className) { - if (! $className) - return $this; - foreach($this->stack(1) as $node) { - if (! $this->is(".$className", $node)) - $node->setAttribute( - 'class', - trim($node->getAttribute('class').' '.$className) - ); - } - return $this; - } - /** - * Enter description here... - * - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - */ - public function addClassPHP( $className) { - foreach($this->stack(1) as $node) { - $classes = $node->getAttribute('class'); - $newValue = $classes - ? $classes.' <'.'?php '.$className.' ?'.'>' - : '<'.'?php '.$className.' ?'.'>'; - $node->setAttribute('class', $newValue); - } - return $this; - } - /** - * Enter description here... - * - * @param string $className - * @return bool - */ - public function hasClass($className) { - foreach($this->stack(1) as $node) { - if ( $this->is(".$className", $node)) - return true; - } - return false; - } - /** - * Enter description here... - * - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - */ - public function removeClass($className) { - foreach($this->stack(1) as $node) { - $classes = explode( ' ', $node->getAttribute('class')); - if ( in_array($className, $classes)) { - $classes = array_diff($classes, array($className)); - if ( $classes ) - $node->setAttribute('class', implode(' ', $classes)); - else - $node->removeAttribute('class'); - } - } - return $this; - } - /** - * Enter description here... - * - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - */ - public function toggleClass($className) { - foreach($this->stack(1) as $node) { - if ( $this->is( $node, '.'.$className )) - $this->removeClass($className); - else - $this->addClass($className); - } - return $this; - } - /** - * Proper name without underscore (just ->empty()) also works. - * - * Removes all child nodes from the set of matched elements. - * - * Example: - * pq("p")._empty() - * - * HTML: - *

    Hello, Person and person

    - * - * Result: - * [

    ] - * - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - * @access private - */ - public function _empty() { - foreach($this->stack(1) as $node) { - // thx to 'dave at dgx dot cz' - $node->nodeValue = ''; - } - return $this; - } - /** - * Enter description here... - * - * @param array|string $callback Expects $node as first param, $index as second - * @param array $scope External variables passed to callback. Use compact('varName1', 'varName2'...) and extract($scope) - * @param array $arg1 Will ba passed as third and futher args to callback. - * @param array $arg2 Will ba passed as fourth and futher args to callback, and so on... - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - */ - public function each($callback, $param1 = null, $param2 = null, $param3 = null) { - $paramStructure = null; - if (func_num_args() > 1) { - $paramStructure = func_get_args(); - $paramStructure = array_slice($paramStructure, 1); - } - foreach($this->elements as $v) - phpQuery::callbackRun($callback, array($v), $paramStructure); - return $this; - } - /** - * Run callback on actual object. - * - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - */ - public function callback($callback, $param1 = null, $param2 = null, $param3 = null) { - $params = func_get_args(); - $params[0] = $this; - phpQuery::callbackRun($callback, $params); - return $this; - } - /** - * Enter description here... - * - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - * @todo add $scope and $args as in each() ??? - */ - public function map($callback, $param1 = null, $param2 = null, $param3 = null) { -// $stack = array(); -//// foreach($this->newInstance() as $node) { -// foreach($this->newInstance() as $node) { -// $result = call_user_func($callback, $node); -// if ($result) -// $stack[] = $result; -// } - $params = func_get_args(); - array_unshift($params, $this->elements); - return $this->newInstance( - call_user_func_array(array('phpQuery', 'map'), $params) -// phpQuery::map($this->elements, $callback) - ); - } - /** - * Enter description here... - * - * @param $key - * @param $value - */ - public function data($key, $value = null) { - if (! isset($value)) { - // TODO? implement specific jQuery behavior od returning parent values - // is child which we look up doesn't exist - return phpQuery::data($this->get(0), $key, $value, $this->getDocumentID()); - } else { - foreach($this as $node) - phpQuery::data($node, $key, $value, $this->getDocumentID()); - return $this; - } - } - /** - * Enter description here... - * - * @param $key - */ - public function removeData($key) { - foreach($this as $node) - phpQuery::removeData($node, $key, $this->getDocumentID()); - return $this; - } - // INTERFACE IMPLEMENTATIONS - - // ITERATOR INTERFACE - /** - * @access private - */ - public function rewind(){ - $this->debug('iterating foreach'); -// phpQuery::selectDocument($this->getDocumentID()); - $this->elementsBackup = $this->elements; - $this->elementsInterator = $this->elements; - $this->valid = isset( $this->elements[0] ) - ? 1 : 0; -// $this->elements = $this->valid -// ? array($this->elements[0]) -// : array(); - $this->current = 0; - } - /** - * @access private - */ - public function current(){ - return $this->elementsInterator[ $this->current ]; - } - /** - * @access private - */ - public function key(){ - return $this->current; - } - /** - * Double-function method. - * - * First: main iterator interface method. - * Second: Returning next sibling, alias for _next(). - * - * Proper functionality is choosed automagicaly. - * - * @see phpQueryObject::_next() - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - */ - public function next($cssSelector = null){ -// if ($cssSelector || $this->valid) -// return $this->_next($cssSelector); - $this->valid = isset( $this->elementsInterator[ $this->current+1 ] ) - ? true - : false; - if (! $this->valid && $this->elementsInterator) { - $this->elementsInterator = null; - } else if ($this->valid) { - $this->current++; - } else { - return $this->_next($cssSelector); - } - } - /** - * @access private - */ - public function valid(){ - return $this->valid; - } - // ITERATOR INTERFACE END - // ARRAYACCESS INTERFACE - /** - * @access private - */ - public function offsetExists($offset) { - return $this->find($offset)->size() > 0; - } - /** - * @access private - */ - public function offsetGet($offset) { - return $this->find($offset); - } - /** - * @access private - */ - public function offsetSet($offset, $value) { -// $this->find($offset)->replaceWith($value); - $this->find($offset)->html($value); - } - /** - * @access private - */ - public function offsetUnset($offset) { - // empty - throw new Exception("Can't do unset, use array interface only for calling queries and replacing HTML."); - } - // ARRAYACCESS INTERFACE END - /** - * Returns node's XPath. - * - * @param unknown_type $oneNode - * @return string - * @TODO use native getNodePath is avaible - * @access private - */ - protected function getNodeXpath($oneNode = null, $namespace = null) { - $return = array(); - $loop = $oneNode - ? array($oneNode) - : $this->elements; -// if ($namespace) -// $namespace .= ':'; - foreach($loop as $node) { - if ($node instanceof DOMDOCUMENT) { - $return[] = ''; - continue; - } - $xpath = array(); - while(! ($node instanceof DOMDOCUMENT)) { - $i = 1; - $sibling = $node; - while($sibling->previousSibling) { - $sibling = $sibling->previousSibling; - $isElement = $sibling instanceof DOMELEMENT; - if ($isElement && $sibling->tagName == $node->tagName) - $i++; - } - $xpath[] = $this->isXML() - ? "*[local-name()='{$node->tagName}'][{$i}]" - : "{$node->tagName}[{$i}]"; - $node = $node->parentNode; - } - $xpath = join('/', array_reverse($xpath)); - $return[] = '/'.$xpath; - } - return $oneNode - ? $return[0] - : $return; - } - // HELPERS - public function whois($oneNode = null) { - $return = array(); - $loop = $oneNode - ? array( $oneNode ) - : $this->elements; - foreach($loop as $node) { - if (isset($node->tagName)) { - $tag = in_array($node->tagName, array('php', 'js')) - ? strtoupper($node->tagName) - : $node->tagName; - $return[] = $tag - .($node->getAttribute('id') - ? '#'.$node->getAttribute('id'):'') - .($node->getAttribute('class') - ? '.'.join('.', split(' ', $node->getAttribute('class'))):'') - .($node->getAttribute('name') - ? '[name="'.$node->getAttribute('name').'"]':'') - .($node->getAttribute('value') && strpos($node->getAttribute('value'), '<'.'?php') === false - ? '[value="'.substr(str_replace("\n", '', $node->getAttribute('value')), 0, 15).'"]':'') - .($node->getAttribute('value') && strpos($node->getAttribute('value'), '<'.'?php') !== false - ? '[value=PHP]':'') - .($node->getAttribute('selected') - ? '[selected]':'') - .($node->getAttribute('checked') - ? '[checked]':'') - ; - } else if ($node instanceof DOMTEXT) { - if (trim($node->textContent)) - $return[] = 'Text:'.substr(str_replace("\n", ' ', $node->textContent), 0, 15); - } else { - - } - } - return $oneNode && isset($return[0]) - ? $return[0] - : $return; - } - /** - * Dump htmlOuter and preserve chain. Usefull for debugging. - * - * @return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery - * - */ - public function dump() { - print 'DUMP #'.(phpQuery::$dumpCount++).' '; - $debug = phpQuery::$debug; - phpQuery::$debug = false; -// print __FILE__.':'.__LINE__."\n"; - var_dump($this->htmlOuter()); - return $this; - } - public function dumpWhois() { - print 'DUMP #'.(phpQuery::$dumpCount++).' '; - $debug = phpQuery::$debug; - phpQuery::$debug = false; -// print __FILE__.':'.__LINE__."\n"; - var_dump('whois', $this->whois()); - phpQuery::$debug = $debug; - return $this; - } - public function dumpLength() { - print 'DUMP #'.(phpQuery::$dumpCount++).' '; - $debug = phpQuery::$debug; - phpQuery::$debug = false; -// print __FILE__.':'.__LINE__."\n"; - var_dump('length', $this->length()); - phpQuery::$debug = $debug; - return $this; - } - public function dumpTree($html = true, $title = true) { - $output = $title - ? 'DUMP #'.(phpQuery::$dumpCount++)." \n" : ''; - $debug = phpQuery::$debug; - phpQuery::$debug = false; - foreach($this->stack() as $node) - $output .= $this->__dumpTree($node); - phpQuery::$debug = $debug; - print $html - ? nl2br(str_replace(' ', ' ', $output)) - : $output; - return $this; - } - private function __dumpTree($node, $intend = 0) { - $whois = $this->whois($node); - $return = ''; - if ($whois) - $return .= str_repeat(' - ', $intend).$whois."\n"; - if (isset($node->childNodes)) - foreach($node->childNodes as $chNode) - $return .= $this->__dumpTree($chNode, $intend+1); - return $return; - } - /** - * Dump htmlOuter and stop script execution. Usefull for debugging. - * - */ - public function dumpDie() { - print __FILE__.':'.__LINE__; - var_dump($this->htmlOuter()); - die(); - } -} diff --git a/sitecake/2.2.9/server/vendor/electrolinux/phpquery/phpQuery/phpQuery/plugins/Scripts.php b/sitecake/2.2.9/server/vendor/electrolinux/phpquery/phpQuery/phpQuery/plugins/Scripts.php deleted file mode 100644 index cc4dd6f..0000000 --- a/sitecake/2.2.9/server/vendor/electrolinux/phpquery/phpQuery/phpQuery/plugins/Scripts.php +++ /dev/null @@ -1,72 +0,0 @@ - \ No newline at end of file diff --git a/sitecake/2.2.9/server/vendor/electrolinux/phpquery/phpQuery/phpQuery/plugins/Scripts/__config.example.php b/sitecake/2.2.9/server/vendor/electrolinux/phpquery/phpQuery/phpQuery/plugins/Scripts/__config.example.php deleted file mode 100644 index db80652..0000000 --- a/sitecake/2.2.9/server/vendor/electrolinux/phpquery/phpQuery/phpQuery/plugins/Scripts/__config.example.php +++ /dev/null @@ -1,10 +0,0 @@ - array('login@mail', 'password'), -); -?> \ No newline at end of file diff --git a/sitecake/2.2.9/server/vendor/electrolinux/phpquery/phpQuery/phpQuery/plugins/Scripts/example.php b/sitecake/2.2.9/server/vendor/electrolinux/phpquery/phpQuery/phpQuery/plugins/Scripts/example.php deleted file mode 100644 index a8f45f4..0000000 --- a/sitecake/2.2.9/server/vendor/electrolinux/phpquery/phpQuery/phpQuery/plugins/Scripts/example.php +++ /dev/null @@ -1,14 +0,0 @@ -find($params[0]); -?> \ No newline at end of file diff --git a/sitecake/2.2.9/server/vendor/electrolinux/phpquery/phpQuery/phpQuery/plugins/Scripts/fix_webroot.php b/sitecake/2.2.9/server/vendor/electrolinux/phpquery/phpQuery/phpQuery/plugins/Scripts/fix_webroot.php deleted file mode 100644 index a7cac9e..0000000 --- a/sitecake/2.2.9/server/vendor/electrolinux/phpquery/phpQuery/phpQuery/plugins/Scripts/fix_webroot.php +++ /dev/null @@ -1,16 +0,0 @@ -filter($filter) as $el) { - $el = pq($el, $self->getDocumentID()); - // imgs and scripts - if ( $el->is('img') || $el->is('script') ) - $el->attr('src', $params[0].$el->attr('src')); - // css - if ( $el->is('link') ) - $el->attr('href', $params[0].$el->attr('href')); -} \ No newline at end of file diff --git a/sitecake/2.2.9/server/vendor/electrolinux/phpquery/phpQuery/phpQuery/plugins/Scripts/google_login.php b/sitecake/2.2.9/server/vendor/electrolinux/phpquery/phpQuery/phpQuery/plugins/Scripts/google_login.php deleted file mode 100644 index 0327045..0000000 --- a/sitecake/2.2.9/server/vendor/electrolinux/phpquery/phpQuery/phpQuery/plugins/Scripts/google_login.php +++ /dev/null @@ -1,47 +0,0 @@ - - */ -phpQuery::ajaxAllowHost( - 'code.google.com', - 'google.com', 'www.google.com', - 'mail.google.com', - 'docs.google.com', - 'reader.google.com' -); -if (! function_exists('ndfasui8923')) { - function ndfasui8923($browser, $scope) { - extract($scope); - $browser - ->WebBrowser() - ->find('#Email') - ->val($config['google_login'][0])->end() - ->find('#Passwd') - ->val($config['google_login'][1]) - ->parents('form') - ->submit(); - } - $ndfasui8923 = new Callback('ndfasui8923', new CallbackParam, compact( - 'config', 'self', 'return', 'params' - )); -} -phpQuery::plugin('WebBrowser'); -$self->document->xhr = phpQuery::$plugins->browserGet( - 'https://www.google.com/accounts/Login', - $ndfasui8923 -); -//$self->document->xhr = phpQuery::$plugins->browserGet('https://www.google.com/accounts/Login', create_function('$browser', " -// \$browser -// ->WebBrowser() -// ->find('#Email') -// ->val('{$config['google_login'][0]}')->end() -// ->find('#Passwd') -// ->val('".str_replace("'", "\\'", $config['google_login'][1])."') -// ->parents('form') -// ->submit();" -//)); -?> \ No newline at end of file diff --git a/sitecake/2.2.9/server/vendor/electrolinux/phpquery/phpQuery/phpQuery/plugins/Scripts/print_source.php b/sitecake/2.2.9/server/vendor/electrolinux/phpquery/phpQuery/phpQuery/plugins/Scripts/print_source.php deleted file mode 100644 index 03d8061..0000000 --- a/sitecake/2.2.9/server/vendor/electrolinux/phpquery/phpQuery/phpQuery/plugins/Scripts/print_source.php +++ /dev/null @@ -1,9 +0,0 @@ - - */ -/** @var phpQueryObject */ -$self = $self; -$return = htmlspecialchars($self); \ No newline at end of file diff --git a/sitecake/2.2.9/server/vendor/electrolinux/phpquery/phpQuery/phpQuery/plugins/Scripts/print_websafe.php b/sitecake/2.2.9/server/vendor/electrolinux/phpquery/phpQuery/phpQuery/plugins/Scripts/print_websafe.php deleted file mode 100644 index 4f48bd7..0000000 --- a/sitecake/2.2.9/server/vendor/electrolinux/phpquery/phpQuery/phpQuery/plugins/Scripts/print_websafe.php +++ /dev/null @@ -1,13 +0,0 @@ - - */ -/** @var phpQueryObject */ -$self = $self; -$self - ->find('script') - ->add('meta[http-equiv=refresh]') - ->add('meta[http-equiv=Refresh]') - ->remove(); \ No newline at end of file diff --git a/sitecake/2.2.9/server/vendor/electrolinux/phpquery/phpQuery/phpQuery/plugins/WebBrowser.php b/sitecake/2.2.9/server/vendor/electrolinux/phpquery/phpQuery/phpQuery/plugins/WebBrowser.php deleted file mode 100644 index e5e83d0..0000000 --- a/sitecake/2.2.9/server/vendor/electrolinux/phpquery/phpQuery/phpQuery/plugins/WebBrowser.php +++ /dev/null @@ -1,436 +0,0 @@ -_clone()->toRoot(); - $location = $location - ? $location - // TODO use document.location - : $self->document->xhr->getUri(true); - // FIXME tmp - $self->document->WebBrowserCallback = $callback; - if (! $location) - throw new Exception('Location needed to activate WebBrowser plugin !'); - else { - $self->bind('click', array($location, $callback), array('phpQueryPlugin_WebBrowser', 'hadleClick')); - $self->bind('submit', array($location, $callback), array('phpQueryPlugin_WebBrowser', 'handleSubmit')); - } - } - public static function browser($self, $callback = null, $location = null) { - return $self->WebBrowser($callback, $location); - } - public static function downloadTo($self, $dir = null, $filename = null) { - $url = null; - if ($self->is('a[href]')) - $url = $self->attr('href'); - else if ($self->find('a')->length) - $url = $self->find('a')->attr('href'); - if ($url) { - $url = resolve_url($self->document->location, $url); - if (! $dir) - $dir = getcwd(); - // TODO resolv name from response headers - if (! $filename) { - $matches = null; - preg_match('@/([^/]+)$@', $url, $matches); - $filename = $matches[1]; - } - //print $url; - $path = rtrim($dir, '/').'/'.$filename; - phpQuery::debug("Requesting download of $url\n"); - // TODO use AJAX instead of file_get_contents - file_put_contents($path, file_get_contents($url)); - } - return $self; - } - /** - * Method changing browser location. - * Fires callback registered with WebBrowser(), if any. - * @param $self - * @param $url - * @return unknown_type - */ - public static function location($self, $url = null) { - // TODO if ! $url return actual location ??? - $xhr = isset($self->document->xhr) - ? $self->document->xhr - : null; - $xhr = phpQuery::ajax(array( - 'url' => $url, - ), $xhr); - $return = false; - if ($xhr->getLastResponse()->isSuccessful()) { - $return = phpQueryPlugin_WebBrowser::browserReceive($xhr); - if (isset($self->document->WebBrowserCallback)) - phpQuery::callbackRun( - $self->document->WebBrowserCallback, - array($return) - ); - } - return $return; - } - - - public static function download($self, $url = null) { - $xhr = isset($self->document->xhr) - ? $self->document->xhr - : null; - $xhr = phpQuery::ajax(array( - 'url' => $url, - ), $xhr); - $return = false; - if ($xhr->getLastResponse()->isSuccessful()) { - $return = phpQueryPlugin_WebBrowser::browserDownload($xhr); - if (isset($self->document->WebBrowserCallback)) - phpQuery::callbackRun( - $self->document->WebBrowserCallback, - array($return) - ); - } - return $return; - } -} -class phpQueryPlugin_WebBrowser { - /** - * - * @param $url - * @param $callback - * @param $param1 - * @param $param2 - * @param $param3 - * @return Zend_Http_Client - */ - public static function browserGet($url, $callback, - $param1 = null, $param2 = null, $param3 = null) { - phpQuery::debug("[WebBrowser] GET: $url"); - self::authorizeHost($url); - $xhr = phpQuery::ajax(array( - 'type' => 'GET', - 'url' => $url, - 'dataType' => 'html', - )); - $paramStructure = null; - if (func_num_args() > 2) { - $paramStructure = func_get_args(); - $paramStructure = array_slice($paramStructure, 2); - } - if ($xhr->getLastResponse()->isSuccessful()) { - phpQuery::callbackRun($callback, - array(self::browserReceive($xhr)->WebBrowser()), - $paramStructure - ); -// phpQuery::callbackRun($callback, array( -// self::browserReceive($xhr)//->WebBrowser($callback) -// )); - return $xhr; - } else { - throw new Exception("[WebBrowser] GET request failed; url: $url"); - return false; - } - } - /** - * - * @param $url - * @param $data - * @param $callback - * @param $param1 - * @param $param2 - * @param $param3 - * @return Zend_Http_Client - */ - public static function browserPost($url, $data, $callback, - $param1 = null, $param2 = null, $param3 = null) { - self::authorizeHost($url); - $xhr = phpQuery::ajax(array( - 'type' => 'POST', - 'url' => $url, - 'dataType' => 'html', - 'data' => $data, - )); - $paramStructure = null; - if (func_num_args() > 3) { - $paramStructure = func_get_args(); - $paramStructure = array_slice($paramStructure, 3); - } - if ($xhr->getLastResponse()->isSuccessful()) { - phpQuery::callbackRun($callback, - array(self::browserReceive($xhr)->WebBrowser()), - $paramStructure - ); -// phpQuery::callbackRun($callback, array( -// self::browserReceive($xhr)//->WebBrowser($callback) -// )); - return $xhr; - } else - return false; - } - /** - * - * @param $ajaxSettings - * @param $callback - * @param $param1 - * @param $param2 - * @param $param3 - * @return Zend_Http_Client - */ - public static function browser($ajaxSettings, $callback, - $param1 = null, $param2 = null, $param3 = null) { - self::authorizeHost($ajaxSettings['url']); - $xhr = phpQuery::ajax( - self::ajaxSettingsPrepare($ajaxSettings) - ); - $paramStructure = null; - if (func_num_args() > 2) { - $paramStructure = func_get_args(); - $paramStructure = array_slice($paramStructure, 2); - } - if ($xhr->getLastResponse()->isSuccessful()) { - phpQuery::callbackRun($callback, - array(self::browserReceive($xhr)->WebBrowser()), - $paramStructure - ); -// phpQuery::callbackRun($callback, array( -// self::browserReceive($xhr)//->WebBrowser($callback) -// )); - return $xhr; - } else - return false; - } - protected static function authorizeHost($url) { - $host = parse_url($url, PHP_URL_HOST); - if ($host) - phpQuery::ajaxAllowHost($host); - } - protected static function ajaxSettingsPrepare($settings) { - unset($settings['success']); - unset($settings['error']); - return $settings; - } - /** - * @param Zend_Http_Client $xhr - */ - public static function browserReceive($xhr) { - phpQuery::debug("[WebBrowser] Received from ".$xhr->getUri(true)); - // TODO handle meta redirects - $body = $xhr->getLastResponse()->getBody(); - - // XXX error ??? - if (strpos($body, '') !== false) { - $body = '' - .str_replace('', '', $body) - .''; - } - $pq = phpQuery::newDocument($body); - $pq->document->xhr = $xhr; - $pq->document->location = $xhr->getUri(true); - $refresh = $pq->find('meta[http-equiv=refresh]') - ->add('meta[http-equiv=Refresh]'); - if ($refresh->size()) { -// print htmlspecialchars(var_export($xhr->getCookieJar()->getAllCookies(), true)); -// print htmlspecialchars(var_export($xhr->getLastResponse()->getHeader('Set-Cookie'), true)); - phpQuery::debug("Meta redirect... '{$refresh->attr('content')}'\n"); - // there is a refresh, so get the new url - $content = $refresh->attr('content'); - $urlRefresh = substr($content, strpos($content, '=')+1); - $urlRefresh = trim($urlRefresh, '\'"'); - // XXX not secure ?! - phpQuery::ajaxAllowURL($urlRefresh); -// $urlRefresh = urldecode($urlRefresh); - // make ajax call, passing last $xhr object to preserve important stuff - $xhr = phpQuery::ajax(array( - 'type' => 'GET', - 'url' => $urlRefresh, - 'dataType' => 'html', - ), $xhr); - if ($xhr->getLastResponse()->isSuccessful()) { - // if all is ok, repeat this method... - return call_user_func_array( - array('phpQueryPlugin_WebBrowser', 'browserReceive'), array($xhr) - ); - } - } else - return $pq; - } - - /** - * @param Zend_Http_Client $xhr - */ - public static function browserDownload($xhr) { - phpQuery::debug("[WebBrowser] Received from ".$xhr->getUri(true)); - // TODO handle meta redirects - $body = $xhr->getLastResponse()->getBody(); - - return $body; - } - /** - * - * @param $e - * @param $callback - * @return unknown_type - */ - public static function hadleClick($e, $callback = null) { - $node = phpQuery::pq($e->target); - $type = null; - if ($node->is('a[href]')) { - // TODO document.location - $xhr = isset($node->document->xhr) - ? $node->document->xhr - : null; - $xhr = phpQuery::ajax(array( - 'url' => resolve_url($e->data[0], $node->attr('href')), - 'referer' => $node->document->location, - ), $xhr); - if ((! $callback || !($callback instanceof Callback)) && $e->data[1]) - $callback = $e->data[1]; - if ($xhr->getLastResponse()->isSuccessful() && $callback) - phpQuery::callbackRun($callback, array( - self::browserReceive($xhr) - )); - } else if ($node->is(':submit') && $node->parents('form')->size()) - $node->parents('form')->trigger('submit', array($e)); - } - /** - * Enter description here... - * - * @param unknown_type $e - * @TODO trigger submit for form after form's submit button has a click event - */ - public static function handleSubmit($e, $callback = null) { - $node = phpQuery::pq($e->target); - if (!$node->is('form') || !$node->is('[action]')) - return; - // TODO document.location - $xhr = isset($node->document->xhr) - ? $node->document->xhr - : null; - $submit = pq($e->relatedTarget)->is(':submit') - ? $e->relatedTarget - // will this work ? -// : $node->find(':submit:first')->get(0); - : $node->find('*:submit:first')->get(0); - $data = array(); - foreach($node->serializeArray($submit) as $r) - // XXXt.c maybe $node->not(':submit')->add($sumit) would be better ? -// foreach($node->serializeArray($submit) as $r) - $data[ $r['name'] ] = $r['value']; - $options = array( - 'type' => $node->attr('method') - ? $node->attr('method') - : 'GET', - 'url' => resolve_url($e->data[0], $node->attr('action')), - 'data' => $data, - 'referer' => $node->document->location, -// 'success' => $e->data[1], - ); - if ($node->attr('enctype')) - $options['contentType'] = $node->attr('enctype'); - $xhr = phpQuery::ajax($options, $xhr); - if ((! $callback || !($callback instanceof Callback)) && $e->data[1]) - $callback = $e->data[1]; - if ($xhr->getLastResponse()->isSuccessful() && $callback) - phpQuery::callbackRun($callback, array( - self::browserReceive($xhr) - )); - } -} -/** - * - * @param unknown_type $parsed - * @return unknown - * @link http://www.php.net/manual/en/function.parse-url.php - * @author stevenlewis at hotmail dot com - */ -function glue_url($parsed) - { - if (! is_array($parsed)) return false; - $uri = isset($parsed['scheme']) ? $parsed['scheme'].':'.((strtolower($parsed['scheme']) == 'mailto') ? '':'//'): ''; - $uri .= isset($parsed['user']) ? $parsed['user'].($parsed['pass']? ':'.$parsed['pass']:'').'@':''; - $uri .= isset($parsed['host']) ? $parsed['host'] : ''; - $uri .= isset($parsed['port']) ? ':'.$parsed['port'] : ''; - if(isset($parsed['path'])) - { - $uri .= (substr($parsed['path'],0,1) == '/')?$parsed['path']:'/'.$parsed['path']; - } - $uri .= isset($parsed['query']) ? '?'.$parsed['query'] : ''; - $uri .= isset($parsed['fragment']) ? '#'.$parsed['fragment'] : ''; - return $uri; - } -/** - * Enter description here... - * - * @param unknown_type $base - * @param unknown_type $url - * @return unknown - * @author adrian-php at sixfingeredman dot net - */ -function resolve_url($base, $url) { - if (!strlen($base)) return $url; - // Step 2 - if (!strlen($url)) return $base; - // Step 3 - if (preg_match('!^[a-z]+:!i', $url)) return $url; - $base = parse_url($base); - if ($url{0} == "#") { - // Step 2 (fragment) - $base['fragment'] = substr($url, 1); - return unparse_url($base); - } - unset($base['fragment']); - unset($base['query']); - if (substr($url, 0, 2) == "//") { - // Step 4 - return unparse_url(array( - 'scheme'=>$base['scheme'], - 'path'=>substr($url,2), - )); - } else if ($url{0} == "/") { - // Step 5 - $base['path'] = $url; - } else { - // Step 6 - $path = explode('/', $base['path']); - $url_path = explode('/', $url); - // Step 6a: drop file from base - array_pop($path); - // Step 6b, 6c, 6e: append url while removing "." and ".." from - // the directory portion - $end = array_pop($url_path); - foreach ($url_path as $segment) { - if ($segment == '.') { - // skip - } else if ($segment == '..' && $path && $path[sizeof($path)-1] != '..') { - array_pop($path); - } else { - $path[] = $segment; - } - } - // Step 6d, 6f: remove "." and ".." from file portion - if ($end == '.') { - $path[] = ''; - } else if ($end == '..' && $path && $path[sizeof($path)-1] != '..') { - $path[sizeof($path)-1] = ''; - } else { - $path[] = $end; - } - // Step 6h - $base['path'] = join('/', $path); - - } - // Step 7 - return glue_url($base); -} diff --git a/sitecake/2.2.9/server/vendor/electrolinux/phpquery/phpQuery/phpQuery/plugins/example.php b/sitecake/2.2.9/server/vendor/electrolinux/phpquery/phpQuery/phpQuery/plugins/example.php deleted file mode 100644 index 732f05c..0000000 --- a/sitecake/2.2.9/server/vendor/electrolinux/phpquery/phpQuery/phpQuery/plugins/example.php +++ /dev/null @@ -1,75 +0,0 @@ -plugin('example') - * pq('ul')->plugin('example', 'example.php') - * - * Plugin classes are never intialized, just method calls are forwarded - * in static way from phpQuery. - * - * Have fun writing plugins :) - */ - -/** - * phpQuery plugin class extending phpQuery object. - * Methods from this class are callable on every phpQuery object. - * - * Class name prefix 'phpQueryObjectPlugin_' must be preserved. - */ -abstract class phpQueryObjectPlugin_example { - /** - * Limit binded methods. - * - * null means all public. - * array means only specified ones. - * - * @var array|null - */ - public static $phpQueryMethods = null; - /** - * Enter description here... - * - * @param phpQueryObject $self - */ - public static function example($self, $arg1) { - // this method can be called on any phpQuery object, like this: - // pq('div')->example('$arg1 Value') - - // do something - $self->append('Im just an example !'); - // change stack of result object - return $self->find('div'); - } - protected static function helperFunction() { - // this method WONT be avaible as phpQuery method, - // because it isn't publicly callable - } -} - -/** - * phpQuery plugin class extending phpQuery static namespace. - * Methods from this class are callable as follows: - * phpQuery::$plugins->staticMethod() - * - * Class name prefix 'phpQueryPlugin_' must be preserved. - */ -abstract class phpQueryPlugin_example { - /** - * Limit binded methods. - * - * null means all public. - * array means only specified ones. - * - * @var array|null - */ - public static $phpQueryMethods = null; - public static function staticMethod() { - // this method can be called within phpQuery class namespace, like this: - // phpQuery::$plugins->staticMethod() - } -} -?> \ No newline at end of file diff --git a/sitecake/2.2.9/server/vendor/jdesrosiers/silex-cors-provider/.scrutinizer.yml b/sitecake/2.2.9/server/vendor/jdesrosiers/silex-cors-provider/.scrutinizer.yml deleted file mode 100644 index 1833e8e..0000000 --- a/sitecake/2.2.9/server/vendor/jdesrosiers/silex-cors-provider/.scrutinizer.yml +++ /dev/null @@ -1,32 +0,0 @@ -filter: - excluded_paths: [vendor/*] - -build: - tests: - override: - - - command: 'vendor/bin/phpunit --coverage-clover=coverage' - coverage: - file: 'coverage' - format: 'php-clover' - -tools: - php_mess_detector: true - php_cpd: - enabled: true - excluded_dirs: [vendor] - php_pdepend: - enabled: true - excluded_dirs: [vendor] - php_code_sniffer: - enabled: true - config: - standard: PSR2 - php_code_coverage: true - php_loc: - enabled: true - excluded_dirs: [vendor] - sensiolabs_security_checker: true - -before_commands: - - "composer install --prefer-source" diff --git a/sitecake/2.2.9/server/vendor/jdesrosiers/silex-cors-provider/.travis.yml b/sitecake/2.2.9/server/vendor/jdesrosiers/silex-cors-provider/.travis.yml deleted file mode 100644 index cb7d950..0000000 --- a/sitecake/2.2.9/server/vendor/jdesrosiers/silex-cors-provider/.travis.yml +++ /dev/null @@ -1,18 +0,0 @@ -language: php - -env: - - SILEX_VERSION="1.0.*" - - SILEX_VERSION="1.1.*" - - SILEX_VERSION="1.2.*" - -before_script: - - composer require silex/silex:${SILEX_VERSION} - - composer install --dev --prefer-source - -script: vendor/bin/phpunit - -php: - - 5.3 - - 5.4 - - 5.5 - - 5.6 diff --git a/sitecake/2.2.9/server/vendor/jdesrosiers/silex-cors-provider/LICENSE b/sitecake/2.2.9/server/vendor/jdesrosiers/silex-cors-provider/LICENSE deleted file mode 100644 index ad5406e..0000000 --- a/sitecake/2.2.9/server/vendor/jdesrosiers/silex-cors-provider/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2013 Jason Desrosiers - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/sitecake/2.2.9/server/vendor/jdesrosiers/silex-cors-provider/README.md b/sitecake/2.2.9/server/vendor/jdesrosiers/silex-cors-provider/README.md deleted file mode 100644 index 14d47a0..0000000 --- a/sitecake/2.2.9/server/vendor/jdesrosiers/silex-cors-provider/README.md +++ /dev/null @@ -1,51 +0,0 @@ -silex-cors-provider -=================== - -[![Build Status](https://travis-ci.org/jdesrosiers/silex-cors-provider.png?branch=v0)](https://travis-ci.org/jdesrosiers/silex-cors-provider) -[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/jdesrosiers/silex-cors-provider/badges/quality-score.png?b=v0)](https://scrutinizer-ci.com/g/jdesrosiers/silex-cors-provider/?branch=v0) -[![Code Coverage](https://scrutinizer-ci.com/g/jdesrosiers/silex-cors-provider/badges/coverage.png?b=v0)](https://scrutinizer-ci.com/g/jdesrosiers/silex-cors-provider/?branch=v0) - -The CorsServiceProvider provides [CORS](http://enable-cors.org/) support as middleware for your silex application. CORS -allows you to make AJAX requests across domains. CORS uses OPTIONS requests to make preflight requests. Because silex -doesn't have functionality for serving OPTIONS request by default, this service goes through all of your routes and -generates the necessary OPTIONS routes. - -Installation ------------- -Install the silex-cors-provider using [composer](http://getcomposer.org/). This project uses [sematic versioning](http://semver.org/). - -```json -{ - "require": { - "jdesrosiers/silex-cors-provider": "~0.1" - } -} -``` - -Parameters ----------- -* **cors.allowOrigin**: (string) Space separated set of allowed domains. Defaults to all. -* **cors.allowMethods**: (string) Comma separated set of allowed HTTP methods. Defaults to all. -* **cors.maxAge**: (int) The number of seconds a CORS pre-flight response can be cached. Defaults to 0. -* **cors.allowCredentials**: (boolean) Are cookies allowed? Defaults to false. -* **cors.exposeHeaders**: (string) Space separated set of headers that are safe to expose. Defaults to all. - -Services --------- -* **cors**: A function that can be added as after middleware to the Application, a ControllerCollection, or a Route. - -Registering ------------ -```php -$app->register(new JDesrosiers\Silex\Provider\CorsServiceProvider(), array( - "cors.allowOrigin" => "http://petstore.swagger.wordnik.com", -)); -``` - -Usage ------ -The following shows how to add CORS functionality to the entire application. It can also be applied to a -ControllerCollection a Route to limit its scope. -```php -$app->after($app["cors"]); -``` diff --git a/sitecake/2.2.9/server/vendor/jdesrosiers/silex-cors-provider/composer.json b/sitecake/2.2.9/server/vendor/jdesrosiers/silex-cors-provider/composer.json deleted file mode 100644 index 6779334..0000000 --- a/sitecake/2.2.9/server/vendor/jdesrosiers/silex-cors-provider/composer.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "name": "jdesrosiers/silex-cors-provider", - "description": "A silex service provider that adds CORS services to silex", - "keywords": ["silex", "cors", "cross", "origin", "resource", "sharing", "service", "provider"], - "license": "MIT", - "authors": [ - { - "name": "Jason Desrosiers", - "email": "jdesrosi@gmail.com" - } - ], - "require": { - "silex/silex": "~1.0" - }, - "require-dev": { - "symfony/browser-kit": "2.3.*", - "phpunit/phpunit": "3.7.*" - }, - "autoload": { - "psr-4": { - "JDesrosiers\\Silex\\Provider\\": "src/" - } - }, - "scripts": { - "test": "vendor/bin/phpunit --colors" - }, - "minimum-stability": "stable" -} diff --git a/sitecake/2.2.9/server/vendor/jdesrosiers/silex-cors-provider/phpunit.xml.dist b/sitecake/2.2.9/server/vendor/jdesrosiers/silex-cors-provider/phpunit.xml.dist deleted file mode 100644 index acc0e5d..0000000 --- a/sitecake/2.2.9/server/vendor/jdesrosiers/silex-cors-provider/phpunit.xml.dist +++ /dev/null @@ -1,25 +0,0 @@ - - - - - src/Test - - - - - src - - src/Test - - - - \ No newline at end of file diff --git a/sitecake/2.2.9/server/vendor/jdesrosiers/silex-cors-provider/src/Cors.php b/sitecake/2.2.9/server/vendor/jdesrosiers/silex-cors-provider/src/Cors.php deleted file mode 100644 index 3e4a7d6..0000000 --- a/sitecake/2.2.9/server/vendor/jdesrosiers/silex-cors-provider/src/Cors.php +++ /dev/null @@ -1,85 +0,0 @@ -app = $app; - } - - public function __invoke(Request $request, Response $response) - { - $response->headers->add($this->corsHeaders($request, $response->headers->get("Allow"))); - } - - private function corsHeaders(Request $request, $allow) - { - $headers = array(); - - if (!$this->isCorsRequest($request)) { - return array(); - } - - if ($this->isPreflightRequest($request)) { - $allowedMethods = $this->allowedMethods($request, $allow); - if (!in_array($request->headers->get("Access-Control-Request-Method"), $allowedMethods)) { - return array(); - } - - // TODO: Allow cors.allowHeaders to be set and use it to validate the request - $headers["Access-Control-Allow-Headers"] = $request->headers->get("Access-Control-Request-Headers"); - $headers["Access-Control-Allow-Methods"] = $allowedMethods; - $headers["Access-Control-Max-Age"] = $this->app["cors.maxAge"]; - } else { - $headers["Access-Control-Expose-Headers"] = $this->app["cors.exposeHeaders"]; - } - - $headers["Access-Control-Allow-Origin"] = $this->allowOrigin($request); - $headers["Access-Control-Allow-Credentials"] = $this->allowCredentials($request); - - return array_filter($headers); - } - - private function isCorsRequest(Request $request) - { - return $request->headers->has("Origin"); - } - - private function isPreflightRequest(Request $request) - { - return $request->getMethod() === "OPTIONS" && $request->headers->has("Access-Control-Request-Method"); - } - - private function allowedMethods(Request $request, $allow) - { - $allowMethods = !is_null($this->app["cors.allowMethods"]) ? $this->app["cors.allowMethods"] : $allow; - return preg_split("/\s*,\s*/", $allowMethods); - } - - private function allowOrigin(Request $request) - { - if ($this->app["cors.allowOrigin"] === '*') { - $this->app["cors.allowOrigin"] = null; - } - - $origin = $request->headers->get("Origin"); - if (is_null($this->app["cors.allowOrigin"])) { - $this->app["cors.allowOrigin"] = $origin; - } - - return in_array($origin, preg_split('/\s+/', $this->app["cors.allowOrigin"])) ? $origin : "null"; - } - - private function allowCredentials(Request $request) - { - return $this->app["cors.allowCredentials"] === true ? "true" : null; - } -} diff --git a/sitecake/2.2.9/server/vendor/jdesrosiers/silex-cors-provider/src/CorsServiceProvider.php b/sitecake/2.2.9/server/vendor/jdesrosiers/silex-cors-provider/src/CorsServiceProvider.php deleted file mode 100644 index 868cd17..0000000 --- a/sitecake/2.2.9/server/vendor/jdesrosiers/silex-cors-provider/src/CorsServiceProvider.php +++ /dev/null @@ -1,69 +0,0 @@ -flush(); // This seems to be necessary sometimes. I'm not sure why. - $this->createOptionsRoutes($app, $this->determineAllowedMethods($app["routes"])); - } - - /** - * Register the cors function and set defaults - * - * @param Application $app - */ - public function register(Application $app) - { - $app["cors.allowOrigin"] = "*"; // Defaults to all - $app["cors.allowMethods"] = null; // Defaults to all - $app["cors.maxAge"] = null; - $app["cors.allowCredentials"] = null; - $app["cors.exposeHeaders"] = null; - - $app["cors"] = $app->protect(new Cors($app)); - } - - private function determineAllowedMethods(RouteCollection $routes) - { - $allow = array(); - foreach ($routes as $route) { - $path = $route->getPath(); - if (!array_key_exists($path, $allow)) { - $allow[$path] = array("methods" => array(), "requirements" => array()); - } - - $allow[$path]["methods"] = array_merge($allow[$path]["methods"], $route->getMethods()); - $allow[$path]["requirements"] = array_merge($allow[$path]["requirements"], $route->getRequirements()); - } - - return $allow; - } - - private function createOptionsRoutes(Application $app, $allow) - { - foreach ($allow as $path => $routeDetails) { - // Remove _method from requirements, it would cause a - // E_USER_DEPRECATED error with Symfony Routing component 2.7+ - unset($routeDetails['requirements']['_method']); - - $app->match($path, new OptionsController($routeDetails["methods"])) - ->setRequirements($routeDetails["requirements"]) - ->method("OPTIONS"); - } - } -} diff --git a/sitecake/2.2.9/server/vendor/jdesrosiers/silex-cors-provider/src/OptionsController.php b/sitecake/2.2.9/server/vendor/jdesrosiers/silex-cors-provider/src/OptionsController.php deleted file mode 100644 index cb05682..0000000 --- a/sitecake/2.2.9/server/vendor/jdesrosiers/silex-cors-provider/src/OptionsController.php +++ /dev/null @@ -1,20 +0,0 @@ -methods = $methods; - } - - public function __invoke() - { - return Response::create("", 204, array("Allow" => implode(",", $this->methods))); - } -} diff --git a/sitecake/2.2.9/server/vendor/league/flysystem/src/Adapter/AbstractAdapter.php b/sitecake/2.2.9/server/vendor/league/flysystem/src/Adapter/AbstractAdapter.php deleted file mode 100644 index 4617c95..0000000 --- a/sitecake/2.2.9/server/vendor/league/flysystem/src/Adapter/AbstractAdapter.php +++ /dev/null @@ -1,86 +0,0 @@ -pathSeparator).$this->pathSeparator; - } - - $this->pathPrefix = $is_empty ? null : $prefix; - } - - /** - * Get the path prefix. - * - * @return string path prefix - */ - public function getPathPrefix() - { - return $this->pathPrefix; - } - - /** - * Prefix a path. - * - * @param string $path - * - * @return string prefixed path - */ - public function applyPathPrefix($path) - { - $path = ltrim($path, '\\/'); - - if (strlen($path) === 0) { - return $this->getPathPrefix() ?: ''; - } - - if ($prefix = $this->getPathPrefix()) { - $path = $prefix.$path; - } - - return $path; - } - - /** - * Remove a path prefix. - * - * @param string $path - * - * @return string path without the prefix - */ - public function removePathPrefix($path) - { - $pathPrefix = $this->getPathPrefix(); - - if ($pathPrefix === null) { - return $path; - } - - return substr($path, strlen($pathPrefix)); - } -} diff --git a/sitecake/2.2.9/server/vendor/league/flysystem/src/Adapter/AbstractFtpAdapter.php b/sitecake/2.2.9/server/vendor/league/flysystem/src/Adapter/AbstractFtpAdapter.php deleted file mode 100644 index 6de9b2b..0000000 --- a/sitecake/2.2.9/server/vendor/league/flysystem/src/Adapter/AbstractFtpAdapter.php +++ /dev/null @@ -1,613 +0,0 @@ -setConfig($config); - } - - /** - * Set the config. - * - * @param array $config - * - * @return $this - */ - public function setConfig(array $config) - { - foreach ($this->configurable as $setting) { - if (! isset($config[$setting])) { - continue; - } - - $method = 'set'.ucfirst($setting); - - if (method_exists($this, $method)) { - $this->$method($config[$setting]); - } - } - - return $this; - } - - /** - * Returns the host. - * - * @return string - */ - public function getHost() - { - return $this->host; - } - - /** - * Set the host. - * - * @param string $host - * - * @return $this - */ - public function setHost($host) - { - $this->host = $host; - - return $this; - } - - /** - * Set the public permission value. - * - * @param int $permPublic - * - * @return $this - */ - public function setPermPublic($permPublic) - { - $this->permPublic = $permPublic; - - return $this; - } - - /** - * Set the private permission value. - * - * @param int $permPrivate - * - * @return $this - */ - public function setPermPrivate($permPrivate) - { - $this->permPrivate = $permPrivate; - - return $this; - } - - /** - * Returns the ftp port. - * - * @return int - */ - public function getPort() - { - return $this->port; - } - - /** - * Returns the root folder to work from. - * - * @return string - */ - public function getRoot() - { - return $this->root; - } - - /** - * Set the ftp port. - * - * @param int|string $port - * - * @return $this - */ - public function setPort($port) - { - $this->port = (int) $port; - - return $this; - } - - /** - * Set the root folder to work from. - * - * @param string $root - * - * @return $this - */ - public function setRoot($root) - { - $this->root = rtrim($root, '\\/').$this->separator; - - return $this; - } - - /** - * Returns the ftp username. - * - * @return string username - */ - public function getUsername() - { - return empty($this->username) ? 'anonymous' : $this->username; - } - - /** - * Set ftp username. - * - * @param string $username - * - * @return $this - */ - public function setUsername($username) - { - $this->username = $username; - - return $this; - } - - /** - * Returns the password. - * - * @return string password - */ - public function getPassword() - { - return $this->password; - } - - /** - * Set the ftp password. - * - * @param string $password - * - * @return $this - */ - public function setPassword($password) - { - $this->password = $password; - - return $this; - } - - /** - * Returns the amount of seconds before the connection will timeout. - * - * @return int - */ - public function getTimeout() - { - return $this->timeout; - } - - /** - * Set the amount of seconds before the connection should timeout. - * - * @param int $timeout - * - * @return $this - */ - public function setTimeout($timeout) - { - $this->timeout = (int) $timeout; - - return $this; - } - - /** - * Return the FTP system type - * - * @return string - */ - public function getSystemType() - { - return $this->systemType; - } - - /** - * Set the FTP system type (windows or unix) - * - * @param string $systemType - * - * @return $this - */ - public function setSystemType($systemType) - { - $this->systemType = strtolower($systemType); - - return $this; - } - - /** - * {@inheritdoc} - */ - public function listContents($directory = '', $recursive = false) - { - return $this->listDirectoryContents($directory, $recursive); - } - - /** - * Normalize a directory listing. - * - * @param array $listing - * @param string $prefix - * - * @return array directory listing - */ - protected function normalizeListing(array $listing, $prefix = '') - { - $base = $prefix; - $result = []; - $listing = $this->removeDotDirectories($listing); - - while ($item = array_shift($listing)) { - if (preg_match('#^.*:$#', $item)) { - $base = trim($item, ':'); - continue; - } - - $result[] = $this->normalizeObject($item, $base); - } - - return $this->sortListing($result); - } - - /** - * Sort a directory listing. - * - * @param array $result - * - * @return array sorted listing - */ - protected function sortListing(array $result) - { - $compare = function ($one, $two) { - return strnatcmp($one['path'], $two['path']); - }; - - usort($result, $compare); - - return $result; - } - - /** - * Normalize a file entry. - * - * @param string $item - * @param string $base - * - * @return array normalized file array - * @throws NotSupportedException - */ - protected function normalizeObject($item, $base) - { - $systemType = $this->systemType ?: $this->detectSystemType($item); - - if ($systemType === 'unix') { - return $this->normalizeUnixObject($item, $base); - } elseif ($systemType === 'windows'){ - return $this->normalizeWindowsObject($item, $base); - } - - throw NotSupportedException::forFtpSystemType($systemType); - } - - /** - * Normalize a Unix file entry. - * - * @param string $item - * @param string $base - * - * @return array normalized file array - */ - protected function normalizeUnixObject($item, $base) - { - $item = preg_replace('#\s+#', ' ', trim($item), 7); - list($permissions, /* $number */, /* $owner */, /* $group */, $size, /* $month */, /* $day */, /* $time*/, $name) = explode(' ', $item, 9); - $type = $this->detectType($permissions); - $path = empty($base) ? $name : $base.$this->separator.$name; - - if ($type === 'dir') { - return compact('type', 'path'); - } - - $permissions = $this->normalizePermissions($permissions); - $visibility = $permissions & 0044 ? AdapterInterface::VISIBILITY_PUBLIC : AdapterInterface::VISIBILITY_PRIVATE; - $size = (int) $size; - - return compact('type', 'path', 'visibility', 'size'); - } - - /** - * Normalize a Windows/DOS file entry. - * - * @param string $item - * @param string $base - * - * @return array normalized file array - */ - protected function normalizeWindowsObject($item, $base) - { - $item = preg_replace('#\s+#', ' ', trim($item), 3); - list ($date, $time, $size, $name) = explode(' ', $item, 4); - $path = empty($base) ? $name : $base.$this->separator.$name; - - // Check for the correct date/time format - $format = strlen($date) === 8 ? "m-d-yH:iA" : "Y-m-dH:i"; - $timestamp = DateTime::createFromFormat($format, $date.$time)->getTimestamp(); - - if ($size === '') { - $type = 'dir'; - return compact('type', 'path', 'timestamp'); - } - - $type = 'file'; - $visibility = AdapterInterface::VISIBILITY_PUBLIC; - $size = (int) $size; - - return compact('type', 'path', 'visibility', 'size', 'timestamp'); - } - - /** - * Get the system type from a listing item. - * - * @param string $item - * - * @return string the system type - */ - protected function detectSystemType($item) - { - if (preg_match('/^[0-9]{2,4}-[0-9]{2}-[0-9]{2}/', $item)) { - return $this->systemType = 'windows'; - } - - return $this->systemType = 'unix'; - } - - /** - * Get the file type from the permissions. - * - * @param string $permissions - * - * @return string file type - */ - protected function detectType($permissions) - { - return substr($permissions, 0, 1) === 'd' ? 'dir' : 'file'; - } - - /** - * Normalize a permissions string. - * - * @param string $permissions - * - * @return int - */ - protected function normalizePermissions($permissions) - { - // remove the type identifier - $permissions = substr($permissions, 1); - - // map the string rights to the numeric counterparts - $map = ['-' => '0', 'r' => '4', 'w' => '2', 'x' => '1']; - $permissions = strtr($permissions, $map); - - // split up the permission groups - $parts = str_split($permissions, 3); - - // convert the groups - $mapper = function ($part) { - return array_sum(str_split($part)); - }; - - // get the sum of the groups - return array_sum(array_map($mapper, $parts)); - } - - /** - * Filter out dot-directories. - * - * @param array $list - * - * @return array - */ - public function removeDotDirectories(array $list) - { - $filter = function ($line) { - if (! empty($line) && ! preg_match('#.* \.(\.)?$|^total#', $line)) { - return true; - } - - return false; - }; - - return array_filter($list, $filter); - } - - /** - * {@inheritdoc} - */ - public function has($path) - { - return $this->getMetadata($path); - } - - /** - * {@inheritdoc} - */ - public function getSize($path) - { - return $this->getMetadata($path); - } - - /** - * {@inheritdoc} - */ - public function getTimestamp($path) - { - $timestamp = ftp_mdtm($this->getConnection(), $path); - - return ($timestamp !== -1) ? ['timestamp' => $timestamp] : false; - } - - /** - * {@inheritdoc} - */ - public function getVisibility($path) - { - return $this->getMetadata($path); - } - - /** - * Ensure a directory exists. - * - * @param string $dirname - */ - public function ensureDirectory($dirname) - { - if (! empty($dirname) && ! $this->has($dirname)) { - $this->createDir($dirname, new Config()); - } - } - - /** - * @return mixed - */ - public function getConnection() - { - if (! $this->connection) { - $this->connect(); - } - - return $this->connection; - } - - /** - * Get the public permission value. - * - * @return int - */ - public function getPermPublic() - { - return $this->permPublic; - } - - /** - * Get the private permission value. - * - * @return int - */ - public function getPermPrivate() - { - return $this->permPrivate; - } - - /** - * Disconnect on destruction. - */ - public function __destruct() - { - $this->disconnect(); - } - - /** - * Establish a connection. - */ - abstract public function connect(); - - /** - * Close the connection. - */ - abstract public function disconnect(); -} diff --git a/sitecake/2.2.9/server/vendor/league/flysystem/src/Adapter/Ftp.php b/sitecake/2.2.9/server/vendor/league/flysystem/src/Adapter/Ftp.php deleted file mode 100644 index 158cfce..0000000 --- a/sitecake/2.2.9/server/vendor/league/flysystem/src/Adapter/Ftp.php +++ /dev/null @@ -1,398 +0,0 @@ -transferMode = $mode; - - return $this; - } - - /** - * Set if Ssl is enabled. - * - * @param bool $ssl - * - * @return $this - */ - public function setSsl($ssl) - { - $this->ssl = (bool) $ssl; - - return $this; - } - - /** - * Set if passive mode should be used. - * - * @param bool $passive - */ - public function setPassive($passive = true) - { - $this->passive = $passive; - } - - /** - * Connect to the FTP server. - */ - public function connect() - { - if ($this->ssl) { - $this->connection = ftp_ssl_connect($this->getHost(), $this->getPort(), $this->getTimeout()); - } else { - $this->connection = ftp_connect($this->getHost(), $this->getPort(), $this->getTimeout()); - } - - if (! $this->connection) { - throw new RuntimeException('Could not connect to host: '.$this->getHost().', port:'.$this->getPort()); - } - - $this->login(); - $this->setConnectionPassiveMode(); - $this->setConnectionRoot(); - } - - /** - * Set the connections to passive mode. - * - * @throws RuntimeException - */ - protected function setConnectionPassiveMode() - { - if (! ftp_pasv($this->getConnection(), $this->passive)) { - throw new RuntimeException('Could not set passive mode for connection: '.$this->getHost().'::'.$this->getPort()); - } - } - - /** - * Set the connection root. - */ - protected function setConnectionRoot() - { - $root = $this->getRoot(); - $connection = $this->getConnection(); - - if (empty($root) === false && ! ftp_chdir($connection, $root)) { - throw new RuntimeException('Root is invalid or does not exist: '.$this->getRoot()); - } - - // Store absolute path for further reference. - // This is needed when creating directories and - // initial root was a relative path, else the root - // would be relative to the chdir'd path. - $this->root = ftp_pwd($connection); - } - - /** - * Login. - * - * @throws RuntimeException - */ - protected function login() - { - set_error_handler(function () {}); - $isLoggedIn = ftp_login($this->getConnection(), $this->getUsername(), $this->getPassword()); - restore_error_handler(); - - if (! $isLoggedIn) { - $this->disconnect(); - throw new RuntimeException('Could not login with connection: '.$this->getHost().'::'.$this->getPort().', username: '.$this->getUsername()); - } - } - - /** - * Disconnect from the FTP server. - */ - public function disconnect() - { - if ($this->connection) { - ftp_close($this->connection); - } - - $this->connection = null; - } - - /** - * {@inheritdoc} - */ - public function write($path, $contents, Config $config) - { - $stream = fopen('php://temp', 'w+b'); - fwrite($stream, $contents); - rewind($stream); - - $result = $this->writeStream($path, $stream, $config); - - fclose($stream); - - if ($result === false) { - return false; - } - - $result['contents'] = $contents; - $result['mimetype'] = Util::guessMimeType($path, $contents); - - return $result; - } - - /** - * {@inheritdoc} - */ - public function writeStream($path, $resource, Config $config) - { - $this->ensureDirectory(Util::dirname($path)); - - if (! ftp_fput($this->getConnection(), $path, $resource, $this->transferMode)) { - return false; - } - - if ($visibility = $config->get('visibility')) { - $this->setVisibility($path, $visibility); - } - - return compact('path', 'visibility'); - } - - /** - * {@inheritdoc} - */ - public function update($path, $contents, Config $config) - { - return $this->write($path, $contents, $config); - } - - /** - * {@inheritdoc} - */ - public function updateStream($path, $resource, Config $config) - { - return $this->writeStream($path, $resource, $config); - } - - /** - * {@inheritdoc} - */ - public function rename($path, $newpath) - { - return ftp_rename($this->getConnection(), $path, $newpath); - } - - /** - * {@inheritdoc} - */ - public function delete($path) - { - return ftp_delete($this->getConnection(), $path); - } - - /** - * {@inheritdoc} - */ - public function deleteDir($dirname) - { - $connection = $this->getConnection(); - $contents = array_reverse($this->listDirectoryContents($dirname)); - - foreach ($contents as $object) { - if ($object['type'] === 'file') { - if (! ftp_delete($connection, $object['path'])) { - return false; - } - } elseif (! ftp_rmdir($connection, $object['path'])) { - return false; - } - } - - return ftp_rmdir($connection, $dirname); - } - - /** - * {@inheritdoc} - */ - public function createDir($dirname, Config $config) - { - $result = false; - $connection = $this->getConnection(); - $directories = explode('/', $dirname); - - foreach ($directories as $directory) { - $result = $this->createActualDirectory($directory, $connection); - - if (! $result) { - break; - } - - ftp_chdir($connection, $directory); - } - - $this->setConnectionRoot(); - - if (! $result) { - return false; - } - - return ['path' => $dirname]; - } - - /** - * Create a directory. - * - * @param string $directory - * @param resource $connection - * - * @return bool - */ - protected function createActualDirectory($directory, $connection) - { - // List the current directory - $listing = ftp_nlist($connection, '.'); - - foreach ($listing as $key => $item) { - if (preg_match('~^\./.*~', $item)) { - $listing[$key] = substr($item, 2); - } - } - - if (in_array($directory, $listing)) { - return true; - } - - return (boolean) ftp_mkdir($connection, $directory); - } - - /** - * {@inheritdoc} - */ - public function getMetadata($path) - { - $connection = $this->getConnection(); - - if ($path === '') { - return ['type' => 'dir', 'path' => '']; - } - - if (@ftp_chdir($connection, $path) === true) { - $this->setConnectionRoot(); - - return ['type' => 'dir', 'path' => $path]; - } - - $listing = ftp_rawlist($connection, $path); - - if (empty($listing)) { - return false; - } - - $metadata = $this->normalizeObject($listing[0], ''); - - return $metadata; - } - - /** - * {@inheritdoc} - */ - public function getMimetype($path) - { - if (! $metadata = $this->read($path)) { - return false; - } - - $metadata['mimetype'] = Util::guessMimeType($path, $metadata['contents']); - - return $metadata; - } - - /** - * {@inheritdoc} - */ - public function read($path) - { - if (! $object = $this->readStream($path)) { - return false; - } - - $object['contents'] = stream_get_contents($object['stream']); - fclose($object['stream']); - unset($object['stream']); - - return $object; - } - - /** - * {@inheritdoc} - */ - public function readStream($path) - { - $stream = fopen('php://temp', 'w+'); - $result = ftp_fget($this->getConnection(), $stream, $path, $this->transferMode); - rewind($stream); - - if (! $result) { - fclose($stream); - - return false; - } - - return compact('stream'); - } - - /** - * {@inheritdoc} - */ - public function setVisibility($path, $visibility) - { - $mode = $visibility === AdapterInterface::VISIBILITY_PUBLIC ? $this->getPermPublic() : $this->getPermPrivate(); - - if (! ftp_chmod($this->getConnection(), $mode, $path)) { - return false; - } - - return compact('visibility'); - } - - /** - * {@inheritdoc} - * - * @param string $directory - */ - protected function listDirectoryContents($directory, $recursive = true) - { - $listing = ftp_rawlist($this->getConnection(), '-lna '.$directory, $recursive); - - return $listing ? $this->normalizeListing($listing, $directory) : []; - } -} diff --git a/sitecake/2.2.9/server/vendor/league/flysystem/src/Adapter/Ftpd.php b/sitecake/2.2.9/server/vendor/league/flysystem/src/Adapter/Ftpd.php deleted file mode 100644 index d682d56..0000000 --- a/sitecake/2.2.9/server/vendor/league/flysystem/src/Adapter/Ftpd.php +++ /dev/null @@ -1,36 +0,0 @@ -getConnection(), 'STAT '.$path)) || count($object) < 3) { - return false; - } - - if (substr($object[1], 0, 5) === "ftpd:") { - return false; - } - - return $this->normalizeObject($object[1], ''); - } - - /** - * {@inheritdoc} - */ - protected function listDirectoryContents($directory, $recursive = true) - { - $listing = ftp_rawlist($this->getConnection(), $directory, $recursive); - - if ($listing === false || (! empty($listing) && substr($listing[0], 0, 5) === "ftpd:")) { - return []; - } - - return $this->normalizeListing($listing, $directory); - } -} diff --git a/sitecake/2.2.9/server/vendor/league/flysystem/src/Adapter/Local.php b/sitecake/2.2.9/server/vendor/league/flysystem/src/Adapter/Local.php deleted file mode 100644 index 28bcc84..0000000 --- a/sitecake/2.2.9/server/vendor/league/flysystem/src/Adapter/Local.php +++ /dev/null @@ -1,401 +0,0 @@ - 0744, - 'private' => 0700, - ]; - - /** - * @var string - */ - protected $pathSeparator = DIRECTORY_SEPARATOR; - - /** - * Constructor. - * - * @param string $root - */ - public function __construct($root) - { - $realRoot = $this->ensureDirectory($root); - - if (! is_dir($realRoot) || ! is_readable($realRoot)) { - throw new \LogicException('The root path '.$root.' is not readable.'); - } - - $this->setPathPrefix($realRoot); - } - - /** - * Ensure the root directory exists. - * - * @param string $root root directory path - * - * @return string real path to root - */ - protected function ensureDirectory($root) - { - if (! is_dir($root)) { - $umask = umask(0); - mkdir($root, 0777, true); - umask($umask); - } - - return realpath($root); - } - - /** - * {@inheritdoc} - */ - public function has($path) - { - $location = $this->applyPathPrefix($path); - - return file_exists($location); - } - - /** - * {@inheritdoc} - */ - public function write($path, $contents, Config $config) - { - $location = $this->applyPathPrefix($path); - $this->ensureDirectory(dirname($location)); - - if (($size = file_put_contents($location, $contents, LOCK_EX)) === false) { - return false; - } - - $type = 'file'; - $result = compact('contents', 'type', 'size', 'path'); - - if ($visibility = $config->get('visibility')) { - $result['visibility'] = $visibility; - $this->setVisibility($path, $visibility); - } - - return $result; - } - - /** - * {@inheritdoc} - */ - public function writeStream($path, $resource, Config $config) - { - $location = $this->applyPathPrefix($path); - $this->ensureDirectory(dirname($location)); - - if (! $stream = fopen($location, 'w+')) { - return false; - } - - stream_copy_to_stream($resource, $stream); - - if (! fclose($stream)) { - return false; - } - - if ($visibility = $config->get('visibility')) { - $this->setVisibility($path, $visibility); - } - - return compact('path', 'visibility'); - } - - /** - * {@inheritdoc} - */ - public function readStream($path) - { - $location = $this->applyPathPrefix($path); - $stream = fopen($location, 'r'); - - return compact('stream', 'path'); - } - - /** - * {@inheritdoc} - */ - public function updateStream($path, $resource, Config $config) - { - return $this->writeStream($path, $resource, $config); - } - - /** - * {@inheritdoc} - */ - public function update($path, $contents, Config $config) - { - $location = $this->applyPathPrefix($path); - $mimetype = Util::guessMimeType($path, $contents); - - if (($size = file_put_contents($location, $contents, LOCK_EX)) === false) { - return false; - } - - return compact('path', 'size', 'contents', 'mimetype'); - } - - /** - * {@inheritdoc} - */ - public function read($path) - { - $location = $this->applyPathPrefix($path); - $contents = file_get_contents($location); - - if ($contents === false) { - return false; - } - - return compact('contents', 'path'); - } - - /** - * {@inheritdoc} - */ - public function rename($path, $newpath) - { - $location = $this->applyPathPrefix($path); - $destination = $this->applyPathPrefix($newpath); - $parentDirectory = $this->applyPathPrefix(Util::dirname($newpath)); - $this->ensureDirectory($parentDirectory); - - return rename($location, $destination); - } - - /** - * {@inheritdoc} - */ - public function copy($path, $newpath) - { - $location = $this->applyPathPrefix($path); - $destination = $this->applyPathPrefix($newpath); - $this->ensureDirectory(dirname($destination)); - - return copy($location, $destination); - } - - /** - * {@inheritdoc} - */ - public function delete($path) - { - $location = $this->applyPathPrefix($path); - - return unlink($location); - } - - /** - * {@inheritdoc} - */ - public function listContents($directory = '', $recursive = false) - { - $result = []; - $location = $this->applyPathPrefix($directory).$this->pathSeparator; - - if (! is_dir($location)) { - return []; - } - - $iterator = $recursive ? $this->getRecursiveDirectoryIterator($location) : $this->getDirectoryIterator($location); - - foreach ($iterator as $file) { - $path = $this->getFilePath($file); - if (preg_match('#(^|/|\\\\)\.{1,2}$#', $path)) { - continue; - } - $result[] = $this->normalizeFileInfo($file); - } - - return $result; - } - - /** - * {@inheritdoc} - */ - public function getMetadata($path) - { - $location = $this->applyPathPrefix($path); - $info = new SplFileInfo($location); - - return $this->normalizeFileInfo($info); - } - - /** - * {@inheritdoc} - */ - public function getSize($path) - { - return $this->getMetadata($path); - } - - /** - * {@inheritdoc} - */ - public function getMimetype($path) - { - $location = $this->applyPathPrefix($path); - $finfo = new Finfo(FILEINFO_MIME_TYPE); - - return ['mimetype' => $finfo->file($location)]; - } - - /** - * {@inheritdoc} - */ - public function getTimestamp($path) - { - return $this->getMetadata($path); - } - - /** - * {@inheritdoc} - */ - public function getVisibility($path) - { - $location = $this->applyPathPrefix($path); - clearstatcache(false, $location); - $permissions = octdec(substr(sprintf('%o', fileperms($location)), -4)); - $visibility = $permissions & 0044 ? AdapterInterface::VISIBILITY_PUBLIC : AdapterInterface::VISIBILITY_PRIVATE; - - return compact('visibility'); - } - - /** - * {@inheritdoc} - */ - public function setVisibility($path, $visibility) - { - $location = $this->applyPathPrefix($path); - chmod($location, static::$permissions[$visibility]); - - return compact('visibility'); - } - - /** - * {@inheritdoc} - */ - public function createDir($dirname, Config $config) - { - $location = $this->applyPathPrefix($dirname); - $umask = umask(0); - - if (! is_dir($location) && ! mkdir($location, 0777, true)) { - $return = false; - } else { - $return = ['path' => $dirname, 'type' => 'dir']; - } - - umask($umask); - - return $return; - } - - /** - * {@inheritdoc} - */ - public function deleteDir($dirname) - { - $location = $this->applyPathPrefix($dirname); - - if (! is_dir($location)) { - return false; - } - - $contents = $this->listContents($dirname, true); - $contents = array_reverse($contents); - - foreach ($contents as $file) { - if ($file['type'] !== 'dir') { - unlink($this->applyPathPrefix($file['path'])); - } else { - rmdir($this->applyPathPrefix($file['path'])); - } - } - - return rmdir($location); - } - - /** - * Normalize the file info. - * - * @param SplFileInfo $file - * - * @return array - */ - protected function normalizeFileInfo(SplFileInfo $file) - { - if ($file->isLink()) { - throw NotSupportedException::forLink($file); - } - - $normalized = [ - 'type' => $file->getType(), - 'path' => $this->getFilePath($file), - ]; - - $normalized['timestamp'] = $file->getMTime(); - - if ($normalized['type'] === 'file') { - $normalized['size'] = $file->getSize(); - } - - return $normalized; - } - - /** - * Get the normalized path from a SplFileInfo object. - * - * @param SplFileInfo $file - * - * @return string - */ - protected function getFilePath(SplFileInfo $file) - { - $path = $file->getPathname(); - $path = $this->removePathPrefix($path); - - return trim($path, '\\/'); - } - - /** - * @param string $path - * - * @return RecursiveIteratorIterator - */ - protected function getRecursiveDirectoryIterator($path) - { - $directory = new RecursiveDirectoryIterator($path, FilesystemIterator::SKIP_DOTS); - $iterator = new RecursiveIteratorIterator($directory, RecursiveIteratorIterator::SELF_FIRST); - - return $iterator; - } - - /** - * @param string $path - * - * @return DirectoryIterator - */ - protected function getDirectoryIterator($path) - { - $iterator = new DirectoryIterator($path); - - return $iterator; - } -} diff --git a/sitecake/2.2.9/server/vendor/league/flysystem/src/Adapter/NullAdapter.php b/sitecake/2.2.9/server/vendor/league/flysystem/src/Adapter/NullAdapter.php deleted file mode 100644 index 659acc2..0000000 --- a/sitecake/2.2.9/server/vendor/league/flysystem/src/Adapter/NullAdapter.php +++ /dev/null @@ -1,144 +0,0 @@ -get('visibility')) { - $result['visibility'] = $visibility; - } - - return $result; - } - - /** - * {@inheritdoc} - */ - public function update($path, $contents, Config $config) - { - return false; - } - - /** - * {@inheritdoc} - */ - public function read($path) - { - return false; - } - - /** - * {@inheritdoc} - */ - public function rename($path, $newpath) - { - return false; - } - - /** - * {@inheritdoc} - */ - public function delete($path) - { - return false; - } - - /** - * {@inheritdoc} - */ - public function listContents($directory = '', $recursive = false) - { - return []; - } - - /** - * {@inheritdoc} - */ - public function getMetadata($path) - { - return false; - } - - /** - * {@inheritdoc} - */ - public function getSize($path) - { - return false; - } - - /** - * {@inheritdoc} - */ - public function getMimetype($path) - { - return false; - } - - /** - * {@inheritdoc} - */ - public function getTimestamp($path) - { - return false; - } - - /** - * {@inheritdoc} - */ - public function getVisibility($path) - { - return false; - } - - /** - * {@inheritdoc} - */ - public function setVisibility($path, $visibility) - { - return compact('visibility'); - } - - /** - * {@inheritdoc} - */ - public function createDir($dirname, Config $config) - { - return ['path' => $dirname, 'type' => 'dir']; - } - - /** - * {@inheritdoc} - */ - public function deleteDir($dirname) - { - return false; - } -} diff --git a/sitecake/2.2.9/server/vendor/league/flysystem/src/Adapter/Polyfill/NotSupportingVisibilityTrait.php b/sitecake/2.2.9/server/vendor/league/flysystem/src/Adapter/Polyfill/NotSupportingVisibilityTrait.php deleted file mode 100644 index 64de443..0000000 --- a/sitecake/2.2.9/server/vendor/league/flysystem/src/Adapter/Polyfill/NotSupportingVisibilityTrait.php +++ /dev/null @@ -1,33 +0,0 @@ -readStream($path); - - if ($response === false || ! is_resource($response['stream'])) { - return false; - } - - $result = $this->writeStream($newpath, $response['stream'], new Config()); - - if ($result !== false && is_resource($response['stream'])) { - fclose($response['stream']); - } - - return $result !== false; - } - - // Required abstract method - - /** - * @param string $path - */ - abstract public function readStream($path); - - /** - * @param string $path - */ - abstract public function writeStream($path, $resource, Config $config); -} diff --git a/sitecake/2.2.9/server/vendor/league/flysystem/src/Adapter/Polyfill/StreamedReadingTrait.php b/sitecake/2.2.9/server/vendor/league/flysystem/src/Adapter/Polyfill/StreamedReadingTrait.php deleted file mode 100644 index 3cd6ab4..0000000 --- a/sitecake/2.2.9/server/vendor/league/flysystem/src/Adapter/Polyfill/StreamedReadingTrait.php +++ /dev/null @@ -1,37 +0,0 @@ -read($path)) { - return false; - } - - $stream = tmpfile(); - fwrite($stream, $data['contents']); - rewind($stream); - $data['stream'] = $stream; - unset($data['contents']); - - return $data; - } - - // Required abstract method - - /** - * @param string $path - * - * @return resource - */ - abstract public function read($path); -} diff --git a/sitecake/2.2.9/server/vendor/league/flysystem/src/Adapter/Polyfill/StreamedTrait.php b/sitecake/2.2.9/server/vendor/league/flysystem/src/Adapter/Polyfill/StreamedTrait.php deleted file mode 100644 index 8042496..0000000 --- a/sitecake/2.2.9/server/vendor/league/flysystem/src/Adapter/Polyfill/StreamedTrait.php +++ /dev/null @@ -1,9 +0,0 @@ -stream($path, $resource, $config, 'write'); - } - - /** - * Update a file using a stream. - * - * @param string $path - * @param resource $resource - * @param Config $config Config object or visibility setting - * - * @return mixed false of file metadata - */ - public function updateStream($path, $resource, Config $config) - { - return $this->stream($path, $resource, $config, 'update'); - } - - // Required abstract methods - abstract public function write($pash, $contents, Config $config); - abstract public function update($pash, $contents, Config $config); -} diff --git a/sitecake/2.2.9/server/vendor/league/flysystem/src/Adapter/SynologyFtp.php b/sitecake/2.2.9/server/vendor/league/flysystem/src/Adapter/SynologyFtp.php deleted file mode 100644 index fe0d344..0000000 --- a/sitecake/2.2.9/server/vendor/league/flysystem/src/Adapter/SynologyFtp.php +++ /dev/null @@ -1,8 +0,0 @@ -settings = $settings; - } - - /** - * Get a setting. - * - * @param string $key - * @param mixed $default - * - * @return mixed config setting or default when not found - */ - public function get($key, $default = null) - { - if (! array_key_exists($key, $this->settings)) { - return $this->getDefault($key, $default); - } - - return $this->settings[$key]; - } - - /** - * Check if an item exists by key. - * - * @param string $key - * - * @return bool - */ - public function has($key) - { - return array_key_exists($key, $this->settings); - } - - /** - * Try to retrieve a default setting from a config fallback. - * - * @param string $key - * @param mixed $default - * - * @return mixed config setting or default when not found - */ - protected function getDefault($key, $default) - { - if (! $this->fallback) { - return $default; - } - - return $this->fallback->get($key, $default); - } - - /** - * Set a setting. - * - * @param string $key - * @param mixed $value - * - * @return $this - */ - public function set($key, $value) - { - $this->settings[$key] = $value; - - return $this; - } - - /** - * Set the fallback. - * - * @param Config $fallback - * - * @return $this - */ - public function setFallback(Config $fallback) - { - $this->fallback = $fallback; - - return $this; - } -} diff --git a/sitecake/2.2.9/server/vendor/league/flysystem/src/Directory.php b/sitecake/2.2.9/server/vendor/league/flysystem/src/Directory.php deleted file mode 100644 index 6ba744b..0000000 --- a/sitecake/2.2.9/server/vendor/league/flysystem/src/Directory.php +++ /dev/null @@ -1,28 +0,0 @@ -filesystem->deleteDir($this->path); - } - - /** - * List the directory contents. - * - * @param bool $recursive - * - * @return array|bool directory contents or false - */ - public function getContents($recursive = false) - { - return $this->filesystem->listContents($this->path, $recursive); - } -} diff --git a/sitecake/2.2.9/server/vendor/league/flysystem/src/Exception.php b/sitecake/2.2.9/server/vendor/league/flysystem/src/Exception.php deleted file mode 100644 index d4a9907..0000000 --- a/sitecake/2.2.9/server/vendor/league/flysystem/src/Exception.php +++ /dev/null @@ -1,8 +0,0 @@ -filesystem->has($this->path); - } - - /** - * Read the file. - * - * @return string file contents - */ - public function read() - { - return $this->filesystem->read($this->path); - } - - /** - * Read the file as a stream. - * - * @return resource file stream - */ - public function readStream() - { - return $this->filesystem->readStream($this->path); - } - - /** - * Write the new file. - * - * @param string $content - * - * @return bool success boolean - */ - public function write($content) - { - return $this->filesystem->write($this->path, $content); - } - - /** - * Write the new file using a stream. - * - * @param resource $resource - * - * @return bool success boolean - */ - public function writeStream($resource) - { - return $this->filesystem->writeStream($this->path, $resource); - } - - /** - * Update the file contents. - * - * @param string $content - * - * @return bool success boolean - */ - public function update($content) - { - return $this->filesystem->update($this->path, $content); - } - - /** - * Update the file contents with a stream. - * - * @param resource $resource - * - * @return bool success boolean - */ - public function updateStream($resource) - { - return $this->filesystem->updateStream($this->path, $resource); - } - - /** - * Create the file or update if exists. - * - * @param string $content - * - * @return bool success boolean - */ - public function put($content) - { - return $this->filesystem->put($this->path, $content); - } - - /** - * Create the file or update if exists using a stream. - * - * @param resource $resource - * - * @return bool success boolean - */ - public function putStream($resource) - { - return $this->filesystem->putStream($this->path, $resource); - } - - /** - * Rename the file. - * - * @param string $newpath - * - * @return bool success boolean - */ - public function rename($newpath) - { - if ($this->filesystem->rename($this->path, $newpath)) { - $this->path = $newpath; - - return true; - } - - return false; - } - - /** - * Copy the file. - * - * @param string $newpath - * - * @return File|false new file or false - */ - public function copy($newpath) - { - if ($this->filesystem->copy($this->path, $newpath)) { - return new File($this->filesystem, $newpath); - } - - return false; - } - - /** - * Get the file's timestamp. - * - * @return int unix timestamp - */ - public function getTimestamp() - { - return $this->filesystem->getTimestamp($this->path); - } - - /** - * Get the file's mimetype. - * - * @return string mimetime - */ - public function getMimetype() - { - return $this->filesystem->getMimetype($this->path); - } - - /** - * Get the file's visibility. - * - * @return string visibility - */ - public function getVisibility() - { - return $this->filesystem->getVisibility($this->path); - } - - /** - * Get the file's metadata. - * - * @return array - */ - public function getMetadata() - { - return $this->filesystem->getMetadata($this->path); - } - - /** - * Get the file size. - * - * @return int file size - */ - public function getSize() - { - return $this->filesystem->getSize($this->path); - } - - /** - * Delete the file. - * - * @return bool success boolean - */ - public function delete() - { - return $this->filesystem->delete($this->path); - } -} diff --git a/sitecake/2.2.9/server/vendor/league/flysystem/src/FileExistsException.php b/sitecake/2.2.9/server/vendor/league/flysystem/src/FileExistsException.php deleted file mode 100644 index b77059f..0000000 --- a/sitecake/2.2.9/server/vendor/league/flysystem/src/FileExistsException.php +++ /dev/null @@ -1,37 +0,0 @@ -path = $path; - - parent::__construct('File already exists at path: '.$this->getPath(), $code, $previous); - } - - /** - * Get the path which was not found. - * - * @return string - */ - public function getPath() - { - return $this->path; - } -} diff --git a/sitecake/2.2.9/server/vendor/league/flysystem/src/FileNotFoundException.php b/sitecake/2.2.9/server/vendor/league/flysystem/src/FileNotFoundException.php deleted file mode 100644 index b66a4cc..0000000 --- a/sitecake/2.2.9/server/vendor/league/flysystem/src/FileNotFoundException.php +++ /dev/null @@ -1,37 +0,0 @@ -path = $path; - - parent::__construct('File not found at path: '.$this->getPath(), $code, $previous); - } - - /** - * Get the path which was not found. - * - * @return string - */ - public function getPath() - { - return $this->path; - } -} diff --git a/sitecake/2.2.9/server/vendor/league/flysystem/src/Filesystem.php b/sitecake/2.2.9/server/vendor/league/flysystem/src/Filesystem.php deleted file mode 100644 index 4f79482..0000000 --- a/sitecake/2.2.9/server/vendor/league/flysystem/src/Filesystem.php +++ /dev/null @@ -1,464 +0,0 @@ -adapter = $adapter; - $this->config = Util::ensureConfig($config); - } - - /** - * Get the Adapter. - * - * @return AdapterInterface adapter - */ - public function getAdapter() - { - return $this->adapter; - } - - /** - * Get the Config. - * - * @return Config config object - */ - public function getConfig() - { - return $this->config; - } - - /** - * {@inheritdoc} - */ - public function has($path) - { - $path = Util::normalizePath($path); - - return (bool) $this->getAdapter()->has($path); - } - - /** - * {@inheritdoc} - */ - public function write($path, $contents, array $config = []) - { - $path = Util::normalizePath($path); - $this->assertAbsent($path); - $config = $this->prepareConfig($config); - - return (bool) $this->getAdapter()->write($path, $contents, $config); - } - - /** - * {@inheritdoc} - */ - public function writeStream($path, $resource, array $config = []) - { - if (! is_resource($resource)) { - throw new InvalidArgumentException(__METHOD__.' expects argument #2 to be a valid resource.'); - } - - $path = Util::normalizePath($path); - $this->assertAbsent($path); - $config = $this->prepareConfig($config); - - Util::rewindStream($resource); - - return (bool) $this->getAdapter()->writeStream($path, $resource, $config); - } - - /** - * {@inheritdoc} - */ - public function put($path, $contents, array $config = []) - { - $path = Util::normalizePath($path); - $config = $this->prepareConfig($config); - - if ($this->has($path)) { - return (bool) $this->getAdapter()->update($path, $contents, $config); - } - - return (bool) $this->getAdapter()->write($path, $contents, $config); - } - - /** - * {@inheritdoc} - */ - public function putStream($path, $resource, array $config = []) - { - if (! is_resource($resource)) { - throw new InvalidArgumentException(__METHOD__.' expects argument #2 to be a valid resource.'); - } - - $path = Util::normalizePath($path); - $config = $this->prepareConfig($config); - Util::rewindStream($resource); - - if ($this->has($path)) { - return (bool) $this->getAdapter()->updateStream($path, $resource, $config); - } - - return (bool) $this->getAdapter()->writeStream($path, $resource, $config); - } - - /** - * {@inheritdoc} - */ - public function readAndDelete($path) - { - $path = Util::normalizePath($path); - $this->assertPresent($path); - $contents = $this->read($path); - - if ($contents === false) { - return false; - } - - $this->delete($path); - - return $contents; - } - - /** - * {@inheritdoc} - */ - public function update($path, $contents, array $config = []) - { - $path = Util::normalizePath($path); - $config = $this->prepareConfig($config); - - $this->assertPresent($path); - - return (bool) $this->getAdapter()->update($path, $contents, $config); - } - - /** - * {@inheritdoc} - */ - public function updateStream($path, $resource, array $config = []) - { - if (! is_resource($resource)) { - throw new InvalidArgumentException(__METHOD__.' expects argument #2 to be a valid resource.'); - } - - $path = Util::normalizePath($path); - $config = $this->prepareConfig($config); - $this->assertPresent($path); - Util::rewindStream($resource); - - return (bool) $this->getAdapter()->updateStream($path, $resource, $config); - } - - /** - * {@inheritdoc} - */ - public function read($path) - { - $path = Util::normalizePath($path); - $this->assertPresent($path); - - if (! ($object = $this->getAdapter()->read($path))) { - return false; - } - - return $object['contents']; - } - - /** - * {@inheritdoc} - */ - public function readStream($path) - { - $path = Util::normalizePath($path); - $this->assertPresent($path); - - if (! $object = $this->getAdapter()->readStream($path)) { - return false; - } - - return $object['stream']; - } - - /** - * {@inheritdoc} - */ - public function rename($path, $newpath) - { - $path = Util::normalizePath($path); - $newpath = Util::normalizePath($newpath); - $this->assertPresent($path); - $this->assertAbsent($newpath); - - return (bool) $this->getAdapter()->rename($path, $newpath); - } - - /** - * {@inheritdoc} - */ - public function copy($path, $newpath) - { - $path = Util::normalizePath($path); - $newpath = Util::normalizePath($newpath); - $this->assertPresent($path); - $this->assertAbsent($newpath); - - return $this->getAdapter()->copy($path, $newpath); - } - - /** - * {@inheritdoc} - */ - public function delete($path) - { - $path = Util::normalizePath($path); - $this->assertPresent($path); - - return $this->getAdapter()->delete($path); - } - - /** - * {@inheritdoc} - */ - public function deleteDir($dirname) - { - $dirname = Util::normalizePath($dirname); - - if ($dirname === '') { - throw new RootViolationException('Root directories can not be deleted.'); - } - - return (bool) $this->getAdapter()->deleteDir($dirname); - } - - /** - * {@inheritdoc} - */ - public function createDir($dirname, array $config = []) - { - $dirname = Util::normalizePath($dirname); - $config = $this->prepareConfig($config); - - return (bool) $this->getAdapter()->createDir($dirname, $config); - } - - /** - * {@inheritdoc} - */ - public function listContents($directory = '', $recursive = false) - { - $directory = Util::normalizePath($directory); - $contents = $this->getAdapter()->listContents($directory, $recursive); - $mapper = function ($entry) use ($directory, $recursive) { - $entry = $entry + Util::pathinfo($entry['path']); - - if (! empty($directory) && strpos($entry['path'], $directory) === false) { - return false; - } - - if ($recursive === false && Util::dirname($entry['path']) !== $directory) { - return false; - } - - return $entry; - }; - - return array_values(array_filter(array_map($mapper, $contents))); - } - - /** - * {@inheritdoc} - */ - public function getMimetype($path) - { - $path = Util::normalizePath($path); - $this->assertPresent($path); - - if (! $object = $this->getAdapter()->getMimetype($path)) { - return false; - } - - return $object['mimetype']; - } - - /** - * {@inheritdoc} - */ - public function getTimestamp($path) - { - $path = Util::normalizePath($path); - $this->assertPresent($path); - - if (! $object = $this->getAdapter()->getTimestamp($path)) { - return false; - } - - return $object['timestamp']; - } - - /** - * {@inheritdoc} - */ - public function getVisibility($path) - { - $path = Util::normalizePath($path); - $this->assertPresent($path); - - if (($object = $this->getAdapter()->getVisibility($path)) === false) { - return false; - } - - return $object['visibility']; - } - - /** - * {@inheritdoc} - */ - public function getSize($path) - { - $path = Util::normalizePath($path); - - if (($object = $this->getAdapter()->getSize($path)) === false || !isset($object['size'])) { - return false; - } - - return (int) $object['size']; - } - - /** - * {@inheritdoc} - */ - public function setVisibility($path, $visibility) - { - $path = Util::normalizePath($path); - - return (bool) $this->getAdapter()->setVisibility($path, $visibility); - } - - /** - * {@inheritdoc} - */ - public function getMetadata($path) - { - $path = Util::normalizePath($path); - $this->assertPresent($path); - - return $this->getAdapter()->getMetadata($path); - } - - /** - * {@inheritdoc} - */ - public function get($path, Handler $handler = null) - { - $path = Util::normalizePath($path); - - if (! $handler) { - $metadata = $this->getMetadata($path); - $handler = $metadata['type'] === 'file' ? new File($this, $path) : new Directory($this, $path); - } - - $handler->setPath($path); - $handler->setFilesystem($this); - - return $handler; - } - - /** - * Convert a config array to a Config object with the correct fallback. - * - * @param array $config - * - * @return Config - */ - protected function prepareConfig(array $config) - { - $config = new Config($config); - $config->setFallback($this->config); - - return $config; - } - - /** - * Assert a file is present. - * - * @param string $path path to file - * - * @throws FileNotFoundException - */ - public function assertPresent($path) - { - if (! $this->has($path)) { - throw new FileNotFoundException($path); - } - } - - /** - * Assert a file is absent. - * - * @param string $path path to file - * - * @throws FileExistsException - */ - public function assertAbsent($path) - { - if ($this->has($path)) { - throw new FileExistsException($path); - } - } - - /** - * Plugins pass-through. - * - * @param string $method - * @param array $arguments - * - * @throws BadMethodCallException - * - * @return mixed - */ - public function __call($method, array $arguments) - { - try { - return $this->invokePlugin($method, $arguments, $this); - } catch (PluginNotFoundException $e) { - throw new BadMethodCallException( - 'Call to undefined method ' - .__CLASS__ - .'::'.$method - ); - } - } -} diff --git a/sitecake/2.2.9/server/vendor/league/flysystem/src/FilesystemInterface.php b/sitecake/2.2.9/server/vendor/league/flysystem/src/FilesystemInterface.php deleted file mode 100644 index d631443..0000000 --- a/sitecake/2.2.9/server/vendor/league/flysystem/src/FilesystemInterface.php +++ /dev/null @@ -1,276 +0,0 @@ -path = $path; - $this->filesystem = $filesystem; - } - - /** - * Check whether the entree is a directory. - * - * @return bool - */ - public function isDir() - { - return $this->getType() === 'dir'; - } - - /** - * Check whether the entree is a file. - * - * @return bool - */ - public function isFile() - { - return $this->getType() === 'file'; - } - - /** - * Retrieve the entree type (file|dir). - * - * @return string file or dir - */ - public function getType() - { - $metadata = $this->filesystem->getMetadata($this->path); - - return $metadata['type']; - } - - /** - * Set the Filesystem object. - * - * @param FilesystemInterface $filesystem - * - * @return $this - */ - public function setFilesystem(FilesystemInterface $filesystem) - { - $this->filesystem = $filesystem; - - return $this; - } - - /** - * Set the entree path. - * - * @param string $path - * - * @return $this - */ - public function setPath($path) - { - $this->path = $path; - - return $this; - } - - /** - * Retrieve the entree path. - * - * @return string path - */ - public function getPath() - { - return $this->path; - } -} diff --git a/sitecake/2.2.9/server/vendor/league/flysystem/src/MountManager.php b/sitecake/2.2.9/server/vendor/league/flysystem/src/MountManager.php deleted file mode 100644 index 576b1cc..0000000 --- a/sitecake/2.2.9/server/vendor/league/flysystem/src/MountManager.php +++ /dev/null @@ -1,267 +0,0 @@ -mountFilesystems($filesystems); - } - - /** - * Mount filesystems. - * - * @param array $filesystems [:prefix => Filesystem,] - * - * @return $this - */ - public function mountFilesystems(array $filesystems) - { - foreach ($filesystems as $prefix => $filesystem) { - $this->mountFilesystem($prefix, $filesystem); - } - - return $this; - } - - /** - * Mount filesystems. - * - * @param string $prefix - * @param FilesystemInterface $filesystem - * - * @return $this - */ - public function mountFilesystem($prefix, FilesystemInterface $filesystem) - { - if (! is_string($prefix)) { - throw new InvalidArgumentException(__METHOD__.' expects argument #1 to be a string.'); - } - - $this->filesystems[$prefix] = $filesystem; - - return $this; - } - - /** - * Get the filesystem with the corresponding prefix. - * - * @param string $prefix - * - * @throws LogicException - * - * @return FilesystemInterface - */ - public function getFilesystem($prefix) - { - if (! isset($this->filesystems[$prefix])) { - throw new LogicException('No filesystem mounted with prefix '.$prefix); - } - - return $this->filesystems[$prefix]; - } - - /** - * Retrieve the prefix from an arguments array. - * - * @param array $arguments - * - * @return array [:prefix, :arguments] - */ - public function filterPrefix(array $arguments) - { - if (empty($arguments)) { - throw new LogicException('At least one argument needed'); - } - - $path = array_shift($arguments); - - if (! is_string($path)) { - throw new InvalidArgumentException('First argument should be a string'); - } - - if (! preg_match('#^[a-zA-Z0-9]+\:\/\/.*#', $path)) { - throw new InvalidArgumentException('No prefix detected in path: '.$path); - } - - list($prefix, $path) = explode('://', $path, 2); - array_unshift($arguments, $path); - - return [$prefix, $arguments]; - } - - /** - * @param string $directory - * @param bool $recursive - * - * @return array - */ - public function listContents($directory = '', $recursive = false) - { - list($prefix, $arguments) = $this->filterPrefix([$directory]); - $filesystem = $this->getFilesystem($prefix); - $directory = array_shift($arguments); - $result = $filesystem->listContents($directory, $recursive); - - foreach ($result as &$file) { - $file['filesystem'] = $prefix; - } - - return $result; - } - - /** - * Call forwarder. - * - * @param string $method - * @param array $arguments - * - * @return mixed - */ - public function __call($method, $arguments) - { - list($prefix, $arguments) = $this->filterPrefix($arguments); - - return $this->invokePluginOnFilesystem($method, $arguments, $prefix); - } - - /** - * @param $from - * @param $to - * - * @return bool - */ - public function copy($from, $to) - { - list($prefixFrom, $arguments) = $this->filterPrefix([$from]); - - $fsFrom = $this->getFilesystem($prefixFrom); - $buffer = call_user_func_array([$fsFrom, 'readStream'], $arguments); - - if ($buffer === false) { - return false; - } - - list($prefixTo, $arguments) = $this->filterPrefix([$to]); - - $fsTo = $this->getFilesystem($prefixTo); - $result = call_user_func_array([$fsTo, 'writeStream'], array_merge($arguments, [$buffer])); - - if (is_resource($buffer)) { - fclose($buffer); - } - - return $result; - } - - /** - * List with plugin adapter. - * - * @param array $keys - * @param string $directory - * @param bool $recursive - */ - public function listWith(array $keys = [], $directory = '', $recursive = false) - { - list($prefix, $arguments) = $this->filterPrefix([$directory]); - $directory = $arguments[0]; - $arguments = [$keys, $directory, $recursive]; - - return $this->invokePluginOnFilesystem('listWith', $arguments, $prefix); - } - - /** - * Move a file. - * - * @param $from - * @param $to - * @return bool - */ - public function move($from, $to) - { - $copied = $this->copy($from, $to); - - if ($copied) { - return $this->delete($from); - } - - return false; - } - - /** - * Invoke a plugin on a filesystem mounted on a given prefix. - * - * @param $method - * @param $arguments - * @param $prefix - * @return mixed - */ - public function invokePluginOnFilesystem($method, $arguments, $prefix) - { - $filesystem = $this->getFilesystem($prefix); - - try { - return $this->invokePlugin($method, $arguments, $filesystem); - } catch (PluginNotFoundException $e) { - // Let it pass, it's ok, don't panic. - } - - $callback = [$filesystem, $method]; - - return call_user_func_array($callback, $arguments); - } -} diff --git a/sitecake/2.2.9/server/vendor/league/flysystem/src/NotSupportedException.php b/sitecake/2.2.9/server/vendor/league/flysystem/src/NotSupportedException.php deleted file mode 100644 index ab58f9e..0000000 --- a/sitecake/2.2.9/server/vendor/league/flysystem/src/NotSupportedException.php +++ /dev/null @@ -1,35 +0,0 @@ -getPathname()); - } - - /** - * Create a new exception for a link. - * - * @param string $systemType - * @return static - */ - public static function forFtpSystemType($systemType) - { - $message = "The FTP system type '$systemType' is currently not supported."; - - return new static($message); - } -} diff --git a/sitecake/2.2.9/server/vendor/league/flysystem/src/Plugin/AbstractPlugin.php b/sitecake/2.2.9/server/vendor/league/flysystem/src/Plugin/AbstractPlugin.php deleted file mode 100644 index 0d56789..0000000 --- a/sitecake/2.2.9/server/vendor/league/flysystem/src/Plugin/AbstractPlugin.php +++ /dev/null @@ -1,24 +0,0 @@ -filesystem = $filesystem; - } -} diff --git a/sitecake/2.2.9/server/vendor/league/flysystem/src/Plugin/EmptyDir.php b/sitecake/2.2.9/server/vendor/league/flysystem/src/Plugin/EmptyDir.php deleted file mode 100644 index 9502333..0000000 --- a/sitecake/2.2.9/server/vendor/league/flysystem/src/Plugin/EmptyDir.php +++ /dev/null @@ -1,34 +0,0 @@ -filesystem->listContents($dirname, false); - - foreach ($listing as $item) { - if ($item['type'] === 'dir') { - $this->filesystem->deleteDir($item['path']); - } else { - $this->filesystem->delete($item['path']); - } - } - } -} diff --git a/sitecake/2.2.9/server/vendor/league/flysystem/src/Plugin/GetWithMetadata.php b/sitecake/2.2.9/server/vendor/league/flysystem/src/Plugin/GetWithMetadata.php deleted file mode 100644 index b88fd68..0000000 --- a/sitecake/2.2.9/server/vendor/league/flysystem/src/Plugin/GetWithMetadata.php +++ /dev/null @@ -1,49 +0,0 @@ -filesystem->getMetadata($path); - - if (! $object) { - return false; - } - - $keys = array_diff($metadata, array_keys($object)); - - foreach ($keys as $key) { - if (! method_exists($this->filesystem, $method = 'get'.ucfirst($key))) { - throw new InvalidArgumentException('Could not fetch metadata: '.$key); - } - - $object[$key] = $this->filesystem->{$method}($path); - } - - return $object; - } -} diff --git a/sitecake/2.2.9/server/vendor/league/flysystem/src/Plugin/ListFiles.php b/sitecake/2.2.9/server/vendor/league/flysystem/src/Plugin/ListFiles.php deleted file mode 100644 index 9669fe7..0000000 --- a/sitecake/2.2.9/server/vendor/league/flysystem/src/Plugin/ListFiles.php +++ /dev/null @@ -1,35 +0,0 @@ -filesystem->listContents($directory, $recursive); - - $filter = function ($object) { - return $object['type'] === 'file'; - }; - - return array_values(array_filter($contents, $filter)); - } -} diff --git a/sitecake/2.2.9/server/vendor/league/flysystem/src/Plugin/ListPaths.php b/sitecake/2.2.9/server/vendor/league/flysystem/src/Plugin/ListPaths.php deleted file mode 100644 index 514bdf0..0000000 --- a/sitecake/2.2.9/server/vendor/league/flysystem/src/Plugin/ListPaths.php +++ /dev/null @@ -1,36 +0,0 @@ -filesystem->listContents($directory, $recursive); - - foreach ($contents as $object) { - $result[] = $object['path']; - } - - return $result; - } -} diff --git a/sitecake/2.2.9/server/vendor/league/flysystem/src/Plugin/ListWith.php b/sitecake/2.2.9/server/vendor/league/flysystem/src/Plugin/ListWith.php deleted file mode 100644 index 341a219..0000000 --- a/sitecake/2.2.9/server/vendor/league/flysystem/src/Plugin/ListWith.php +++ /dev/null @@ -1,60 +0,0 @@ -filesystem->listContents($directory, $recursive); - - foreach ($contents as $index => $object) { - if ($object['type'] === 'file') { - $missingKeys = array_diff($keys, array_keys($object)); - $contents[$index] = array_reduce($missingKeys, [$this, 'getMetadataByName'], $object); - } - } - - return $contents; - } - - /** - * Get a meta-data value by key name. - * - * @param array $object - * @param $key - * - * @return array - */ - protected function getMetadataByName(array $object, $key) - { - $method = 'get'.ucfirst($key); - - if (! method_exists($this->filesystem, $method)) { - throw new \InvalidArgumentException('Could not get meta-data for key: '.$key); - } - - $object[$key] = $this->filesystem->{$method}($object['path']); - - return $object; - } -} diff --git a/sitecake/2.2.9/server/vendor/league/flysystem/src/Plugin/PluggableTrait.php b/sitecake/2.2.9/server/vendor/league/flysystem/src/Plugin/PluggableTrait.php deleted file mode 100644 index 4bc1878..0000000 --- a/sitecake/2.2.9/server/vendor/league/flysystem/src/Plugin/PluggableTrait.php +++ /dev/null @@ -1,68 +0,0 @@ -plugins[$plugin->getMethod()] = $plugin; - - return $this; - } - - /** - * Register a plugin. - * - * @param string $method - * - * @throws LogicException - * - * @return PluginInterface $plugin - */ - protected function findPlugin($method) - { - if (! isset($this->plugins[$method])) { - throw new PluginNotFoundException('Plugin not found for method: '.$method); - } - - if (! method_exists($this->plugins[$method], 'handle')) { - throw new LogicException(get_class($this->plugins[$method]).' does not have a handle method.'); - } - - return $this->plugins[$method]; - } - - /** - * Invoke a plugin by method name. - * - * @param string $method - * @param array $arguments - * - * @return mixed - */ - protected function invokePlugin($method, array $arguments, FilesystemInterface $filesystem) - { - $plugin = $this->findPlugin($method); - $plugin->setFilesystem($filesystem); - $callback = [$plugin, 'handle']; - - return call_user_func_array($callback, $arguments); - } -} diff --git a/sitecake/2.2.9/server/vendor/league/flysystem/src/Plugin/PluginNotFoundException.php b/sitecake/2.2.9/server/vendor/league/flysystem/src/Plugin/PluginNotFoundException.php deleted file mode 100644 index fd1d7e7..0000000 --- a/sitecake/2.2.9/server/vendor/league/flysystem/src/Plugin/PluginNotFoundException.php +++ /dev/null @@ -1,10 +0,0 @@ - $to) { - if (! isset($object[$from])) { - continue; - } - - $result[$to] = $object[$from]; - } - - return $result; - } - - /** - * Normalize path. - * - * @param string $path - * - * @throws LogicException - * - * @return string - */ - public static function normalizePath($path) - { - // Remove any kind of funky unicode whitespace - $normalized = preg_replace('#\p{C}+|^\./#u', '', $path); - $normalized = static::normalizeRelativePath($normalized); - - if (preg_match('#/\.{2}|^\.{2}/|^\.{2}$#', $normalized)) { - throw new LogicException('Path is outside of the defined root, path: ['.$path.'], resolved: ['.$normalized.']'); - } - - $normalized = preg_replace('#\\\{2,}#', '\\', trim($normalized, '\\')); - $normalized = preg_replace('#/{2,}#', '/', trim($normalized, '/')); - - return $normalized; - } - - /** - * Normalize relative directories in a path. - * - * @param string $path - * - * @return string - */ - public static function normalizeRelativePath($path) - { - // Path remove self referring paths ("/./"). - $path = preg_replace('#/\.(?=/)|^\./|/\./?$#', '', $path); - - // Regex for resolving relative paths - $regex = '#/*[^/\.]+/\.\.#Uu'; - - while (preg_match($regex, $path)) { - $path = preg_replace($regex, '', $path); - } - - return $path; - } - - /** - * Normalize prefix. - * - * @param string $prefix - * @param string $separator - * - * @return string normalized path - */ - public static function normalizePrefix($prefix, $separator) - { - return rtrim($prefix, $separator).$separator; - } - - /** - * Get content size. - * - * @param string $contents - * - * @return int content size - */ - public static function contentSize($contents) - { - return mb_strlen($contents, '8bit'); - } - - /** - * Guess MIME Type based on the path of the file and it's content. - * - * @param string $path - * @param string $content - * - * @return string|null MIME Type or NULL if no extension detected - */ - public static function guessMimeType($path, $content) - { - $mimeType = MimeType::detectByContent($content); - - if (empty($mimeType) || $mimeType === 'text/plain') { - $extension = pathinfo($path, PATHINFO_EXTENSION); - - if ($extension) { - $mimeType = MimeType::detectByFileExtension($extension) ?: 'text/plain'; - } - } - - return $mimeType; - } - - /** - * Emulate directories. - * - * @param array $listing - * - * @return array listing with emulated directories - */ - public static function emulateDirectories(array $listing) - { - $directories = []; - $listedDirectories = []; - - foreach ($listing as $object) { - list($directories, $listedDirectories) = static::emulateObjectDirectories($object, $directories, $listedDirectories); - } - - $directories = array_diff(array_unique($directories), array_unique($listedDirectories)); - - foreach ($directories as $directory) { - $listing[] = static::pathinfo($directory) + ['type' => 'dir']; - } - - return $listing; - } - - /** - * Ensure a Config instance. - * - * @param null|array|Config $config - * - * @return Config config instance - * - * @throw LogicException - */ - public static function ensureConfig($config) - { - if ($config === null) { - return new Config(); - } - - if ($config instanceof Config) { - return $config; - } - - if (is_array($config)) { - return new Config($config); - } - - throw new LogicException('A config should either be an array or a Flysystem\Config object.'); - } - - /** - * Rewind a stream. - * - * @param resource $resource - */ - public static function rewindStream($resource) - { - if (ftell($resource) !== 0 && static::isSeekableStream($resource)) { - rewind($resource); - } - } - - public static function isSeekableStream($resource) - { - $metadata = stream_get_meta_data($resource); - - return $metadata['seekable']; - } - - /** - * Get the size of a stream. - * - * @param resource $resource - * - * @return int stream size - */ - public static function getStreamSize($resource) - { - $stat = fstat($resource); - - return $stat['size']; - } - - /** - * Emulate the directories of a single object. - * - * @param array $object - * @param array $directories - * @param array $listedDirectories - * - * @return array - */ - protected static function emulateObjectDirectories(array $object, array $directories, array $listedDirectories) - { - if (empty($object['dirname'])) { - return [$directories, $listedDirectories]; - } - - $parent = $object['dirname']; - - while (! empty($parent) && ! in_array($parent, $directories)) { - $directories[] = $parent; - $parent = static::dirname($parent); - } - - if (isset($object['type']) && $object['type'] === 'dir') { - $listedDirectories[] = $object['path']; - - return [$directories, $listedDirectories]; - } - - return [$directories, $listedDirectories]; - } -} diff --git a/sitecake/2.2.9/server/vendor/league/flysystem/src/Util/MimeType.php b/sitecake/2.2.9/server/vendor/league/flysystem/src/Util/MimeType.php deleted file mode 100644 index a3f173c..0000000 --- a/sitecake/2.2.9/server/vendor/league/flysystem/src/Util/MimeType.php +++ /dev/null @@ -1,195 +0,0 @@ -buffer($content); - - return $mimeType ?: null; - } - - /** - * Detects MIME Type based on file extension. - * - * @param string $extension - * - * @return string|null MIME Type or NULL if no extension detected - */ - public static function detectByFileExtension($extension) - { - static $extensionToMimeTypeMap; - - if (! $extensionToMimeTypeMap) { - $extensionToMimeTypeMap = static::getExtensionToMimeTypeMap(); - } - - if (isset($extensionToMimeTypeMap[$extension])) { - return $extensionToMimeTypeMap[$extension]; - } - } - - /** - * @return array Map of file extension to MIME Type - */ - public static function getExtensionToMimeTypeMap() - { - return [ - 'hqx' => 'application/mac-binhex40', - 'cpt' => 'application/mac-compactpro', - 'csv' => 'text/x-comma-separated-values', - 'bin' => 'application/octet-stream', - 'dms' => 'application/octet-stream', - 'lha' => 'application/octet-stream', - 'lzh' => 'application/octet-stream', - 'exe' => 'application/octet-stream', - 'class' => 'application/octet-stream', - 'psd' => 'application/x-photoshop', - 'so' => 'application/octet-stream', - 'sea' => 'application/octet-stream', - 'dll' => 'application/octet-stream', - 'oda' => 'application/oda', - 'pdf' => 'application/pdf', - 'ai' => 'application/pdf', - 'eps' => 'application/postscript', - 'ps' => 'application/postscript', - 'smi' => 'application/smil', - 'smil' => 'application/smil', - 'mif' => 'application/vnd.mif', - 'xls' => 'application/vnd.ms-excel', - 'ppt' => 'application/powerpoint', - 'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation', - 'wbxml' => 'application/wbxml', - 'wmlc' => 'application/wmlc', - 'dcr' => 'application/x-director', - 'dir' => 'application/x-director', - 'dxr' => 'application/x-director', - 'dvi' => 'application/x-dvi', - 'gtar' => 'application/x-gtar', - 'gz' => 'application/x-gzip', - 'gzip' => 'application/x-gzip', - 'php' => 'application/x-httpd-php', - 'php4' => 'application/x-httpd-php', - 'php3' => 'application/x-httpd-php', - 'phtml' => 'application/x-httpd-php', - 'phps' => 'application/x-httpd-php-source', - 'js' => 'application/javascript', - 'swf' => 'application/x-shockwave-flash', - 'sit' => 'application/x-stuffit', - 'tar' => 'application/x-tar', - 'tgz' => 'application/x-tar', - 'z' => 'application/x-compress', - 'xhtml' => 'application/xhtml+xml', - 'xht' => 'application/xhtml+xml', - 'zip' => 'application/x-zip', - 'rar' => 'application/x-rar', - 'mid' => 'audio/midi', - 'midi' => 'audio/midi', - 'mpga' => 'audio/mpeg', - 'mp2' => 'audio/mpeg', - 'mp3' => 'audio/mpeg', - 'aif' => 'audio/x-aiff', - 'aiff' => 'audio/x-aiff', - 'aifc' => 'audio/x-aiff', - 'ram' => 'audio/x-pn-realaudio', - 'rm' => 'audio/x-pn-realaudio', - 'rpm' => 'audio/x-pn-realaudio-plugin', - 'ra' => 'audio/x-realaudio', - 'rv' => 'video/vnd.rn-realvideo', - 'wav' => 'audio/x-wav', - 'jpg' => 'image/jpeg', - 'jpeg' => 'image/jpeg', - 'jpe' => 'image/jpeg', - 'png' => 'image/png', - 'gif' => 'image/gif', - 'bmp' => 'image/bmp', - 'tiff' => 'image/tiff', - 'tif' => 'image/tiff', - 'css' => 'text/css', - 'html' => 'text/html', - 'htm' => 'text/html', - 'shtml' => 'text/html', - 'txt' => 'text/plain', - 'text' => 'text/plain', - 'log' => 'text/plain', - 'rtx' => 'text/richtext', - 'rtf' => 'text/rtf', - 'xml' => 'application/xml', - 'xsl' => 'application/xml', - 'mpeg' => 'video/mpeg', - 'mpg' => 'video/mpeg', - 'mpe' => 'video/mpeg', - 'qt' => 'video/quicktime', - 'mov' => 'video/quicktime', - 'avi' => 'video/x-msvideo', - 'movie' => 'video/x-sgi-movie', - 'doc' => 'application/msword', - 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', - 'dot' => 'application/msword', - 'dotx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', - 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', - 'word' => 'application/msword', - 'xl' => 'application/excel', - 'eml' => 'message/rfc822', - 'json' => 'application/json', - 'pem' => 'application/x-x509-user-cert', - 'p10' => 'application/x-pkcs10', - 'p12' => 'application/x-pkcs12', - 'p7a' => 'application/x-pkcs7-signature', - 'p7c' => 'application/pkcs7-mime', - 'p7m' => 'application/pkcs7-mime', - 'p7r' => 'application/x-pkcs7-certreqresp', - 'p7s' => 'application/pkcs7-signature', - 'crt' => 'application/x-x509-ca-cert', - 'crl' => 'application/pkix-crl', - 'der' => 'application/x-x509-ca-cert', - 'kdb' => 'application/octet-stream', - 'pgp' => 'application/pgp', - 'gpg' => 'application/gpg-keys', - 'sst' => 'application/octet-stream', - 'csr' => 'application/octet-stream', - 'rsa' => 'application/x-pkcs7', - 'cer' => 'application/pkix-cert', - '3g2' => 'video/3gpp2', - '3gp' => 'video/3gp', - 'mp4' => 'video/mp4', - 'm4a' => 'audio/x-m4a', - 'f4v' => 'video/mp4', - 'webm' => 'video/webm', - 'aac' => 'audio/x-acc', - 'm4u' => 'application/vnd.mpegurl', - 'm3u' => 'text/plain', - 'xspf' => 'application/xspf+xml', - 'vlc' => 'application/videolan', - 'wmv' => 'video/x-ms-wmv', - 'au' => 'audio/x-au', - 'ac3' => 'audio/ac3', - 'flac' => 'audio/x-flac', - 'ogg' => 'audio/ogg', - 'kmz' => 'application/vnd.google-earth.kmz', - 'kml' => 'application/vnd.google-earth.kml+xml', - 'ics' => 'text/calendar', - 'zsh' => 'text/x-scriptzsh', - '7zip' => 'application/x-7z-compressed', - 'cdr' => 'application/cdr', - 'wma' => 'audio/x-ms-wma', - 'jar' => 'application/java-archive', - ]; - } -} diff --git a/sitecake/2.2.9/server/vendor/pimple/pimple/lib/Pimple.php b/sitecake/2.2.9/server/vendor/pimple/pimple/lib/Pimple.php deleted file mode 100644 index b980522..0000000 --- a/sitecake/2.2.9/server/vendor/pimple/pimple/lib/Pimple.php +++ /dev/null @@ -1,214 +0,0 @@ -values = $values; - } - - /** - * Sets a parameter or an object. - * - * Objects must be defined as Closures. - * - * Allowing any PHP callable leads to difficult to debug problems - * as function names (strings) are callable (creating a function with - * the same a name as an existing parameter would break your container). - * - * @param string $id The unique identifier for the parameter or object - * @param mixed $value The value of the parameter or a closure to defined an object - */ - public function offsetSet($id, $value) - { - $this->values[$id] = $value; - } - - /** - * Gets a parameter or an object. - * - * @param string $id The unique identifier for the parameter or object - * - * @return mixed The value of the parameter or an object - * - * @throws InvalidArgumentException if the identifier is not defined - */ - public function offsetGet($id) - { - if (!array_key_exists($id, $this->values)) { - throw new InvalidArgumentException(sprintf('Identifier "%s" is not defined.', $id)); - } - - $isFactory = is_object($this->values[$id]) && method_exists($this->values[$id], '__invoke'); - - return $isFactory ? $this->values[$id]($this) : $this->values[$id]; - } - - /** - * Checks if a parameter or an object is set. - * - * @param string $id The unique identifier for the parameter or object - * - * @return Boolean - */ - public function offsetExists($id) - { - return array_key_exists($id, $this->values); - } - - /** - * Unsets a parameter or an object. - * - * @param string $id The unique identifier for the parameter or object - */ - public function offsetUnset($id) - { - unset($this->values[$id]); - } - - /** - * Returns a closure that stores the result of the given service definition - * for uniqueness in the scope of this instance of Pimple. - * - * @param callable $callable A service definition to wrap for uniqueness - * - * @return Closure The wrapped closure - */ - public static function share($callable) - { - if (!is_object($callable) || !method_exists($callable, '__invoke')) { - throw new InvalidArgumentException('Service definition is not a Closure or invokable object.'); - } - - return function ($c) use ($callable) { - static $object; - - if (null === $object) { - $object = $callable($c); - } - - return $object; - }; - } - - /** - * Protects a callable from being interpreted as a service. - * - * This is useful when you want to store a callable as a parameter. - * - * @param callable $callable A callable to protect from being evaluated - * - * @return Closure The protected closure - */ - public static function protect($callable) - { - if (!is_object($callable) || !method_exists($callable, '__invoke')) { - throw new InvalidArgumentException('Callable is not a Closure or invokable object.'); - } - - return function ($c) use ($callable) { - return $callable; - }; - } - - /** - * Gets a parameter or the closure defining an object. - * - * @param string $id The unique identifier for the parameter or object - * - * @return mixed The value of the parameter or the closure defining an object - * - * @throws InvalidArgumentException if the identifier is not defined - */ - public function raw($id) - { - if (!array_key_exists($id, $this->values)) { - throw new InvalidArgumentException(sprintf('Identifier "%s" is not defined.', $id)); - } - - return $this->values[$id]; - } - - /** - * Extends an object definition. - * - * Useful when you want to extend an existing object definition, - * without necessarily loading that object. - * - * @param string $id The unique identifier for the object - * @param callable $callable A service definition to extend the original - * - * @return Closure The wrapped closure - * - * @throws InvalidArgumentException if the identifier is not defined or not a service definition - */ - public function extend($id, $callable) - { - if (!array_key_exists($id, $this->values)) { - throw new InvalidArgumentException(sprintf('Identifier "%s" is not defined.', $id)); - } - - if (!is_object($this->values[$id]) || !method_exists($this->values[$id], '__invoke')) { - throw new InvalidArgumentException(sprintf('Identifier "%s" does not contain an object definition.', $id)); - } - - if (!is_object($callable) || !method_exists($callable, '__invoke')) { - throw new InvalidArgumentException('Extension service definition is not a Closure or invokable object.'); - } - - $factory = $this->values[$id]; - - return $this->values[$id] = function ($c) use ($callable, $factory) { - return $callable($factory($c), $c); - }; - } - - /** - * Returns all defined value names. - * - * @return array An array of value names - */ - public function keys() - { - return array_keys($this->values); - } -} diff --git a/sitecake/2.2.9/server/vendor/psr/log/Psr/Log/AbstractLogger.php b/sitecake/2.2.9/server/vendor/psr/log/Psr/Log/AbstractLogger.php deleted file mode 100644 index 00f9034..0000000 --- a/sitecake/2.2.9/server/vendor/psr/log/Psr/Log/AbstractLogger.php +++ /dev/null @@ -1,120 +0,0 @@ -log(LogLevel::EMERGENCY, $message, $context); - } - - /** - * Action must be taken immediately. - * - * Example: Entire website down, database unavailable, etc. This should - * trigger the SMS alerts and wake you up. - * - * @param string $message - * @param array $context - * @return null - */ - public function alert($message, array $context = array()) - { - $this->log(LogLevel::ALERT, $message, $context); - } - - /** - * Critical conditions. - * - * Example: Application component unavailable, unexpected exception. - * - * @param string $message - * @param array $context - * @return null - */ - public function critical($message, array $context = array()) - { - $this->log(LogLevel::CRITICAL, $message, $context); - } - - /** - * Runtime errors that do not require immediate action but should typically - * be logged and monitored. - * - * @param string $message - * @param array $context - * @return null - */ - public function error($message, array $context = array()) - { - $this->log(LogLevel::ERROR, $message, $context); - } - - /** - * Exceptional occurrences that are not errors. - * - * Example: Use of deprecated APIs, poor use of an API, undesirable things - * that are not necessarily wrong. - * - * @param string $message - * @param array $context - * @return null - */ - public function warning($message, array $context = array()) - { - $this->log(LogLevel::WARNING, $message, $context); - } - - /** - * Normal but significant events. - * - * @param string $message - * @param array $context - * @return null - */ - public function notice($message, array $context = array()) - { - $this->log(LogLevel::NOTICE, $message, $context); - } - - /** - * Interesting events. - * - * Example: User logs in, SQL logs. - * - * @param string $message - * @param array $context - * @return null - */ - public function info($message, array $context = array()) - { - $this->log(LogLevel::INFO, $message, $context); - } - - /** - * Detailed debug information. - * - * @param string $message - * @param array $context - * @return null - */ - public function debug($message, array $context = array()) - { - $this->log(LogLevel::DEBUG, $message, $context); - } -} diff --git a/sitecake/2.2.9/server/vendor/psr/log/Psr/Log/InvalidArgumentException.php b/sitecake/2.2.9/server/vendor/psr/log/Psr/Log/InvalidArgumentException.php deleted file mode 100644 index 67f852d..0000000 --- a/sitecake/2.2.9/server/vendor/psr/log/Psr/Log/InvalidArgumentException.php +++ /dev/null @@ -1,7 +0,0 @@ -logger = $logger; - } -} diff --git a/sitecake/2.2.9/server/vendor/psr/log/Psr/Log/LoggerInterface.php b/sitecake/2.2.9/server/vendor/psr/log/Psr/Log/LoggerInterface.php deleted file mode 100644 index 476bb96..0000000 --- a/sitecake/2.2.9/server/vendor/psr/log/Psr/Log/LoggerInterface.php +++ /dev/null @@ -1,114 +0,0 @@ -log(LogLevel::EMERGENCY, $message, $context); - } - - /** - * Action must be taken immediately. - * - * Example: Entire website down, database unavailable, etc. This should - * trigger the SMS alerts and wake you up. - * - * @param string $message - * @param array $context - * @return null - */ - public function alert($message, array $context = array()) - { - $this->log(LogLevel::ALERT, $message, $context); - } - - /** - * Critical conditions. - * - * Example: Application component unavailable, unexpected exception. - * - * @param string $message - * @param array $context - * @return null - */ - public function critical($message, array $context = array()) - { - $this->log(LogLevel::CRITICAL, $message, $context); - } - - /** - * Runtime errors that do not require immediate action but should typically - * be logged and monitored. - * - * @param string $message - * @param array $context - * @return null - */ - public function error($message, array $context = array()) - { - $this->log(LogLevel::ERROR, $message, $context); - } - - /** - * Exceptional occurrences that are not errors. - * - * Example: Use of deprecated APIs, poor use of an API, undesirable things - * that are not necessarily wrong. - * - * @param string $message - * @param array $context - * @return null - */ - public function warning($message, array $context = array()) - { - $this->log(LogLevel::WARNING, $message, $context); - } - - /** - * Normal but significant events. - * - * @param string $message - * @param array $context - * @return null - */ - public function notice($message, array $context = array()) - { - $this->log(LogLevel::NOTICE, $message, $context); - } - - /** - * Interesting events. - * - * Example: User logs in, SQL logs. - * - * @param string $message - * @param array $context - * @return null - */ - public function info($message, array $context = array()) - { - $this->log(LogLevel::INFO, $message, $context); - } - - /** - * Detailed debug information. - * - * @param string $message - * @param array $context - * @return null - */ - public function debug($message, array $context = array()) - { - $this->log(LogLevel::DEBUG, $message, $context); - } - - /** - * Logs with an arbitrary level. - * - * @param mixed $level - * @param string $message - * @param array $context - * @return null - */ - abstract public function log($level, $message, array $context = array()); -} diff --git a/sitecake/2.2.9/server/vendor/psr/log/Psr/Log/NullLogger.php b/sitecake/2.2.9/server/vendor/psr/log/Psr/Log/NullLogger.php deleted file mode 100644 index 553a3c5..0000000 --- a/sitecake/2.2.9/server/vendor/psr/log/Psr/Log/NullLogger.php +++ /dev/null @@ -1,27 +0,0 @@ -logger) { }` - * blocks. - */ -class NullLogger extends AbstractLogger -{ - /** - * Logs with an arbitrary level. - * - * @param mixed $level - * @param string $message - * @param array $context - * @return null - */ - public function log($level, $message, array $context = array()) - { - // noop - } -} diff --git a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Application.php b/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Application.php deleted file mode 100644 index e860581..0000000 --- a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Application.php +++ /dev/null @@ -1,595 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex; - -use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Symfony\Component\HttpFoundation\BinaryFileResponse; -use Symfony\Component\HttpKernel\HttpKernel; -use Symfony\Component\HttpKernel\HttpKernelInterface; -use Symfony\Component\HttpKernel\TerminableInterface; -use Symfony\Component\HttpKernel\Event\FilterResponseEvent; -use Symfony\Component\HttpKernel\Event\GetResponseEvent; -use Symfony\Component\HttpKernel\Event\PostResponseEvent; -use Symfony\Component\HttpKernel\EventListener\ResponseListener; -use Symfony\Component\HttpKernel\EventListener\RouterListener; -use Symfony\Component\HttpKernel\Exception\HttpException; -use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\RequestStack; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpFoundation\RedirectResponse; -use Symfony\Component\HttpFoundation\StreamedResponse; -use Symfony\Component\HttpFoundation\JsonResponse; -use Symfony\Component\Routing\RouteCollection; -use Symfony\Component\Routing\RequestContext; -use Silex\EventListener\LocaleListener; -use Silex\EventListener\MiddlewareListener; -use Silex\EventListener\ConverterListener; -use Silex\EventListener\StringToResponseListener; - -/** - * The Silex framework class. - * - * @author Fabien Potencier - */ -class Application extends \Pimple implements HttpKernelInterface, TerminableInterface -{ - const VERSION = '1.3.0'; - - const EARLY_EVENT = 512; - const LATE_EVENT = -512; - - protected $providers = array(); - protected $booted = false; - - /** - * Instantiate a new Application. - * - * Objects and parameters can be passed as argument to the constructor. - * - * @param array $values The parameters or objects. - */ - public function __construct(array $values = array()) - { - parent::__construct(); - - $app = $this; - - $this['logger'] = null; - - $this['routes'] = $this->share(function () { - return new RouteCollection(); - }); - - $this['controllers'] = $this->share(function () use ($app) { - return $app['controllers_factory']; - }); - - $this['controllers_factory'] = function () use ($app) { - return new ControllerCollection($app['route_factory']); - }; - - $this['route_class'] = 'Silex\\Route'; - $this['route_factory'] = function () use ($app) { - return new $app['route_class'](); - }; - - $this['exception_handler'] = $this->share(function () use ($app) { - return new ExceptionHandler($app['debug']); - }); - - $this['dispatcher_class'] = 'Symfony\\Component\\EventDispatcher\\EventDispatcher'; - $this['dispatcher'] = $this->share(function () use ($app) { - /** - * @var EventDispatcherInterface $dispatcher - */ - $dispatcher = new $app['dispatcher_class'](); - - $urlMatcher = new LazyUrlMatcher(function () use ($app) { - return $app['url_matcher']; - }); - $dispatcher->addSubscriber(new RouterListener($urlMatcher, $app['request_context'], $app['logger'], $app['request_stack'])); - $dispatcher->addSubscriber(new LocaleListener($app, $urlMatcher, $app['request_stack'])); - if (isset($app['exception_handler'])) { - $dispatcher->addSubscriber($app['exception_handler']); - } - $dispatcher->addSubscriber(new ResponseListener($app['charset'])); - $dispatcher->addSubscriber(new MiddlewareListener($app)); - $dispatcher->addSubscriber(new ConverterListener($app['routes'], $app['callback_resolver'])); - $dispatcher->addSubscriber(new StringToResponseListener()); - - return $dispatcher; - }); - - $this['callback_resolver'] = $this->share(function () use ($app) { - return new CallbackResolver($app); - }); - - $this['resolver'] = $this->share(function () use ($app) { - return new ControllerResolver($app, $app['logger']); - }); - - $this['kernel'] = $this->share(function () use ($app) { - return new HttpKernel($app['dispatcher'], $app['resolver'], $app['request_stack']); - }); - - $this['request_stack'] = $this->share(function () use ($app) { - if (class_exists('Symfony\Component\HttpFoundation\RequestStack')) { - return new RequestStack(); - } - }); - - $this['request_context'] = $this->share(function () use ($app) { - $context = new RequestContext(); - - $context->setHttpPort($app['request.http_port']); - $context->setHttpsPort($app['request.https_port']); - - return $context; - }); - - $this['url_matcher'] = $this->share(function () use ($app) { - return new RedirectableUrlMatcher($app['routes'], $app['request_context']); - }); - - $this['request_error'] = $this->protect(function () { - throw new \RuntimeException('Accessed request service outside of request scope. Try moving that call to a before handler or controller.'); - }); - - $this['request'] = $this['request_error']; - - $this['request.http_port'] = 80; - $this['request.https_port'] = 443; - $this['debug'] = false; - $this['charset'] = 'UTF-8'; - $this['locale'] = 'en'; - - foreach ($values as $key => $value) { - $this[$key] = $value; - } - } - - /** - * Registers a service provider. - * - * @param ServiceProviderInterface $provider A ServiceProviderInterface instance - * @param array $values An array of values that customizes the provider - * - * @return Application - */ - public function register(ServiceProviderInterface $provider, array $values = array()) - { - $this->providers[] = $provider; - - $provider->register($this); - - foreach ($values as $key => $value) { - $this[$key] = $value; - } - - return $this; - } - - /** - * Boots all service providers. - * - * This method is automatically called by handle(), but you can use it - * to boot all service providers when not handling a request. - */ - public function boot() - { - if (!$this->booted) { - foreach ($this->providers as $provider) { - $provider->boot($this); - } - - $this->booted = true; - } - } - - /** - * Maps a pattern to a callable. - * - * You can optionally specify HTTP methods that should be matched. - * - * @param string $pattern Matched route pattern - * @param mixed $to Callback that returns the response when matched - * - * @return Controller - */ - public function match($pattern, $to = null) - { - return $this['controllers']->match($pattern, $to); - } - - /** - * Maps a GET request to a callable. - * - * @param string $pattern Matched route pattern - * @param mixed $to Callback that returns the response when matched - * - * @return Controller - */ - public function get($pattern, $to = null) - { - return $this['controllers']->get($pattern, $to); - } - - /** - * Maps a POST request to a callable. - * - * @param string $pattern Matched route pattern - * @param mixed $to Callback that returns the response when matched - * - * @return Controller - */ - public function post($pattern, $to = null) - { - return $this['controllers']->post($pattern, $to); - } - - /** - * Maps a PUT request to a callable. - * - * @param string $pattern Matched route pattern - * @param mixed $to Callback that returns the response when matched - * - * @return Controller - */ - public function put($pattern, $to = null) - { - return $this['controllers']->put($pattern, $to); - } - - /** - * Maps a DELETE request to a callable. - * - * @param string $pattern Matched route pattern - * @param mixed $to Callback that returns the response when matched - * - * @return Controller - */ - public function delete($pattern, $to = null) - { - return $this['controllers']->delete($pattern, $to); - } - - /** - * Maps an OPTIONS request to a callable. - * - * @param string $pattern Matched route pattern - * @param mixed $to Callback that returns the response when matched - * - * @return Controller - */ - public function options($pattern, $to = null) - { - return $this['controllers']->options($pattern, $to); - } - - /** - * Maps a PATCH request to a callable. - * - * @param string $pattern Matched route pattern - * @param mixed $to Callback that returns the response when matched - * - * @return Controller - */ - public function patch($pattern, $to = null) - { - return $this['controllers']->patch($pattern, $to); - } - - /** - * Adds an event listener that listens on the specified events. - * - * @param string $eventName The event to listen on - * @param callable $callback The listener - * @param int $priority The higher this value, the earlier an event - * listener will be triggered in the chain (defaults to 0) - */ - public function on($eventName, $callback, $priority = 0) - { - if ($this->booted) { - $this['dispatcher']->addListener($eventName, $this['callback_resolver']->resolveCallback($callback), $priority); - - return; - } - - $this['dispatcher'] = $this->share($this->extend('dispatcher', function (EventDispatcherInterface $dispatcher, $app) use ($callback, $priority, $eventName) { - $dispatcher->addListener($eventName, $app['callback_resolver']->resolveCallback($callback), $priority); - - return $dispatcher; - })); - } - - /** - * Registers a before filter. - * - * Before filters are run before any route has been matched. - * - * @param mixed $callback Before filter callback - * @param int $priority The higher this value, the earlier an event - * listener will be triggered in the chain (defaults to 0) - */ - public function before($callback, $priority = 0) - { - $app = $this; - - $this->on(KernelEvents::REQUEST, function (GetResponseEvent $event) use ($callback, $app) { - if (HttpKernelInterface::MASTER_REQUEST !== $event->getRequestType()) { - return; - } - - $ret = call_user_func($app['callback_resolver']->resolveCallback($callback), $event->getRequest(), $app); - - if ($ret instanceof Response) { - $event->setResponse($ret); - } - }, $priority); - } - - /** - * Registers an after filter. - * - * After filters are run after the controller has been executed. - * - * @param mixed $callback After filter callback - * @param int $priority The higher this value, the earlier an event - * listener will be triggered in the chain (defaults to 0) - */ - public function after($callback, $priority = 0) - { - $app = $this; - - $this->on(KernelEvents::RESPONSE, function (FilterResponseEvent $event) use ($callback, $app) { - if (HttpKernelInterface::MASTER_REQUEST !== $event->getRequestType()) { - return; - } - - $response = call_user_func($app['callback_resolver']->resolveCallback($callback), $event->getRequest(), $event->getResponse(), $app); - if ($response instanceof Response) { - $event->setResponse($response); - } elseif (null !== $response) { - throw new \RuntimeException('An after middleware returned an invalid response value. Must return null or an instance of Response.'); - } - }, $priority); - } - - /** - * Registers a finish filter. - * - * Finish filters are run after the response has been sent. - * - * @param mixed $callback Finish filter callback - * @param int $priority The higher this value, the earlier an event - * listener will be triggered in the chain (defaults to 0) - */ - public function finish($callback, $priority = 0) - { - $app = $this; - - $this->on(KernelEvents::TERMINATE, function (PostResponseEvent $event) use ($callback, $app) { - call_user_func($app['callback_resolver']->resolveCallback($callback), $event->getRequest(), $event->getResponse(), $app); - }, $priority); - } - - /** - * Aborts the current request by sending a proper HTTP error. - * - * @param int $statusCode The HTTP status code - * @param string $message The status message - * @param array $headers An array of HTTP headers - */ - public function abort($statusCode, $message = '', array $headers = array()) - { - throw new HttpException($statusCode, $message, null, $headers); - } - - /** - * Registers an error handler. - * - * Error handlers are simple callables which take a single Exception - * as an argument. If a controller throws an exception, an error handler - * can return a specific response. - * - * When an exception occurs, all handlers will be called, until one returns - * something (a string or a Response object), at which point that will be - * returned to the client. - * - * For this reason you should add logging handlers before output handlers. - * - * @param mixed $callback Error handler callback, takes an Exception argument - * @param int $priority The higher this value, the earlier an event - * listener will be triggered in the chain (defaults to -8) - */ - public function error($callback, $priority = -8) - { - $this->on(KernelEvents::EXCEPTION, new ExceptionListenerWrapper($this, $callback), $priority); - } - - /** - * Registers a view handler. - * - * View handlers are simple callables which take a controller result and the - * request as arguments, whenever a controller returns a value that is not - * an instance of Response. When this occurs, all suitable handlers will be - * called, until one returns a Response object. - * - * @param mixed $callback View handler callback - * @param int $priority The higher this value, the earlier an event - * listener will be triggered in the chain (defaults to 0) - */ - public function view($callback, $priority = 0) - { - $this->on(KernelEvents::VIEW, new ViewListenerWrapper($this, $callback), $priority); - } - - /** - * Flushes the controller collection. - * - * @param string $prefix The route prefix - */ - public function flush($prefix = '') - { - $this['routes']->addCollection($this['controllers']->flush($prefix)); - } - - /** - * Redirects the user to another URL. - * - * @param string $url The URL to redirect to - * @param int $status The status code (302 by default) - * - * @return RedirectResponse - */ - public function redirect($url, $status = 302) - { - return new RedirectResponse($url, $status); - } - - /** - * Creates a streaming response. - * - * @param mixed $callback A valid PHP callback - * @param int $status The response status code - * @param array $headers An array of response headers - * - * @return StreamedResponse - */ - public function stream($callback = null, $status = 200, array $headers = array()) - { - return new StreamedResponse($callback, $status, $headers); - } - - /** - * Escapes a text for HTML. - * - * @param string $text The input text to be escaped - * @param int $flags The flags (@see htmlspecialchars) - * @param string $charset The charset - * @param bool $doubleEncode Whether to try to avoid double escaping or not - * - * @return string Escaped text - */ - public function escape($text, $flags = ENT_COMPAT, $charset = null, $doubleEncode = true) - { - return htmlspecialchars($text, $flags, $charset ?: $this['charset'], $doubleEncode); - } - - /** - * Convert some data into a JSON response. - * - * @param mixed $data The response data - * @param int $status The response status code - * @param array $headers An array of response headers - * - * @return JsonResponse - */ - public function json($data = array(), $status = 200, array $headers = array()) - { - return new JsonResponse($data, $status, $headers); - } - - /** - * Sends a file. - * - * @param \SplFileInfo|string $file The file to stream - * @param int $status The response status code - * @param array $headers An array of response headers - * @param null|string $contentDisposition The type of Content-Disposition to set automatically with the filename - * - * @return BinaryFileResponse - * - * @throws \RuntimeException When the feature is not supported, before http-foundation v2.2 - */ - public function sendFile($file, $status = 200, array $headers = array(), $contentDisposition = null) - { - return new BinaryFileResponse($file, $status, $headers, true, $contentDisposition); - } - - /** - * Mounts controllers under the given route prefix. - * - * @param string $prefix The route prefix - * @param ControllerCollection|ControllerProviderInterface $controllers A ControllerCollection or a ControllerProviderInterface instance - * - * @return Application - */ - public function mount($prefix, $controllers) - { - if ($controllers instanceof ControllerProviderInterface) { - $connectedControllers = $controllers->connect($this); - - if (!$connectedControllers instanceof ControllerCollection) { - throw new \LogicException(sprintf('The method "%s::connect" must return a "ControllerCollection" instance. Got: "%s"', get_class($controllers), is_object($connectedControllers) ? get_class($connectedControllers) : gettype($connectedControllers))); - } - - $controllers = $connectedControllers; - } elseif (!$controllers instanceof ControllerCollection) { - throw new \LogicException('The "mount" method takes either a "ControllerCollection" or a "ControllerProviderInterface" instance.'); - } - - $this['controllers']->mount($prefix, $controllers); - - return $this; - } - - /** - * Handles the request and delivers the response. - * - * @param Request|null $request Request to process - */ - public function run(Request $request = null) - { - if (null === $request) { - $request = Request::createFromGlobals(); - } - - $response = $this->handle($request); - $response->send(); - $this->terminate($request, $response); - } - - /** - * {@inheritdoc} - * - * If you call this method directly instead of run(), you must call the - * terminate() method yourself if you want the finish filters to be run. - */ - public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true) - { - if (!$this->booted) { - $this->boot(); - } - - $current = HttpKernelInterface::SUB_REQUEST === $type ? $this['request'] : $this['request_error']; - - $this['request'] = $request; - - $this->flush(); - - $response = $this['kernel']->handle($request, $type, $catch); - - $this['request'] = $current; - - return $response; - } - - /** - * {@inheritdoc} - */ - public function terminate(Request $request, Response $response) - { - $this['kernel']->terminate($request, $response); - } -} diff --git a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Application/FormTrait.php b/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Application/FormTrait.php deleted file mode 100644 index 4744c80..0000000 --- a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Application/FormTrait.php +++ /dev/null @@ -1,35 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\Application; - -use Symfony\Component\Form\FormBuilder; - -/** - * Form trait. - * - * @author Fabien Potencier - */ -trait FormTrait -{ - /** - * Creates and returns a form builder instance. - * - * @param mixed $data The initial data for the form - * @param array $options Options for the form - * - * @return FormBuilder - */ - public function form($data = null, array $options = array()) - { - return $this['form.factory']->createBuilder('form', $data, $options); - } -} diff --git a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Application/MonologTrait.php b/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Application/MonologTrait.php deleted file mode 100644 index 18cb54c..0000000 --- a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Application/MonologTrait.php +++ /dev/null @@ -1,36 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\Application; - -use Monolog\Logger; - -/** - * Monolog trait. - * - * @author Fabien Potencier - */ -trait MonologTrait -{ - /** - * Adds a log record. - * - * @param string $message The log message - * @param array $context The log context - * @param int $level The logging level - * - * @return bool Whether the record has been processed - */ - public function log($message, array $context = array(), $level = Logger::INFO) - { - return $this['monolog']->addRecord($level, $message, $context); - } -} diff --git a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Application/SecurityTrait.php b/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Application/SecurityTrait.php deleted file mode 100644 index ada79e7..0000000 --- a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Application/SecurityTrait.php +++ /dev/null @@ -1,68 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\Application; - -use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; -use Symfony\Component\Security\Core\Exception\AuthenticationCredentialsNotFoundException; -use Symfony\Component\Security\Core\User\UserInterface; - -/** - * Security trait. - * - * @author Fabien Potencier - */ -trait SecurityTrait -{ - /** - * Gets a user from the Security context. - * - * @return mixed - * - * @see TokenInterface::getUser() - * - * @deprecated since 1.3, to be removed in 3.0 - */ - public function user() - { - return $this['user']; - } - - /** - * Encodes the raw password. - * - * @param UserInterface $user A UserInterface instance - * @param string $password The password to encode - * - * @return string The encoded password - * - * @throws \RuntimeException when no password encoder could be found for the user - */ - public function encodePassword(UserInterface $user, $password) - { - return $this['security.encoder_factory']->getEncoder($user)->encodePassword($password, $user->getSalt()); - } - - /** - * Checks if the attributes are granted against the current authentication token and optionally supplied object. - * - * @param mixed $attributes - * @param mixed $object - * - * @return bool - * - * @throws AuthenticationCredentialsNotFoundException when the token storage has no authentication token. - */ - public function isGranted($attributes, $object = null) - { - return $this['security.authorization_checker']->isGranted($attributes, $object); - } -} diff --git a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Application/SwiftmailerTrait.php b/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Application/SwiftmailerTrait.php deleted file mode 100644 index 157f94d..0000000 --- a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Application/SwiftmailerTrait.php +++ /dev/null @@ -1,33 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\Application; - -/** - * Swiftmailer trait. - * - * @author Fabien Potencier - */ -trait SwiftmailerTrait -{ - /** - * Sends an email. - * - * @param \Swift_Message $message A \Swift_Message instance - * @param array $failedRecipients An array of failures by-reference - * - * @return int The number of sent messages - */ - public function mail(\Swift_Message $message, &$failedRecipients = null) - { - return $this['mailer']->send($message, $failedRecipients); - } -} diff --git a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Application/TranslationTrait.php b/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Application/TranslationTrait.php deleted file mode 100644 index 8b6e818..0000000 --- a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Application/TranslationTrait.php +++ /dev/null @@ -1,51 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\Application; - -/** - * Translation trait. - * - * @author Fabien Potencier - */ -trait TranslationTrait -{ - /** - * Translates the given message. - * - * @param string $id The message id - * @param array $parameters An array of parameters for the message - * @param string $domain The domain for the message - * @param string $locale The locale - * - * @return string The translated string - */ - public function trans($id, array $parameters = array(), $domain = 'messages', $locale = null) - { - return $this['translator']->trans($id, $parameters, $domain, $locale); - } - - /** - * Translates the given choice message by choosing a translation according to a number. - * - * @param string $id The message id - * @param int $number The number to use to find the indice of the message - * @param array $parameters An array of parameters for the message - * @param string $domain The domain for the message - * @param string $locale The locale - * - * @return string The translated string - */ - public function transChoice($id, $number, array $parameters = array(), $domain = 'messages', $locale = null) - { - return $this['translator']->transChoice($id, $number, $parameters, $domain, $locale); - } -} diff --git a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Application/TwigTrait.php b/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Application/TwigTrait.php deleted file mode 100644 index cb4127d..0000000 --- a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Application/TwigTrait.php +++ /dev/null @@ -1,65 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\Application; - -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpFoundation\StreamedResponse; - -/** - * Twig trait. - * - * @author Fabien Potencier - */ -trait TwigTrait -{ - /** - * Renders a view and returns a Response. - * - * To stream a view, pass an instance of StreamedResponse as a third argument. - * - * @param string $view The view name - * @param array $parameters An array of parameters to pass to the view - * @param Response $response A Response instance - * - * @return Response A Response instance - */ - public function render($view, array $parameters = array(), Response $response = null) - { - $twig = $this['twig']; - - if ($response instanceof StreamedResponse) { - $response->setCallback(function () use ($twig, $view, $parameters) { - $twig->display($view, $parameters); - }); - } else { - if (null === $response) { - $response = new Response(); - } - $response->setContent($twig->render($view, $parameters)); - } - - return $response; - } - - /** - * Renders a view. - * - * @param string $view The view name - * @param array $parameters An array of parameters to pass to the view - * - * @return string The rendered view - */ - public function renderView($view, array $parameters = array()) - { - return $this['twig']->render($view, $parameters); - } -} diff --git a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Application/UrlGeneratorTrait.php b/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Application/UrlGeneratorTrait.php deleted file mode 100644 index 7ccdf8a..0000000 --- a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Application/UrlGeneratorTrait.php +++ /dev/null @@ -1,48 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\Application; - -use Symfony\Component\Routing\Generator\UrlGeneratorInterface; - -/** - * UrlGenerator trait. - * - * @author Fabien Potencier - */ -trait UrlGeneratorTrait -{ - /** - * Generates a path from the given parameters. - * - * @param string $route The name of the route - * @param mixed $parameters An array of parameters - * - * @return string The generated path - */ - public function path($route, $parameters = array()) - { - return $this['url_generator']->generate($route, $parameters, UrlGeneratorInterface::ABSOLUTE_PATH); - } - - /** - * Generates an absolute URL from the given parameters. - * - * @param string $route The name of the route - * @param mixed $parameters An array of parameters - * - * @return string The generated URL - */ - public function url($route, $parameters = array()) - { - return $this['url_generator']->generate($route, $parameters, UrlGeneratorInterface::ABSOLUTE_URL); - } -} diff --git a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/CallbackResolver.php b/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/CallbackResolver.php deleted file mode 100644 index 859d86e..0000000 --- a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/CallbackResolver.php +++ /dev/null @@ -1,70 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex; - -class CallbackResolver -{ - const SERVICE_PATTERN = "/[A-Za-z0-9\._\-]+:[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/"; - - private $app; - - public function __construct(\Pimple $app) - { - $this->app = $app; - } - - /** - * Returns true if the string is a valid service method representation. - * - * @param string $name - * - * @return bool - */ - public function isValid($name) - { - return is_string($name) && preg_match(static::SERVICE_PATTERN, $name); - } - - /** - * Returns a callable given its string representation. - * - * @param string $name - * - * @return array A callable array - * - * @throws \InvalidArgumentException In case the method does not exist. - */ - public function convertCallback($name) - { - list($service, $method) = explode(':', $name, 2); - - if (!isset($this->app[$service])) { - throw new \InvalidArgumentException(sprintf('Service "%s" does not exist.', $service)); - } - - return array($this->app[$service], $method); - } - - /** - * Returns a callable given its string representation if it is a valid service method. - * - * @param string $name - * - * @return array A callable array - * - * @throws \InvalidArgumentException In case the method does not exist. - */ - public function resolveCallback($name) - { - return $this->isValid($name) ? $this->convertCallback($name) : $name; - } -} diff --git a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/ConstraintValidatorFactory.php b/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/ConstraintValidatorFactory.php deleted file mode 100644 index f3df978..0000000 --- a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/ConstraintValidatorFactory.php +++ /dev/null @@ -1,89 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex; - -use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\ConstraintValidatorFactoryInterface; -use Symfony\Component\Validator\ConstraintValidator; - -/** - * Uses a service container to create constraint validators with dependencies. - * - * @author Kris Wallsmith - * @author Alex Kalyvitis - */ -class ConstraintValidatorFactory implements ConstraintValidatorFactoryInterface -{ - /** - * @var \Pimple - */ - protected $container; - - /** - * @var array - */ - protected $serviceNames; - - /** - * @var array - */ - protected $validators; - - /** - * Constructor. - * - * @param \Pimple $container DI container - * @param array $serviceNames Validator service names - */ - public function __construct(\Pimple $container, array $serviceNames = array()) - { - $this->container = $container; - $this->serviceNames = $serviceNames; - $this->validators = array(); - } - - /** - * Returns the validator for the supplied constraint. - * - * @param Constraint $constraint A constraint - * - * @return ConstraintValidator A validator for the supplied constraint - */ - public function getInstance(Constraint $constraint) - { - $name = $constraint->validatedBy(); - - if (isset($this->validators[$name])) { - return $this->validators[$name]; - } - - $this->validators[$name] = $this->createValidator($name); - - return $this->validators[$name]; - } - - /** - * Returns the validator instance. - * - * @param string $name - * - * @return ConstraintValidator - */ - private function createValidator($name) - { - if (isset($this->serviceNames[$name])) { - return $this->container[$this->serviceNames[$name]]; - } - - return new $name(); - } -} diff --git a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Controller.php b/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Controller.php deleted file mode 100644 index 96bc6b0..0000000 --- a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Controller.php +++ /dev/null @@ -1,121 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex; - -use Silex\Exception\ControllerFrozenException; - -/** - * A wrapper for a controller, mapped to a route. - * - * __call() forwards method-calls to Route, but returns instance of Controller - * listing Route's methods below, so that IDEs know they are valid - * - * @method Controller assert(string $variable, string $regexp) - * @method Controller value(string $variable, mixed $default) - * @method Controller convert(string $variable, mixed $callback) - * @method Controller method(string $method) - * @method Controller requireHttp() - * @method Controller requireHttps() - * @method Controller before(mixed $callback) - * @method Controller after(mixed $callback) - * - * @author Igor Wiedler - */ -class Controller -{ - private $route; - private $routeName; - private $isFrozen = false; - - /** - * Constructor. - * - * @param Route $route - */ - public function __construct(Route $route) - { - $this->route = $route; - } - - /** - * Gets the controller's route. - * - * @return Route - */ - public function getRoute() - { - return $this->route; - } - - /** - * Gets the controller's route name. - * - * @return string - */ - public function getRouteName() - { - return $this->routeName; - } - - /** - * Sets the controller's route. - * - * @param string $routeName - * - * @return Controller $this The current Controller instance - */ - public function bind($routeName) - { - if ($this->isFrozen) { - throw new ControllerFrozenException(sprintf('Calling %s on frozen %s instance.', __METHOD__, __CLASS__)); - } - - $this->routeName = $routeName; - - return $this; - } - - public function __call($method, $arguments) - { - if (!method_exists($this->route, $method)) { - throw new \BadMethodCallException(sprintf('Method "%s::%s" does not exist.', get_class($this->route), $method)); - } - - call_user_func_array(array($this->route, $method), $arguments); - - return $this; - } - - /** - * Freezes the controller. - * - * Once the controller is frozen, you can no longer change the route name - */ - public function freeze() - { - $this->isFrozen = true; - } - - public function generateRouteName($prefix) - { - $methods = implode('_', $this->route->getMethods()).'_'; - - $routeName = $methods.$prefix.$this->route->getPath(); - $routeName = str_replace(array('/', ':', '|', '-'), '_', $routeName); - $routeName = preg_replace('/[^a-z0-9A-Z_.]+/', '', $routeName); - - // Collapse consecutive underscores down into a single underscore. - $routeName = preg_replace('/_+/', '_', $routeName); - - return $routeName; - } -} diff --git a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/ControllerCollection.php b/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/ControllerCollection.php deleted file mode 100644 index 7e27708..0000000 --- a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/ControllerCollection.php +++ /dev/null @@ -1,215 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex; - -use Symfony\Component\Routing\RouteCollection; -use Symfony\Component\HttpFoundation\Request; - -/** - * Builds Silex controllers. - * - * It acts as a staging area for routes. You are able to set the route name - * until flush() is called, at which point all controllers are frozen and - * converted to a RouteCollection. - * - * __call() forwards method-calls to Route, but returns instance of ControllerCollection - * listing Route's methods below, so that IDEs know they are valid - * - * @method ControllerCollection assert(string $variable, string $regexp) - * @method ControllerCollection value(string $variable, mixed $default) - * @method ControllerCollection convert(string $variable, mixed $callback) - * @method ControllerCollection method(string $method) - * @method ControllerCollection requireHttp() - * @method ControllerCollection requireHttps() - * @method ControllerCollection before(mixed $callback) - * @method ControllerCollection after(mixed $callback) - * - * @author Igor Wiedler - * @author Fabien Potencier - */ -class ControllerCollection -{ - protected $controllers = array(); - protected $defaultRoute; - protected $defaultController; - protected $prefix; - - public function __construct(Route $defaultRoute) - { - $this->defaultRoute = $defaultRoute; - $this->defaultController = function (Request $request) { - throw new \LogicException(sprintf('The "%s" route must have code to run when it matches.', $request->attributes->get('_route'))); - }; - } - - /** - * Mounts controllers under the given route prefix. - * - * @param string $prefix The route prefix - * @param ControllerCollection $controllers A ControllerCollection instance - */ - public function mount($prefix, ControllerCollection $controllers) - { - $controllers->prefix = $prefix; - - $this->controllers[] = $controllers; - } - - /** - * Maps a pattern to a callable. - * - * You can optionally specify HTTP methods that should be matched. - * - * @param string $pattern Matched route pattern - * @param mixed $to Callback that returns the response when matched - * - * @return Controller - */ - public function match($pattern, $to = null) - { - $route = clone $this->defaultRoute; - $route->setPath($pattern); - $this->controllers[] = $controller = new Controller($route); - $route->setDefault('_controller', null === $to ? $this->defaultController : $to); - - return $controller; - } - - /** - * Maps a GET request to a callable. - * - * @param string $pattern Matched route pattern - * @param mixed $to Callback that returns the response when matched - * - * @return Controller - */ - public function get($pattern, $to = null) - { - return $this->match($pattern, $to)->method('GET'); - } - - /** - * Maps a POST request to a callable. - * - * @param string $pattern Matched route pattern - * @param mixed $to Callback that returns the response when matched - * - * @return Controller - */ - public function post($pattern, $to = null) - { - return $this->match($pattern, $to)->method('POST'); - } - - /** - * Maps a PUT request to a callable. - * - * @param string $pattern Matched route pattern - * @param mixed $to Callback that returns the response when matched - * - * @return Controller - */ - public function put($pattern, $to = null) - { - return $this->match($pattern, $to)->method('PUT'); - } - - /** - * Maps a DELETE request to a callable. - * - * @param string $pattern Matched route pattern - * @param mixed $to Callback that returns the response when matched - * - * @return Controller - */ - public function delete($pattern, $to = null) - { - return $this->match($pattern, $to)->method('DELETE'); - } - - /** - * Maps an OPTIONS request to a callable. - * - * @param string $pattern Matched route pattern - * @param mixed $to Callback that returns the response when matched - * - * @return Controller - */ - public function options($pattern, $to = null) - { - return $this->match($pattern, $to)->method('OPTIONS'); - } - - /** - * Maps a PATCH request to a callable. - * - * @param string $pattern Matched route pattern - * @param mixed $to Callback that returns the response when matched - * - * @return Controller - */ - public function patch($pattern, $to = null) - { - return $this->match($pattern, $to)->method('PATCH'); - } - - public function __call($method, $arguments) - { - if (!method_exists($this->defaultRoute, $method)) { - throw new \BadMethodCallException(sprintf('Method "%s::%s" does not exist.', get_class($this->defaultRoute), $method)); - } - - call_user_func_array(array($this->defaultRoute, $method), $arguments); - - foreach ($this->controllers as $controller) { - if ($controller instanceof Controller) { - call_user_func_array(array($controller, $method), $arguments); - } - } - - return $this; - } - - /** - * Persists and freezes staged controllers. - * - * @param string $prefix - * - * @return RouteCollection A RouteCollection instance - */ - public function flush($prefix = '') - { - $routes = new RouteCollection(); - - foreach ($this->controllers as $controller) { - if ($controller instanceof Controller) { - if (!$name = $controller->getRouteName()) { - $name = $controller->generateRouteName($prefix); - while ($routes->get($name)) { - $name .= '_'; - } - $controller->bind($name); - } - $routes->add($name, $controller->getRoute()); - $controller->freeze(); - } else { - $routes->addCollection($controller->flush($controller->prefix)); - } - } - - $routes->addPrefix($prefix); - - $this->controllers = array(); - - return $routes; - } -} diff --git a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/ControllerProviderInterface.php b/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/ControllerProviderInterface.php deleted file mode 100644 index 2e1f7e6..0000000 --- a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/ControllerProviderInterface.php +++ /dev/null @@ -1,29 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex; - -/** - * Interface for controller providers. - * - * @author Fabien Potencier - */ -interface ControllerProviderInterface -{ - /** - * Returns routes to connect to the given application. - * - * @param Application $app An Application instance - * - * @return ControllerCollection A ControllerCollection instance - */ - public function connect(Application $app); -} diff --git a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/ControllerResolver.php b/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/ControllerResolver.php deleted file mode 100644 index 5955f8f..0000000 --- a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/ControllerResolver.php +++ /dev/null @@ -1,52 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex; - -use Psr\Log\LoggerInterface; -use Symfony\Component\HttpKernel\Controller\ControllerResolver as BaseControllerResolver; -use Symfony\Component\HttpFoundation\Request; - -/** - * Adds Application as a valid argument for controllers. - * - * @author Fabien Potencier - */ -class ControllerResolver extends BaseControllerResolver -{ - protected $app; - - /** - * Constructor. - * - * @param Application $app An Application instance - * @param LoggerInterface $logger A LoggerInterface instance - */ - public function __construct(Application $app, LoggerInterface $logger = null) - { - $this->app = $app; - - parent::__construct($logger); - } - - protected function doGetArguments(Request $request, $controller, array $parameters) - { - foreach ($parameters as $param) { - if ($param->getClass() && $param->getClass()->isInstance($this->app)) { - $request->attributes->set($param->getName(), $this->app); - - break; - } - } - - return parent::doGetArguments($request, $controller, $parameters); - } -} diff --git a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/EventListener/ConverterListener.php b/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/EventListener/ConverterListener.php deleted file mode 100644 index 2fa93c1..0000000 --- a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/EventListener/ConverterListener.php +++ /dev/null @@ -1,66 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\EventListener; - -use Silex\CallbackResolver; -use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\HttpKernel\Event\FilterControllerEvent; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; -use Symfony\Component\Routing\RouteCollection; - -/** - * Handles converters. - * - * @author Fabien Potencier - */ -class ConverterListener implements EventSubscriberInterface -{ - protected $routes; - protected $callbackResolver; - - /** - * Constructor. - * - * @param RouteCollection $routes A RouteCollection instance - * @param CallbackResolver $callbackResolver A CallbackResolver instance - */ - public function __construct(RouteCollection $routes, CallbackResolver $callbackResolver) - { - $this->routes = $routes; - $this->callbackResolver = $callbackResolver; - } - - /** - * Handles converters. - * - * @param FilterControllerEvent $event The event to handle - */ - public function onKernelController(FilterControllerEvent $event) - { - $request = $event->getRequest(); - $route = $this->routes->get($request->attributes->get('_route')); - if ($route && $converters = $route->getOption('_converters')) { - foreach ($converters as $name => $callback) { - $callback = $this->callbackResolver->resolveCallback($callback); - - $request->attributes->set($name, call_user_func($callback, $request->attributes->get($name), $request)); - } - } - } - - public static function getSubscribedEvents() - { - return array( - KernelEvents::CONTROLLER => 'onKernelController', - ); - } -} diff --git a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/EventListener/LocaleListener.php b/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/EventListener/LocaleListener.php deleted file mode 100644 index 60dd624..0000000 --- a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/EventListener/LocaleListener.php +++ /dev/null @@ -1,42 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\EventListener; - -use Symfony\Component\HttpKernel\Event\GetResponseEvent; -use Symfony\Component\HttpKernel\EventListener\LocaleListener as BaseLocaleListener; -use Symfony\Component\HttpFoundation\RequestStack; -use Symfony\Component\Routing\RequestContextAwareInterface; -use Silex\Application; - -/** - * Initializes the locale based on the current request. - * - * @author Fabien Potencier - */ -class LocaleListener extends BaseLocaleListener -{ - protected $app; - - public function __construct(Application $app, RequestContextAwareInterface $router = null, RequestStack $requestStack = null) - { - parent::__construct($app['locale'], $router, $requestStack); - - $this->app = $app; - } - - public function onKernelRequest(GetResponseEvent $event) - { - parent::onKernelRequest($event); - - $this->app['locale'] = $event->getRequest()->getLocale(); - } -} diff --git a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/EventListener/LogListener.php b/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/EventListener/LogListener.php deleted file mode 100644 index 9211d07..0000000 --- a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/EventListener/LogListener.php +++ /dev/null @@ -1,128 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\EventListener; - -use Psr\Log\LoggerInterface; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; -use Symfony\Component\HttpKernel\HttpKernelInterface; -use Symfony\Component\HttpKernel\Event\GetResponseEvent; -use Symfony\Component\HttpKernel\Event\FilterResponseEvent; -use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; -use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpFoundation\RedirectResponse; - -/** - * Log request, response and exceptions. - */ -class LogListener implements EventSubscriberInterface -{ - protected $logger; - - public function __construct(LoggerInterface $logger) - { - $this->logger = $logger; - } - - /** - * Logs master requests on event KernelEvents::REQUEST. - * - * @param GetResponseEvent $event - */ - public function onKernelRequest(GetResponseEvent $event) - { - if (HttpKernelInterface::MASTER_REQUEST !== $event->getRequestType()) { - return; - } - - $this->logRequest($event->getRequest()); - } - - /** - * Logs master response on event KernelEvents::RESPONSE. - * - * @param FilterResponseEvent $event - */ - public function onKernelResponse(FilterResponseEvent $event) - { - if (HttpKernelInterface::MASTER_REQUEST !== $event->getRequestType()) { - return; - } - - $this->logResponse($event->getResponse()); - } - - /** - * Logs uncaught exceptions on event KernelEvents::EXCEPTION. - * - * @param GetResponseForExceptionEvent $event - */ - public function onKernelException(GetResponseForExceptionEvent $event) - { - $this->logException($event->getException()); - } - - /** - * Logs a request. - * - * @param Request $request - */ - protected function logRequest(Request $request) - { - $this->logger->info('> '.$request->getMethod().' '.$request->getRequestUri()); - } - - /** - * Logs a response. - * - * @param Response $response - */ - protected function logResponse(Response $response) - { - if ($response instanceof RedirectResponse) { - $this->logger->info('< '.$response->getStatusCode().' '.$response->getTargetUrl()); - } else { - $this->logger->info('< '.$response->getStatusCode()); - } - } - - /** - * Logs an exception. - * - * @param \Exception $e - */ - protected function logException(\Exception $e) - { - $message = sprintf('%s: %s (uncaught exception) at %s line %s', get_class($e), $e->getMessage(), $e->getFile(), $e->getLine()); - - if ($e instanceof HttpExceptionInterface && $e->getStatusCode() < 500) { - $this->logger->error($message, array('exception' => $e)); - } else { - $this->logger->critical($message, array('exception' => $e)); - } - } - - public static function getSubscribedEvents() - { - return array( - KernelEvents::REQUEST => array('onKernelRequest', 0), - KernelEvents::RESPONSE => array('onKernelResponse', 0), - /* - * Priority -4 is used to come after those from SecurityServiceProvider (0) - * but before the error handlers added with Silex\Application::error (defaults to -8) - */ - KernelEvents::EXCEPTION => array('onKernelException', -4), - ); - } -} diff --git a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/EventListener/MiddlewareListener.php b/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/EventListener/MiddlewareListener.php deleted file mode 100644 index 0fecb81..0000000 --- a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/EventListener/MiddlewareListener.php +++ /dev/null @@ -1,96 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\EventListener; - -use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\HttpKernel\Event\GetResponseEvent; -use Symfony\Component\HttpKernel\Event\FilterResponseEvent; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; -use Silex\Application; - -/** - * Manages the route middlewares. - * - * @author Fabien Potencier - */ -class MiddlewareListener implements EventSubscriberInterface -{ - protected $app; - - /** - * Constructor. - * - * @param Application $app An Application instance - */ - public function __construct(Application $app) - { - $this->app = $app; - } - - /** - * Runs before filters. - * - * @param GetResponseEvent $event The event to handle - */ - public function onKernelRequest(GetResponseEvent $event) - { - $request = $event->getRequest(); - $routeName = $request->attributes->get('_route'); - if (!$route = $this->app['routes']->get($routeName)) { - return; - } - - foreach ((array) $route->getOption('_before_middlewares') as $callback) { - $ret = call_user_func($this->app['callback_resolver']->resolveCallback($callback), $request, $this->app); - if ($ret instanceof Response) { - $event->setResponse($ret); - - return; - } elseif (null !== $ret) { - throw new \RuntimeException(sprintf('A before middleware for route "%s" returned an invalid response value. Must return null or an instance of Response.', $routeName)); - } - } - } - - /** - * Runs after filters. - * - * @param FilterResponseEvent $event The event to handle - */ - public function onKernelResponse(FilterResponseEvent $event) - { - $request = $event->getRequest(); - $routeName = $request->attributes->get('_route'); - if (!$route = $this->app['routes']->get($routeName)) { - return; - } - - foreach ((array) $route->getOption('_after_middlewares') as $callback) { - $response = call_user_func($this->app['callback_resolver']->resolveCallback($callback), $request, $event->getResponse(), $this->app); - if ($response instanceof Response) { - $event->setResponse($response); - } elseif (null !== $response) { - throw new \RuntimeException(sprintf('An after middleware for route "%s" returned an invalid response value. Must return null or an instance of Response.', $routeName)); - } - } - } - - public static function getSubscribedEvents() - { - return array( - // this must be executed after the late events defined with before() (and their priority is -512) - KernelEvents::REQUEST => array('onKernelRequest', -1024), - KernelEvents::RESPONSE => array('onKernelResponse', 128), - ); - } -} diff --git a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/EventListener/StringToResponseListener.php b/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/EventListener/StringToResponseListener.php deleted file mode 100644 index 9fdba5f..0000000 --- a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/EventListener/StringToResponseListener.php +++ /dev/null @@ -1,51 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\EventListener; - -use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; -use Symfony\Component\HttpFoundation\Response; - -/** - * Converts string responses to proper Response instances. - * - * @author Fabien Potencier - */ -class StringToResponseListener implements EventSubscriberInterface -{ - /** - * Handles string responses. - * - * @param GetResponseForControllerResultEvent $event The event to handle - */ - public function onKernelView(GetResponseForControllerResultEvent $event) - { - $response = $event->getControllerResult(); - - if (!( - null === $response - || is_array($response) - || $response instanceof Response - || (is_object($response) && !method_exists($response, '__toString')) - )) { - $event->setResponse(new Response((string) $response)); - } - } - - public static function getSubscribedEvents() - { - return array( - KernelEvents::VIEW => array('onKernelView', -10), - ); - } -} diff --git a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Exception/ControllerFrozenException.php b/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Exception/ControllerFrozenException.php deleted file mode 100644 index 7f0d65f..0000000 --- a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Exception/ControllerFrozenException.php +++ /dev/null @@ -1,21 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\Exception; - -/** - * Exception, is thrown when a frozen controller is modified. - * - * @author Igor Wiedler - */ -class ControllerFrozenException extends \RuntimeException -{ -} diff --git a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/ExceptionHandler.php b/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/ExceptionHandler.php deleted file mode 100644 index 15f5cb8..0000000 --- a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/ExceptionHandler.php +++ /dev/null @@ -1,61 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex; - -use Symfony\Component\Debug\ExceptionHandler as DebugExceptionHandler; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; -use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; -use Symfony\Component\HttpKernel\KernelEvents; - -/** - * Defaults exception handler. - * - * @author Fabien Potencier - */ -class ExceptionHandler implements EventSubscriberInterface -{ - protected $debug; - protected $enabled; - - public function __construct($debug) - { - $this->debug = $debug; - $this->enabled = true; - } - - /** - * @deprecated since 1.3, to be removed in 2.0 - */ - public function disable() - { - $this->enabled = false; - } - - public function onSilexError(GetResponseForExceptionEvent $event) - { - if (!$this->enabled) { - return; - } - - $handler = new DebugExceptionHandler($this->debug); - - $event->setResponse($handler->createResponse($event->getException())); - } - - /** - * {@inheritdoc} - */ - public static function getSubscribedEvents() - { - return array(KernelEvents::EXCEPTION => array('onSilexError', -255)); - } -} diff --git a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/ExceptionListenerWrapper.php b/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/ExceptionListenerWrapper.php deleted file mode 100644 index fc0d231..0000000 --- a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/ExceptionListenerWrapper.php +++ /dev/null @@ -1,93 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex; - -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface; -use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; -use Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent; - -/** - * Wraps exception listeners. - * - * @author Fabien Potencier - */ -class ExceptionListenerWrapper -{ - protected $app; - protected $callback; - - /** - * Constructor. - * - * @param Application $app An Application instance - * @param callable $callback - */ - public function __construct(Application $app, $callback) - { - $this->app = $app; - $this->callback = $callback; - } - - public function __invoke(GetResponseForExceptionEvent $event) - { - $exception = $event->getException(); - $this->callback = $this->app['callback_resolver']->resolveCallback($this->callback); - - if (!$this->shouldRun($exception)) { - return; - } - - $code = $exception instanceof HttpExceptionInterface ? $exception->getStatusCode() : 500; - - $response = call_user_func($this->callback, $exception, $code); - - $this->ensureResponse($response, $event); - } - - protected function shouldRun(\Exception $exception) - { - if (is_array($this->callback)) { - $callbackReflection = new \ReflectionMethod($this->callback[0], $this->callback[1]); - } elseif (is_object($this->callback) && !$this->callback instanceof \Closure) { - $callbackReflection = new \ReflectionObject($this->callback); - $callbackReflection = $callbackReflection->getMethod('__invoke'); - } else { - $callbackReflection = new \ReflectionFunction($this->callback); - } - - if ($callbackReflection->getNumberOfParameters() > 0) { - $parameters = $callbackReflection->getParameters(); - $expectedException = $parameters[0]; - if ($expectedException->getClass() && !$expectedException->getClass()->isInstance($exception)) { - return false; - } - } - - return true; - } - - protected function ensureResponse($response, GetResponseForExceptionEvent $event) - { - if ($response instanceof Response) { - $event->setResponse($response); - } else { - $viewEvent = new GetResponseForControllerResultEvent($this->app['kernel'], $event->getRequest(), $event->getRequestType(), $response); - $this->app['dispatcher']->dispatch(KernelEvents::VIEW, $viewEvent); - - if ($viewEvent->hasResponse()) { - $event->setResponse($viewEvent->getResponse()); - } - } - } -} diff --git a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/HttpCache.php b/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/HttpCache.php deleted file mode 100644 index ebd65dd..0000000 --- a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/HttpCache.php +++ /dev/null @@ -1,39 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex; - -use Symfony\Component\HttpKernel\HttpCache\HttpCache as BaseHttpCache; -use Symfony\Component\HttpFoundation\Request; - -/** - * HTTP Cache extension to allow using the run() shortcut. - * - * @author Fabien Potencier - */ -class HttpCache extends BaseHttpCache -{ - /** - * Handles the Request and delivers the Response. - * - * @param Request $request The Request object - */ - public function run(Request $request = null) - { - if (null === $request) { - $request = Request::createFromGlobals(); - } - - $response = $this->handle($request); - $response->send(); - $this->terminate($request, $response); - } -} diff --git a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/LazyUrlMatcher.php b/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/LazyUrlMatcher.php deleted file mode 100644 index 2005503..0000000 --- a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/LazyUrlMatcher.php +++ /dev/null @@ -1,69 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex; - -use Symfony\Component\Routing\RequestContext as SymfonyRequestContext; -use Symfony\Component\Routing\Matcher\UrlMatcherInterface; - -/** - * Implements a lazy UrlMatcher. - * - * @author Igor Wiedler - */ -class LazyUrlMatcher implements UrlMatcherInterface -{ - private $factory; - - public function __construct(\Closure $factory) - { - $this->factory = $factory; - } - - /** - * Returns the corresponding UrlMatcherInterface instance. - * - * @return UrlMatcherInterface - */ - public function getUrlMatcher() - { - $urlMatcher = call_user_func($this->factory); - if (!$urlMatcher instanceof UrlMatcherInterface) { - throw new \LogicException('Factory supplied to LazyUrlMatcher must return implementation of UrlMatcherInterface.'); - } - - return $urlMatcher; - } - - /** - * {@inheritdoc} - */ - public function match($pathinfo) - { - return $this->getUrlMatcher()->match($pathinfo); - } - - /** - * {@inheritdoc} - */ - public function setContext(SymfonyRequestContext $context) - { - $this->getUrlMatcher()->setContext($context); - } - - /** - * {@inheritdoc} - */ - public function getContext() - { - return $this->getUrlMatcher()->getContext(); - } -} diff --git a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Provider/DoctrineServiceProvider.php b/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Provider/DoctrineServiceProvider.php deleted file mode 100644 index c4c62b0..0000000 --- a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Provider/DoctrineServiceProvider.php +++ /dev/null @@ -1,133 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\Provider; - -use Silex\Application; -use Silex\ServiceProviderInterface; -use Doctrine\DBAL\DriverManager; -use Doctrine\DBAL\Configuration; -use Doctrine\Common\EventManager; -use Symfony\Bridge\Doctrine\Logger\DbalLogger; - -/** - * Doctrine DBAL Provider. - * - * @author Fabien Potencier - */ -class DoctrineServiceProvider implements ServiceProviderInterface -{ - public function register(Application $app) - { - $app['db.default_options'] = array( - 'driver' => 'pdo_mysql', - 'dbname' => null, - 'host' => 'localhost', - 'user' => 'root', - 'password' => null, - ); - - $app['dbs.options.initializer'] = $app->protect(function () use ($app) { - static $initialized = false; - - if ($initialized) { - return; - } - - $initialized = true; - - if (!isset($app['dbs.options'])) { - $app['dbs.options'] = array('default' => isset($app['db.options']) ? $app['db.options'] : array()); - } - - $tmp = $app['dbs.options']; - foreach ($tmp as $name => &$options) { - $options = array_replace($app['db.default_options'], $options); - - if (!isset($app['dbs.default'])) { - $app['dbs.default'] = $name; - } - } - $app['dbs.options'] = $tmp; - }); - - $app['dbs'] = $app->share(function ($app) { - $app['dbs.options.initializer'](); - - $dbs = new \Pimple(); - foreach ($app['dbs.options'] as $name => $options) { - if ($app['dbs.default'] === $name) { - // we use shortcuts here in case the default has been overridden - $config = $app['db.config']; - $manager = $app['db.event_manager']; - } else { - $config = $app['dbs.config'][$name]; - $manager = $app['dbs.event_manager'][$name]; - } - - $dbs[$name] = $dbs->share(function ($dbs) use ($options, $config, $manager) { - return DriverManager::getConnection($options, $config, $manager); - }); - } - - return $dbs; - }); - - $app['dbs.config'] = $app->share(function ($app) { - $app['dbs.options.initializer'](); - - $configs = new \Pimple(); - foreach ($app['dbs.options'] as $name => $options) { - $configs[$name] = new Configuration(); - - if (isset($app['logger']) && class_exists('Symfony\Bridge\Doctrine\Logger\DbalLogger')) { - $configs[$name]->setSQLLogger(new DbalLogger($app['logger'], isset($app['stopwatch']) ? $app['stopwatch'] : null)); - } - } - - return $configs; - }); - - $app['dbs.event_manager'] = $app->share(function ($app) { - $app['dbs.options.initializer'](); - - $managers = new \Pimple(); - foreach ($app['dbs.options'] as $name => $options) { - $managers[$name] = new EventManager(); - } - - return $managers; - }); - - // shortcuts for the "first" DB - $app['db'] = $app->share(function ($app) { - $dbs = $app['dbs']; - - return $dbs[$app['dbs.default']]; - }); - - $app['db.config'] = $app->share(function ($app) { - $dbs = $app['dbs.config']; - - return $dbs[$app['dbs.default']]; - }); - - $app['db.event_manager'] = $app->share(function ($app) { - $dbs = $app['dbs.event_manager']; - - return $dbs[$app['dbs.default']]; - }); - } - - public function boot(Application $app) - { - } -} diff --git a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Provider/FormServiceProvider.php b/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Provider/FormServiceProvider.php deleted file mode 100644 index b3c531f..0000000 --- a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Provider/FormServiceProvider.php +++ /dev/null @@ -1,129 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\Provider; - -use Silex\Application; -use Silex\ServiceProviderInterface; -use Symfony\Component\Form\Extension\Csrf\CsrfExtension; -use Symfony\Component\Form\Extension\Csrf\CsrfProvider\DefaultCsrfProvider; -use Symfony\Component\Form\Extension\Csrf\CsrfProvider\SessionCsrfProvider; -use Symfony\Component\Form\Extension\HttpFoundation\HttpFoundationExtension; -use Symfony\Component\Form\Extension\Validator\ValidatorExtension as FormValidatorExtension; -use Symfony\Component\Form\Forms; -use Symfony\Component\Form\ResolvedFormTypeFactory; -use Symfony\Component\Security\Csrf\CsrfTokenManager; -use Symfony\Component\Security\Csrf\TokenStorage\NativeSessionTokenStorage; -use Symfony\Component\Security\Csrf\TokenStorage\SessionTokenStorage; - -/** - * Symfony Form component Provider. - * - * @author Fabien Potencier - */ -class FormServiceProvider implements ServiceProviderInterface -{ - public function register(Application $app) - { - if (!class_exists('Locale') && !class_exists('Symfony\Component\Locale\Stub\StubLocale')) { - throw new \RuntimeException('You must either install the PHP intl extension or the Symfony Locale Component to use the Form extension.'); - } - - if (!class_exists('Locale')) { - $r = new \ReflectionClass('Symfony\Component\Locale\Stub\StubLocale'); - $path = dirname(dirname($r->getFilename())).'/Resources/stubs'; - - require_once $path.'/functions.php'; - require_once $path.'/Collator.php'; - require_once $path.'/IntlDateFormatter.php'; - require_once $path.'/Locale.php'; - require_once $path.'/NumberFormatter.php'; - } - - $app['form.secret'] = md5(__DIR__); - - $app['form.types'] = $app->share(function ($app) { - return array(); - }); - - $app['form.type.extensions'] = $app->share(function ($app) { - return array(); - }); - - $app['form.type.guessers'] = $app->share(function ($app) { - return array(); - }); - - $app['form.extension.csrf'] = $app->share(function ($app) { - if (isset($app['translator'])) { - return new CsrfExtension($app['form.csrf_provider'], $app['translator']); - } - - return new CsrfExtension($app['form.csrf_provider']); - }); - - $app['form.extensions'] = $app->share(function ($app) { - $extensions = array( - $app['form.extension.csrf'], - new HttpFoundationExtension(), - ); - - if (isset($app['validator'])) { - $extensions[] = new FormValidatorExtension($app['validator']); - - if (isset($app['translator'])) { - $r = new \ReflectionClass('Symfony\Component\Form\Form'); - $file = dirname($r->getFilename()).'/Resources/translations/validators.'.$app['locale'].'.xlf'; - if (file_exists($file)) { - $app['translator']->addResource('xliff', $file, $app['locale'], 'validators'); - } - } - } - - return $extensions; - }); - - $app['form.factory'] = $app->share(function ($app) { - return Forms::createFormFactoryBuilder() - ->addExtensions($app['form.extensions']) - ->addTypes($app['form.types']) - ->addTypeExtensions($app['form.type.extensions']) - ->addTypeGuessers($app['form.type.guessers']) - ->setResolvedTypeFactory($app['form.resolved_type_factory']) - ->getFormFactory() - ; - }); - - $app['form.resolved_type_factory'] = $app->share(function ($app) { - return new ResolvedFormTypeFactory(); - }); - - $app['form.csrf_provider'] = $app->share(function ($app) { - if (!class_exists('Symfony\Component\Form\Extension\DataCollector\DataCollectorExtension')) { - // Symfony 2.3 - if (isset($app['session'])) { - return new SessionCsrfProvider($app['session'], $app['form.secret']); - } - - return new DefaultCsrfProvider($app['form.secret']); - } else { - // Symfony 2.4+ - $storage = isset($app['session']) ? new SessionTokenStorage($app['session']) : new NativeSessionTokenStorage(); - - return new CsrfTokenManager(null, $storage); - } - }); - } - - public function boot(Application $app) - { - } -} diff --git a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Provider/HttpCacheServiceProvider.php b/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Provider/HttpCacheServiceProvider.php deleted file mode 100644 index 1281c81..0000000 --- a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Provider/HttpCacheServiceProvider.php +++ /dev/null @@ -1,64 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\Provider; - -use Silex\Application; -use Silex\ServiceProviderInterface; -use Silex\HttpCache; -use Symfony\Component\HttpKernel\HttpCache\Esi; -use Symfony\Component\HttpKernel\HttpCache\Store; -use Symfony\Component\HttpKernel\EventListener\EsiListener; -use Symfony\Component\HttpKernel\EventListener\SurrogateListener; - -/** - * Symfony HttpKernel component Provider for HTTP cache. - * - * @author Fabien Potencier - */ -class HttpCacheServiceProvider implements ServiceProviderInterface -{ - public function register(Application $app) - { - $app['http_cache'] = $app->share(function ($app) { - $app['http_cache.options'] = array_replace( - array( - 'debug' => $app['debug'], - ), $app['http_cache.options'] - ); - - return new HttpCache($app, $app['http_cache.store'], $app['http_cache.esi'], $app['http_cache.options']); - }); - - $app['http_cache.esi'] = $app->share(function ($app) { - return new Esi(); - }); - - $app['http_cache.store'] = $app->share(function ($app) { - return new Store($app['http_cache.cache_dir']); - }); - - $app['http_cache.esi_listener'] = $app->share(function ($app) { - if (class_exists('Symfony\Component\HttpKernel\EventListener\SurrogateListener')) { - return new SurrogateListener($app['http_cache.esi']); - } - - return new EsiListener($app['http_cache.esi']); - }); - - $app['http_cache.options'] = array(); - } - - public function boot(Application $app) - { - $app['dispatcher']->addSubscriber($app['http_cache.esi_listener']); - } -} diff --git a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Provider/HttpFragmentServiceProvider.php b/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Provider/HttpFragmentServiceProvider.php deleted file mode 100644 index f72a97b..0000000 --- a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Provider/HttpFragmentServiceProvider.php +++ /dev/null @@ -1,89 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\Provider; - -use Silex\Application; -use Silex\ServiceProviderInterface; -use Symfony\Component\HttpKernel\Fragment\FragmentHandler; -use Symfony\Component\HttpKernel\Fragment\InlineFragmentRenderer; -use Symfony\Component\HttpKernel\Fragment\EsiFragmentRenderer; -use Symfony\Component\HttpKernel\Fragment\HIncludeFragmentRenderer; -use Symfony\Component\HttpKernel\EventListener\FragmentListener; -use Symfony\Component\HttpKernel\UriSigner; - -/** - * HttpKernel Fragment integration for Silex. - * - * This service provider requires Symfony 2.4+. - * - * @author Fabien Potencier - */ -class HttpFragmentServiceProvider implements ServiceProviderInterface -{ - public function register(Application $app) - { - if (!class_exists('Symfony\Component\HttpFoundation\RequestStack')) { - throw new \LogicException('The HTTP Fragment service provider only works with Symfony 2.4+.'); - } - - $app['fragment.handler'] = $app->share(function ($app) { - return new FragmentHandler($app['fragment.renderers'], $app['debug'], $app['request_stack']); - }); - - $app['fragment.renderer.inline'] = $app->share(function ($app) { - $renderer = new InlineFragmentRenderer($app['kernel'], $app['dispatcher']); - $renderer->setFragmentPath($app['fragment.path']); - - return $renderer; - }); - - $app['fragment.renderer.hinclude'] = $app->share(function ($app) { - $renderer = new HIncludeFragmentRenderer(null, $app['uri_signer'], $app['fragment.renderer.hinclude.global_template'], $app['charset']); - $renderer->setFragmentPath($app['fragment.path']); - - return $renderer; - }); - - $app['fragment.renderer.esi'] = $app->share(function ($app) { - $renderer = new EsiFragmentRenderer($app['http_cache.esi'], $app['fragment.renderer.inline']); - $renderer->setFragmentPath($app['fragment.path']); - - return $renderer; - }); - - $app['fragment.listener'] = $app->share(function ($app) { - return new FragmentListener($app['uri_signer'], $app['fragment.path']); - }); - - $app['uri_signer'] = $app->share(function ($app) { - return new UriSigner($app['uri_signer.secret']); - }); - - $app['uri_signer.secret'] = md5(__DIR__); - $app['fragment.path'] = '/_fragment'; - $app['fragment.renderer.hinclude.global_template'] = null; - $app['fragment.renderers'] = $app->share(function ($app) { - $renderers = array($app['fragment.renderer.inline'], $app['fragment.renderer.hinclude']); - - if (isset($app['http_cache.esi'])) { - $renderers[] = $app['fragment.renderer.esi']; - } - - return $renderers; - }); - } - - public function boot(Application $app) - { - $app['dispatcher']->addSubscriber($app['fragment.listener']); - } -} diff --git a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Provider/MonologServiceProvider.php b/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Provider/MonologServiceProvider.php deleted file mode 100644 index acb21ef..0000000 --- a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Provider/MonologServiceProvider.php +++ /dev/null @@ -1,98 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\Provider; - -use Monolog\Logger; -use Monolog\Handler\StreamHandler; -use Silex\Application; -use Silex\ServiceProviderInterface; -use Symfony\Bridge\Monolog\Handler\DebugHandler; -use Silex\EventListener\LogListener; - -/** - * Monolog Provider. - * - * @author Fabien Potencier - */ -class MonologServiceProvider implements ServiceProviderInterface -{ - public function register(Application $app) - { - $app['logger'] = function () use ($app) { - return $app['monolog']; - }; - - if ($bridge = class_exists('Symfony\Bridge\Monolog\Logger')) { - $app['monolog.handler.debug'] = function () use ($app) { - $level = MonologServiceProvider::translateLevel($app['monolog.level']); - - return new DebugHandler($level); - }; - } - - $app['monolog.logger.class'] = $bridge ? 'Symfony\Bridge\Monolog\Logger' : 'Monolog\Logger'; - - $app['monolog'] = $app->share(function ($app) { - $log = new $app['monolog.logger.class']($app['monolog.name']); - - $log->pushHandler($app['monolog.handler']); - - if ($app['debug'] && isset($app['monolog.handler.debug'])) { - $log->pushHandler($app['monolog.handler.debug']); - } - - return $log; - }); - - $app['monolog.handler'] = function () use ($app) { - $level = MonologServiceProvider::translateLevel($app['monolog.level']); - - return new StreamHandler($app['monolog.logfile'], $level, $app['monolog.bubble'], $app['monolog.permission']); - }; - - $app['monolog.level'] = function () { - return Logger::DEBUG; - }; - - $app['monolog.listener'] = $app->share(function () use ($app) { - return new LogListener($app['logger']); - }); - - $app['monolog.name'] = 'myapp'; - $app['monolog.bubble'] = true; - $app['monolog.permission'] = null; - } - - public function boot(Application $app) - { - if (isset($app['monolog.listener'])) { - $app['dispatcher']->addSubscriber($app['monolog.listener']); - } - } - - public static function translateLevel($name) - { - // level is already translated to logger constant, return as-is - if (is_int($name)) { - return $name; - } - - $levels = Logger::getLevels(); - $upper = strtoupper($name); - - if (!isset($levels[$upper])) { - throw new \InvalidArgumentException("Provided logging level '$name' does not exist. Must be a valid monolog logging level."); - } - - return $levels[$upper]; - } -} diff --git a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Provider/RememberMeServiceProvider.php b/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Provider/RememberMeServiceProvider.php deleted file mode 100644 index 56259a3..0000000 --- a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Provider/RememberMeServiceProvider.php +++ /dev/null @@ -1,105 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\Provider; - -use Silex\Application; -use Silex\ServiceProviderInterface; -use Symfony\Component\Security\Core\Authentication\Provider\RememberMeAuthenticationProvider; -use Symfony\Component\Security\Http\Firewall\RememberMeListener; -use Symfony\Component\Security\Http\RememberMe\TokenBasedRememberMeServices; -use Symfony\Component\Security\Http\RememberMe\ResponseListener; - -/** - * Remember-me authentication for the SecurityServiceProvider. - * - * @author Jérôme Tamarelle - */ -class RememberMeServiceProvider implements ServiceProviderInterface -{ - public function register(Application $app) - { - $app['security.remember_me.response_listener'] = $app->share(function () { - return new ResponseListener(); - }); - - $app['security.authentication_listener.factory.remember_me'] = $app->protect(function ($name, $options) use ($app) { - if (empty($options['key'])) { - $options['key'] = $name; - } - - if (!isset($app['security.remember_me.service.'.$name])) { - $app['security.remember_me.service.'.$name] = $app['security.remember_me.service._proto']($name, $options); - } - - if (!isset($app['security.authentication_listener.'.$name.'.remember_me'])) { - $app['security.authentication_listener.'.$name.'.remember_me'] = $app['security.authentication_listener.remember_me._proto']($name, $options); - } - - if (!isset($app['security.authentication_provider.'.$name.'.remember_me'])) { - $app['security.authentication_provider.'.$name.'.remember_me'] = $app['security.authentication_provider.remember_me._proto']($name, $options); - } - - return array( - 'security.authentication_provider.'.$name.'.remember_me', - 'security.authentication_listener.'.$name.'.remember_me', - null, // entry point - 'remember_me', - ); - }); - - $app['security.remember_me.service._proto'] = $app->protect(function ($providerKey, $options) use ($app) { - return $app->share(function () use ($providerKey, $options, $app) { - $options = array_replace(array( - 'name' => 'REMEMBERME', - 'lifetime' => 31536000, - 'path' => '/', - 'domain' => null, - 'secure' => false, - 'httponly' => true, - 'always_remember_me' => false, - 'remember_me_parameter' => '_remember_me', - ), $options); - - return new TokenBasedRememberMeServices(array($app['security.user_provider.'.$providerKey]), $options['key'], $providerKey, $options, $app['logger']); - }); - }); - - $app['security.authentication_listener.remember_me._proto'] = $app->protect(function ($providerKey) use ($app) { - return $app->share(function () use ($app, $providerKey) { - $listener = new RememberMeListener( - $app['security.token_storage'], - $app['security.remember_me.service.'.$providerKey], - $app['security.authentication_manager'], - $app['logger'], - $app['dispatcher'] - ); - - return $listener; - }); - }); - - $app['security.authentication_provider.remember_me._proto'] = $app->protect(function ($name, $options) use ($app) { - return $app->share(function () use ($app, $name, $options) { - return new RememberMeAuthenticationProvider($app['security.user_checker'], $options['key'], $name); - }); - }); - } - - public function boot(Application $app) - { - if (!isset($app['security'])) { - throw new \LogicException('You must register the SecurityServiceProvider to use the RememberMeServiceProvider'); - } - - $app['dispatcher']->addSubscriber($app['security.remember_me.response_listener']); - } -} diff --git a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Provider/SecurityServiceProvider.php b/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Provider/SecurityServiceProvider.php deleted file mode 100644 index 6b4d79e..0000000 --- a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Provider/SecurityServiceProvider.php +++ /dev/null @@ -1,595 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\Provider; - -use Silex\Application; -use Silex\ServiceProviderInterface; -use Symfony\Component\HttpFoundation\RequestMatcher; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\Security\Core\Security; -use Symfony\Component\Security\Core\SecurityContext; -use Symfony\Component\Security\Core\SecurityContextInterface; -use Symfony\Component\Security\Core\User\UserChecker; -use Symfony\Component\Security\Core\User\InMemoryUserProvider; -use Symfony\Component\Security\Core\Encoder\EncoderFactory; -use Symfony\Component\Security\Core\Encoder\MessageDigestPasswordEncoder; -use Symfony\Component\Security\Core\Authentication\Provider\DaoAuthenticationProvider; -use Symfony\Component\Security\Core\Authentication\Provider\AnonymousAuthenticationProvider; -use Symfony\Component\Security\Core\Authentication\AuthenticationProviderManager; -use Symfony\Component\Security\Core\Authentication\AuthenticationTrustResolver; -use Symfony\Component\Security\Http\Authentication\DefaultAuthenticationSuccessHandler; -use Symfony\Component\Security\Http\Authentication\DefaultAuthenticationFailureHandler; -use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage; -use Symfony\Component\Security\Core\Authorization\AuthorizationChecker; -use Symfony\Component\Security\Core\Authorization\Voter\RoleHierarchyVoter; -use Symfony\Component\Security\Core\Authorization\Voter\AuthenticatedVoter; -use Symfony\Component\Security\Core\Authorization\AccessDecisionManager; -use Symfony\Component\Security\Core\Role\RoleHierarchy; -use Symfony\Component\Security\Core\Validator\Constraints\UserPasswordValidator; -use Symfony\Component\Security\Http\Firewall; -use Symfony\Component\Security\Http\FirewallMap; -use Symfony\Component\Security\Http\Firewall\AbstractAuthenticationListener; -use Symfony\Component\Security\Http\Firewall\AccessListener; -use Symfony\Component\Security\Http\Firewall\BasicAuthenticationListener; -use Symfony\Component\Security\Http\Firewall\LogoutListener; -use Symfony\Component\Security\Http\Firewall\SwitchUserListener; -use Symfony\Component\Security\Http\Firewall\AnonymousAuthenticationListener; -use Symfony\Component\Security\Http\Firewall\ContextListener; -use Symfony\Component\Security\Http\Firewall\ExceptionListener; -use Symfony\Component\Security\Http\Firewall\ChannelListener; -use Symfony\Component\Security\Http\EntryPoint\FormAuthenticationEntryPoint; -use Symfony\Component\Security\Http\EntryPoint\BasicAuthenticationEntryPoint; -use Symfony\Component\Security\Http\EntryPoint\RetryAuthenticationEntryPoint; -use Symfony\Component\Security\Http\Session\SessionAuthenticationStrategy; -use Symfony\Component\Security\Http\Logout\SessionLogoutHandler; -use Symfony\Component\Security\Http\Logout\DefaultLogoutSuccessHandler; -use Symfony\Component\Security\Http\AccessMap; -use Symfony\Component\Security\Http\HttpUtils; - -/** - * Symfony Security component Provider. - * - * @author Fabien Potencier - */ -class SecurityServiceProvider implements ServiceProviderInterface -{ - protected $fakeRoutes; - - public function register(Application $app) - { - // used to register routes for login_check and logout - $this->fakeRoutes = array(); - - $that = $this; - - $app['security.role_hierarchy'] = array(); - $app['security.access_rules'] = array(); - $app['security.hide_user_not_found'] = true; - - $r = new \ReflectionMethod('Symfony\Component\Security\Http\Firewall\ContextListener', '__construct'); - $params = $r->getParameters(); - if ('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface' === $params[0]->getClass()->getName()) { - $app['security.authorization_checker'] = $app->share(function ($app) { - return new AuthorizationChecker($app['security.token_storage'], $app['security.authentication_manager'], $app['security.access_manager']); - }); - - $app['security.token_storage'] = $app->share(function ($app) { - return new TokenStorage(); - }); - - $app['security'] = $app->share(function ($app) { - // Deprecated, to be removed in 2.0 - return new SecurityContext($app['security.token_storage'], $app['security.authorization_checker']); - }); - } else { - $app['security.token_storage'] = $app['security.authorization_checker'] = $app->share(function ($app) { - return $app['security']; - }); - - $app['security'] = $app->share(function ($app) { - // Deprecated, to be removed in 2.0 - return new SecurityContext($app['security.authentication_manager'], $app['security.access_manager']); - }); - } - - $app['user'] = function ($app) { - if (null === $token = $app['security.token_storage']->getToken()) { - return; - } - - if (!is_object($user = $token->getUser())) { - return; - } - - return $user; - }; - - $app['security.authentication_manager'] = $app->share(function ($app) { - $manager = new AuthenticationProviderManager($app['security.authentication_providers']); - $manager->setEventDispatcher($app['dispatcher']); - - return $manager; - }); - - // by default, all users use the digest encoder - $app['security.encoder_factory'] = $app->share(function ($app) { - return new EncoderFactory(array( - 'Symfony\Component\Security\Core\User\UserInterface' => $app['security.encoder.digest'], - )); - }); - - $app['security.encoder.digest'] = $app->share(function ($app) { - return new MessageDigestPasswordEncoder(); - }); - - $app['security.user_checker'] = $app->share(function ($app) { - return new UserChecker(); - }); - - $app['security.access_manager'] = $app->share(function ($app) { - return new AccessDecisionManager($app['security.voters']); - }); - - $app['security.voters'] = $app->share(function ($app) { - return array( - new RoleHierarchyVoter(new RoleHierarchy($app['security.role_hierarchy'])), - new AuthenticatedVoter($app['security.trust_resolver']), - ); - }); - - $app['security.firewall'] = $app->share(function ($app) { - return new Firewall($app['security.firewall_map'], $app['dispatcher']); - }); - - $app['security.channel_listener'] = $app->share(function ($app) { - return new ChannelListener( - $app['security.access_map'], - new RetryAuthenticationEntryPoint($app['request.http_port'], $app['request.https_port']), - $app['logger'] - ); - }); - - // generate the build-in authentication factories - foreach (array('logout', 'pre_auth', 'form', 'http', 'remember_me', 'anonymous') as $type) { - $entryPoint = null; - if ('http' === $type) { - $entryPoint = 'http'; - } elseif ('form' === $type) { - $entryPoint = 'form'; - } - - $app['security.authentication_listener.factory.'.$type] = $app->protect(function ($name, $options) use ($type, $app, $entryPoint) { - if ($entryPoint && !isset($app['security.entry_point.'.$name.'.'.$entryPoint])) { - $app['security.entry_point.'.$name.'.'.$entryPoint] = $app['security.entry_point.'.$entryPoint.'._proto']($name, $options); - } - - if (!isset($app['security.authentication_listener.'.$name.'.'.$type])) { - $app['security.authentication_listener.'.$name.'.'.$type] = $app['security.authentication_listener.'.$type.'._proto']($name, $options); - } - - $provider = 'anonymous' === $type ? 'anonymous' : 'dao'; - if (!isset($app['security.authentication_provider.'.$name.'.'.$provider])) { - $app['security.authentication_provider.'.$name.'.'.$provider] = $app['security.authentication_provider.'.$provider.'._proto']($name); - } - - return array( - 'security.authentication_provider.'.$name.'.'.$provider, - 'security.authentication_listener.'.$name.'.'.$type, - $entryPoint ? 'security.entry_point.'.$name.'.'.$entryPoint : null, - $type, - ); - }); - } - - $app['security.firewall_map'] = $app->share(function ($app) { - $positions = array('logout', 'pre_auth', 'form', 'http', 'remember_me', 'anonymous'); - $providers = array(); - $configs = array(); - foreach ($app['security.firewalls'] as $name => $firewall) { - $entryPoint = null; - $pattern = isset($firewall['pattern']) ? $firewall['pattern'] : null; - $users = isset($firewall['users']) ? $firewall['users'] : array(); - $security = isset($firewall['security']) ? (bool) $firewall['security'] : true; - $stateless = isset($firewall['stateless']) ? (bool) $firewall['stateless'] : false; - unset($firewall['pattern'], $firewall['users'], $firewall['security'], $firewall['stateless']); - - $protected = false === $security ? false : count($firewall); - - $listeners = array('security.channel_listener'); - - if ($protected) { - if (!isset($app['security.context_listener.'.$name])) { - if (!isset($app['security.user_provider.'.$name])) { - $app['security.user_provider.'.$name] = is_array($users) ? $app['security.user_provider.inmemory._proto']($users) : $users; - } - - $app['security.context_listener.'.$name] = $app['security.context_listener._proto']($name, array($app['security.user_provider.'.$name])); - } - - if (false === $stateless) { - $listeners[] = 'security.context_listener.'.$name; - } - - $factories = array(); - foreach ($positions as $position) { - $factories[$position] = array(); - } - - foreach ($firewall as $type => $options) { - if ('switch_user' === $type) { - continue; - } - - // normalize options - if (!is_array($options)) { - if (!$options) { - continue; - } - - $options = array(); - } - - if (!isset($app['security.authentication_listener.factory.'.$type])) { - throw new \LogicException(sprintf('The "%s" authentication entry is not registered.', $type)); - } - - list($providerId, $listenerId, $entryPointId, $position) = $app['security.authentication_listener.factory.'.$type]($name, $options); - - if (null !== $entryPointId) { - $entryPoint = $entryPointId; - } - - $factories[$position][] = $listenerId; - $providers[] = $providerId; - } - - foreach ($positions as $position) { - foreach ($factories[$position] as $listener) { - $listeners[] = $listener; - } - } - - $listeners[] = 'security.access_listener'; - - if (isset($firewall['switch_user'])) { - $app['security.switch_user.'.$name] = $app['security.authentication_listener.switch_user._proto']($name, $firewall['switch_user']); - - $listeners[] = 'security.switch_user.'.$name; - } - - if (!isset($app['security.exception_listener.'.$name])) { - if (null == $entryPoint) { - $app[$entryPoint = 'security.entry_point.'.$name.'.form'] = $app['security.entry_point.form._proto']($name, array()); - } - $app['security.exception_listener.'.$name] = $app['security.exception_listener._proto']($entryPoint, $name); - } - } - - $configs[$name] = array($pattern, $listeners, $protected); - } - - $app['security.authentication_providers'] = array_map(function ($provider) use ($app) { - return $app[$provider]; - }, array_unique($providers)); - - $map = new FirewallMap(); - foreach ($configs as $name => $config) { - $map->add( - is_string($config[0]) ? new RequestMatcher($config[0]) : $config[0], - array_map(function ($listenerId) use ($app, $name) { - $listener = $app[$listenerId]; - - if (isset($app['security.remember_me.service.'.$name])) { - if ($listener instanceof AbstractAuthenticationListener) { - $listener->setRememberMeServices($app['security.remember_me.service.'.$name]); - } - if ($listener instanceof LogoutListener) { - $listener->addHandler($app['security.remember_me.service.'.$name]); - } - } - - return $listener; - }, $config[1]), - $config[2] ? $app['security.exception_listener.'.$name] : null - ); - } - - return $map; - }); - - $app['security.access_listener'] = $app->share(function ($app) { - return new AccessListener( - $app['security.token_storage'], - $app['security.access_manager'], - $app['security.access_map'], - $app['security.authentication_manager'], - $app['logger'] - ); - }); - - $app['security.access_map'] = $app->share(function ($app) { - $map = new AccessMap(); - - foreach ($app['security.access_rules'] as $rule) { - if (is_string($rule[0])) { - $rule[0] = new RequestMatcher($rule[0]); - } - - $map->add($rule[0], (array) $rule[1], isset($rule[2]) ? $rule[2] : null); - } - - return $map; - }); - - $app['security.trust_resolver'] = $app->share(function ($app) { - return new AuthenticationTrustResolver('Symfony\Component\Security\Core\Authentication\Token\AnonymousToken', 'Symfony\Component\Security\Core\Authentication\Token\RememberMeToken'); - }); - - $app['security.session_strategy'] = $app->share(function ($app) { - return new SessionAuthenticationStrategy(SessionAuthenticationStrategy::MIGRATE); - }); - - $app['security.http_utils'] = $app->share(function ($app) { - return new HttpUtils(isset($app['url_generator']) ? $app['url_generator'] : null, $app['url_matcher']); - }); - - $app['security.last_error'] = $app->protect(function (Request $request) { - if (class_exists('Symfony\Component\Security\Core\Security')) { - $error = Security::AUTHENTICATION_ERROR; - } else { - $error = SecurityContextInterface::AUTHENTICATION_ERROR; - } - if ($request->attributes->has($error)) { - return $request->attributes->get($error)->getMessage(); - } - - $session = $request->getSession(); - if ($session && $session->has($error)) { - $error = $session->get($error)->getMessage(); - $session->remove($error); - - return $error; - } - }); - - // prototypes (used by the Firewall Map) - - $app['security.context_listener._proto'] = $app->protect(function ($providerKey, $userProviders) use ($app) { - return $app->share(function () use ($app, $userProviders, $providerKey) { - return new ContextListener( - $app['security.token_storage'], - $userProviders, - $providerKey, - $app['logger'], - $app['dispatcher'] - ); - }); - }); - - $app['security.user_provider.inmemory._proto'] = $app->protect(function ($params) use ($app) { - return $app->share(function () use ($app, $params) { - $users = array(); - foreach ($params as $name => $user) { - $users[$name] = array('roles' => (array) $user[0], 'password' => $user[1]); - } - - return new InMemoryUserProvider($users); - }); - }); - - $app['security.exception_listener._proto'] = $app->protect(function ($entryPoint, $name) use ($app) { - return $app->share(function () use ($app, $entryPoint, $name) { - return new ExceptionListener( - $app['security.token_storage'], - $app['security.trust_resolver'], - $app['security.http_utils'], - $name, - $app[$entryPoint], - null, // errorPage - null, // AccessDeniedHandlerInterface - $app['logger'] - ); - }); - }); - - $app['security.authentication.success_handler._proto'] = $app->protect(function ($name, $options) use ($app) { - return $app->share(function () use ($name, $options, $app) { - $handler = new DefaultAuthenticationSuccessHandler( - $app['security.http_utils'], - $options - ); - $handler->setProviderKey($name); - - return $handler; - }); - }); - - $app['security.authentication.failure_handler._proto'] = $app->protect(function ($name, $options) use ($app) { - return $app->share(function () use ($name, $options, $app) { - return new DefaultAuthenticationFailureHandler( - $app, - $app['security.http_utils'], - $options, - $app['logger'] - ); - }); - }); - - $app['security.authentication_listener.form._proto'] = $app->protect(function ($name, $options) use ($app, $that) { - return $app->share(function () use ($app, $name, $options, $that) { - $that->addFakeRoute( - 'match', - $tmp = isset($options['check_path']) ? $options['check_path'] : '/login_check', - str_replace('/', '_', ltrim($tmp, '/')) - ); - - $class = isset($options['listener_class']) ? $options['listener_class'] : 'Symfony\\Component\\Security\\Http\\Firewall\\UsernamePasswordFormAuthenticationListener'; - - if (!isset($app['security.authentication.success_handler.'.$name])) { - $app['security.authentication.success_handler.'.$name] = $app['security.authentication.success_handler._proto']($name, $options); - } - - if (!isset($app['security.authentication.failure_handler.'.$name])) { - $app['security.authentication.failure_handler.'.$name] = $app['security.authentication.failure_handler._proto']($name, $options); - } - - return new $class( - $app['security.token_storage'], - $app['security.authentication_manager'], - isset($app['security.session_strategy.'.$name]) ? $app['security.session_strategy.'.$name] : $app['security.session_strategy'], - $app['security.http_utils'], - $name, - $app['security.authentication.success_handler.'.$name], - $app['security.authentication.failure_handler.'.$name], - $options, - $app['logger'], - $app['dispatcher'], - isset($options['with_csrf']) && $options['with_csrf'] && isset($app['form.csrf_provider']) ? $app['form.csrf_provider'] : null - ); - }); - }); - - $app['security.authentication_listener.http._proto'] = $app->protect(function ($providerKey, $options) use ($app) { - return $app->share(function () use ($app, $providerKey, $options) { - return new BasicAuthenticationListener( - $app['security.token_storage'], - $app['security.authentication_manager'], - $providerKey, - $app['security.entry_point.'.$providerKey.'.http'], - $app['logger'] - ); - }); - }); - - $app['security.authentication_listener.anonymous._proto'] = $app->protect(function ($providerKey, $options) use ($app) { - return $app->share(function () use ($app, $providerKey, $options) { - return new AnonymousAuthenticationListener( - $app['security.token_storage'], - $providerKey, - $app['logger'] - ); - }); - }); - - $app['security.authentication.logout_handler._proto'] = $app->protect(function ($name, $options) use ($app) { - return $app->share(function () use ($name, $options, $app) { - return new DefaultLogoutSuccessHandler( - $app['security.http_utils'], - isset($options['target_url']) ? $options['target_url'] : '/' - ); - }); - }); - - $app['security.authentication_listener.logout._proto'] = $app->protect(function ($name, $options) use ($app, $that) { - return $app->share(function () use ($app, $name, $options, $that) { - $that->addFakeRoute( - 'get', - $tmp = isset($options['logout_path']) ? $options['logout_path'] : '/logout', - str_replace('/', '_', ltrim($tmp, '/')) - ); - - if (!isset($app['security.authentication.logout_handler.'.$name])) { - $app['security.authentication.logout_handler.'.$name] = $app['security.authentication.logout_handler._proto']($name, $options); - } - - $listener = new LogoutListener( - $app['security.token_storage'], - $app['security.http_utils'], - $app['security.authentication.logout_handler.'.$name], - $options, - isset($options['with_csrf']) && $options['with_csrf'] && isset($app['form.csrf_provider']) ? $app['form.csrf_provider'] : null - ); - - $listener->addHandler(new SessionLogoutHandler()); - - return $listener; - }); - }); - - $app['security.authentication_listener.switch_user._proto'] = $app->protect(function ($name, $options) use ($app, $that) { - return $app->share(function () use ($app, $name, $options, $that) { - return new SwitchUserListener( - $app['security.token_storage'], - $app['security.user_provider.'.$name], - $app['security.user_checker'], - $name, - $app['security.access_manager'], - $app['logger'], - isset($options['parameter']) ? $options['parameter'] : '_switch_user', - isset($options['role']) ? $options['role'] : 'ROLE_ALLOWED_TO_SWITCH', - $app['dispatcher'] - ); - }); - }); - - $app['security.entry_point.form._proto'] = $app->protect(function ($name, array $options) use ($app) { - return $app->share(function () use ($app, $options) { - $loginPath = isset($options['login_path']) ? $options['login_path'] : '/login'; - $useForward = isset($options['use_forward']) ? $options['use_forward'] : false; - - return new FormAuthenticationEntryPoint($app, $app['security.http_utils'], $loginPath, $useForward); - }); - }); - - $app['security.entry_point.http._proto'] = $app->protect(function ($name, array $options) use ($app) { - return $app->share(function () use ($app, $name, $options) { - return new BasicAuthenticationEntryPoint(isset($options['real_name']) ? $options['real_name'] : 'Secured'); - }); - }); - - $app['security.authentication_provider.dao._proto'] = $app->protect(function ($name) use ($app) { - return $app->share(function () use ($app, $name) { - return new DaoAuthenticationProvider( - $app['security.user_provider.'.$name], - $app['security.user_checker'], - $name, - $app['security.encoder_factory'], - $app['security.hide_user_not_found'] - ); - }); - }); - - $app['security.authentication_provider.anonymous._proto'] = $app->protect(function ($name) use ($app) { - return $app->share(function () use ($app, $name) { - return new AnonymousAuthenticationProvider($name); - }); - }); - - if (isset($app['validator'])) { - $app['security.validator.user_password_validator'] = $app->share(function ($app) { - return new UserPasswordValidator($app['security.token_storage'], $app['security.encoder_factory']); - }); - - if (!isset($app['validator.validator_service_ids'])) { - $app['validator.validator_service_ids'] = array(); - } - - $app['validator.validator_service_ids'] = array_merge($app['validator.validator_service_ids'], array('security.validator.user_password' => 'security.validator.user_password_validator')); - } - } - - public function boot(Application $app) - { - $app['dispatcher']->addSubscriber($app['security.firewall']); - - foreach ($this->fakeRoutes as $route) { - list($method, $pattern, $name) = $route; - - $app->$method($pattern)->run(null)->bind($name); - } - } - - public function addFakeRoute($method, $pattern, $name) - { - $this->fakeRoutes[] = array($method, $pattern, $name); - } -} diff --git a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Provider/SerializerServiceProvider.php b/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Provider/SerializerServiceProvider.php deleted file mode 100644 index 3ba24a8..0000000 --- a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Provider/SerializerServiceProvider.php +++ /dev/null @@ -1,63 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\Provider; - -use Silex\Application; -use Silex\ServiceProviderInterface; -use Symfony\Component\Serializer\Serializer; -use Symfony\Component\Serializer\Encoder\JsonEncoder; -use Symfony\Component\Serializer\Encoder\XmlEncoder; -use Symfony\Component\Serializer\Normalizer\CustomNormalizer; -use Symfony\Component\Serializer\Normalizer\GetSetMethodNormalizer; - -/** - * Symfony Serializer component Provider. - * - * @author Fabien Potencier - * @author Marijn Huizendveld - */ -class SerializerServiceProvider implements ServiceProviderInterface -{ - /** - * {@inheritdoc} - * - * This method registers a serializer service. {@link http://api.symfony.com/master/Symfony/Component/Serializer/Serializer.html - * The service is provided by the Symfony Serializer component}. - * - * @param Application $app - */ - public function register(Application $app) - { - $app['serializer'] = $app->share(function () use ($app) { - return new Serializer($app['serializer.normalizers'], $app['serializer.encoders']); - }); - - $app['serializer.encoders'] = $app->share(function () { - return array(new JsonEncoder(), new XmlEncoder()); - }); - - $app['serializer.normalizers'] = $app->share(function () { - return array(new CustomNormalizer(), new GetSetMethodNormalizer()); - }); - } - - /** - * {@inheritdoc} - * - * This provider does not execute any code when booting. - * - * @param Application $app - */ - public function boot(Application $app) - { - } -} diff --git a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Provider/ServiceControllerServiceProvider.php b/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Provider/ServiceControllerServiceProvider.php deleted file mode 100644 index a35a034..0000000 --- a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Provider/ServiceControllerServiceProvider.php +++ /dev/null @@ -1,31 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\Provider; - -use Silex\Application; -use Silex\ServiceProviderInterface; -use Silex\ServiceControllerResolver; - -class ServiceControllerServiceProvider implements ServiceProviderInterface -{ - public function register(Application $app) - { - $app['resolver'] = $app->share($app->extend('resolver', function ($resolver, $app) { - return new ServiceControllerResolver($resolver, $app['callback_resolver']); - })); - } - - public function boot(Application $app) - { - // noop - } -} diff --git a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Provider/SessionServiceProvider.php b/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Provider/SessionServiceProvider.php deleted file mode 100644 index dcd94c0..0000000 --- a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Provider/SessionServiceProvider.php +++ /dev/null @@ -1,124 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\Provider; - -use Silex\Application; -use Silex\ServiceProviderInterface; -use Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeFileSessionHandler; -use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage; -use Symfony\Component\HttpFoundation\Session\Storage\MockFileSessionStorage; -use Symfony\Component\HttpFoundation\Session\Session; -use Symfony\Component\HttpFoundation\Cookie; -use Symfony\Component\HttpKernel\HttpKernelInterface; -use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\HttpKernel\Event\FilterResponseEvent; -use Symfony\Component\HttpKernel\Event\GetResponseEvent; - -/** - * Symfony HttpFoundation component Provider for sessions. - * - * @author Fabien Potencier - */ -class SessionServiceProvider implements ServiceProviderInterface -{ - private $app; - - public function register(Application $app) - { - $this->app = $app; - - $app['session.test'] = false; - - $app['session'] = $app->share(function ($app) { - if (!isset($app['session.storage'])) { - if ($app['session.test']) { - $app['session.storage'] = $app['session.storage.test']; - } else { - $app['session.storage'] = $app['session.storage.native']; - } - } - - return new Session($app['session.storage']); - }); - - $app['session.storage.handler'] = $app->share(function ($app) { - return new NativeFileSessionHandler($app['session.storage.save_path']); - }); - - $app['session.storage.native'] = $app->share(function ($app) { - return new NativeSessionStorage( - $app['session.storage.options'], - $app['session.storage.handler'] - ); - }); - - $app['session.storage.test'] = $app->share(function () { - return new MockFileSessionStorage(); - }); - - $app['session.storage.options'] = array(); - $app['session.default_locale'] = 'en'; - $app['session.storage.save_path'] = null; - } - - public function onEarlyKernelRequest(GetResponseEvent $event) - { - $event->getRequest()->setSession($this->app['session']); - } - - public function onKernelRequest(GetResponseEvent $event) - { - if (HttpKernelInterface::MASTER_REQUEST !== $event->getRequestType()) { - return; - } - - // bootstrap the session - if (!isset($this->app['session'])) { - return; - } - - $session = $this->app['session']; - $cookies = $event->getRequest()->cookies; - - if ($cookies->has($session->getName())) { - $session->setId($cookies->get($session->getName())); - } else { - $session->migrate(false); - } - } - - public function onKernelResponse(FilterResponseEvent $event) - { - if (HttpKernelInterface::MASTER_REQUEST !== $event->getRequestType()) { - return; - } - - $session = $event->getRequest()->getSession(); - if ($session && $session->isStarted()) { - $session->save(); - - $params = session_get_cookie_params(); - - $event->getResponse()->headers->setCookie(new Cookie($session->getName(), $session->getId(), 0 === $params['lifetime'] ? 0 : time() + $params['lifetime'], $params['path'], $params['domain'], $params['secure'], $params['httponly'])); - } - } - - public function boot(Application $app) - { - $app['dispatcher']->addListener(KernelEvents::REQUEST, array($this, 'onEarlyKernelRequest'), 128); - - if ($app['session.test']) { - $app['dispatcher']->addListener(KernelEvents::REQUEST, array($this, 'onKernelRequest'), 192); - $app['dispatcher']->addListener(KernelEvents::RESPONSE, array($this, 'onKernelResponse'), -128); - } - } -} diff --git a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Provider/SwiftmailerServiceProvider.php b/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Provider/SwiftmailerServiceProvider.php deleted file mode 100644 index 42646c1..0000000 --- a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Provider/SwiftmailerServiceProvider.php +++ /dev/null @@ -1,99 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\Provider; - -use Silex\Application; -use Silex\ServiceProviderInterface; - -/** - * Swiftmailer Provider. - * - * @author Fabien Potencier - */ -class SwiftmailerServiceProvider implements ServiceProviderInterface -{ - public function register(Application $app) - { - $app['swiftmailer.options'] = array(); - $app['swiftmailer.use_spool'] = true; - - $app['mailer.initialized'] = false; - - $app['mailer'] = $app->share(function ($app) { - $app['mailer.initialized'] = true; - $transport = $app['swiftmailer.use_spool'] ? $app['swiftmailer.spooltransport'] : $app['swiftmailer.transport']; - - return new \Swift_Mailer($transport); - }); - - $app['swiftmailer.spooltransport'] = $app->share(function ($app) { - return new \Swift_Transport_SpoolTransport($app['swiftmailer.transport.eventdispatcher'], $app['swiftmailer.spool']); - }); - - $app['swiftmailer.spool'] = $app->share(function ($app) { - return new \Swift_MemorySpool(); - }); - - $app['swiftmailer.transport'] = $app->share(function ($app) { - $transport = new \Swift_Transport_EsmtpTransport( - $app['swiftmailer.transport.buffer'], - array($app['swiftmailer.transport.authhandler']), - $app['swiftmailer.transport.eventdispatcher'] - ); - - $options = $app['swiftmailer.options'] = array_replace(array( - 'host' => 'localhost', - 'port' => 25, - 'username' => '', - 'password' => '', - 'encryption' => null, - 'auth_mode' => null, - ), $app['swiftmailer.options']); - - $transport->setHost($options['host']); - $transport->setPort($options['port']); - $transport->setEncryption($options['encryption']); - $transport->setUsername($options['username']); - $transport->setPassword($options['password']); - $transport->setAuthMode($options['auth_mode']); - - return $transport; - }); - - $app['swiftmailer.transport.buffer'] = $app->share(function () { - return new \Swift_Transport_StreamBuffer(new \Swift_StreamFilters_StringReplacementFilterFactory()); - }); - - $app['swiftmailer.transport.authhandler'] = $app->share(function () { - return new \Swift_Transport_Esmtp_AuthHandler(array( - new \Swift_Transport_Esmtp_Auth_CramMd5Authenticator(), - new \Swift_Transport_Esmtp_Auth_LoginAuthenticator(), - new \Swift_Transport_Esmtp_Auth_PlainAuthenticator(), - )); - }); - - $app['swiftmailer.transport.eventdispatcher'] = $app->share(function () { - return new \Swift_Events_SimpleEventDispatcher(); - }); - } - - public function boot(Application $app) - { - $app->finish(function () use ($app) { - // To speed things up (by avoiding Swift Mailer initialization), flush - // messages only if our mailer has been created (potentially used) - if ($app['mailer.initialized']) { - $app['swiftmailer.spooltransport']->getSpool()->flushQueue($app['swiftmailer.transport']); - } - }); - } -} diff --git a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Provider/TranslationServiceProvider.php b/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Provider/TranslationServiceProvider.php deleted file mode 100644 index fcb89c6..0000000 --- a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Provider/TranslationServiceProvider.php +++ /dev/null @@ -1,64 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\Provider; - -use Silex\Application; -use Silex\ServiceProviderInterface; -use Silex\Translator; -use Symfony\Component\Translation\MessageSelector; -use Symfony\Component\Translation\Loader\ArrayLoader; -use Symfony\Component\Translation\Loader\XliffFileLoader; - -/** - * Symfony Translation component Provider. - * - * @author Fabien Potencier - */ -class TranslationServiceProvider implements ServiceProviderInterface -{ - public function register(Application $app) - { - $app['translator'] = $app->share(function ($app) { - $translator = new Translator($app, $app['translator.message_selector'], $app['translator.cache_dir'], $app['debug']); - - // Handle deprecated 'locale_fallback' - if (isset($app['locale_fallback'])) { - $app['locale_fallbacks'] = (array) $app['locale_fallback']; - } - - $translator->setFallbackLocales($app['locale_fallbacks']); - - $translator->addLoader('array', new ArrayLoader()); - $translator->addLoader('xliff', new XliffFileLoader()); - - foreach ($app['translator.domains'] as $domain => $data) { - foreach ($data as $locale => $messages) { - $translator->addResource('array', $messages, $locale, $domain); - } - } - - return $translator; - }); - - $app['translator.message_selector'] = $app->share(function () { - return new MessageSelector(); - }); - - $app['translator.domains'] = array(); - $app['locale_fallbacks'] = array('en'); - $app['translator.cache_dir'] = null; - } - - public function boot(Application $app) - { - } -} diff --git a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Provider/TwigServiceProvider.php b/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Provider/TwigServiceProvider.php deleted file mode 100644 index d3eb957..0000000 --- a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Provider/TwigServiceProvider.php +++ /dev/null @@ -1,113 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\Provider; - -use Silex\Application; -use Silex\ServiceProviderInterface; -use Symfony\Bridge\Twig\Extension\RoutingExtension; -use Symfony\Bridge\Twig\Extension\TranslationExtension; -use Symfony\Bridge\Twig\Extension\FormExtension; -use Symfony\Bridge\Twig\Extension\SecurityExtension; -use Symfony\Bridge\Twig\Extension\HttpKernelExtension; -use Symfony\Bridge\Twig\Form\TwigRendererEngine; -use Symfony\Bridge\Twig\Form\TwigRenderer; - -/** - * Twig integration for Silex. - * - * @author Fabien Potencier - */ -class TwigServiceProvider implements ServiceProviderInterface -{ - public function register(Application $app) - { - $app['twig.options'] = array(); - $app['twig.form.templates'] = array('form_div_layout.html.twig'); - $app['twig.path'] = array(); - $app['twig.templates'] = array(); - - $app['twig'] = $app->share(function ($app) { - $app['twig.options'] = array_replace( - array( - 'charset' => $app['charset'], - 'debug' => $app['debug'], - 'strict_variables' => $app['debug'], - ), $app['twig.options'] - ); - - $twig = new \Twig_Environment($app['twig.loader'], $app['twig.options']); - $twig->addGlobal('app', $app); - - if ($app['debug']) { - $twig->addExtension(new \Twig_Extension_Debug()); - } - - if (class_exists('Symfony\Bridge\Twig\Extension\RoutingExtension')) { - if (isset($app['url_generator'])) { - $twig->addExtension(new RoutingExtension($app['url_generator'])); - } - - if (isset($app['translator'])) { - $twig->addExtension(new TranslationExtension($app['translator'])); - } - - if (isset($app['security.authorization_checker'])) { - $twig->addExtension(new SecurityExtension($app['security.authorization_checker'])); - } - - if (isset($app['fragment.handler'])) { - $app['fragment.renderer.hinclude']->setTemplating($twig); - - $twig->addExtension(new HttpKernelExtension($app['fragment.handler'])); - } - - if (isset($app['form.factory'])) { - $app['twig.form.engine'] = $app->share(function ($app) { - return new TwigRendererEngine($app['twig.form.templates']); - }); - - $app['twig.form.renderer'] = $app->share(function ($app) { - return new TwigRenderer($app['twig.form.engine'], $app['form.csrf_provider']); - }); - - $twig->addExtension(new FormExtension($app['twig.form.renderer'])); - - // add loader for Symfony built-in form templates - $reflected = new \ReflectionClass('Symfony\Bridge\Twig\Extension\FormExtension'); - $path = dirname($reflected->getFileName()).'/../Resources/views/Form'; - $app['twig.loader']->addLoader(new \Twig_Loader_Filesystem($path)); - } - } - - return $twig; - }); - - $app['twig.loader.filesystem'] = $app->share(function ($app) { - return new \Twig_Loader_Filesystem($app['twig.path']); - }); - - $app['twig.loader.array'] = $app->share(function ($app) { - return new \Twig_Loader_Array($app['twig.templates']); - }); - - $app['twig.loader'] = $app->share(function ($app) { - return new \Twig_Loader_Chain(array( - $app['twig.loader.array'], - $app['twig.loader.filesystem'], - )); - }); - } - - public function boot(Application $app) - { - } -} diff --git a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Provider/UrlGeneratorServiceProvider.php b/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Provider/UrlGeneratorServiceProvider.php deleted file mode 100644 index ccbd2e7..0000000 --- a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Provider/UrlGeneratorServiceProvider.php +++ /dev/null @@ -1,37 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\Provider; - -use Silex\Application; -use Silex\ServiceProviderInterface; -use Symfony\Component\Routing\Generator\UrlGenerator; - -/** - * Symfony Routing component Provider for URL generation. - * - * @author Fabien Potencier - */ -class UrlGeneratorServiceProvider implements ServiceProviderInterface -{ - public function register(Application $app) - { - $app['url_generator'] = $app->share(function ($app) { - $app->flush(); - - return new UrlGenerator($app['routes'], $app['request_context']); - }); - } - - public function boot(Application $app) - { - } -} diff --git a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Provider/ValidatorServiceProvider.php b/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Provider/ValidatorServiceProvider.php deleted file mode 100644 index dd6d338..0000000 --- a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Provider/ValidatorServiceProvider.php +++ /dev/null @@ -1,78 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\Provider; - -use Silex\Application; -use Silex\ServiceProviderInterface; -use Silex\ConstraintValidatorFactory; -use Symfony\Component\Validator\Mapping\ClassMetadataFactory; -use Symfony\Component\Validator\Mapping\Factory\LazyLoadingMetadataFactory; -use Symfony\Component\Validator\Mapping\Loader\StaticMethodLoader; -use Symfony\Component\Validator\Validation; - -/** - * Symfony Validator component Provider. - * - * @author Fabien Potencier - */ -class ValidatorServiceProvider implements ServiceProviderInterface -{ - public function register(Application $app) - { - $app['validator'] = $app->share(function ($app) { - if (isset($app['translator'])) { - $r = new \ReflectionClass('Symfony\Component\Validator\Validation'); - $file = dirname($r->getFilename()).'/Resources/translations/validators.'.$app['locale'].'.xlf'; - if (file_exists($file)) { - $app['translator']->addResource('xliff', $file, $app['locale'], 'validators'); - } - } - - return $app['validator.builder']->getValidator(); - }); - - $app['validator.builder'] = $app->share(function ($app) { - $builder = Validation::createValidatorBuilder(); - $builder->setConstraintValidatorFactory($app['validator.validator_factory']); - $builder->setTranslationDomain('validators'); - $builder->addObjectInitializers($app['validator.object_initializers']); - $builder->setMetadataFactory($app['validator.mapping.class_metadata_factory']); - if (isset($app['translator'])) { - $builder->setTranslator($app['translator']); - } - - return $builder; - }); - - $app['validator.mapping.class_metadata_factory'] = $app->share(function ($app) { - if (class_exists('Symfony\Component\Validator\Mapping\Factory\LazyLoadingMetadataFactory')) { - return new LazyLoadingMetadataFactory(new StaticMethodLoader()); - } - - return new ClassMetadataFactory(new StaticMethodLoader()); - }); - - $app['validator.validator_factory'] = $app->share(function () use ($app) { - $validators = isset($app['validator.validator_service_ids']) ? $app['validator.validator_service_ids'] : array(); - - return new ConstraintValidatorFactory($app, $validators); - }); - - $app['validator.object_initializers'] = $app->share(function ($app) { - return array(); - }); - } - - public function boot(Application $app) - { - } -} diff --git a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/RedirectableUrlMatcher.php b/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/RedirectableUrlMatcher.php deleted file mode 100644 index aa0cdf1..0000000 --- a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/RedirectableUrlMatcher.php +++ /dev/null @@ -1,55 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex; - -use Symfony\Component\HttpFoundation\RedirectResponse; -use Symfony\Component\Routing\Matcher\RedirectableUrlMatcher as BaseRedirectableUrlMatcher; - -/** - * Implements the RedirectableUrlMatcherInterface for Silex. - * - * @author Fabien Potencier - */ -class RedirectableUrlMatcher extends BaseRedirectableUrlMatcher -{ - /** - * {@inheritdoc} - */ - public function redirect($path, $route, $scheme = null) - { - $url = $this->context->getBaseUrl().$path; - $query = $this->context->getQueryString() ?: ''; - - if ($query !== '') { - $url .= '?'.$query; - } - - if ($this->context->getHost()) { - if ($scheme) { - $port = ''; - if ('http' === $scheme && 80 != $this->context->getHttpPort()) { - $port = ':'.$this->context->getHttpPort(); - } elseif ('https' === $scheme && 443 != $this->context->getHttpsPort()) { - $port = ':'.$this->context->getHttpsPort(); - } - - $url = $scheme.'://'.$this->context->getHost().$port.$url; - } - } - - return array( - '_controller' => function ($url) { return new RedirectResponse($url, 301); }, - '_route' => null, - 'url' => $url, - ); - } -} diff --git a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Route.php b/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Route.php deleted file mode 100644 index 1ade9b7..0000000 --- a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Route.php +++ /dev/null @@ -1,188 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex; - -use Symfony\Component\Routing\Route as BaseRoute; - -/** - * A wrapper for a controller, mapped to a route. - * - * @author Fabien Potencier - */ -class Route extends BaseRoute -{ - /** - * Constructor. - * - * Available options: - * - * * compiler_class: A class name able to compile this route instance (RouteCompiler by default) - * - * @param string $path The path pattern to match - * @param array $defaults An array of default parameter values - * @param array $requirements An array of requirements for parameters (regexes) - * @param array $options An array of options - * @param string $host The host pattern to match - * @param string|array $schemes A required URI scheme or an array of restricted schemes - * @param string|array $methods A required HTTP method or an array of restricted methods - */ - public function __construct($path = '/', array $defaults = array(), array $requirements = array(), array $options = array(), $host = '', $schemes = array(), $methods = array()) - { - // overridden constructor to make $path optional - parent::__construct($path, $defaults, $requirements, $options, $host, $schemes, $methods); - } - - /** - * Sets the route code that should be executed when matched. - * - * @param callable $to PHP callback that returns the response when matched - * - * @return Route $this The current Route instance - */ - public function run($to) - { - $this->setDefault('_controller', $to); - - return $this; - } - - /** - * Sets the requirement for a route variable. - * - * @param string $variable The variable name - * @param string $regexp The regexp to apply - * - * @return Route $this The current route instance - */ - public function assert($variable, $regexp) - { - $this->setRequirement($variable, $regexp); - - return $this; - } - - /** - * Sets the default value for a route variable. - * - * @param string $variable The variable name - * @param mixed $default The default value - * - * @return Route $this The current Route instance - */ - public function value($variable, $default) - { - $this->setDefault($variable, $default); - - return $this; - } - - /** - * Sets a converter for a route variable. - * - * @param string $variable The variable name - * @param mixed $callback A PHP callback that converts the original value - * - * @return Route $this The current Route instance - */ - public function convert($variable, $callback) - { - $converters = $this->getOption('_converters'); - $converters[$variable] = $callback; - $this->setOption('_converters', $converters); - - return $this; - } - - /** - * Sets the requirement for the HTTP method. - * - * @param string $method The HTTP method name. Multiple methods can be supplied, delimited by a pipe character '|', eg. 'GET|POST' - * - * @return Route $this The current Route instance - */ - public function method($method) - { - $this->setMethods(explode('|', $method)); - - return $this; - } - - /** - * Sets the requirement of host on this Route. - * - * @param string $host The host for which this route should be enabled - * - * @return Route $this The current Route instance - */ - public function host($host) - { - $this->setHost($host); - - return $this; - } - - /** - * Sets the requirement of HTTP (no HTTPS) on this Route. - * - * @return Route $this The current Route instance - */ - public function requireHttp() - { - $this->setSchemes('http'); - - return $this; - } - - /** - * Sets the requirement of HTTPS on this Route. - * - * @return Route $this The current Route instance - */ - public function requireHttps() - { - $this->setSchemes('https'); - - return $this; - } - - /** - * Sets a callback to handle before triggering the route callback. - * - * @param mixed $callback A PHP callback to be triggered when the Route is matched, just before the route callback - * - * @return Route $this The current Route instance - */ - public function before($callback) - { - $callbacks = $this->getOption('_before_middlewares'); - $callbacks[] = $callback; - $this->setOption('_before_middlewares', $callbacks); - - return $this; - } - - /** - * Sets a callback to handle after the route callback. - * - * @param mixed $callback A PHP callback to be triggered after the route callback - * - * @return Route $this The current Route instance - */ - public function after($callback) - { - $callbacks = $this->getOption('_after_middlewares'); - $callbacks[] = $callback; - $this->setOption('_after_middlewares', $callbacks); - - return $this; - } -} diff --git a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Route/SecurityTrait.php b/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Route/SecurityTrait.php deleted file mode 100644 index d42ba2f..0000000 --- a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Route/SecurityTrait.php +++ /dev/null @@ -1,31 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\Route; - -use Symfony\Component\Security\Core\Exception\AccessDeniedException; - -/** - * Security trait. - * - * @author Fabien Potencier - */ -trait SecurityTrait -{ - public function secure($roles) - { - $this->before(function ($request, $app) use ($roles) { - if (!$app['security.authorization_checker']->isGranted($roles)) { - throw new AccessDeniedException(); - } - }); - } -} diff --git a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/ServiceControllerResolver.php b/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/ServiceControllerResolver.php deleted file mode 100644 index 87f91b0..0000000 --- a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/ServiceControllerResolver.php +++ /dev/null @@ -1,60 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpKernel\Controller\ControllerResolverInterface; - -/** - * Enables name_of_service:method_name syntax for declaring controllers. - * - * @link http://silex.sensiolabs.org/doc/providers/service_controller.html - */ -class ServiceControllerResolver implements ControllerResolverInterface -{ - protected $controllerResolver; - protected $callbackResolver; - - /** - * Constructor. - * - * @param ControllerResolverInterface $controllerResolver A ControllerResolverInterface instance to delegate to - * @param CallbackResolver $callbackResolver A service resolver instance - */ - public function __construct(ControllerResolverInterface $controllerResolver, CallbackResolver $callbackResolver) - { - $this->controllerResolver = $controllerResolver; - $this->callbackResolver = $callbackResolver; - } - - /** - * {@inheritdoc} - */ - public function getController(Request $request) - { - $controller = $request->attributes->get('_controller', null); - - if (!$this->callbackResolver->isValid($controller)) { - return $this->controllerResolver->getController($request); - } - - return $this->callbackResolver->convertCallback($controller); - } - - /** - * {@inheritdoc} - */ - public function getArguments(Request $request, $controller) - { - return $this->controllerResolver->getArguments($request, $controller); - } -} diff --git a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/ServiceProviderInterface.php b/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/ServiceProviderInterface.php deleted file mode 100644 index cd04079..0000000 --- a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/ServiceProviderInterface.php +++ /dev/null @@ -1,37 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex; - -/** - * Interface that all Silex service providers must implement. - * - * @author Fabien Potencier - */ -interface ServiceProviderInterface -{ - /** - * Registers services on the given app. - * - * This method should only be used to configure services and parameters. - * It should not get services. - */ - public function register(Application $app); - - /** - * Bootstraps the application. - * - * This method is called after all services are registered - * and should be used for "dynamic" configuration (whenever - * a service must be requested). - */ - public function boot(Application $app); -} diff --git a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Translator.php b/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Translator.php deleted file mode 100644 index 20f1047..0000000 --- a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Translator.php +++ /dev/null @@ -1,48 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex; - -use Symfony\Component\Translation\Translator as BaseTranslator; -use Symfony\Component\Translation\MessageSelector; - -/** - * Translator that gets the current locale from the Silex application. - * - * @author Fabien Potencier - */ -class Translator extends BaseTranslator -{ - protected $app; - - public function __construct(Application $app, MessageSelector $selector, $cacheDir = null, $debug = false) - { - $this->app = $app; - - parent::__construct(null, $selector, $cacheDir, $debug); - } - - public function getLocale() - { - return $this->app['locale']; - } - - public function setLocale($locale) - { - if (null === $locale) { - return; - } - - $this->app['locale'] = $locale; - - parent::setLocale($locale); - } -} diff --git a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Util/Compiler.php b/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Util/Compiler.php deleted file mode 100644 index 2d2930d..0000000 --- a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/Util/Compiler.php +++ /dev/null @@ -1,188 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\Util; - -use Symfony\Component\Finder\Finder; -use Symfony\Component\Process\Process; - -/** - * The Compiler class compiles the Silex framework. - * - * This is deprecated. Use composer instead. - * - * @author Fabien Potencier - */ -class Compiler -{ - protected $version; - - /** - * Compiles the Silex source code into one single Phar file. - * - * @param string $pharFile Name of the output Phar file - */ - public function compile($pharFile = 'silex.phar') - { - if (file_exists($pharFile)) { - unlink($pharFile); - } - - $process = new Process('git log --pretty="%h %ci" -n1 HEAD'); - if ($process->run() > 0) { - throw new \RuntimeException('The git binary cannot be found.'); - } - $this->version = trim($process->getOutput()); - - $phar = new \Phar($pharFile, 0, 'silex.phar'); - $phar->setSignatureAlgorithm(\Phar::SHA1); - - $phar->startBuffering(); - - $root = __DIR__.'/../../..'; - - $finder = new Finder(); - $finder->files() - ->ignoreVCS(true) - ->name('*.php') - ->notName('Compiler.php') - ->exclude('Tests') - ->in($root.'/src') - ->in($root.'/vendor/pimple/pimple/lib') - ->in($root.'/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher') - ->in($root.'/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation') - ->in($root.'/vendor/symfony/http-kernel/Symfony/Component/HttpKernel') - ->in($root.'/vendor/symfony/routing/Symfony/Component/Routing') - ->in($root.'/vendor/symfony/browser-kit/Symfony/Component/BrowserKit') - ->in($root.'/vendor/symfony/css-selector/Symfony/Component/CssSelector') - ->in($root.'/vendor/symfony/dom-crawler/Symfony/Component/DomCrawler') - ; - - foreach ($finder as $file) { - $this->addFile($phar, $file); - } - - $this->addFile($phar, new \SplFileInfo($root.'/LICENSE'), false); - $this->addFile($phar, new \SplFileInfo($root.'/vendor/autoload.php')); - $this->addFile($phar, new \SplFileInfo($root.'/vendor/composer/ClassLoader.php')); - $this->addFile($phar, new \SplFileInfo($root.'/vendor/composer/autoload_namespaces.php')); - $this->addFile($phar, new \SplFileInfo($root.'/vendor/composer/autoload_classmap.php')); - - // Stubs - $phar->setStub($this->getStub()); - - $phar->stopBuffering(); - - unset($phar); - } - - protected function addFile(\Phar $phar, \SplFileInfo $file, $strip = true) - { - $path = str_replace(dirname(dirname(dirname(__DIR__))).DIRECTORY_SEPARATOR, '', $file->getRealPath()); - - $content = file_get_contents($file); - if ($strip) { - $content = self::stripWhitespace($content); - } - - $content = preg_replace("/const VERSION = '.*?';/", "const VERSION = '".$this->version."';", $content); - - $phar->addFromString($path, $content); - } - - protected function getStub() - { - return <<<'EOF' - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -Phar::mapPhar('silex.phar'); - -require_once 'phar://silex.phar/vendor/autoload.php'; - -if ('cli' === php_sapi_name() && basename(__FILE__) === basename($_SERVER['argv'][0]) && isset($_SERVER['argv'][1])) { - switch ($_SERVER['argv'][1]) { - case 'update': - $remoteFilename = 'http://silex.sensiolabs.org/get/silex.phar'; - $localFilename = __DIR__.'/silex.phar'; - - file_put_contents($localFilename, file_get_contents($remoteFilename)); - break; - - case 'check': - $latest = trim(file_get_contents('http://silex.sensiolabs.org/get/version')); - - if ($latest != Silex\Application::VERSION) { - printf("A newer Silex version is available (%s).\n", $latest); - } else { - print("You are using the latest Silex version.\n"); - } - break; - - case 'version': - printf("Silex version %s\n", Silex\Application::VERSION); - break; - - default: - printf("Unknown command '%s' (available commands: version, check, and update).\n", $_SERVER['argv'][1]); - } - - exit(0); -} - -__HALT_COMPILER(); -EOF; - } - - /** - * Removes whitespace from a PHP source string while preserving line numbers. - * - * Based on Kernel::stripComments(), but keeps line numbers intact. - * - * @param string $source A PHP string - * - * @return string The PHP string with the whitespace removed - */ - public static function stripWhitespace($source) - { - if (!function_exists('token_get_all')) { - return $source; - } - - $output = ''; - foreach (token_get_all($source) as $token) { - if (is_string($token)) { - $output .= $token; - } elseif (in_array($token[0], array(T_COMMENT, T_DOC_COMMENT))) { - $output .= str_repeat("\n", substr_count($token[1], "\n")); - } elseif (T_WHITESPACE === $token[0]) { - // reduce wide spaces - $whitespace = preg_replace('{[ \t]+}', ' ', $token[1]); - // normalize newlines to \n - $whitespace = preg_replace('{(?:\r\n|\r|\n)}', "\n", $whitespace); - // trim leading spaces - $whitespace = preg_replace('{\n +}', "\n", $whitespace); - $output .= $whitespace; - } else { - $output .= $token[1]; - } - } - - return $output; - } -} diff --git a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/ViewListenerWrapper.php b/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/ViewListenerWrapper.php deleted file mode 100644 index 2cadd9a..0000000 --- a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/ViewListenerWrapper.php +++ /dev/null @@ -1,88 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex; - -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent; - -/** - * Wraps view listeners. - * - * @author Dave Marshall - */ -class ViewListenerWrapper -{ - private $app; - private $callback; - - /** - * Constructor. - * - * @param Application $app An Application instance - * @param mixed $callback - */ - public function __construct(Application $app, $callback) - { - $this->app = $app; - $this->callback = $callback; - } - - public function __invoke(GetResponseForControllerResultEvent $event) - { - $controllerResult = $event->getControllerResult(); - $callback = $this->app['callback_resolver']->resolveCallback($this->callback); - - if (!$this->shouldRun($callback, $controllerResult)) { - return; - } - - $response = call_user_func($callback, $controllerResult, $event->getRequest()); - - if ($response instanceof Response) { - $event->setResponse($response); - } elseif (null !== $response) { - $event->setControllerResult($response); - } - } - - private function shouldRun($callback, $controllerResult) - { - if (is_array($callback)) { - $callbackReflection = new \ReflectionMethod($callback[0], $callback[1]); - } elseif (is_object($callback) && !$callback instanceof \Closure) { - $callbackReflection = new \ReflectionObject($callback); - $callbackReflection = $callbackReflection->getMethod('__invoke'); - } else { - $callbackReflection = new \ReflectionFunction($callback); - } - - if ($callbackReflection->getNumberOfParameters() > 0) { - $parameters = $callbackReflection->getParameters(); - $expectedControllerResult = $parameters[0]; - - if ($expectedControllerResult->getClass() && (!is_object($controllerResult) || !$expectedControllerResult->getClass()->isInstance($controllerResult))) { - return false; - } - - if ($expectedControllerResult->isArray() && !is_array($controllerResult)) { - return false; - } - - if (method_exists($expectedControllerResult, 'isCallable') && $expectedControllerResult->isCallable() && !is_callable($controllerResult)) { - return false; - } - } - - return true; - } - -} diff --git a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/WebTestCase.php b/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/WebTestCase.php deleted file mode 100644 index 4adeaf3..0000000 --- a/sitecake/2.2.9/server/vendor/silex/silex/src/Silex/WebTestCase.php +++ /dev/null @@ -1,60 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex; - -use Symfony\Component\HttpKernel\Client; -use Symfony\Component\HttpKernel\HttpKernel; - -/** - * WebTestCase is the base class for functional tests. - * - * @author Igor Wiedler - */ -abstract class WebTestCase extends \PHPUnit_Framework_TestCase -{ - /** - * Application instance. - * - * @var Application - */ - protected $app; - - /** - * PHPUnit setUp for setting up the application. - * - * Note: Child classes that define a setUp method must call - * parent::setUp(). - */ - public function setUp() - { - $this->app = $this->createApplication(); - } - - /** - * Creates the application. - * - * @return HttpKernel - */ - abstract public function createApplication(); - - /** - * Creates a Client. - * - * @param array $server An array of server parameters - * - * @return Client A Client instance - */ - public function createClient(array $server = array()) - { - return new Client($this->app, $server); - } -} diff --git a/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Canvas.php b/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Canvas.php deleted file mode 100644 index 4420778..0000000 --- a/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Canvas.php +++ /dev/null @@ -1,161 +0,0 @@ -handle = $img->getHandle(); - $this->image = $img; - } - - /** - * Sets the active font. Can be an instance of - * \WideImage\Font\TTF, \WideImage\Font\PS, or \WideImage\Font\GDF. - * - * @param object $font Font object to set for writeText() - */ - public function setFont($font) - { - $this->font = $font; - } - - /** - * Creates and sets the current font - * - * The supported font types are: TTF/OTF, PS, and GDF. - * Font type is detected from the extension. If the $file parameter doesn't have an extension, TTF font is presumed. - * - * Note: not all parameters are supported by all fonts. - * - * @param string $file Font file name (string) - * @param int $size Font size (supported for TTF/OTF and PS fonts, ignored for GDF) - * @param int $color Text color - * @param int $bgcolor Background color (supported only for PS font, ignored for TTF and PS) - * @return mixed One of the \WideImage\Font\* objects - */ - public function useFont($file, $size = 12, $color = 0, $bgcolor = null) - { - $p = strrpos($file, '.'); - - if ($p === false || $p < strlen($file) - 4) { - $ext = 'ttf'; - } else { - $ext = strtolower(substr($file, $p + 1)); - } - - if ($ext == 'ttf' || $ext == 'otf') { - $font = new Font\TTF($file, $size, $color); - } elseif ($ext == 'ps') { - $font = new Font\PS($file, $size, $color, $bgcolor); - } elseif ($ext == 'gdf') { - $font = new Font\GDF($file, $color); - } else { - throw new InvalidFontFileException("'$file' appears to be an invalid font file."); - } - - $this->setFont($font); - return $font; - } - - /** - * Write text on the image at specified position - * - * You must set a font with a call to \WideImage\Canvas::setFont() prior to writing text to the image. - * - * Smart coordinates are supported for $x and $y arguments, but currently only for TTF/OTF fonts. - * - * Example: - * - * $img = WideImage::load('pic.jpg'); - * $canvas = $img->getCanvas(); - * $canvas->useFont('Verdana.ttf', 16, $img->allocateColor(255, 0, 0)); - * $canvas->writeText('right', 'bottom', 'www.website.com'); - * - * - * @param int $x Left - * @param int $y Top - * @param string $text Text to write - * @param int $angle The angle, defaults to 0 - */ - public function writeText($x, $y, $text, $angle = 0) - { - if ($this->font === null) { - throw new NoFontException("Can't write text without a font."); - } - - $angle = - floatval($angle); - - if ($angle < 0) { - $angle = 360 + $angle; - } - - $angle = $angle % 360; - - $this->font->writeText($this->image, $x, $y, $text, $angle); - } - - /** - * A magic method that allows you to call any PHP function that starts with "image". - * - * This is a shortcut to call custom functions on the image handle. - * - * Example: - * - * $img = WideImage::load('pic.jpg'); - * $canvas = $img->getCanvas(); - * $canvas->filledRect(10, 10, 20, 30, $img->allocateColor(0, 0, 0)); - * $canvas->line(60, 80, 30, 100, $img->allocateColor(255, 0, 0)); - * - */ - function __call($method, $params) - { - if (function_exists('image' . $method)) { - array_unshift($params, $this->handle); - call_user_func_array('image' . $method, $params); - } else { - throw new InvalidCanvasMethodException("Function doesn't exist: image{$method}."); - } - } -} diff --git a/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Coordinate.php b/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Coordinate.php deleted file mode 100644 index 8390c51..0000000 --- a/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Coordinate.php +++ /dev/null @@ -1,198 +0,0 @@ - 'operand', 'value' => trim($current_operand)); - } - - $current_operand = ''; - $flush_operand = false; - } - - if ($flush_operator) { - $tokens[] = array('type' => 'operator', 'value' => $char); - $flush_operator = false; - } - } - - return $tokens; - } - - /** - * Evaluates the $coord relatively to $dim - * - * @param string $coord A numeric value or percent string - * @param int $dim Dimension - * @param int $sec_dim Secondary dimension (for align) - * @return int Calculated value - */ - public static function evaluate($coord, $dim, $sec_dim = null) - { - $comp_regex = implode('|', self::$coord_align) . '|' . implode('|', self::$coord_numeric); - - if (preg_match("/^([+-])?({$comp_regex})$/", $coord, $matches)) { - $sign = intval($matches[1] . "1"); - $val = $matches[2]; - - if (in_array($val, self::$coord_align)) { - if ($sec_dim === null) { - switch ($val) { - case 'left': - case 'top': - return 0; - break; - case 'center': - case 'middle': - return $sign * intval($dim / 2); - break; - case 'right': - case 'bottom': - return $sign * $dim; - break; - default: - return null; - } - } else { - switch ($val) { - case 'left': - case 'top': - return 0; - break; - case 'center': - case 'middle': - return $sign * intval($dim / 2 - $sec_dim / 2); - break; - case 'right': - case 'bottom': - return $sign * ($dim - $sec_dim); - break; - default: - return null; - } - } - } elseif (substr($val, -1) === '%') { - return intval(round($sign * $dim * floatval(str_replace('%', '', $val)) / 100)); - } else { - return $sign * intval(round($val)); - } - } - } - - /** - * Calculates and fixes a smart coordinate into a numeric value - * - * @param mixed $value Smart coordinate, relative to $dim - * @param int $dim Coordinate to which $value is relative - * @param int $sec_dim Secondary dimension (for align) - * @return int Calculated value - */ - public static function fix($value, $dim, $sec_dim = null) - { - $coord_tokens = self::parse($value); - - if (count($coord_tokens) == 0 || $coord_tokens[count($coord_tokens) - 1]['type'] != 'operand') { - throw new InvalidCoordinateException("Couldn't parse coordinate '$value' properly."); - } - - $value = 0; - $operation = 1; - - foreach ($coord_tokens as $token) { - if ($token['type'] == 'operand') { - $operand_value = self::evaluate($token['value'], $dim, $sec_dim); - - if ($operation == 1) { - $value = $value + $operand_value; - } elseif ($operation == -1) { - $value = $value - $operand_value; - } else { - throw new InvalidCoordinateException("Invalid coordinate syntax."); - } - - $operation = 0; - } elseif ($token['type'] == 'operator') { - if ($token['value'] == '-') { - if ($operation == 0) { - $operation = -1; - } else { - $operation = $operation * -1; - } - } elseif ($token['value'] == '+') { - if ($operation == 0) { - $operation = '1'; - } - } - } - } - - return $value; - } -} diff --git a/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Exception/Exception.php b/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Exception/Exception.php deleted file mode 100644 index 16f4361..0000000 --- a/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Exception/Exception.php +++ /dev/null @@ -1,32 +0,0 @@ -= 1 && $face <= 5) { - $this->font = $face; - } else { - $this->font = imageloadfont($face); - } - - $this->color = $color; - } - - public function writeText($image, $x, $y, $text) - { - imagestring($image->getHandle(), $this->font, $x, $y, $text, $this->color); - } -} diff --git a/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Font/PS.php b/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Font/PS.php deleted file mode 100644 index 164bd26..0000000 --- a/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Font/PS.php +++ /dev/null @@ -1,64 +0,0 @@ -handle = imagepsloadfont($file); - $this->size = $size; - $this->color = $color; - - if ($bgcolor === null) { - $this->bgcolor = $color; - } else { - $this->color = $color; - } - } - - public function writeText($image, $x, $y, $text, $angle = 0) - { - if ($image->isTrueColor()) { - $image->alphaBlending(true); - } - - imagepstext($image->getHandle(), $text, $this->handle, $this->size, $this->color, $this->bgcolor, $x, $y, 0, 0, $angle, 4); - } - - public function __destruct() - { - imagepsfreefont($this->handle); - $this->handle = null; - } -} diff --git a/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Font/TTF.php b/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Font/TTF.php deleted file mode 100644 index 34c97bb..0000000 --- a/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Font/TTF.php +++ /dev/null @@ -1,79 +0,0 @@ -face = $face; - $this->size = $size; - $this->color = $color; - } - - /** - * Writes text onto an image - * - * @param \WideImage\Image $image - * @param mixed $x smart coordinate - * @param mixed $y smart coordinate - * @param string $text - * @param int $angle Angle in degrees clockwise - */ - public function writeText($image, $x, $y, $text, $angle = 0) - { - if ($image->isTrueColor()) { - $image->alphaBlending(true); - } - - $box = imageftbbox($this->size, $angle, $this->face, $text); - $obox = array( - 'left' => min($box[0], $box[2], $box[4], $box[6]), - 'top' => min($box[1], $box[3], $box[5], $box[7]), - 'right' => max($box[0], $box[2], $box[4], $box[6]) - 1, - 'bottom' => max($box[1], $box[3], $box[5], $box[7]) - 1 - ); - $obox['width'] = abs($obox['left']) + abs($obox['right']); - $obox['height'] = abs($obox['top']) + abs($obox['bottom']); - - $x = Coordinate::fix($x, $image->getWidth(), $obox['width']); - $y = Coordinate::fix($y, $image->getHeight(), $obox['height']); - - $fixed_x = $x - $obox['left']; - $fixed_y = $y - $obox['top']; - - imagettftext($image->getHandle(), $this->size, $angle, $fixed_x, $fixed_y, $this->color, $this->face, $text); - } -} diff --git a/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Image.php b/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Image.php deleted file mode 100644 index 49999c6..0000000 --- a/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Image.php +++ /dev/null @@ -1,979 +0,0 @@ -handle = $handle; - } - - /** - * Cleanup - * - * Destroys the handle via \WideImage\Image::destroy() when called by the GC. - */ - public function __destruct() - { - $this->destroy(); - } - - /** - * This method destroy the image handle, and releases the image resource. - * - * After this is called, the object doesn't hold a valid image any more. - * No operation should be called after that. - */ - public function destroy() - { - if ($this->isValid() && !$this->handleReleased) { - imagedestroy($this->handle); - } - - $this->handle = null; - } - - /** - * Returns the GD image resource - * - * @return resource GD image resource - */ - public function getHandle() - { - return $this->handle; - } - - /** - * @return bool True, if the image object holds a valid GD image, false otherwise - */ - public function isValid() - { - return WideImage::isValidImageHandle($this->handle); - } - - /** - * Releases the handle - */ - public function releaseHandle() - { - $this->handleReleased = true; - } - - /** - * Saves an image to a file - * - * The file type is recognized from the $uri. If you save to a GIF8, truecolor images - * are automatically converted to palette. - * - * This method supports additional parameters: quality (for jpeg images) and - * compression quality and filters (for png images). See http://www.php.net/imagejpeg and - * http://www.php.net/imagepng for details. - * - * Examples: - * - * // save to a GIF - * $image->saveToFile('image.gif'); - * - * // save to a PNG with compression=7 and no filters - * $image->saveToFile('image.png', 7, PNG_NO_FILTER); - * - * // save to a JPEG with quality=80 - * $image->saveToFile('image.jpg', 80); - * - * // save to a JPEG with default quality=100 - * $image->saveToFile('image.jpg'); - * - * - * @param string $uri File location - */ - public function saveToFile($uri) - { - $mapper = MapperFactory::selectMapper($uri, null); - $args = func_get_args(); - array_unshift($args, $this->getHandle()); - $res = call_user_func_array(array($mapper, 'save'), $args); - - if (!$res) { - throw new UnknownErrorWhileMappingException(get_class($mapper) . " returned an invalid result while saving to $uri"); - } - } - - /** - * Returns binary string with image data in format specified by $format - * - * Additional parameters may be passed to the function. See \WideImage\Image::saveToFile() for more details. - * - * @param string $format The format of the image - * @return string The binary image data in specified format - */ - public function asString($format) - { - ob_start(); - $args = func_get_args(); - $args[0] = null; - array_unshift($args, $this->getHandle()); - - $mapper = MapperFactory::selectMapper(null, $format); - $res = call_user_func_array(array($mapper, 'save'), $args); - - if (!$res) { - throw new UnknownErrorWhileMappingException(get_class($mapper) . " returned an invalid result while writing the image data"); - } - - return ob_get_clean(); - } - - /** - * Output a header to browser. - * - * @param $name Name of the header - * @param $data Data - */ - protected function writeHeader($name, $data) - { - header($name . ": " . $data); - } - - /** - * Outputs the image to browser - * - * Sets headers Content-length and Content-type, and echoes the image in the specified format. - * All other headers (such as Content-disposition) must be added manually. - * - * Example: - * - * WideImage::load('image1.png')->resize(100, 100)->output('gif'); - * - * - * @param string $format Image format - */ - public function output($format) - { - $args = func_get_args(); - $data = call_user_func_array(array($this, 'asString'), $args); - - $this->writeHeader('Content-length', strlen($data)); - $this->writeHeader('Content-type', MapperFactory::mimeType($format)); - echo $data; - } - - /** - * @return int Image width - */ - public function getWidth() - { - return imagesx($this->handle); - } - - /** - * @return int Image height - */ - public function getHeight() - { - return imagesy($this->handle); - } - - /** - * Allocate a color by RGB values. - * - * @param mixed $R Red-component value or an RGB array (with red, green, blue keys) - * @param int $G If $R is int, this is the green component - * @param int $B If $R is int, this is the blue component - * @return int Image color index - */ - public function allocateColor($R, $G = null, $B = null) - { - if (is_array($R)) { - return imageColorAllocate($this->handle, $R['red'], $R['green'], $R['blue']); - } - - return imageColorAllocate($this->handle, $R, $G, $B); - } - - /** - * @return bool True if the image is transparent, false otherwise - */ - public function isTransparent() - { - return $this->getTransparentColor() >= 0; - } - - /** - * @return int Transparent color index - */ - public function getTransparentColor() - { - return imagecolortransparent($this->handle); - } - - /** - * Sets the current transparent color index. Only makes sense for palette images (8-bit). - * - * @param int $color Transparent color index - */ - public function setTransparentColor($color) - { - return imagecolortransparent($this->handle, $color); - } - - /** - * Returns a RGB array of the transparent color or null if none. - * - * @return mixed Transparent color RGBA array - */ - public function getTransparentColorRGB() - { - $total = imagecolorstotal($this->handle); - $tc = $this->getTransparentColor(); - - if ($tc >= $total && $total > 0) { - return null; - } - - return $this->getColorRGB($tc); - } - - /** - * Returns a RGBA array for pixel at $x, $y - * - * @param int $x - * @param int $y - * @return array RGB array - */ - public function getRGBAt($x, $y) - { - return $this->getColorRGB($this->getColorAt($x, $y)); - } - - /** - * Writes a pixel at the designated coordinates - * - * Takes an associative array of colours and uses getExactColor() to - * retrieve the exact index color to write to the image with. - * - * @param int $x - * @param int $y - * @param array $color - */ - public function setRGBAt($x, $y, $color) - { - $this->setColorAt($x, $y, $this->getExactColor($color)); - } - - /** - * Returns a color's RGB - * - * @param int $colorIndex Color index - * @return mixed RGBA array for a color with index $colorIndex - */ - public function getColorRGB($colorIndex) - { - return imageColorsForIndex($this->handle, $colorIndex); - } - - /** - * Returns an index of the color at $x, $y - * - * @param int $x - * @param int $y - * @return int Color index for a pixel at $x, $y - */ - public function getColorAt($x, $y) - { - return imagecolorat($this->handle, $x, $y); - } - - /** - * Set the color index $color to a pixel at $x, $y - * - * @param int $x - * @param int $y - * @param int $color Color index - */ - public function setColorAt($x, $y, $color) - { - return imagesetpixel($this->handle, $x, $y, $color); - } - - /** - * Returns closest color index that matches the given RGB value. Uses - * PHP's imagecolorclosest() - * - * @param mixed $R Red or RGBA array - * @param int $G Green component (or null if $R is an RGB array) - * @param int $B Blue component (or null if $R is an RGB array) - * @return int Color index - */ - public function getClosestColor($R, $G = null, $B = null) - { - if (is_array($R)) { - return imagecolorclosest($this->handle, $R['red'], $R['green'], $R['blue']); - } - - return imagecolorclosest($this->handle, $R, $G, $B); - } - - /** - * Returns the color index that exactly matches the given RGB value. Uses - * PHP's imagecolorexact() - * - * @param mixed $R Red or RGBA array - * @param int $G Green component (or null if $R is an RGB array) - * @param int $B Blue component (or null if $R is an RGB array) - * @return int Color index - */ - public function getExactColor($R, $G = null, $B = null) - { - if (is_array($R)) { - return imagecolorexact($this->handle, $R['red'], $R['green'], $R['blue']); - } - - return imagecolorexact($this->handle, $R, $G, $B); - } - - /** - * Copies transparency information from $sourceImage. Optionally fills - * the image with the transparent color at (0, 0). - * - * @param object $sourceImage - * @param bool $fill True if you want to fill the image with transparent color - */ - public function copyTransparencyFrom($sourceImage, $fill = true) - { - if ($sourceImage->isTransparent()) { - $rgba = $sourceImage->getTransparentColorRGB(); - - if ($rgba === null) { - return; - } - - if ($this->isTrueColor()) { - $rgba['alpha'] = 127; - $color = $this->allocateColorAlpha($rgba); - } else { - $color = $this->allocateColor($rgba); - } - - $this->setTransparentColor($color); - - if ($fill) { - $this->fill(0, 0, $color); - } - } - } - - /** - * Fill the image at ($x, $y) with color index $color - * - * @param int $x - * @param int $y - * @param int $color - */ - public function fill($x, $y, $color) - { - return imagefill($this->handle, $x, $y, $color); - } - - /** - * Used internally to create Operation objects - * - * @param string $name - * @return object - */ - protected function getOperation($name) - { - return OperationFactory::get($name); - } - - /** - * Returns the image's mask - * - * Mask is a greyscale image where the shade defines the alpha channel (black = transparent, white = opaque). - * - * For opaque images (JPEG), the result will be white. For images with single-color transparency (GIF, 8-bit PNG), - * the areas with the transparent color will be black. For images with alpha channel transparenct, - * the result will be alpha channel. - * - * @return \WideImage\Image An image mask - **/ - public function getMask() - { - return $this->getOperation('GetMask')->execute($this); - } - - /** - * Resize the image to given dimensions. - * - * $width and $height are both smart coordinates. This means that you can pass any of these values in: - * - positive or negative integer (100, -20, ...) - * - positive or negative percent string (30%, -15%, ...) - * - complex coordinate (50% - 20, 15 + 30%, ...) - * - null: if one dimension is null, it's calculated proportionally from the other. - * - * $fit parameter can be set to one of these three values: - * - 'inside': resize proportionally and fit the resulting image tightly in the $width x $height box - * - 'outside': resize proportionally and fit the resulting image tighly outside the box - * - 'fill': resize the image to fill the $width x $height box exactly - * - * $scale parameter can be: - * - 'down': only resize the image if it's larger than the $width x $height box - * - 'up': only resize the image if it's smaller than the $width x $height box - * - 'any': resize the image - * - * Example (resize to half-size): - * - * $smaller = $image->resize('50%'); - * - * $smaller = $image->resize('100', '100', 'inside', 'down'); - * is the same as - * $smaller = $image->resizeDown(100, 100, 'inside'); - * - * - * @param mixed $width The new width (smart coordinate), or null. - * @param mixed $height The new height (smart coordinate), or null. - * @param string $fit 'inside', 'outside', 'fill' - * @param string $scale 'down', 'up', 'any' - * @return \WideImage\Image The resized image - */ - public function resize($width = null, $height = null, $fit = 'inside', $scale = 'any') - { - return $this->getOperation('Resize')->execute($this, $width, $height, $fit, $scale); - } - - /** - * Same as \WideImage\Image::resize(), but the image is only applied if it is larger then the given dimensions. - * Otherwise, the resulting image retains the source's dimensions. - * - * @param int $width New width, smart coordinate - * @param int $height New height, smart coordinate - * @param string $fit 'inside', 'outside', 'fill' - * @return \WideImage\Image resized image - */ - public function resizeDown($width = null, $height = null, $fit = 'inside') - { - return $this->resize($width, $height, $fit, 'down'); - } - - /** - * Same as \WideImage\Image::resize(), but the image is only applied if it is smaller then the given dimensions. - * Otherwise, the resulting image retains the source's dimensions. - * - * @param int $width New width, smart coordinate - * @param int $height New height, smart coordinate - * @param string $fit 'inside', 'outside', 'fill' - * @return \WideImage\Image resized image - */ - public function resizeUp($width = null, $height = null, $fit = 'inside') - { - return $this->resize($width, $height, $fit, 'up'); - } - - /** - * Rotate the image for angle $angle clockwise. - * - * Preserves transparency. Has issues when saving to a BMP. - * - * @param int $angle Angle in degrees, clock-wise - * @param int $bgColor color of the new background - * @param bool $ignoreTransparent - * @return \WideImage\Image The rotated image - */ - public function rotate($angle, $bgColor = null, $ignoreTransparent = true) - { - return $this->getOperation('Rotate')->execute($this, $angle, $bgColor, $ignoreTransparent); - } - - /** - * This method lays the overlay (watermark) on the image. - * - * Hint: if the overlay is a truecolor image with alpha channel, you should leave $pct at 100. - * - * This operation supports alignment notation in coordinates: - * - * $watermark = WideImage::load('logo.gif'); - * $base = WideImage::load('picture.jpg'); - * $result = $base->merge($watermark, "right - 10", "bottom - 10", 50); - * // applies a logo aligned to bottom-right corner with a 10 pixel margin - * - * - * @param \WideImage\Image $overlay The overlay image - * @param mixed $left Left position of the overlay, smart coordinate - * @param mixed $top Top position of the overlay, smart coordinate - * @param int $pct The opacity of the overlay - * @return \WideImage\Image The merged image - */ - public function merge($overlay, $left = 0, $top = 0, $pct = 100) - { - return $this->getOperation('Merge')->execute($this, $overlay, $left, $top, $pct); - } - - /** - * Resizes the canvas of the image, but doesn't scale the content of the image - * - * This operation creates an empty canvas with dimensions $width x $height, filled with - * background color $bg_color and draws the original image onto it at position [$pos_x, $pos_y]. - * - * Arguments $width, $height, $pos_x and $pos_y are all smart coordinates. $width and $height are - * relative to the current image size, $pos_x and $pos_y are relative to the newly calculated - * canvas size. This can be confusing, but it makes sense. See the example below. - * - * The example below loads a 100x150 image and then resizes its canvas to 200% x 100%+20 - * (which evaluates to 200x170). The image is placed at position [10, center+20], which evaluates to [10, 30]. - * - * $image = WideImage::load('someimage.jpg'); // 100x150 - * $white = $image->allocateColor(255, 255, 255); - * $image->resizeCanvas('200%', '100% + 20', 10, 'center+20', $white); - * - * - * The parameter $merge defines whether the original image should be merged onto the new canvas. - * This means it blends transparent color and alpha colors into the background color. If set to false, - * the original image is just copied over, preserving the transparency/alpha information. - * - * You can set the $scale parameter to limit when to resize the canvas. For example, if you want - * to resize the canvas only if the image is smaller than the new size, but leave the image intact - * if it's larger, set it to 'up'. Likewise, if you want to shrink the canvas, but don't want to - * change images that are already smaller, set it to 'down'. - * - * @param mixed $width Width of the new canvas (smart coordinate, relative to current image width) - * @param mixed $height Height of the new canvas (smart coordinate, relative to current image height) - * @param mixed $pos_x x-position of the image (smart coordinate, relative to the new width) - * @param mixed $pos_y y-position of the image (smart coordinate, relative to the new height) - * @param int $bg_color Background color (created with allocateColor or allocateColorAlpha), defaults to null (tries to use a transparent color) - * @param string $scale Possible values: 'up' (enlarge only), 'down' (downsize only), 'any' (resize precisely to $width x $height). Defaults to 'any'. - * @param bool $merge Merge the original image (flatten alpha channel and transparency) or copy it over (preserve). Defaults to false. - * @return \WideImage\Image The resulting image with resized canvas - */ - public function resizeCanvas($width, $height, $pos_x, $pos_y, $bg_color = null, $scale = 'any', $merge = false) - { - return $this->getOperation('ResizeCanvas')->execute($this, $width, $height, $pos_x, $pos_y, $bg_color, $scale, $merge); - } - - /** - * Returns an image with round corners - * - * You can either set the corners' color or set them transparent. - * - * Note on $smoothness: 1 means jagged edges, 2 is much better, more than 4 doesn't noticeably improve the quality. - * Rendering becomes increasingly slower if you increase smoothness. - * - * Example: - * - * $nice = $ugly->roundCorners(20, $ugly->allocateColor(255, 0, 0), 2); - * - * - * Use $corners parameter to specify which corners to draw rounded. Possible values are - * WideImage::SIDE_TOP_LEFT, WideImage::SIDE_TOP, - * WideImage::SIDE_TOP_RIGHT, WideImage::SIDE_RIGHT, - * WideImage::SIDE_BOTTOM_RIGHT, WideImage::SIDE_BOTTOM, - * WideImage::SIDE_BOTTOM_LEFT, WideImage::SIDE_LEFT, and WideImage::SIDE_ALL. - * You can specify any combination of corners with a + operation, see example below. - * - * Example: - * - * $white = $image->allocateColor(255, 255, 255); - * $diagonal_corners = $image->roundCorners(15, $white, 2, WideImage::SIDE_TOP_LEFT + WideImage::SIDE_BOTTOM_RIGHT); - * $right_corners = $image->roundCorners(15, $white, 2, WideImage::SIDE_RIGHT); - * - * - * @param int $radius Radius of the corners - * @param int $color The color of corners. If null, corners are rendered transparent (slower than using a solid color). - * @param int $smoothness Specify the level of smoothness. Suggested values from 1 to 4. - * @param int $corners Specify which corners to draw (defaults to WideImage::SIDE_ALL = all corners) - * @return \WideImage\Image The resulting image with round corners - */ - public function roundCorners($radius, $color = null, $smoothness = 2, $corners = 255) - { - return $this->getOperation('RoundCorners')->execute($this, $radius, $color, $smoothness, $corners); - } - - /** - * Returns an image with applied mask - * - * A mask is a grayscale image, where the shade determines the alpha channel. Black is fully transparent - * and white is fully opaque. - * - * @param \WideImage\Image $mask The mask image, greyscale - * @param mixed $left Left coordinate, smart coordinate - * @param mixed $top Top coordinate, smart coordinate - * @return \WideImage\Image The resulting image - **/ - public function applyMask($mask, $left = 0, $top = 0) - { - return $this->getOperation('ApplyMask')->execute($this, $mask, $left, $top); - } - - /** - * Applies a filter - * - * @param int $filter One of the IMG_FILTER_* constants - * @param int $arg1 - * @param int $arg2 - * @param int $arg3 - * @param int $arg4 - * @return \WideImage\Image - */ - public function applyFilter($filter, $arg1 = null, $arg2 = null, $arg3 = null, $arg4 = null) - { - return $this->getOperation('ApplyFilter')->execute($this, $filter, $arg1, $arg2, $arg3, $arg4); - } - - /** - * Applies convolution matrix with imageconvolution() - * - * @param array $matrix - * @param float $div - * @param float $offset - * @return \WideImage\Image - */ - public function applyConvolution($matrix, $div, $offset) - { - return $this->getOperation('ApplyConvolution')->execute($this, $matrix, $div, $offset); - } - - /** - * Returns a cropped rectangular portion of the image - * - * If the rectangle specifies area that is out of bounds, it's limited to the current image bounds. - * - * Examples: - * - * $cropped = $img->crop(10, 10, 150, 200); // crops a 150x200 rect at (10, 10) - * $cropped = $img->crop(-100, -50, 100, 50); // crops a 100x50 rect at the right-bottom of the image - * $cropped = $img->crop('25%', '25%', '50%', '50%'); // crops a 50%x50% rect from the center of the image - * - * - * This operation supports alignment notation in left/top coordinates. - * Example: - * - * $cropped = $img->crop("right", "bottom", 100, 200); // crops a 100x200 rect from right bottom - * $cropped = $img->crop("center", "middle", 50, 30); // crops a 50x30 from the center of the image - * - * - * @param mixed $left Left-coordinate of the crop rect, smart coordinate - * @param mixed $top Top-coordinate of the crop rect, smart coordinate - * @param mixed $width Width of the crop rect, smart coordinate - * @param mixed $height Height of the crop rect, smart coordinate - * @return \WideImage\Image The cropped image - **/ - public function crop($left = 0, $top = 0, $width = '100%', $height = '100%') - { - return $this->getOperation('Crop')->execute($this, $left, $top, $width, $height); - } - - /** - * Performs an auto-crop on the image - * - * The image is auto-cropped from each of four sides. All sides are - * scanned for pixels that differ from $base_color for more than - * $rgb_threshold in absolute RGB difference. If more than $pixel_cutoff - * differentiating pixels are found, that line is considered to be the crop line for the side. - * If the line isn't different enough, the algorithm procedes to the next line - * towards the other edge of the image. - * - * When the crop rectangle is found, it's enlarged by the $margin value on each of the four sides. - * - * @param int $margin Margin for the crop rectangle, can be negative. - * @param int $rgb_threshold RGB difference which still counts as "same color". - * @param int $pixel_cutoff How many pixels need to be different to mark a cut line. - * @param int $base_color The base color index. If none specified (or null given), left-top pixel is used. - * @return \WideImage\Image The cropped image - */ - public function autoCrop($margin = 0, $rgb_threshold = 0, $pixel_cutoff = 1, $base_color = null) - { - return $this->getOperation('AutoCrop')->execute($this, $margin, $rgb_threshold, $pixel_cutoff, $base_color); - } - - /** - * Returns a negative of the image - * - * This operation differs from calling \WideImage\Image::applyFilter(IMG_FILTER_NEGATIVE), because it's 8-bit and transparency safe. - * This means it will return an 8-bit image, if the source image is 8-bit. If that 8-bit image has a palette transparency, - * the resulting image will keep transparency. - * - * @return \WideImage\Image negative of the image - */ - public function asNegative() - { - return $this->getOperation('AsNegative')->execute($this); - } - - /** - * Returns a grayscale copy of the image - * - * @return \WideImage\Image grayscale copy - **/ - public function asGrayscale() - { - return $this->getOperation('AsGrayscale')->execute($this); - } - - /** - * Returns a mirrored copy of the image - * - * @return \WideImage\Image Mirrored copy - **/ - public function mirror() - { - return $this->getOperation('Mirror')->execute($this); - } - - /** - * Applies the unsharp filter - * - * @param float $amount - * @param float $radius - * @param float $threshold - * @return \WideImage\Image Unsharpened copy of the image - **/ - public function unsharp($amount, $radius, $threshold) - { - return $this->getOperation('Unsharp')->execute($this, $amount, $radius, $threshold); - } - - /** - * Returns a flipped (mirrored over horizontal line) copy of the image - * - * @return \WideImage\Image Flipped copy - **/ - public function flip() - { - return $this->getOperation('Flip')->execute($this); - } - - /** - * Corrects gamma on the image - * - * @param float $inputGamma - * @param float $outputGamma - * @return \WideImage\Image Image with corrected gamma - **/ - public function correctGamma($inputGamma, $outputGamma) - { - return $this->getOperation('CorrectGamma')->execute($this, $inputGamma, $outputGamma); - } - - /** - * Adds noise to the image - * - * @author Tomasz Kapusta - * - * @param int $amount Number of noise pixels to add - * @param string $type Type of noise 'salt&pepper', 'color' or 'mono' - * @return \WideImage\Image Image with noise added - **/ - public function addNoise($amount, $type) - { - return $this->getOperation('AddNoise')->execute($this, $amount, $type); - } - - /** - * Used internally to execute operations - * - * @param string $name - * @param array $args - * @return \WideImage\Image - */ - public function __call($name, $args) - { - $op = $this->getOperation($name); - array_unshift($args, $this); - return call_user_func_array(array($op, 'execute'), $args); - } - - /** - * Returns an image in GIF or PNG format - * - * @return string - */ - public function __toString() - { - if ($this->isTransparent()) { - return $this->asString('gif'); - } - - return $this->asString('png'); - } - - /** - * Returns a copy of the image object - * - * @return \WideImage\Image The copy - **/ - public function copy() - { - $dest = $this->doCreate($this->getWidth(), $this->getHeight()); - $dest->copyTransparencyFrom($this, true); - $this->copyTo($dest, 0, 0); - return $dest; - } - - /** - * Copies this image onto another image - * - * @param \WideImage\Image $dest - * @param int $left - * @param int $top - **/ - public function copyTo($dest, $left = 0, $top = 0) - { - if (!imagecopy($dest->getHandle(), $this->handle, $left, $top, 0, 0, $this->getWidth(), $this->getHeight())) { - throw new GDFunctionResultException("imagecopy() returned false"); - } - } - - /** - * Returns the canvas object - * - * The Canvas object can be used to draw text and shapes on the image - * - * Examples: - * - * $img = WideImage::load('pic.jpg); - * $canvas = $img->getCanvas(); - * $canvas->useFont('arial.ttf', 15, $img->allocateColor(200, 220, 255)); - * $canvas->writeText(10, 50, "Hello world!"); - * - * $canvas->filledRectangle(10, 10, 80, 40, $img->allocateColor(255, 127, 255)); - * $canvas->line(60, 80, 30, 100, $img->allocateColor(255, 0, 0)); - * $img->saveToFile('new.png'); - * - * - * @return \WideImage\Canvas The Canvas object - **/ - function getCanvas() - { - if ($this->canvas == null) { - $this->canvas = new Canvas($this); - } - - return $this->canvas; - } - - /** - * Returns true if the image is true-color, false otherwise - * - * @return bool - **/ - abstract public function isTrueColor(); - - /** - * Returns a true-color copy of the image - * - * @return \WideImage\TrueColorImage - **/ - abstract public function asTrueColor(); - - /** - * Returns a palette copy (8bit) of the image - * - * @param int $nColors Number of colors in the resulting image, more than 0, less or equal to 255 - * @param bool $dither Use dithering or not - * @param bool $matchPalette Set to true to use imagecolormatch() to match the resulting palette more closely to the original image - * @return \WideImage\Image - **/ - abstract public function asPalette($nColors = 255, $dither = null, $matchPalette = true); - - /** - * Retrieve an image with selected channels - * - * Examples: - * - * $channels = $img->getChannels('red', 'blue'); - * $channels = $img->getChannels('alpha', 'green'); - * $channels = $img->getChannels(array('green', 'blue')); - * - * - * @return \WideImage\Image - **/ - abstract public function getChannels(); - - /** - * Returns an image without an alpha channel - * - * @return \WideImage\Image - **/ - abstract public function copyNoAlpha(); - - /** - * Returns an array of serializable protected variables. Called automatically upon serialize(). - * - * @return array - */ - public function __sleep() - { - $this->sdata = $this->asString('png'); - - return array('sdata', 'handleReleased'); - } - - /** - * Restores an image from serialization. Called automatically upon unserialize(). - */ - public function __wakeup() - { - $temp_image = WideImage::loadFromString($this->sdata); - $temp_image->releaseHandle(); - $this->handle = $temp_image->handle; - $temp_image = null; - $this->sdata = null; - } -} diff --git a/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Mapper/BMP.php b/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Mapper/BMP.php deleted file mode 100644 index fca1d1f..0000000 --- a/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Mapper/BMP.php +++ /dev/null @@ -1,53 +0,0 @@ - 'JPEG', - 'image/jpeg' => 'JPEG', - 'image/pjpeg' => 'JPEG', - 'image/gif' => 'GIF', - 'image/png' => 'PNG' - ); - - /** - * Returns a mapper, based on the $uri and $format - * - * @param string $uri File URI - * @param string $format File format (extension or mime-type) or null - * @return mixed - **/ - public static function selectMapper($uri, $format = null) - { - $format = self::determineFormat($uri, $format); - - if (array_key_exists($format, self::$mappers)) { - return self::$mappers[$format]; - } - - $mapperClassName = '\\WideImage\\Mapper\\' . $format; - - // why not use autoloading? - // if (!class_exists($mapperClassName, false)) { - if (!class_exists($mapperClassName)) { - throw new UnsupportedFormatException("Format '{$format}' is not supported."); - } - - if (class_exists($mapperClassName)) { - self::$mappers[$format] = new $mapperClassName(); - return self::$mappers[$format]; - } - } - - public static function registerMapper($mapper_class_name, $mime_type, $extension) - { - self::$customMappers[$mime_type] = $mapper_class_name; - self::$mimeTable[$mime_type] = $extension; - } - - public static function getCustomMappers() - { - return self::$customMappers; - } - - public static function determineFormat($uri, $format = null) - { - if ($format == null) { - $format = self::extractExtension($uri); - } - - // mime-type match - if (preg_match('~[a-z]*/[a-z-]*~i', $format)) { - if (isset(self::$mimeTable[strtolower($format)])) { - return self::$mimeTable[strtolower($format)]; - } - } - - // clean the string - $format = strtoupper(preg_replace('/[^a-z0-9_-]/i', '', $format)); - if ($format == 'JPG') { - $format = 'JPEG'; - } - - return $format; - } - - public static function mimeType($format) - { - $format = strtoupper($format); - - if ($format == 'JPG') { - $format = 'JPEG'; - } - - return array_search($format, self::$mimeTable); - } - - public static function extractExtension($uri) - { - $p = strrpos($uri, '.'); - - if ($p === false) { - return ''; - } - - return substr($uri, $p + 1); - } -} diff --git a/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Operation/AddNoise.php b/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Operation/AddNoise.php deleted file mode 100644 index ce0fbec..0000000 --- a/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Operation/AddNoise.php +++ /dev/null @@ -1,167 +0,0 @@ -asTrueColor(), $fun, $amount); - } - - /** - * Returns image with every pixel changed by specififed function - * - * @param \WideImage\Image $image - * @param str $function - * @param int $value - * @return \WideImage\Image - */ - public function filter($image, $function, $value) - { - for ($y = 0; $y < $image->getHeight(); $y++) { - for ($x = 0; $x< $image->getWidth(); $x++) { - $rgb = imagecolorat($image->getHandle(), $x, $y); - - $a = ($rgb >> 24) & 0xFF; - $r = ($rgb >> 16) & 0xFF; - $g = ($rgb >> 8) & 0xFF; - $b = $rgb & 0xFF; - - static::$function($r, $g, $b, $value); - - $color = imagecolorallocatealpha($image->getHandle(), $r, $g, $b, $a); - imagesetpixel($image->getHandle(), $x, $y, $color); - } - } - - return $image; - } - - /** - * Adds color noise by altering given R,G,B values using specififed amount - * - * @param int $r - * @param int $g - * @param int $b - * @param int $value - * @return void - */ - public function colorNoise_fun(&$r, &$g, &$b, $amount) - { - $r = static::byte($r + mt_rand(0, $amount) - ($amount >> 1) ); - $g = static::byte($g + mt_rand(0, $amount) - ($amount >> 1) ); - $b = static::byte($b + mt_rand(0, $amount) - ($amount >> 1) ); - } - - /** - * Adds mono noise by altering given R,G,B values using specififed amount - * - * @param int $r - * @param int $g - * @param int $b - * @param int $value - * @return void - */ - public function monoNoise_fun(&$r, &$g, &$b, $amount) - { - $rand = mt_rand(0, $amount) - ($amount >> 1); - - $r = static::byte($r + $rand); - $g = static::byte($g + $rand); - $b = static::byte($b + $rand); - } - - /** - * Adds salt&pepper noise by altering given R,G,B values using specififed amount - * - * @param int $r - * @param int $g - * @param int $b - * @param int $value - * @return void - */ - public function saltPepperNoise_fun(&$r, &$g, &$b, $amount) - { - if (mt_rand(0, 255 - $amount) != 0) { - return; - } - - $rand = mt_rand(0, 1); - - switch ($rand) { - case 0: - $r = $g = $b = 0; - break; - case 1: - $r = $g = $b = 255; - break; - } - } - - /** - * Returns value within (0,255) - * - * @param int $b - * @return int - */ - public function byte($b) - { - if ($b > 255) { - return 255; - } - - if ($b < 0) { - return 0; - } - - return (int) $b; - } -} diff --git a/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Operation/ApplyConvolution.php b/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Operation/ApplyConvolution.php deleted file mode 100644 index ab803d9..0000000 --- a/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Operation/ApplyConvolution.php +++ /dev/null @@ -1,54 +0,0 @@ -asTrueColor(); - - if (!imageconvolution($new->getHandle(), $matrix, $div, $offset)) { - throw new GDFunctionResultException("imageconvolution() returned false"); - } - - return $new; - } -} diff --git a/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Operation/ApplyFilter.php b/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Operation/ApplyFilter.php deleted file mode 100644 index 3c7d28f..0000000 --- a/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Operation/ApplyFilter.php +++ /dev/null @@ -1,72 +0,0 @@ -asTrueColor(); - - if (in_array($filter, static::$one_arg_filters)) { - $res = imagefilter($new->getHandle(), $filter, $arg1); - } elseif (defined('IMG_FILTER_PIXELATE') && $filter == IMG_FILTER_PIXELATE) { - $res = imagefilter($new->getHandle(), $filter, $arg1, $arg2); - } elseif ($filter == IMG_FILTER_COLORIZE) { - $res = imagefilter($new->getHandle(), $filter, $arg1, $arg2, $arg3, $arg4); - } else { - $res = imagefilter($new->getHandle(), $filter); - } - - if (!$res) { - throw new GDFunctionResultException("imagefilter() returned false"); - } - - return $new; - } -} diff --git a/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Operation/ApplyMask.php b/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Operation/ApplyMask.php deleted file mode 100644 index 40c9af2..0000000 --- a/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Operation/ApplyMask.php +++ /dev/null @@ -1,105 +0,0 @@ -getWidth(), $mask->getWidth()); - $top = Coordinate::fix($top, $image->getHeight(), $mask->getHeight()); - - $width = $image->getWidth(); - $mask_width = $mask->getWidth(); - - $height = $image->getHeight(); - $mask_height = $mask->getHeight(); - - $result = $image->asTrueColor(); - - $result->alphaBlending(false); - $result->saveAlpha(true); - - $srcTransparentColor = $result->getTransparentColor(); - - if ($srcTransparentColor >= 0) { - $destTransparentColor = $srcTransparentColor; - } else { - $destTransparentColor = $result->allocateColorAlpha(255, 255, 255, 127); - } - - for ($x = 0; $x < $width; $x++) { - for ($y = 0; $y < $height; $y++) { - $mx = $x - $left; - $my = $y - $top; - - if ($mx >= 0 && $mx < $mask_width && $my >= 0 && $my < $mask_height) { - $srcColor = $image->getColorAt($x, $y); - - if ($srcColor == $srcTransparentColor) { - $destColor = $destTransparentColor; - } else { - $maskRGB = $mask->getRGBAt($mx, $my); - - if ($maskRGB['red'] == 0) { - $destColor = $destTransparentColor; - } elseif ($srcColor >= 0) { - $imageRGB = $image->getRGBAt($x, $y); - $level = ($maskRGB['red'] / 255) * (1 - $imageRGB['alpha'] / 127); - $imageRGB['alpha'] = 127 - round($level * 127); - - if ($imageRGB['alpha'] == 127) { - $destColor = $destTransparentColor; - } else { - $destColor = $result->allocateColorAlpha($imageRGB); - } - } else { - $destColor = $destTransparentColor; - } - } - - $result->setColorAt($x, $y, $destColor); - } - } - } - - return $result; - } -} diff --git a/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Operation/AsGrayscale.php b/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Operation/AsGrayscale.php deleted file mode 100644 index 0914895..0000000 --- a/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Operation/AsGrayscale.php +++ /dev/null @@ -1,55 +0,0 @@ -asTrueColor(); - - if (!imagefilter($new->getHandle(), IMG_FILTER_GRAYSCALE)) { - throw new GDFunctionResultException("imagefilter() returned false"); - } - - if (!$image->isTrueColor()) { - $new = $new->asPalette(); - } - - return $new; - } -} diff --git a/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Operation/AsNegative.php b/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Operation/AsNegative.php deleted file mode 100644 index adad0ff..0000000 --- a/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Operation/AsNegative.php +++ /dev/null @@ -1,70 +0,0 @@ -isTrueColor(); - $transparent = $image->isTransparent(); - - if ($palette && $transparent) { - $tcrgb = $image->getTransparentColorRGB(); - } - - $new = $image->asTrueColor(); - - if (!imagefilter($new->getHandle(), IMG_FILTER_NEGATE)) { - throw new GDFunctionResultException("imagefilter() returned false"); - } - - if ($palette) { - $new = $new->asPalette(); - - if ($transparent) { - $irgb = array('red' => 255 - $tcrgb['red'], 'green' => 255 - $tcrgb['green'], 'blue' => 255 - $tcrgb['blue'], 'alpha' => 127); - - // needs imagecolorexactalpha instead of imagecolorexact, otherwise doesn't work on some transparent GIF images - $new_tci = imagecolorexactalpha($new->getHandle(), $irgb['red'], $irgb['green'], $irgb['blue'], 127); - $new->setTransparentColor($new_tci); - } - } - - return $new; - } -} diff --git a/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Operation/AutoCrop.php b/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Operation/AutoCrop.php deleted file mode 100644 index f8b8cc8..0000000 --- a/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Operation/AutoCrop.php +++ /dev/null @@ -1,166 +0,0 @@ -getRGBAt(0, 0); - } else { - if ($base_color < 0) { - return $img->copy(); - } - - $rgb_base = $img->getColorRGB($base_color); - } - - $cut_rect = array('left' => 0, 'top' => 0, 'right' => $img->getWidth() - 1, 'bottom' => $img->getHeight() - 1); - - for ($y = 0; $y <= $cut_rect['bottom']; $y++) { - $count = 0; - - for ($x = 0; $x <= $cut_rect['right']; $x++) { - $rgb = $img->getRGBAt($x, $y); - $diff = abs($rgb['red'] - $rgb_base['red']) + abs($rgb['green'] - $rgb_base['green']) + abs($rgb['blue'] - $rgb_base['blue']); - - if ($diff > $rgb_threshold) { - $count++; - - if ($count >= $pixel_cutoff) { - $cut_rect['top'] = $y; - break 2; - } - } - } - } - - for ($y = $img->getHeight() - 1; $y >= $cut_rect['top']; $y--) { - $count = 0; - - for ($x = 0; $x <= $cut_rect['right']; $x++) { - $rgb = $img->getRGBAt($x, $y); - $diff = abs($rgb['red'] - $rgb_base['red']) + abs($rgb['green'] - $rgb_base['green']) + abs($rgb['blue'] - $rgb_base['blue']); - - if ($diff > $rgb_threshold) { - $count++; - - if ($count >= $pixel_cutoff) { - $cut_rect['bottom'] = $y; - break 2; - } - } - } - } - - for ($x = 0; $x <= $cut_rect['right']; $x++) { - $count = 0; - - for ($y = $cut_rect['top']; $y <= $cut_rect['bottom']; $y++) { - $rgb = $img->getRGBAt($x, $y); - $diff = abs($rgb['red'] - $rgb_base['red']) + abs($rgb['green'] - $rgb_base['green']) + abs($rgb['blue'] - $rgb_base['blue']); - - if ($diff > $rgb_threshold) { - $count++; - - if ($count >= $pixel_cutoff) { - $cut_rect['left'] = $x; - break 2; - } - } - } - } - - for ($x = $cut_rect['right']; $x >= $cut_rect['left']; $x--) { - $count = 0; - - for ($y = $cut_rect['top']; $y <= $cut_rect['bottom']; $y++) { - $rgb = $img->getRGBAt($x, $y); - $diff = abs($rgb['red'] - $rgb_base['red']) + abs($rgb['green'] - $rgb_base['green']) + abs($rgb['blue'] - $rgb_base['blue']); - - if ($diff > $rgb_threshold) { - $count++; - - if ($count >= $pixel_cutoff) { - $cut_rect['right'] = $x; - break 2; - } - } - } - } - - $cut_rect = array( - 'left' => $cut_rect['left'] - $margin, - 'top' => $cut_rect['top'] - $margin, - 'right' => $cut_rect['right'] + $margin, - 'bottom' => $cut_rect['bottom'] + $margin - ); - - if ($cut_rect['left'] < 0) { - $cut_rect['left'] = 0; - } - - if ($cut_rect['top'] < 0) { - $cut_rect['top'] = 0; - } - - if ($cut_rect['right'] >= $img->getWidth()) { - $cut_rect['right'] = $img->getWidth() - 1; - } - - if ($cut_rect['bottom'] >= $img->getHeight()) { - $cut_rect['bottom'] = $img->getHeight() - 1; - } - - return $img->crop($cut_rect['left'], $cut_rect['top'], $cut_rect['right'] - $cut_rect['left'] + 1, $cut_rect['bottom'] - $cut_rect['top'] + 1); - } -} diff --git a/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Operation/CopyChannelsPalette.php b/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Operation/CopyChannelsPalette.php deleted file mode 100644 index 7f419d5..0000000 --- a/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Operation/CopyChannelsPalette.php +++ /dev/null @@ -1,98 +0,0 @@ - 0, 'green' => 0, 'blue' => 0); - - if (isset($channels['alpha'])) { - unset($channels['alpha']); - } - - $width = $img->getWidth(); - $height = $img->getHeight(); - $copy = PaletteImage::create($width, $height); - - if ($img->isTransparent()) { - $otci = $img->getTransparentColor(); - $TRGB = $img->getColorRGB($otci); - $tci = $copy->allocateColor($TRGB); - } else { - $otci = null; - $tci = null; - } - - for ($x = 0; $x < $width; $x++) { - for ($y = 0; $y < $height; $y++) { - $ci = $img->getColorAt($x, $y); - - if ($ci === $otci) { - $copy->setColorAt($x, $y, $tci); - continue; - } - - $RGB = $img->getColorRGB($ci); - - $newRGB = $blank; - - foreach ($channels as $channel) { - $newRGB[$channel] = $RGB[$channel]; - } - - $color = $copy->getExactColor($newRGB); - - if ($color == -1) { - $color = $copy->allocateColor($newRGB); - } - - $copy->setColorAt($x, $y, $color); - } - } - - if ($img->isTransparent()) { - $copy->setTransparentColor($tci); - } - - return $copy; - } -} diff --git a/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Operation/CopyChannelsTrueColor.php b/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Operation/CopyChannelsTrueColor.php deleted file mode 100644 index fbf2cb0..0000000 --- a/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Operation/CopyChannelsTrueColor.php +++ /dev/null @@ -1,74 +0,0 @@ - 0, 'green' => 0, 'blue' => 0, 'alpha' => 0); - - $width = $img->getWidth(); - $height = $img->getHeight(); - $copy = TrueColorImage::create($width, $height); - - if (count($channels) > 0) { - for ($x = 0; $x < $width; $x++) { - for ($y = 0; $y < $height; $y++) { - $RGBA = $img->getRGBAt($x, $y); - $newRGBA = $blank; - - foreach ($channels as $channel) { - $newRGBA[$channel] = $RGBA[$channel]; - } - - $color = $copy->getExactColorAlpha($newRGBA); - - if ($color == -1) { - $color = $copy->allocateColorAlpha($newRGBA); - } - - $copy->setColorAt($x, $y, $color); - } - } - } - - return $copy; - } -} diff --git a/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Operation/CorrectGamma.php b/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Operation/CorrectGamma.php deleted file mode 100644 index 69d6cb7..0000000 --- a/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Operation/CorrectGamma.php +++ /dev/null @@ -1,52 +0,0 @@ -copy(); - - if (!imagegammacorrect($new->getHandle(), $input_gamma, $output_gamma)) { - throw new GDFunctionResultException("imagegammacorrect() returned false"); - } - - return $new; - } -} diff --git a/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Operation/Crop.php b/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Operation/Crop.php deleted file mode 100644 index c809004..0000000 --- a/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Operation/Crop.php +++ /dev/null @@ -1,96 +0,0 @@ -getWidth(), $width); - $height = Coordinate::fix($height, $img->getHeight(), $height); - $left = Coordinate::fix($left, $img->getWidth(), $width); - $top = Coordinate::fix($top, $img->getHeight(), $height); - - if ($left < 0) { - $width = $left + $width; - $left = 0; - } - - if ($width > $img->getWidth() - $left) { - $width = $img->getWidth() - $left; - } - - if ($top < 0) { - $height = $top + $height; - $top = 0; - } - - if ($height > $img->getHeight() - $top) { - $height = $img->getHeight() - $top; - } - - if ($width <= 0 || $height <= 0) { - throw new Exception("Can't crop outside of an image."); - } - - $new = $img->doCreate($width, $height); - - if ($img->isTransparent() || $img instanceof PaletteImage) { - $new->copyTransparencyFrom($img); - - if (!imagecopyresized($new->getHandle(), $img->getHandle(), 0, 0, $left, $top, $width, $height, $width, $height)) { - throw new GDFunctionResultException("imagecopyresized() returned false"); - } - } else { - $new->alphaBlending(false); - $new->saveAlpha(true); - - if (!imagecopyresampled($new->getHandle(), $img->getHandle(), 0, 0, $left, $top, $width, $height, $width, $height)) { - throw new GDFunctionResultException("imagecopyresampled() returned false"); - } - } - - return $new; - } -} diff --git a/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Operation/Exception/InvalidFitMethodException.php b/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Operation/Exception/InvalidFitMethodException.php deleted file mode 100644 index beaa0bc..0000000 --- a/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Operation/Exception/InvalidFitMethodException.php +++ /dev/null @@ -1,10 +0,0 @@ -copy(); - - $width = $image->getWidth(); - $height = $image->getHeight(); - - if ($new->isTransparent()) { - imagefilledrectangle($new->getHandle(), 0, 0, $width, $height, $new->getTransparentColor()); - } - - for ($y = 0; $y < $height; $y++) { - if (!imagecopy($new->getHandle(), $image->getHandle(), 0, $y, 0, $height - $y - 1, $width, 1)) { - throw new GDFunctionResultException("imagecopy() returned false"); - } - } - - return $new; - } -} diff --git a/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Operation/GetMask.php b/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Operation/GetMask.php deleted file mode 100644 index 34d0d9c..0000000 --- a/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Operation/GetMask.php +++ /dev/null @@ -1,76 +0,0 @@ -getWidth(); - $height = $image->getHeight(); - - $mask = TrueColorImage::create($width, $height); - $mask->setTransparentColor(-1); - $mask->alphaBlending(false); - $mask->saveAlpha(false); - - for ($i = 0; $i <= 255; $i++) { - $greyscale[$i] = ImageColorAllocate($mask->getHandle(), $i, $i, $i); - } - - imagefilledrectangle($mask->getHandle(), 0, 0, $width, $height, $greyscale[255]); - - $transparentColor = $image->getTransparentColor(); - $alphaToGreyRatio = 255 / 127; - - for ($x = 0; $x < $width; $x++) { - for ($y = 0; $y < $height; $y++) { - $color = $image->getColorAt($x, $y); - - if ($color == $transparentColor) { - $rgba['alpha'] = 127; - } else { - $rgba = $image->getColorRGB($color); - } - - imagesetpixel($mask->getHandle(), $x, $y, $greyscale[255 - round($rgba['alpha'] * $alphaToGreyRatio)]); - } - } - - return $mask; - } -} diff --git a/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Operation/Merge.php b/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Operation/Merge.php deleted file mode 100644 index 264d180..0000000 --- a/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Operation/Merge.php +++ /dev/null @@ -1,82 +0,0 @@ -getWidth(), $overlay->getWidth()); - $y = Coordinate::fix($top, $base->getHeight(), $overlay->getHeight()); - - $result = $base->asTrueColor(); - $result->alphaBlending(true); - $result->saveAlpha(true); - - if ($pct <= 0) { - return $result; - } - - if ($pct < 100) { - if (!imagecopymerge( - $result->getHandle(), - $overlay->getHandle(), - $x, $y, 0, 0, - $overlay->getWidth(), - $overlay->getHeight(), - $pct)) { - throw new GDFunctionResultException("imagecopymerge() returned false"); - } - } else { - if (!imagecopy( - $result->getHandle(), - $overlay->getHandle(), - $x, $y, 0, 0, - $overlay->getWidth(), - $overlay->getHeight())) { - throw new GDFunctionResultException("imagecopy() returned false"); - } - } - - return $result; - } -} diff --git a/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Operation/Mirror.php b/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Operation/Mirror.php deleted file mode 100644 index 199c423..0000000 --- a/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Operation/Mirror.php +++ /dev/null @@ -1,60 +0,0 @@ -copy(); - - $width = $image->getWidth(); - $height = $image->getHeight(); - - if ($new->isTransparent()) { - imagefilledrectangle($new->getHandle(), 0, 0, $width, $height, $new->getTransparentColor()); - } - - for ($x = 0; $x < $width; $x++) { - if (!imagecopy($new->getHandle(), $image->getHandle(), $x, 0, $width - $x - 1, 0, 1, $height)) { - throw new GDFunctionResultException("imagecopy() returned false"); - } - } - - return $new; - } -} diff --git a/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Operation/Resize.php b/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Operation/Resize.php deleted file mode 100644 index 9852089..0000000 --- a/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Operation/Resize.php +++ /dev/null @@ -1,166 +0,0 @@ - $img->getWidth(), 'height' => $img->getHeight()); - } - - if ($width !== null) { - $width = Coordinate::fix($width, $img->getWidth()); - $rx = $img->getWidth() / $width; - } else { - $rx = null; - } - - if ($height !== null) { - $height = Coordinate::fix($height, $img->getHeight()); - $ry = $img->getHeight() / $height; - } else { - $ry = null; - } - - if ($rx === null && $ry !== null) { - $rx = $ry; - $width = round($img->getWidth() / $rx); - } - - if ($ry === null && $rx !== null) { - $ry = $rx; - $height = round($img->getHeight() / $ry); - } - - if ($width === 0 || $height === 0) { - return array('width' => 0, 'height' => 0); - } - - if ($fit == null) { - $fit = 'inside'; - } - - $dim = array(); - - if ($fit == 'fill') { - $dim['width'] = $width; - $dim['height'] = $height; - } elseif ($fit == 'inside' || $fit == 'outside') { - if ($fit == 'inside') { - $ratio = ($rx > $ry) ? $rx : $ry; - } else { - $ratio = ($rx < $ry) ? $rx : $ry; - } - - $dim['width'] = round($img->getWidth() / $ratio); - $dim['height'] = round($img->getHeight() / $ratio); - } else { - throw new InvalidFitMethodException("{$fit} is not a valid resize-fit method."); - } - - return $dim; - } - - /** - * Returns a resized image - * - * @param \WideImage\Image $img - * @param smart_coordinate $width - * @param smart_coordinate $height - * @param string $fit - * @param string $scale - * @return \WideImage\Image - */ - public function execute($img, $width, $height, $fit, $scale) - { - $dim = $this->prepareDimensions($img, $width, $height, $fit); - - if (($scale === 'down' && ($dim['width'] >= $img->getWidth() && $dim['height'] >= $img->getHeight())) || - ($scale === 'up' && ($dim['width'] <= $img->getWidth() && $dim['height'] <= $img->getHeight()))) { - $dim = array('width' => $img->getWidth(), 'height' => $img->getHeight()); - } - - if ($dim['width'] <= 0 || $dim['height'] <= 0) { - throw new InvalidResizeDimensionException("Both dimensions must be larger than 0."); - } - - if ($img->isTransparent() || $img instanceof PaletteImage) { - $new = PaletteImage::create($dim['width'], $dim['height']); - $new->copyTransparencyFrom($img); - - if (!imagecopyresized( - $new->getHandle(), - $img->getHandle(), - 0, 0, 0, 0, - $new->getWidth(), - $new->getHeight(), - $img->getWidth(), - $img->getHeight())) { - throw new GDFunctionResultException("imagecopyresized() returned false"); - } - } else { - $new = TrueColorImage::create($dim['width'], $dim['height']); - $new->alphaBlending(false); - $new->saveAlpha(true); - - if (!imagecopyresampled( - $new->getHandle(), - $img->getHandle(), - 0, 0, 0, 0, - $new->getWidth(), - $new->getHeight(), - $img->getWidth(), - $img->getHeight())) { - throw new GDFunctionResultException("imagecopyresampled() returned false"); - } - - $new->alphaBlending(true); - } - - return $new; - } -} diff --git a/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Operation/ResizeCanvas.php b/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Operation/ResizeCanvas.php deleted file mode 100644 index 8fa39f2..0000000 --- a/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Operation/ResizeCanvas.php +++ /dev/null @@ -1,109 +0,0 @@ -getWidth()); - $new_height = Coordinate::fix($height, $img->getHeight()); - - if ($scale == 'down') { - $new_width = min($new_width, $img->getWidth()); - $new_height = min($new_height, $img->getHeight()); - } elseif ($scale == 'up') { - $new_width = max($new_width, $img->getWidth()); - $new_height = max($new_height, $img->getHeight()); - } - - $new = WideImage::createTrueColorImage($new_width, $new_height); - - if ($img->isTrueColor()) { - if ($color === null) { - $color = $new->allocateColorAlpha(0, 0, 0, 127); - } - } else { - imagepalettecopy($new->getHandle(), $img->getHandle()); - - if ($img->isTransparent()) { - $new->copyTransparencyFrom($img); - $tc_rgb = $img->getTransparentColorRGB(); - $t_color = $new->allocateColorAlpha($tc_rgb); - } - - if ($color === null) { - if ($img->isTransparent()) { - $color = $t_color; - } else { - $color = $new->allocateColorAlpha(255, 0, 127, 127); - } - - imagecolortransparent($new->getHandle(), $color); - } - } - - $new->fill(0, 0, $color); - - $x = Coordinate::fix($left, $new->getWidth(), $img->getWidth()); - $y = Coordinate::fix($top, $new->getHeight(), $img->getHeight()); - - // blending for truecolor images - if ($img->isTrueColor()) { - $new->alphaBlending($merge); - } - - // not-blending for palette images - if (!$merge && !$img->isTrueColor() && isset($t_color)) { - $new->getCanvas()->filledRectangle($x, $y, $x + $img->getWidth(), $y + $img->getHeight(), $t_color); - } - - $img->copyTo($new, $x, $y); - - return $new; - } -} diff --git a/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Operation/Rotate.php b/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Operation/Rotate.php deleted file mode 100644 index b6c40fa..0000000 --- a/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Operation/Rotate.php +++ /dev/null @@ -1,71 +0,0 @@ -copy(); - } - - $image = $image->asTrueColor(); - - if ($bgColor === null) { - $bgColor = $image->getTransparentColor(); - - if ($bgColor == -1) { - $bgColor = $image->allocateColorAlpha(255, 255, 255, 127); - imagecolortransparent($image->getHandle(), $bgColor); - } - } - - return new TrueColorImage(imagerotate($image->getHandle(), $angle, $bgColor, $ignoreTransparent)); - } -} diff --git a/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Operation/RoundCorners.php b/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Operation/RoundCorners.php deleted file mode 100644 index d81757a..0000000 --- a/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Operation/RoundCorners.php +++ /dev/null @@ -1,124 +0,0 @@ - 16) { - $sample_ratio = 16; - } else { - $sample_ratio = $smoothness; - } - - $corner = WideImage::createTrueColorImage($radius * $sample_ratio, $radius * $sample_ratio); - - if ($color === null) { - imagepalettecopy($corner->getHandle(), $image->getHandle()); - $bg_color = $corner->allocateColor(0, 0, 0); - - $corner->fill(0, 0, $bg_color); - $fg_color = $corner->allocateColor(255, 255, 255); - $corner->getCanvas()->filledEllipse($radius * $sample_ratio, $radius * $sample_ratio, $radius * 2 * $sample_ratio, $radius * 2 * $sample_ratio, $fg_color); - $corner = $corner->resize($radius, $radius); - - $result = $image->asTrueColor(); - - $tc = $result->getTransparentColor(); - - if ($tc == -1) { - $tc = $result->allocateColorAlpha(255, 255, 255, 127); - imagecolortransparent($result->getHandle(), $tc); - $result->setTransparentColor($tc); - } - - if ($corners & WideImage::SIDE_TOP_LEFT || $corners & WideImage::SIDE_LEFT || $corners & WideImage::SIDE_TOP) { - $result = $result->applyMask($corner, -1, -1); - } - - $corner = $corner->rotate(90); - if ($corners & WideImage::SIDE_TOP_RIGHT || $corners & WideImage::SIDE_TOP || $corners & WideImage::SIDE_RIGHT) { - $result = $result->applyMask($corner, $result->getWidth() - $corner->getWidth() + 1, -1, 100); - } - - $corner = $corner->rotate(90); - if ($corners & WideImage::SIDE_BOTTOM_RIGHT || $corners & WideImage::SIDE_RIGHT || $corners & WideImage::SIDE_BOTTOM) { - $result = $result->applyMask($corner, $result->getWidth() - $corner->getWidth() + 1, $result->getHeight() - $corner->getHeight() + 1, 100); - } - - $corner = $corner->rotate(90); - if ($corners & WideImage::SIDE_BOTTOM_LEFT || $corners & WideImage::SIDE_LEFT || $corners & WideImage::SIDE_BOTTOM) { - $result = $result->applyMask($corner, -1, $result->getHeight() - $corner->getHeight() + 1, 100); - } - - return $result; - } else { - $bg_color = $color; - - $corner->fill(0, 0, $bg_color); - $fg_color = $corner->allocateColorAlpha(127, 127, 127, 127); - $corner->getCanvas()->filledEllipse($radius * $sample_ratio, $radius * $sample_ratio, $radius * 2 * $sample_ratio, $radius * 2 * $sample_ratio, $fg_color); - $corner = $corner->resize($radius, $radius); - - $result = $image->copy(); - if ($corners & WideImage::SIDE_TOP_LEFT || $corners & WideImage::SIDE_LEFT || $corners & WideImage::SIDE_TOP) { - $result = $result->merge($corner, -1, -1, 100); - } - - $corner = $corner->rotate(90); - if ($corners & WideImage::SIDE_TOP_RIGHT || $corners & WideImage::SIDE_TOP || $corners & WideImage::SIDE_RIGHT) { - $result = $result->merge($corner, $result->getWidth() - $corner->getWidth() + 1, -1, 100); - } - - $corner = $corner->rotate(90); - if ($corners & WideImage::SIDE_BOTTOM_RIGHT || $corners & WideImage::SIDE_RIGHT || $corners & WideImage::SIDE_BOTTOM) { - $result = $result->merge($corner, $result->getWidth() - $corner->getWidth() + 1, $result->getHeight() - $corner->getHeight() + 1, 100); - } - - $corner = $corner->rotate(90); - if ($corners & WideImage::SIDE_BOTTOM_LEFT || $corners & WideImage::SIDE_LEFT || $corners & WideImage::SIDE_BOTTOM) { - $result = $result->merge($corner, -1, $result->getHeight() - $corner->getHeight() + 1, 100); - } - - return $result; - } - } -} diff --git a/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Operation/Unsharp.php b/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Operation/Unsharp.php deleted file mode 100644 index 8afe8c0..0000000 --- a/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/Operation/Unsharp.php +++ /dev/null @@ -1,154 +0,0 @@ - 500) { - $amount = 500; - } - - $amount = $amount * 0.016; - - if ($radius > 50) { - $radius = 50; - } - - $radius = $radius * 2; - - if ($threshold > 255) { - $threshold = 255; - } - - $radius = abs(round($radius)); // Only integers make sense. - - if ($radius == 0) { - return $image; - } - - // Gaussian blur matrix - $matrix = array( - array(1, 2, 1), - array(2, 4, 2), - array(1, 2, 1) - ); - - $blurred = $image->applyConvolution($matrix, 16, 0); - - if ($threshold > 0) { - // Calculate the difference between the blurred pixels and the original - // and set the pixels - for ($x = 0; $x < $image->getWidth(); $x++) { - for ($y = 0; $y < $image->getHeight(); $y++) { - $rgbOrig = $image->getRGBAt($x, $y); - $rOrig = $rgbOrig["red"]; - $gOrig = $rgbOrig["green"]; - $bOrig = $rgbOrig["blue"]; - - $rgbBlur = $blurred->getRGBAt($x, $y); - $rBlur = $rgbBlur["red"]; - $gBlur = $rgbBlur["green"]; - $bBlur = $rgbBlur["blue"]; - - // When the masked pixels differ less from the original - // than the threshold specifies, they are set to their original value. - $rNew = (abs($rOrig - $rBlur) >= $threshold) - ? max(0, min(255, ($amount * ($rOrig - $rBlur)) + $rOrig)) - : $rOrig; - $gNew = (abs($gOrig - $gBlur) >= $threshold) - ? max(0, min(255, ($amount * ($gOrig - $gBlur)) + $gOrig)) - : $gOrig; - $bNew = (abs($bOrig - $bBlur) >= $threshold) - ? max(0, min(255, ($amount * ($bOrig - $bBlur)) + $bOrig)) - : $bOrig; - $rgbNew = array("red" => $rNew, "green" => $gNew, "blue" => $bNew, "alpha" => 0); - - if (($rOrig != $rNew) || ($gOrig != $gNew) || ($bOrig != $bNew)) { - $image->setRGBAt($x, $y, $rgbNew); - } - } - } - } else { - $w = $image->getWidth(); - $h = $image->getHeight(); - - for ($x = 0; $x < $w; $x++) { - for ($y = 0; $y < $h; $y++) { - $rgbOrig = $image->getRGBAt($x, $y); - $rOrig = $rgbOrig["red"]; - $gOrig = $rgbOrig["green"]; - $bOrig = $rgbOrig["blue"]; - - $rgbBlur = $blurred->getRGBAt($x, $y); - $rBlur = $rgbBlur["red"]; - $gBlur = $rgbBlur["green"]; - $bBlur = $rgbBlur["blue"]; - - $rNew = static::bit(($amount * ($rOrig - $rBlur)) + $rOrig); - $gNew = static::bit(($amount * ($gOrig - $gBlur)) + $gOrig); - $bNew = static::bit(($amount * ($bOrig - $bBlur)) + $bOrig); - $rgbNew = array("red" => $rNew, "green" => $gNew, "blue" => $bNew, "alpha" => 0); - - $image->setRGBAt($x, $y, $rgbNew); - } - } - } - - return $image; - } - - protected static function bit($val) - { - if ($val > 255) { - return 255; - } - - if ($val < 0) { - return 0; - } - - return $val; - } -} diff --git a/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/OperationFactory.php b/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/OperationFactory.php deleted file mode 100644 index 1a9ce25..0000000 --- a/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/OperationFactory.php +++ /dev/null @@ -1,56 +0,0 @@ -copy(); - } - - /** - * Returns a copy of the image - * - * @param $trueColor True if the new image should be truecolor - * @return \WideImage\Image - */ - protected function copyAsNew($trueColor = false) - { - $width = $this->getWidth(); - $height = $this->getHeight(); - - if ($trueColor) { - $new = TrueColorImage::create($width, $height); - } else { - $new = PaletteImage::create($width, $height); - } - - // copy transparency of source to target - if ($this->isTransparent()) { - $rgb = $this->getTransparentColorRGB(); - - if (is_array($rgb)) { - $tci = $new->allocateColor($rgb['red'], $rgb['green'], $rgb['blue']); - $new->fill(0, 0, $tci); - $new->setTransparentColor($tci); - } - } - - imageCopy($new->getHandle(), $this->handle, 0, 0, 0, 0, $width, $height); - - return $new; - } - - /** - * (non-PHPdoc) - * @see \WideImage\Image#asTrueColor() - */ - public function asTrueColor() - { - $width = $this->getWidth(); - $height = $this->getHeight(); - $new = WideImage::createTrueColorImage($width, $height); - - if ($this->isTransparent()) { - $new->copyTransparencyFrom($this); - } - - if (!imageCopy($new->getHandle(), $this->handle, 0, 0, 0, 0, $width, $height)) { - throw new GDFunctionResultException("imagecopy() returned false"); - } - - return $new; - } - - /** - * (non-PHPdoc) - * @see \WideImage\Image#getChannels() - */ - public function getChannels() - { - $args = func_get_args(); - - if (count($args) == 1 && is_array($args[0])) { - $args = $args[0]; - } - - return OperationFactory::get('CopyChannelsPalette')->execute($this, $args); - } - - /** - * (non-PHPdoc) - * @see \WideImage\Image#copyNoAlpha() - */ - public function copyNoAlpha() - { - return WideImage::loadFromString($this->asString('png')); - } -} diff --git a/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/TrueColorImage.php b/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/TrueColorImage.php deleted file mode 100644 index 230c46e..0000000 --- a/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/TrueColorImage.php +++ /dev/null @@ -1,293 +0,0 @@ -alphaBlending(false); - $this->saveAlpha(true); - } - - /** - * Factory method that creates a true-color image object - * - * @param int $width - * @param int $height - * @return \WideImage\TrueColorImage - */ - public static function create($width, $height) - { - if ($width * $height <= 0 || $width < 0) { - throw new InvalidImageDimensionException("Can't create an image with dimensions [$width, $height]."); - } - - return new TrueColorImage(imagecreatetruecolor($width, $height)); - } - - public function doCreate($width, $height) - { - return static::create($width, $height); - } - - public function isTrueColor() - { - return true; - } - - /** - * Sets alpha blending mode via imagealphablending() - * - * @param bool $mode - * @return bool - */ - public function alphaBlending($mode) - { - return imagealphablending($this->handle, $mode); - } - - /** - * Toggle if alpha channel should be saved with the image via imagesavealpha() - * - * @param bool $on - * @return bool - */ - public function saveAlpha($on) - { - return imagesavealpha($this->handle, $on); - } - - /** - * Allocates a color and returns its index - * - * This method accepts either each component as an integer value, - * or an associative array that holds the color's components in keys - * 'red', 'green', 'blue', 'alpha'. - * - * @param mixed $R - * @param int $G - * @param int $B - * @param int $A - * @return int - */ - public function allocateColorAlpha($R, $G = null, $B = null, $A = null) - { - if (is_array($R)) { - return imageColorAllocateAlpha($this->handle, $R['red'], $R['green'], $R['blue'], $R['alpha']); - } - - return imageColorAllocateAlpha($this->handle, $R, $G, $B, $A); - } - - /** - * @see \WideImage\Image#asPalette($nColors, $dither, $matchPalette) - */ - public function asPalette($nColors = 255, $dither = null, $matchPalette = true) - { - $nColors = intval($nColors); - - if ($nColors < 1) { - $nColors = 1; - } elseif ($nColors > 255) { - $nColors = 255; - } - - if ($dither === null) { - $dither = $this->isTransparent(); - } - - $temp = $this->copy(); - - imagetruecolortopalette($temp->handle, $dither, $nColors); - - if ($matchPalette == true && function_exists('imagecolormatch')) { - imagecolormatch($this->handle, $temp->handle); - } - - // The code below isn't working properly; it corrupts transparency on some palette->tc->palette conversions. - // Why is this code here? - /* - if ($this->isTransparent()) - { - $trgb = $this->getTransparentColorRGB(); - $tci = $temp->getClosestColor($trgb); - $temp->setTransparentColor($tci); - } - /**/ - - $temp->releaseHandle(); - - return new PaletteImage($temp->handle); - } - - /** - * Returns the index of the color that best match the given color components - * - * This method accepts either each component as an integer value, - * or an associative array that holds the color's components in keys - * 'red', 'green', 'blue', 'alpha'. - * - * @param mixed $R Red component value or an associative array - * @param int $G Green component - * @param int $B Blue component - * @param int $A Alpha component - * @return int The color index - */ - public function getClosestColorAlpha($R, $G = null, $B = null, $A = null) - { - if (is_array($R)) { - return imagecolorclosestalpha($this->handle, $R['red'], $R['green'], $R['blue'], $R['alpha']); - } - - return imagecolorclosestalpha($this->handle, $R, $G, $B, $A); - } - - /** - * Returns the index of the color that exactly match the given color components - * - * This method accepts either each component as an integer value, - * or an associative array that holds the color's components in keys - * 'red', 'green', 'blue', 'alpha'. - * - * @param mixed $R Red component value or an associative array - * @param int $G Green component - * @param int $B Blue component - * @param int $A Alpha component - * @return int The color index - */ - public function getExactColorAlpha($R, $G = null, $B = null, $A = null) - { - if (is_array($R)) { - return imagecolorexactalpha($this->handle, $R['red'], $R['green'], $R['blue'], $R['alpha']); - } - - return imagecolorexactalpha($this->handle, $R, $G, $B, $A); - } - - /** - * @see \WideImage\Image#getChannels() - */ - public function getChannels() - { - $args = func_get_args(); - - if (count($args) == 1 && is_array($args[0])) { - $args = $args[0]; - } - - return OperationFactory::get('CopyChannelsTrueColor')->execute($this, $args); - } - - /** - * (non-PHPdoc) - * @see \WideImage\Image#copyNoAlpha() - */ - public function copyNoAlpha() - { - $prev = $this->saveAlpha(false); - $result = WideImage::loadFromString($this->asString('png')); - $this->saveAlpha($prev); - //$result->releaseHandle(); - return $result; - } - - /** - * (non-PHPdoc) - * @see \WideImage\Image#asTrueColor() - * @return TrueColorImage - */ - public function asTrueColor() - { - return $this->copy(); - } - - /** - * Calls imageinterlace() using the current handler - * @see \WideImage\Image#asTrueColor() - * @return TrueColorImage A copy of the image, with imageinterlace() applied - */ - public function asProgressive() - { - $dest = $this->asTrueColor(); - - imageinterlace($dest->getHandle(), true); - - return $dest; - } - - /** - * Resizes the image proportionally inside the given width and height. - * The returned image will have always the specified width and height, and any space will be filled - * with the given $fillCollor - * - * @param int $width Exact width in pixels - * @param int $height Exact height in pixels - * @param string $fit 'inside' (default), 'outside' or 'fill' - * @param string $scale 'down' (default), 'up' or 'any' - * @param mixed $alignLeft Left position of the image over the fill space, smart coordinate - * @param mixed $alignTop Top position of the image over the fill space, smart coordinate - * @param int $mergeOpacity The opacity of the image over the fill space - * @param int|array $fillColor RGB color index or array. Background color to fill the resulting image with if it's smaller - * than the given size. By default (if null), the top left pixel color will be used. - * - * @return TrueColorImage A new, resized image - */ - public function resizeInsideRect($width, $height, $fit = 'inside', $scale = 'down', $alignLeft = 'center', - $alignTop = 'center', $mergeOpacity = 100, $fillColor = null) - { - - if ($fillColor) { - if (is_numeric($fillColor)) { - $fillColor = $this->getColorRGB($fillColor); - } - } else { - $fillColor = $this->getColorRGB($this->getColorAt(0, 0)); - } - - $rect = \WideImage::createTrueColorImage($width, $height); - $rect->fill(0, 0, $rect->allocateColor($fillColor)); - - $img = $this; - - for ($i = 0; $i < 4; $i++) { //4 times - $img = $img->resize($width, $height, $fit, $scale); - } - - return $rect->merge($img, $alignLeft, $alignTop, $mergeOpacity); - } -} - diff --git a/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/WideImage.php b/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/WideImage.php deleted file mode 100644 index 4dd0bf5..0000000 --- a/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/WideImage.php +++ /dev/null @@ -1,372 +0,0 @@ - - * \WideImage\WideImage::registerCustomMapper('\\WideImage\\Mapper\\TGA', 'image/tga', 'tga'); - * - * - * @param string $mapper_class_name - * @param string $mime_type - * @param string $extension - */ - public static function registerCustomMapper($mapper_class_name, $mime_type, $extension) - { - MapperFactory::registerMapper($mapper_class_name, $mime_type, strtoupper($extension)); - } - - /** - * Loads an image from a file, URL, HTML input file field, binary string, or a valid image handle. - * The image format is auto-detected. - * - * Currently supported formats: PNG, GIF, JPG, BMP, TGA, GD, GD2. - * - * This function analyzes the input and decides whether to use WideImage::loadFromHandle(), - * WideImage::loadFromFile(), WideImage::loadFromUpload() or WideImage::loadFromString(), - * all of which you can also call directly to spare WideImage some guessing. - * - * Arrays are supported for upload fields; it returns an array of loaded images. - * To load only a single image from an array field, use WideImage::loadFromUpload('img', $i), - * where $i is the index of the image you want to load. - * - * - * $img = WideImage::load('http://url/image.png'); // image URL - * $img = WideImage::load('/path/to/image.png'); // local file path - * $img = WideImage::load('img'); // upload field name - * $img = WideImage::load(imagecreatetruecolor(10, 10)); // a GD resource - * $img = WideImage::load($image_data); // binary string containing image data - * - * - * @param mixed $source File name, url, HTML file input field name, binary string, or a GD image resource - * @return \WideImage\Image|\WideImage\PaletteImage|\WideImage\TrueColorImage - */ - public static function load($source) - { - $predictedSourceType = ''; - - if ($source == '') { - $predictedSourceType = 'String'; - } - - // Creating image via a valid resource - if (!$predictedSourceType && static::isValidImageHandle($source)) { - $predictedSourceType = 'Handle'; - } - - // Check for binary string - if (!$predictedSourceType) { - // search first $binLength bytes (at a maximum) for ord<32 characters (binary image data) - $binLength = 64; - $sourceLength = strlen($source); - $maxlen = ($sourceLength > $binLength) ? $binLength : $sourceLength; - - for ($i = 0; $i < $maxlen; $i++) { - if (ord($source[$i]) < 32) { - $predictedSourceType = 'String'; - break; - } - } - } - - // Uploaded image (array uploads not supported) - if (isset($_FILES[$source]) && isset($_FILES[$source]['tmp_name'])) { - $predictedSourceType = 'Upload'; - } - - // Otherwise, must be a file or an URL - if (!$predictedSourceType) { - $predictedSourceType = 'File'; - } - - return call_user_func(array(__CLASS__, 'loadFrom' . $predictedSourceType), $source); - } - - /** - * Create and load an image from a file or URL. The image format is auto-detected. - * - * @param string $uri File or url - * @return \WideImage\Image|\WideImage\PaletteImage|\WideImage\TrueColorImage - */ - public static function loadFromFile($uri) - { - $data = file_get_contents($uri); - $handle = @imagecreatefromstring($data); - - if (!static::isValidImageHandle($handle)) { - try { - // try to find a mapper first - $mapper = MapperFactory::selectMapper($uri); - - if ($mapper) { - $handle = $mapper->load($uri); - } - } catch (UnsupportedFormatException $e) { - // mapper not found - } - - // try all custom mappers - if (!static::isValidImageHandle($handle)) { - $custom_mappers = MapperFactory::getCustomMappers(); - - foreach ($custom_mappers as $mime_type => $mapper_class) { - $mapper = MapperFactory::selectMapper(null, $mime_type); - $handle = $mapper->loadFromString($data); - - if (static::isValidImageHandle($handle)) { - break; - } - } - } - } - - if (!static::isValidImageHandle($handle)) { - throw new InvalidImageSourceException("File '{$uri}' appears to be an invalid image source."); - } - - return static::loadFromHandle($handle); - } - - /** - * Create and load an image from a string. Format is auto-detected. - * - * @param string $string Binary data, i.e. from BLOB field in the database - * @return \WideImage\Image|\WideImage\PaletteImage|\WideImage\TrueColorImage - */ - public static function loadFromString($string) - { - if (strlen($string) < 128) { - throw new InvalidImageSourceException("String doesn't contain image data."); - } - - $handle = @imagecreatefromstring($string); - - if (!static::isValidImageHandle($handle)) { - $custom_mappers = MapperFactory::getCustomMappers(); - - foreach ($custom_mappers as $mime_type => $mapper_class) { - $mapper = MapperFactory::selectMapper(null, $mime_type); - $handle = $mapper->loadFromString($string); - - if (static::isValidImageHandle($handle)) { - break; - } - } - } - - if (!static::isValidImageHandle($handle)) { - throw new InvalidImageSourceException("String doesn't contain valid image data."); - } - - return static::loadFromHandle($handle); - } - - /** - * Create and load an image from an image handle. - * - * Note: the resulting image object takes ownership of the passed - * handle. When the newly-created image object is destroyed, the handle is - * destroyed too, so it's not a valid image handle anymore. In order to - * preserve the handle for use after object destruction, you have to call - * \WideImage\Image::releaseHandle() on the created image instance prior to its - * destruction. - * - * - * $handle = imagecreatefrompng('file.png'); - * $image = WideImage::loadFromHandle($handle); - * - * - * @param resource $handle A valid GD image resource - * @return \WideImage\Image|\WideImage\PaletteImage|\WideImage\TrueColorImage - */ - public static function loadFromHandle($handle) - { - if (!static::isValidImageHandle($handle)) { - throw new InvalidImageSourceException("Handle is not a valid GD image resource."); - } - - if (imageistruecolor($handle)) { - return new TrueColorImage($handle); - } - - return new PaletteImage($handle); - } - - /** - * This method loads a file from the $_FILES array. The image format is auto-detected. - * - * You only have to pass the field name as the parameter. For array fields, this function will - * return an array of image objects, unless you specify the $index parameter, which will - * load the desired image. - * - * @param $field_name Name of the key in $_FILES array - * @param int $index The index of the file to load (if the input field is an array) - * @return \WideImage\Image The loaded image - */ - public static function loadFromUpload($field_name, $index = null) - { - if (!array_key_exists($field_name, $_FILES)) { - throw new InvalidImageSourceException("Upload field '{$field_name}' doesn't exist."); - } - - if (is_array($_FILES[$field_name]['tmp_name'])) { - if (isset($_FILES[$field_name]['tmp_name'][$index])) { - $filename = $_FILES[$field_name]['tmp_name'][$index]; - } else { - $result = array(); - - foreach ($_FILES[$field_name]['tmp_name'] as $idx => $tmp_name) { - $result[$idx] = static::loadFromFile($tmp_name); - } - - return $result; - } - } else { - $filename = $_FILES[$field_name]['tmp_name']; - } - - if (!file_exists($filename)) { - throw new InvalidImageSourceException("Uploaded file doesn't exist."); - } - - return static::loadFromFile($filename); - } - - /** - * Factory method for creating a palette image - * - * @param int $width - * @param int $height - * @return \WideImage\PaletteImage - */ - public static function createPaletteImage($width, $height) - { - return PaletteImage::create($width, $height); - } - - /** - * Factory method for creating a true-color image - * - * @param int $width - * @param int $height - * @return \WideImage\TrueColorImage - */ - public static function createTrueColorImage($width, $height) - { - return TrueColorImage::create($width, $height); - } - - /** - * Check whether the given handle is a valid GD resource - * - * @param mixed $handle The variable to check - * @return bool - */ - public static function isValidImageHandle($handle) - { - return (is_resource($handle) && get_resource_type($handle) == 'gd'); - } - - /** - * Throws exception if the handle isn't a valid GD resource - * - * @param mixed $handle The variable to check - */ - public static function assertValidImageHandle($handle) - { - if (!static::isValidImageHandle($handle)) { - throw new InvalidImageHandleException("{$handle} is not a valid image handle."); - } - } -} - -WideImage::checkGD(); - -WideImage::registerCustomMapper('\\WideImage\\Mapper\\BMP', 'image/bmp', 'bmp'); -WideImage::registerCustomMapper('\\WideImage\\Mapper\\TGA', 'image/tga', 'tga'); - \ No newline at end of file diff --git a/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/vendor/de77/BMP.php b/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/vendor/de77/BMP.php deleted file mode 100644 index bffeb12..0000000 --- a/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/vendor/de77/BMP.php +++ /dev/null @@ -1,256 +0,0 @@ -= 0; $y--) { - for ($x = 0; $x < $wid; $x++) { - $rgb = imagecolorat($img, $x, $y); - fwrite($f, self::byte3($rgb)); - } - - fwrite($f, $wid_pad); - } - - fclose($f); - } else { - foreach ($header as $h) { - echo $h; - } - - //save pixels - for ($y = $hei-1; $y >= 0; $y--) { - for ($x = 0; $x < $wid; $x++) { - $rgb = imagecolorat($img, $x, $y); - echo self::byte3($rgb); - } - - echo $wid_pad; - } - } - - return true; - } - - public static function imagecreatefromstring($data) - { - //read header - $pos = 0; - $header = substr($data, 0, 54); - $pos = 54; - - if (strlen($header) < 54) { - return false; - } - - $header = unpack( 'c2identifier/Vfile_size/Vreserved/Vbitmap_data/Vheader_size/' . - 'Vwidth/Vheight/vplanes/vbits_per_pixel/Vcompression/Vdata_size/'. - 'Vh_resolution/Vv_resolution/Vcolors/Vimportant_colors', $header); - - if ($header['identifier1'] != 66 or $header['identifier2'] != 77) { - return false; - } - - if (!in_array($header['bits_per_pixel'], array(24, 32, 8, 4, 1))) { - return false; - } - - $bps = $header['bits_per_pixel']; //bits per pixel - $wid2 = ceil(($bps/8 * $header['width']) / 4) * 4; - $colors = pow(2, $bps); - - $wid = $header['width']; - $hei = $header['height']; - - $img = imagecreatetruecolor($header['width'], $header['height']); - - //read palette - if ($bps < 9) { - for ($i = 0; $i < $colors; $i++) { - $palette[] = self::undword(substr($data, $pos, 4)); - $pos += 4; - } - } else { - if ($bps == 32) { - imagealphablending($img, false); - imagesavealpha($img, true); - } - - $palette = array(); - } - - //read pixels - for ($y = $hei-1; $y >= 0; $y--) { - $row = substr($data, $pos, $wid2); - $pos += $wid2; - $pixels = self::str_split2($row, $bps, $palette); - - for ($x = 0; $x < $wid; $x++) { - self::makepixel($img, $x, $y, $pixels[$x], $bps); - } - } - - return $img; - } - - public static function imagecreatefrombmp($filename) - { - return self::imagecreatefromstring(file_get_contents($filename)); - } - - private static function str_split2($row, $bps, $palette) - { - switch ($bps) { - case 32: - case 24: return str_split($row, $bps / 8); - case 8: $out = array(); - $count = strlen($row); - - for ($i = 0; $i < $count; $i++) { - $out[] = $palette[ ord($row[$i]) ]; - } - - return $out; - case 4: $out = array(); - $count = strlen($row); - - for ($i = 0; $i < $count; $i++) { - $roww = ord($row[$i]); - $out[] = $palette[ ($roww & 240) >> 4 ]; - $out[] = $palette[ ($roww & 15) ]; - } - - return $out; - case 1: $out = array(); - $count = strlen($row); - - for ($i = 0; $i < $count; $i++) { - $roww = ord($row[$i]); - $out[] = $palette[ ($roww & 128) >> 7 ]; - $out[] = $palette[ ($roww & 64) >> 6 ]; - $out[] = $palette[ ($roww & 32) >> 5 ]; - $out[] = $palette[ ($roww & 16) >> 4 ]; - $out[] = $palette[ ($roww & 8) >> 3 ]; - $out[] = $palette[ ($roww & 4) >> 2 ]; - $out[] = $palette[ ($roww & 2) >> 1 ]; - $out[] = $palette[ ($roww & 1) ]; - } - - return $out; - } - } - - private static function makepixel($img, $x, $y, $str, $bps) - { - switch ($bps) { - case 32 : $a = ord($str[0]); - $b = ord($str[1]); - $c = ord($str[2]); - $d = 256 - ord($str[3]); //TODO: gives imperfect results - $pixel = $d*256*256*256 + $c*256*256 + $b*256 + $a; - imagesetpixel($img, $x, $y, $pixel); - break; - case 24 : $a = ord($str[0]); - $b = ord($str[1]); - $c = ord($str[2]); - $pixel = $c*256*256 + $b*256 + $a; - imagesetpixel($img, $x, $y, $pixel); - break; - case 8 : - case 4 : - case 1 : imagesetpixel($img, $x, $y, $str); - break; - } - } - - private static function byte3($n) - { - return chr($n & 255) . chr(($n >> 8) & 255) . chr(($n >> 16) & 255); - } - - private static function undword($n) - { - $r = unpack("V", $n); - return $r[1]; - } - - private static function dword($n) - { - return pack("V", $n); - } - - private static function word($n) - { - return pack("v", $n); - } -} diff --git a/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/vendor/de77/TGA.php b/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/vendor/de77/TGA.php deleted file mode 100644 index 348f122..0000000 --- a/sitecake/2.2.9/server/vendor/smottt/wideimage/lib/WideImage/vendor/de77/TGA.php +++ /dev/null @@ -1,189 +0,0 @@ -= $datalen) { - break; - } - - $i++; - - if ($type == 0) { //raw - for ($j = 0; $j < (3 * $value); $j++) { - $out .= $data[$j+$i]; - $k++; - } - - $i += $value * 3; - } else { //rle - for ($j = 0; $j < $value; $j++) { - $out .= $data[$i] . $data[$i+1] . $data[$i+2]; - $k++; - } - - $i += 3; - } - } - - return $out; - } - - public static function dec_bits($byte, &$type, &$value) - { - $type = ($byte & 0x80) >> 7; - $value = 1 + ($byte & 0x7F); - } - - public static function imagecreatefromstring($bin_data) - { - $bin_pos = 0; - $header = substr($bin_data, $bin_pos, 18); - $bin_pos += 18; - $header = unpack( "cimage_id_len/ccolor_map_type/cimage_type/vcolor_map_origin/vcolor_map_len/" . - "ccolor_map_entry_size/vx_origin/vy_origin/vwidth/vheight/" . - "cpixel_size/cdescriptor", $header); - - switch ($header['image_type']) { - case 2: //no palette, uncompressed - case 10: //no palette, rle - break; - default: return false; - } - - if ($header['pixel_size'] != 24) { - return false; - //die('Unsupported TGA color depth'); - } - - $bytes = $header['pixel_size'] / 8; - - if ($header['image_id_len'] > 0) { - $header['image_id'] = substr($bin_data, $bin_pos, $header['image_id_len']); - $bin_pos += $header['image_id_len']; - } else { - $header['image_id'] = ''; - } - - $im = imagecreatetruecolor($header['width'], $header['height']); - - $size = $header['width'] * $header['height'] * 3; - - //-- check whether this is NEW TGA or not - $pos = $bin_pos; - $bin_pos = strlen($bin_data) - 26; - $newtga = substr($bin_data, $bin_pos, 26); - - if (substr($newtga, 8, 16) != 'TRUEVISION-XFILE') { - $newtga = false; - } - - $bin_pos = strlen($bin_data); - $datasize = $bin_pos - $pos; - - if ($newtga) { - $datasize -= 26; - } - - $bin_pos = $pos; - - //-- end of check - $data = substr($bin_data, $bin_pos, $datasize); - $bin_pos += $datasize; - - if ($header['image_type'] == 10) { - $data = self::rle_decode($data, $size); - } - - $reverse = self::bit5($header['descriptor']) == 1; - $pixels = str_split($data, 3); - - $i = 0; - - //read pixels - if ($reverse) { - for ($y = 0; $y < $header['height']; $y++) { - for ($x = 0; $x < $header['width']; $x++) { - imagesetpixel($im, $x, $y, self::dwordize($pixels[$i])); - $i++; - } - } - } else { - for ($y = $header['height']-1; $y >= 0; $y--) { - for ($x=0; $x<$header['width']; $x++) { - imagesetpixel($im, $x, $y, self::dwordize($pixels[$i])); - $i++; - } - } - } - - return $im; - } - - public static function imagecreatefromtga($filename) - { - return self::imagecreatefromstring(file_get_contents($filename)); - } - - public static function dwordize($str) - { - $a = ord($str[0]); - $b = ord($str[1]); - $c = ord($str[2]); - - return $c*256*256 + $b*256 + $a; - } - - public static function bit5($x) - { - return ($x & 32) >> 5; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/config/CHANGELOG.md b/sitecake/2.2.9/server/vendor/symfony/config/CHANGELOG.md deleted file mode 100644 index e1b19e6..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/config/CHANGELOG.md +++ /dev/null @@ -1,27 +0,0 @@ -CHANGELOG -========= - -2.7.0 ------ - - * added `ConfigCacheInterface`, `ConfigCacheFactoryInterface` and a basic `ConfigCacheFactory` - implementation to delegate creation of ConfigCache instances - -2.2.0 ------ - - * added ArrayNodeDefinition::canBeEnabled() and ArrayNodeDefinition::canBeDisabled() - to ease configuration when some sections are respectively disabled / enabled - by default. - * added a `normalizeKeys()` method for array nodes (to avoid key normalization) - * added numerical type handling for config definitions - * added convenience methods for optional configuration sections to ArrayNodeDefinition - * added a utils class for XML manipulations - -2.1.0 ------ - - * added a way to add documentation on configuration - * implemented `Serializable` on resources - * LoaderResolverInterface is now used instead of LoaderResolver for type - hinting diff --git a/sitecake/2.2.9/server/vendor/symfony/config/ConfigCache.php b/sitecake/2.2.9/server/vendor/symfony/config/ConfigCache.php deleted file mode 100644 index 1f6e07c..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/config/ConfigCache.php +++ /dev/null @@ -1,137 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config; - -use Symfony\Component\Config\Resource\ResourceInterface; -use Symfony\Component\Filesystem\Exception\IOException; -use Symfony\Component\Filesystem\Filesystem; - -/** - * ConfigCache manages PHP cache files. - * - * When debug is enabled, it knows when to flush the cache - * thanks to an array of ResourceInterface instances. - * - * @author Fabien Potencier - */ -class ConfigCache implements ConfigCacheInterface -{ - private $debug; - private $file; - - /** - * @param string $file The absolute cache path - * @param bool $debug Whether debugging is enabled or not - */ - public function __construct($file, $debug) - { - $this->file = $file; - $this->debug = (bool) $debug; - } - - /** - * Gets the cache file path. - * - * @return string The cache file path - * @deprecated since 2.7, to be removed in 3.0. Use getPath() instead. - */ - public function __toString() - { - @trigger_error('ConfigCache::__toString() is deprecated since version 2.7 and will be removed in 3.0. Use the getPath() method instead.', E_USER_DEPRECATED); - - return $this->file; - } - - /** - * Gets the cache file path. - * - * @return string The cache file path - */ - public function getPath() - { - return $this->file; - } - - /** - * Checks if the cache is still fresh. - * - * This method always returns true when debug is off and the - * cache file exists. - * - * @return bool true if the cache is fresh, false otherwise - */ - public function isFresh() - { - if (!is_file($this->file)) { - return false; - } - - if (!$this->debug) { - return true; - } - - $metadata = $this->getMetaFile(); - if (!is_file($metadata)) { - return false; - } - - $time = filemtime($this->file); - $meta = unserialize(file_get_contents($metadata)); - foreach ($meta as $resource) { - if (!$resource->isFresh($time)) { - return false; - } - } - - return true; - } - - /** - * Writes cache. - * - * @param string $content The content to write in the cache - * @param ResourceInterface[] $metadata An array of ResourceInterface instances - * - * @throws \RuntimeException When cache file can't be written - */ - public function write($content, array $metadata = null) - { - $mode = 0666; - $umask = umask(); - $filesystem = new Filesystem(); - $filesystem->dumpFile($this->file, $content, null); - try { - $filesystem->chmod($this->file, $mode, $umask); - } catch (IOException $e) { - // discard chmod failure (some filesystem may not support it) - } - - if (null !== $metadata && true === $this->debug) { - $filesystem->dumpFile($this->getMetaFile(), serialize($metadata), null); - try { - $filesystem->chmod($this->getMetaFile(), $mode, $umask); - } catch (IOException $e) { - // discard chmod failure (some filesystem may not support it) - } - } - } - - /** - * Gets the meta file path. - * - * @return string The meta file path - */ - private function getMetaFile() - { - return $this->file.'.meta'; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/config/ConfigCacheFactory.php b/sitecake/2.2.9/server/vendor/symfony/config/ConfigCacheFactory.php deleted file mode 100644 index 5a8f456..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/config/ConfigCacheFactory.php +++ /dev/null @@ -1,51 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config; - -/** - * Basic implementation for ConfigCacheFactoryInterface - * that will simply create an instance of ConfigCache. - * - * @author Matthias Pigulla - */ -class ConfigCacheFactory implements ConfigCacheFactoryInterface -{ - /** - * @var bool Debug flag passed to the ConfigCache - */ - private $debug; - - /** - * @param bool $debug The debug flag to pass to ConfigCache - */ - public function __construct($debug) - { - $this->debug = $debug; - } - - /** - * {@inheritdoc} - */ - public function cache($file, $callback) - { - if (!is_callable($callback)) { - throw new \InvalidArgumentException(sprintf('Invalid type for callback argument. Expected callable, but got "%s".', gettype($callback))); - } - - $cache = new ConfigCache($file, $this->debug); - if (!$cache->isFresh()) { - call_user_func($callback, $cache); - } - - return $cache; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/config/ConfigCacheFactoryInterface.php b/sitecake/2.2.9/server/vendor/symfony/config/ConfigCacheFactoryInterface.php deleted file mode 100644 index 750d2cc..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/config/ConfigCacheFactoryInterface.php +++ /dev/null @@ -1,32 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config; - -/** - * Interface for a ConfigCache factory. This factory creates - * an instance of ConfigCacheInterface and initializes the - * cache if necessary. - * - * @author Matthias Pigulla - */ -interface ConfigCacheFactoryInterface -{ - /** - * Creates a cache instance and (re-)initializes it if necessary. - * - * @param string $file The absolute cache file path - * @param callable $callable The callable to be executed when the cache needs to be filled (i. e. is not fresh). The cache will be passed as the only parameter to this callback - * - * @return ConfigCacheInterface $configCache The cache instance - */ - public function cache($file, $callable); -} diff --git a/sitecake/2.2.9/server/vendor/symfony/config/ConfigCacheInterface.php b/sitecake/2.2.9/server/vendor/symfony/config/ConfigCacheInterface.php deleted file mode 100644 index 067e2a1..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/config/ConfigCacheInterface.php +++ /dev/null @@ -1,49 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config; - -use Symfony\Component\Config\Resource\ResourceInterface; - -/** - * Interface for ConfigCache - * - * @author Matthias Pigulla - */ -interface ConfigCacheInterface -{ - /** - * Gets the cache file path. - * - * @return string The cache file path - */ - public function getPath(); - - /** - * Checks if the cache is still fresh. - * - * This check should take the metadata passed to the write() method into consideration. - * - * @return bool Whether the cache is still fresh. - */ - public function isFresh(); - - /** - * Writes the given content into the cache file. Metadata will be stored - * independently and can be used to check cache freshness at a later time. - * - * @param string $content The content to write into the cache - * @param ResourceInterface[]|null $metadata An array of ResourceInterface instances - * - * @throws \RuntimeException When the cache file cannot be written - */ - public function write($content, array $metadata = null); -} diff --git a/sitecake/2.2.9/server/vendor/symfony/config/Definition/ArrayNode.php b/sitecake/2.2.9/server/vendor/symfony/config/Definition/ArrayNode.php deleted file mode 100644 index 5deb472..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/config/Definition/ArrayNode.php +++ /dev/null @@ -1,393 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition; - -use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException; -use Symfony\Component\Config\Definition\Exception\InvalidTypeException; -use Symfony\Component\Config\Definition\Exception\UnsetKeyException; - -/** - * Represents an Array node in the config tree. - * - * @author Johannes M. Schmitt - */ -class ArrayNode extends BaseNode implements PrototypeNodeInterface -{ - protected $xmlRemappings = array(); - protected $children = array(); - protected $allowFalse = false; - protected $allowNewKeys = true; - protected $addIfNotSet = false; - protected $performDeepMerging = true; - protected $ignoreExtraKeys = false; - protected $normalizeKeys = true; - - public function setNormalizeKeys($normalizeKeys) - { - $this->normalizeKeys = (bool) $normalizeKeys; - } - - /** - * Normalizes keys between the different configuration formats. - * - * Namely, you mostly have foo_bar in YAML while you have foo-bar in XML. - * After running this method, all keys are normalized to foo_bar. - * - * If you have a mixed key like foo-bar_moo, it will not be altered. - * The key will also not be altered if the target key already exists. - * - * @param mixed $value - * - * @return array The value with normalized keys - */ - protected function preNormalize($value) - { - if (!$this->normalizeKeys || !is_array($value)) { - return $value; - } - - foreach ($value as $k => $v) { - if (false !== strpos($k, '-') && false === strpos($k, '_') && !array_key_exists($normalizedKey = str_replace('-', '_', $k), $value)) { - $value[$normalizedKey] = $v; - unset($value[$k]); - } - } - - return $value; - } - - /** - * Retrieves the children of this node. - * - * @return array The children - */ - public function getChildren() - { - return $this->children; - } - - /** - * Sets the xml remappings that should be performed. - * - * @param array $remappings an array of the form array(array(string, string)) - */ - public function setXmlRemappings(array $remappings) - { - $this->xmlRemappings = $remappings; - } - - /** - * Gets the xml remappings that should be performed. - * - * @return array $remappings an array of the form array(array(string, string)) - */ - public function getXmlRemappings() - { - return $this->xmlRemappings; - } - - /** - * Sets whether to add default values for this array if it has not been - * defined in any of the configuration files. - * - * @param bool $boolean - */ - public function setAddIfNotSet($boolean) - { - $this->addIfNotSet = (bool) $boolean; - } - - /** - * Sets whether false is allowed as value indicating that the array should be unset. - * - * @param bool $allow - */ - public function setAllowFalse($allow) - { - $this->allowFalse = (bool) $allow; - } - - /** - * Sets whether new keys can be defined in subsequent configurations. - * - * @param bool $allow - */ - public function setAllowNewKeys($allow) - { - $this->allowNewKeys = (bool) $allow; - } - - /** - * Sets if deep merging should occur. - * - * @param bool $boolean - */ - public function setPerformDeepMerging($boolean) - { - $this->performDeepMerging = (bool) $boolean; - } - - /** - * Whether extra keys should just be ignore without an exception. - * - * @param bool $boolean To allow extra keys - */ - public function setIgnoreExtraKeys($boolean) - { - $this->ignoreExtraKeys = (bool) $boolean; - } - - /** - * Sets the node Name. - * - * @param string $name The node's name - */ - public function setName($name) - { - $this->name = $name; - } - - /** - * Checks if the node has a default value. - * - * @return bool - */ - public function hasDefaultValue() - { - return $this->addIfNotSet; - } - - /** - * Retrieves the default value. - * - * @return array The default value - * - * @throws \RuntimeException if the node has no default value - */ - public function getDefaultValue() - { - if (!$this->hasDefaultValue()) { - throw new \RuntimeException(sprintf('The node at path "%s" has no default value.', $this->getPath())); - } - - $defaults = array(); - foreach ($this->children as $name => $child) { - if ($child->hasDefaultValue()) { - $defaults[$name] = $child->getDefaultValue(); - } - } - - return $defaults; - } - - /** - * Adds a child node. - * - * @param NodeInterface $node The child node to add - * - * @throws \InvalidArgumentException when the child node has no name - * @throws \InvalidArgumentException when the child node's name is not unique - */ - public function addChild(NodeInterface $node) - { - $name = $node->getName(); - if (!strlen($name)) { - throw new \InvalidArgumentException('Child nodes must be named.'); - } - if (isset($this->children[$name])) { - throw new \InvalidArgumentException(sprintf('A child node named "%s" already exists.', $name)); - } - - $this->children[$name] = $node; - } - - /** - * Finalizes the value of this node. - * - * @param mixed $value - * - * @return mixed The finalised value - * - * @throws UnsetKeyException - * @throws InvalidConfigurationException if the node doesn't have enough children - */ - protected function finalizeValue($value) - { - if (false === $value) { - $msg = sprintf('Unsetting key for path "%s", value: %s', $this->getPath(), json_encode($value)); - throw new UnsetKeyException($msg); - } - - foreach ($this->children as $name => $child) { - if (!array_key_exists($name, $value)) { - if ($child->isRequired()) { - $msg = sprintf('The child node "%s" at path "%s" must be configured.', $name, $this->getPath()); - $ex = new InvalidConfigurationException($msg); - $ex->setPath($this->getPath()); - - throw $ex; - } - - if ($child->hasDefaultValue()) { - $value[$name] = $child->getDefaultValue(); - } - - continue; - } - - try { - $value[$name] = $child->finalize($value[$name]); - } catch (UnsetKeyException $unset) { - unset($value[$name]); - } - } - - return $value; - } - - /** - * Validates the type of the value. - * - * @param mixed $value - * - * @throws InvalidTypeException - */ - protected function validateType($value) - { - if (!is_array($value) && (!$this->allowFalse || false !== $value)) { - $ex = new InvalidTypeException(sprintf( - 'Invalid type for path "%s". Expected array, but got %s', - $this->getPath(), - gettype($value) - )); - if ($hint = $this->getInfo()) { - $ex->addHint($hint); - } - $ex->setPath($this->getPath()); - - throw $ex; - } - } - - /** - * Normalizes the value. - * - * @param mixed $value The value to normalize - * - * @return mixed The normalized value - * - * @throws InvalidConfigurationException - */ - protected function normalizeValue($value) - { - if (false === $value) { - return $value; - } - - $value = $this->remapXml($value); - - $normalized = array(); - foreach ($value as $name => $val) { - if (isset($this->children[$name])) { - $normalized[$name] = $this->children[$name]->normalize($val); - unset($value[$name]); - } - } - - // if extra fields are present, throw exception - if (count($value) && !$this->ignoreExtraKeys) { - $msg = sprintf('Unrecognized option%s "%s" under "%s"', 1 === count($value) ? '' : 's', implode(', ', array_keys($value)), $this->getPath()); - $ex = new InvalidConfigurationException($msg); - $ex->setPath($this->getPath()); - - throw $ex; - } - - return $normalized; - } - - /** - * Remaps multiple singular values to a single plural value. - * - * @param array $value The source values - * - * @return array The remapped values - */ - protected function remapXml($value) - { - foreach ($this->xmlRemappings as $transformation) { - list($singular, $plural) = $transformation; - - if (!isset($value[$singular])) { - continue; - } - - $value[$plural] = Processor::normalizeConfig($value, $singular, $plural); - unset($value[$singular]); - } - - return $value; - } - - /** - * Merges values together. - * - * @param mixed $leftSide The left side to merge. - * @param mixed $rightSide The right side to merge. - * - * @return mixed The merged values - * - * @throws InvalidConfigurationException - * @throws \RuntimeException - */ - protected function mergeValues($leftSide, $rightSide) - { - if (false === $rightSide) { - // if this is still false after the last config has been merged the - // finalization pass will take care of removing this key entirely - return false; - } - - if (false === $leftSide || !$this->performDeepMerging) { - return $rightSide; - } - - foreach ($rightSide as $k => $v) { - // no conflict - if (!array_key_exists($k, $leftSide)) { - if (!$this->allowNewKeys) { - $ex = new InvalidConfigurationException(sprintf( - 'You are not allowed to define new elements for path "%s". ' - .'Please define all elements for this path in one config file. ' - .'If you are trying to overwrite an element, make sure you redefine it ' - .'with the same name.', - $this->getPath() - )); - $ex->setPath($this->getPath()); - - throw $ex; - } - - $leftSide[$k] = $v; - continue; - } - - if (!isset($this->children[$k])) { - throw new \RuntimeException('merge() expects a normalized config array.'); - } - - $leftSide[$k] = $this->children[$k]->merge($leftSide[$k], $v); - } - - return $leftSide; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/config/Definition/BaseNode.php b/sitecake/2.2.9/server/vendor/symfony/config/Definition/BaseNode.php deleted file mode 100644 index afccc1c..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/config/Definition/BaseNode.php +++ /dev/null @@ -1,360 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition; - -use Symfony\Component\Config\Definition\Exception\Exception; -use Symfony\Component\Config\Definition\Exception\ForbiddenOverwriteException; -use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException; -use Symfony\Component\Config\Definition\Exception\InvalidTypeException; - -/** - * The base node class. - * - * @author Johannes M. Schmitt - */ -abstract class BaseNode implements NodeInterface -{ - protected $name; - protected $parent; - protected $normalizationClosures = array(); - protected $finalValidationClosures = array(); - protected $allowOverwrite = true; - protected $required = false; - protected $equivalentValues = array(); - protected $attributes = array(); - - /** - * Constructor. - * - * @param string $name The name of the node - * @param NodeInterface $parent The parent of this node - * - * @throws \InvalidArgumentException if the name contains a period. - */ - public function __construct($name, NodeInterface $parent = null) - { - if (false !== strpos($name, '.')) { - throw new \InvalidArgumentException('The name must not contain ".".'); - } - - $this->name = $name; - $this->parent = $parent; - } - - public function setAttribute($key, $value) - { - $this->attributes[$key] = $value; - } - - public function getAttribute($key, $default = null) - { - return isset($this->attributes[$key]) ? $this->attributes[$key] : $default; - } - - public function hasAttribute($key) - { - return isset($this->attributes[$key]); - } - - public function getAttributes() - { - return $this->attributes; - } - - public function setAttributes(array $attributes) - { - $this->attributes = $attributes; - } - - public function removeAttribute($key) - { - unset($this->attributes[$key]); - } - - /** - * Sets an info message. - * - * @param string $info - */ - public function setInfo($info) - { - $this->setAttribute('info', $info); - } - - /** - * Returns info message. - * - * @return string The info text - */ - public function getInfo() - { - return $this->getAttribute('info'); - } - - /** - * Sets the example configuration for this node. - * - * @param string|array $example - */ - public function setExample($example) - { - $this->setAttribute('example', $example); - } - - /** - * Retrieves the example configuration for this node. - * - * @return string|array The example - */ - public function getExample() - { - return $this->getAttribute('example'); - } - - /** - * Adds an equivalent value. - * - * @param mixed $originalValue - * @param mixed $equivalentValue - */ - public function addEquivalentValue($originalValue, $equivalentValue) - { - $this->equivalentValues[] = array($originalValue, $equivalentValue); - } - - /** - * Set this node as required. - * - * @param bool $boolean Required node - */ - public function setRequired($boolean) - { - $this->required = (bool) $boolean; - } - - /** - * Sets if this node can be overridden. - * - * @param bool $allow - */ - public function setAllowOverwrite($allow) - { - $this->allowOverwrite = (bool) $allow; - } - - /** - * Sets the closures used for normalization. - * - * @param \Closure[] $closures An array of Closures used for normalization - */ - public function setNormalizationClosures(array $closures) - { - $this->normalizationClosures = $closures; - } - - /** - * Sets the closures used for final validation. - * - * @param \Closure[] $closures An array of Closures used for final validation - */ - public function setFinalValidationClosures(array $closures) - { - $this->finalValidationClosures = $closures; - } - - /** - * Checks if this node is required. - * - * @return bool - */ - public function isRequired() - { - return $this->required; - } - - /** - * Returns the name of this node. - * - * @return string The Node's name. - */ - public function getName() - { - return $this->name; - } - - /** - * Retrieves the path of this node. - * - * @return string The Node's path - */ - public function getPath() - { - $path = $this->name; - - if (null !== $this->parent) { - $path = $this->parent->getPath().'.'.$path; - } - - return $path; - } - - /** - * Merges two values together. - * - * @param mixed $leftSide - * @param mixed $rightSide - * - * @return mixed The merged value - * - * @throws ForbiddenOverwriteException - */ - final public function merge($leftSide, $rightSide) - { - if (!$this->allowOverwrite) { - throw new ForbiddenOverwriteException(sprintf( - 'Configuration path "%s" cannot be overwritten. You have to ' - .'define all options for this path, and any of its sub-paths in ' - .'one configuration section.', - $this->getPath() - )); - } - - $this->validateType($leftSide); - $this->validateType($rightSide); - - return $this->mergeValues($leftSide, $rightSide); - } - - /** - * Normalizes a value, applying all normalization closures. - * - * @param mixed $value Value to normalize. - * - * @return mixed The normalized value. - */ - final public function normalize($value) - { - $value = $this->preNormalize($value); - - // run custom normalization closures - foreach ($this->normalizationClosures as $closure) { - $value = $closure($value); - } - - // replace value with their equivalent - foreach ($this->equivalentValues as $data) { - if ($data[0] === $value) { - $value = $data[1]; - } - } - - // validate type - $this->validateType($value); - - // normalize value - return $this->normalizeValue($value); - } - - /** - * Normalizes the value before any other normalization is applied. - * - * @param $value - * - * @return $value The normalized array value - */ - protected function preNormalize($value) - { - return $value; - } - - /** - * Returns parent node for this node. - * - * @return NodeInterface|null - */ - public function getParent() - { - return $this->parent; - } - - /** - * Finalizes a value, applying all finalization closures. - * - * @param mixed $value The value to finalize - * - * @return mixed The finalized value - * - * @throws Exception - * @throws InvalidConfigurationException - */ - final public function finalize($value) - { - $this->validateType($value); - - $value = $this->finalizeValue($value); - - // Perform validation on the final value if a closure has been set. - // The closure is also allowed to return another value. - foreach ($this->finalValidationClosures as $closure) { - try { - $value = $closure($value); - } catch (Exception $correctEx) { - throw $correctEx; - } catch (\Exception $invalid) { - throw new InvalidConfigurationException(sprintf( - 'Invalid configuration for path "%s": %s', - $this->getPath(), - $invalid->getMessage() - ), $invalid->getCode(), $invalid); - } - } - - return $value; - } - - /** - * Validates the type of a Node. - * - * @param mixed $value The value to validate - * - * @throws InvalidTypeException when the value is invalid - */ - abstract protected function validateType($value); - - /** - * Normalizes the value. - * - * @param mixed $value The value to normalize. - * - * @return mixed The normalized value - */ - abstract protected function normalizeValue($value); - - /** - * Merges two values together. - * - * @param mixed $leftSide - * @param mixed $rightSide - * - * @return mixed The merged value - */ - abstract protected function mergeValues($leftSide, $rightSide); - - /** - * Finalizes a value. - * - * @param mixed $value The value to finalize - * - * @return mixed The finalized value - */ - abstract protected function finalizeValue($value); -} diff --git a/sitecake/2.2.9/server/vendor/symfony/config/Definition/BooleanNode.php b/sitecake/2.2.9/server/vendor/symfony/config/Definition/BooleanNode.php deleted file mode 100644 index df06b30..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/config/Definition/BooleanNode.php +++ /dev/null @@ -1,42 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition; - -use Symfony\Component\Config\Definition\Exception\InvalidTypeException; - -/** - * This node represents a Boolean value in the config tree. - * - * @author Johannes M. Schmitt - */ -class BooleanNode extends ScalarNode -{ - /** - * {@inheritdoc} - */ - protected function validateType($value) - { - if (!is_bool($value)) { - $ex = new InvalidTypeException(sprintf( - 'Invalid type for path "%s". Expected boolean, but got %s.', - $this->getPath(), - gettype($value) - )); - if ($hint = $this->getInfo()) { - $ex->addHint($hint); - } - $ex->setPath($this->getPath()); - - throw $ex; - } - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/config/Definition/Builder/ArrayNodeDefinition.php b/sitecake/2.2.9/server/vendor/symfony/config/Definition/Builder/ArrayNodeDefinition.php deleted file mode 100644 index c64b2ec..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/config/Definition/Builder/ArrayNodeDefinition.php +++ /dev/null @@ -1,489 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition\Builder; - -use Symfony\Component\Config\Definition\ArrayNode; -use Symfony\Component\Config\Definition\PrototypedArrayNode; -use Symfony\Component\Config\Definition\Exception\InvalidDefinitionException; - -/** - * This class provides a fluent interface for defining an array node. - * - * @author Johannes M. Schmitt - */ -class ArrayNodeDefinition extends NodeDefinition implements ParentNodeDefinitionInterface -{ - protected $performDeepMerging = true; - protected $ignoreExtraKeys = false; - protected $children = array(); - protected $prototype; - protected $atLeastOne = false; - protected $allowNewKeys = true; - protected $key; - protected $removeKeyItem; - protected $addDefaults = false; - protected $addDefaultChildren = false; - protected $nodeBuilder; - protected $normalizeKeys = true; - - /** - * {@inheritdoc} - */ - public function __construct($name, NodeParentInterface $parent = null) - { - parent::__construct($name, $parent); - - $this->nullEquivalent = array(); - $this->trueEquivalent = array(); - } - - /** - * Sets a custom children builder. - * - * @param NodeBuilder $builder A custom NodeBuilder - */ - public function setBuilder(NodeBuilder $builder) - { - $this->nodeBuilder = $builder; - } - - /** - * Returns a builder to add children nodes. - * - * @return NodeBuilder - */ - public function children() - { - return $this->getNodeBuilder(); - } - - /** - * Sets a prototype for child nodes. - * - * @param string $type the type of node - * - * @return NodeDefinition - */ - public function prototype($type) - { - return $this->prototype = $this->getNodeBuilder()->node(null, $type)->setParent($this); - } - - /** - * Adds the default value if the node is not set in the configuration. - * - * This method is applicable to concrete nodes only (not to prototype nodes). - * If this function has been called and the node is not set during the finalization - * phase, it's default value will be derived from its children default values. - * - * @return ArrayNodeDefinition - */ - public function addDefaultsIfNotSet() - { - $this->addDefaults = true; - - return $this; - } - - /** - * Adds children with a default value when none are defined. - * - * @param int|string|array|null $children The number of children|The child name|The children names to be added - * - * This method is applicable to prototype nodes only. - * - * @return ArrayNodeDefinition - */ - public function addDefaultChildrenIfNoneSet($children = null) - { - $this->addDefaultChildren = $children; - - return $this; - } - - /** - * Requires the node to have at least one element. - * - * This method is applicable to prototype nodes only. - * - * @return ArrayNodeDefinition - */ - public function requiresAtLeastOneElement() - { - $this->atLeastOne = true; - - return $this; - } - - /** - * Disallows adding news keys in a subsequent configuration. - * - * If used all keys have to be defined in the same configuration file. - * - * @return ArrayNodeDefinition - */ - public function disallowNewKeysInSubsequentConfigs() - { - $this->allowNewKeys = false; - - return $this; - } - - /** - * Sets a normalization rule for XML configurations. - * - * @param string $singular The key to remap - * @param string $plural The plural of the key for irregular plurals - * - * @return ArrayNodeDefinition - */ - public function fixXmlConfig($singular, $plural = null) - { - $this->normalization()->remap($singular, $plural); - - return $this; - } - - /** - * Sets the attribute which value is to be used as key. - * - * This is useful when you have an indexed array that should be an - * associative array. You can select an item from within the array - * to be the key of the particular item. For example, if "id" is the - * "key", then: - * - * array( - * array('id' => 'my_name', 'foo' => 'bar'), - * ); - * - * becomes - * - * array( - * 'my_name' => array('foo' => 'bar'), - * ); - * - * If you'd like "'id' => 'my_name'" to still be present in the resulting - * array, then you can set the second argument of this method to false. - * - * This method is applicable to prototype nodes only. - * - * @param string $name The name of the key - * @param bool $removeKeyItem Whether or not the key item should be removed. - * - * @return ArrayNodeDefinition - */ - public function useAttributeAsKey($name, $removeKeyItem = true) - { - $this->key = $name; - $this->removeKeyItem = $removeKeyItem; - - return $this; - } - - /** - * Sets whether the node can be unset. - * - * @param bool $allow - * - * @return ArrayNodeDefinition - */ - public function canBeUnset($allow = true) - { - $this->merge()->allowUnset($allow); - - return $this; - } - - /** - * Adds an "enabled" boolean to enable the current section. - * - * By default, the section is disabled. If any configuration is specified then - * the node will be automatically enabled: - * - * enableableArrayNode: {enabled: true, ...} # The config is enabled & default values get overridden - * enableableArrayNode: ~ # The config is enabled & use the default values - * enableableArrayNode: true # The config is enabled & use the default values - * enableableArrayNode: {other: value, ...} # The config is enabled & default values get overridden - * enableableArrayNode: {enabled: false, ...} # The config is disabled - * enableableArrayNode: false # The config is disabled - * - * @return ArrayNodeDefinition - */ - public function canBeEnabled() - { - $this - ->addDefaultsIfNotSet() - ->treatFalseLike(array('enabled' => false)) - ->treatTrueLike(array('enabled' => true)) - ->treatNullLike(array('enabled' => true)) - ->beforeNormalization() - ->ifArray() - ->then(function ($v) { - $v['enabled'] = isset($v['enabled']) ? $v['enabled'] : true; - - return $v; - }) - ->end() - ->children() - ->booleanNode('enabled') - ->defaultFalse() - ; - - return $this; - } - - /** - * Adds an "enabled" boolean to enable the current section. - * - * By default, the section is enabled. - * - * @return ArrayNodeDefinition - */ - public function canBeDisabled() - { - $this - ->addDefaultsIfNotSet() - ->treatFalseLike(array('enabled' => false)) - ->treatTrueLike(array('enabled' => true)) - ->treatNullLike(array('enabled' => true)) - ->children() - ->booleanNode('enabled') - ->defaultTrue() - ; - - return $this; - } - - /** - * Disables the deep merging of the node. - * - * @return ArrayNodeDefinition - */ - public function performNoDeepMerging() - { - $this->performDeepMerging = false; - - return $this; - } - - /** - * Allows extra config keys to be specified under an array without - * throwing an exception. - * - * Those config values are simply ignored and removed from the - * resulting array. This should be used only in special cases where - * you want to send an entire configuration array through a special - * tree that processes only part of the array. - * - * @return ArrayNodeDefinition - */ - public function ignoreExtraKeys() - { - $this->ignoreExtraKeys = true; - - return $this; - } - - /** - * Sets key normalization. - * - * @param bool $bool Whether to enable key normalization - * - * @return ArrayNodeDefinition - */ - public function normalizeKeys($bool) - { - $this->normalizeKeys = (bool) $bool; - - return $this; - } - - /** - * Appends a node definition. - * - * $node = new ArrayNodeDefinition() - * ->children() - * ->scalarNode('foo')->end() - * ->scalarNode('baz')->end() - * ->end() - * ->append($this->getBarNodeDefinition()) - * ; - * - * @param NodeDefinition $node A NodeDefinition instance - * - * @return ArrayNodeDefinition This node - */ - public function append(NodeDefinition $node) - { - $this->children[$node->name] = $node->setParent($this); - - return $this; - } - - /** - * Returns a node builder to be used to add children and prototype. - * - * @return NodeBuilder The node builder - */ - protected function getNodeBuilder() - { - if (null === $this->nodeBuilder) { - $this->nodeBuilder = new NodeBuilder(); - } - - return $this->nodeBuilder->setParent($this); - } - - /** - * {@inheritdoc} - */ - protected function createNode() - { - if (null === $this->prototype) { - $node = new ArrayNode($this->name, $this->parent); - - $this->validateConcreteNode($node); - - $node->setAddIfNotSet($this->addDefaults); - - foreach ($this->children as $child) { - $child->parent = $node; - $node->addChild($child->getNode()); - } - } else { - $node = new PrototypedArrayNode($this->name, $this->parent); - - $this->validatePrototypeNode($node); - - if (null !== $this->key) { - $node->setKeyAttribute($this->key, $this->removeKeyItem); - } - - if (true === $this->atLeastOne) { - $node->setMinNumberOfElements(1); - } - - if ($this->default) { - $node->setDefaultValue($this->defaultValue); - } - - if (false !== $this->addDefaultChildren) { - $node->setAddChildrenIfNoneSet($this->addDefaultChildren); - if ($this->prototype instanceof static && null === $this->prototype->prototype) { - $this->prototype->addDefaultsIfNotSet(); - } - } - - $this->prototype->parent = $node; - $node->setPrototype($this->prototype->getNode()); - } - - $node->setAllowNewKeys($this->allowNewKeys); - $node->addEquivalentValue(null, $this->nullEquivalent); - $node->addEquivalentValue(true, $this->trueEquivalent); - $node->addEquivalentValue(false, $this->falseEquivalent); - $node->setPerformDeepMerging($this->performDeepMerging); - $node->setRequired($this->required); - $node->setIgnoreExtraKeys($this->ignoreExtraKeys); - $node->setNormalizeKeys($this->normalizeKeys); - - if (null !== $this->normalization) { - $node->setNormalizationClosures($this->normalization->before); - $node->setXmlRemappings($this->normalization->remappings); - } - - if (null !== $this->merge) { - $node->setAllowOverwrite($this->merge->allowOverwrite); - $node->setAllowFalse($this->merge->allowFalse); - } - - if (null !== $this->validation) { - $node->setFinalValidationClosures($this->validation->rules); - } - - return $node; - } - - /** - * Validate the configuration of a concrete node. - * - * @param ArrayNode $node The related node - * - * @throws InvalidDefinitionException - */ - protected function validateConcreteNode(ArrayNode $node) - { - $path = $node->getPath(); - - if (null !== $this->key) { - throw new InvalidDefinitionException( - sprintf('->useAttributeAsKey() is not applicable to concrete nodes at path "%s"', $path) - ); - } - - if (true === $this->atLeastOne) { - throw new InvalidDefinitionException( - sprintf('->requiresAtLeastOneElement() is not applicable to concrete nodes at path "%s"', $path) - ); - } - - if ($this->default) { - throw new InvalidDefinitionException( - sprintf('->defaultValue() is not applicable to concrete nodes at path "%s"', $path) - ); - } - - if (false !== $this->addDefaultChildren) { - throw new InvalidDefinitionException( - sprintf('->addDefaultChildrenIfNoneSet() is not applicable to concrete nodes at path "%s"', $path) - ); - } - } - - /** - * Validate the configuration of a prototype node. - * - * @param PrototypedArrayNode $node The related node - * - * @throws InvalidDefinitionException - */ - protected function validatePrototypeNode(PrototypedArrayNode $node) - { - $path = $node->getPath(); - - if ($this->addDefaults) { - throw new InvalidDefinitionException( - sprintf('->addDefaultsIfNotSet() is not applicable to prototype nodes at path "%s"', $path) - ); - } - - if (false !== $this->addDefaultChildren) { - if ($this->default) { - throw new InvalidDefinitionException( - sprintf('A default value and default children might not be used together at path "%s"', $path) - ); - } - - if (null !== $this->key && (null === $this->addDefaultChildren || is_int($this->addDefaultChildren) && $this->addDefaultChildren > 0)) { - throw new InvalidDefinitionException( - sprintf('->addDefaultChildrenIfNoneSet() should set default children names as ->useAttributeAsKey() is used at path "%s"', $path) - ); - } - - if (null === $this->key && (is_string($this->addDefaultChildren) || is_array($this->addDefaultChildren))) { - throw new InvalidDefinitionException( - sprintf('->addDefaultChildrenIfNoneSet() might not set default children names as ->useAttributeAsKey() is not used at path "%s"', $path) - ); - } - } - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/config/Definition/Builder/BooleanNodeDefinition.php b/sitecake/2.2.9/server/vendor/symfony/config/Definition/Builder/BooleanNodeDefinition.php deleted file mode 100644 index db7ebc2..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/config/Definition/Builder/BooleanNodeDefinition.php +++ /dev/null @@ -1,42 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition\Builder; - -use Symfony\Component\Config\Definition\BooleanNode; - -/** - * This class provides a fluent interface for defining a node. - * - * @author Johannes M. Schmitt - */ -class BooleanNodeDefinition extends ScalarNodeDefinition -{ - /** - * {@inheritdoc} - */ - public function __construct($name, NodeParentInterface $parent = null) - { - parent::__construct($name, $parent); - - $this->nullEquivalent = true; - } - - /** - * Instantiate a Node. - * - * @return BooleanNode The node - */ - protected function instantiateNode() - { - return new BooleanNode($this->name, $this->parent); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/config/Definition/Builder/EnumNodeDefinition.php b/sitecake/2.2.9/server/vendor/symfony/config/Definition/Builder/EnumNodeDefinition.php deleted file mode 100644 index dc25fcb..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/config/Definition/Builder/EnumNodeDefinition.php +++ /dev/null @@ -1,58 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition\Builder; - -use Symfony\Component\Config\Definition\EnumNode; - -/** - * Enum Node Definition. - * - * @author Johannes M. Schmitt - */ -class EnumNodeDefinition extends ScalarNodeDefinition -{ - private $values; - - /** - * @param array $values - * - * @return EnumNodeDefinition|$this - */ - public function values(array $values) - { - $values = array_unique($values); - - if (count($values) <= 1) { - throw new \InvalidArgumentException('->values() must be called with at least two distinct values.'); - } - - $this->values = $values; - - return $this; - } - - /** - * Instantiate a Node. - * - * @return EnumNode The node - * - * @throws \RuntimeException - */ - protected function instantiateNode() - { - if (null === $this->values) { - throw new \RuntimeException('You must call ->values() on enum nodes.'); - } - - return new EnumNode($this->name, $this->parent, $this->values); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/config/Definition/Builder/ExprBuilder.php b/sitecake/2.2.9/server/vendor/symfony/config/Definition/Builder/ExprBuilder.php deleted file mode 100644 index 3d79b29..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/config/Definition/Builder/ExprBuilder.php +++ /dev/null @@ -1,238 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition\Builder; - -use Symfony\Component\Config\Definition\Exception\UnsetKeyException; - -/** - * This class builds an if expression. - * - * @author Johannes M. Schmitt - * @author Christophe Coevoet - */ -class ExprBuilder -{ - protected $node; - public $ifPart; - public $thenPart; - - /** - * Constructor. - * - * @param NodeDefinition $node The related node - */ - public function __construct(NodeDefinition $node) - { - $this->node = $node; - } - - /** - * Marks the expression as being always used. - * - * @param \Closure $then - * - * @return ExprBuilder - */ - public function always(\Closure $then = null) - { - $this->ifPart = function ($v) { return true; }; - - if (null !== $then) { - $this->thenPart = $then; - } - - return $this; - } - - /** - * Sets a closure to use as tests. - * - * The default one tests if the value is true. - * - * @param \Closure $closure - * - * @return ExprBuilder - */ - public function ifTrue(\Closure $closure = null) - { - if (null === $closure) { - $closure = function ($v) { return true === $v; }; - } - - $this->ifPart = $closure; - - return $this; - } - - /** - * Tests if the value is a string. - * - * @return ExprBuilder - */ - public function ifString() - { - $this->ifPart = function ($v) { return is_string($v); }; - - return $this; - } - - /** - * Tests if the value is null. - * - * @return ExprBuilder - */ - public function ifNull() - { - $this->ifPart = function ($v) { return null === $v; }; - - return $this; - } - - /** - * Tests if the value is an array. - * - * @return ExprBuilder - */ - public function ifArray() - { - $this->ifPart = function ($v) { return is_array($v); }; - - return $this; - } - - /** - * Tests if the value is in an array. - * - * @param array $array - * - * @return ExprBuilder - */ - public function ifInArray(array $array) - { - $this->ifPart = function ($v) use ($array) { return in_array($v, $array, true); }; - - return $this; - } - - /** - * Tests if the value is not in an array. - * - * @param array $array - * - * @return ExprBuilder - */ - public function ifNotInArray(array $array) - { - $this->ifPart = function ($v) use ($array) { return !in_array($v, $array, true); }; - - return $this; - } - - /** - * Sets the closure to run if the test pass. - * - * @param \Closure $closure - * - * @return ExprBuilder - */ - public function then(\Closure $closure) - { - $this->thenPart = $closure; - - return $this; - } - - /** - * Sets a closure returning an empty array. - * - * @return ExprBuilder - */ - public function thenEmptyArray() - { - $this->thenPart = function ($v) { return array(); }; - - return $this; - } - - /** - * Sets a closure marking the value as invalid at validation time. - * - * if you want to add the value of the node in your message just use a %s placeholder. - * - * @param string $message - * - * @return ExprBuilder - * - * @throws \InvalidArgumentException - */ - public function thenInvalid($message) - { - $this->thenPart = function ($v) use ($message) {throw new \InvalidArgumentException(sprintf($message, json_encode($v))); }; - - return $this; - } - - /** - * Sets a closure unsetting this key of the array at validation time. - * - * @return ExprBuilder - * - * @throws UnsetKeyException - */ - public function thenUnset() - { - $this->thenPart = function ($v) { throw new UnsetKeyException('Unsetting key'); }; - - return $this; - } - - /** - * Returns the related node. - * - * @return NodeDefinition - * - * @throws \RuntimeException - */ - public function end() - { - if (null === $this->ifPart) { - throw new \RuntimeException('You must specify an if part.'); - } - if (null === $this->thenPart) { - throw new \RuntimeException('You must specify a then part.'); - } - - return $this->node; - } - - /** - * Builds the expressions. - * - * @param ExprBuilder[] $expressions An array of ExprBuilder instances to build - * - * @return array - */ - public static function buildExpressions(array $expressions) - { - foreach ($expressions as $k => $expr) { - if ($expr instanceof self) { - $if = $expr->ifPart; - $then = $expr->thenPart; - $expressions[$k] = function ($v) use ($if, $then) { - return $if($v) ? $then($v) : $v; - }; - } - } - - return $expressions; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/config/Definition/Builder/FloatNodeDefinition.php b/sitecake/2.2.9/server/vendor/symfony/config/Definition/Builder/FloatNodeDefinition.php deleted file mode 100644 index c0bed46..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/config/Definition/Builder/FloatNodeDefinition.php +++ /dev/null @@ -1,32 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition\Builder; - -use Symfony\Component\Config\Definition\FloatNode; - -/** - * This class provides a fluent interface for defining a float node. - * - * @author Jeanmonod David - */ -class FloatNodeDefinition extends NumericNodeDefinition -{ - /** - * Instantiates a Node. - * - * @return FloatNode The node - */ - protected function instantiateNode() - { - return new FloatNode($this->name, $this->parent, $this->min, $this->max); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/config/Definition/Builder/IntegerNodeDefinition.php b/sitecake/2.2.9/server/vendor/symfony/config/Definition/Builder/IntegerNodeDefinition.php deleted file mode 100644 index f6c3c14..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/config/Definition/Builder/IntegerNodeDefinition.php +++ /dev/null @@ -1,32 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition\Builder; - -use Symfony\Component\Config\Definition\IntegerNode; - -/** - * This class provides a fluent interface for defining an integer node. - * - * @author Jeanmonod David - */ -class IntegerNodeDefinition extends NumericNodeDefinition -{ - /** - * Instantiates a Node. - * - * @return IntegerNode The node - */ - protected function instantiateNode() - { - return new IntegerNode($this->name, $this->parent, $this->min, $this->max); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/config/Definition/Builder/MergeBuilder.php b/sitecake/2.2.9/server/vendor/symfony/config/Definition/Builder/MergeBuilder.php deleted file mode 100644 index f908a49..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/config/Definition/Builder/MergeBuilder.php +++ /dev/null @@ -1,72 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition\Builder; - -/** - * This class builds merge conditions. - * - * @author Johannes M. Schmitt - */ -class MergeBuilder -{ - protected $node; - public $allowFalse = false; - public $allowOverwrite = true; - - /** - * Constructor. - * - * @param NodeDefinition $node The related node - */ - public function __construct(NodeDefinition $node) - { - $this->node = $node; - } - - /** - * Sets whether the node can be unset. - * - * @param bool $allow - * - * @return MergeBuilder - */ - public function allowUnset($allow = true) - { - $this->allowFalse = $allow; - - return $this; - } - - /** - * Sets whether the node can be overwritten. - * - * @param bool $deny Whether the overwriting is forbidden or not - * - * @return MergeBuilder - */ - public function denyOverwrite($deny = true) - { - $this->allowOverwrite = !$deny; - - return $this; - } - - /** - * Returns the related node. - * - * @return NodeDefinition - */ - public function end() - { - return $this->node; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/config/Definition/Builder/NodeBuilder.php b/sitecake/2.2.9/server/vendor/symfony/config/Definition/Builder/NodeBuilder.php deleted file mode 100644 index b2b6336..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/config/Definition/Builder/NodeBuilder.php +++ /dev/null @@ -1,245 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition\Builder; - -/** - * This class provides a fluent interface for building a node. - * - * @author Johannes M. Schmitt - */ -class NodeBuilder implements NodeParentInterface -{ - protected $parent; - protected $nodeMapping; - - /** - * Constructor. - */ - public function __construct() - { - $this->nodeMapping = array( - 'variable' => __NAMESPACE__.'\\VariableNodeDefinition', - 'scalar' => __NAMESPACE__.'\\ScalarNodeDefinition', - 'boolean' => __NAMESPACE__.'\\BooleanNodeDefinition', - 'integer' => __NAMESPACE__.'\\IntegerNodeDefinition', - 'float' => __NAMESPACE__.'\\FloatNodeDefinition', - 'array' => __NAMESPACE__.'\\ArrayNodeDefinition', - 'enum' => __NAMESPACE__.'\\EnumNodeDefinition', - ); - } - - /** - * Set the parent node. - * - * @param ParentNodeDefinitionInterface $parent The parent node - * - * @return NodeBuilder This node builder - */ - public function setParent(ParentNodeDefinitionInterface $parent = null) - { - $this->parent = $parent; - - return $this; - } - - /** - * Creates a child array node. - * - * @param string $name The name of the node - * - * @return ArrayNodeDefinition The child node - */ - public function arrayNode($name) - { - return $this->node($name, 'array'); - } - - /** - * Creates a child scalar node. - * - * @param string $name the name of the node - * - * @return ScalarNodeDefinition The child node - */ - public function scalarNode($name) - { - return $this->node($name, 'scalar'); - } - - /** - * Creates a child Boolean node. - * - * @param string $name The name of the node - * - * @return BooleanNodeDefinition The child node - */ - public function booleanNode($name) - { - return $this->node($name, 'boolean'); - } - - /** - * Creates a child integer node. - * - * @param string $name the name of the node - * - * @return IntegerNodeDefinition The child node - */ - public function integerNode($name) - { - return $this->node($name, 'integer'); - } - - /** - * Creates a child float node. - * - * @param string $name the name of the node - * - * @return FloatNodeDefinition The child node - */ - public function floatNode($name) - { - return $this->node($name, 'float'); - } - - /** - * Creates a child EnumNode. - * - * @param string $name - * - * @return EnumNodeDefinition - */ - public function enumNode($name) - { - return $this->node($name, 'enum'); - } - - /** - * Creates a child variable node. - * - * @param string $name The name of the node - * - * @return VariableNodeDefinition The builder of the child node - */ - public function variableNode($name) - { - return $this->node($name, 'variable'); - } - - /** - * Returns the parent node. - * - * @return ParentNodeDefinitionInterface The parent node - */ - public function end() - { - return $this->parent; - } - - /** - * Creates a child node. - * - * @param string $name The name of the node - * @param string $type The type of the node - * - * @return NodeDefinition The child node - * - * @throws \RuntimeException When the node type is not registered - * @throws \RuntimeException When the node class is not found - */ - public function node($name, $type) - { - $class = $this->getNodeClass($type); - - $node = new $class($name); - - $this->append($node); - - return $node; - } - - /** - * Appends a node definition. - * - * Usage: - * - * $node = new ArrayNodeDefinition('name') - * ->children() - * ->scalarNode('foo')->end() - * ->scalarNode('baz')->end() - * ->append($this->getBarNodeDefinition()) - * ->end() - * ; - * - * @param NodeDefinition $node - * - * @return NodeBuilder This node builder - */ - public function append(NodeDefinition $node) - { - if ($node instanceof ParentNodeDefinitionInterface) { - $builder = clone $this; - $builder->setParent(null); - $node->setBuilder($builder); - } - - if (null !== $this->parent) { - $this->parent->append($node); - // Make this builder the node parent to allow for a fluid interface - $node->setParent($this); - } - - return $this; - } - - /** - * Adds or overrides a node Type. - * - * @param string $type The name of the type - * @param string $class The fully qualified name the node definition class - * - * @return NodeBuilder This node builder - */ - public function setNodeClass($type, $class) - { - $this->nodeMapping[strtolower($type)] = $class; - - return $this; - } - - /** - * Returns the class name of the node definition. - * - * @param string $type The node type - * - * @return string The node definition class name - * - * @throws \RuntimeException When the node type is not registered - * @throws \RuntimeException When the node class is not found - */ - protected function getNodeClass($type) - { - $type = strtolower($type); - - if (!isset($this->nodeMapping[$type])) { - throw new \RuntimeException(sprintf('The node type "%s" is not registered.', $type)); - } - - $class = $this->nodeMapping[$type]; - - if (!class_exists($class)) { - throw new \RuntimeException(sprintf('The node class "%s" does not exist.', $class)); - } - - return $class; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/config/Definition/Builder/NodeDefinition.php b/sitecake/2.2.9/server/vendor/symfony/config/Definition/Builder/NodeDefinition.php deleted file mode 100644 index f7f84bc..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/config/Definition/Builder/NodeDefinition.php +++ /dev/null @@ -1,343 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition\Builder; - -use Symfony\Component\Config\Definition\NodeInterface; -use Symfony\Component\Config\Definition\Exception\InvalidDefinitionException; - -/** - * This class provides a fluent interface for defining a node. - * - * @author Johannes M. Schmitt - */ -abstract class NodeDefinition implements NodeParentInterface -{ - protected $name; - protected $normalization; - protected $validation; - protected $defaultValue; - protected $default = false; - protected $required = false; - protected $merge; - protected $allowEmptyValue = true; - protected $nullEquivalent; - protected $trueEquivalent = true; - protected $falseEquivalent = false; - - /** - * @var NodeParentInterface|null - */ - protected $parent; - protected $attributes = array(); - - /** - * Constructor. - * - * @param string $name The name of the node - * @param NodeParentInterface|null $parent The parent - */ - public function __construct($name, NodeParentInterface $parent = null) - { - $this->parent = $parent; - $this->name = $name; - } - - /** - * Sets the parent node. - * - * @param NodeParentInterface $parent The parent - * - * @return NodeDefinition|$this - */ - public function setParent(NodeParentInterface $parent) - { - $this->parent = $parent; - - return $this; - } - - /** - * Sets info message. - * - * @param string $info The info text - * - * @return NodeDefinition|$this - */ - public function info($info) - { - return $this->attribute('info', $info); - } - - /** - * Sets example configuration. - * - * @param string|array $example - * - * @return NodeDefinition|$this - */ - public function example($example) - { - return $this->attribute('example', $example); - } - - /** - * Sets an attribute on the node. - * - * @param string $key - * @param mixed $value - * - * @return NodeDefinition|$this - */ - public function attribute($key, $value) - { - $this->attributes[$key] = $value; - - return $this; - } - - /** - * Returns the parent node. - * - * @return NodeParentInterface|null The builder of the parent node - */ - public function end() - { - return $this->parent; - } - - /** - * Creates the node. - * - * @param bool $forceRootNode Whether to force this node as the root node - * - * @return NodeInterface - */ - public function getNode($forceRootNode = false) - { - if ($forceRootNode) { - $this->parent = null; - } - - if (null !== $this->normalization) { - $this->normalization->before = ExprBuilder::buildExpressions($this->normalization->before); - } - - if (null !== $this->validation) { - $this->validation->rules = ExprBuilder::buildExpressions($this->validation->rules); - } - - $node = $this->createNode(); - $node->setAttributes($this->attributes); - - return $node; - } - - /** - * Sets the default value. - * - * @param mixed $value The default value - * - * @return NodeDefinition|$this - */ - public function defaultValue($value) - { - $this->default = true; - $this->defaultValue = $value; - - return $this; - } - - /** - * Sets the node as required. - * - * @return NodeDefinition|$this - */ - public function isRequired() - { - $this->required = true; - - return $this; - } - - /** - * Sets the equivalent value used when the node contains null. - * - * @param mixed $value - * - * @return NodeDefinition|$this - */ - public function treatNullLike($value) - { - $this->nullEquivalent = $value; - - return $this; - } - - /** - * Sets the equivalent value used when the node contains true. - * - * @param mixed $value - * - * @return NodeDefinition|$this - */ - public function treatTrueLike($value) - { - $this->trueEquivalent = $value; - - return $this; - } - - /** - * Sets the equivalent value used when the node contains false. - * - * @param mixed $value - * - * @return NodeDefinition|$this - */ - public function treatFalseLike($value) - { - $this->falseEquivalent = $value; - - return $this; - } - - /** - * Sets null as the default value. - * - * @return NodeDefinition|$this - */ - public function defaultNull() - { - return $this->defaultValue(null); - } - - /** - * Sets true as the default value. - * - * @return NodeDefinition|$this - */ - public function defaultTrue() - { - return $this->defaultValue(true); - } - - /** - * Sets false as the default value. - * - * @return NodeDefinition|$this - */ - public function defaultFalse() - { - return $this->defaultValue(false); - } - - /** - * Sets an expression to run before the normalization. - * - * @return ExprBuilder - */ - public function beforeNormalization() - { - return $this->normalization()->before(); - } - - /** - * Denies the node value being empty. - * - * @return NodeDefinition|$this - */ - public function cannotBeEmpty() - { - $this->allowEmptyValue = false; - - return $this; - } - - /** - * Sets an expression to run for the validation. - * - * The expression receives the value of the node and must return it. It can - * modify it. - * An exception should be thrown when the node is not valid. - * - * @return ExprBuilder - */ - public function validate() - { - return $this->validation()->rule(); - } - - /** - * Sets whether the node can be overwritten. - * - * @param bool $deny Whether the overwriting is forbidden or not - * - * @return NodeDefinition|$this - */ - public function cannotBeOverwritten($deny = true) - { - $this->merge()->denyOverwrite($deny); - - return $this; - } - - /** - * Gets the builder for validation rules. - * - * @return ValidationBuilder - */ - protected function validation() - { - if (null === $this->validation) { - $this->validation = new ValidationBuilder($this); - } - - return $this->validation; - } - - /** - * Gets the builder for merging rules. - * - * @return MergeBuilder - */ - protected function merge() - { - if (null === $this->merge) { - $this->merge = new MergeBuilder($this); - } - - return $this->merge; - } - - /** - * Gets the builder for normalization rules. - * - * @return NormalizationBuilder - */ - protected function normalization() - { - if (null === $this->normalization) { - $this->normalization = new NormalizationBuilder($this); - } - - return $this->normalization; - } - - /** - * Instantiate and configure the node according to this definition. - * - * @return NodeInterface $node The node instance - * - * @throws InvalidDefinitionException When the definition is invalid - */ - abstract protected function createNode(); -} diff --git a/sitecake/2.2.9/server/vendor/symfony/config/Definition/Builder/NodeParentInterface.php b/sitecake/2.2.9/server/vendor/symfony/config/Definition/Builder/NodeParentInterface.php deleted file mode 100644 index 305e993..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/config/Definition/Builder/NodeParentInterface.php +++ /dev/null @@ -1,21 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition\Builder; - -/** - * An interface that must be implemented by all node parents. - * - * @author Victor Berchet - */ -interface NodeParentInterface -{ -} diff --git a/sitecake/2.2.9/server/vendor/symfony/config/Definition/Builder/NormalizationBuilder.php b/sitecake/2.2.9/server/vendor/symfony/config/Definition/Builder/NormalizationBuilder.php deleted file mode 100644 index 748c9f2..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/config/Definition/Builder/NormalizationBuilder.php +++ /dev/null @@ -1,67 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition\Builder; - -/** - * This class builds normalization conditions. - * - * @author Johannes M. Schmitt - */ -class NormalizationBuilder -{ - protected $node; - public $before = array(); - public $remappings = array(); - - /** - * Constructor. - * - * @param NodeDefinition $node The related node - */ - public function __construct(NodeDefinition $node) - { - $this->node = $node; - } - - /** - * Registers a key to remap to its plural form. - * - * @param string $key The key to remap - * @param string $plural The plural of the key in case of irregular plural - * - * @return NormalizationBuilder - */ - public function remap($key, $plural = null) - { - $this->remappings[] = array($key, null === $plural ? $key.'s' : $plural); - - return $this; - } - - /** - * Registers a closure to run before the normalization or an expression builder to build it if null is provided. - * - * @param \Closure $closure - * - * @return ExprBuilder|NormalizationBuilder - */ - public function before(\Closure $closure = null) - { - if (null !== $closure) { - $this->before[] = $closure; - - return $this; - } - - return $this->before[] = new ExprBuilder($this->node); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/config/Definition/Builder/NumericNodeDefinition.php b/sitecake/2.2.9/server/vendor/symfony/config/Definition/Builder/NumericNodeDefinition.php deleted file mode 100644 index ddd716d..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/config/Definition/Builder/NumericNodeDefinition.php +++ /dev/null @@ -1,61 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition\Builder; - -/** - * Abstract class that contains common code of integer and float node definitions. - * - * @author David Jeanmonod - */ -abstract class NumericNodeDefinition extends ScalarNodeDefinition -{ - protected $min; - protected $max; - - /** - * Ensures that the value is smaller than the given reference. - * - * @param mixed $max - * - * @return NumericNodeDefinition - * - * @throws \InvalidArgumentException when the constraint is inconsistent - */ - public function max($max) - { - if (isset($this->min) && $this->min > $max) { - throw new \InvalidArgumentException(sprintf('You cannot define a max(%s) as you already have a min(%s)', $max, $this->min)); - } - $this->max = $max; - - return $this; - } - - /** - * Ensures that the value is bigger than the given reference. - * - * @param mixed $min - * - * @return NumericNodeDefinition - * - * @throws \InvalidArgumentException when the constraint is inconsistent - */ - public function min($min) - { - if (isset($this->max) && $this->max < $min) { - throw new \InvalidArgumentException(sprintf('You cannot define a min(%s) as you already have a max(%s)', $min, $this->max)); - } - $this->min = $min; - - return $this; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/config/Definition/Builder/ParentNodeDefinitionInterface.php b/sitecake/2.2.9/server/vendor/symfony/config/Definition/Builder/ParentNodeDefinitionInterface.php deleted file mode 100644 index 575495b..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/config/Definition/Builder/ParentNodeDefinitionInterface.php +++ /dev/null @@ -1,26 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition\Builder; - -/** - * An interface that must be implemented by nodes which can have children. - * - * @author Victor Berchet - */ -interface ParentNodeDefinitionInterface -{ - public function children(); - - public function append(NodeDefinition $node); - - public function setBuilder(NodeBuilder $builder); -} diff --git a/sitecake/2.2.9/server/vendor/symfony/config/Definition/Builder/ScalarNodeDefinition.php b/sitecake/2.2.9/server/vendor/symfony/config/Definition/Builder/ScalarNodeDefinition.php deleted file mode 100644 index 6170555..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/config/Definition/Builder/ScalarNodeDefinition.php +++ /dev/null @@ -1,32 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition\Builder; - -use Symfony\Component\Config\Definition\ScalarNode; - -/** - * This class provides a fluent interface for defining a node. - * - * @author Johannes M. Schmitt - */ -class ScalarNodeDefinition extends VariableNodeDefinition -{ - /** - * Instantiate a Node. - * - * @return ScalarNode The node - */ - protected function instantiateNode() - { - return new ScalarNode($this->name, $this->parent); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/config/Definition/Builder/TreeBuilder.php b/sitecake/2.2.9/server/vendor/symfony/config/Definition/Builder/TreeBuilder.php deleted file mode 100644 index 5d02848..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/config/Definition/Builder/TreeBuilder.php +++ /dev/null @@ -1,63 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition\Builder; - -use Symfony\Component\Config\Definition\NodeInterface; - -/** - * This is the entry class for building a config tree. - * - * @author Johannes M. Schmitt - */ -class TreeBuilder implements NodeParentInterface -{ - protected $tree; - protected $root; - protected $builder; - - /** - * Creates the root node. - * - * @param string $name The name of the root node - * @param string $type The type of the root node - * @param NodeBuilder $builder A custom node builder instance - * - * @return ArrayNodeDefinition|NodeDefinition The root node (as an ArrayNodeDefinition when the type is 'array') - * - * @throws \RuntimeException When the node type is not supported - */ - public function root($name, $type = 'array', NodeBuilder $builder = null) - { - $builder = $builder ?: new NodeBuilder(); - - return $this->root = $builder->node($name, $type)->setParent($this); - } - - /** - * Builds the tree. - * - * @return NodeInterface - * - * @throws \RuntimeException - */ - public function buildTree() - { - if (null === $this->root) { - throw new \RuntimeException('The configuration tree has no root node.'); - } - if (null !== $this->tree) { - return $this->tree; - } - - return $this->tree = $this->root->getNode(true); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/config/Definition/Builder/ValidationBuilder.php b/sitecake/2.2.9/server/vendor/symfony/config/Definition/Builder/ValidationBuilder.php deleted file mode 100644 index e885823..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/config/Definition/Builder/ValidationBuilder.php +++ /dev/null @@ -1,51 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition\Builder; - -/** - * This class builds validation conditions. - * - * @author Christophe Coevoet - */ -class ValidationBuilder -{ - protected $node; - public $rules = array(); - - /** - * Constructor. - * - * @param NodeDefinition $node The related node - */ - public function __construct(NodeDefinition $node) - { - $this->node = $node; - } - - /** - * Registers a closure to run as normalization or an expression builder to build it if null is provided. - * - * @param \Closure $closure - * - * @return ExprBuilder|ValidationBuilder - */ - public function rule(\Closure $closure = null) - { - if (null !== $closure) { - $this->rules[] = $closure; - - return $this; - } - - return $this->rules[] = new ExprBuilder($this->node); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/config/Definition/Builder/VariableNodeDefinition.php b/sitecake/2.2.9/server/vendor/symfony/config/Definition/Builder/VariableNodeDefinition.php deleted file mode 100644 index a46b7ea..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/config/Definition/Builder/VariableNodeDefinition.php +++ /dev/null @@ -1,64 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition\Builder; - -use Symfony\Component\Config\Definition\VariableNode; - -/** - * This class provides a fluent interface for defining a node. - * - * @author Johannes M. Schmitt - */ -class VariableNodeDefinition extends NodeDefinition -{ - /** - * Instantiate a Node. - * - * @return VariableNode The node - */ - protected function instantiateNode() - { - return new VariableNode($this->name, $this->parent); - } - - /** - * {@inheritdoc} - */ - protected function createNode() - { - $node = $this->instantiateNode(); - - if (null !== $this->normalization) { - $node->setNormalizationClosures($this->normalization->before); - } - - if (null !== $this->merge) { - $node->setAllowOverwrite($this->merge->allowOverwrite); - } - - if (true === $this->default) { - $node->setDefaultValue($this->defaultValue); - } - - $node->setAllowEmptyValue($this->allowEmptyValue); - $node->addEquivalentValue(null, $this->nullEquivalent); - $node->addEquivalentValue(true, $this->trueEquivalent); - $node->addEquivalentValue(false, $this->falseEquivalent); - $node->setRequired($this->required); - - if (null !== $this->validation) { - $node->setFinalValidationClosures($this->validation->rules); - } - - return $node; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/config/Definition/ConfigurationInterface.php b/sitecake/2.2.9/server/vendor/symfony/config/Definition/ConfigurationInterface.php deleted file mode 100644 index d6456ed..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/config/Definition/ConfigurationInterface.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition; - -/** - * Configuration interface. - * - * @author Victor Berchet - */ -interface ConfigurationInterface -{ - /** - * Generates the configuration tree builder. - * - * @return \Symfony\Component\Config\Definition\Builder\TreeBuilder The tree builder - */ - public function getConfigTreeBuilder(); -} diff --git a/sitecake/2.2.9/server/vendor/symfony/config/Definition/Dumper/XmlReferenceDumper.php b/sitecake/2.2.9/server/vendor/symfony/config/Definition/Dumper/XmlReferenceDumper.php deleted file mode 100644 index ab56a92..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/config/Definition/Dumper/XmlReferenceDumper.php +++ /dev/null @@ -1,300 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition\Dumper; - -use Symfony\Component\Config\Definition\ConfigurationInterface; -use Symfony\Component\Config\Definition\NodeInterface; -use Symfony\Component\Config\Definition\ArrayNode; -use Symfony\Component\Config\Definition\EnumNode; -use Symfony\Component\Config\Definition\PrototypedArrayNode; - -/** - * Dumps a XML reference configuration for the given configuration/node instance. - * - * @author Wouter J - */ -class XmlReferenceDumper -{ - private $reference; - - public function dump(ConfigurationInterface $configuration, $namespace = null) - { - return $this->dumpNode($configuration->getConfigTreeBuilder()->buildTree(), $namespace); - } - - public function dumpNode(NodeInterface $node, $namespace = null) - { - $this->reference = ''; - $this->writeNode($node, 0, true, $namespace); - $ref = $this->reference; - $this->reference = null; - - return $ref; - } - - /** - * @param NodeInterface $node - * @param int $depth - * @param bool $root If the node is the root node - * @param string $namespace The namespace of the node - */ - private function writeNode(NodeInterface $node, $depth = 0, $root = false, $namespace = null) - { - $rootName = ($root ? 'config' : $node->getName()); - $rootNamespace = ($namespace ?: ($root ? 'http://example.org/schema/dic/'.$node->getName() : null)); - - // xml remapping - if ($node->getParent()) { - $remapping = array_filter($node->getParent()->getXmlRemappings(), function ($mapping) use ($rootName) { - return $rootName === $mapping[1]; - }); - - if (count($remapping)) { - list($singular) = current($remapping); - $rootName = $singular; - } - } - $rootName = str_replace('_', '-', $rootName); - - $rootAttributes = array(); - $rootAttributeComments = array(); - $rootChildren = array(); - $rootComments = array(); - - if ($node instanceof ArrayNode) { - $children = $node->getChildren(); - - // comments about the root node - if ($rootInfo = $node->getInfo()) { - $rootComments[] = $rootInfo; - } - - if ($rootNamespace) { - $rootComments[] = 'Namespace: '.$rootNamespace; - } - - // render prototyped nodes - if ($node instanceof PrototypedArrayNode) { - array_unshift($rootComments, 'prototype'); - - if ($key = $node->getKeyAttribute()) { - $rootAttributes[$key] = str_replace('-', ' ', $rootName).' '.$key; - } - - $prototype = $node->getPrototype(); - - if ($prototype instanceof ArrayNode) { - $children = $prototype->getChildren(); - } else { - if ($prototype->hasDefaultValue()) { - $prototypeValue = $prototype->getDefaultValue(); - } else { - switch (get_class($prototype)) { - case 'Symfony\Component\Config\Definition\ScalarNode': - $prototypeValue = 'scalar value'; - break; - - case 'Symfony\Component\Config\Definition\FloatNode': - case 'Symfony\Component\Config\Definition\IntegerNode': - $prototypeValue = 'numeric value'; - break; - - case 'Symfony\Component\Config\Definition\BooleanNode': - $prototypeValue = 'true|false'; - break; - - case 'Symfony\Component\Config\Definition\EnumNode': - $prototypeValue = implode('|', array_map('json_encode', $prototype->getValues())); - break; - - default: - $prototypeValue = 'value'; - } - } - } - } - - // get attributes and elements - foreach ($children as $child) { - if (!$child instanceof ArrayNode) { - // get attributes - - // metadata - $name = str_replace('_', '-', $child->getName()); - $value = '%%%%not_defined%%%%'; // use a string which isn't used in the normal world - - // comments - $comments = array(); - if ($info = $child->getInfo()) { - $comments[] = $info; - } - - if ($example = $child->getExample()) { - $comments[] = 'Example: '.$example; - } - - if ($child->isRequired()) { - $comments[] = 'Required'; - } - - if ($child instanceof EnumNode) { - $comments[] = 'One of '.implode('; ', array_map('json_encode', $child->getValues())); - } - - if (count($comments)) { - $rootAttributeComments[$name] = implode(";\n", $comments); - } - - // default values - if ($child->hasDefaultValue()) { - $value = $child->getDefaultValue(); - } - - // append attribute - $rootAttributes[$name] = $value; - } else { - // get elements - $rootChildren[] = $child; - } - } - } - - // render comments - - // root node comment - if (count($rootComments)) { - foreach ($rootComments as $comment) { - $this->writeLine('', $depth); - } - } - - // attribute comments - if (count($rootAttributeComments)) { - foreach ($rootAttributeComments as $attrName => $comment) { - $commentDepth = $depth + 4 + strlen($attrName) + 2; - $commentLines = explode("\n", $comment); - $multiline = (count($commentLines) > 1); - $comment = implode(PHP_EOL.str_repeat(' ', $commentDepth), $commentLines); - - if ($multiline) { - $this->writeLine('', $depth); - } else { - $this->writeLine('', $depth); - } - } - } - - // render start tag + attributes - $rootIsVariablePrototype = isset($prototypeValue); - $rootIsEmptyTag = (0 === count($rootChildren) && !$rootIsVariablePrototype); - $rootOpenTag = '<'.$rootName; - if (1 >= ($attributesCount = count($rootAttributes))) { - if (1 === $attributesCount) { - $rootOpenTag .= sprintf(' %s="%s"', current(array_keys($rootAttributes)), $this->writeValue(current($rootAttributes))); - } - - $rootOpenTag .= $rootIsEmptyTag ? ' />' : '>'; - - if ($rootIsVariablePrototype) { - $rootOpenTag .= $prototypeValue.''; - } - - $this->writeLine($rootOpenTag, $depth); - } else { - $this->writeLine($rootOpenTag, $depth); - - $i = 1; - - foreach ($rootAttributes as $attrName => $attrValue) { - $attr = sprintf('%s="%s"', $attrName, $this->writeValue($attrValue)); - - $this->writeLine($attr, $depth + 4); - - if ($attributesCount === $i++) { - $this->writeLine($rootIsEmptyTag ? '/>' : '>', $depth); - - if ($rootIsVariablePrototype) { - $rootOpenTag .= $prototypeValue.''; - } - } - } - } - - // render children tags - foreach ($rootChildren as $child) { - $this->writeLine(''); - $this->writeNode($child, $depth + 4); - } - - // render end tag - if (!$rootIsEmptyTag && !$rootIsVariablePrototype) { - $this->writeLine(''); - - $rootEndTag = ''; - $this->writeLine($rootEndTag, $depth); - } - } - - /** - * Outputs a single config reference line - * - * @param string $text - * @param int $indent - */ - private function writeLine($text, $indent = 0) - { - $indent = strlen($text) + $indent; - $format = '%'.$indent.'s'; - - $this->reference .= sprintf($format, $text)."\n"; - } - - /** - * Renders the string conversion of the value. - * - * @param mixed $value - * - * @return string - */ - private function writeValue($value) - { - if ('%%%%not_defined%%%%' === $value) { - return ''; - } - - if (is_string($value) || is_numeric($value)) { - return $value; - } - - if (false === $value) { - return 'false'; - } - - if (true === $value) { - return 'true'; - } - - if (null === $value) { - return 'null'; - } - - if (empty($value)) { - return ''; - } - - if (is_array($value)) { - return implode(',', $value); - } - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/config/Definition/Dumper/YamlReferenceDumper.php b/sitecake/2.2.9/server/vendor/symfony/config/Definition/Dumper/YamlReferenceDumper.php deleted file mode 100644 index a7cd448..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/config/Definition/Dumper/YamlReferenceDumper.php +++ /dev/null @@ -1,198 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition\Dumper; - -use Symfony\Component\Config\Definition\ConfigurationInterface; -use Symfony\Component\Config\Definition\NodeInterface; -use Symfony\Component\Config\Definition\ArrayNode; -use Symfony\Component\Config\Definition\EnumNode; -use Symfony\Component\Config\Definition\PrototypedArrayNode; -use Symfony\Component\Yaml\Inline; - -/** - * Dumps a Yaml reference configuration for the given configuration/node instance. - * - * @author Kevin Bond - */ -class YamlReferenceDumper -{ - private $reference; - - public function dump(ConfigurationInterface $configuration) - { - return $this->dumpNode($configuration->getConfigTreeBuilder()->buildTree()); - } - - public function dumpNode(NodeInterface $node) - { - $this->reference = ''; - $this->writeNode($node); - $ref = $this->reference; - $this->reference = null; - - return $ref; - } - - /** - * @param NodeInterface $node - * @param int $depth - */ - private function writeNode(NodeInterface $node, $depth = 0) - { - $comments = array(); - $default = ''; - $defaultArray = null; - $children = null; - $example = $node->getExample(); - - // defaults - if ($node instanceof ArrayNode) { - $children = $node->getChildren(); - - if ($node instanceof PrototypedArrayNode) { - $prototype = $node->getPrototype(); - - if ($prototype instanceof ArrayNode) { - $children = $prototype->getChildren(); - } - - // check for attribute as key - if ($key = $node->getKeyAttribute()) { - $keyNodeClass = 'Symfony\Component\Config\Definition\\'.($prototype instanceof ArrayNode ? 'ArrayNode' : 'ScalarNode'); - $keyNode = new $keyNodeClass($key, $node); - $keyNode->setInfo('Prototype'); - - // add children - foreach ($children as $childNode) { - $keyNode->addChild($childNode); - } - $children = array($key => $keyNode); - } - } - - if (!$children) { - if ($node->hasDefaultValue() && count($defaultArray = $node->getDefaultValue())) { - $default = ''; - } elseif (!is_array($example)) { - $default = '[]'; - } - } - } elseif ($node instanceof EnumNode) { - $comments[] = 'One of '.implode('; ', array_map('json_encode', $node->getValues())); - $default = '~'; - } else { - $default = '~'; - - if ($node->hasDefaultValue()) { - $default = $node->getDefaultValue(); - - if (is_array($default)) { - if (count($defaultArray = $node->getDefaultValue())) { - $default = ''; - } elseif (!is_array($example)) { - $default = '[]'; - } - } else { - $default = Inline::dump($default); - } - } - } - - // required? - if ($node->isRequired()) { - $comments[] = 'Required'; - } - - // example - if ($example && !is_array($example)) { - $comments[] = 'Example: '.$example; - } - - $default = (string) $default != '' ? ' '.$default : ''; - $comments = count($comments) ? '# '.implode(', ', $comments) : ''; - - $text = rtrim(sprintf('%-20s %s %s', $node->getName().':', $default, $comments), ' '); - - if ($info = $node->getInfo()) { - $this->writeLine(''); - // indenting multi-line info - $info = str_replace("\n", sprintf("\n%".($depth * 4)."s# ", ' '), $info); - $this->writeLine('# '.$info, $depth * 4); - } - - $this->writeLine($text, $depth * 4); - - // output defaults - if ($defaultArray) { - $this->writeLine(''); - - $message = count($defaultArray) > 1 ? 'Defaults' : 'Default'; - - $this->writeLine('# '.$message.':', $depth * 4 + 4); - - $this->writeArray($defaultArray, $depth + 1); - } - - if (is_array($example)) { - $this->writeLine(''); - - $message = count($example) > 1 ? 'Examples' : 'Example'; - - $this->writeLine('# '.$message.':', $depth * 4 + 4); - - $this->writeArray($example, $depth + 1); - } - - if ($children) { - foreach ($children as $childNode) { - $this->writeNode($childNode, $depth + 1); - } - } - } - - /** - * Outputs a single config reference line - * - * @param string $text - * @param int $indent - */ - private function writeLine($text, $indent = 0) - { - $indent = strlen($text) + $indent; - $format = '%'.$indent.'s'; - - $this->reference .= sprintf($format, $text)."\n"; - } - - private function writeArray(array $array, $depth) - { - $isIndexed = array_values($array) === $array; - - foreach ($array as $key => $value) { - if (is_array($value)) { - $val = ''; - } else { - $val = $value; - } - - if ($isIndexed) { - $this->writeLine('- '.$val, $depth * 4); - } else { - $this->writeLine(sprintf('%-20s %s', $key.':', $val), $depth * 4); - } - - if (is_array($value)) { - $this->writeArray($value, $depth + 1); - } - } - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/config/Definition/EnumNode.php b/sitecake/2.2.9/server/vendor/symfony/config/Definition/EnumNode.php deleted file mode 100644 index 224871a..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/config/Definition/EnumNode.php +++ /dev/null @@ -1,58 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition; - -use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException; - -/** - * Node which only allows a finite set of values. - * - * @author Johannes M. Schmitt - */ -class EnumNode extends ScalarNode -{ - private $values; - - public function __construct($name, NodeInterface $parent = null, array $values = array()) - { - $values = array_unique($values); - if (count($values) <= 1) { - throw new \InvalidArgumentException('$values must contain at least two distinct elements.'); - } - - parent::__construct($name, $parent); - $this->values = $values; - } - - public function getValues() - { - return $this->values; - } - - protected function finalizeValue($value) - { - $value = parent::finalizeValue($value); - - if (!in_array($value, $this->values, true)) { - $ex = new InvalidConfigurationException(sprintf( - 'The value %s is not allowed for path "%s". Permissible values: %s', - json_encode($value), - $this->getPath(), - implode(', ', array_map('json_encode', $this->values)))); - $ex->setPath($this->getPath()); - - throw $ex; - } - - return $value; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/config/Definition/Exception/DuplicateKeyException.php b/sitecake/2.2.9/server/vendor/symfony/config/Definition/Exception/DuplicateKeyException.php deleted file mode 100644 index 48dd932..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/config/Definition/Exception/DuplicateKeyException.php +++ /dev/null @@ -1,22 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition\Exception; - -/** - * This exception is thrown whenever the key of an array is not unique. This can - * only be the case if the configuration is coming from an XML file. - * - * @author Johannes M. Schmitt - */ -class DuplicateKeyException extends InvalidConfigurationException -{ -} diff --git a/sitecake/2.2.9/server/vendor/symfony/config/Definition/Exception/Exception.php b/sitecake/2.2.9/server/vendor/symfony/config/Definition/Exception/Exception.php deleted file mode 100644 index 8933a49..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/config/Definition/Exception/Exception.php +++ /dev/null @@ -1,21 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition\Exception; - -/** - * Base exception for all configuration exceptions. - * - * @author Johannes M. Schmitt - */ -class Exception extends \RuntimeException -{ -} diff --git a/sitecake/2.2.9/server/vendor/symfony/config/Definition/Exception/ForbiddenOverwriteException.php b/sitecake/2.2.9/server/vendor/symfony/config/Definition/Exception/ForbiddenOverwriteException.php deleted file mode 100644 index 726c07f..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/config/Definition/Exception/ForbiddenOverwriteException.php +++ /dev/null @@ -1,22 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition\Exception; - -/** - * This exception is thrown when a configuration path is overwritten from a - * subsequent configuration file, but the entry node specifically forbids this. - * - * @author Johannes M. Schmitt - */ -class ForbiddenOverwriteException extends InvalidConfigurationException -{ -} diff --git a/sitecake/2.2.9/server/vendor/symfony/config/Definition/Exception/InvalidConfigurationException.php b/sitecake/2.2.9/server/vendor/symfony/config/Definition/Exception/InvalidConfigurationException.php deleted file mode 100644 index 3dbc57b..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/config/Definition/Exception/InvalidConfigurationException.php +++ /dev/null @@ -1,49 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition\Exception; - -/** - * A very general exception which can be thrown whenever non of the more specific - * exceptions is suitable. - * - * @author Johannes M. Schmitt - */ -class InvalidConfigurationException extends Exception -{ - private $path; - private $containsHints = false; - - public function setPath($path) - { - $this->path = $path; - } - - public function getPath() - { - return $this->path; - } - - /** - * Adds extra information that is suffixed to the original exception message. - * - * @param string $hint - */ - public function addHint($hint) - { - if (!$this->containsHints) { - $this->message .= "\nHint: ".$hint; - $this->containsHints = true; - } else { - $this->message .= ', '.$hint; - } - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/config/Definition/Exception/InvalidDefinitionException.php b/sitecake/2.2.9/server/vendor/symfony/config/Definition/Exception/InvalidDefinitionException.php deleted file mode 100644 index 98310da..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/config/Definition/Exception/InvalidDefinitionException.php +++ /dev/null @@ -1,21 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition\Exception; - -/** - * Thrown when an error is detected in a node Definition. - * - * @author Victor Berchet - */ -class InvalidDefinitionException extends Exception -{ -} diff --git a/sitecake/2.2.9/server/vendor/symfony/config/Definition/Exception/InvalidTypeException.php b/sitecake/2.2.9/server/vendor/symfony/config/Definition/Exception/InvalidTypeException.php deleted file mode 100644 index d7ca8c9..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/config/Definition/Exception/InvalidTypeException.php +++ /dev/null @@ -1,21 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition\Exception; - -/** - * This exception is thrown if an invalid type is encountered. - * - * @author Johannes M. Schmitt - */ -class InvalidTypeException extends InvalidConfigurationException -{ -} diff --git a/sitecake/2.2.9/server/vendor/symfony/config/Definition/Exception/UnsetKeyException.php b/sitecake/2.2.9/server/vendor/symfony/config/Definition/Exception/UnsetKeyException.php deleted file mode 100644 index 863181a..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/config/Definition/Exception/UnsetKeyException.php +++ /dev/null @@ -1,22 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition\Exception; - -/** - * This exception is usually not encountered by the end-user, but only used - * internally to signal the parent scope to unset a key. - * - * @author Johannes M. Schmitt - */ -class UnsetKeyException extends Exception -{ -} diff --git a/sitecake/2.2.9/server/vendor/symfony/config/Definition/FloatNode.php b/sitecake/2.2.9/server/vendor/symfony/config/Definition/FloatNode.php deleted file mode 100644 index 5e1af17..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/config/Definition/FloatNode.php +++ /dev/null @@ -1,43 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition; - -use Symfony\Component\Config\Definition\Exception\InvalidTypeException; - -/** - * This node represents a float value in the config tree. - * - * @author Jeanmonod David - */ -class FloatNode extends NumericNode -{ - /** - * {@inheritdoc} - */ - protected function validateType($value) - { - // Integers are also accepted, we just cast them - if (is_int($value)) { - $value = (float) $value; - } - - if (!is_float($value)) { - $ex = new InvalidTypeException(sprintf('Invalid type for path "%s". Expected float, but got %s.', $this->getPath(), gettype($value))); - if ($hint = $this->getInfo()) { - $ex->addHint($hint); - } - $ex->setPath($this->getPath()); - - throw $ex; - } - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/config/Definition/IntegerNode.php b/sitecake/2.2.9/server/vendor/symfony/config/Definition/IntegerNode.php deleted file mode 100644 index ba23070..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/config/Definition/IntegerNode.php +++ /dev/null @@ -1,38 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition; - -use Symfony\Component\Config\Definition\Exception\InvalidTypeException; - -/** - * This node represents an integer value in the config tree. - * - * @author Jeanmonod David - */ -class IntegerNode extends NumericNode -{ - /** - * {@inheritdoc} - */ - protected function validateType($value) - { - if (!is_int($value)) { - $ex = new InvalidTypeException(sprintf('Invalid type for path "%s". Expected int, but got %s.', $this->getPath(), gettype($value))); - if ($hint = $this->getInfo()) { - $ex->addHint($hint); - } - $ex->setPath($this->getPath()); - - throw $ex; - } - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/config/Definition/NodeInterface.php b/sitecake/2.2.9/server/vendor/symfony/config/Definition/NodeInterface.php deleted file mode 100644 index b9bddc4..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/config/Definition/NodeInterface.php +++ /dev/null @@ -1,88 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition; - -/** - * Common Interface among all nodes. - * - * In most cases, it is better to inherit from BaseNode instead of implementing - * this interface yourself. - * - * @author Johannes M. Schmitt - */ -interface NodeInterface -{ - /** - * Returns the name of the node. - * - * @return string The name of the node - */ - public function getName(); - - /** - * Returns the path of the node. - * - * @return string The node path - */ - public function getPath(); - - /** - * Returns true when the node is required. - * - * @return bool If the node is required - */ - public function isRequired(); - - /** - * Returns true when the node has a default value. - * - * @return bool If the node has a default value - */ - public function hasDefaultValue(); - - /** - * Returns the default value of the node. - * - * @return mixed The default value - * - * @throws \RuntimeException if the node has no default value - */ - public function getDefaultValue(); - - /** - * Normalizes the supplied value. - * - * @param mixed $value The value to normalize - * - * @return mixed The normalized value - */ - public function normalize($value); - - /** - * Merges two values together. - * - * @param mixed $leftSide - * @param mixed $rightSide - * - * @return mixed The merged values - */ - public function merge($leftSide, $rightSide); - - /** - * Finalizes a value. - * - * @param mixed $value The value to finalize - * - * @return mixed The finalized value - */ - public function finalize($value); -} diff --git a/sitecake/2.2.9/server/vendor/symfony/config/Definition/NumericNode.php b/sitecake/2.2.9/server/vendor/symfony/config/Definition/NumericNode.php deleted file mode 100644 index 2304ad9..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/config/Definition/NumericNode.php +++ /dev/null @@ -1,55 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition; - -use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException; - -/** - * This node represents a numeric value in the config tree. - * - * @author David Jeanmonod - */ -class NumericNode extends ScalarNode -{ - protected $min; - protected $max; - - public function __construct($name, NodeInterface $parent = null, $min = null, $max = null) - { - parent::__construct($name, $parent); - $this->min = $min; - $this->max = $max; - } - - /** - * {@inheritdoc} - */ - protected function finalizeValue($value) - { - $value = parent::finalizeValue($value); - - $errorMsg = null; - if (isset($this->min) && $value < $this->min) { - $errorMsg = sprintf('The value %s is too small for path "%s". Should be greater than or equal to %s', $value, $this->getPath(), $this->min); - } - if (isset($this->max) && $value > $this->max) { - $errorMsg = sprintf('The value %s is too big for path "%s". Should be less than or equal to %s', $value, $this->getPath(), $this->max); - } - if (isset($errorMsg)) { - $ex = new InvalidConfigurationException($errorMsg); - $ex->setPath($this->getPath()); - throw $ex; - } - - return $value; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/config/Definition/Processor.php b/sitecake/2.2.9/server/vendor/symfony/config/Definition/Processor.php deleted file mode 100644 index 025e693..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/config/Definition/Processor.php +++ /dev/null @@ -1,97 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition; - -/** - * This class is the entry point for config normalization/merging/finalization. - * - * @author Johannes M. Schmitt - */ -class Processor -{ - /** - * Processes an array of configurations. - * - * @param NodeInterface $configTree The node tree describing the configuration - * @param array $configs An array of configuration items to process - * - * @return array The processed configuration - */ - public function process(NodeInterface $configTree, array $configs) - { - $currentConfig = array(); - foreach ($configs as $config) { - $config = $configTree->normalize($config); - $currentConfig = $configTree->merge($currentConfig, $config); - } - - return $configTree->finalize($currentConfig); - } - - /** - * Processes an array of configurations. - * - * @param ConfigurationInterface $configuration The configuration class - * @param array $configs An array of configuration items to process - * - * @return array The processed configuration - */ - public function processConfiguration(ConfigurationInterface $configuration, array $configs) - { - return $this->process($configuration->getConfigTreeBuilder()->buildTree(), $configs); - } - - /** - * Normalizes a configuration entry. - * - * This method returns a normalize configuration array for a given key - * to remove the differences due to the original format (YAML and XML mainly). - * - * Here is an example. - * - * The configuration in XML: - * - * twig.extension.foo - * twig.extension.bar - * - * And the same configuration in YAML: - * - * extensions: ['twig.extension.foo', 'twig.extension.bar'] - * - * @param array $config A config array - * @param string $key The key to normalize - * @param string $plural The plural form of the key if it is irregular - * - * @return array - */ - public static function normalizeConfig($config, $key, $plural = null) - { - if (null === $plural) { - $plural = $key.'s'; - } - - if (isset($config[$plural])) { - return $config[$plural]; - } - - if (isset($config[$key])) { - if (is_string($config[$key]) || !is_int(key($config[$key]))) { - // only one - return array($config[$key]); - } - - return $config[$key]; - } - - return array(); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/config/Definition/PrototypeNodeInterface.php b/sitecake/2.2.9/server/vendor/symfony/config/Definition/PrototypeNodeInterface.php deleted file mode 100644 index 8bbb84d..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/config/Definition/PrototypeNodeInterface.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition; - -/** - * This interface must be implemented by nodes which can be used as prototypes. - * - * @author Johannes M. Schmitt - */ -interface PrototypeNodeInterface extends NodeInterface -{ - /** - * Sets the name of the node. - * - * @param string $name The name of the node - */ - public function setName($name); -} diff --git a/sitecake/2.2.9/server/vendor/symfony/config/Definition/PrototypedArrayNode.php b/sitecake/2.2.9/server/vendor/symfony/config/Definition/PrototypedArrayNode.php deleted file mode 100644 index 0a03d36..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/config/Definition/PrototypedArrayNode.php +++ /dev/null @@ -1,331 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition; - -use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException; -use Symfony\Component\Config\Definition\Exception\DuplicateKeyException; -use Symfony\Component\Config\Definition\Exception\UnsetKeyException; -use Symfony\Component\Config\Definition\Exception\Exception; - -/** - * Represents a prototyped Array node in the config tree. - * - * @author Johannes M. Schmitt - */ -class PrototypedArrayNode extends ArrayNode -{ - protected $prototype; - protected $keyAttribute; - protected $removeKeyAttribute = false; - protected $minNumberOfElements = 0; - protected $defaultValue = array(); - protected $defaultChildren; - - /** - * Sets the minimum number of elements that a prototype based node must - * contain. By default this is zero, meaning no elements. - * - * @param int $number - */ - public function setMinNumberOfElements($number) - { - $this->minNumberOfElements = $number; - } - - /** - * Sets the attribute which value is to be used as key. - * - * This is useful when you have an indexed array that should be an - * associative array. You can select an item from within the array - * to be the key of the particular item. For example, if "id" is the - * "key", then: - * - * array( - * array('id' => 'my_name', 'foo' => 'bar'), - * ); - * - * becomes - * - * array( - * 'my_name' => array('foo' => 'bar'), - * ); - * - * If you'd like "'id' => 'my_name'" to still be present in the resulting - * array, then you can set the second argument of this method to false. - * - * @param string $attribute The name of the attribute which value is to be used as a key - * @param bool $remove Whether or not to remove the key - */ - public function setKeyAttribute($attribute, $remove = true) - { - $this->keyAttribute = $attribute; - $this->removeKeyAttribute = $remove; - } - - /** - * Retrieves the name of the attribute which value should be used as key. - * - * @return string The name of the attribute - */ - public function getKeyAttribute() - { - return $this->keyAttribute; - } - - /** - * Sets the default value of this node. - * - * @param string $value - * - * @throws \InvalidArgumentException if the default value is not an array - */ - public function setDefaultValue($value) - { - if (!is_array($value)) { - throw new \InvalidArgumentException($this->getPath().': the default value of an array node has to be an array.'); - } - - $this->defaultValue = $value; - } - - /** - * Checks if the node has a default value. - * - * @return bool - */ - public function hasDefaultValue() - { - return true; - } - - /** - * Adds default children when none are set. - * - * @param int|string|array|null $children The number of children|The child name|The children names to be added - */ - public function setAddChildrenIfNoneSet($children = array('defaults')) - { - if (null === $children) { - $this->defaultChildren = array('defaults'); - } else { - $this->defaultChildren = is_int($children) && $children > 0 ? range(1, $children) : (array) $children; - } - } - - /** - * Retrieves the default value. - * - * The default value could be either explicited or derived from the prototype - * default value. - * - * @return array The default value - */ - public function getDefaultValue() - { - if (null !== $this->defaultChildren) { - $default = $this->prototype->hasDefaultValue() ? $this->prototype->getDefaultValue() : array(); - $defaults = array(); - foreach (array_values($this->defaultChildren) as $i => $name) { - $defaults[null === $this->keyAttribute ? $i : $name] = $default; - } - - return $defaults; - } - - return $this->defaultValue; - } - - /** - * Sets the node prototype. - * - * @param PrototypeNodeInterface $node - */ - public function setPrototype(PrototypeNodeInterface $node) - { - $this->prototype = $node; - } - - /** - * Retrieves the prototype. - * - * @return PrototypeNodeInterface The prototype - */ - public function getPrototype() - { - return $this->prototype; - } - - /** - * Disable adding concrete children for prototyped nodes. - * - * @param NodeInterface $node The child node to add - * - * @throws Exception - */ - public function addChild(NodeInterface $node) - { - throw new Exception('A prototyped array node can not have concrete children.'); - } - - /** - * Finalizes the value of this node. - * - * @param mixed $value - * - * @return mixed The finalized value - * - * @throws UnsetKeyException - * @throws InvalidConfigurationException if the node doesn't have enough children - */ - protected function finalizeValue($value) - { - if (false === $value) { - $msg = sprintf('Unsetting key for path "%s", value: %s', $this->getPath(), json_encode($value)); - throw new UnsetKeyException($msg); - } - - foreach ($value as $k => $v) { - $this->prototype->setName($k); - try { - $value[$k] = $this->prototype->finalize($v); - } catch (UnsetKeyException $unset) { - unset($value[$k]); - } - } - - if (count($value) < $this->minNumberOfElements) { - $msg = sprintf('The path "%s" should have at least %d element(s) defined.', $this->getPath(), $this->minNumberOfElements); - $ex = new InvalidConfigurationException($msg); - $ex->setPath($this->getPath()); - - throw $ex; - } - - return $value; - } - - /** - * Normalizes the value. - * - * @param mixed $value The value to normalize - * - * @return mixed The normalized value - * - * @throws InvalidConfigurationException - * @throws DuplicateKeyException - */ - protected function normalizeValue($value) - { - if (false === $value) { - return $value; - } - - $value = $this->remapXml($value); - - $isAssoc = array_keys($value) !== range(0, count($value) - 1); - $normalized = array(); - foreach ($value as $k => $v) { - if (null !== $this->keyAttribute && is_array($v)) { - if (!isset($v[$this->keyAttribute]) && is_int($k) && !$isAssoc) { - $msg = sprintf('The attribute "%s" must be set for path "%s".', $this->keyAttribute, $this->getPath()); - $ex = new InvalidConfigurationException($msg); - $ex->setPath($this->getPath()); - - throw $ex; - } elseif (isset($v[$this->keyAttribute])) { - $k = $v[$this->keyAttribute]; - - // remove the key attribute when required - if ($this->removeKeyAttribute) { - unset($v[$this->keyAttribute]); - } - - // if only "value" is left - if (1 == count($v) && isset($v['value'])) { - $v = $v['value']; - } - } - - if (array_key_exists($k, $normalized)) { - $msg = sprintf('Duplicate key "%s" for path "%s".', $k, $this->getPath()); - $ex = new DuplicateKeyException($msg); - $ex->setPath($this->getPath()); - - throw $ex; - } - } - - $this->prototype->setName($k); - if (null !== $this->keyAttribute || $isAssoc) { - $normalized[$k] = $this->prototype->normalize($v); - } else { - $normalized[] = $this->prototype->normalize($v); - } - } - - return $normalized; - } - - /** - * Merges values together. - * - * @param mixed $leftSide The left side to merge. - * @param mixed $rightSide The right side to merge. - * - * @return mixed The merged values - * - * @throws InvalidConfigurationException - * @throws \RuntimeException - */ - protected function mergeValues($leftSide, $rightSide) - { - if (false === $rightSide) { - // if this is still false after the last config has been merged the - // finalization pass will take care of removing this key entirely - return false; - } - - if (false === $leftSide || !$this->performDeepMerging) { - return $rightSide; - } - - foreach ($rightSide as $k => $v) { - // prototype, and key is irrelevant, so simply append the element - if (null === $this->keyAttribute) { - $leftSide[] = $v; - continue; - } - - // no conflict - if (!array_key_exists($k, $leftSide)) { - if (!$this->allowNewKeys) { - $ex = new InvalidConfigurationException(sprintf( - 'You are not allowed to define new elements for path "%s". '. - 'Please define all elements for this path in one config file.', - $this->getPath() - )); - $ex->setPath($this->getPath()); - - throw $ex; - } - - $leftSide[$k] = $v; - continue; - } - - $this->prototype->setName($k); - $leftSide[$k] = $this->prototype->merge($leftSide[$k], $v); - } - - return $leftSide; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/config/Definition/ReferenceDumper.php b/sitecake/2.2.9/server/vendor/symfony/config/Definition/ReferenceDumper.php deleted file mode 100644 index 09526cf..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/config/Definition/ReferenceDumper.php +++ /dev/null @@ -1,24 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition; - -@trigger_error('The '.__NAMESPACE__.'\ReferenceDumper class is deprecated since version 2.4 and will be removed in 3.0. Use the Symfony\Component\Config\Definition\Dumper\YamlReferenceDumper class instead.', E_USER_DEPRECATED); - -use Symfony\Component\Config\Definition\Dumper\YamlReferenceDumper; - -/** - * @deprecated since version 2.4, to be removed in 3.0. - * Use {@link \Symfony\Component\Config\Definition\Dumper\YamlReferenceDumper} instead. - */ -class ReferenceDumper extends YamlReferenceDumper -{ -} diff --git a/sitecake/2.2.9/server/vendor/symfony/config/Definition/ScalarNode.php b/sitecake/2.2.9/server/vendor/symfony/config/Definition/ScalarNode.php deleted file mode 100644 index 854c265..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/config/Definition/ScalarNode.php +++ /dev/null @@ -1,49 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition; - -use Symfony\Component\Config\Definition\Exception\InvalidTypeException; - -/** - * This node represents a scalar value in the config tree. - * - * The following values are considered scalars: - * * booleans - * * strings - * * null - * * integers - * * floats - * - * @author Johannes M. Schmitt - */ -class ScalarNode extends VariableNode -{ - /** - * {@inheritdoc} - */ - protected function validateType($value) - { - if (!is_scalar($value) && null !== $value) { - $ex = new InvalidTypeException(sprintf( - 'Invalid type for path "%s". Expected scalar, but got %s.', - $this->getPath(), - gettype($value) - )); - if ($hint = $this->getInfo()) { - $ex->addHint($hint); - } - $ex->setPath($this->getPath()); - - throw $ex; - } - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/config/Definition/VariableNode.php b/sitecake/2.2.9/server/vendor/symfony/config/Definition/VariableNode.php deleted file mode 100644 index 2ab7a45..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/config/Definition/VariableNode.php +++ /dev/null @@ -1,119 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition; - -use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException; - -/** - * This node represents a value of variable type in the config tree. - * - * This node is intended for values of arbitrary type. - * Any PHP type is accepted as a value. - * - * @author Jeremy Mikola - */ -class VariableNode extends BaseNode implements PrototypeNodeInterface -{ - protected $defaultValueSet = false; - protected $defaultValue; - protected $allowEmptyValue = true; - - /** - * {@inheritdoc} - */ - public function setDefaultValue($value) - { - $this->defaultValueSet = true; - $this->defaultValue = $value; - } - - /** - * {@inheritdoc} - */ - public function hasDefaultValue() - { - return $this->defaultValueSet; - } - - /** - * {@inheritdoc} - */ - public function getDefaultValue() - { - $v = $this->defaultValue; - - return $v instanceof \Closure ? $v() : $v; - } - - /** - * Sets if this node is allowed to have an empty value. - * - * @param bool $boolean True if this entity will accept empty values. - */ - public function setAllowEmptyValue($boolean) - { - $this->allowEmptyValue = (bool) $boolean; - } - - /** - * {@inheritdoc} - */ - public function setName($name) - { - $this->name = $name; - } - - /** - * {@inheritdoc} - */ - protected function validateType($value) - { - } - - /** - * {@inheritdoc} - */ - protected function finalizeValue($value) - { - if (!$this->allowEmptyValue && empty($value)) { - $ex = new InvalidConfigurationException(sprintf( - 'The path "%s" cannot contain an empty value, but got %s.', - $this->getPath(), - json_encode($value) - )); - if ($hint = $this->getInfo()) { - $ex->addHint($hint); - } - $ex->setPath($this->getPath()); - - throw $ex; - } - - return $value; - } - - /** - * {@inheritdoc} - */ - protected function normalizeValue($value) - { - return $value; - } - - /** - * {@inheritdoc} - */ - protected function mergeValues($leftSide, $rightSide) - { - return $rightSide; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/config/Exception/FileLoaderImportCircularReferenceException.php b/sitecake/2.2.9/server/vendor/symfony/config/Exception/FileLoaderImportCircularReferenceException.php deleted file mode 100644 index 6a3b01c..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/config/Exception/FileLoaderImportCircularReferenceException.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Exception; - -/** - * Exception class for when a circular reference is detected when importing resources. - * - * @author Fabien Potencier - */ -class FileLoaderImportCircularReferenceException extends FileLoaderLoadException -{ - public function __construct(array $resources, $code = null, $previous = null) - { - $message = sprintf('Circular reference detected in "%s" ("%s" > "%s").', $this->varToString($resources[0]), implode('" > "', $resources), $resources[0]); - - \Exception::__construct($message, $code, $previous); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/config/Exception/FileLoaderLoadException.php b/sitecake/2.2.9/server/vendor/symfony/config/Exception/FileLoaderLoadException.php deleted file mode 100644 index 6af3dd0..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/config/Exception/FileLoaderLoadException.php +++ /dev/null @@ -1,101 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Exception; - -/** - * Exception class for when a resource cannot be loaded or imported. - * - * @author Ryan Weaver - */ -class FileLoaderLoadException extends \Exception -{ - /** - * @param string $resource The resource that could not be imported - * @param string $sourceResource The original resource importing the new resource - * @param int $code The error code - * @param \Exception $previous A previous exception - */ - public function __construct($resource, $sourceResource = null, $code = null, $previous = null) - { - $message = ''; - if ($previous) { - // Include the previous exception, to help the user see what might be the underlying cause - - // Trim the trailing period of the previous message. We only want 1 period remove so no rtrim... - if ('.' === substr($previous->getMessage(), -1)) { - $trimmedMessage = substr($previous->getMessage(), 0, -1); - $message .= sprintf('%s', $trimmedMessage).' in '; - } else { - $message .= sprintf('%s', $previous->getMessage()).' in '; - } - $message .= $resource.' '; - - // show tweaked trace to complete the human readable sentence - if (null === $sourceResource) { - $message .= sprintf('(which is loaded in resource "%s")', $this->varToString($resource)); - } else { - $message .= sprintf('(which is being imported from "%s")', $this->varToString($sourceResource)); - } - $message .= '.'; - - // if there's no previous message, present it the default way - } elseif (null === $sourceResource) { - $message .= sprintf('Cannot load resource "%s".', $this->varToString($resource)); - } else { - $message .= sprintf('Cannot import resource "%s" from "%s".', $this->varToString($resource), $this->varToString($sourceResource)); - } - - // Is the resource located inside a bundle? - if ('@' === $resource[0]) { - $parts = explode(DIRECTORY_SEPARATOR, $resource); - $bundle = substr($parts[0], 1); - $message .= sprintf(' Make sure the "%s" bundle is correctly registered and loaded in the application kernel class.', $bundle); - $message .= sprintf(' If the bundle is registered, make sure the bundle path "%s" is not empty.', $resource); - } - - parent::__construct($message, $code, $previous); - } - - protected function varToString($var) - { - if (is_object($var)) { - return sprintf('Object(%s)', get_class($var)); - } - - if (is_array($var)) { - $a = array(); - foreach ($var as $k => $v) { - $a[] = sprintf('%s => %s', $k, $this->varToString($v)); - } - - return sprintf('Array(%s)', implode(', ', $a)); - } - - if (is_resource($var)) { - return sprintf('Resource(%s)', get_resource_type($var)); - } - - if (null === $var) { - return 'null'; - } - - if (false === $var) { - return 'false'; - } - - if (true === $var) { - return 'true'; - } - - return (string) $var; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/config/FileLocator.php b/sitecake/2.2.9/server/vendor/symfony/config/FileLocator.php deleted file mode 100644 index c224833..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/config/FileLocator.php +++ /dev/null @@ -1,95 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config; - -/** - * FileLocator uses an array of pre-defined paths to find files. - * - * @author Fabien Potencier - */ -class FileLocator implements FileLocatorInterface -{ - protected $paths; - - /** - * Constructor. - * - * @param string|array $paths A path or an array of paths where to look for resources - */ - public function __construct($paths = array()) - { - $this->paths = (array) $paths; - } - - /** - * {@inheritdoc} - */ - public function locate($name, $currentPath = null, $first = true) - { - if ('' == $name) { - throw new \InvalidArgumentException('An empty file name is not valid to be located.'); - } - - if ($this->isAbsolutePath($name)) { - if (!file_exists($name)) { - throw new \InvalidArgumentException(sprintf('The file "%s" does not exist.', $name)); - } - - return $name; - } - - $paths = $this->paths; - - if (null !== $currentPath) { - array_unshift($paths, $currentPath); - } - - $filepaths = array(); - - foreach ($paths as $path) { - if (file_exists($file = $path.DIRECTORY_SEPARATOR.$name)) { - if (true === $first) { - return $file; - } - $filepaths[] = $file; - } - } - - if (!$filepaths) { - throw new \InvalidArgumentException(sprintf('The file "%s" does not exist (in: %s).', $name, implode(', ', $paths))); - } - - return array_values(array_unique($filepaths)); - } - - /** - * Returns whether the file path is an absolute path. - * - * @param string $file A file path - * - * @return bool - */ - private function isAbsolutePath($file) - { - if ($file[0] === '/' || $file[0] === '\\' - || (strlen($file) > 3 && ctype_alpha($file[0]) - && $file[1] === ':' - && ($file[2] === '\\' || $file[2] === '/') - ) - || null !== parse_url($file, PHP_URL_SCHEME) - ) { - return true; - } - - return false; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/config/FileLocatorInterface.php b/sitecake/2.2.9/server/vendor/symfony/config/FileLocatorInterface.php deleted file mode 100644 index 6605798..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/config/FileLocatorInterface.php +++ /dev/null @@ -1,31 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config; - -/** - * @author Fabien Potencier - */ -interface FileLocatorInterface -{ - /** - * Returns a full path for a given file name. - * - * @param string $name The file name to locate - * @param string|null $currentPath The current path - * @param bool $first Whether to return the first occurrence or an array of filenames - * - * @return string|array The full path to the file or an array of file paths - * - * @throws \InvalidArgumentException When file is not found - */ - public function locate($name, $currentPath = null, $first = true); -} diff --git a/sitecake/2.2.9/server/vendor/symfony/config/LICENSE b/sitecake/2.2.9/server/vendor/symfony/config/LICENSE deleted file mode 100644 index 43028bc..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/config/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2004-2015 Fabien Potencier - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/sitecake/2.2.9/server/vendor/symfony/config/Loader/DelegatingLoader.php b/sitecake/2.2.9/server/vendor/symfony/config/Loader/DelegatingLoader.php deleted file mode 100644 index 3097878..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/config/Loader/DelegatingLoader.php +++ /dev/null @@ -1,55 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Loader; - -use Symfony\Component\Config\Exception\FileLoaderLoadException; - -/** - * DelegatingLoader delegates loading to other loaders using a loader resolver. - * - * This loader acts as an array of LoaderInterface objects - each having - * a chance to load a given resource (handled by the resolver) - * - * @author Fabien Potencier - */ -class DelegatingLoader extends Loader -{ - /** - * Constructor. - * - * @param LoaderResolverInterface $resolver A LoaderResolverInterface instance - */ - public function __construct(LoaderResolverInterface $resolver) - { - $this->resolver = $resolver; - } - - /** - * {@inheritdoc} - */ - public function load($resource, $type = null) - { - if (false === $loader = $this->resolver->resolve($resource, $type)) { - throw new FileLoaderLoadException($resource); - } - - return $loader->load($resource, $type); - } - - /** - * {@inheritdoc} - */ - public function supports($resource, $type = null) - { - return false !== $this->resolver->resolve($resource, $type); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/config/Loader/FileLoader.php b/sitecake/2.2.9/server/vendor/symfony/config/Loader/FileLoader.php deleted file mode 100644 index 9c1b4d9..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/config/Loader/FileLoader.php +++ /dev/null @@ -1,129 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Loader; - -use Symfony\Component\Config\FileLocatorInterface; -use Symfony\Component\Config\Exception\FileLoaderLoadException; -use Symfony\Component\Config\Exception\FileLoaderImportCircularReferenceException; - -/** - * FileLoader is the abstract class used by all built-in loaders that are file based. - * - * @author Fabien Potencier - */ -abstract class FileLoader extends Loader -{ - /** - * @var array - */ - protected static $loading = array(); - - /** - * @var FileLocatorInterface - */ - protected $locator; - - private $currentDir; - - /** - * Constructor. - * - * @param FileLocatorInterface $locator A FileLocatorInterface instance - */ - public function __construct(FileLocatorInterface $locator) - { - $this->locator = $locator; - } - - /** - * Sets the current directory. - * - * @param string $dir - */ - public function setCurrentDir($dir) - { - $this->currentDir = $dir; - } - - /** - * Returns the file locator used by this loader. - * - * @return FileLocatorInterface - */ - public function getLocator() - { - return $this->locator; - } - - /** - * Imports a resource. - * - * @param mixed $resource A Resource - * @param string|null $type The resource type or null if unknown - * @param bool $ignoreErrors Whether to ignore import errors or not - * @param string|null $sourceResource The original resource importing the new resource - * - * @return mixed - * - * @throws FileLoaderLoadException - * @throws FileLoaderImportCircularReferenceException - */ - public function import($resource, $type = null, $ignoreErrors = false, $sourceResource = null) - { - try { - $loader = $this->resolve($resource, $type); - - if ($loader instanceof self && null !== $this->currentDir) { - // we fallback to the current locator to keep BC - // as some some loaders do not call the parent __construct() - // @deprecated should be removed in 3.0 - $locator = $loader->getLocator() ?: $this->locator; - $resource = $locator->locate($resource, $this->currentDir, false); - } - - $resources = is_array($resource) ? $resource : array($resource); - for ($i = 0; $i < $resourcesCount = count($resources); ++$i) { - if (isset(self::$loading[$resources[$i]])) { - if ($i == $resourcesCount - 1) { - throw new FileLoaderImportCircularReferenceException(array_keys(self::$loading)); - } - } else { - $resource = $resources[$i]; - break; - } - } - self::$loading[$resource] = true; - - try { - $ret = $loader->load($resource, $type); - } catch (\Exception $e) { - unset(self::$loading[$resource]); - throw $e; - } - - unset(self::$loading[$resource]); - - return $ret; - } catch (FileLoaderImportCircularReferenceException $e) { - throw $e; - } catch (\Exception $e) { - if (!$ignoreErrors) { - // prevent embedded imports from nesting multiple exceptions - if ($e instanceof FileLoaderLoadException) { - throw $e; - } - - throw new FileLoaderLoadException($resource, $sourceResource, null, $e); - } - } - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/config/Loader/Loader.php b/sitecake/2.2.9/server/vendor/symfony/config/Loader/Loader.php deleted file mode 100644 index de4e127..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/config/Loader/Loader.php +++ /dev/null @@ -1,78 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Loader; - -use Symfony\Component\Config\Exception\FileLoaderLoadException; - -/** - * Loader is the abstract class used by all built-in loaders. - * - * @author Fabien Potencier - */ -abstract class Loader implements LoaderInterface -{ - protected $resolver; - - /** - * {@inheritdoc} - */ - public function getResolver() - { - return $this->resolver; - } - - /** - * {@inheritdoc} - */ - public function setResolver(LoaderResolverInterface $resolver) - { - $this->resolver = $resolver; - } - - /** - * Imports a resource. - * - * @param mixed $resource A resource - * @param string|null $type The resource type or null if unknown - * - * @return mixed - */ - public function import($resource, $type = null) - { - return $this->resolve($resource, $type)->load($resource, $type); - } - - /** - * Finds a loader able to load an imported resource. - * - * @param mixed $resource A resource - * @param string|null $type The resource type or null if unknown - * - * @return LoaderInterface A LoaderInterface instance - * - * @throws FileLoaderLoadException If no loader is found - */ - public function resolve($resource, $type = null) - { - if ($this->supports($resource, $type)) { - return $this; - } - - $loader = null === $this->resolver ? false : $this->resolver->resolve($resource, $type); - - if (false === $loader) { - throw new FileLoaderLoadException($resource); - } - - return $loader; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/config/Loader/LoaderInterface.php b/sitecake/2.2.9/server/vendor/symfony/config/Loader/LoaderInterface.php deleted file mode 100644 index dd0a85a..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/config/Loader/LoaderInterface.php +++ /dev/null @@ -1,54 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Loader; - -/** - * LoaderInterface is the interface implemented by all loader classes. - * - * @author Fabien Potencier - */ -interface LoaderInterface -{ - /** - * Loads a resource. - * - * @param mixed $resource The resource - * @param string|null $type The resource type or null if unknown - * - * @throws \Exception If something went wrong - */ - public function load($resource, $type = null); - - /** - * Returns whether this class supports the given resource. - * - * @param mixed $resource A resource - * @param string|null $type The resource type or null if unknown - * - * @return bool True if this class supports the given resource, false otherwise - */ - public function supports($resource, $type = null); - - /** - * Gets the loader resolver. - * - * @return LoaderResolverInterface A LoaderResolverInterface instance - */ - public function getResolver(); - - /** - * Sets the loader resolver. - * - * @param LoaderResolverInterface $resolver A LoaderResolverInterface instance - */ - public function setResolver(LoaderResolverInterface $resolver); -} diff --git a/sitecake/2.2.9/server/vendor/symfony/config/Loader/LoaderResolver.php b/sitecake/2.2.9/server/vendor/symfony/config/Loader/LoaderResolver.php deleted file mode 100644 index dc6846d..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/config/Loader/LoaderResolver.php +++ /dev/null @@ -1,75 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Loader; - -/** - * LoaderResolver selects a loader for a given resource. - * - * A resource can be anything (e.g. a full path to a config file or a Closure). - * Each loader determines whether it can load a resource and how. - * - * @author Fabien Potencier - */ -class LoaderResolver implements LoaderResolverInterface -{ - /** - * @var LoaderInterface[] An array of LoaderInterface objects - */ - private $loaders = array(); - - /** - * Constructor. - * - * @param LoaderInterface[] $loaders An array of loaders - */ - public function __construct(array $loaders = array()) - { - foreach ($loaders as $loader) { - $this->addLoader($loader); - } - } - - /** - * {@inheritdoc} - */ - public function resolve($resource, $type = null) - { - foreach ($this->loaders as $loader) { - if ($loader->supports($resource, $type)) { - return $loader; - } - } - - return false; - } - - /** - * Adds a loader. - * - * @param LoaderInterface $loader A LoaderInterface instance - */ - public function addLoader(LoaderInterface $loader) - { - $this->loaders[] = $loader; - $loader->setResolver($this); - } - - /** - * Returns the registered loaders. - * - * @return LoaderInterface[] An array of LoaderInterface instances - */ - public function getLoaders() - { - return $this->loaders; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/config/Loader/LoaderResolverInterface.php b/sitecake/2.2.9/server/vendor/symfony/config/Loader/LoaderResolverInterface.php deleted file mode 100644 index 40f1a1a..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/config/Loader/LoaderResolverInterface.php +++ /dev/null @@ -1,30 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Loader; - -/** - * LoaderResolverInterface selects a loader for a given resource. - * - * @author Fabien Potencier - */ -interface LoaderResolverInterface -{ - /** - * Returns a loader able to load the resource. - * - * @param mixed $resource A resource - * @param string|null $type The resource type or null if unknown - * - * @return LoaderInterface|false The loader or false if none is able to load the resource - */ - public function resolve($resource, $type = null); -} diff --git a/sitecake/2.2.9/server/vendor/symfony/config/README.md b/sitecake/2.2.9/server/vendor/symfony/config/README.md deleted file mode 100644 index 690d7d7..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/config/README.md +++ /dev/null @@ -1,17 +0,0 @@ -Config Component -================ - -Config provides the infrastructure for loading configurations from different -data sources and optionally monitoring these data sources for changes. There -are additional tools for validating, normalizing and handling of defaults that -can optionally be used to convert from different formats to arrays. - -Resources ---------- - -You can run the unit tests with the following command: - - $ cd path/to/Symfony/Component/Config/ - $ composer install - $ phpunit - diff --git a/sitecake/2.2.9/server/vendor/symfony/config/Resource/DirectoryResource.php b/sitecake/2.2.9/server/vendor/symfony/config/Resource/DirectoryResource.php deleted file mode 100644 index 515fb5c..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/config/Resource/DirectoryResource.php +++ /dev/null @@ -1,99 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Resource; - -/** - * DirectoryResource represents a resources stored in a subdirectory tree. - * - * @author Fabien Potencier - */ -class DirectoryResource implements ResourceInterface, \Serializable -{ - private $resource; - private $pattern; - - /** - * Constructor. - * - * @param string $resource The file path to the resource - * @param string|null $pattern A pattern to restrict monitored files - */ - public function __construct($resource, $pattern = null) - { - $this->resource = $resource; - $this->pattern = $pattern; - } - - /** - * {@inheritdoc} - */ - public function __toString() - { - return (string) $this->resource; - } - - /** - * {@inheritdoc} - */ - public function getResource() - { - return $this->resource; - } - - /** - * Returns the pattern to restrict monitored files. - * - * @return string|null - */ - public function getPattern() - { - return $this->pattern; - } - - /** - * {@inheritdoc} - */ - public function isFresh($timestamp) - { - if (!is_dir($this->resource)) { - return false; - } - - $newestMTime = filemtime($this->resource); - foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($this->resource), \RecursiveIteratorIterator::SELF_FIRST) as $file) { - // if regex filtering is enabled only check matching files - if ($this->pattern && $file->isFile() && !preg_match($this->pattern, $file->getBasename())) { - continue; - } - - // always monitor directories for changes, except the .. entries - // (otherwise deleted files wouldn't get detected) - if ($file->isDir() && '/..' === substr($file, -3)) { - continue; - } - - $newestMTime = max($file->getMTime(), $newestMTime); - } - - return $newestMTime < $timestamp; - } - - public function serialize() - { - return serialize(array($this->resource, $this->pattern)); - } - - public function unserialize($serialized) - { - list($this->resource, $this->pattern) = unserialize($serialized); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/config/Resource/FileResource.php b/sitecake/2.2.9/server/vendor/symfony/config/Resource/FileResource.php deleted file mode 100644 index 4c00ae4..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/config/Resource/FileResource.php +++ /dev/null @@ -1,75 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Resource; - -/** - * FileResource represents a resource stored on the filesystem. - * - * The resource can be a file or a directory. - * - * @author Fabien Potencier - */ -class FileResource implements ResourceInterface, \Serializable -{ - /** - * @var string|false - */ - private $resource; - - /** - * Constructor. - * - * @param string $resource The file path to the resource - */ - public function __construct($resource) - { - $this->resource = realpath($resource); - } - - /** - * {@inheritdoc} - */ - public function __toString() - { - return (string) $this->resource; - } - - /** - * {@inheritdoc} - */ - public function getResource() - { - return $this->resource; - } - - /** - * {@inheritdoc} - */ - public function isFresh($timestamp) - { - if (false === $this->resource || !file_exists($this->resource)) { - return false; - } - - return filemtime($this->resource) <= $timestamp; - } - - public function serialize() - { - return serialize($this->resource); - } - - public function unserialize($serialized) - { - $this->resource = unserialize($serialized); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/config/Resource/ResourceInterface.php b/sitecake/2.2.9/server/vendor/symfony/config/Resource/ResourceInterface.php deleted file mode 100644 index db03d12..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/config/Resource/ResourceInterface.php +++ /dev/null @@ -1,43 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Resource; - -/** - * ResourceInterface is the interface that must be implemented by all Resource classes. - * - * @author Fabien Potencier - */ -interface ResourceInterface -{ - /** - * Returns a string representation of the Resource. - * - * @return string A string representation of the Resource - */ - public function __toString(); - - /** - * Returns true if the resource has not been updated since the given timestamp. - * - * @param int $timestamp The last time the resource was loaded - * - * @return bool True if the resource has not been updated, false otherwise - */ - public function isFresh($timestamp); - - /** - * Returns the tied resource. - * - * @return mixed The resource - */ - public function getResource(); -} diff --git a/sitecake/2.2.9/server/vendor/symfony/config/Util/XmlUtils.php b/sitecake/2.2.9/server/vendor/symfony/config/Util/XmlUtils.php deleted file mode 100644 index 2ef881d..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/config/Util/XmlUtils.php +++ /dev/null @@ -1,238 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Util; - -/** - * XMLUtils is a bunch of utility methods to XML operations. - * - * This class contains static methods only and is not meant to be instantiated. - * - * @author Fabien Potencier - * @author Martin Hasoň - */ -class XmlUtils -{ - /** - * This class should not be instantiated. - */ - private function __construct() - { - } - - /** - * Loads an XML file. - * - * @param string $file An XML file path - * @param string|callable|null $schemaOrCallable An XSD schema file path, a callable, or null to disable validation - * - * @return \DOMDocument - * - * @throws \InvalidArgumentException When loading of XML file returns error - */ - public static function loadFile($file, $schemaOrCallable = null) - { - $content = @file_get_contents($file); - if ('' === trim($content)) { - throw new \InvalidArgumentException(sprintf('File %s does not contain valid XML, it is empty.', $file)); - } - - $internalErrors = libxml_use_internal_errors(true); - $disableEntities = libxml_disable_entity_loader(true); - libxml_clear_errors(); - - $dom = new \DOMDocument(); - $dom->validateOnParse = true; - if (!$dom->loadXML($content, LIBXML_NONET | (defined('LIBXML_COMPACT') ? LIBXML_COMPACT : 0))) { - libxml_disable_entity_loader($disableEntities); - - throw new \InvalidArgumentException(implode("\n", static::getXmlErrors($internalErrors))); - } - - $dom->normalizeDocument(); - - libxml_use_internal_errors($internalErrors); - libxml_disable_entity_loader($disableEntities); - - foreach ($dom->childNodes as $child) { - if ($child->nodeType === XML_DOCUMENT_TYPE_NODE) { - throw new \InvalidArgumentException('Document types are not allowed.'); - } - } - - if (null !== $schemaOrCallable) { - $internalErrors = libxml_use_internal_errors(true); - libxml_clear_errors(); - - $e = null; - if (is_callable($schemaOrCallable)) { - try { - $valid = call_user_func($schemaOrCallable, $dom, $internalErrors); - } catch (\Exception $e) { - $valid = false; - } - } elseif (!is_array($schemaOrCallable) && is_file((string) $schemaOrCallable)) { - $schemaSource = file_get_contents((string) $schemaOrCallable); - $valid = @$dom->schemaValidateSource($schemaSource); - } else { - libxml_use_internal_errors($internalErrors); - - throw new \InvalidArgumentException('The schemaOrCallable argument has to be a valid path to XSD file or callable.'); - } - - if (!$valid) { - $messages = static::getXmlErrors($internalErrors); - if (empty($messages)) { - $messages = array(sprintf('The XML file "%s" is not valid.', $file)); - } - throw new \InvalidArgumentException(implode("\n", $messages), 0, $e); - } - } - - libxml_clear_errors(); - libxml_use_internal_errors($internalErrors); - - return $dom; - } - - /** - * Converts a \DomElement object to a PHP array. - * - * The following rules applies during the conversion: - * - * * Each tag is converted to a key value or an array - * if there is more than one "value" - * - * * The content of a tag is set under a "value" key (bar) - * if the tag also has some nested tags - * - * * The attributes are converted to keys () - * - * * The nested-tags are converted to keys (bar) - * - * @param \DomElement $element A \DomElement instance - * @param bool $checkPrefix Check prefix in an element or an attribute name - * - * @return array A PHP array - */ - public static function convertDomElementToArray(\DomElement $element, $checkPrefix = true) - { - $prefix = (string) $element->prefix; - $empty = true; - $config = array(); - foreach ($element->attributes as $name => $node) { - if ($checkPrefix && !in_array((string) $node->prefix, array('', $prefix), true)) { - continue; - } - $config[$name] = static::phpize($node->value); - $empty = false; - } - - $nodeValue = false; - foreach ($element->childNodes as $node) { - if ($node instanceof \DOMText) { - if ('' !== trim($node->nodeValue)) { - $nodeValue = trim($node->nodeValue); - $empty = false; - } - } elseif ($checkPrefix && $prefix != (string) $node->prefix) { - continue; - } elseif (!$node instanceof \DOMComment) { - $value = static::convertDomElementToArray($node, $checkPrefix); - - $key = $node->localName; - if (isset($config[$key])) { - if (!is_array($config[$key]) || !is_int(key($config[$key]))) { - $config[$key] = array($config[$key]); - } - $config[$key][] = $value; - } else { - $config[$key] = $value; - } - - $empty = false; - } - } - - if (false !== $nodeValue) { - $value = static::phpize($nodeValue); - if (count($config)) { - $config['value'] = $value; - } else { - $config = $value; - } - } - - return !$empty ? $config : null; - } - - /** - * Converts an xml value to a PHP type. - * - * @param mixed $value - * - * @return mixed - */ - public static function phpize($value) - { - $value = (string) $value; - $lowercaseValue = strtolower($value); - - switch (true) { - case 'null' === $lowercaseValue: - return; - case ctype_digit($value): - $raw = $value; - $cast = (int) $value; - - return '0' == $value[0] ? octdec($value) : (((string) $raw === (string) $cast) ? $cast : $raw); - case isset($value[1]) && '-' === $value[0] && ctype_digit(substr($value, 1)): - $raw = $value; - $cast = intval($value); - - return '0' == $value[1] ? octdec($value) : (((string) $raw === (string) $cast) ? $cast : $raw); - case 'true' === $lowercaseValue: - return true; - case 'false' === $lowercaseValue: - return false; - case isset($value[1]) && '0b' == $value[0].$value[1]: - return bindec($value); - case is_numeric($value): - return '0x' === $value[0].$value[1] ? hexdec($value) : (float) $value; - case preg_match('/^0x[0-9a-f]++$/i', $value): - return hexdec($value); - case preg_match('/^(-|\+)?[0-9]+(\.[0-9]+)?$/', $value): - return (float) $value; - default: - return $value; - } - } - - protected static function getXmlErrors($internalErrors) - { - $errors = array(); - foreach (libxml_get_errors() as $error) { - $errors[] = sprintf('[%s %s] %s (in %s - line %d, column %d)', - LIBXML_ERR_WARNING == $error->level ? 'WARNING' : 'ERROR', - $error->code, - trim($error->message), - $error->file ?: 'n/a', - $error->line, - $error->column - ); - } - - libxml_clear_errors(); - libxml_use_internal_errors($internalErrors); - - return $errors; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/config/composer.json b/sitecake/2.2.9/server/vendor/symfony/config/composer.json deleted file mode 100644 index a14d935..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/config/composer.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "name": "symfony/config", - "type": "library", - "description": "Symfony Config Component", - "keywords": [], - "homepage": "https://symfony.com", - "license": "MIT", - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "require": { - "php": ">=5.3.9", - "symfony/filesystem": "~2.3" - }, - "require-dev": { - "symfony/phpunit-bridge": "~2.7" - }, - "autoload": { - "psr-4": { "Symfony\\Component\\Config\\": "" } - }, - "minimum-stability": "dev", - "extra": { - "branch-alias": { - "dev-master": "2.7-dev" - } - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/config/phpunit.xml.dist b/sitecake/2.2.9/server/vendor/symfony/config/phpunit.xml.dist deleted file mode 100644 index 3fe6fd8..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/config/phpunit.xml.dist +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - ./Tests/ - - - - - - ./ - - ./Resources - ./Tests - ./vendor - - - - diff --git a/sitecake/2.2.9/server/vendor/symfony/debug/CHANGELOG.md b/sitecake/2.2.9/server/vendor/symfony/debug/CHANGELOG.md deleted file mode 100644 index 31f0de9..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/debug/CHANGELOG.md +++ /dev/null @@ -1,35 +0,0 @@ -CHANGELOG -========= - -2.7.0 ------ - -* added deprecations checking for parent interfaces/classes to DebugClassLoader -* added ZTS support to symfony_debug extension -* added symfony_debug_backtrace() to symfony_debug extension - to track the backtrace of fatal errors - -2.6.0 ------ - -* generalized ErrorHandler and ExceptionHandler, - with some new methods and others deprecated -* enhanced error messages for uncaught exceptions - -2.5.0 ------ - -* added ExceptionHandler::setHandler() -* added UndefinedMethodFatalErrorHandler -* deprecated DummyException - -2.4.0 ------ - - * added a DebugClassLoader able to wrap any autoloader providing a findFile method - * improved error messages for not found classes and functions - -2.3.0 ------ - - * added the component diff --git a/sitecake/2.2.9/server/vendor/symfony/debug/Debug.php b/sitecake/2.2.9/server/vendor/symfony/debug/Debug.php deleted file mode 100644 index 08b35f4..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/debug/Debug.php +++ /dev/null @@ -1,62 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Debug; - -/** - * Registers all the debug tools. - * - * @author Fabien Potencier - */ -class Debug -{ - private static $enabled = false; - - /** - * Enables the debug tools. - * - * This method registers an error handler and an exception handler. - * - * If the Symfony ClassLoader component is available, a special - * class loader is also registered. - * - * @param int $errorReportingLevel The level of error reporting you want - * @param bool $displayErrors Whether to display errors (for development) or just log them (for production) - */ - public static function enable($errorReportingLevel = null, $displayErrors = true) - { - if (static::$enabled) { - return; - } - - static::$enabled = true; - - if (null !== $errorReportingLevel) { - error_reporting($errorReportingLevel); - } else { - error_reporting(-1); - } - - if ('cli' !== php_sapi_name()) { - ini_set('display_errors', 0); - ExceptionHandler::register(); - } elseif ($displayErrors && (!ini_get('log_errors') || ini_get('error_log'))) { - // CLI - display errors only if they're not already logged to STDERR - ini_set('display_errors', 1); - } - $handler = ErrorHandler::register(); - if (!$displayErrors) { - $handler->throwAt(0, true); - } - - DebugClassLoader::enable(); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/debug/DebugClassLoader.php b/sitecake/2.2.9/server/vendor/symfony/debug/DebugClassLoader.php deleted file mode 100644 index 01104ea..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/debug/DebugClassLoader.php +++ /dev/null @@ -1,258 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Debug; - -/** - * Autoloader checking if the class is really defined in the file found. - * - * The ClassLoader will wrap all registered autoloaders - * and will throw an exception if a file is found but does - * not declare the class. - * - * @author Fabien Potencier - * @author Christophe Coevoet - * @author Nicolas Grekas - * - * @api - */ -class DebugClassLoader -{ - private $classLoader; - private $isFinder; - private $wasFinder; - private static $caseCheck; - private static $deprecated = array(); - private static $php7Reserved = array('int', 'float', 'bool', 'string', 'true', 'false', 'null'); - - /** - * Constructor. - * - * @param callable|object $classLoader Passing an object is @deprecated since version 2.5 and support for it will be removed in 3.0 - * - * @api - */ - public function __construct($classLoader) - { - $this->wasFinder = is_object($classLoader) && method_exists($classLoader, 'findFile'); - - if ($this->wasFinder) { - @trigger_error('The '.__METHOD__.' method will no longer support receiving an object into its $classLoader argument in 3.0.', E_USER_DEPRECATED); - $this->classLoader = array($classLoader, 'loadClass'); - $this->isFinder = true; - } else { - $this->classLoader = $classLoader; - $this->isFinder = is_array($classLoader) && method_exists($classLoader[0], 'findFile'); - } - - if (!isset(self::$caseCheck)) { - self::$caseCheck = false !== stripos(PHP_OS, 'win') ? (false !== stripos(PHP_OS, 'darwin') ? 2 : 1) : 0; - } - } - - /** - * Gets the wrapped class loader. - * - * @return callable|object A class loader. Since version 2.5, returning an object is @deprecated and support for it will be removed in 3.0 - */ - public function getClassLoader() - { - return $this->wasFinder ? $this->classLoader[0] : $this->classLoader; - } - - /** - * Wraps all autoloaders. - */ - public static function enable() - { - // Ensures we don't hit https://bugs.php.net/42098 - class_exists('Symfony\Component\Debug\ErrorHandler'); - class_exists('Psr\Log\LogLevel'); - - if (!is_array($functions = spl_autoload_functions())) { - return; - } - - foreach ($functions as $function) { - spl_autoload_unregister($function); - } - - foreach ($functions as $function) { - if (!is_array($function) || !$function[0] instanceof self) { - $function = array(new static($function), 'loadClass'); - } - - spl_autoload_register($function); - } - } - - /** - * Disables the wrapping. - */ - public static function disable() - { - if (!is_array($functions = spl_autoload_functions())) { - return; - } - - foreach ($functions as $function) { - spl_autoload_unregister($function); - } - - foreach ($functions as $function) { - if (is_array($function) && $function[0] instanceof self) { - $function = $function[0]->getClassLoader(); - } - - spl_autoload_register($function); - } - } - - /** - * Finds a file by class name. - * - * @param string $class A class name to resolve to file - * - * @return string|null - * - * @deprecated since version 2.5, to be removed in 3.0. - */ - public function findFile($class) - { - @trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED); - - if ($this->wasFinder) { - return $this->classLoader[0]->findFile($class); - } - } - - /** - * Loads the given class or interface. - * - * @param string $class The name of the class - * - * @return bool|null True, if loaded - * - * @throws \RuntimeException - */ - public function loadClass($class) - { - ErrorHandler::stackErrors(); - - try { - if ($this->isFinder) { - if ($file = $this->classLoader[0]->findFile($class)) { - require $file; - } - } else { - call_user_func($this->classLoader, $class); - $file = false; - } - } catch (\Exception $e) { - ErrorHandler::unstackErrors(); - - throw $e; - } - - ErrorHandler::unstackErrors(); - - $exists = class_exists($class, false) || interface_exists($class, false) || (function_exists('trait_exists') && trait_exists($class, false)); - - if ('\\' === $class[0]) { - $class = substr($class, 1); - } - - if ($exists) { - $refl = new \ReflectionClass($class); - $name = $refl->getName(); - - if ($name !== $class && 0 === strcasecmp($name, $class)) { - throw new \RuntimeException(sprintf('Case mismatch between loaded and declared class names: %s vs %s', $class, $name)); - } - - if (in_array(strtolower($refl->getShortName()), self::$php7Reserved)) { - trigger_error(sprintf('%s uses a reserved class name (%s) that will break on PHP 7 and higher', $name, $refl->getShortName()), E_USER_DEPRECATED); - } elseif (preg_match('#\n \* @deprecated (.*?)\r?\n \*(?: @|/$)#s', $refl->getDocComment(), $notice)) { - self::$deprecated[$name] = preg_replace('#\s*\r?\n \* +#', ' ', $notice[1]); - } else { - if (2 > $len = 1 + (strpos($name, '\\', 1 + strpos($name, '\\')) ?: strpos($name, '_'))) { - $len = 0; - $ns = ''; - } else { - switch ($ns = substr($name, 0, $len)) { - case 'Symfony\Bridge\\': - case 'Symfony\Bundle\\': - case 'Symfony\Component\\': - $ns = 'Symfony\\'; - $len = strlen($ns); - break; - } - } - $parent = $refl->getParentClass(); - - if (!$parent || strncmp($ns, $parent->name, $len)) { - if ($parent && isset(self::$deprecated[$parent->name]) && strncmp($ns, $parent->name, $len)) { - @trigger_error(sprintf('The %s class extends %s that is deprecated %s', $name, $parent->name, self::$deprecated[$parent->name]), E_USER_DEPRECATED); - } - - foreach ($refl->getInterfaceNames() as $interface) { - if (isset(self::$deprecated[$interface]) && strncmp($ns, $interface, $len) && !($parent && $parent->implementsInterface($interface))) { - @trigger_error(sprintf('The %s %s %s that is deprecated %s', $name, $refl->isInterface() ? 'interface extends' : 'class implements', $interface, self::$deprecated[$interface]), E_USER_DEPRECATED); - } - } - } - } - } - - if ($file) { - if (!$exists) { - if (false !== strpos($class, '/')) { - throw new \RuntimeException(sprintf('Trying to autoload a class with an invalid name "%s". Be careful that the namespace separator is "\" in PHP, not "/".', $class)); - } - - throw new \RuntimeException(sprintf('The autoloader expected class "%s" to be defined in file "%s". The file was found but the class was not in it, the class name or namespace probably has a typo.', $class, $file)); - } - if (self::$caseCheck && preg_match('#([/\\\\][a-zA-Z_\x7F-\xFF][a-zA-Z0-9_\x7F-\xFF]*)+\.(php|hh)$#D', $file, $tail)) { - $tail = $tail[0]; - $real = $refl->getFilename(); - - if (2 === self::$caseCheck) { - // realpath() on MacOSX doesn't normalize the case of characters - $cwd = getcwd(); - $basename = strrpos($real, '/'); - chdir(substr($real, 0, $basename)); - $basename = substr($real, $basename + 1); - // glob() patterns are case-sensitive even if the underlying fs is not - if (!in_array($basename, glob($basename.'*', GLOB_NOSORT), true)) { - $real = getcwd().'/'; - $h = opendir('.'); - while (false !== $f = readdir($h)) { - if (0 === strcasecmp($f, $basename)) { - $real .= $f; - break; - } - } - closedir($h); - } - chdir($cwd); - } - - if (0 === substr_compare($real, $tail, -strlen($tail), strlen($tail), true) - && 0 !== substr_compare($real, $tail, -strlen($tail), strlen($tail), false) - ) { - throw new \RuntimeException(sprintf('Case mismatch between class and source file names: %s vs %s', $class, $real)); - } - } - - return true; - } - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/debug/ErrorHandler.php b/sitecake/2.2.9/server/vendor/symfony/debug/ErrorHandler.php deleted file mode 100644 index 112ba03..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/debug/ErrorHandler.php +++ /dev/null @@ -1,718 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Debug; - -use Psr\Log\LogLevel; -use Psr\Log\LoggerInterface; -use Symfony\Component\Debug\Exception\ContextErrorException; -use Symfony\Component\Debug\Exception\FatalBaseException; -use Symfony\Component\Debug\Exception\FatalErrorException; -use Symfony\Component\Debug\Exception\OutOfMemoryException; -use Symfony\Component\Debug\FatalErrorHandler\UndefinedFunctionFatalErrorHandler; -use Symfony\Component\Debug\FatalErrorHandler\UndefinedMethodFatalErrorHandler; -use Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandler; -use Symfony\Component\Debug\FatalErrorHandler\FatalErrorHandlerInterface; - -/** - * A generic ErrorHandler for the PHP engine. - * - * Provides five bit fields that control how errors are handled: - * - thrownErrors: errors thrown as \ErrorException - * - loggedErrors: logged errors, when not @-silenced - * - scopedErrors: errors thrown or logged with their local context - * - tracedErrors: errors logged with their stack trace, only once for repeated errors - * - screamedErrors: never @-silenced errors - * - * Each error level can be logged by a dedicated PSR-3 logger object. - * Screaming only applies to logging. - * Throwing takes precedence over logging. - * Uncaught exceptions are logged as E_ERROR. - * E_DEPRECATED and E_USER_DEPRECATED levels never throw. - * E_RECOVERABLE_ERROR and E_USER_ERROR levels always throw. - * Non catchable errors that can be detected at shutdown time are logged when the scream bit field allows so. - * As errors have a performance cost, repeated errors are all logged, so that the developer - * can see them and weight them as more important to fix than others of the same level. - * - * @author Nicolas Grekas - */ -class ErrorHandler -{ - /** - * @deprecated since version 2.6, to be removed in 3.0. - */ - const TYPE_DEPRECATION = -100; - - private $levels = array( - E_DEPRECATED => 'Deprecated', - E_USER_DEPRECATED => 'User Deprecated', - E_NOTICE => 'Notice', - E_USER_NOTICE => 'User Notice', - E_STRICT => 'Runtime Notice', - E_WARNING => 'Warning', - E_USER_WARNING => 'User Warning', - E_COMPILE_WARNING => 'Compile Warning', - E_CORE_WARNING => 'Core Warning', - E_USER_ERROR => 'User Error', - E_RECOVERABLE_ERROR => 'Catchable Fatal Error', - E_COMPILE_ERROR => 'Compile Error', - E_PARSE => 'Parse Error', - E_ERROR => 'Error', - E_CORE_ERROR => 'Core Error', - ); - - private $loggers = array( - E_DEPRECATED => array(null, LogLevel::INFO), - E_USER_DEPRECATED => array(null, LogLevel::INFO), - E_NOTICE => array(null, LogLevel::WARNING), - E_USER_NOTICE => array(null, LogLevel::WARNING), - E_STRICT => array(null, LogLevel::WARNING), - E_WARNING => array(null, LogLevel::WARNING), - E_USER_WARNING => array(null, LogLevel::WARNING), - E_COMPILE_WARNING => array(null, LogLevel::WARNING), - E_CORE_WARNING => array(null, LogLevel::WARNING), - E_USER_ERROR => array(null, LogLevel::CRITICAL), - E_RECOVERABLE_ERROR => array(null, LogLevel::CRITICAL), - E_COMPILE_ERROR => array(null, LogLevel::CRITICAL), - E_PARSE => array(null, LogLevel::CRITICAL), - E_ERROR => array(null, LogLevel::CRITICAL), - E_CORE_ERROR => array(null, LogLevel::CRITICAL), - ); - - private $thrownErrors = 0x1FFF; // E_ALL - E_DEPRECATED - E_USER_DEPRECATED - private $scopedErrors = 0x1FFF; // E_ALL - E_DEPRECATED - E_USER_DEPRECATED - private $tracedErrors = 0x77FB; // E_ALL - E_STRICT - E_PARSE - private $screamedErrors = 0x55; // E_ERROR + E_CORE_ERROR + E_COMPILE_ERROR + E_PARSE - private $loggedErrors = 0; - - private $loggedTraces = array(); - private $isRecursive = 0; - private $exceptionHandler; - - private static $reservedMemory; - private static $stackedErrors = array(); - private static $stackedErrorLevels = array(); - - /** - * Same init value as thrownErrors. - * - * @deprecated since version 2.6, to be removed in 3.0. - */ - private $displayErrors = 0x1FFF; - - /** - * Registers the error handler. - * - * @param self|null|int $handler The handler to register, or @deprecated (since version 2.6, to be removed in 3.0) bit field of thrown levels - * @param bool $replace Whether to replace or not any existing handler - * - * @return self The registered error handler - */ - public static function register($handler = null, $replace = true) - { - if (null === self::$reservedMemory) { - self::$reservedMemory = str_repeat('x', 10240); - register_shutdown_function(__CLASS__.'::handleFatalError'); - } - - $levels = -1; - - if ($handlerIsNew = !$handler instanceof self) { - // @deprecated polymorphism, to be removed in 3.0 - if (null !== $handler) { - $levels = $replace ? $handler : 0; - $replace = true; - } - $handler = new static(); - } - - $prev = set_error_handler(array($handler, 'handleError'), $handler->thrownErrors | $handler->loggedErrors); - - if ($handlerIsNew && is_array($prev) && $prev[0] instanceof self) { - $handler = $prev[0]; - $replace = false; - } - if ($replace || !$prev) { - $handler->setExceptionHandler(set_exception_handler(array($handler, 'handleException'))); - } else { - restore_error_handler(); - } - - $handler->throwAt($levels & $handler->thrownErrors, true); - - return $handler; - } - - /** - * Sets a logger to non assigned errors levels. - * - * @param LoggerInterface $logger A PSR-3 logger to put as default for the given levels - * @param array|int $levels An array map of E_* to LogLevel::* or an integer bit field of E_* constants - * @param bool $replace Whether to replace or not any existing logger - */ - public function setDefaultLogger(LoggerInterface $logger, $levels = null, $replace = false) - { - $loggers = array(); - - if (is_array($levels)) { - foreach ($levels as $type => $logLevel) { - if (empty($this->loggers[$type][0]) || $replace) { - $loggers[$type] = array($logger, $logLevel); - } - } - } else { - if (null === $levels) { - $levels = E_ALL | E_STRICT; - } - foreach ($this->loggers as $type => $log) { - if (($type & $levels) && (empty($log[0]) || $replace)) { - $log[0] = $logger; - $loggers[$type] = $log; - } - } - } - - $this->setLoggers($loggers); - } - - /** - * Sets a logger for each error level. - * - * @param array $loggers Error levels to [LoggerInterface|null, LogLevel::*] map - * - * @return array The previous map - * - * @throws \InvalidArgumentException - */ - public function setLoggers(array $loggers) - { - $prevLogged = $this->loggedErrors; - $prev = $this->loggers; - - foreach ($loggers as $type => $log) { - if (!isset($prev[$type])) { - throw new \InvalidArgumentException('Unknown error type: '.$type); - } - if (!is_array($log)) { - $log = array($log); - } elseif (!array_key_exists(0, $log)) { - throw new \InvalidArgumentException('No logger provided'); - } - if (null === $log[0]) { - $this->loggedErrors &= ~$type; - } elseif ($log[0] instanceof LoggerInterface) { - $this->loggedErrors |= $type; - } else { - throw new \InvalidArgumentException('Invalid logger provided'); - } - $this->loggers[$type] = $log + $prev[$type]; - } - $this->reRegister($prevLogged | $this->thrownErrors); - - return $prev; - } - - /** - * Sets a user exception handler. - * - * @param callable $handler A handler that will be called on Exception - * - * @return callable|null The previous exception handler - * - * @throws \InvalidArgumentException - */ - public function setExceptionHandler($handler) - { - if (null !== $handler && !is_callable($handler)) { - throw new \LogicException('The exception handler must be a valid PHP callable.'); - } - $prev = $this->exceptionHandler; - $this->exceptionHandler = $handler; - - return $prev; - } - - /** - * Sets the PHP error levels that throw an exception when a PHP error occurs. - * - * @param int $levels A bit field of E_* constants for thrown errors - * @param bool $replace Replace or amend the previous value - * - * @return int The previous value - */ - public function throwAt($levels, $replace = false) - { - $prev = $this->thrownErrors; - $this->thrownErrors = ($levels | E_RECOVERABLE_ERROR | E_USER_ERROR) & ~E_USER_DEPRECATED & ~E_DEPRECATED; - if (!$replace) { - $this->thrownErrors |= $prev; - } - $this->reRegister($prev | $this->loggedErrors); - - // $this->displayErrors is @deprecated since version 2.6 - $this->displayErrors = $this->thrownErrors; - - return $prev; - } - - /** - * Sets the PHP error levels for which local variables are preserved. - * - * @param int $levels A bit field of E_* constants for scoped errors - * @param bool $replace Replace or amend the previous value - * - * @return int The previous value - */ - public function scopeAt($levels, $replace = false) - { - $prev = $this->scopedErrors; - $this->scopedErrors = (int) $levels; - if (!$replace) { - $this->scopedErrors |= $prev; - } - - return $prev; - } - - /** - * Sets the PHP error levels for which the stack trace is preserved. - * - * @param int $levels A bit field of E_* constants for traced errors - * @param bool $replace Replace or amend the previous value - * - * @return int The previous value - */ - public function traceAt($levels, $replace = false) - { - $prev = $this->tracedErrors; - $this->tracedErrors = (int) $levels; - if (!$replace) { - $this->tracedErrors |= $prev; - } - - return $prev; - } - - /** - * Sets the error levels where the @-operator is ignored. - * - * @param int $levels A bit field of E_* constants for screamed errors - * @param bool $replace Replace or amend the previous value - * - * @return int The previous value - */ - public function screamAt($levels, $replace = false) - { - $prev = $this->screamedErrors; - $this->screamedErrors = (int) $levels; - if (!$replace) { - $this->screamedErrors |= $prev; - } - - return $prev; - } - - /** - * Re-registers as a PHP error handler if levels changed. - */ - private function reRegister($prev) - { - if ($prev !== $this->thrownErrors | $this->loggedErrors) { - $handler = set_error_handler('var_dump', 0); - $handler = is_array($handler) ? $handler[0] : null; - restore_error_handler(); - if ($handler === $this) { - restore_error_handler(); - set_error_handler(array($this, 'handleError'), $this->thrownErrors | $this->loggedErrors); - } - } - } - - /** - * Handles errors by filtering then logging them according to the configured bit fields. - * - * @param int $type One of the E_* constants - * @param string $file - * @param int $line - * @param array $context - * - * @return bool Returns false when no handling happens so that the PHP engine can handle the error itself. - * - * @throws \ErrorException When $this->thrownErrors requests so - * - * @internal - */ - public function handleError($type, $message, $file, $line, array $context) - { - $level = error_reporting() | E_RECOVERABLE_ERROR | E_USER_ERROR; - $log = $this->loggedErrors & $type; - $throw = $this->thrownErrors & $type & $level; - $type &= $level | $this->screamedErrors; - - if (!$type || (!$log && !$throw)) { - return $type && $log; - } - - if (PHP_VERSION_ID < 50400 && isset($context['GLOBALS']) && ($this->scopedErrors & $type)) { - $e = $context; // Whatever the signature of the method, - unset($e['GLOBALS'], $context); // $context is always a reference in 5.3 - $context = $e; - } - - if ($throw) { - if (($this->scopedErrors & $type) && class_exists('Symfony\Component\Debug\Exception\ContextErrorException')) { - // Checking for class existence is a work around for https://bugs.php.net/42098 - $throw = new ContextErrorException($this->levels[$type].': '.$message, 0, $type, $file, $line, $context); - } else { - $throw = new \ErrorException($this->levels[$type].': '.$message, 0, $type, $file, $line); - } - - if (PHP_VERSION_ID <= 50407 && (PHP_VERSION_ID >= 50400 || PHP_VERSION_ID <= 50317)) { - // Exceptions thrown from error handlers are sometimes not caught by the exception - // handler and shutdown handlers are bypassed before 5.4.8/5.3.18. - // We temporarily re-enable display_errors to prevent any blank page related to this bug. - - $throw->errorHandlerCanary = new ErrorHandlerCanary(); - } - - throw $throw; - } - - // For duplicated errors, log the trace only once - $e = md5("{$type}/{$line}/{$file}\x00{$message}", true); - $trace = true; - - if (!($this->tracedErrors & $type) || isset($this->loggedTraces[$e])) { - $trace = false; - } else { - $this->loggedTraces[$e] = 1; - } - - $e = compact('type', 'file', 'line', 'level'); - - if ($type & $level) { - if ($this->scopedErrors & $type) { - $e['scope_vars'] = $context; - if ($trace) { - $e['stack'] = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT); - } - } elseif ($trace) { - $e['stack'] = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); - } - } - - if ($this->isRecursive) { - $log = 0; - } elseif (self::$stackedErrorLevels) { - self::$stackedErrors[] = array($this->loggers[$type], $message, $e); - } else { - try { - $this->isRecursive = true; - $this->loggers[$type][0]->log(($type & $level) ? $this->loggers[$type][1] : LogLevel::DEBUG, $message, $e); - $this->isRecursive = false; - } catch (\Exception $e) { - $this->isRecursive = false; - - throw $e; - } - } - - return $type && $log; - } - - /** - * Handles an exception by logging then forwarding it to an other handler. - * - * @param \Exception|\BaseException $exception An exception to handle - * @param array $error An array as returned by error_get_last() - * - * @internal - */ - public function handleException($exception, array $error = null) - { - if (!$exception instanceof \Exception) { - $exception = new FatalBaseException($exception); - } - $type = $exception instanceof FatalErrorException ? $exception->getSeverity() : E_ERROR; - - if ($this->loggedErrors & $type) { - $e = array( - 'type' => $type, - 'file' => $exception->getFile(), - 'line' => $exception->getLine(), - 'level' => error_reporting(), - 'stack' => $exception->getTrace(), - ); - if ($exception instanceof FatalBaseException) { - $error = array( - 'type' => $type, - 'message' => $message = $exception->getMessage(), - 'file' => $e['file'], - 'line' => $e['line'], - ); - } elseif ($exception instanceof FatalErrorException) { - $message = 'Fatal '.$exception->getMessage(); - } elseif ($exception instanceof \ErrorException) { - $message = 'Uncaught '.$exception->getMessage(); - if ($exception instanceof ContextErrorException) { - $e['context'] = $exception->getContext(); - } - } else { - $message = 'Uncaught Exception: '.$exception->getMessage(); - } - if ($this->loggedErrors & $e['type']) { - $this->loggers[$e['type']][0]->log($this->loggers[$e['type']][1], $message, $e); - } - } - if ($exception instanceof FatalErrorException && !$exception instanceof OutOfMemoryException && $error) { - foreach ($this->getFatalErrorHandlers() as $handler) { - if ($e = $handler->handleError($error, $exception)) { - $exception = $e; - break; - } - } - } - if (empty($this->exceptionHandler)) { - throw $exception; // Give back $exception to the native handler - } - try { - call_user_func($this->exceptionHandler, $exception); - } catch (\Exception $handlerException) { - $this->exceptionHandler = null; - $this->handleException($handlerException); - } catch (\BaseException $handlerException) { - $this->exceptionHandler = null; - $this->handleException($handlerException); - } - } - - /** - * Shutdown registered function for handling PHP fatal errors. - * - * @param array $error An array as returned by error_get_last() - * - * @internal - */ - public static function handleFatalError(array $error = null) - { - self::$reservedMemory = ''; - - $handler = set_error_handler('var_dump', 0); - $handler = is_array($handler) ? $handler[0] : null; - restore_error_handler(); - - if (!$handler instanceof self) { - return; - } - - if (null === $error) { - $error = error_get_last(); - } - - try { - while (self::$stackedErrorLevels) { - static::unstackErrors(); - } - } catch (\Exception $exception) { - // Handled below - } - - if ($error && ($error['type'] & (E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR))) { - // Let's not throw anymore but keep logging - $handler->throwAt(0, true); - - if (0 === strpos($error['message'], 'Allowed memory') || 0 === strpos($error['message'], 'Out of memory')) { - $exception = new OutOfMemoryException($handler->levels[$error['type']].': '.$error['message'], 0, $error['type'], $error['file'], $error['line'], 2, false); - } else { - $exception = new FatalErrorException($handler->levels[$error['type']].': '.$error['message'], 0, $error['type'], $error['file'], $error['line'], 2, true); - } - } elseif (!isset($exception)) { - return; - } - - try { - $handler->handleException($exception, $error); - } catch (FatalErrorException $e) { - // Ignore this re-throw - } - } - - /** - * Configures the error handler for delayed handling. - * Ensures also that non-catchable fatal errors are never silenced. - * - * As shown by http://bugs.php.net/42098 and http://bugs.php.net/60724 - * PHP has a compile stage where it behaves unusually. To workaround it, - * we plug an error handler that only stacks errors for later. - * - * The most important feature of this is to prevent - * autoloading until unstackErrors() is called. - */ - public static function stackErrors() - { - self::$stackedErrorLevels[] = error_reporting(error_reporting() | E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR); - } - - /** - * Unstacks stacked errors and forwards to the logger. - */ - public static function unstackErrors() - { - $level = array_pop(self::$stackedErrorLevels); - - if (null !== $level) { - $e = error_reporting($level); - if ($e !== ($level | E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR)) { - // If the user changed the error level, do not overwrite it - error_reporting($e); - } - } - - if (empty(self::$stackedErrorLevels)) { - $errors = self::$stackedErrors; - self::$stackedErrors = array(); - - foreach ($errors as $e) { - $e[0][0]->log($e[0][1], $e[1], $e[2]); - } - } - } - - /** - * Gets the fatal error handlers. - * - * Override this method if you want to define more fatal error handlers. - * - * @return FatalErrorHandlerInterface[] An array of FatalErrorHandlerInterface - */ - protected function getFatalErrorHandlers() - { - return array( - new UndefinedFunctionFatalErrorHandler(), - new UndefinedMethodFatalErrorHandler(), - new ClassNotFoundFatalErrorHandler(), - ); - } - - /** - * Sets the level at which the conversion to Exception is done. - * - * @param int|null $level The level (null to use the error_reporting() value and 0 to disable) - * - * @deprecated since version 2.6, to be removed in 3.0. Use throwAt() instead. - */ - public function setLevel($level) - { - @trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the throwAt() method instead.', E_USER_DEPRECATED); - - $level = null === $level ? error_reporting() : $level; - $this->throwAt($level, true); - } - - /** - * Sets the display_errors flag value. - * - * @param int $displayErrors The display_errors flag value - * - * @deprecated since version 2.6, to be removed in 3.0. Use throwAt() instead. - */ - public function setDisplayErrors($displayErrors) - { - @trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the throwAt() method instead.', E_USER_DEPRECATED); - - if ($displayErrors) { - $this->throwAt($this->displayErrors, true); - } else { - $displayErrors = $this->displayErrors; - $this->throwAt(0, true); - $this->displayErrors = $displayErrors; - } - } - - /** - * Sets a logger for the given channel. - * - * @param LoggerInterface $logger A logger interface - * @param string $channel The channel associated with the logger (deprecation, emergency or scream) - * - * @deprecated since version 2.6, to be removed in 3.0. Use setLoggers() or setDefaultLogger() instead. - */ - public static function setLogger(LoggerInterface $logger, $channel = 'deprecation') - { - @trigger_error('The '.__METHOD__.' static method is deprecated since version 2.6 and will be removed in 3.0. Use the setLoggers() or setDefaultLogger() methods instead.', E_USER_DEPRECATED); - - $handler = set_error_handler('var_dump', 0); - $handler = is_array($handler) ? $handler[0] : null; - restore_error_handler(); - if (!$handler instanceof self) { - return; - } - if ('deprecation' === $channel) { - $handler->setDefaultLogger($logger, E_DEPRECATED | E_USER_DEPRECATED, true); - $handler->screamAt(E_DEPRECATED | E_USER_DEPRECATED); - } elseif ('scream' === $channel) { - $handler->setDefaultLogger($logger, E_ALL | E_STRICT, false); - $handler->screamAt(E_ALL | E_STRICT); - } elseif ('emergency' === $channel) { - $handler->setDefaultLogger($logger, E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR, true); - $handler->screamAt(E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR); - } - } - - /** - * @deprecated since version 2.6, to be removed in 3.0. Use handleError() instead. - */ - public function handle($level, $message, $file = 'unknown', $line = 0, $context = array()) - { - $this->handleError(E_USER_DEPRECATED, 'The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the handleError() method instead.', __FILE__, __LINE__, array()); - - return $this->handleError($level, $message, $file, $line, (array) $context); - } - - /** - * Handles PHP fatal errors. - * - * @deprecated since version 2.6, to be removed in 3.0. Use handleFatalError() instead. - */ - public function handleFatal() - { - @trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the handleFatalError() method instead.', E_USER_DEPRECATED); - - static::handleFatalError(); - } -} - -/** - * Private class used to work around https://bugs.php.net/54275. - * - * @author Nicolas Grekas - * - * @internal - */ -class ErrorHandlerCanary -{ - private static $displayErrors = null; - - public function __construct() - { - if (null === self::$displayErrors) { - self::$displayErrors = ini_set('display_errors', 1); - } - } - - public function __destruct() - { - if (null !== self::$displayErrors) { - ini_set('display_errors', self::$displayErrors); - self::$displayErrors = null; - } - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/debug/Exception/ClassNotFoundException.php b/sitecake/2.2.9/server/vendor/symfony/debug/Exception/ClassNotFoundException.php deleted file mode 100644 index b91bf46..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/debug/Exception/ClassNotFoundException.php +++ /dev/null @@ -1,33 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Debug\Exception; - -/** - * Class (or Trait or Interface) Not Found Exception. - * - * @author Konstanton Myakshin - */ -class ClassNotFoundException extends FatalErrorException -{ - public function __construct($message, \ErrorException $previous) - { - parent::__construct( - $message, - $previous->getCode(), - $previous->getSeverity(), - $previous->getFile(), - $previous->getLine(), - $previous->getPrevious() - ); - $this->setTrace($previous->getTrace()); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/debug/Exception/ContextErrorException.php b/sitecake/2.2.9/server/vendor/symfony/debug/Exception/ContextErrorException.php deleted file mode 100644 index 54f0198..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/debug/Exception/ContextErrorException.php +++ /dev/null @@ -1,36 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Debug\Exception; - -/** - * Error Exception with Variable Context. - * - * @author Christian Sciberras - */ -class ContextErrorException extends \ErrorException -{ - private $context = array(); - - public function __construct($message, $code, $severity, $filename, $lineno, $context = array()) - { - parent::__construct($message, $code, $severity, $filename, $lineno); - $this->context = $context; - } - - /** - * @return array Array of variables that existed when the exception occurred - */ - public function getContext() - { - return $this->context; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/debug/Exception/DummyException.php b/sitecake/2.2.9/server/vendor/symfony/debug/Exception/DummyException.php deleted file mode 100644 index c836f87..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/debug/Exception/DummyException.php +++ /dev/null @@ -1,23 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Debug\Exception; - -@trigger_error('The '.__NAMESPACE__.'\DummyException class is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED); - -/** - * @author Fabien Potencier - * - * @deprecated since version 2.5, to be removed in 3.0. - */ -class DummyException extends \ErrorException -{ -} diff --git a/sitecake/2.2.9/server/vendor/symfony/debug/Exception/FatalBaseException.php b/sitecake/2.2.9/server/vendor/symfony/debug/Exception/FatalBaseException.php deleted file mode 100644 index 769d30c..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/debug/Exception/FatalBaseException.php +++ /dev/null @@ -1,44 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Debug\Exception; - -/** - * Base Fatal Error Exception. - * - * @author Nicolas Grekas - */ -class FatalBaseException extends FatalErrorException -{ - public function __construct(\BaseException $e) - { - if ($e instanceof \ParseException) { - $message = 'Parse error: '.$e->getMessage(); - $severity = E_PARSE; - } elseif ($e instanceof \TypeException) { - $message = 'Type error: '.$e->getMessage(); - $severity = E_RECOVERABLE_ERROR; - } else { - $message = 'Fatal error: '.$e->getMessage(); - $severity = E_ERROR; - } - - \ErrorException::__construct( - $message, - $e->getCode(), - $severity, - $e->getFile(), - $e->getLine() - ); - - $this->setTrace($e->getTrace()); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/debug/Exception/FatalErrorException.php b/sitecake/2.2.9/server/vendor/symfony/debug/Exception/FatalErrorException.php deleted file mode 100644 index 41bb97c..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/debug/Exception/FatalErrorException.php +++ /dev/null @@ -1,91 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Exception; - -/** - * Fatal Error Exception. - * - * @author Fabien Potencier - * @author Konstanton Myakshin - * @author Nicolas Grekas - * - * @deprecated Deprecated in 2.3, to be removed in 3.0. Use the same class from the Debug component instead. - */ -class FatalErrorException extends \ErrorException -{ -} - -namespace Symfony\Component\Debug\Exception; - -use Symfony\Component\HttpKernel\Exception\FatalErrorException as LegacyFatalErrorException; - -/** - * Fatal Error Exception. - * - * @author Konstanton Myakshin - */ -class FatalErrorException extends LegacyFatalErrorException -{ - public function __construct($message, $code, $severity, $filename, $lineno, $traceOffset = null, $traceArgs = true) - { - parent::__construct($message, $code, $severity, $filename, $lineno); - - if (null !== $traceOffset) { - if (function_exists('xdebug_get_function_stack')) { - $trace = xdebug_get_function_stack(); - if (0 < $traceOffset) { - array_splice($trace, -$traceOffset); - } - - foreach ($trace as &$frame) { - if (!isset($frame['type'])) { - // XDebug pre 2.1.1 doesn't currently set the call type key http://bugs.xdebug.org/view.php?id=695 - if (isset($frame['class'])) { - $frame['type'] = '::'; - } - } elseif ('dynamic' === $frame['type']) { - $frame['type'] = '->'; - } elseif ('static' === $frame['type']) { - $frame['type'] = '::'; - } - - // XDebug also has a different name for the parameters array - if (!$traceArgs) { - unset($frame['params'], $frame['args']); - } elseif (isset($frame['params']) && !isset($frame['args'])) { - $frame['args'] = $frame['params']; - unset($frame['params']); - } - } - - unset($frame); - $trace = array_reverse($trace); - } elseif (function_exists('symfony_debug_backtrace')) { - $trace = symfony_debug_backtrace(); - if (0 < $traceOffset) { - array_splice($trace, 0, $traceOffset); - } - } else { - $trace = array(); - } - - $this->setTrace($trace); - } - } - - protected function setTrace($trace) - { - $traceReflector = new \ReflectionProperty('Exception', 'trace'); - $traceReflector->setAccessible(true); - $traceReflector->setValue($this, $trace); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/debug/Exception/FlattenException.php b/sitecake/2.2.9/server/vendor/symfony/debug/Exception/FlattenException.php deleted file mode 100644 index d8d5c5b..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/debug/Exception/FlattenException.php +++ /dev/null @@ -1,292 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Exception; - -use Symfony\Component\Debug\Exception\FlattenException as DebugFlattenException; - -/** - * FlattenException wraps a PHP Exception to be able to serialize it. - * - * Basically, this class removes all objects from the trace. - * - * @author Fabien Potencier - * - * @deprecated Deprecated in 2.3, to be removed in 3.0. Use the same class from the Debug component instead. - */ -class FlattenException -{ - private $handler; - - public static function __callStatic($method, $args) - { - if (!method_exists('Symfony\Component\Debug\Exception\FlattenException', $method)) { - throw new \BadMethodCallException(sprintf('Call to undefined method %s::%s()', get_called_class(), $method)); - } - - return call_user_func_array(array('Symfony\Component\Debug\Exception\FlattenException', $method), $args); - } - - public function __call($method, $args) - { - if (!isset($this->handler)) { - $this->handler = new DebugFlattenException(); - } - - if (!method_exists($this->handler, $method)) { - throw new \BadMethodCallException(sprintf('Call to undefined method %s::%s()', get_class($this), $method)); - } - - return call_user_func_array(array($this->handler, $method), $args); - } -} - -namespace Symfony\Component\Debug\Exception; - -use Symfony\Component\HttpKernel\Exception\FlattenException as LegacyFlattenException; -use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface; - -/** - * FlattenException wraps a PHP Exception to be able to serialize it. - * - * Basically, this class removes all objects from the trace. - * - * @author Fabien Potencier - */ -class FlattenException extends LegacyFlattenException -{ - private $message; - private $code; - private $previous; - private $trace; - private $class; - private $statusCode; - private $headers; - private $file; - private $line; - - public static function create(\Exception $exception, $statusCode = null, array $headers = array()) - { - $e = new static(); - $e->setMessage($exception->getMessage()); - $e->setCode($exception->getCode()); - - if ($exception instanceof HttpExceptionInterface) { - $statusCode = $exception->getStatusCode(); - $headers = array_merge($headers, $exception->getHeaders()); - } - - if (null === $statusCode) { - $statusCode = 500; - } - - $e->setStatusCode($statusCode); - $e->setHeaders($headers); - $e->setTraceFromException($exception); - $e->setClass(get_class($exception)); - $e->setFile($exception->getFile()); - $e->setLine($exception->getLine()); - if ($exception->getPrevious()) { - $e->setPrevious(static::create($exception->getPrevious())); - } - - return $e; - } - - public function toArray() - { - $exceptions = array(); - foreach (array_merge(array($this), $this->getAllPrevious()) as $exception) { - $exceptions[] = array( - 'message' => $exception->getMessage(), - 'class' => $exception->getClass(), - 'trace' => $exception->getTrace(), - ); - } - - return $exceptions; - } - - public function getStatusCode() - { - return $this->statusCode; - } - - public function setStatusCode($code) - { - $this->statusCode = $code; - } - - public function getHeaders() - { - return $this->headers; - } - - public function setHeaders(array $headers) - { - $this->headers = $headers; - } - - public function getClass() - { - return $this->class; - } - - public function setClass($class) - { - $this->class = $class; - } - - public function getFile() - { - return $this->file; - } - - public function setFile($file) - { - $this->file = $file; - } - - public function getLine() - { - return $this->line; - } - - public function setLine($line) - { - $this->line = $line; - } - - public function getMessage() - { - return $this->message; - } - - public function setMessage($message) - { - $this->message = $message; - } - - public function getCode() - { - return $this->code; - } - - public function setCode($code) - { - $this->code = $code; - } - - public function getPrevious() - { - return $this->previous; - } - - public function setPrevious(FlattenException $previous) - { - $this->previous = $previous; - } - - public function getAllPrevious() - { - $exceptions = array(); - $e = $this; - while ($e = $e->getPrevious()) { - $exceptions[] = $e; - } - - return $exceptions; - } - - public function getTrace() - { - return $this->trace; - } - - public function setTraceFromException(\Exception $exception) - { - $this->setTrace($exception->getTrace(), $exception->getFile(), $exception->getLine()); - } - - public function setTrace($trace, $file, $line) - { - $this->trace = array(); - $this->trace[] = array( - 'namespace' => '', - 'short_class' => '', - 'class' => '', - 'type' => '', - 'function' => '', - 'file' => $file, - 'line' => $line, - 'args' => array(), - ); - foreach ($trace as $entry) { - $class = ''; - $namespace = ''; - if (isset($entry['class'])) { - $parts = explode('\\', $entry['class']); - $class = array_pop($parts); - $namespace = implode('\\', $parts); - } - - $this->trace[] = array( - 'namespace' => $namespace, - 'short_class' => $class, - 'class' => isset($entry['class']) ? $entry['class'] : '', - 'type' => isset($entry['type']) ? $entry['type'] : '', - 'function' => isset($entry['function']) ? $entry['function'] : null, - 'file' => isset($entry['file']) ? $entry['file'] : null, - 'line' => isset($entry['line']) ? $entry['line'] : null, - 'args' => isset($entry['args']) ? $this->flattenArgs($entry['args']) : array(), - ); - } - } - - private function flattenArgs($args, $level = 0, &$count = 0) - { - $result = array(); - foreach ($args as $key => $value) { - if (++$count > 1e4) { - return array('array', '*SKIPPED over 10000 entries*'); - } - if (is_object($value)) { - $result[$key] = array('object', get_class($value)); - } elseif (is_array($value)) { - if ($level > 10) { - $result[$key] = array('array', '*DEEP NESTED ARRAY*'); - } else { - $result[$key] = array('array', $this->flattenArgs($value, $level + 1, $count)); - } - } elseif (null === $value) { - $result[$key] = array('null', null); - } elseif (is_bool($value)) { - $result[$key] = array('boolean', $value); - } elseif (is_resource($value)) { - $result[$key] = array('resource', get_resource_type($value)); - } elseif ($value instanceof \__PHP_Incomplete_Class) { - // Special case of object, is_object will return false - $result[$key] = array('incomplete-object', $this->getClassNameFromIncomplete($value)); - } else { - $result[$key] = array('string', (string) $value); - } - } - - return $result; - } - - private function getClassNameFromIncomplete(\__PHP_Incomplete_Class $value) - { - $array = new \ArrayObject($value); - - return $array['__PHP_Incomplete_Class_Name']; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/debug/Exception/OutOfMemoryException.php b/sitecake/2.2.9/server/vendor/symfony/debug/Exception/OutOfMemoryException.php deleted file mode 100644 index fec1979..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/debug/Exception/OutOfMemoryException.php +++ /dev/null @@ -1,21 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Debug\Exception; - -/** - * Out of memory exception. - * - * @author Nicolas Grekas - */ -class OutOfMemoryException extends FatalErrorException -{ -} diff --git a/sitecake/2.2.9/server/vendor/symfony/debug/Exception/UndefinedFunctionException.php b/sitecake/2.2.9/server/vendor/symfony/debug/Exception/UndefinedFunctionException.php deleted file mode 100644 index a66ae2a..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/debug/Exception/UndefinedFunctionException.php +++ /dev/null @@ -1,33 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Debug\Exception; - -/** - * Undefined Function Exception. - * - * @author Konstanton Myakshin - */ -class UndefinedFunctionException extends FatalErrorException -{ - public function __construct($message, \ErrorException $previous) - { - parent::__construct( - $message, - $previous->getCode(), - $previous->getSeverity(), - $previous->getFile(), - $previous->getLine(), - $previous->getPrevious() - ); - $this->setTrace($previous->getTrace()); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/debug/Exception/UndefinedMethodException.php b/sitecake/2.2.9/server/vendor/symfony/debug/Exception/UndefinedMethodException.php deleted file mode 100644 index 350dc31..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/debug/Exception/UndefinedMethodException.php +++ /dev/null @@ -1,33 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Debug\Exception; - -/** - * Undefined Method Exception. - * - * @author Grégoire Pineau - */ -class UndefinedMethodException extends FatalErrorException -{ - public function __construct($message, \ErrorException $previous) - { - parent::__construct( - $message, - $previous->getCode(), - $previous->getSeverity(), - $previous->getFile(), - $previous->getLine(), - $previous->getPrevious() - ); - $this->setTrace($previous->getTrace()); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/debug/ExceptionHandler.php b/sitecake/2.2.9/server/vendor/symfony/debug/ExceptionHandler.php deleted file mode 100644 index c883f15..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/debug/ExceptionHandler.php +++ /dev/null @@ -1,469 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Debug; - -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\Debug\Exception\FlattenException; -use Symfony\Component\Debug\Exception\OutOfMemoryException; - -/** - * ExceptionHandler converts an exception to a Response object. - * - * It is mostly useful in debug mode to replace the default PHP/XDebug - * output with something prettier and more useful. - * - * As this class is mainly used during Kernel boot, where nothing is yet - * available, the Response content is always HTML. - * - * @author Fabien Potencier - * @author Nicolas Grekas - */ -class ExceptionHandler -{ - private $debug; - private $charset; - private $handler; - private $caughtBuffer; - private $caughtLength; - private $fileLinkFormat; - - public function __construct($debug = true, $charset = null, $fileLinkFormat = null) - { - if (false !== strpos($charset, '%') xor false === strpos($fileLinkFormat, '%')) { - // Swap $charset and $fileLinkFormat for BC reasons - $pivot = $fileLinkFormat; - $fileLinkFormat = $charset; - $charset = $pivot; - } - $this->debug = $debug; - $this->charset = $charset ?: ini_get('default_charset') ?: 'UTF-8'; - $this->fileLinkFormat = $fileLinkFormat ?: ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format'); - } - - /** - * Registers the exception handler. - * - * @param bool $debug Enable/disable debug mode, where the stack trace is displayed - * @param string|null $charset The charset used by exception messages - * @param string|null $fileLinkFormat The IDE link template - * - * @return ExceptionHandler The registered exception handler - */ - public static function register($debug = true, $charset = null, $fileLinkFormat = null) - { - $handler = new static($debug, $charset, $fileLinkFormat); - - $prev = set_exception_handler(array($handler, 'handle')); - if (is_array($prev) && $prev[0] instanceof ErrorHandler) { - restore_exception_handler(); - $prev[0]->setExceptionHandler(array($handler, 'handle')); - } - - return $handler; - } - - /** - * Sets a user exception handler. - * - * @param callable $handler An handler that will be called on Exception - * - * @return callable|null The previous exception handler if any - */ - public function setHandler($handler) - { - if (null !== $handler && !is_callable($handler)) { - throw new \LogicException('The exception handler must be a valid PHP callable.'); - } - $old = $this->handler; - $this->handler = $handler; - - return $old; - } - - /** - * Sets the format for links to source files. - * - * @param string $format The format for links to source files - * - * @return string The previous file link format. - */ - public function setFileLinkFormat($format) - { - $old = $this->fileLinkFormat; - $this->fileLinkFormat = $format; - - return $old; - } - - /** - * Sends a response for the given Exception. - * - * To be as fail-safe as possible, the exception is first handled - * by our simple exception handler, then by the user exception handler. - * The latter takes precedence and any output from the former is cancelled, - * if and only if nothing bad happens in this handling path. - */ - public function handle(\Exception $exception) - { - if (null === $this->handler || $exception instanceof OutOfMemoryException) { - $this->failSafeHandle($exception); - - return; - } - - $caughtLength = $this->caughtLength = 0; - - ob_start(array($this, 'catchOutput')); - $this->failSafeHandle($exception); - while (null === $this->caughtBuffer && ob_end_flush()) { - // Empty loop, everything is in the condition - } - if (isset($this->caughtBuffer[0])) { - ob_start(array($this, 'cleanOutput')); - echo $this->caughtBuffer; - $caughtLength = ob_get_length(); - } - $this->caughtBuffer = null; - - try { - call_user_func($this->handler, $exception); - $this->caughtLength = $caughtLength; - } catch (\Exception $e) { - if (!$caughtLength) { - // All handlers failed. Let PHP handle that now. - throw $exception; - } - } - } - - /** - * Sends a response for the given Exception. - * - * If you have the Symfony HttpFoundation component installed, - * this method will use it to create and send the response. If not, - * it will fallback to plain PHP functions. - * - * @param \Exception $exception An \Exception instance - * - * @see sendPhpResponse() - * @see createResponse() - */ - private function failSafeHandle(\Exception $exception) - { - if (class_exists('Symfony\Component\HttpFoundation\Response', false)) { - $response = $this->createResponse($exception); - $response->sendHeaders(); - $response->sendContent(); - } else { - $this->sendPhpResponse($exception); - } - } - - /** - * Sends the error associated with the given Exception as a plain PHP response. - * - * This method uses plain PHP functions like header() and echo to output - * the response. - * - * @param \Exception|FlattenException $exception An \Exception instance - */ - public function sendPhpResponse($exception) - { - if (!$exception instanceof FlattenException) { - $exception = FlattenException::create($exception); - } - - if (!headers_sent()) { - header(sprintf('HTTP/1.0 %s', $exception->getStatusCode())); - foreach ($exception->getHeaders() as $name => $value) { - header($name.': '.$value, false); - } - header('Content-Type: text/html; charset='.$this->charset); - } - - echo $this->decorate($this->getContent($exception), $this->getStylesheet($exception)); - } - - /** - * Creates the error Response associated with the given Exception. - * - * @param \Exception|FlattenException $exception An \Exception instance - * - * @return Response A Response instance - */ - public function createResponse($exception) - { - if (!$exception instanceof FlattenException) { - $exception = FlattenException::create($exception); - } - - return Response::create($this->decorate($this->getContent($exception), $this->getStylesheet($exception)), $exception->getStatusCode(), $exception->getHeaders())->setCharset($this->charset); - } - - /** - * Gets the HTML content associated with the given exception. - * - * @param FlattenException $exception A FlattenException instance - * - * @return string The content as a string - */ - public function getContent(FlattenException $exception) - { - switch ($exception->getStatusCode()) { - case 404: - $title = 'Sorry, the page you are looking for could not be found.'; - break; - default: - $title = 'Whoops, looks like something went wrong.'; - } - - $content = ''; - if ($this->debug) { - try { - $count = count($exception->getAllPrevious()); - $total = $count + 1; - foreach ($exception->toArray() as $position => $e) { - $ind = $count - $position + 1; - $class = $this->formatClass($e['class']); - $message = nl2br($this->escapeHtml($e['message'])); - $content .= sprintf(<< - %d/%d - %s%s: - %s - -
    -
      - -EOF - , $ind, $total, $class, $this->formatPath($e['trace'][0]['file'], $e['trace'][0]['line']), $message); - foreach ($e['trace'] as $trace) { - $content .= '
    1. '; - if ($trace['function']) { - $content .= sprintf('at %s%s%s(%s)', $this->formatClass($trace['class']), $trace['type'], $trace['function'], $this->formatArgs($trace['args'])); - } - if (isset($trace['file']) && isset($trace['line'])) { - $content .= $this->formatPath($trace['file'], $trace['line']); - } - $content .= "
    2. \n"; - } - - $content .= "
    \n
    \n"; - } - } catch (\Exception $e) { - // something nasty happened and we cannot throw an exception anymore - if ($this->debug) { - $title = sprintf('Exception thrown when handling an exception (%s: %s)', get_class($e), $this->escapeHtml($e->getMessage())); - } else { - $title = 'Whoops, looks like something went wrong.'; - } - } - } - - return << -

    $title

    - $content -
    -EOF; - } - - /** - * Gets the stylesheet associated with the given exception. - * - * @param FlattenException $exception A FlattenException instance - * - * @return string The stylesheet as a string - */ - public function getStylesheet(FlattenException $exception) - { - return << - - - - - - - - $content - - -EOF; - } - - private function formatClass($class) - { - $parts = explode('\\', $class); - - return sprintf('%s', $class, array_pop($parts)); - } - - private function formatPath($path, $line) - { - $path = $this->escapeHtml($path); - $file = preg_match('#[^/\\\\]*$#', $path, $file) ? $file[0] : $path; - - if ($linkFormat = $this->fileLinkFormat) { - $link = strtr($this->escapeHtml($linkFormat), array('%f' => $path, '%l' => (int) $line)); - - return sprintf(' in %s line %d', $link, $file, $line); - } - - return sprintf(' in %s line %d', $path, $file, $line); - } - - /** - * Formats an array as a string. - * - * @param array $args The argument array - * - * @return string - */ - private function formatArgs(array $args) - { - $result = array(); - foreach ($args as $key => $item) { - if ('object' === $item[0]) { - $formattedValue = sprintf('object(%s)', $this->formatClass($item[1])); - } elseif ('array' === $item[0]) { - $formattedValue = sprintf('array(%s)', is_array($item[1]) ? $this->formatArgs($item[1]) : $item[1]); - } elseif ('string' === $item[0]) { - $formattedValue = sprintf("'%s'", $this->escapeHtml($item[1])); - } elseif ('null' === $item[0]) { - $formattedValue = 'null'; - } elseif ('boolean' === $item[0]) { - $formattedValue = ''.strtolower(var_export($item[1], true)).''; - } elseif ('resource' === $item[0]) { - $formattedValue = 'resource'; - } else { - $formattedValue = str_replace("\n", '', var_export($this->escapeHtml((string) $item[1]), true)); - } - - $result[] = is_int($key) ? $formattedValue : sprintf("'%s' => %s", $key, $formattedValue); - } - - return implode(', ', $result); - } - - /** - * Returns an UTF-8 and HTML encoded string. - * - * @deprecated since version 2.7, to be removed in 3.0. - */ - protected static function utf8Htmlize($str) - { - @trigger_error('The '.__METHOD__.' method is deprecated since version 2.7 and will be removed in 3.0.', E_USER_DEPRECATED); - - return htmlspecialchars($str, ENT_QUOTES | (PHP_VERSION_ID >= 50400 ? ENT_SUBSTITUTE : 0), 'UTF-8'); - } - - /** - * HTML-encodes a string. - */ - private function escapeHtml($str) - { - return htmlspecialchars($str, ENT_QUOTES | (PHP_VERSION_ID >= 50400 ? ENT_SUBSTITUTE : 0), $this->charset); - } - - /** - * @internal - */ - public function catchOutput($buffer) - { - $this->caughtBuffer = $buffer; - - return ''; - } - - /** - * @internal - */ - public function cleanOutput($buffer) - { - if ($this->caughtLength) { - // use substr_replace() instead of substr() for mbstring overloading resistance - $cleanBuffer = substr_replace($buffer, '', 0, $this->caughtLength); - if (isset($cleanBuffer[0])) { - $buffer = $cleanBuffer; - } - } - - return $buffer; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php b/sitecake/2.2.9/server/vendor/symfony/debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php deleted file mode 100644 index abfe90d..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php +++ /dev/null @@ -1,212 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Debug\FatalErrorHandler; - -use Symfony\Component\Debug\Exception\ClassNotFoundException; -use Symfony\Component\Debug\Exception\FatalErrorException; -use Symfony\Component\Debug\DebugClassLoader; -use Composer\Autoload\ClassLoader as ComposerClassLoader; -use Symfony\Component\ClassLoader\ClassLoader as SymfonyClassLoader; -use Symfony\Component\ClassLoader\UniversalClassLoader as SymfonyUniversalClassLoader; - -/** - * ErrorHandler for classes that do not exist. - * - * @author Fabien Potencier - */ -class ClassNotFoundFatalErrorHandler implements FatalErrorHandlerInterface -{ - /** - * {@inheritdoc} - */ - public function handleError(array $error, FatalErrorException $exception) - { - $messageLen = strlen($error['message']); - $notFoundSuffix = '\' not found'; - $notFoundSuffixLen = strlen($notFoundSuffix); - if ($notFoundSuffixLen > $messageLen) { - return; - } - - if (0 !== substr_compare($error['message'], $notFoundSuffix, -$notFoundSuffixLen)) { - return; - } - - foreach (array('class', 'interface', 'trait') as $typeName) { - $prefix = ucfirst($typeName).' \''; - $prefixLen = strlen($prefix); - if (0 !== strpos($error['message'], $prefix)) { - continue; - } - - $fullyQualifiedClassName = substr($error['message'], $prefixLen, -$notFoundSuffixLen); - if (false !== $namespaceSeparatorIndex = strrpos($fullyQualifiedClassName, '\\')) { - $className = substr($fullyQualifiedClassName, $namespaceSeparatorIndex + 1); - $namespacePrefix = substr($fullyQualifiedClassName, 0, $namespaceSeparatorIndex); - $message = sprintf('Attempted to load %s "%s" from namespace "%s".', $typeName, $className, $namespacePrefix); - $tail = ' for another namespace?'; - } else { - $className = $fullyQualifiedClassName; - $message = sprintf('Attempted to load %s "%s" from the global namespace.', $typeName, $className); - $tail = '?'; - } - - if ($candidates = $this->getClassCandidates($className)) { - $tail = array_pop($candidates).'"?'; - if ($candidates) { - $tail = ' for e.g. "'.implode('", "', $candidates).'" or "'.$tail; - } else { - $tail = ' for "'.$tail; - } - } - $message .= "\nDid you forget a \"use\" statement".$tail; - - return new ClassNotFoundException($message, $exception); - } - } - - /** - * Tries to guess the full namespace for a given class name. - * - * By default, it looks for PSR-0 and PSR-4 classes registered via a Symfony or a Composer - * autoloader (that should cover all common cases). - * - * @param string $class A class name (without its namespace) - * - * @return array An array of possible fully qualified class names - */ - private function getClassCandidates($class) - { - if (!is_array($functions = spl_autoload_functions())) { - return array(); - } - - // find Symfony and Composer autoloaders - $classes = array(); - - foreach ($functions as $function) { - if (!is_array($function)) { - continue; - } - // get class loaders wrapped by DebugClassLoader - if ($function[0] instanceof DebugClassLoader) { - $function = $function[0]->getClassLoader(); - - // @deprecated since version 2.5. Returning an object from DebugClassLoader::getClassLoader() is deprecated. - if (is_object($function)) { - $function = array($function); - } - - if (!is_array($function)) { - continue; - } - } - - if ($function[0] instanceof ComposerClassLoader || $function[0] instanceof SymfonyClassLoader || $function[0] instanceof SymfonyUniversalClassLoader) { - foreach ($function[0]->getPrefixes() as $prefix => $paths) { - foreach ($paths as $path) { - $classes = array_merge($classes, $this->findClassInPath($path, $class, $prefix)); - } - } - } - if ($function[0] instanceof ComposerClassLoader) { - foreach ($function[0]->getPrefixesPsr4() as $prefix => $paths) { - foreach ($paths as $path) { - $classes = array_merge($classes, $this->findClassInPath($path, $class, $prefix)); - } - } - } - } - - return array_unique($classes); - } - - /** - * @param string $path - * @param string $class - * @param string $prefix - * - * @return array - */ - private function findClassInPath($path, $class, $prefix) - { - if (!$path = realpath($path.'/'.strtr($prefix, '\\_', '//')) ?: realpath($path.'/'.dirname(strtr($prefix, '\\_', '//'))) ?: realpath($path)) { - return array(); - } - - $classes = array(); - $filename = $class.'.php'; - foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::LEAVES_ONLY) as $file) { - if ($filename == $file->getFileName() && $class = $this->convertFileToClass($path, $file->getPathName(), $prefix)) { - $classes[] = $class; - } - } - - return $classes; - } - - /** - * @param string $path - * @param string $file - * @param string $prefix - * - * @return string|null - */ - private function convertFileToClass($path, $file, $prefix) - { - $candidates = array( - // namespaced class - $namespacedClass = str_replace(array($path.DIRECTORY_SEPARATOR, '.php', '/'), array('', '', '\\'), $file), - // namespaced class (with target dir) - $prefix.$namespacedClass, - // namespaced class (with target dir and separator) - $prefix.'\\'.$namespacedClass, - // PEAR class - str_replace('\\', '_', $namespacedClass), - // PEAR class (with target dir) - str_replace('\\', '_', $prefix.$namespacedClass), - // PEAR class (with target dir and separator) - str_replace('\\', '_', $prefix.'\\'.$namespacedClass), - ); - - if ($prefix) { - $candidates = array_filter($candidates, function ($candidate) use ($prefix) {return 0 === strpos($candidate, $prefix);}); - } - - // We cannot use the autoloader here as most of them use require; but if the class - // is not found, the new autoloader call will require the file again leading to a - // "cannot redeclare class" error. - foreach ($candidates as $candidate) { - if ($this->classExists($candidate)) { - return $candidate; - } - } - - require_once $file; - - foreach ($candidates as $candidate) { - if ($this->classExists($candidate)) { - return $candidate; - } - } - } - - /** - * @param string $class - * - * @return bool - */ - private function classExists($class) - { - return class_exists($class, false) || interface_exists($class, false) || (function_exists('trait_exists') && trait_exists($class, false)); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/debug/FatalErrorHandler/FatalErrorHandlerInterface.php b/sitecake/2.2.9/server/vendor/symfony/debug/FatalErrorHandler/FatalErrorHandlerInterface.php deleted file mode 100644 index 6b87eb3..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/debug/FatalErrorHandler/FatalErrorHandlerInterface.php +++ /dev/null @@ -1,32 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Debug\FatalErrorHandler; - -use Symfony\Component\Debug\Exception\FatalErrorException; - -/** - * Attempts to convert fatal errors to exceptions. - * - * @author Fabien Potencier - */ -interface FatalErrorHandlerInterface -{ - /** - * Attempts to convert an error into an exception. - * - * @param array $error An array as returned by error_get_last() - * @param FatalErrorException $exception A FatalErrorException instance - * - * @return FatalErrorException|null A FatalErrorException instance if the class is able to convert the error, null otherwise - */ - public function handleError(array $error, FatalErrorException $exception); -} diff --git a/sitecake/2.2.9/server/vendor/symfony/debug/FatalErrorHandler/UndefinedFunctionFatalErrorHandler.php b/sitecake/2.2.9/server/vendor/symfony/debug/FatalErrorHandler/UndefinedFunctionFatalErrorHandler.php deleted file mode 100644 index c6f391a..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/debug/FatalErrorHandler/UndefinedFunctionFatalErrorHandler.php +++ /dev/null @@ -1,84 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Debug\FatalErrorHandler; - -use Symfony\Component\Debug\Exception\UndefinedFunctionException; -use Symfony\Component\Debug\Exception\FatalErrorException; - -/** - * ErrorHandler for undefined functions. - * - * @author Fabien Potencier - */ -class UndefinedFunctionFatalErrorHandler implements FatalErrorHandlerInterface -{ - /** - * {@inheritdoc} - */ - public function handleError(array $error, FatalErrorException $exception) - { - $messageLen = strlen($error['message']); - $notFoundSuffix = '()'; - $notFoundSuffixLen = strlen($notFoundSuffix); - if ($notFoundSuffixLen > $messageLen) { - return; - } - - if (0 !== substr_compare($error['message'], $notFoundSuffix, -$notFoundSuffixLen)) { - return; - } - - $prefix = 'Call to undefined function '; - $prefixLen = strlen($prefix); - if (0 !== strpos($error['message'], $prefix)) { - return; - } - - $fullyQualifiedFunctionName = substr($error['message'], $prefixLen, -$notFoundSuffixLen); - if (false !== $namespaceSeparatorIndex = strrpos($fullyQualifiedFunctionName, '\\')) { - $functionName = substr($fullyQualifiedFunctionName, $namespaceSeparatorIndex + 1); - $namespacePrefix = substr($fullyQualifiedFunctionName, 0, $namespaceSeparatorIndex); - $message = sprintf('Attempted to call function "%s" from namespace "%s".', $functionName, $namespacePrefix); - } else { - $functionName = $fullyQualifiedFunctionName; - $message = sprintf('Attempted to call function "%s" from the global namespace.', $functionName); - } - - $candidates = array(); - foreach (get_defined_functions() as $type => $definedFunctionNames) { - foreach ($definedFunctionNames as $definedFunctionName) { - if (false !== $namespaceSeparatorIndex = strrpos($definedFunctionName, '\\')) { - $definedFunctionNameBasename = substr($definedFunctionName, $namespaceSeparatorIndex + 1); - } else { - $definedFunctionNameBasename = $definedFunctionName; - } - - if ($definedFunctionNameBasename === $functionName) { - $candidates[] = '\\'.$definedFunctionName; - } - } - } - - if ($candidates) { - sort($candidates); - $last = array_pop($candidates).'"?'; - if ($candidates) { - $candidates = 'e.g. "'.implode('", "', $candidates).'" or "'.$last; - } else { - $candidates = '"'.$last; - } - $message .= "\nDid you mean to call ".$candidates; - } - - return new UndefinedFunctionException($message, $exception); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/debug/FatalErrorHandler/UndefinedMethodFatalErrorHandler.php b/sitecake/2.2.9/server/vendor/symfony/debug/FatalErrorHandler/UndefinedMethodFatalErrorHandler.php deleted file mode 100644 index f734d6b..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/debug/FatalErrorHandler/UndefinedMethodFatalErrorHandler.php +++ /dev/null @@ -1,60 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Debug\FatalErrorHandler; - -use Symfony\Component\Debug\Exception\FatalErrorException; -use Symfony\Component\Debug\Exception\UndefinedMethodException; - -/** - * ErrorHandler for undefined methods. - * - * @author Grégoire Pineau - */ -class UndefinedMethodFatalErrorHandler implements FatalErrorHandlerInterface -{ - /** - * {@inheritdoc} - */ - public function handleError(array $error, FatalErrorException $exception) - { - preg_match('/^Call to undefined method (.*)::(.*)\(\)$/', $error['message'], $matches); - if (!$matches) { - return; - } - - $className = $matches[1]; - $methodName = $matches[2]; - - $message = sprintf('Attempted to call an undefined method named "%s" of class "%s".', $methodName, $className); - - $candidates = array(); - foreach (get_class_methods($className) as $definedMethodName) { - $lev = levenshtein($methodName, $definedMethodName); - if ($lev <= strlen($methodName) / 3 || false !== strpos($definedMethodName, $methodName)) { - $candidates[] = $definedMethodName; - } - } - - if ($candidates) { - sort($candidates); - $last = array_pop($candidates).'"?'; - if ($candidates) { - $candidates = 'e.g. "'.implode('", "', $candidates).'" or "'.$last; - } else { - $candidates = '"'.$last; - } - $message .= "\nDid you mean to call ".$candidates; - } - - return new UndefinedMethodException($message, $exception); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/debug/LICENSE b/sitecake/2.2.9/server/vendor/symfony/debug/LICENSE deleted file mode 100644 index 43028bc..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/debug/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2004-2015 Fabien Potencier - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/sitecake/2.2.9/server/vendor/symfony/debug/README.md b/sitecake/2.2.9/server/vendor/symfony/debug/README.md deleted file mode 100644 index 67e6d6c..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/debug/README.md +++ /dev/null @@ -1,43 +0,0 @@ -Debug Component -=============== - -Debug provides tools to make debugging easier. - -Enabling all debug tools is as easy as calling the `enable()` method on the -main `Debug` class: - -```php -use Symfony\Component\Debug\Debug; - -Debug::enable(); -``` - -You can also use the tools individually: - -```php -use Symfony\Component\Debug\ErrorHandler; -use Symfony\Component\Debug\ExceptionHandler; - -if ('cli' !== php_sapi_name()) { - ini_set('display_errors', 0); - ExceptionHandler::register(); -} elseif (!ini_get('log_errors') || ini_get('error_log')) { - ini_set('display_errors', 1); -} -ErrorHandler::register(); -``` - -Note that the `Debug::enable()` call also registers the debug class loader -from the Symfony ClassLoader component when available. - -This component can optionally take advantage of the features of the HttpKernel -and HttpFoundation components. - -Resources ---------- - -You can run the unit tests with the following command: - - $ cd path/to/Symfony/Component/Debug/ - $ composer install - $ phpunit diff --git a/sitecake/2.2.9/server/vendor/symfony/debug/Resources/ext/README.md b/sitecake/2.2.9/server/vendor/symfony/debug/Resources/ext/README.md deleted file mode 100644 index 0672ef8..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/debug/Resources/ext/README.md +++ /dev/null @@ -1,133 +0,0 @@ -Symfony Debug Extension -======================= - -This extension publishes several functions to help building powerful debugging tools. - -symfony_zval_info() -------------------- - -- exposes zval_hash/refcounts, allowing e.g. efficient exploration of arbitrary structures in PHP, -- does work with references, preventing memory copying. - -Its behavior is about the same as: - -```php - gettype($array[$key]), - 'zval_hash' => /* hashed memory address of $array[$key] */, - 'zval_refcount' => /* internal zval refcount of $array[$key] */, - 'zval_isref' => /* is_ref status of $array[$key] */, - ); - - switch ($info['type']) { - case 'object': - $info += array( - 'object_class' => get_class($array[$key]), - 'object_refcount' => /* internal object refcount of $array[$key] */, - 'object_hash' => spl_object_hash($array[$key]), - 'object_handle' => /* internal object handle $array[$key] */, - ); - break; - - case 'resource': - $info += array( - 'resource_handle' => (int) $array[$key], - 'resource_type' => get_resource_type($array[$key]), - 'resource_refcount' => /* internal resource refcount of $array[$key] */, - ); - break; - - case 'array': - $info += array( - 'array_count' => count($array[$key]), - ); - break; - - case 'string': - $info += array( - 'strlen' => strlen($array[$key]), - ); - break; - } - - return $info; -} -``` - -symfony_debug_backtrace() -------------------------- - -This function works like debug_backtrace(), except that it can fetch the full backtrace in case of fatal errors: - -```php -function foo() { fatal(); } -function bar() { foo(); } - -function sd() { var_dump(symfony_debug_backtrace()); } - -register_shutdown_function('sd'); - -bar(); - -/* Will output -Fatal error: Call to undefined function fatal() in foo.php on line 42 -array(3) { - [0]=> - array(2) { - ["function"]=> - string(2) "sd" - ["args"]=> - array(0) { - } - } - [1]=> - array(4) { - ["file"]=> - string(7) "foo.php" - ["line"]=> - int(1) - ["function"]=> - string(3) "foo" - ["args"]=> - array(0) { - } - } - [2]=> - array(4) { - ["file"]=> - string(102) "foo.php" - ["line"]=> - int(2) - ["function"]=> - string(3) "bar" - ["args"]=> - array(0) { - } - } -} -*/ -``` - -Usage ------ - -The extension is compatible with ZTS mode, and should be supported by PHP5.3, 5.4, 5.5 and 5.6. -To enable the extension from source, run: - -``` - phpize - ./configure - make - sudo make install -``` diff --git a/sitecake/2.2.9/server/vendor/symfony/debug/Resources/ext/config.m4 b/sitecake/2.2.9/server/vendor/symfony/debug/Resources/ext/config.m4 deleted file mode 100644 index 3c56047..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/debug/Resources/ext/config.m4 +++ /dev/null @@ -1,63 +0,0 @@ -dnl $Id$ -dnl config.m4 for extension symfony_debug - -dnl Comments in this file start with the string 'dnl'. -dnl Remove where necessary. This file will not work -dnl without editing. - -dnl If your extension references something external, use with: - -dnl PHP_ARG_WITH(symfony_debug, for symfony_debug support, -dnl Make sure that the comment is aligned: -dnl [ --with-symfony_debug Include symfony_debug support]) - -dnl Otherwise use enable: - -PHP_ARG_ENABLE(symfony_debug, whether to enable symfony_debug support, -dnl Make sure that the comment is aligned: -[ --enable-symfony_debug Enable symfony_debug support]) - -if test "$PHP_SYMFONY_DEBUG" != "no"; then - dnl Write more examples of tests here... - - dnl # --with-symfony_debug -> check with-path - dnl SEARCH_PATH="/usr/local /usr" # you might want to change this - dnl SEARCH_FOR="/include/symfony_debug.h" # you most likely want to change this - dnl if test -r $PHP_SYMFONY_DEBUG/$SEARCH_FOR; then # path given as parameter - dnl SYMFONY_DEBUG_DIR=$PHP_SYMFONY_DEBUG - dnl else # search default path list - dnl AC_MSG_CHECKING([for symfony_debug files in default path]) - dnl for i in $SEARCH_PATH ; do - dnl if test -r $i/$SEARCH_FOR; then - dnl SYMFONY_DEBUG_DIR=$i - dnl AC_MSG_RESULT(found in $i) - dnl fi - dnl done - dnl fi - dnl - dnl if test -z "$SYMFONY_DEBUG_DIR"; then - dnl AC_MSG_RESULT([not found]) - dnl AC_MSG_ERROR([Please reinstall the symfony_debug distribution]) - dnl fi - - dnl # --with-symfony_debug -> add include path - dnl PHP_ADD_INCLUDE($SYMFONY_DEBUG_DIR/include) - - dnl # --with-symfony_debug -> check for lib and symbol presence - dnl LIBNAME=symfony_debug # you may want to change this - dnl LIBSYMBOL=symfony_debug # you most likely want to change this - - dnl PHP_CHECK_LIBRARY($LIBNAME,$LIBSYMBOL, - dnl [ - dnl PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $SYMFONY_DEBUG_DIR/lib, SYMFONY_DEBUG_SHARED_LIBADD) - dnl AC_DEFINE(HAVE_SYMFONY_DEBUGLIB,1,[ ]) - dnl ],[ - dnl AC_MSG_ERROR([wrong symfony_debug lib version or lib not found]) - dnl ],[ - dnl -L$SYMFONY_DEBUG_DIR/lib -lm - dnl ]) - dnl - dnl PHP_SUBST(SYMFONY_DEBUG_SHARED_LIBADD) - - PHP_NEW_EXTENSION(symfony_debug, symfony_debug.c, $ext_shared) -fi diff --git a/sitecake/2.2.9/server/vendor/symfony/debug/Resources/ext/config.w32 b/sitecake/2.2.9/server/vendor/symfony/debug/Resources/ext/config.w32 deleted file mode 100644 index 487e691..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/debug/Resources/ext/config.w32 +++ /dev/null @@ -1,13 +0,0 @@ -// $Id$ -// vim:ft=javascript - -// If your extension references something external, use ARG_WITH -// ARG_WITH("symfony_debug", "for symfony_debug support", "no"); - -// Otherwise, use ARG_ENABLE -// ARG_ENABLE("symfony_debug", "enable symfony_debug support", "no"); - -if (PHP_SYMFONY_DEBUG != "no") { - EXTENSION("symfony_debug", "symfony_debug.c"); -} - diff --git a/sitecake/2.2.9/server/vendor/symfony/debug/Resources/ext/php_symfony_debug.h b/sitecake/2.2.9/server/vendor/symfony/debug/Resources/ext/php_symfony_debug.h deleted file mode 100644 index 26d0e8c..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/debug/Resources/ext/php_symfony_debug.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -#ifndef PHP_SYMFONY_DEBUG_H -#define PHP_SYMFONY_DEBUG_H - -extern zend_module_entry symfony_debug_module_entry; -#define phpext_symfony_debug_ptr &symfony_debug_module_entry - -#define PHP_SYMFONY_DEBUG_VERSION "2.7" - -#ifdef PHP_WIN32 -# define PHP_SYMFONY_DEBUG_API __declspec(dllexport) -#elif defined(__GNUC__) && __GNUC__ >= 4 -# define PHP_SYMFONY_DEBUG_API __attribute__ ((visibility("default"))) -#else -# define PHP_SYMFONY_DEBUG_API -#endif - -#ifdef ZTS -#include "TSRM.h" -#endif - -ZEND_BEGIN_MODULE_GLOBALS(symfony_debug) - intptr_t req_rand_init; - void (*old_error_cb)(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args); - zval *debug_bt; -ZEND_END_MODULE_GLOBALS(symfony_debug) - -PHP_MINIT_FUNCTION(symfony_debug); -PHP_MSHUTDOWN_FUNCTION(symfony_debug); -PHP_RINIT_FUNCTION(symfony_debug); -PHP_RSHUTDOWN_FUNCTION(symfony_debug); -PHP_MINFO_FUNCTION(symfony_debug); -PHP_GINIT_FUNCTION(symfony_debug); -PHP_GSHUTDOWN_FUNCTION(symfony_debug); - -PHP_FUNCTION(symfony_zval_info); -PHP_FUNCTION(symfony_debug_backtrace); - -static char *_symfony_debug_memory_address_hash(void * TSRMLS_DC); -static const char *_symfony_debug_zval_type(zval *); -static const char* _symfony_debug_get_resource_type(long TSRMLS_DC); -static int _symfony_debug_get_resource_refcount(long TSRMLS_DC); - -void symfony_debug_error_cb(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args); - -#ifdef ZTS -#define SYMFONY_DEBUG_G(v) TSRMG(symfony_debug_globals_id, zend_symfony_debug_globals *, v) -#else -#define SYMFONY_DEBUG_G(v) (symfony_debug_globals.v) -#endif - -#endif /* PHP_SYMFONY_DEBUG_H */ diff --git a/sitecake/2.2.9/server/vendor/symfony/debug/Resources/ext/symfony_debug.c b/sitecake/2.2.9/server/vendor/symfony/debug/Resources/ext/symfony_debug.c deleted file mode 100644 index 0d7cb60..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/debug/Resources/ext/symfony_debug.c +++ /dev/null @@ -1,283 +0,0 @@ -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "php.h" -#ifdef ZTS -#include "TSRM.h" -#endif -#include "php_ini.h" -#include "ext/standard/info.h" -#include "php_symfony_debug.h" -#include "ext/standard/php_rand.h" -#include "ext/standard/php_lcg.h" -#include "ext/spl/php_spl.h" -#include "Zend/zend_gc.h" -#include "Zend/zend_builtin_functions.h" -#include "Zend/zend_extensions.h" /* for ZEND_EXTENSION_API_NO */ -#include "ext/standard/php_array.h" -#include "Zend/zend_interfaces.h" -#include "SAPI.h" - -#define IS_PHP_53 ZEND_EXTENSION_API_NO == 220090626 - -ZEND_DECLARE_MODULE_GLOBALS(symfony_debug) - -ZEND_BEGIN_ARG_INFO_EX(symfony_zval_arginfo, 0, 0, 2) - ZEND_ARG_INFO(0, key) - ZEND_ARG_ARRAY_INFO(0, array, 0) - ZEND_ARG_INFO(0, options) -ZEND_END_ARG_INFO() - -const zend_function_entry symfony_debug_functions[] = { - PHP_FE(symfony_zval_info, symfony_zval_arginfo) - PHP_FE(symfony_debug_backtrace, NULL) - PHP_FE_END -}; - -PHP_FUNCTION(symfony_debug_backtrace) -{ - if (zend_parse_parameters_none() == FAILURE) { - return; - } -#if IS_PHP_53 - zend_fetch_debug_backtrace(return_value, 1, 0 TSRMLS_CC); -#else - zend_fetch_debug_backtrace(return_value, 1, 0, 0 TSRMLS_CC); -#endif - - if (!SYMFONY_DEBUG_G(debug_bt)) { - return; - } - - php_array_merge(Z_ARRVAL_P(return_value), Z_ARRVAL_P(SYMFONY_DEBUG_G(debug_bt)), 0 TSRMLS_CC); -} - -PHP_FUNCTION(symfony_zval_info) -{ - zval *key = NULL, *arg = NULL; - zval **data = NULL; - HashTable *array = NULL; - long options = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zh|l", &key, &array, &options) == FAILURE) { - return; - } - - switch (Z_TYPE_P(key)) { - case IS_STRING: - if (zend_symtable_find(array, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, (void **)&data) == FAILURE) { - return; - } - break; - case IS_LONG: - if (zend_hash_index_find(array, Z_LVAL_P(key), (void **)&data)) { - return; - } - break; - } - - arg = *data; - - array_init(return_value); - - add_assoc_string(return_value, "type", (char *)_symfony_debug_zval_type(arg), 1); - add_assoc_stringl(return_value, "zval_hash", _symfony_debug_memory_address_hash((void *)arg TSRMLS_CC), 16, 0); - add_assoc_long(return_value, "zval_refcount", Z_REFCOUNT_P(arg)); - add_assoc_bool(return_value, "zval_isref", (zend_bool)Z_ISREF_P(arg)); - - if (Z_TYPE_P(arg) == IS_OBJECT) { - char hash[33] = {0}; - - php_spl_object_hash(arg, (char *)hash TSRMLS_CC); - add_assoc_stringl(return_value, "object_class", (char *)Z_OBJCE_P(arg)->name, Z_OBJCE_P(arg)->name_length, 1); - add_assoc_long(return_value, "object_refcount", EG(objects_store).object_buckets[Z_OBJ_HANDLE_P(arg)].bucket.obj.refcount); - add_assoc_string(return_value, "object_hash", hash, 1); - add_assoc_long(return_value, "object_handle", Z_OBJ_HANDLE_P(arg)); - } else if (Z_TYPE_P(arg) == IS_ARRAY) { - add_assoc_long(return_value, "array_count", zend_hash_num_elements(Z_ARRVAL_P(arg))); - } else if(Z_TYPE_P(arg) == IS_RESOURCE) { - add_assoc_long(return_value, "resource_handle", Z_LVAL_P(arg)); - add_assoc_string(return_value, "resource_type", (char *)_symfony_debug_get_resource_type(Z_LVAL_P(arg) TSRMLS_CC), 1); - add_assoc_long(return_value, "resource_refcount", _symfony_debug_get_resource_refcount(Z_LVAL_P(arg) TSRMLS_CC)); - } else if (Z_TYPE_P(arg) == IS_STRING) { - add_assoc_long(return_value, "strlen", Z_STRLEN_P(arg)); - } -} - -void symfony_debug_error_cb(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args) -{ - TSRMLS_FETCH(); - zval *retval; - - switch (type) { - case E_ERROR: - case E_PARSE: - case E_CORE_ERROR: - case E_CORE_WARNING: - case E_COMPILE_ERROR: - case E_COMPILE_WARNING: - ALLOC_INIT_ZVAL(retval); -#if IS_PHP_53 - zend_fetch_debug_backtrace(retval, 1, 0 TSRMLS_CC); -#else - zend_fetch_debug_backtrace(retval, 1, 0, 0 TSRMLS_CC); -#endif - SYMFONY_DEBUG_G(debug_bt) = retval; - } - - SYMFONY_DEBUG_G(old_error_cb)(type, error_filename, error_lineno, format, args); -} - -static const char* _symfony_debug_get_resource_type(long rsid TSRMLS_DC) -{ - const char *res_type; - res_type = zend_rsrc_list_get_rsrc_type(rsid TSRMLS_CC); - - if (!res_type) { - return "Unknown"; - } - - return res_type; -} - -static int _symfony_debug_get_resource_refcount(long rsid TSRMLS_DC) -{ - zend_rsrc_list_entry *le; - - if (zend_hash_index_find(&EG(regular_list), rsid, (void **) &le)==SUCCESS) { - return le->refcount; - } - - return 0; -} - -static char *_symfony_debug_memory_address_hash(void *address TSRMLS_DC) -{ - char *result = NULL; - intptr_t address_rand; - - if (!SYMFONY_DEBUG_G(req_rand_init)) { - if (!BG(mt_rand_is_seeded)) { - php_mt_srand(GENERATE_SEED() TSRMLS_CC); - } - SYMFONY_DEBUG_G(req_rand_init) = (intptr_t)php_mt_rand(TSRMLS_C); - } - - address_rand = (intptr_t)address ^ SYMFONY_DEBUG_G(req_rand_init); - - spprintf(&result, 17, "%016zx", address_rand); - - return result; -} - -static const char *_symfony_debug_zval_type(zval *zv) -{ - switch (Z_TYPE_P(zv)) { - case IS_NULL: - return "NULL"; - break; - - case IS_BOOL: - return "boolean"; - break; - - case IS_LONG: - return "integer"; - break; - - case IS_DOUBLE: - return "double"; - break; - - case IS_STRING: - return "string"; - break; - - case IS_ARRAY: - return "array"; - break; - - case IS_OBJECT: - return "object"; - - case IS_RESOURCE: - return "resource"; - - default: - return "unknown type"; - } -} - -zend_module_entry symfony_debug_module_entry = { - STANDARD_MODULE_HEADER, - "symfony_debug", - symfony_debug_functions, - PHP_MINIT(symfony_debug), - PHP_MSHUTDOWN(symfony_debug), - PHP_RINIT(symfony_debug), - PHP_RSHUTDOWN(symfony_debug), - PHP_MINFO(symfony_debug), - PHP_SYMFONY_DEBUG_VERSION, - PHP_MODULE_GLOBALS(symfony_debug), - PHP_GINIT(symfony_debug), - PHP_GSHUTDOWN(symfony_debug), - NULL, - STANDARD_MODULE_PROPERTIES_EX -}; - -#ifdef COMPILE_DL_SYMFONY_DEBUG -ZEND_GET_MODULE(symfony_debug) -#endif - -PHP_GINIT_FUNCTION(symfony_debug) -{ - memset(symfony_debug_globals, 0 , sizeof(*symfony_debug_globals)); -} - -PHP_GSHUTDOWN_FUNCTION(symfony_debug) -{ - -} - -PHP_MINIT_FUNCTION(symfony_debug) -{ - SYMFONY_DEBUG_G(old_error_cb) = zend_error_cb; - zend_error_cb = symfony_debug_error_cb; - - return SUCCESS; -} - -PHP_MSHUTDOWN_FUNCTION(symfony_debug) -{ - zend_error_cb = SYMFONY_DEBUG_G(old_error_cb); - - return SUCCESS; -} - -PHP_RINIT_FUNCTION(symfony_debug) -{ - return SUCCESS; -} - -PHP_RSHUTDOWN_FUNCTION(symfony_debug) -{ - return SUCCESS; -} - -PHP_MINFO_FUNCTION(symfony_debug) -{ - php_info_print_table_start(); - php_info_print_table_header(2, "Symfony Debug support", "enabled"); - php_info_print_table_header(2, "Symfony Debug version", PHP_SYMFONY_DEBUG_VERSION); - php_info_print_table_end(); -} diff --git a/sitecake/2.2.9/server/vendor/symfony/debug/composer.json b/sitecake/2.2.9/server/vendor/symfony/debug/composer.json deleted file mode 100644 index 3b15688..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/debug/composer.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "name": "symfony/debug", - "type": "library", - "description": "Symfony Debug Component", - "keywords": [], - "homepage": "https://symfony.com", - "license": "MIT", - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "require": { - "php": ">=5.3.9", - "psr/log": "~1.0" - }, - "conflict": { - "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" - }, - "require-dev": { - "symfony/phpunit-bridge": "~2.7", - "symfony/class-loader": "~2.2", - "symfony/http-kernel": "~2.3.24|~2.5.9|~2.6,>=2.6.2", - "symfony/http-foundation": "~2.1" - }, - "suggest": { - "symfony/http-foundation": "", - "symfony/http-kernel": "" - }, - "autoload": { - "psr-4": { "Symfony\\Component\\Debug\\": "" } - }, - "minimum-stability": "dev", - "extra": { - "branch-alias": { - "dev-master": "2.7-dev" - } - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/debug/phpunit.xml.dist b/sitecake/2.2.9/server/vendor/symfony/debug/phpunit.xml.dist deleted file mode 100644 index e99c4dd..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/debug/phpunit.xml.dist +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - ./Tests/ - - - ./Resources/ext/tests/ - - - - - - ./ - - ./Tests - ./vendor - - - - diff --git a/sitecake/2.2.9/server/vendor/symfony/event-dispatcher/CHANGELOG.md b/sitecake/2.2.9/server/vendor/symfony/event-dispatcher/CHANGELOG.md deleted file mode 100644 index bb42ee1..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/event-dispatcher/CHANGELOG.md +++ /dev/null @@ -1,23 +0,0 @@ -CHANGELOG -========= - -2.5.0 ------ - - * added Debug\TraceableEventDispatcher (originally in HttpKernel) - * changed Debug\TraceableEventDispatcherInterface to extend EventDispatcherInterface - * added RegisterListenersPass (originally in HttpKernel) - -2.1.0 ------ - - * added TraceableEventDispatcherInterface - * added ContainerAwareEventDispatcher - * added a reference to the EventDispatcher on the Event - * added a reference to the Event name on the event - * added fluid interface to the dispatch() method which now returns the Event - object - * added GenericEvent event class - * added the possibility for subscribers to subscribe several times for the - same event - * added ImmutableEventDispatcher diff --git a/sitecake/2.2.9/server/vendor/symfony/event-dispatcher/ContainerAwareEventDispatcher.php b/sitecake/2.2.9/server/vendor/symfony/event-dispatcher/ContainerAwareEventDispatcher.php deleted file mode 100644 index 76f0e38..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/event-dispatcher/ContainerAwareEventDispatcher.php +++ /dev/null @@ -1,202 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\EventDispatcher; - -use Symfony\Component\DependencyInjection\ContainerInterface; - -/** - * Lazily loads listeners and subscribers from the dependency injection - * container. - * - * @author Fabien Potencier - * @author Bernhard Schussek - * @author Jordan Alliot - */ -class ContainerAwareEventDispatcher extends EventDispatcher -{ - /** - * The container from where services are loaded. - * - * @var ContainerInterface - */ - private $container; - - /** - * The service IDs of the event listeners and subscribers. - * - * @var array - */ - private $listenerIds = array(); - - /** - * The services registered as listeners. - * - * @var array - */ - private $listeners = array(); - - /** - * Constructor. - * - * @param ContainerInterface $container A ContainerInterface instance - */ - public function __construct(ContainerInterface $container) - { - $this->container = $container; - } - - /** - * Adds a service as event listener. - * - * @param string $eventName Event for which the listener is added - * @param array $callback The service ID of the listener service & the method - * name that has to be called - * @param int $priority The higher this value, the earlier an event listener - * will be triggered in the chain. - * Defaults to 0. - * - * @throws \InvalidArgumentException - */ - public function addListenerService($eventName, $callback, $priority = 0) - { - if (!is_array($callback) || 2 !== count($callback)) { - throw new \InvalidArgumentException('Expected an array("service", "method") argument'); - } - - $this->listenerIds[$eventName][] = array($callback[0], $callback[1], $priority); - } - - public function removeListener($eventName, $listener) - { - $this->lazyLoad($eventName); - - if (isset($this->listenerIds[$eventName])) { - foreach ($this->listenerIds[$eventName] as $i => $args) { - list($serviceId, $method, $priority) = $args; - $key = $serviceId.'.'.$method; - if (isset($this->listeners[$eventName][$key]) && $listener === array($this->listeners[$eventName][$key], $method)) { - unset($this->listeners[$eventName][$key]); - if (empty($this->listeners[$eventName])) { - unset($this->listeners[$eventName]); - } - unset($this->listenerIds[$eventName][$i]); - if (empty($this->listenerIds[$eventName])) { - unset($this->listenerIds[$eventName]); - } - } - } - } - - parent::removeListener($eventName, $listener); - } - - /** - * @see EventDispatcherInterface::hasListeners() - */ - public function hasListeners($eventName = null) - { - if (null === $eventName) { - return (bool) count($this->listenerIds) || (bool) count($this->listeners); - } - - if (isset($this->listenerIds[$eventName])) { - return true; - } - - return parent::hasListeners($eventName); - } - - /** - * @see EventDispatcherInterface::getListeners() - */ - public function getListeners($eventName = null) - { - if (null === $eventName) { - foreach ($this->listenerIds as $serviceEventName => $args) { - $this->lazyLoad($serviceEventName); - } - } else { - $this->lazyLoad($eventName); - } - - return parent::getListeners($eventName); - } - - /** - * Adds a service as event subscriber. - * - * @param string $serviceId The service ID of the subscriber service - * @param string $class The service's class name (which must implement EventSubscriberInterface) - */ - public function addSubscriberService($serviceId, $class) - { - foreach ($class::getSubscribedEvents() as $eventName => $params) { - if (is_string($params)) { - $this->listenerIds[$eventName][] = array($serviceId, $params, 0); - } elseif (is_string($params[0])) { - $this->listenerIds[$eventName][] = array($serviceId, $params[0], isset($params[1]) ? $params[1] : 0); - } else { - foreach ($params as $listener) { - $this->listenerIds[$eventName][] = array($serviceId, $listener[0], isset($listener[1]) ? $listener[1] : 0); - } - } - } - } - - /** - * {@inheritdoc} - * - * Lazily loads listeners for this event from the dependency injection - * container. - * - * @throws \InvalidArgumentException if the service is not defined - */ - public function dispatch($eventName, Event $event = null) - { - $this->lazyLoad($eventName); - - return parent::dispatch($eventName, $event); - } - - public function getContainer() - { - return $this->container; - } - - /** - * Lazily loads listeners for this event from the dependency injection - * container. - * - * @param string $eventName The name of the event to dispatch. The name of - * the event is the name of the method that is - * invoked on listeners. - */ - protected function lazyLoad($eventName) - { - if (isset($this->listenerIds[$eventName])) { - foreach ($this->listenerIds[$eventName] as $args) { - list($serviceId, $method, $priority) = $args; - $listener = $this->container->get($serviceId); - - $key = $serviceId.'.'.$method; - if (!isset($this->listeners[$eventName][$key])) { - $this->addListener($eventName, array($listener, $method), $priority); - } elseif ($listener !== $this->listeners[$eventName][$key]) { - parent::removeListener($eventName, array($this->listeners[$eventName][$key], $method)); - $this->addListener($eventName, array($listener, $method), $priority); - } - - $this->listeners[$eventName][$key] = $listener; - } - } - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php b/sitecake/2.2.9/server/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php deleted file mode 100644 index 7653ccf..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php +++ /dev/null @@ -1,335 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\EventDispatcher\Debug; - -use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; -use Symfony\Component\EventDispatcher\Event; -use Symfony\Component\Stopwatch\Stopwatch; -use Psr\Log\LoggerInterface; - -/** - * Collects some data about event listeners. - * - * This event dispatcher delegates the dispatching to another one. - * - * @author Fabien Potencier - */ -class TraceableEventDispatcher implements TraceableEventDispatcherInterface -{ - protected $logger; - protected $stopwatch; - - private $called; - private $dispatcher; - private $wrappedListeners; - - /** - * Constructor. - * - * @param EventDispatcherInterface $dispatcher An EventDispatcherInterface instance - * @param Stopwatch $stopwatch A Stopwatch instance - * @param LoggerInterface $logger A LoggerInterface instance - */ - public function __construct(EventDispatcherInterface $dispatcher, Stopwatch $stopwatch, LoggerInterface $logger = null) - { - $this->dispatcher = $dispatcher; - $this->stopwatch = $stopwatch; - $this->logger = $logger; - $this->called = array(); - $this->wrappedListeners = array(); - } - - /** - * {@inheritdoc} - */ - public function addListener($eventName, $listener, $priority = 0) - { - $this->dispatcher->addListener($eventName, $listener, $priority); - } - - /** - * {@inheritdoc} - */ - public function addSubscriber(EventSubscriberInterface $subscriber) - { - $this->dispatcher->addSubscriber($subscriber); - } - - /** - * {@inheritdoc} - */ - public function removeListener($eventName, $listener) - { - if (isset($this->wrappedListeners[$eventName])) { - foreach ($this->wrappedListeners[$eventName] as $index => $wrappedListener) { - if ($wrappedListener->getWrappedListener() === $listener) { - $listener = $wrappedListener; - unset($this->wrappedListeners[$eventName][$index]); - break; - } - } - } - - return $this->dispatcher->removeListener($eventName, $listener); - } - - /** - * {@inheritdoc} - */ - public function removeSubscriber(EventSubscriberInterface $subscriber) - { - return $this->dispatcher->removeSubscriber($subscriber); - } - - /** - * {@inheritdoc} - */ - public function getListeners($eventName = null) - { - return $this->dispatcher->getListeners($eventName); - } - - /** - * {@inheritdoc} - */ - public function hasListeners($eventName = null) - { - return $this->dispatcher->hasListeners($eventName); - } - - /** - * {@inheritdoc} - */ - public function dispatch($eventName, Event $event = null) - { - if (null === $event) { - $event = new Event(); - } - - $this->preProcess($eventName); - $this->preDispatch($eventName, $event); - - $e = $this->stopwatch->start($eventName, 'section'); - - $this->dispatcher->dispatch($eventName, $event); - - if ($e->isStarted()) { - $e->stop(); - } - - $this->postDispatch($eventName, $event); - $this->postProcess($eventName); - - return $event; - } - - /** - * {@inheritdoc} - */ - public function getCalledListeners() - { - $called = array(); - foreach ($this->called as $eventName => $listeners) { - foreach ($listeners as $listener) { - $info = $this->getListenerInfo($listener->getWrappedListener(), $eventName); - $called[$eventName.'.'.$info['pretty']] = $info; - } - } - - return $called; - } - - /** - * {@inheritdoc} - */ - public function getNotCalledListeners() - { - try { - $allListeners = $this->getListeners(); - } catch (\Exception $e) { - if (null !== $this->logger) { - $this->logger->info('An exception was thrown while getting the uncalled listeners.', array('exception' => $e)); - } - - // unable to retrieve the uncalled listeners - return array(); - } - - $notCalled = array(); - foreach ($allListeners as $eventName => $listeners) { - foreach ($listeners as $listener) { - $called = false; - if (isset($this->called[$eventName])) { - foreach ($this->called[$eventName] as $l) { - if ($l->getWrappedListener() === $listener) { - $called = true; - - break; - } - } - } - - if (!$called) { - $info = $this->getListenerInfo($listener, $eventName); - $notCalled[$eventName.'.'.$info['pretty']] = $info; - } - } - } - - return $notCalled; - } - - /** - * Proxies all method calls to the original event dispatcher. - * - * @param string $method The method name - * @param array $arguments The method arguments - * - * @return mixed - */ - public function __call($method, $arguments) - { - return call_user_func_array(array($this->dispatcher, $method), $arguments); - } - - /** - * Called before dispatching the event. - * - * @param string $eventName The event name - * @param Event $event The event - */ - protected function preDispatch($eventName, Event $event) - { - } - - /** - * Called after dispatching the event. - * - * @param string $eventName The event name - * @param Event $event The event - */ - protected function postDispatch($eventName, Event $event) - { - } - - private function preProcess($eventName) - { - foreach ($this->dispatcher->getListeners($eventName) as $listener) { - $this->dispatcher->removeListener($eventName, $listener); - $info = $this->getListenerInfo($listener, $eventName); - $name = isset($info['class']) ? $info['class'] : $info['type']; - $wrappedListener = new WrappedListener($listener, $name, $this->stopwatch, $this); - $this->wrappedListeners[$eventName][] = $wrappedListener; - $this->dispatcher->addListener($eventName, $wrappedListener); - } - } - - private function postProcess($eventName) - { - unset($this->wrappedListeners[$eventName]); - $skipped = false; - foreach ($this->dispatcher->getListeners($eventName) as $listener) { - if (!$listener instanceof WrappedListener) { // #12845: a new listener was added during dispatch. - continue; - } - // Unwrap listener - $this->dispatcher->removeListener($eventName, $listener); - $this->dispatcher->addListener($eventName, $listener->getWrappedListener()); - - $info = $this->getListenerInfo($listener->getWrappedListener(), $eventName); - if ($listener->wasCalled()) { - if (null !== $this->logger) { - $this->logger->debug(sprintf('Notified event "%s" to listener "%s".', $eventName, $info['pretty'])); - } - - if (!isset($this->called[$eventName])) { - $this->called[$eventName] = new \SplObjectStorage(); - } - - $this->called[$eventName]->attach($listener); - } - - if (null !== $this->logger && $skipped) { - $this->logger->debug(sprintf('Listener "%s" was not called for event "%s".', $info['pretty'], $eventName)); - } - - if ($listener->stoppedPropagation()) { - if (null !== $this->logger) { - $this->logger->debug(sprintf('Listener "%s" stopped propagation of the event "%s".', $info['pretty'], $eventName)); - } - - $skipped = true; - } - } - } - - /** - * Returns information about the listener. - * - * @param object $listener The listener - * @param string $eventName The event name - * - * @return array Information about the listener - */ - private function getListenerInfo($listener, $eventName) - { - $info = array( - 'event' => $eventName, - ); - if ($listener instanceof \Closure) { - $info += array( - 'type' => 'Closure', - 'pretty' => 'closure', - ); - } elseif (is_string($listener)) { - try { - $r = new \ReflectionFunction($listener); - $file = $r->getFileName(); - $line = $r->getStartLine(); - } catch (\ReflectionException $e) { - $file = null; - $line = null; - } - $info += array( - 'type' => 'Function', - 'function' => $listener, - 'file' => $file, - 'line' => $line, - 'pretty' => $listener, - ); - } elseif (is_array($listener) || (is_object($listener) && is_callable($listener))) { - if (!is_array($listener)) { - $listener = array($listener, '__invoke'); - } - $class = is_object($listener[0]) ? get_class($listener[0]) : $listener[0]; - try { - $r = new \ReflectionMethod($class, $listener[1]); - $file = $r->getFileName(); - $line = $r->getStartLine(); - } catch (\ReflectionException $e) { - $file = null; - $line = null; - } - $info += array( - 'type' => 'Method', - 'class' => $class, - 'method' => $listener[1], - 'file' => $file, - 'line' => $line, - 'pretty' => $class.'::'.$listener[1], - ); - } - - return $info; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcherInterface.php b/sitecake/2.2.9/server/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcherInterface.php deleted file mode 100644 index 5483e81..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcherInterface.php +++ /dev/null @@ -1,34 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\EventDispatcher\Debug; - -use Symfony\Component\EventDispatcher\EventDispatcherInterface; - -/** - * @author Fabien Potencier - */ -interface TraceableEventDispatcherInterface extends EventDispatcherInterface -{ - /** - * Gets the called listeners. - * - * @return array An array of called listeners - */ - public function getCalledListeners(); - - /** - * Gets the not called listeners. - * - * @return array An array of not called listeners - */ - public function getNotCalledListeners(); -} diff --git a/sitecake/2.2.9/server/vendor/symfony/event-dispatcher/Debug/WrappedListener.php b/sitecake/2.2.9/server/vendor/symfony/event-dispatcher/Debug/WrappedListener.php deleted file mode 100644 index e16627d..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/event-dispatcher/Debug/WrappedListener.php +++ /dev/null @@ -1,71 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\EventDispatcher\Debug; - -use Symfony\Component\Stopwatch\Stopwatch; -use Symfony\Component\EventDispatcher\Event; -use Symfony\Component\EventDispatcher\EventDispatcherInterface; - -/** - * @author Fabien Potencier - */ -class WrappedListener -{ - private $listener; - private $name; - private $called; - private $stoppedPropagation; - private $stopwatch; - private $dispatcher; - - public function __construct($listener, $name, Stopwatch $stopwatch, EventDispatcherInterface $dispatcher = null) - { - $this->listener = $listener; - $this->name = $name; - $this->stopwatch = $stopwatch; - $this->dispatcher = $dispatcher; - $this->called = false; - $this->stoppedPropagation = false; - } - - public function getWrappedListener() - { - return $this->listener; - } - - public function wasCalled() - { - return $this->called; - } - - public function stoppedPropagation() - { - return $this->stoppedPropagation; - } - - public function __invoke(Event $event, $eventName, EventDispatcherInterface $dispatcher) - { - $this->called = true; - - $e = $this->stopwatch->start($this->name, 'event_listener'); - - call_user_func($this->listener, $event, $eventName, $this->dispatcher ?: $dispatcher); - - if ($e->isStarted()) { - $e->stop(); - } - - if ($event->isPropagationStopped()) { - $this->stoppedPropagation = true; - } - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/event-dispatcher/DependencyInjection/RegisterListenersPass.php b/sitecake/2.2.9/server/vendor/symfony/event-dispatcher/DependencyInjection/RegisterListenersPass.php deleted file mode 100644 index 7e74a37..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/event-dispatcher/DependencyInjection/RegisterListenersPass.php +++ /dev/null @@ -1,110 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\EventDispatcher\DependencyInjection; - -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; - -/** - * Compiler pass to register tagged services for an event dispatcher. - */ -class RegisterListenersPass implements CompilerPassInterface -{ - /** - * @var string - */ - protected $dispatcherService; - - /** - * @var string - */ - protected $listenerTag; - - /** - * @var string - */ - protected $subscriberTag; - - /** - * Constructor. - * - * @param string $dispatcherService Service name of the event dispatcher in processed container - * @param string $listenerTag Tag name used for listener - * @param string $subscriberTag Tag name used for subscribers - */ - public function __construct($dispatcherService = 'event_dispatcher', $listenerTag = 'kernel.event_listener', $subscriberTag = 'kernel.event_subscriber') - { - $this->dispatcherService = $dispatcherService; - $this->listenerTag = $listenerTag; - $this->subscriberTag = $subscriberTag; - } - - public function process(ContainerBuilder $container) - { - if (!$container->hasDefinition($this->dispatcherService) && !$container->hasAlias($this->dispatcherService)) { - return; - } - - $definition = $container->findDefinition($this->dispatcherService); - - foreach ($container->findTaggedServiceIds($this->listenerTag) as $id => $events) { - $def = $container->getDefinition($id); - if (!$def->isPublic()) { - throw new \InvalidArgumentException(sprintf('The service "%s" must be public as event listeners are lazy-loaded.', $id)); - } - - if ($def->isAbstract()) { - throw new \InvalidArgumentException(sprintf('The service "%s" must not be abstract as event listeners are lazy-loaded.', $id)); - } - - foreach ($events as $event) { - $priority = isset($event['priority']) ? $event['priority'] : 0; - - if (!isset($event['event'])) { - throw new \InvalidArgumentException(sprintf('Service "%s" must define the "event" attribute on "%s" tags.', $id, $this->listenerTag)); - } - - if (!isset($event['method'])) { - $event['method'] = 'on'.preg_replace_callback(array( - '/(?<=\b)[a-z]/i', - '/[^a-z0-9]/i', - ), function ($matches) { return strtoupper($matches[0]); }, $event['event']); - $event['method'] = preg_replace('/[^a-z0-9]/i', '', $event['method']); - } - - $definition->addMethodCall('addListenerService', array($event['event'], array($id, $event['method']), $priority)); - } - } - - foreach ($container->findTaggedServiceIds($this->subscriberTag) as $id => $attributes) { - $def = $container->getDefinition($id); - if (!$def->isPublic()) { - throw new \InvalidArgumentException(sprintf('The service "%s" must be public as event subscribers are lazy-loaded.', $id)); - } - - if ($def->isAbstract()) { - throw new \InvalidArgumentException(sprintf('The service "%s" must not be abstract as event subscribers are lazy-loaded.', $id)); - } - - // We must assume that the class value has been correctly filled, even if the service is created by a factory - $class = $container->getParameterBag()->resolveValue($def->getClass()); - - $refClass = new \ReflectionClass($class); - $interface = 'Symfony\Component\EventDispatcher\EventSubscriberInterface'; - if (!$refClass->implementsInterface($interface)) { - throw new \InvalidArgumentException(sprintf('Service "%s" must implement interface "%s".', $id, $interface)); - } - - $definition->addMethodCall('addSubscriberService', array($id, $class)); - } - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/event-dispatcher/Event.php b/sitecake/2.2.9/server/vendor/symfony/event-dispatcher/Event.php deleted file mode 100644 index 048bf0a..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/event-dispatcher/Event.php +++ /dev/null @@ -1,134 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\EventDispatcher; - -/** - * Event is the base class for classes containing event data. - * - * This class contains no event data. It is used by events that do not pass - * state information to an event handler when an event is raised. - * - * You can call the method stopPropagation() to abort the execution of - * further listeners in your event listener. - * - * @author Guilherme Blanco - * @author Jonathan Wage - * @author Roman Borschel - * @author Bernhard Schussek - * - * @api - */ -class Event -{ - /** - * @var bool Whether no further event listeners should be triggered - */ - private $propagationStopped = false; - - /** - * @var EventDispatcher Dispatcher that dispatched this event - */ - private $dispatcher; - - /** - * @var string This event's name - */ - private $name; - - /** - * Returns whether further event listeners should be triggered. - * - * @see Event::stopPropagation() - * - * @return bool Whether propagation was already stopped for this event. - * - * @api - */ - public function isPropagationStopped() - { - return $this->propagationStopped; - } - - /** - * Stops the propagation of the event to further event listeners. - * - * If multiple event listeners are connected to the same event, no - * further event listener will be triggered once any trigger calls - * stopPropagation(). - * - * @api - */ - public function stopPropagation() - { - $this->propagationStopped = true; - } - - /** - * Stores the EventDispatcher that dispatches this Event. - * - * @param EventDispatcherInterface $dispatcher - * - * @deprecated since version 2.4, to be removed in 3.0. The event dispatcher is passed to the listener call. - * - * @api - */ - public function setDispatcher(EventDispatcherInterface $dispatcher) - { - $this->dispatcher = $dispatcher; - } - - /** - * Returns the EventDispatcher that dispatches this Event. - * - * @return EventDispatcherInterface - * - * @deprecated since version 2.4, to be removed in 3.0. The event dispatcher is passed to the listener call. - * - * @api - */ - public function getDispatcher() - { - @trigger_error('The '.__METHOD__.' method is deprecated since version 2.4 and will be removed in 3.0. The event dispatcher instance can be received in the listener call instead.', E_USER_DEPRECATED); - - return $this->dispatcher; - } - - /** - * Gets the event's name. - * - * @return string - * - * @deprecated since version 2.4, to be removed in 3.0. The event name is passed to the listener call. - * - * @api - */ - public function getName() - { - @trigger_error('The '.__METHOD__.' method is deprecated since version 2.4 and will be removed in 3.0. The event name can be received in the listener call instead.', E_USER_DEPRECATED); - - return $this->name; - } - - /** - * Sets the event's name property. - * - * @param string $name The event name. - * - * @deprecated since version 2.4, to be removed in 3.0. The event name is passed to the listener call. - * - * @api - */ - public function setName($name) - { - $this->name = $name; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/event-dispatcher/EventDispatcher.php b/sitecake/2.2.9/server/vendor/symfony/event-dispatcher/EventDispatcher.php deleted file mode 100644 index 46c1110..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/event-dispatcher/EventDispatcher.php +++ /dev/null @@ -1,185 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\EventDispatcher; - -/** - * The EventDispatcherInterface is the central point of Symfony's event listener system. - * - * Listeners are registered on the manager and events are dispatched through the - * manager. - * - * @author Guilherme Blanco - * @author Jonathan Wage - * @author Roman Borschel - * @author Bernhard Schussek - * @author Fabien Potencier - * @author Jordi Boggiano - * @author Jordan Alliot - * - * @api - */ -class EventDispatcher implements EventDispatcherInterface -{ - private $listeners = array(); - private $sorted = array(); - - /** - * @see EventDispatcherInterface::dispatch() - * - * @api - */ - public function dispatch($eventName, Event $event = null) - { - if (null === $event) { - $event = new Event(); - } - - $event->setDispatcher($this); - $event->setName($eventName); - - if (!isset($this->listeners[$eventName])) { - return $event; - } - - $this->doDispatch($this->getListeners($eventName), $eventName, $event); - - return $event; - } - - /** - * @see EventDispatcherInterface::getListeners() - */ - public function getListeners($eventName = null) - { - if (null !== $eventName) { - if (!isset($this->sorted[$eventName])) { - $this->sortListeners($eventName); - } - - return $this->sorted[$eventName]; - } - - foreach ($this->listeners as $eventName => $eventListeners) { - if (!isset($this->sorted[$eventName])) { - $this->sortListeners($eventName); - } - } - - return array_filter($this->sorted); - } - - /** - * @see EventDispatcherInterface::hasListeners() - */ - public function hasListeners($eventName = null) - { - return (bool) count($this->getListeners($eventName)); - } - - /** - * @see EventDispatcherInterface::addListener() - * - * @api - */ - public function addListener($eventName, $listener, $priority = 0) - { - $this->listeners[$eventName][$priority][] = $listener; - unset($this->sorted[$eventName]); - } - - /** - * @see EventDispatcherInterface::removeListener() - */ - public function removeListener($eventName, $listener) - { - if (!isset($this->listeners[$eventName])) { - return; - } - - foreach ($this->listeners[$eventName] as $priority => $listeners) { - if (false !== ($key = array_search($listener, $listeners, true))) { - unset($this->listeners[$eventName][$priority][$key], $this->sorted[$eventName]); - } - } - } - - /** - * @see EventDispatcherInterface::addSubscriber() - * - * @api - */ - public function addSubscriber(EventSubscriberInterface $subscriber) - { - foreach ($subscriber->getSubscribedEvents() as $eventName => $params) { - if (is_string($params)) { - $this->addListener($eventName, array($subscriber, $params)); - } elseif (is_string($params[0])) { - $this->addListener($eventName, array($subscriber, $params[0]), isset($params[1]) ? $params[1] : 0); - } else { - foreach ($params as $listener) { - $this->addListener($eventName, array($subscriber, $listener[0]), isset($listener[1]) ? $listener[1] : 0); - } - } - } - } - - /** - * @see EventDispatcherInterface::removeSubscriber() - */ - public function removeSubscriber(EventSubscriberInterface $subscriber) - { - foreach ($subscriber->getSubscribedEvents() as $eventName => $params) { - if (is_array($params) && is_array($params[0])) { - foreach ($params as $listener) { - $this->removeListener($eventName, array($subscriber, $listener[0])); - } - } else { - $this->removeListener($eventName, array($subscriber, is_string($params) ? $params : $params[0])); - } - } - } - - /** - * Triggers the listeners of an event. - * - * This method can be overridden to add functionality that is executed - * for each listener. - * - * @param callable[] $listeners The event listeners. - * @param string $eventName The name of the event to dispatch. - * @param Event $event The event object to pass to the event handlers/listeners. - */ - protected function doDispatch($listeners, $eventName, Event $event) - { - foreach ($listeners as $listener) { - call_user_func($listener, $event, $eventName, $this); - if ($event->isPropagationStopped()) { - break; - } - } - } - - /** - * Sorts the internal list of listeners for the given event by priority. - * - * @param string $eventName The name of the event. - */ - private function sortListeners($eventName) - { - $this->sorted[$eventName] = array(); - - if (isset($this->listeners[$eventName])) { - krsort($this->listeners[$eventName]); - $this->sorted[$eventName] = call_user_func_array('array_merge', $this->listeners[$eventName]); - } - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/event-dispatcher/EventDispatcherInterface.php b/sitecake/2.2.9/server/vendor/symfony/event-dispatcher/EventDispatcherInterface.php deleted file mode 100644 index 9d9fc4d..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/event-dispatcher/EventDispatcherInterface.php +++ /dev/null @@ -1,96 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\EventDispatcher; - -/** - * The EventDispatcherInterface is the central point of Symfony's event listener system. - * Listeners are registered on the manager and events are dispatched through the - * manager. - * - * @author Bernhard Schussek - * - * @api - */ -interface EventDispatcherInterface -{ - /** - * Dispatches an event to all registered listeners. - * - * @param string $eventName The name of the event to dispatch. The name of - * the event is the name of the method that is - * invoked on listeners. - * @param Event $event The event to pass to the event handlers/listeners. - * If not supplied, an empty Event instance is created. - * - * @return Event - * - * @api - */ - public function dispatch($eventName, Event $event = null); - - /** - * Adds an event listener that listens on the specified events. - * - * @param string $eventName The event to listen on - * @param callable $listener The listener - * @param int $priority The higher this value, the earlier an event - * listener will be triggered in the chain (defaults to 0) - * - * @api - */ - public function addListener($eventName, $listener, $priority = 0); - - /** - * Adds an event subscriber. - * - * The subscriber is asked for all the events he is - * interested in and added as a listener for these events. - * - * @param EventSubscriberInterface $subscriber The subscriber. - * - * @api - */ - public function addSubscriber(EventSubscriberInterface $subscriber); - - /** - * Removes an event listener from the specified events. - * - * @param string $eventName The event to remove a listener from - * @param callable $listener The listener to remove - */ - public function removeListener($eventName, $listener); - - /** - * Removes an event subscriber. - * - * @param EventSubscriberInterface $subscriber The subscriber - */ - public function removeSubscriber(EventSubscriberInterface $subscriber); - - /** - * Gets the listeners of a specific event or all listeners sorted by descending priority. - * - * @param string $eventName The name of the event - * - * @return array The event listeners for the specified event, or all event listeners by event name - */ - public function getListeners($eventName = null); - - /** - * Checks whether an event has any registered listeners. - * - * @param string $eventName The name of the event - * - * @return bool true if the specified event has any listeners, false otherwise - */ - public function hasListeners($eventName = null); -} diff --git a/sitecake/2.2.9/server/vendor/symfony/event-dispatcher/EventSubscriberInterface.php b/sitecake/2.2.9/server/vendor/symfony/event-dispatcher/EventSubscriberInterface.php deleted file mode 100644 index ff7e305..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/event-dispatcher/EventSubscriberInterface.php +++ /dev/null @@ -1,50 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\EventDispatcher; - -/** - * An EventSubscriber knows himself what events he is interested in. - * If an EventSubscriber is added to an EventDispatcherInterface, the manager invokes - * {@link getSubscribedEvents} and registers the subscriber as a listener for all - * returned events. - * - * @author Guilherme Blanco - * @author Jonathan Wage - * @author Roman Borschel - * @author Bernhard Schussek - * - * @api - */ -interface EventSubscriberInterface -{ - /** - * Returns an array of event names this subscriber wants to listen to. - * - * The array keys are event names and the value can be: - * - * * The method name to call (priority defaults to 0) - * * An array composed of the method name to call and the priority - * * An array of arrays composed of the method names to call and respective - * priorities, or 0 if unset - * - * For instance: - * - * * array('eventName' => 'methodName') - * * array('eventName' => array('methodName', $priority)) - * * array('eventName' => array(array('methodName1', $priority), array('methodName2')) - * - * @return array The event names to listen to - * - * @api - */ - public static function getSubscribedEvents(); -} diff --git a/sitecake/2.2.9/server/vendor/symfony/event-dispatcher/GenericEvent.php b/sitecake/2.2.9/server/vendor/symfony/event-dispatcher/GenericEvent.php deleted file mode 100644 index 6458180..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/event-dispatcher/GenericEvent.php +++ /dev/null @@ -1,186 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\EventDispatcher; - -/** - * Event encapsulation class. - * - * Encapsulates events thus decoupling the observer from the subject they encapsulate. - * - * @author Drak - */ -class GenericEvent extends Event implements \ArrayAccess, \IteratorAggregate -{ - /** - * Event subject. - * - * @var mixed usually object or callable - */ - protected $subject; - - /** - * Array of arguments. - * - * @var array - */ - protected $arguments; - - /** - * Encapsulate an event with $subject and $args. - * - * @param mixed $subject The subject of the event, usually an object. - * @param array $arguments Arguments to store in the event. - */ - public function __construct($subject = null, array $arguments = array()) - { - $this->subject = $subject; - $this->arguments = $arguments; - } - - /** - * Getter for subject property. - * - * @return mixed $subject The observer subject. - */ - public function getSubject() - { - return $this->subject; - } - - /** - * Get argument by key. - * - * @param string $key Key. - * - * @throws \InvalidArgumentException If key is not found. - * - * @return mixed Contents of array key. - */ - public function getArgument($key) - { - if ($this->hasArgument($key)) { - return $this->arguments[$key]; - } - - throw new \InvalidArgumentException(sprintf('Argument "%s" not found.', $key)); - } - - /** - * Add argument to event. - * - * @param string $key Argument name. - * @param mixed $value Value. - * - * @return GenericEvent - */ - public function setArgument($key, $value) - { - $this->arguments[$key] = $value; - - return $this; - } - - /** - * Getter for all arguments. - * - * @return array - */ - public function getArguments() - { - return $this->arguments; - } - - /** - * Set args property. - * - * @param array $args Arguments. - * - * @return GenericEvent - */ - public function setArguments(array $args = array()) - { - $this->arguments = $args; - - return $this; - } - - /** - * Has argument. - * - * @param string $key Key of arguments array. - * - * @return bool - */ - public function hasArgument($key) - { - return array_key_exists($key, $this->arguments); - } - - /** - * ArrayAccess for argument getter. - * - * @param string $key Array key. - * - * @throws \InvalidArgumentException If key does not exist in $this->args. - * - * @return mixed - */ - public function offsetGet($key) - { - return $this->getArgument($key); - } - - /** - * ArrayAccess for argument setter. - * - * @param string $key Array key to set. - * @param mixed $value Value. - */ - public function offsetSet($key, $value) - { - $this->setArgument($key, $value); - } - - /** - * ArrayAccess for unset argument. - * - * @param string $key Array key. - */ - public function offsetUnset($key) - { - if ($this->hasArgument($key)) { - unset($this->arguments[$key]); - } - } - - /** - * ArrayAccess has argument. - * - * @param string $key Array key. - * - * @return bool - */ - public function offsetExists($key) - { - return $this->hasArgument($key); - } - - /** - * IteratorAggregate for iterating over the object like an array. - * - * @return \ArrayIterator - */ - public function getIterator() - { - return new \ArrayIterator($this->arguments); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/event-dispatcher/ImmutableEventDispatcher.php b/sitecake/2.2.9/server/vendor/symfony/event-dispatcher/ImmutableEventDispatcher.php deleted file mode 100644 index 7ef9ece..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/event-dispatcher/ImmutableEventDispatcher.php +++ /dev/null @@ -1,93 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\EventDispatcher; - -/** - * A read-only proxy for an event dispatcher. - * - * @author Bernhard Schussek - */ -class ImmutableEventDispatcher implements EventDispatcherInterface -{ - /** - * The proxied dispatcher. - * - * @var EventDispatcherInterface - */ - private $dispatcher; - - /** - * Creates an unmodifiable proxy for an event dispatcher. - * - * @param EventDispatcherInterface $dispatcher The proxied event dispatcher. - */ - public function __construct(EventDispatcherInterface $dispatcher) - { - $this->dispatcher = $dispatcher; - } - - /** - * {@inheritdoc} - */ - public function dispatch($eventName, Event $event = null) - { - return $this->dispatcher->dispatch($eventName, $event); - } - - /** - * {@inheritdoc} - */ - public function addListener($eventName, $listener, $priority = 0) - { - throw new \BadMethodCallException('Unmodifiable event dispatchers must not be modified.'); - } - - /** - * {@inheritdoc} - */ - public function addSubscriber(EventSubscriberInterface $subscriber) - { - throw new \BadMethodCallException('Unmodifiable event dispatchers must not be modified.'); - } - - /** - * {@inheritdoc} - */ - public function removeListener($eventName, $listener) - { - throw new \BadMethodCallException('Unmodifiable event dispatchers must not be modified.'); - } - - /** - * {@inheritdoc} - */ - public function removeSubscriber(EventSubscriberInterface $subscriber) - { - throw new \BadMethodCallException('Unmodifiable event dispatchers must not be modified.'); - } - - /** - * {@inheritdoc} - */ - public function getListeners($eventName = null) - { - return $this->dispatcher->getListeners($eventName); - } - - /** - * {@inheritdoc} - */ - public function hasListeners($eventName = null) - { - return $this->dispatcher->hasListeners($eventName); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/event-dispatcher/LICENSE b/sitecake/2.2.9/server/vendor/symfony/event-dispatcher/LICENSE deleted file mode 100644 index 43028bc..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/event-dispatcher/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2004-2015 Fabien Potencier - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/sitecake/2.2.9/server/vendor/symfony/event-dispatcher/README.md b/sitecake/2.2.9/server/vendor/symfony/event-dispatcher/README.md deleted file mode 100644 index 8031f4d..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/event-dispatcher/README.md +++ /dev/null @@ -1,27 +0,0 @@ -EventDispatcher Component -========================= - -The Symfony EventDispatcher component implements the Mediator pattern in a -simple and effective way to make your projects truly extensible. - -```php -use Symfony\Component\EventDispatcher\EventDispatcher; -use Symfony\Component\EventDispatcher\Event; - -$dispatcher = new EventDispatcher(); - -$dispatcher->addListener('event_name', function (Event $event) { - // ... -}); - -$dispatcher->dispatch('event_name'); -``` - -Resources ---------- - -You can run the unit tests with the following command: - - $ cd path/to/Symfony/Component/EventDispatcher/ - $ composer install - $ phpunit diff --git a/sitecake/2.2.9/server/vendor/symfony/event-dispatcher/composer.json b/sitecake/2.2.9/server/vendor/symfony/event-dispatcher/composer.json deleted file mode 100644 index d705862..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/event-dispatcher/composer.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "name": "symfony/event-dispatcher", - "type": "library", - "description": "Symfony EventDispatcher Component", - "keywords": [], - "homepage": "https://symfony.com", - "license": "MIT", - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "require": { - "php": ">=5.3.9" - }, - "require-dev": { - "symfony/phpunit-bridge": "~2.7", - "symfony/dependency-injection": "~2.6", - "symfony/expression-language": "~2.6", - "symfony/config": "~2.0,>=2.0.5", - "symfony/stopwatch": "~2.3", - "psr/log": "~1.0" - }, - "suggest": { - "symfony/dependency-injection": "", - "symfony/http-kernel": "" - }, - "autoload": { - "psr-4": { "Symfony\\Component\\EventDispatcher\\": "" } - }, - "minimum-stability": "dev", - "extra": { - "branch-alias": { - "dev-master": "2.7-dev" - } - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/event-dispatcher/phpunit.xml.dist b/sitecake/2.2.9/server/vendor/symfony/event-dispatcher/phpunit.xml.dist deleted file mode 100644 index ae0586e..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/event-dispatcher/phpunit.xml.dist +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - ./Tests/ - - - - - - ./ - - ./Resources - ./Tests - ./vendor - - - - diff --git a/sitecake/2.2.9/server/vendor/symfony/filesystem/CHANGELOG.md b/sitecake/2.2.9/server/vendor/symfony/filesystem/CHANGELOG.md deleted file mode 100644 index a4c0479..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/filesystem/CHANGELOG.md +++ /dev/null @@ -1,28 +0,0 @@ -CHANGELOG -========= - -2.6.0 ------ - - * added LockHandler - -2.3.12 ------- - - * deprecated dumpFile() file mode argument. - -2.3.0 ------ - - * added the dumpFile() method to atomically write files - -2.2.0 ------ - - * added a delete option for the mirror() method - -2.1.0 ------ - - * 24eb396 : BC Break : mkdir() function now throws exception in case of failure instead of returning Boolean value - * created the component diff --git a/sitecake/2.2.9/server/vendor/symfony/filesystem/Exception/ExceptionInterface.php b/sitecake/2.2.9/server/vendor/symfony/filesystem/Exception/ExceptionInterface.php deleted file mode 100644 index c212e66..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/filesystem/Exception/ExceptionInterface.php +++ /dev/null @@ -1,23 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Filesystem\Exception; - -/** - * Exception interface for all exceptions thrown by the component. - * - * @author Romain Neutron - * - * @api - */ -interface ExceptionInterface -{ -} diff --git a/sitecake/2.2.9/server/vendor/symfony/filesystem/Exception/FileNotFoundException.php b/sitecake/2.2.9/server/vendor/symfony/filesystem/Exception/FileNotFoundException.php deleted file mode 100644 index 15533db..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/filesystem/Exception/FileNotFoundException.php +++ /dev/null @@ -1,34 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Filesystem\Exception; - -/** - * Exception class thrown when a file couldn't be found - * - * @author Fabien Potencier - * @author Christian Gärtner - */ -class FileNotFoundException extends IOException -{ - public function __construct($message = null, $code = 0, \Exception $previous = null, $path = null) - { - if (null === $message) { - if (null === $path) { - $message = 'File could not be found.'; - } else { - $message = sprintf('File "%s" could not be found.', $path); - } - } - - parent::__construct($message, $code, $previous, $path); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/filesystem/Exception/IOException.php b/sitecake/2.2.9/server/vendor/symfony/filesystem/Exception/IOException.php deleted file mode 100644 index f68a820..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/filesystem/Exception/IOException.php +++ /dev/null @@ -1,41 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Filesystem\Exception; - -/** - * Exception class thrown when a filesystem operation failure happens. - * - * @author Romain Neutron - * @author Christian Gärtner - * @author Fabien Potencier - * - * @api - */ -class IOException extends \RuntimeException implements IOExceptionInterface -{ - private $path; - - public function __construct($message, $code = 0, \Exception $previous = null, $path = null) - { - $this->path = $path; - - parent::__construct($message, $code, $previous); - } - - /** - * {@inheritdoc} - */ - public function getPath() - { - return $this->path; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/filesystem/Exception/IOExceptionInterface.php b/sitecake/2.2.9/server/vendor/symfony/filesystem/Exception/IOExceptionInterface.php deleted file mode 100644 index c88c763..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/filesystem/Exception/IOExceptionInterface.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Filesystem\Exception; - -/** - * IOException interface for file and input/output stream related exceptions thrown by the component. - * - * @author Christian Gärtner - */ -interface IOExceptionInterface extends ExceptionInterface -{ - /** - * Returns the associated path for the exception - * - * @return string The path. - */ - public function getPath(); -} diff --git a/sitecake/2.2.9/server/vendor/symfony/filesystem/Filesystem.php b/sitecake/2.2.9/server/vendor/symfony/filesystem/Filesystem.php deleted file mode 100644 index 3d6f3ca..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/filesystem/Filesystem.php +++ /dev/null @@ -1,500 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Filesystem; - -use Symfony\Component\Filesystem\Exception\IOException; -use Symfony\Component\Filesystem\Exception\FileNotFoundException; - -/** - * Provides basic utility to manipulate the file system. - * - * @author Fabien Potencier - */ -class Filesystem -{ - /** - * Copies a file. - * - * This method only copies the file if the origin file is newer than the target file. - * - * By default, if the target already exists, it is not overridden. - * - * @param string $originFile The original filename - * @param string $targetFile The target filename - * @param bool $override Whether to override an existing file or not - * - * @throws FileNotFoundException When originFile doesn't exist - * @throws IOException When copy fails - */ - public function copy($originFile, $targetFile, $override = false) - { - if (stream_is_local($originFile) && !is_file($originFile)) { - throw new FileNotFoundException(sprintf('Failed to copy "%s" because file does not exist.', $originFile), 0, null, $originFile); - } - - $this->mkdir(dirname($targetFile)); - - $doCopy = true; - if (!$override && null === parse_url($originFile, PHP_URL_HOST) && is_file($targetFile)) { - $doCopy = filemtime($originFile) > filemtime($targetFile); - } - - if ($doCopy) { - // https://bugs.php.net/bug.php?id=64634 - if (false === $source = @fopen($originFile, 'r')) { - throw new IOException(sprintf('Failed to copy "%s" to "%s" because source file could not be opened for reading.', $originFile, $targetFile), 0, null, $originFile); - } - - // Stream context created to allow files overwrite when using FTP stream wrapper - disabled by default - if (false === $target = @fopen($targetFile, 'w', null, stream_context_create(array('ftp' => array('overwrite' => true))))) { - throw new IOException(sprintf('Failed to copy "%s" to "%s" because target file could not be opened for writing.', $originFile, $targetFile), 0, null, $originFile); - } - - $bytesCopied = stream_copy_to_stream($source, $target); - fclose($source); - fclose($target); - unset($source, $target); - - if (!is_file($targetFile)) { - throw new IOException(sprintf('Failed to copy "%s" to "%s".', $originFile, $targetFile), 0, null, $originFile); - } - - // Like `cp`, preserve executable permission bits - @chmod($targetFile, fileperms($targetFile) | (fileperms($originFile) & 0111)); - - if (stream_is_local($originFile) && $bytesCopied !== ($bytesOrigin = filesize($originFile))) { - throw new IOException(sprintf('Failed to copy the whole content of "%s" to "%s" (%g of %g bytes copied).', $originFile, $targetFile, $bytesCopied, $bytesOrigin), 0, null, $originFile); - } - } - } - - /** - * Creates a directory recursively. - * - * @param string|array|\Traversable $dirs The directory path - * @param int $mode The directory mode - * - * @throws IOException On any directory creation failure - */ - public function mkdir($dirs, $mode = 0777) - { - foreach ($this->toIterator($dirs) as $dir) { - if (is_dir($dir)) { - continue; - } - - if (true !== @mkdir($dir, $mode, true)) { - $error = error_get_last(); - if (!is_dir($dir)) { - // The directory was not created by a concurrent process. Let's throw an exception with a developer friendly error message if we have one - if ($error) { - throw new IOException(sprintf('Failed to create "%s": %s.', $dir, $error['message']), 0, null, $dir); - } - throw new IOException(sprintf('Failed to create "%s"', $dir), 0, null, $dir); - } - } - } - } - - /** - * Checks the existence of files or directories. - * - * @param string|array|\Traversable $files A filename, an array of files, or a \Traversable instance to check - * - * @return bool true if the file exists, false otherwise - */ - public function exists($files) - { - foreach ($this->toIterator($files) as $file) { - if (!file_exists($file)) { - return false; - } - } - - return true; - } - - /** - * Sets access and modification time of file. - * - * @param string|array|\Traversable $files A filename, an array of files, or a \Traversable instance to create - * @param int $time The touch time as a Unix timestamp - * @param int $atime The access time as a Unix timestamp - * - * @throws IOException When touch fails - */ - public function touch($files, $time = null, $atime = null) - { - foreach ($this->toIterator($files) as $file) { - $touch = $time ? @touch($file, $time, $atime) : @touch($file); - if (true !== $touch) { - throw new IOException(sprintf('Failed to touch "%s".', $file), 0, null, $file); - } - } - } - - /** - * Removes files or directories. - * - * @param string|array|\Traversable $files A filename, an array of files, or a \Traversable instance to remove - * - * @throws IOException When removal fails - */ - public function remove($files) - { - $files = iterator_to_array($this->toIterator($files)); - $files = array_reverse($files); - foreach ($files as $file) { - if (!file_exists($file) && !is_link($file)) { - continue; - } - - if (is_dir($file) && !is_link($file)) { - $this->remove(new \FilesystemIterator($file)); - - if (true !== @rmdir($file)) { - throw new IOException(sprintf('Failed to remove directory "%s".', $file), 0, null, $file); - } - } else { - // https://bugs.php.net/bug.php?id=52176 - if ('\\' === DIRECTORY_SEPARATOR && is_dir($file)) { - if (true !== @rmdir($file)) { - throw new IOException(sprintf('Failed to remove file "%s".', $file), 0, null, $file); - } - } else { - if (true !== @unlink($file)) { - throw new IOException(sprintf('Failed to remove file "%s".', $file), 0, null, $file); - } - } - } - } - } - - /** - * Change mode for an array of files or directories. - * - * @param string|array|\Traversable $files A filename, an array of files, or a \Traversable instance to change mode - * @param int $mode The new mode (octal) - * @param int $umask The mode mask (octal) - * @param bool $recursive Whether change the mod recursively or not - * - * @throws IOException When the change fail - */ - public function chmod($files, $mode, $umask = 0000, $recursive = false) - { - foreach ($this->toIterator($files) as $file) { - if ($recursive && is_dir($file) && !is_link($file)) { - $this->chmod(new \FilesystemIterator($file), $mode, $umask, true); - } - if (true !== @chmod($file, $mode & ~$umask)) { - throw new IOException(sprintf('Failed to chmod file "%s".', $file), 0, null, $file); - } - } - } - - /** - * Change the owner of an array of files or directories. - * - * @param string|array|\Traversable $files A filename, an array of files, or a \Traversable instance to change owner - * @param string $user The new owner user name - * @param bool $recursive Whether change the owner recursively or not - * - * @throws IOException When the change fail - */ - public function chown($files, $user, $recursive = false) - { - foreach ($this->toIterator($files) as $file) { - if ($recursive && is_dir($file) && !is_link($file)) { - $this->chown(new \FilesystemIterator($file), $user, true); - } - if (is_link($file) && function_exists('lchown')) { - if (true !== @lchown($file, $user)) { - throw new IOException(sprintf('Failed to chown file "%s".', $file), 0, null, $file); - } - } else { - if (true !== @chown($file, $user)) { - throw new IOException(sprintf('Failed to chown file "%s".', $file), 0, null, $file); - } - } - } - } - - /** - * Change the group of an array of files or directories. - * - * @param string|array|\Traversable $files A filename, an array of files, or a \Traversable instance to change group - * @param string $group The group name - * @param bool $recursive Whether change the group recursively or not - * - * @throws IOException When the change fail - */ - public function chgrp($files, $group, $recursive = false) - { - foreach ($this->toIterator($files) as $file) { - if ($recursive && is_dir($file) && !is_link($file)) { - $this->chgrp(new \FilesystemIterator($file), $group, true); - } - if (is_link($file) && function_exists('lchgrp')) { - if (true !== @lchgrp($file, $group)) { - throw new IOException(sprintf('Failed to chgrp file "%s".', $file), 0, null, $file); - } - } else { - if (true !== @chgrp($file, $group)) { - throw new IOException(sprintf('Failed to chgrp file "%s".', $file), 0, null, $file); - } - } - } - } - - /** - * Renames a file or a directory. - * - * @param string $origin The origin filename or directory - * @param string $target The new filename or directory - * @param bool $overwrite Whether to overwrite the target if it already exists - * - * @throws IOException When target file or directory already exists - * @throws IOException When origin cannot be renamed - */ - public function rename($origin, $target, $overwrite = false) - { - // we check that target does not exist - if (!$overwrite && is_readable($target)) { - throw new IOException(sprintf('Cannot rename because the target "%s" already exists.', $target), 0, null, $target); - } - - if (true !== @rename($origin, $target)) { - throw new IOException(sprintf('Cannot rename "%s" to "%s".', $origin, $target), 0, null, $target); - } - } - - /** - * Creates a symbolic link or copy a directory. - * - * @param string $originDir The origin directory path - * @param string $targetDir The symbolic link name - * @param bool $copyOnWindows Whether to copy files if on Windows - * - * @throws IOException When symlink fails - */ - public function symlink($originDir, $targetDir, $copyOnWindows = false) - { - if ('\\' === DIRECTORY_SEPARATOR && $copyOnWindows) { - $this->mirror($originDir, $targetDir); - - return; - } - - $this->mkdir(dirname($targetDir)); - - $ok = false; - if (is_link($targetDir)) { - if (readlink($targetDir) != $originDir) { - $this->remove($targetDir); - } else { - $ok = true; - } - } - - if (!$ok && true !== @symlink($originDir, $targetDir)) { - $report = error_get_last(); - if (is_array($report)) { - if ('\\' === DIRECTORY_SEPARATOR && false !== strpos($report['message'], 'error code(1314)')) { - throw new IOException('Unable to create symlink due to error code 1314: \'A required privilege is not held by the client\'. Do you have the required Administrator-rights?'); - } - throw new IOException(sprintf('Failed to create symbolic link from "%s" to "%s".', $originDir, $targetDir), 0, null, $targetDir); - } - throw new IOException(sprintf('Failed to create symbolic link from %s to %s', $originDir, $targetDir)); - } - } - - /** - * Given an existing path, convert it to a path relative to a given starting path. - * - * @param string $endPath Absolute path of target - * @param string $startPath Absolute path where traversal begins - * - * @return string Path of target relative to starting path - */ - public function makePathRelative($endPath, $startPath) - { - // Normalize separators on Windows - if ('\\' === DIRECTORY_SEPARATOR) { - $endPath = strtr($endPath, '\\', '/'); - $startPath = strtr($startPath, '\\', '/'); - } - - // Split the paths into arrays - $startPathArr = explode('/', trim($startPath, '/')); - $endPathArr = explode('/', trim($endPath, '/')); - - // Find for which directory the common path stops - $index = 0; - while (isset($startPathArr[$index]) && isset($endPathArr[$index]) && $startPathArr[$index] === $endPathArr[$index]) { - ++$index; - } - - // Determine how deep the start path is relative to the common path (ie, "web/bundles" = 2 levels) - $depth = count($startPathArr) - $index; - - // Repeated "../" for each level need to reach the common path - $traverser = str_repeat('../', $depth); - - $endPathRemainder = implode('/', array_slice($endPathArr, $index)); - - // Construct $endPath from traversing to the common path, then to the remaining $endPath - $relativePath = $traverser.('' !== $endPathRemainder ? $endPathRemainder.'/' : ''); - - return '' === $relativePath ? './' : $relativePath; - } - - /** - * Mirrors a directory to another. - * - * @param string $originDir The origin directory - * @param string $targetDir The target directory - * @param \Traversable $iterator A Traversable instance - * @param array $options An array of boolean options - * Valid options are: - * - $options['override'] Whether to override an existing file on copy or not (see copy()) - * - $options['copy_on_windows'] Whether to copy files instead of links on Windows (see symlink()) - * - $options['delete'] Whether to delete files that are not in the source directory (defaults to false) - * - * @throws IOException When file type is unknown - */ - public function mirror($originDir, $targetDir, \Traversable $iterator = null, $options = array()) - { - $targetDir = rtrim($targetDir, '/\\'); - $originDir = rtrim($originDir, '/\\'); - - // Iterate in destination folder to remove obsolete entries - if ($this->exists($targetDir) && isset($options['delete']) && $options['delete']) { - $deleteIterator = $iterator; - if (null === $deleteIterator) { - $flags = \FilesystemIterator::SKIP_DOTS; - $deleteIterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($targetDir, $flags), \RecursiveIteratorIterator::CHILD_FIRST); - } - foreach ($deleteIterator as $file) { - $origin = str_replace($targetDir, $originDir, $file->getPathname()); - if (!$this->exists($origin)) { - $this->remove($file); - } - } - } - - $copyOnWindows = false; - if (isset($options['copy_on_windows'])) { - $copyOnWindows = $options['copy_on_windows']; - } - - if (null === $iterator) { - $flags = $copyOnWindows ? \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS : \FilesystemIterator::SKIP_DOTS; - $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($originDir, $flags), \RecursiveIteratorIterator::SELF_FIRST); - } - - if ($this->exists($originDir)) { - $this->mkdir($targetDir); - } - - foreach ($iterator as $file) { - $target = str_replace($originDir, $targetDir, $file->getPathname()); - - if ($copyOnWindows) { - if (is_link($file) || is_file($file)) { - $this->copy($file, $target, isset($options['override']) ? $options['override'] : false); - } elseif (is_dir($file)) { - $this->mkdir($target); - } else { - throw new IOException(sprintf('Unable to guess "%s" file type.', $file), 0, null, $file); - } - } else { - if (is_link($file)) { - $this->symlink($file->getRealPath(), $target); - } elseif (is_dir($file)) { - $this->mkdir($target); - } elseif (is_file($file)) { - $this->copy($file, $target, isset($options['override']) ? $options['override'] : false); - } else { - throw new IOException(sprintf('Unable to guess "%s" file type.', $file), 0, null, $file); - } - } - } - } - - /** - * Returns whether the file path is an absolute path. - * - * @param string $file A file path - * - * @return bool - */ - public function isAbsolutePath($file) - { - return (strspn($file, '/\\', 0, 1) - || (strlen($file) > 3 && ctype_alpha($file[0]) - && substr($file, 1, 1) === ':' - && (strspn($file, '/\\', 2, 1)) - ) - || null !== parse_url($file, PHP_URL_SCHEME) - ); - } - - /** - * Atomically dumps content into a file. - * - * @param string $filename The file to be written to. - * @param string $content The data to write into the file. - * @param null|int $mode The file mode (octal). If null, file permissions are not modified - * Deprecated since version 2.3.12, to be removed in 3.0. - * - * @throws IOException If the file cannot be written to. - */ - public function dumpFile($filename, $content, $mode = 0666) - { - $dir = dirname($filename); - - if (!is_dir($dir)) { - $this->mkdir($dir); - } elseif (!is_writable($dir)) { - throw new IOException(sprintf('Unable to write to the "%s" directory.', $dir), 0, null, $dir); - } - - $tmpFile = tempnam($dir, basename($filename)); - - if (false === @file_put_contents($tmpFile, $content)) { - throw new IOException(sprintf('Failed to write file "%s".', $filename), 0, null, $filename); - } - - $this->rename($tmpFile, $filename, true); - if (null !== $mode) { - if (func_num_args() > 2) { - @trigger_error('Support for modifying file permissions is deprecated since version 2.3.12 and will be removed in 3.0.', E_USER_DEPRECATED); - } - - $this->chmod($filename, $mode); - } - } - - /** - * @param mixed $files - * - * @return \Traversable - */ - private function toIterator($files) - { - if (!$files instanceof \Traversable) { - $files = new \ArrayObject(is_array($files) ? $files : array($files)); - } - - return $files; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/filesystem/LICENSE b/sitecake/2.2.9/server/vendor/symfony/filesystem/LICENSE deleted file mode 100644 index 43028bc..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/filesystem/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2004-2015 Fabien Potencier - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/sitecake/2.2.9/server/vendor/symfony/filesystem/LockHandler.php b/sitecake/2.2.9/server/vendor/symfony/filesystem/LockHandler.php deleted file mode 100644 index 59d35ec..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/filesystem/LockHandler.php +++ /dev/null @@ -1,111 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Filesystem; - -use Symfony\Component\Filesystem\Exception\IOException; - -/** - * LockHandler class provides a simple abstraction to lock anything by means of - * a file lock. - * - * A locked file is created based on the lock name when calling lock(). Other - * lock handlers will not be able to lock the same name until it is released - * (explicitly by calling release() or implicitly when the instance holding the - * lock is destroyed). - * - * @author Grégoire Pineau - * @author Romain Neutron - * @author Nicolas Grekas - */ -class LockHandler -{ - private $file; - private $handle; - - /** - * @param string $name The lock name - * @param string|null $lockPath The directory to store the lock. Default values will use temporary directory - * @throws IOException If the lock directory could not be created or is not writable - */ - public function __construct($name, $lockPath = null) - { - $lockPath = $lockPath ?: sys_get_temp_dir(); - - if (!is_dir($lockPath)) { - $fs = new Filesystem(); - $fs->mkdir($lockPath); - } - - if (!is_writable($lockPath)) { - throw new IOException(sprintf('The directory "%s" is not writable.', $lockPath), 0, null, $lockPath); - } - - $this->file = sprintf('%s/sf.%s.%s.lock', $lockPath, preg_replace('/[^a-z0-9\._-]+/i', '-', $name), hash('sha256', $name)); - } - - /** - * Lock the resource - * - * @param bool $blocking wait until the lock is released - * @return bool Returns true if the lock was acquired, false otherwise - * @throws IOException If the lock file could not be created or opened - */ - public function lock($blocking = false) - { - if ($this->handle) { - return true; - } - - // Silence both userland and native PHP error handlers - $errorLevel = error_reporting(0); - set_error_handler('var_dump', 0); - - if (!$this->handle = fopen($this->file, 'r')) { - if ($this->handle = fopen($this->file, 'x')) { - chmod($this->file, 0444); - } elseif (!$this->handle = fopen($this->file, 'r')) { - usleep(100); // Give some time for chmod() to complete - $this->handle = fopen($this->file, 'r'); - } - } - restore_error_handler(); - error_reporting($errorLevel); - - if (!$this->handle) { - $error = error_get_last(); - throw new IOException($error['message'], 0, null, $this->file); - } - - // On Windows, even if PHP doc says the contrary, LOCK_NB works, see - // https://bugs.php.net/54129 - if (!flock($this->handle, LOCK_EX | ($blocking ? 0 : LOCK_NB))) { - fclose($this->handle); - $this->handle = null; - - return false; - } - - return true; - } - - /** - * Release the resource - */ - public function release() - { - if ($this->handle) { - flock($this->handle, LOCK_UN | LOCK_NB); - fclose($this->handle); - $this->handle = null; - } - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/filesystem/README.md b/sitecake/2.2.9/server/vendor/symfony/filesystem/README.md deleted file mode 100644 index df09f93..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/filesystem/README.md +++ /dev/null @@ -1,47 +0,0 @@ -Filesystem Component -==================== - -Filesystem provides basic utility to manipulate the file system: - -```php -copy($originFile, $targetFile, $override = false); - -$filesystem->mkdir($dirs, $mode = 0777); - -$filesystem->touch($files, $time = null, $atime = null); - -$filesystem->remove($files); - -$filesystem->exists($files); - -$filesystem->chmod($files, $mode, $umask = 0000, $recursive = false); - -$filesystem->chown($files, $user, $recursive = false); - -$filesystem->chgrp($files, $group, $recursive = false); - -$filesystem->rename($origin, $target); - -$filesystem->symlink($originDir, $targetDir, $copyOnWindows = false); - -$filesystem->makePathRelative($endPath, $startPath); - -$filesystem->mirror($originDir, $targetDir, \Traversable $iterator = null, $options = array()); - -$filesystem->isAbsolutePath($file); -``` - -Resources ---------- - -You can run the unit tests with the following command: - - $ cd path/to/Symfony/Component/Filesystem/ - $ composer install - $ phpunit diff --git a/sitecake/2.2.9/server/vendor/symfony/filesystem/composer.json b/sitecake/2.2.9/server/vendor/symfony/filesystem/composer.json deleted file mode 100644 index 820d9f1..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/filesystem/composer.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "name": "symfony/filesystem", - "type": "library", - "description": "Symfony Filesystem Component", - "keywords": [], - "homepage": "https://symfony.com", - "license": "MIT", - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "require": { - "php": ">=5.3.9" - }, - "require-dev": { - "symfony/phpunit-bridge": "~2.7" - }, - "autoload": { - "psr-4": { "Symfony\\Component\\Filesystem\\": "" } - }, - "minimum-stability": "dev", - "extra": { - "branch-alias": { - "dev-master": "2.7-dev" - } - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/filesystem/phpunit.xml.dist b/sitecake/2.2.9/server/vendor/symfony/filesystem/phpunit.xml.dist deleted file mode 100644 index 7c6ba7a..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/filesystem/phpunit.xml.dist +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - ./Tests/ - - - - - - ./ - - ./Tests - - - - diff --git a/sitecake/2.2.9/server/vendor/symfony/http-foundation/AcceptHeader.php b/sitecake/2.2.9/server/vendor/symfony/http-foundation/AcceptHeader.php deleted file mode 100644 index 2260787..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-foundation/AcceptHeader.php +++ /dev/null @@ -1,172 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation; - -/** - * Represents an Accept-* header. - * - * An accept header is compound with a list of items, - * sorted by descending quality. - * - * @author Jean-François Simon - */ -class AcceptHeader -{ - /** - * @var AcceptHeaderItem[] - */ - private $items = array(); - - /** - * @var bool - */ - private $sorted = true; - - /** - * Constructor. - * - * @param AcceptHeaderItem[] $items - */ - public function __construct(array $items) - { - foreach ($items as $item) { - $this->add($item); - } - } - - /** - * Builds an AcceptHeader instance from a string. - * - * @param string $headerValue - * - * @return AcceptHeader - */ - public static function fromString($headerValue) - { - $index = 0; - - return new self(array_map(function ($itemValue) use (&$index) { - $item = AcceptHeaderItem::fromString($itemValue); - $item->setIndex($index++); - - return $item; - }, preg_split('/\s*(?:,*("[^"]+"),*|,*(\'[^\']+\'),*|,+)\s*/', $headerValue, 0, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE))); - } - - /** - * Returns header value's string representation. - * - * @return string - */ - public function __toString() - { - return implode(',', $this->items); - } - - /** - * Tests if header has given value. - * - * @param string $value - * - * @return bool - */ - public function has($value) - { - return isset($this->items[$value]); - } - - /** - * Returns given value's item, if exists. - * - * @param string $value - * - * @return AcceptHeaderItem|null - */ - public function get($value) - { - return isset($this->items[$value]) ? $this->items[$value] : null; - } - - /** - * Adds an item. - * - * @param AcceptHeaderItem $item - * - * @return AcceptHeader - */ - public function add(AcceptHeaderItem $item) - { - $this->items[$item->getValue()] = $item; - $this->sorted = false; - - return $this; - } - - /** - * Returns all items. - * - * @return AcceptHeaderItem[] - */ - public function all() - { - $this->sort(); - - return $this->items; - } - - /** - * Filters items on their value using given regex. - * - * @param string $pattern - * - * @return AcceptHeader - */ - public function filter($pattern) - { - return new self(array_filter($this->items, function (AcceptHeaderItem $item) use ($pattern) { - return preg_match($pattern, $item->getValue()); - })); - } - - /** - * Returns first item. - * - * @return AcceptHeaderItem|null - */ - public function first() - { - $this->sort(); - - return !empty($this->items) ? reset($this->items) : null; - } - - /** - * Sorts items by descending quality. - */ - private function sort() - { - if (!$this->sorted) { - uasort($this->items, function ($a, $b) { - $qA = $a->getQuality(); - $qB = $b->getQuality(); - - if ($qA === $qB) { - return $a->getIndex() > $b->getIndex() ? 1 : -1; - } - - return $qA > $qB ? -1 : 1; - }); - - $this->sorted = true; - } - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-foundation/AcceptHeaderItem.php b/sitecake/2.2.9/server/vendor/symfony/http-foundation/AcceptHeaderItem.php deleted file mode 100644 index 21a5d15..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-foundation/AcceptHeaderItem.php +++ /dev/null @@ -1,226 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation; - -/** - * Represents an Accept-* header item. - * - * @author Jean-François Simon - */ -class AcceptHeaderItem -{ - /** - * @var string - */ - private $value; - - /** - * @var float - */ - private $quality = 1.0; - - /** - * @var int - */ - private $index = 0; - - /** - * @var array - */ - private $attributes = array(); - - /** - * Constructor. - * - * @param string $value - * @param array $attributes - */ - public function __construct($value, array $attributes = array()) - { - $this->value = $value; - foreach ($attributes as $name => $value) { - $this->setAttribute($name, $value); - } - } - - /** - * Builds an AcceptHeaderInstance instance from a string. - * - * @param string $itemValue - * - * @return AcceptHeaderItem - */ - public static function fromString($itemValue) - { - $bits = preg_split('/\s*(?:;*("[^"]+");*|;*(\'[^\']+\');*|;+)\s*/', $itemValue, 0, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE); - $value = array_shift($bits); - $attributes = array(); - - $lastNullAttribute = null; - foreach ($bits as $bit) { - if (($start = substr($bit, 0, 1)) === ($end = substr($bit, -1)) && ($start === '"' || $start === '\'')) { - $attributes[$lastNullAttribute] = substr($bit, 1, -1); - } elseif ('=' === $end) { - $lastNullAttribute = $bit = substr($bit, 0, -1); - $attributes[$bit] = null; - } else { - $parts = explode('=', $bit); - $attributes[$parts[0]] = isset($parts[1]) && strlen($parts[1]) > 0 ? $parts[1] : ''; - } - } - - return new self(($start = substr($value, 0, 1)) === ($end = substr($value, -1)) && ($start === '"' || $start === '\'') ? substr($value, 1, -1) : $value, $attributes); - } - - /** - * Returns header value's string representation. - * - * @return string - */ - public function __toString() - { - $string = $this->value.($this->quality < 1 ? ';q='.$this->quality : ''); - if (count($this->attributes) > 0) { - $string .= ';'.implode(';', array_map(function ($name, $value) { - return sprintf(preg_match('/[,;=]/', $value) ? '%s="%s"' : '%s=%s', $name, $value); - }, array_keys($this->attributes), $this->attributes)); - } - - return $string; - } - - /** - * Set the item value. - * - * @param string $value - * - * @return AcceptHeaderItem - */ - public function setValue($value) - { - $this->value = $value; - - return $this; - } - - /** - * Returns the item value. - * - * @return string - */ - public function getValue() - { - return $this->value; - } - - /** - * Set the item quality. - * - * @param float $quality - * - * @return AcceptHeaderItem - */ - public function setQuality($quality) - { - $this->quality = $quality; - - return $this; - } - - /** - * Returns the item quality. - * - * @return float - */ - public function getQuality() - { - return $this->quality; - } - - /** - * Set the item index. - * - * @param int $index - * - * @return AcceptHeaderItem - */ - public function setIndex($index) - { - $this->index = $index; - - return $this; - } - - /** - * Returns the item index. - * - * @return int - */ - public function getIndex() - { - return $this->index; - } - - /** - * Tests if an attribute exists. - * - * @param string $name - * - * @return bool - */ - public function hasAttribute($name) - { - return isset($this->attributes[$name]); - } - - /** - * Returns an attribute by its name. - * - * @param string $name - * @param mixed $default - * - * @return mixed - */ - public function getAttribute($name, $default = null) - { - return isset($this->attributes[$name]) ? $this->attributes[$name] : $default; - } - - /** - * Returns all attributes. - * - * @return array - */ - public function getAttributes() - { - return $this->attributes; - } - - /** - * Set an attribute. - * - * @param string $name - * @param string $value - * - * @return AcceptHeaderItem - */ - public function setAttribute($name, $value) - { - if ('q' === $name) { - $this->quality = (float) $value; - } else { - $this->attributes[$name] = (string) $value; - } - - return $this; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-foundation/ApacheRequest.php b/sitecake/2.2.9/server/vendor/symfony/http-foundation/ApacheRequest.php deleted file mode 100644 index 84803eb..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-foundation/ApacheRequest.php +++ /dev/null @@ -1,43 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation; - -/** - * Request represents an HTTP request from an Apache server. - * - * @author Fabien Potencier - */ -class ApacheRequest extends Request -{ - /** - * {@inheritdoc} - */ - protected function prepareRequestUri() - { - return $this->server->get('REQUEST_URI'); - } - - /** - * {@inheritdoc} - */ - protected function prepareBaseUrl() - { - $baseUrl = $this->server->get('SCRIPT_NAME'); - - if (false === strpos($this->server->get('REQUEST_URI'), $baseUrl)) { - // assume mod_rewrite - return rtrim(dirname($baseUrl), '/\\'); - } - - return $baseUrl; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-foundation/BinaryFileResponse.php b/sitecake/2.2.9/server/vendor/symfony/http-foundation/BinaryFileResponse.php deleted file mode 100644 index ac41c8f..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-foundation/BinaryFileResponse.php +++ /dev/null @@ -1,321 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation; - -use Symfony\Component\HttpFoundation\File\File; -use Symfony\Component\HttpFoundation\File\Exception\FileException; - -/** - * BinaryFileResponse represents an HTTP response delivering a file. - * - * @author Niklas Fiekas - * @author stealth35 - * @author Igor Wiedler - * @author Jordan Alliot - * @author Sergey Linnik - */ -class BinaryFileResponse extends Response -{ - protected static $trustXSendfileTypeHeader = false; - - protected $file; - protected $offset; - protected $maxlen; - protected $deleteFileAfterSend = false; - - /** - * Constructor. - * - * @param \SplFileInfo|string $file The file to stream - * @param int $status The response status code - * @param array $headers An array of response headers - * @param bool $public Files are public by default - * @param null|string $contentDisposition The type of Content-Disposition to set automatically with the filename - * @param bool $autoEtag Whether the ETag header should be automatically set - * @param bool $autoLastModified Whether the Last-Modified header should be automatically set - */ - public function __construct($file, $status = 200, $headers = array(), $public = true, $contentDisposition = null, $autoEtag = false, $autoLastModified = true) - { - parent::__construct(null, $status, $headers); - - $this->setFile($file, $contentDisposition, $autoEtag, $autoLastModified); - - if ($public) { - $this->setPublic(); - } - } - - /** - * @param \SplFileInfo|string $file The file to stream - * @param int $status The response status code - * @param array $headers An array of response headers - * @param bool $public Files are public by default - * @param null|string $contentDisposition The type of Content-Disposition to set automatically with the filename - * @param bool $autoEtag Whether the ETag header should be automatically set - * @param bool $autoLastModified Whether the Last-Modified header should be automatically set - * - * @return BinaryFileResponse The created response - */ - public static function create($file = null, $status = 200, $headers = array(), $public = true, $contentDisposition = null, $autoEtag = false, $autoLastModified = true) - { - return new static($file, $status, $headers, $public, $contentDisposition, $autoEtag, $autoLastModified); - } - - /** - * Sets the file to stream. - * - * @param \SplFileInfo|string $file The file to stream - * @param string $contentDisposition - * @param bool $autoEtag - * @param bool $autoLastModified - * - * @return BinaryFileResponse - * - * @throws FileException - */ - public function setFile($file, $contentDisposition = null, $autoEtag = false, $autoLastModified = true) - { - if (!$file instanceof File) { - if ($file instanceof \SplFileInfo) { - $file = new File($file->getPathname()); - } else { - $file = new File((string) $file); - } - } - - if (!$file->isReadable()) { - throw new FileException('File must be readable.'); - } - - $this->file = $file; - - if ($autoEtag) { - $this->setAutoEtag(); - } - - if ($autoLastModified) { - $this->setAutoLastModified(); - } - - if ($contentDisposition) { - $this->setContentDisposition($contentDisposition); - } - - return $this; - } - - /** - * Gets the file. - * - * @return File The file to stream - */ - public function getFile() - { - return $this->file; - } - - /** - * Automatically sets the Last-Modified header according the file modification date. - */ - public function setAutoLastModified() - { - $this->setLastModified(\DateTime::createFromFormat('U', $this->file->getMTime())); - - return $this; - } - - /** - * Automatically sets the ETag header according to the checksum of the file. - */ - public function setAutoEtag() - { - $this->setEtag(sha1_file($this->file->getPathname())); - - return $this; - } - - /** - * Sets the Content-Disposition header with the given filename. - * - * @param string $disposition ResponseHeaderBag::DISPOSITION_INLINE or ResponseHeaderBag::DISPOSITION_ATTACHMENT - * @param string $filename Optionally use this filename instead of the real name of the file - * @param string $filenameFallback A fallback filename, containing only ASCII characters. Defaults to an automatically encoded filename - * - * @return BinaryFileResponse - */ - public function setContentDisposition($disposition, $filename = '', $filenameFallback = '') - { - if ($filename === '') { - $filename = $this->file->getFilename(); - } - - $dispositionHeader = $this->headers->makeDisposition($disposition, $filename, $filenameFallback); - $this->headers->set('Content-Disposition', $dispositionHeader); - - return $this; - } - - /** - * {@inheritdoc} - */ - public function prepare(Request $request) - { - $this->headers->set('Content-Length', $this->file->getSize()); - - if (!$this->headers->has('Accept-Ranges')) { - // Only accept ranges on safe HTTP methods - $this->headers->set('Accept-Ranges', $request->isMethodSafe() ? 'bytes' : 'none'); - } - - if (!$this->headers->has('Content-Type')) { - $this->headers->set('Content-Type', $this->file->getMimeType() ?: 'application/octet-stream'); - } - - if ('HTTP/1.0' != $request->server->get('SERVER_PROTOCOL')) { - $this->setProtocolVersion('1.1'); - } - - $this->ensureIEOverSSLCompatibility($request); - - $this->offset = 0; - $this->maxlen = -1; - - if (self::$trustXSendfileTypeHeader && $request->headers->has('X-Sendfile-Type')) { - // Use X-Sendfile, do not send any content. - $type = $request->headers->get('X-Sendfile-Type'); - $path = $this->file->getRealPath(); - if (strtolower($type) == 'x-accel-redirect') { - // Do X-Accel-Mapping substitutions. - // @link http://wiki.nginx.org/X-accel#X-Accel-Redirect - foreach (explode(',', $request->headers->get('X-Accel-Mapping', '')) as $mapping) { - $mapping = explode('=', $mapping, 2); - - if (2 == count($mapping)) { - $pathPrefix = trim($mapping[0]); - $location = trim($mapping[1]); - - if (substr($path, 0, strlen($pathPrefix)) == $pathPrefix) { - $path = $location.substr($path, strlen($pathPrefix)); - break; - } - } - } - } - $this->headers->set($type, $path); - $this->maxlen = 0; - } elseif ($request->headers->has('Range')) { - // Process the range headers. - if (!$request->headers->has('If-Range') || $this->getEtag() == $request->headers->get('If-Range')) { - $range = $request->headers->get('Range'); - $fileSize = $this->file->getSize(); - - list($start, $end) = explode('-', substr($range, 6), 2) + array(0); - - $end = ('' === $end) ? $fileSize - 1 : (int) $end; - - if ('' === $start) { - $start = $fileSize - $end; - $end = $fileSize - 1; - } else { - $start = (int) $start; - } - - if ($start <= $end) { - if ($start < 0 || $end > $fileSize - 1) { - $this->setStatusCode(416); - } elseif ($start !== 0 || $end !== $fileSize - 1) { - $this->maxlen = $end < $fileSize ? $end - $start + 1 : -1; - $this->offset = $start; - - $this->setStatusCode(206); - $this->headers->set('Content-Range', sprintf('bytes %s-%s/%s', $start, $end, $fileSize)); - $this->headers->set('Content-Length', $end - $start + 1); - } - } - } - } - - return $this; - } - - /** - * Sends the file. - */ - public function sendContent() - { - if (!$this->isSuccessful()) { - parent::sendContent(); - - return; - } - - if (0 === $this->maxlen) { - return; - } - - $out = fopen('php://output', 'wb'); - $file = fopen($this->file->getPathname(), 'rb'); - - stream_copy_to_stream($file, $out, $this->maxlen, $this->offset); - - fclose($out); - fclose($file); - - if ($this->deleteFileAfterSend) { - unlink($this->file->getPathname()); - } - } - - /** - * {@inheritdoc} - * - * @throws \LogicException when the content is not null - */ - public function setContent($content) - { - if (null !== $content) { - throw new \LogicException('The content cannot be set on a BinaryFileResponse instance.'); - } - } - - /** - * {@inheritdoc} - * - * @return false - */ - public function getContent() - { - return false; - } - - /** - * Trust X-Sendfile-Type header. - */ - public static function trustXSendfileTypeHeader() - { - self::$trustXSendfileTypeHeader = true; - } - - /** - * If this is set to true, the file will be unlinked after the request is send - * Note: If the X-Sendfile header is used, the deleteFileAfterSend setting will not be used. - * @param bool $shouldDelete - * - * @return BinaryFileResponse - */ - public function deleteFileAfterSend($shouldDelete) - { - $this->deleteFileAfterSend = $shouldDelete; - - return $this; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-foundation/CHANGELOG.md b/sitecake/2.2.9/server/vendor/symfony/http-foundation/CHANGELOG.md deleted file mode 100644 index dcdeb4e..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-foundation/CHANGELOG.md +++ /dev/null @@ -1,122 +0,0 @@ -CHANGELOG -========= - -2.6.0 ------ - - * PdoSessionHandler changes - - implemented different session locking strategies to prevent loss of data by concurrent access to the same session - - [BC BREAK] save session data in a binary column without base64_encode - - [BC BREAK] added lifetime column to the session table which allows to have different lifetimes for each session - - implemented lazy connections that are only opened when a session is used by either passing a dsn string - explicitly or falling back to session.save_path ini setting - - added a createTable method that initializes a correctly defined table depending on the database vendor - -2.5.0 ------ - - * added `JsonResponse::setEncodingOptions()` & `JsonResponse::getEncodingOptions()` for easier manipulation - of the options used while encoding data to JSON format. - -2.4.0 ------ - - * added RequestStack - * added Request::getEncodings() - * added accessors methods to session handlers - -2.3.0 ------ - - * added support for ranges of IPs in trusted proxies - * `UploadedFile::isValid` now returns false if the file was not uploaded via HTTP (in a non-test mode) - * Improved error-handling of `\Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler` - to ensure the supplied PDO handler throws Exceptions on error (as the class expects). Added related test cases - to verify that Exceptions are properly thrown when the PDO queries fail. - -2.2.0 ------ - - * fixed the Request::create() precedence (URI information always take precedence now) - * added Request::getTrustedProxies() - * deprecated Request::isProxyTrusted() - * [BC BREAK] JsonResponse does not turn a top level empty array to an object anymore, use an ArrayObject to enforce objects - * added a IpUtils class to check if an IP belongs to a CIDR - * added Request::getRealMethod() to get the "real" HTTP method (getMethod() returns the "intended" HTTP method) - * disabled _method request parameter support by default (call Request::enableHttpMethodParameterOverride() to - enable it, and Request::getHttpMethodParameterOverride() to check if it is supported) - * Request::splitHttpAcceptHeader() method is deprecated and will be removed in 2.3 - * Deprecated Flashbag::count() and \Countable interface, will be removed in 2.3 - -2.1.0 ------ - - * added Request::getSchemeAndHttpHost() and Request::getUserInfo() - * added a fluent interface to the Response class - * added Request::isProxyTrusted() - * added JsonResponse - * added a getTargetUrl method to RedirectResponse - * added support for streamed responses - * made Response::prepare() method the place to enforce HTTP specification - * [BC BREAK] moved management of the locale from the Session class to the Request class - * added a generic access to the PHP built-in filter mechanism: ParameterBag::filter() - * made FileBinaryMimeTypeGuesser command configurable - * added Request::getUser() and Request::getPassword() - * added support for the PATCH method in Request - * removed the ContentTypeMimeTypeGuesser class as it is deprecated and never used on PHP 5.3 - * added ResponseHeaderBag::makeDisposition() (implements RFC 6266) - * made mimetype to extension conversion configurable - * [BC BREAK] Moved all session related classes and interfaces into own namespace, as - `Symfony\Component\HttpFoundation\Session` and renamed classes accordingly. - Session handlers are located in the subnamespace `Symfony\Component\HttpFoundation\Session\Handler`. - * SessionHandlers must implement `\SessionHandlerInterface` or extend from the - `Symfony\Component\HttpFoundation\Storage\Handler\NativeSessionHandler` base class. - * Added internal storage driver proxy mechanism for forward compatibility with - PHP 5.4 `\SessionHandler` class. - * Added session handlers for custom Memcache, Memcached and Null session save handlers. - * [BC BREAK] Removed `NativeSessionStorage` and replaced with `NativeFileSessionHandler`. - * [BC BREAK] `SessionStorageInterface` methods removed: `write()`, `read()` and - `remove()`. Added `getBag()`, `registerBag()`. The `NativeSessionStorage` class - is a mediator for the session storage internals including the session handlers - which do the real work of participating in the internal PHP session workflow. - * [BC BREAK] Introduced mock implementations of `SessionStorage` to enable unit - and functional testing without starting real PHP sessions. Removed - `ArraySessionStorage`, and replaced with `MockArraySessionStorage` for unit - tests; removed `FilesystemSessionStorage`, and replaced with`MockFileSessionStorage` - for functional tests. These do not interact with global session ini - configuration values, session functions or `$_SESSION` superglobal. This means - they can be configured directly allowing multiple instances to work without - conflicting in the same PHP process. - * [BC BREAK] Removed the `close()` method from the `Session` class, as this is - now redundant. - * Deprecated the following methods from the Session class: `setFlash()`, `setFlashes()` - `getFlash()`, `hasFlash()`, and `removeFlash()`. Use `getFlashBag()` instead - which returns a `FlashBagInterface`. - * `Session->clear()` now only clears session attributes as before it cleared - flash messages and attributes. `Session->getFlashBag()->all()` clears flashes now. - * Session data is now managed by `SessionBagInterface` to better encapsulate - session data. - * Refactored session attribute and flash messages system to their own - `SessionBagInterface` implementations. - * Added `FlashBag`. Flashes expire when retrieved by `get()` or `all()`. This - implementation is ESI compatible. - * Added `AutoExpireFlashBag` (default) to replicate Symfony 2.0.x auto expire - behaviour of messages auto expiring after one page page load. Messages must - be retrieved by `get()` or `all()`. - * Added `Symfony\Component\HttpFoundation\Attribute\AttributeBag` to replicate - attributes storage behaviour from 2.0.x (default). - * Added `Symfony\Component\HttpFoundation\Attribute\NamespacedAttributeBag` for - namespace session attributes. - * Flash API can stores messages in an array so there may be multiple messages - per flash type. The old `Session` class API remains without BC break as it - will allow single messages as before. - * Added basic session meta-data to the session to record session create time, - last updated time, and the lifetime of the session cookie that was provided - to the client. - * Request::getClientIp() method doesn't take a parameter anymore but bases - itself on the trustProxy parameter. - * Added isMethod() to Request object. - * [BC BREAK] The methods `getPathInfo()`, `getBaseUrl()` and `getBasePath()` of - a `Request` now all return a raw value (vs a urldecoded value before). Any call - to one of these methods must be checked and wrapped in a `rawurldecode()` if - needed. diff --git a/sitecake/2.2.9/server/vendor/symfony/http-foundation/Cookie.php b/sitecake/2.2.9/server/vendor/symfony/http-foundation/Cookie.php deleted file mode 100644 index 466d020..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-foundation/Cookie.php +++ /dev/null @@ -1,210 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation; - -/** - * Represents a cookie. - * - * @author Johannes M. Schmitt - * - * @api - */ -class Cookie -{ - protected $name; - protected $value; - protected $domain; - protected $expire; - protected $path; - protected $secure; - protected $httpOnly; - - /** - * Constructor. - * - * @param string $name The name of the cookie - * @param string $value The value of the cookie - * @param int|string|\DateTime $expire The time the cookie expires - * @param string $path The path on the server in which the cookie will be available on - * @param string $domain The domain that the cookie is available to - * @param bool $secure Whether the cookie should only be transmitted over a secure HTTPS connection from the client - * @param bool $httpOnly Whether the cookie will be made accessible only through the HTTP protocol - * - * @throws \InvalidArgumentException - * - * @api - */ - public function __construct($name, $value = null, $expire = 0, $path = '/', $domain = null, $secure = false, $httpOnly = true) - { - // from PHP source code - if (preg_match("/[=,; \t\r\n\013\014]/", $name)) { - throw new \InvalidArgumentException(sprintf('The cookie name "%s" contains invalid characters.', $name)); - } - - if (empty($name)) { - throw new \InvalidArgumentException('The cookie name cannot be empty.'); - } - - // convert expiration time to a Unix timestamp - if ($expire instanceof \DateTime) { - $expire = $expire->format('U'); - } elseif (!is_numeric($expire)) { - $expire = strtotime($expire); - - if (false === $expire || -1 === $expire) { - throw new \InvalidArgumentException('The cookie expiration time is not valid.'); - } - } - - $this->name = $name; - $this->value = $value; - $this->domain = $domain; - $this->expire = $expire; - $this->path = empty($path) ? '/' : $path; - $this->secure = (bool) $secure; - $this->httpOnly = (bool) $httpOnly; - } - - /** - * Returns the cookie as a string. - * - * @return string The cookie - */ - public function __toString() - { - $str = urlencode($this->getName()).'='; - - if ('' === (string) $this->getValue()) { - $str .= 'deleted; expires='.gmdate('D, d-M-Y H:i:s T', time() - 31536001); - } else { - $str .= urlencode($this->getValue()); - - if ($this->getExpiresTime() !== 0) { - $str .= '; expires='.gmdate('D, d-M-Y H:i:s T', $this->getExpiresTime()); - } - } - - if ($this->path) { - $str .= '; path='.$this->path; - } - - if ($this->getDomain()) { - $str .= '; domain='.$this->getDomain(); - } - - if (true === $this->isSecure()) { - $str .= '; secure'; - } - - if (true === $this->isHttpOnly()) { - $str .= '; httponly'; - } - - return $str; - } - - /** - * Gets the name of the cookie. - * - * @return string - * - * @api - */ - public function getName() - { - return $this->name; - } - - /** - * Gets the value of the cookie. - * - * @return string - * - * @api - */ - public function getValue() - { - return $this->value; - } - - /** - * Gets the domain that the cookie is available to. - * - * @return string - * - * @api - */ - public function getDomain() - { - return $this->domain; - } - - /** - * Gets the time the cookie expires. - * - * @return int - * - * @api - */ - public function getExpiresTime() - { - return $this->expire; - } - - /** - * Gets the path on the server in which the cookie will be available on. - * - * @return string - * - * @api - */ - public function getPath() - { - return $this->path; - } - - /** - * Checks whether the cookie should only be transmitted over a secure HTTPS connection from the client. - * - * @return bool - * - * @api - */ - public function isSecure() - { - return $this->secure; - } - - /** - * Checks whether the cookie will be made accessible only through the HTTP protocol. - * - * @return bool - * - * @api - */ - public function isHttpOnly() - { - return $this->httpOnly; - } - - /** - * Whether this cookie is about to be cleared. - * - * @return bool - * - * @api - */ - public function isCleared() - { - return $this->expire < time(); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-foundation/ExpressionRequestMatcher.php b/sitecake/2.2.9/server/vendor/symfony/http-foundation/ExpressionRequestMatcher.php deleted file mode 100644 index e9c8441..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-foundation/ExpressionRequestMatcher.php +++ /dev/null @@ -1,47 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation; - -use Symfony\Component\ExpressionLanguage\ExpressionLanguage; - -/** - * ExpressionRequestMatcher uses an expression to match a Request. - * - * @author Fabien Potencier - */ -class ExpressionRequestMatcher extends RequestMatcher -{ - private $language; - private $expression; - - public function setExpression(ExpressionLanguage $language, $expression) - { - $this->language = $language; - $this->expression = $expression; - } - - public function matches(Request $request) - { - if (!$this->language) { - throw new \LogicException('Unable to match the request as the expression language is not available.'); - } - - return $this->language->evaluate($this->expression, array( - 'request' => $request, - 'method' => $request->getMethod(), - 'path' => rawurldecode($request->getPathInfo()), - 'host' => $request->getHost(), - 'ip' => $request->getClientIp(), - 'attributes' => $request->attributes->all(), - )) && parent::matches($request); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-foundation/File/Exception/AccessDeniedException.php b/sitecake/2.2.9/server/vendor/symfony/http-foundation/File/Exception/AccessDeniedException.php deleted file mode 100644 index 41f7a46..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-foundation/File/Exception/AccessDeniedException.php +++ /dev/null @@ -1,30 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\File\Exception; - -/** - * Thrown when the access on a file was denied. - * - * @author Bernhard Schussek - */ -class AccessDeniedException extends FileException -{ - /** - * Constructor. - * - * @param string $path The path to the accessed file - */ - public function __construct($path) - { - parent::__construct(sprintf('The file %s could not be accessed', $path)); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-foundation/File/Exception/FileException.php b/sitecake/2.2.9/server/vendor/symfony/http-foundation/File/Exception/FileException.php deleted file mode 100644 index fad5133..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-foundation/File/Exception/FileException.php +++ /dev/null @@ -1,21 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\File\Exception; - -/** - * Thrown when an error occurred in the component File. - * - * @author Bernhard Schussek - */ -class FileException extends \RuntimeException -{ -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-foundation/File/Exception/FileNotFoundException.php b/sitecake/2.2.9/server/vendor/symfony/http-foundation/File/Exception/FileNotFoundException.php deleted file mode 100644 index ac90d40..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-foundation/File/Exception/FileNotFoundException.php +++ /dev/null @@ -1,30 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\File\Exception; - -/** - * Thrown when a file was not found. - * - * @author Bernhard Schussek - */ -class FileNotFoundException extends FileException -{ - /** - * Constructor. - * - * @param string $path The path to the file that was not found - */ - public function __construct($path) - { - parent::__construct(sprintf('The file "%s" does not exist', $path)); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-foundation/File/Exception/UnexpectedTypeException.php b/sitecake/2.2.9/server/vendor/symfony/http-foundation/File/Exception/UnexpectedTypeException.php deleted file mode 100644 index 0444b87..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-foundation/File/Exception/UnexpectedTypeException.php +++ /dev/null @@ -1,20 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\File\Exception; - -class UnexpectedTypeException extends FileException -{ - public function __construct($value, $expectedType) - { - parent::__construct(sprintf('Expected argument of type %s, %s given', $expectedType, is_object($value) ? get_class($value) : gettype($value))); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-foundation/File/Exception/UploadException.php b/sitecake/2.2.9/server/vendor/symfony/http-foundation/File/Exception/UploadException.php deleted file mode 100644 index 7074e76..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-foundation/File/Exception/UploadException.php +++ /dev/null @@ -1,21 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\File\Exception; - -/** - * Thrown when an error occurred during file upload. - * - * @author Bernhard Schussek - */ -class UploadException extends FileException -{ -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-foundation/File/File.php b/sitecake/2.2.9/server/vendor/symfony/http-foundation/File/File.php deleted file mode 100644 index b575c85..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-foundation/File/File.php +++ /dev/null @@ -1,146 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\File; - -use Symfony\Component\HttpFoundation\File\Exception\FileException; -use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException; -use Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesser; -use Symfony\Component\HttpFoundation\File\MimeType\ExtensionGuesser; - -/** - * A file in the file system. - * - * @author Bernhard Schussek - * - * @api - */ -class File extends \SplFileInfo -{ - /** - * Constructs a new file from the given path. - * - * @param string $path The path to the file - * @param bool $checkPath Whether to check the path or not - * - * @throws FileNotFoundException If the given path is not a file - * - * @api - */ - public function __construct($path, $checkPath = true) - { - if ($checkPath && !is_file($path)) { - throw new FileNotFoundException($path); - } - - parent::__construct($path); - } - - /** - * Returns the extension based on the mime type. - * - * If the mime type is unknown, returns null. - * - * This method uses the mime type as guessed by getMimeType() - * to guess the file extension. - * - * @return string|null The guessed extension or null if it cannot be guessed - * - * @api - * - * @see ExtensionGuesser - * @see getMimeType() - */ - public function guessExtension() - { - $type = $this->getMimeType(); - $guesser = ExtensionGuesser::getInstance(); - - return $guesser->guess($type); - } - - /** - * Returns the mime type of the file. - * - * The mime type is guessed using a MimeTypeGuesser instance, which uses finfo(), - * mime_content_type() and the system binary "file" (in this order), depending on - * which of those are available. - * - * @return string|null The guessed mime type (i.e. "application/pdf") - * - * @see MimeTypeGuesser - * - * @api - */ - public function getMimeType() - { - $guesser = MimeTypeGuesser::getInstance(); - - return $guesser->guess($this->getPathname()); - } - - /** - * Moves the file to a new location. - * - * @param string $directory The destination folder - * @param string $name The new file name - * - * @return File A File object representing the new file - * - * @throws FileException if the target file could not be created - * - * @api - */ - public function move($directory, $name = null) - { - $target = $this->getTargetFile($directory, $name); - - if (!@rename($this->getPathname(), $target)) { - $error = error_get_last(); - throw new FileException(sprintf('Could not move the file "%s" to "%s" (%s)', $this->getPathname(), $target, strip_tags($error['message']))); - } - - @chmod($target, 0666 & ~umask()); - - return $target; - } - - protected function getTargetFile($directory, $name = null) - { - if (!is_dir($directory)) { - if (false === @mkdir($directory, 0777, true) && !is_dir($directory)) { - throw new FileException(sprintf('Unable to create the "%s" directory', $directory)); - } - } elseif (!is_writable($directory)) { - throw new FileException(sprintf('Unable to write in the "%s" directory', $directory)); - } - - $target = rtrim($directory, '/\\').DIRECTORY_SEPARATOR.(null === $name ? $this->getBasename() : $this->getName($name)); - - return new self($target, false); - } - - /** - * Returns locale independent base name of the given path. - * - * @param string $name The new file name - * - * @return string containing - */ - protected function getName($name) - { - $originalName = str_replace('\\', '/', $name); - $pos = strrpos($originalName, '/'); - $originalName = false === $pos ? $originalName : substr($originalName, $pos + 1); - - return $originalName; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-foundation/File/MimeType/ExtensionGuesser.php b/sitecake/2.2.9/server/vendor/symfony/http-foundation/File/MimeType/ExtensionGuesser.php deleted file mode 100644 index ec9b78a..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-foundation/File/MimeType/ExtensionGuesser.php +++ /dev/null @@ -1,96 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\File\MimeType; - -/** - * A singleton mime type to file extension guesser. - * - * A default guesser is provided. - * You can register custom guessers by calling the register() - * method on the singleton instance: - * - * $guesser = ExtensionGuesser::getInstance(); - * $guesser->register(new MyCustomExtensionGuesser()); - * - * The last registered guesser is preferred over previously registered ones. - */ -class ExtensionGuesser implements ExtensionGuesserInterface -{ - /** - * The singleton instance. - * - * @var ExtensionGuesser - */ - private static $instance = null; - - /** - * All registered ExtensionGuesserInterface instances. - * - * @var array - */ - protected $guessers = array(); - - /** - * Returns the singleton instance. - * - * @return ExtensionGuesser - */ - public static function getInstance() - { - if (null === self::$instance) { - self::$instance = new self(); - } - - return self::$instance; - } - - /** - * Registers all natively provided extension guessers. - */ - private function __construct() - { - $this->register(new MimeTypeExtensionGuesser()); - } - - /** - * Registers a new extension guesser. - * - * When guessing, this guesser is preferred over previously registered ones. - * - * @param ExtensionGuesserInterface $guesser - */ - public function register(ExtensionGuesserInterface $guesser) - { - array_unshift($this->guessers, $guesser); - } - - /** - * Tries to guess the extension. - * - * The mime type is passed to each registered mime type guesser in reverse order - * of their registration (last registered is queried first). Once a guesser - * returns a value that is not NULL, this method terminates and returns the - * value. - * - * @param string $mimeType The mime type - * - * @return string The guessed extension or NULL, if none could be guessed - */ - public function guess($mimeType) - { - foreach ($this->guessers as $guesser) { - if (null !== $extension = $guesser->guess($mimeType)) { - return $extension; - } - } - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-foundation/File/MimeType/ExtensionGuesserInterface.php b/sitecake/2.2.9/server/vendor/symfony/http-foundation/File/MimeType/ExtensionGuesserInterface.php deleted file mode 100644 index d19a0e5..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-foundation/File/MimeType/ExtensionGuesserInterface.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\File\MimeType; - -/** - * Guesses the file extension corresponding to a given mime type. - */ -interface ExtensionGuesserInterface -{ - /** - * Makes a best guess for a file extension, given a mime type. - * - * @param string $mimeType The mime type - * - * @return string The guessed extension or NULL, if none could be guessed - */ - public function guess($mimeType); -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-foundation/File/MimeType/FileBinaryMimeTypeGuesser.php b/sitecake/2.2.9/server/vendor/symfony/http-foundation/File/MimeType/FileBinaryMimeTypeGuesser.php deleted file mode 100644 index f917a06..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-foundation/File/MimeType/FileBinaryMimeTypeGuesser.php +++ /dev/null @@ -1,87 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\File\MimeType; - -use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException; -use Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException; - -/** - * Guesses the mime type with the binary "file" (only available on *nix). - * - * @author Bernhard Schussek - */ -class FileBinaryMimeTypeGuesser implements MimeTypeGuesserInterface -{ - private $cmd; - - /** - * Constructor. - * - * The $cmd pattern must contain a "%s" string that will be replaced - * with the file name to guess. - * - * The command output must start with the mime type of the file. - * - * @param string $cmd The command to run to get the mime type of a file - */ - public function __construct($cmd = 'file -b --mime %s 2>/dev/null') - { - $this->cmd = $cmd; - } - - /** - * Returns whether this guesser is supported on the current OS. - * - * @return bool - */ - public static function isSupported() - { - return '\\' !== DIRECTORY_SEPARATOR && function_exists('passthru') && function_exists('escapeshellarg'); - } - - /** - * {@inheritdoc} - */ - public function guess($path) - { - if (!is_file($path)) { - throw new FileNotFoundException($path); - } - - if (!is_readable($path)) { - throw new AccessDeniedException($path); - } - - if (!self::isSupported()) { - return; - } - - ob_start(); - - // need to use --mime instead of -i. see #6641 - passthru(sprintf($this->cmd, escapeshellarg($path)), $return); - if ($return > 0) { - ob_end_clean(); - - return; - } - - $type = trim(ob_get_clean()); - - if (!preg_match('#^([a-z0-9\-]+/[a-z0-9\-\.]+)#i', $type, $match)) { - // it's not a type, but an error message - return; - } - - return $match[1]; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-foundation/File/MimeType/FileinfoMimeTypeGuesser.php b/sitecake/2.2.9/server/vendor/symfony/http-foundation/File/MimeType/FileinfoMimeTypeGuesser.php deleted file mode 100644 index a7e4ae2..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-foundation/File/MimeType/FileinfoMimeTypeGuesser.php +++ /dev/null @@ -1,71 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\File\MimeType; - -use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException; -use Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException; - -/** - * Guesses the mime type using the PECL extension FileInfo. - * - * @author Bernhard Schussek - */ -class FileinfoMimeTypeGuesser implements MimeTypeGuesserInterface -{ - private $magicFile; - - /** - * Constructor. - * - * @param string $magicFile A magic file to use with the finfo instance - * - * @link http://www.php.net/manual/en/function.finfo-open.php - */ - public function __construct($magicFile = null) - { - $this->magicFile = $magicFile; - } - - /** - * Returns whether this guesser is supported on the current OS/PHP setup. - * - * @return bool - */ - public static function isSupported() - { - return function_exists('finfo_open'); - } - - /** - * {@inheritdoc} - */ - public function guess($path) - { - if (!is_file($path)) { - throw new FileNotFoundException($path); - } - - if (!is_readable($path)) { - throw new AccessDeniedException($path); - } - - if (!self::isSupported()) { - return; - } - - if (!$finfo = new \finfo(FILEINFO_MIME_TYPE, $this->magicFile)) { - return; - } - - return $finfo->file($path); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-foundation/File/MimeType/MimeTypeExtensionGuesser.php b/sitecake/2.2.9/server/vendor/symfony/http-foundation/File/MimeType/MimeTypeExtensionGuesser.php deleted file mode 100644 index 75eeefb..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-foundation/File/MimeType/MimeTypeExtensionGuesser.php +++ /dev/null @@ -1,807 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\File\MimeType; - -/** - * Provides a best-guess mapping of mime type to file extension. - */ -class MimeTypeExtensionGuesser implements ExtensionGuesserInterface -{ - /** - * A map of mime types and their default extensions. - * - * This list has been placed under the public domain by the Apache HTTPD project. - * This list has been updated from upstream on 2013-04-23. - * - * @see http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types - * - * @var array - */ - protected $defaultExtensions = array( - 'application/andrew-inset' => 'ez', - 'application/applixware' => 'aw', - 'application/atom+xml' => 'atom', - 'application/atomcat+xml' => 'atomcat', - 'application/atomsvc+xml' => 'atomsvc', - 'application/ccxml+xml' => 'ccxml', - 'application/cdmi-capability' => 'cdmia', - 'application/cdmi-container' => 'cdmic', - 'application/cdmi-domain' => 'cdmid', - 'application/cdmi-object' => 'cdmio', - 'application/cdmi-queue' => 'cdmiq', - 'application/cu-seeme' => 'cu', - 'application/davmount+xml' => 'davmount', - 'application/docbook+xml' => 'dbk', - 'application/dssc+der' => 'dssc', - 'application/dssc+xml' => 'xdssc', - 'application/ecmascript' => 'ecma', - 'application/emma+xml' => 'emma', - 'application/epub+zip' => 'epub', - 'application/exi' => 'exi', - 'application/font-tdpfr' => 'pfr', - 'application/gml+xml' => 'gml', - 'application/gpx+xml' => 'gpx', - 'application/gxf' => 'gxf', - 'application/hyperstudio' => 'stk', - 'application/inkml+xml' => 'ink', - 'application/ipfix' => 'ipfix', - 'application/java-archive' => 'jar', - 'application/java-serialized-object' => 'ser', - 'application/java-vm' => 'class', - 'application/javascript' => 'js', - 'application/json' => 'json', - 'application/jsonml+json' => 'jsonml', - 'application/lost+xml' => 'lostxml', - 'application/mac-binhex40' => 'hqx', - 'application/mac-compactpro' => 'cpt', - 'application/mads+xml' => 'mads', - 'application/marc' => 'mrc', - 'application/marcxml+xml' => 'mrcx', - 'application/mathematica' => 'ma', - 'application/mathml+xml' => 'mathml', - 'application/mbox' => 'mbox', - 'application/mediaservercontrol+xml' => 'mscml', - 'application/metalink+xml' => 'metalink', - 'application/metalink4+xml' => 'meta4', - 'application/mets+xml' => 'mets', - 'application/mods+xml' => 'mods', - 'application/mp21' => 'm21', - 'application/mp4' => 'mp4s', - 'application/msword' => 'doc', - 'application/mxf' => 'mxf', - 'application/octet-stream' => 'bin', - 'application/oda' => 'oda', - 'application/oebps-package+xml' => 'opf', - 'application/ogg' => 'ogx', - 'application/omdoc+xml' => 'omdoc', - 'application/onenote' => 'onetoc', - 'application/oxps' => 'oxps', - 'application/patch-ops-error+xml' => 'xer', - 'application/pdf' => 'pdf', - 'application/pgp-encrypted' => 'pgp', - 'application/pgp-signature' => 'asc', - 'application/pics-rules' => 'prf', - 'application/pkcs10' => 'p10', - 'application/pkcs7-mime' => 'p7m', - 'application/pkcs7-signature' => 'p7s', - 'application/pkcs8' => 'p8', - 'application/pkix-attr-cert' => 'ac', - 'application/pkix-cert' => 'cer', - 'application/pkix-crl' => 'crl', - 'application/pkix-pkipath' => 'pkipath', - 'application/pkixcmp' => 'pki', - 'application/pls+xml' => 'pls', - 'application/postscript' => 'ai', - 'application/prs.cww' => 'cww', - 'application/pskc+xml' => 'pskcxml', - 'application/rdf+xml' => 'rdf', - 'application/reginfo+xml' => 'rif', - 'application/relax-ng-compact-syntax' => 'rnc', - 'application/resource-lists+xml' => 'rl', - 'application/resource-lists-diff+xml' => 'rld', - 'application/rls-services+xml' => 'rs', - 'application/rpki-ghostbusters' => 'gbr', - 'application/rpki-manifest' => 'mft', - 'application/rpki-roa' => 'roa', - 'application/rsd+xml' => 'rsd', - 'application/rss+xml' => 'rss', - 'application/rtf' => 'rtf', - 'application/sbml+xml' => 'sbml', - 'application/scvp-cv-request' => 'scq', - 'application/scvp-cv-response' => 'scs', - 'application/scvp-vp-request' => 'spq', - 'application/scvp-vp-response' => 'spp', - 'application/sdp' => 'sdp', - 'application/set-payment-initiation' => 'setpay', - 'application/set-registration-initiation' => 'setreg', - 'application/shf+xml' => 'shf', - 'application/smil+xml' => 'smi', - 'application/sparql-query' => 'rq', - 'application/sparql-results+xml' => 'srx', - 'application/srgs' => 'gram', - 'application/srgs+xml' => 'grxml', - 'application/sru+xml' => 'sru', - 'application/ssdl+xml' => 'ssdl', - 'application/ssml+xml' => 'ssml', - 'application/tei+xml' => 'tei', - 'application/thraud+xml' => 'tfi', - 'application/timestamped-data' => 'tsd', - 'application/vnd.3gpp.pic-bw-large' => 'plb', - 'application/vnd.3gpp.pic-bw-small' => 'psb', - 'application/vnd.3gpp.pic-bw-var' => 'pvb', - 'application/vnd.3gpp2.tcap' => 'tcap', - 'application/vnd.3m.post-it-notes' => 'pwn', - 'application/vnd.accpac.simply.aso' => 'aso', - 'application/vnd.accpac.simply.imp' => 'imp', - 'application/vnd.acucobol' => 'acu', - 'application/vnd.acucorp' => 'atc', - 'application/vnd.adobe.air-application-installer-package+zip' => 'air', - 'application/vnd.adobe.formscentral.fcdt' => 'fcdt', - 'application/vnd.adobe.fxp' => 'fxp', - 'application/vnd.adobe.xdp+xml' => 'xdp', - 'application/vnd.adobe.xfdf' => 'xfdf', - 'application/vnd.ahead.space' => 'ahead', - 'application/vnd.airzip.filesecure.azf' => 'azf', - 'application/vnd.airzip.filesecure.azs' => 'azs', - 'application/vnd.amazon.ebook' => 'azw', - 'application/vnd.americandynamics.acc' => 'acc', - 'application/vnd.amiga.ami' => 'ami', - 'application/vnd.android.package-archive' => 'apk', - 'application/vnd.anser-web-certificate-issue-initiation' => 'cii', - 'application/vnd.anser-web-funds-transfer-initiation' => 'fti', - 'application/vnd.antix.game-component' => 'atx', - 'application/vnd.apple.installer+xml' => 'mpkg', - 'application/vnd.apple.mpegurl' => 'm3u8', - 'application/vnd.aristanetworks.swi' => 'swi', - 'application/vnd.astraea-software.iota' => 'iota', - 'application/vnd.audiograph' => 'aep', - 'application/vnd.blueice.multipass' => 'mpm', - 'application/vnd.bmi' => 'bmi', - 'application/vnd.businessobjects' => 'rep', - 'application/vnd.chemdraw+xml' => 'cdxml', - 'application/vnd.chipnuts.karaoke-mmd' => 'mmd', - 'application/vnd.cinderella' => 'cdy', - 'application/vnd.claymore' => 'cla', - 'application/vnd.cloanto.rp9' => 'rp9', - 'application/vnd.clonk.c4group' => 'c4g', - 'application/vnd.cluetrust.cartomobile-config' => 'c11amc', - 'application/vnd.cluetrust.cartomobile-config-pkg' => 'c11amz', - 'application/vnd.commonspace' => 'csp', - 'application/vnd.contact.cmsg' => 'cdbcmsg', - 'application/vnd.cosmocaller' => 'cmc', - 'application/vnd.crick.clicker' => 'clkx', - 'application/vnd.crick.clicker.keyboard' => 'clkk', - 'application/vnd.crick.clicker.palette' => 'clkp', - 'application/vnd.crick.clicker.template' => 'clkt', - 'application/vnd.crick.clicker.wordbank' => 'clkw', - 'application/vnd.criticaltools.wbs+xml' => 'wbs', - 'application/vnd.ctc-posml' => 'pml', - 'application/vnd.cups-ppd' => 'ppd', - 'application/vnd.curl.car' => 'car', - 'application/vnd.curl.pcurl' => 'pcurl', - 'application/vnd.dart' => 'dart', - 'application/vnd.data-vision.rdz' => 'rdz', - 'application/vnd.dece.data' => 'uvf', - 'application/vnd.dece.ttml+xml' => 'uvt', - 'application/vnd.dece.unspecified' => 'uvx', - 'application/vnd.dece.zip' => 'uvz', - 'application/vnd.denovo.fcselayout-link' => 'fe_launch', - 'application/vnd.dna' => 'dna', - 'application/vnd.dolby.mlp' => 'mlp', - 'application/vnd.dpgraph' => 'dpg', - 'application/vnd.dreamfactory' => 'dfac', - 'application/vnd.ds-keypoint' => 'kpxx', - 'application/vnd.dvb.ait' => 'ait', - 'application/vnd.dvb.service' => 'svc', - 'application/vnd.dynageo' => 'geo', - 'application/vnd.ecowin.chart' => 'mag', - 'application/vnd.enliven' => 'nml', - 'application/vnd.epson.esf' => 'esf', - 'application/vnd.epson.msf' => 'msf', - 'application/vnd.epson.quickanime' => 'qam', - 'application/vnd.epson.salt' => 'slt', - 'application/vnd.epson.ssf' => 'ssf', - 'application/vnd.eszigno3+xml' => 'es3', - 'application/vnd.ezpix-album' => 'ez2', - 'application/vnd.ezpix-package' => 'ez3', - 'application/vnd.fdf' => 'fdf', - 'application/vnd.fdsn.mseed' => 'mseed', - 'application/vnd.fdsn.seed' => 'seed', - 'application/vnd.flographit' => 'gph', - 'application/vnd.fluxtime.clip' => 'ftc', - 'application/vnd.framemaker' => 'fm', - 'application/vnd.frogans.fnc' => 'fnc', - 'application/vnd.frogans.ltf' => 'ltf', - 'application/vnd.fsc.weblaunch' => 'fsc', - 'application/vnd.fujitsu.oasys' => 'oas', - 'application/vnd.fujitsu.oasys2' => 'oa2', - 'application/vnd.fujitsu.oasys3' => 'oa3', - 'application/vnd.fujitsu.oasysgp' => 'fg5', - 'application/vnd.fujitsu.oasysprs' => 'bh2', - 'application/vnd.fujixerox.ddd' => 'ddd', - 'application/vnd.fujixerox.docuworks' => 'xdw', - 'application/vnd.fujixerox.docuworks.binder' => 'xbd', - 'application/vnd.fuzzysheet' => 'fzs', - 'application/vnd.genomatix.tuxedo' => 'txd', - 'application/vnd.geogebra.file' => 'ggb', - 'application/vnd.geogebra.tool' => 'ggt', - 'application/vnd.geometry-explorer' => 'gex', - 'application/vnd.geonext' => 'gxt', - 'application/vnd.geoplan' => 'g2w', - 'application/vnd.geospace' => 'g3w', - 'application/vnd.gmx' => 'gmx', - 'application/vnd.google-earth.kml+xml' => 'kml', - 'application/vnd.google-earth.kmz' => 'kmz', - 'application/vnd.grafeq' => 'gqf', - 'application/vnd.groove-account' => 'gac', - 'application/vnd.groove-help' => 'ghf', - 'application/vnd.groove-identity-message' => 'gim', - 'application/vnd.groove-injector' => 'grv', - 'application/vnd.groove-tool-message' => 'gtm', - 'application/vnd.groove-tool-template' => 'tpl', - 'application/vnd.groove-vcard' => 'vcg', - 'application/vnd.hal+xml' => 'hal', - 'application/vnd.handheld-entertainment+xml' => 'zmm', - 'application/vnd.hbci' => 'hbci', - 'application/vnd.hhe.lesson-player' => 'les', - 'application/vnd.hp-hpgl' => 'hpgl', - 'application/vnd.hp-hpid' => 'hpid', - 'application/vnd.hp-hps' => 'hps', - 'application/vnd.hp-jlyt' => 'jlt', - 'application/vnd.hp-pcl' => 'pcl', - 'application/vnd.hp-pclxl' => 'pclxl', - 'application/vnd.hydrostatix.sof-data' => 'sfd-hdstx', - 'application/vnd.ibm.minipay' => 'mpy', - 'application/vnd.ibm.modcap' => 'afp', - 'application/vnd.ibm.rights-management' => 'irm', - 'application/vnd.ibm.secure-container' => 'sc', - 'application/vnd.iccprofile' => 'icc', - 'application/vnd.igloader' => 'igl', - 'application/vnd.immervision-ivp' => 'ivp', - 'application/vnd.immervision-ivu' => 'ivu', - 'application/vnd.insors.igm' => 'igm', - 'application/vnd.intercon.formnet' => 'xpw', - 'application/vnd.intergeo' => 'i2g', - 'application/vnd.intu.qbo' => 'qbo', - 'application/vnd.intu.qfx' => 'qfx', - 'application/vnd.ipunplugged.rcprofile' => 'rcprofile', - 'application/vnd.irepository.package+xml' => 'irp', - 'application/vnd.is-xpr' => 'xpr', - 'application/vnd.isac.fcs' => 'fcs', - 'application/vnd.jam' => 'jam', - 'application/vnd.jcp.javame.midlet-rms' => 'rms', - 'application/vnd.jisp' => 'jisp', - 'application/vnd.joost.joda-archive' => 'joda', - 'application/vnd.kahootz' => 'ktz', - 'application/vnd.kde.karbon' => 'karbon', - 'application/vnd.kde.kchart' => 'chrt', - 'application/vnd.kde.kformula' => 'kfo', - 'application/vnd.kde.kivio' => 'flw', - 'application/vnd.kde.kontour' => 'kon', - 'application/vnd.kde.kpresenter' => 'kpr', - 'application/vnd.kde.kspread' => 'ksp', - 'application/vnd.kde.kword' => 'kwd', - 'application/vnd.kenameaapp' => 'htke', - 'application/vnd.kidspiration' => 'kia', - 'application/vnd.kinar' => 'kne', - 'application/vnd.koan' => 'skp', - 'application/vnd.kodak-descriptor' => 'sse', - 'application/vnd.las.las+xml' => 'lasxml', - 'application/vnd.llamagraphics.life-balance.desktop' => 'lbd', - 'application/vnd.llamagraphics.life-balance.exchange+xml' => 'lbe', - 'application/vnd.lotus-1-2-3' => '123', - 'application/vnd.lotus-approach' => 'apr', - 'application/vnd.lotus-freelance' => 'pre', - 'application/vnd.lotus-notes' => 'nsf', - 'application/vnd.lotus-organizer' => 'org', - 'application/vnd.lotus-screencam' => 'scm', - 'application/vnd.lotus-wordpro' => 'lwp', - 'application/vnd.macports.portpkg' => 'portpkg', - 'application/vnd.mcd' => 'mcd', - 'application/vnd.medcalcdata' => 'mc1', - 'application/vnd.mediastation.cdkey' => 'cdkey', - 'application/vnd.mfer' => 'mwf', - 'application/vnd.mfmp' => 'mfm', - 'application/vnd.micrografx.flo' => 'flo', - 'application/vnd.micrografx.igx' => 'igx', - 'application/vnd.mif' => 'mif', - 'application/vnd.mobius.daf' => 'daf', - 'application/vnd.mobius.dis' => 'dis', - 'application/vnd.mobius.mbk' => 'mbk', - 'application/vnd.mobius.mqy' => 'mqy', - 'application/vnd.mobius.msl' => 'msl', - 'application/vnd.mobius.plc' => 'plc', - 'application/vnd.mobius.txf' => 'txf', - 'application/vnd.mophun.application' => 'mpn', - 'application/vnd.mophun.certificate' => 'mpc', - 'application/vnd.mozilla.xul+xml' => 'xul', - 'application/vnd.ms-artgalry' => 'cil', - 'application/vnd.ms-cab-compressed' => 'cab', - 'application/vnd.ms-excel' => 'xls', - 'application/vnd.ms-excel.addin.macroenabled.12' => 'xlam', - 'application/vnd.ms-excel.sheet.binary.macroenabled.12' => 'xlsb', - 'application/vnd.ms-excel.sheet.macroenabled.12' => 'xlsm', - 'application/vnd.ms-excel.template.macroenabled.12' => 'xltm', - 'application/vnd.ms-fontobject' => 'eot', - 'application/vnd.ms-htmlhelp' => 'chm', - 'application/vnd.ms-ims' => 'ims', - 'application/vnd.ms-lrm' => 'lrm', - 'application/vnd.ms-officetheme' => 'thmx', - 'application/vnd.ms-pki.seccat' => 'cat', - 'application/vnd.ms-pki.stl' => 'stl', - 'application/vnd.ms-powerpoint' => 'ppt', - 'application/vnd.ms-powerpoint.addin.macroenabled.12' => 'ppam', - 'application/vnd.ms-powerpoint.presentation.macroenabled.12' => 'pptm', - 'application/vnd.ms-powerpoint.slide.macroenabled.12' => 'sldm', - 'application/vnd.ms-powerpoint.slideshow.macroenabled.12' => 'ppsm', - 'application/vnd.ms-powerpoint.template.macroenabled.12' => 'potm', - 'application/vnd.ms-project' => 'mpp', - 'application/vnd.ms-word.document.macroenabled.12' => 'docm', - 'application/vnd.ms-word.template.macroenabled.12' => 'dotm', - 'application/vnd.ms-works' => 'wps', - 'application/vnd.ms-wpl' => 'wpl', - 'application/vnd.ms-xpsdocument' => 'xps', - 'application/vnd.mseq' => 'mseq', - 'application/vnd.musician' => 'mus', - 'application/vnd.muvee.style' => 'msty', - 'application/vnd.mynfc' => 'taglet', - 'application/vnd.neurolanguage.nlu' => 'nlu', - 'application/vnd.nitf' => 'ntf', - 'application/vnd.noblenet-directory' => 'nnd', - 'application/vnd.noblenet-sealer' => 'nns', - 'application/vnd.noblenet-web' => 'nnw', - 'application/vnd.nokia.n-gage.data' => 'ngdat', - 'application/vnd.nokia.n-gage.symbian.install' => 'n-gage', - 'application/vnd.nokia.radio-preset' => 'rpst', - 'application/vnd.nokia.radio-presets' => 'rpss', - 'application/vnd.novadigm.edm' => 'edm', - 'application/vnd.novadigm.edx' => 'edx', - 'application/vnd.novadigm.ext' => 'ext', - 'application/vnd.oasis.opendocument.chart' => 'odc', - 'application/vnd.oasis.opendocument.chart-template' => 'otc', - 'application/vnd.oasis.opendocument.database' => 'odb', - 'application/vnd.oasis.opendocument.formula' => 'odf', - 'application/vnd.oasis.opendocument.formula-template' => 'odft', - 'application/vnd.oasis.opendocument.graphics' => 'odg', - 'application/vnd.oasis.opendocument.graphics-template' => 'otg', - 'application/vnd.oasis.opendocument.image' => 'odi', - 'application/vnd.oasis.opendocument.image-template' => 'oti', - 'application/vnd.oasis.opendocument.presentation' => 'odp', - 'application/vnd.oasis.opendocument.presentation-template' => 'otp', - 'application/vnd.oasis.opendocument.spreadsheet' => 'ods', - 'application/vnd.oasis.opendocument.spreadsheet-template' => 'ots', - 'application/vnd.oasis.opendocument.text' => 'odt', - 'application/vnd.oasis.opendocument.text-master' => 'odm', - 'application/vnd.oasis.opendocument.text-template' => 'ott', - 'application/vnd.oasis.opendocument.text-web' => 'oth', - 'application/vnd.olpc-sugar' => 'xo', - 'application/vnd.oma.dd2+xml' => 'dd2', - 'application/vnd.openofficeorg.extension' => 'oxt', - 'application/vnd.openxmlformats-officedocument.presentationml.presentation' => 'pptx', - 'application/vnd.openxmlformats-officedocument.presentationml.slide' => 'sldx', - 'application/vnd.openxmlformats-officedocument.presentationml.slideshow' => 'ppsx', - 'application/vnd.openxmlformats-officedocument.presentationml.template' => 'potx', - 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' => 'xlsx', - 'application/vnd.openxmlformats-officedocument.spreadsheetml.template' => 'xltx', - 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' => 'docx', - 'application/vnd.openxmlformats-officedocument.wordprocessingml.template' => 'dotx', - 'application/vnd.osgeo.mapguide.package' => 'mgp', - 'application/vnd.osgi.dp' => 'dp', - 'application/vnd.osgi.subsystem' => 'esa', - 'application/vnd.palm' => 'pdb', - 'application/vnd.pawaafile' => 'paw', - 'application/vnd.pg.format' => 'str', - 'application/vnd.pg.osasli' => 'ei6', - 'application/vnd.picsel' => 'efif', - 'application/vnd.pmi.widget' => 'wg', - 'application/vnd.pocketlearn' => 'plf', - 'application/vnd.powerbuilder6' => 'pbd', - 'application/vnd.previewsystems.box' => 'box', - 'application/vnd.proteus.magazine' => 'mgz', - 'application/vnd.publishare-delta-tree' => 'qps', - 'application/vnd.pvi.ptid1' => 'ptid', - 'application/vnd.quark.quarkxpress' => 'qxd', - 'application/vnd.realvnc.bed' => 'bed', - 'application/vnd.recordare.musicxml' => 'mxl', - 'application/vnd.recordare.musicxml+xml' => 'musicxml', - 'application/vnd.rig.cryptonote' => 'cryptonote', - 'application/vnd.rim.cod' => 'cod', - 'application/vnd.rn-realmedia' => 'rm', - 'application/vnd.rn-realmedia-vbr' => 'rmvb', - 'application/vnd.route66.link66+xml' => 'link66', - 'application/vnd.sailingtracker.track' => 'st', - 'application/vnd.seemail' => 'see', - 'application/vnd.sema' => 'sema', - 'application/vnd.semd' => 'semd', - 'application/vnd.semf' => 'semf', - 'application/vnd.shana.informed.formdata' => 'ifm', - 'application/vnd.shana.informed.formtemplate' => 'itp', - 'application/vnd.shana.informed.interchange' => 'iif', - 'application/vnd.shana.informed.package' => 'ipk', - 'application/vnd.simtech-mindmapper' => 'twd', - 'application/vnd.smaf' => 'mmf', - 'application/vnd.smart.teacher' => 'teacher', - 'application/vnd.solent.sdkm+xml' => 'sdkm', - 'application/vnd.spotfire.dxp' => 'dxp', - 'application/vnd.spotfire.sfs' => 'sfs', - 'application/vnd.stardivision.calc' => 'sdc', - 'application/vnd.stardivision.draw' => 'sda', - 'application/vnd.stardivision.impress' => 'sdd', - 'application/vnd.stardivision.math' => 'smf', - 'application/vnd.stardivision.writer' => 'sdw', - 'application/vnd.stardivision.writer-global' => 'sgl', - 'application/vnd.stepmania.package' => 'smzip', - 'application/vnd.stepmania.stepchart' => 'sm', - 'application/vnd.sun.xml.calc' => 'sxc', - 'application/vnd.sun.xml.calc.template' => 'stc', - 'application/vnd.sun.xml.draw' => 'sxd', - 'application/vnd.sun.xml.draw.template' => 'std', - 'application/vnd.sun.xml.impress' => 'sxi', - 'application/vnd.sun.xml.impress.template' => 'sti', - 'application/vnd.sun.xml.math' => 'sxm', - 'application/vnd.sun.xml.writer' => 'sxw', - 'application/vnd.sun.xml.writer.global' => 'sxg', - 'application/vnd.sun.xml.writer.template' => 'stw', - 'application/vnd.sus-calendar' => 'sus', - 'application/vnd.svd' => 'svd', - 'application/vnd.symbian.install' => 'sis', - 'application/vnd.syncml+xml' => 'xsm', - 'application/vnd.syncml.dm+wbxml' => 'bdm', - 'application/vnd.syncml.dm+xml' => 'xdm', - 'application/vnd.tao.intent-module-archive' => 'tao', - 'application/vnd.tcpdump.pcap' => 'pcap', - 'application/vnd.tmobile-livetv' => 'tmo', - 'application/vnd.trid.tpt' => 'tpt', - 'application/vnd.triscape.mxs' => 'mxs', - 'application/vnd.trueapp' => 'tra', - 'application/vnd.ufdl' => 'ufd', - 'application/vnd.uiq.theme' => 'utz', - 'application/vnd.umajin' => 'umj', - 'application/vnd.unity' => 'unityweb', - 'application/vnd.uoml+xml' => 'uoml', - 'application/vnd.vcx' => 'vcx', - 'application/vnd.visio' => 'vsd', - 'application/vnd.visionary' => 'vis', - 'application/vnd.vsf' => 'vsf', - 'application/vnd.wap.wbxml' => 'wbxml', - 'application/vnd.wap.wmlc' => 'wmlc', - 'application/vnd.wap.wmlscriptc' => 'wmlsc', - 'application/vnd.webturbo' => 'wtb', - 'application/vnd.wolfram.player' => 'nbp', - 'application/vnd.wordperfect' => 'wpd', - 'application/vnd.wqd' => 'wqd', - 'application/vnd.wt.stf' => 'stf', - 'application/vnd.xara' => 'xar', - 'application/vnd.xfdl' => 'xfdl', - 'application/vnd.yamaha.hv-dic' => 'hvd', - 'application/vnd.yamaha.hv-script' => 'hvs', - 'application/vnd.yamaha.hv-voice' => 'hvp', - 'application/vnd.yamaha.openscoreformat' => 'osf', - 'application/vnd.yamaha.openscoreformat.osfpvg+xml' => 'osfpvg', - 'application/vnd.yamaha.smaf-audio' => 'saf', - 'application/vnd.yamaha.smaf-phrase' => 'spf', - 'application/vnd.yellowriver-custom-menu' => 'cmp', - 'application/vnd.zul' => 'zir', - 'application/vnd.zzazz.deck+xml' => 'zaz', - 'application/voicexml+xml' => 'vxml', - 'application/widget' => 'wgt', - 'application/winhlp' => 'hlp', - 'application/wsdl+xml' => 'wsdl', - 'application/wspolicy+xml' => 'wspolicy', - 'application/x-7z-compressed' => '7z', - 'application/x-abiword' => 'abw', - 'application/x-ace-compressed' => 'ace', - 'application/x-apple-diskimage' => 'dmg', - 'application/x-authorware-bin' => 'aab', - 'application/x-authorware-map' => 'aam', - 'application/x-authorware-seg' => 'aas', - 'application/x-bcpio' => 'bcpio', - 'application/x-bittorrent' => 'torrent', - 'application/x-blorb' => 'blb', - 'application/x-bzip' => 'bz', - 'application/x-bzip2' => 'bz2', - 'application/x-cbr' => 'cbr', - 'application/x-cdlink' => 'vcd', - 'application/x-cfs-compressed' => 'cfs', - 'application/x-chat' => 'chat', - 'application/x-chess-pgn' => 'pgn', - 'application/x-conference' => 'nsc', - 'application/x-cpio' => 'cpio', - 'application/x-csh' => 'csh', - 'application/x-debian-package' => 'deb', - 'application/x-dgc-compressed' => 'dgc', - 'application/x-director' => 'dir', - 'application/x-doom' => 'wad', - 'application/x-dtbncx+xml' => 'ncx', - 'application/x-dtbook+xml' => 'dtb', - 'application/x-dtbresource+xml' => 'res', - 'application/x-dvi' => 'dvi', - 'application/x-envoy' => 'evy', - 'application/x-eva' => 'eva', - 'application/x-font-bdf' => 'bdf', - 'application/x-font-ghostscript' => 'gsf', - 'application/x-font-linux-psf' => 'psf', - 'application/x-font-otf' => 'otf', - 'application/x-font-pcf' => 'pcf', - 'application/x-font-snf' => 'snf', - 'application/x-font-ttf' => 'ttf', - 'application/x-font-type1' => 'pfa', - 'application/x-font-woff' => 'woff', - 'application/x-freearc' => 'arc', - 'application/x-futuresplash' => 'spl', - 'application/x-gca-compressed' => 'gca', - 'application/x-glulx' => 'ulx', - 'application/x-gnumeric' => 'gnumeric', - 'application/x-gramps-xml' => 'gramps', - 'application/x-gtar' => 'gtar', - 'application/x-hdf' => 'hdf', - 'application/x-install-instructions' => 'install', - 'application/x-iso9660-image' => 'iso', - 'application/x-java-jnlp-file' => 'jnlp', - 'application/x-latex' => 'latex', - 'application/x-lzh-compressed' => 'lzh', - 'application/x-mie' => 'mie', - 'application/x-mobipocket-ebook' => 'prc', - 'application/x-ms-application' => 'application', - 'application/x-ms-shortcut' => 'lnk', - 'application/x-ms-wmd' => 'wmd', - 'application/x-ms-wmz' => 'wmz', - 'application/x-ms-xbap' => 'xbap', - 'application/x-msaccess' => 'mdb', - 'application/x-msbinder' => 'obd', - 'application/x-mscardfile' => 'crd', - 'application/x-msclip' => 'clp', - 'application/x-msdownload' => 'exe', - 'application/x-msmediaview' => 'mvb', - 'application/x-msmetafile' => 'wmf', - 'application/x-msmoney' => 'mny', - 'application/x-mspublisher' => 'pub', - 'application/x-msschedule' => 'scd', - 'application/x-msterminal' => 'trm', - 'application/x-mswrite' => 'wri', - 'application/x-netcdf' => 'nc', - 'application/x-nzb' => 'nzb', - 'application/x-pkcs12' => 'p12', - 'application/x-pkcs7-certificates' => 'p7b', - 'application/x-pkcs7-certreqresp' => 'p7r', - 'application/x-rar-compressed' => 'rar', - 'application/x-rar' => 'rar', - 'application/x-research-info-systems' => 'ris', - 'application/x-sh' => 'sh', - 'application/x-shar' => 'shar', - 'application/x-shockwave-flash' => 'swf', - 'application/x-silverlight-app' => 'xap', - 'application/x-sql' => 'sql', - 'application/x-stuffit' => 'sit', - 'application/x-stuffitx' => 'sitx', - 'application/x-subrip' => 'srt', - 'application/x-sv4cpio' => 'sv4cpio', - 'application/x-sv4crc' => 'sv4crc', - 'application/x-t3vm-image' => 't3', - 'application/x-tads' => 'gam', - 'application/x-tar' => 'tar', - 'application/x-tcl' => 'tcl', - 'application/x-tex' => 'tex', - 'application/x-tex-tfm' => 'tfm', - 'application/x-texinfo' => 'texinfo', - 'application/x-tgif' => 'obj', - 'application/x-ustar' => 'ustar', - 'application/x-wais-source' => 'src', - 'application/x-x509-ca-cert' => 'der', - 'application/x-xfig' => 'fig', - 'application/x-xliff+xml' => 'xlf', - 'application/x-xpinstall' => 'xpi', - 'application/x-xz' => 'xz', - 'application/x-zmachine' => 'z1', - 'application/xaml+xml' => 'xaml', - 'application/xcap-diff+xml' => 'xdf', - 'application/xenc+xml' => 'xenc', - 'application/xhtml+xml' => 'xhtml', - 'application/xml' => 'xml', - 'application/xml-dtd' => 'dtd', - 'application/xop+xml' => 'xop', - 'application/xproc+xml' => 'xpl', - 'application/xslt+xml' => 'xslt', - 'application/xspf+xml' => 'xspf', - 'application/xv+xml' => 'mxml', - 'application/yang' => 'yang', - 'application/yin+xml' => 'yin', - 'application/zip' => 'zip', - 'audio/adpcm' => 'adp', - 'audio/basic' => 'au', - 'audio/midi' => 'mid', - 'audio/mp4' => 'mp4a', - 'audio/mpeg' => 'mpga', - 'audio/ogg' => 'oga', - 'audio/s3m' => 's3m', - 'audio/silk' => 'sil', - 'audio/vnd.dece.audio' => 'uva', - 'audio/vnd.digital-winds' => 'eol', - 'audio/vnd.dra' => 'dra', - 'audio/vnd.dts' => 'dts', - 'audio/vnd.dts.hd' => 'dtshd', - 'audio/vnd.lucent.voice' => 'lvp', - 'audio/vnd.ms-playready.media.pya' => 'pya', - 'audio/vnd.nuera.ecelp4800' => 'ecelp4800', - 'audio/vnd.nuera.ecelp7470' => 'ecelp7470', - 'audio/vnd.nuera.ecelp9600' => 'ecelp9600', - 'audio/vnd.rip' => 'rip', - 'audio/webm' => 'weba', - 'audio/x-aac' => 'aac', - 'audio/x-aiff' => 'aif', - 'audio/x-caf' => 'caf', - 'audio/x-flac' => 'flac', - 'audio/x-matroska' => 'mka', - 'audio/x-mpegurl' => 'm3u', - 'audio/x-ms-wax' => 'wax', - 'audio/x-ms-wma' => 'wma', - 'audio/x-pn-realaudio' => 'ram', - 'audio/x-pn-realaudio-plugin' => 'rmp', - 'audio/x-wav' => 'wav', - 'audio/xm' => 'xm', - 'chemical/x-cdx' => 'cdx', - 'chemical/x-cif' => 'cif', - 'chemical/x-cmdf' => 'cmdf', - 'chemical/x-cml' => 'cml', - 'chemical/x-csml' => 'csml', - 'chemical/x-xyz' => 'xyz', - 'image/bmp' => 'bmp', - 'image/x-ms-bmp' => 'bmp', - 'image/cgm' => 'cgm', - 'image/g3fax' => 'g3', - 'image/gif' => 'gif', - 'image/ief' => 'ief', - 'image/jpeg' => 'jpeg', - 'image/ktx' => 'ktx', - 'image/png' => 'png', - 'image/prs.btif' => 'btif', - 'image/sgi' => 'sgi', - 'image/svg+xml' => 'svg', - 'image/tiff' => 'tiff', - 'image/vnd.adobe.photoshop' => 'psd', - 'image/vnd.dece.graphic' => 'uvi', - 'image/vnd.dvb.subtitle' => 'sub', - 'image/vnd.djvu' => 'djvu', - 'image/vnd.dwg' => 'dwg', - 'image/vnd.dxf' => 'dxf', - 'image/vnd.fastbidsheet' => 'fbs', - 'image/vnd.fpx' => 'fpx', - 'image/vnd.fst' => 'fst', - 'image/vnd.fujixerox.edmics-mmr' => 'mmr', - 'image/vnd.fujixerox.edmics-rlc' => 'rlc', - 'image/vnd.ms-modi' => 'mdi', - 'image/vnd.ms-photo' => 'wdp', - 'image/vnd.net-fpx' => 'npx', - 'image/vnd.wap.wbmp' => 'wbmp', - 'image/vnd.xiff' => 'xif', - 'image/webp' => 'webp', - 'image/x-3ds' => '3ds', - 'image/x-cmu-raster' => 'ras', - 'image/x-cmx' => 'cmx', - 'image/x-freehand' => 'fh', - 'image/x-icon' => 'ico', - 'image/x-mrsid-image' => 'sid', - 'image/x-pcx' => 'pcx', - 'image/x-pict' => 'pic', - 'image/x-portable-anymap' => 'pnm', - 'image/x-portable-bitmap' => 'pbm', - 'image/x-portable-graymap' => 'pgm', - 'image/x-portable-pixmap' => 'ppm', - 'image/x-rgb' => 'rgb', - 'image/x-tga' => 'tga', - 'image/x-xbitmap' => 'xbm', - 'image/x-xpixmap' => 'xpm', - 'image/x-xwindowdump' => 'xwd', - 'message/rfc822' => 'eml', - 'model/iges' => 'igs', - 'model/mesh' => 'msh', - 'model/vnd.collada+xml' => 'dae', - 'model/vnd.dwf' => 'dwf', - 'model/vnd.gdl' => 'gdl', - 'model/vnd.gtw' => 'gtw', - 'model/vnd.mts' => 'mts', - 'model/vnd.vtu' => 'vtu', - 'model/vrml' => 'wrl', - 'model/x3d+binary' => 'x3db', - 'model/x3d+vrml' => 'x3dv', - 'model/x3d+xml' => 'x3d', - 'text/cache-manifest' => 'appcache', - 'text/calendar' => 'ics', - 'text/css' => 'css', - 'text/csv' => 'csv', - 'text/html' => 'html', - 'text/n3' => 'n3', - 'text/plain' => 'txt', - 'text/prs.lines.tag' => 'dsc', - 'text/richtext' => 'rtx', - 'text/rtf' => 'rtf', - 'text/sgml' => 'sgml', - 'text/tab-separated-values' => 'tsv', - 'text/troff' => 't', - 'text/turtle' => 'ttl', - 'text/uri-list' => 'uri', - 'text/vcard' => 'vcard', - 'text/vnd.curl' => 'curl', - 'text/vnd.curl.dcurl' => 'dcurl', - 'text/vnd.curl.scurl' => 'scurl', - 'text/vnd.curl.mcurl' => 'mcurl', - 'text/vnd.dvb.subtitle' => 'sub', - 'text/vnd.fly' => 'fly', - 'text/vnd.fmi.flexstor' => 'flx', - 'text/vnd.graphviz' => 'gv', - 'text/vnd.in3d.3dml' => '3dml', - 'text/vnd.in3d.spot' => 'spot', - 'text/vnd.sun.j2me.app-descriptor' => 'jad', - 'text/vnd.wap.wml' => 'wml', - 'text/vnd.wap.wmlscript' => 'wmls', - 'text/x-asm' => 's', - 'text/x-c' => 'c', - 'text/x-fortran' => 'f', - 'text/x-pascal' => 'p', - 'text/x-java-source' => 'java', - 'text/x-opml' => 'opml', - 'text/x-nfo' => 'nfo', - 'text/x-setext' => 'etx', - 'text/x-sfv' => 'sfv', - 'text/x-uuencode' => 'uu', - 'text/x-vcalendar' => 'vcs', - 'text/x-vcard' => 'vcf', - 'video/3gpp' => '3gp', - 'video/3gpp2' => '3g2', - 'video/h261' => 'h261', - 'video/h263' => 'h263', - 'video/h264' => 'h264', - 'video/jpeg' => 'jpgv', - 'video/jpm' => 'jpm', - 'video/mj2' => 'mj2', - 'video/mp4' => 'mp4', - 'video/mpeg' => 'mpeg', - 'video/ogg' => 'ogv', - 'video/quicktime' => 'qt', - 'video/vnd.dece.hd' => 'uvh', - 'video/vnd.dece.mobile' => 'uvm', - 'video/vnd.dece.pd' => 'uvp', - 'video/vnd.dece.sd' => 'uvs', - 'video/vnd.dece.video' => 'uvv', - 'video/vnd.dvb.file' => 'dvb', - 'video/vnd.fvt' => 'fvt', - 'video/vnd.mpegurl' => 'mxu', - 'video/vnd.ms-playready.media.pyv' => 'pyv', - 'video/vnd.uvvu.mp4' => 'uvu', - 'video/vnd.vivo' => 'viv', - 'video/webm' => 'webm', - 'video/x-f4v' => 'f4v', - 'video/x-fli' => 'fli', - 'video/x-flv' => 'flv', - 'video/x-m4v' => 'm4v', - 'video/x-matroska' => 'mkv', - 'video/x-mng' => 'mng', - 'video/x-ms-asf' => 'asf', - 'video/x-ms-vob' => 'vob', - 'video/x-ms-wm' => 'wm', - 'video/x-ms-wmv' => 'wmv', - 'video/x-ms-wmx' => 'wmx', - 'video/x-ms-wvx' => 'wvx', - 'video/x-msvideo' => 'avi', - 'video/x-sgi-movie' => 'movie', - 'video/x-smv' => 'smv', - 'x-conference/x-cooltalk' => 'ice', - ); - - /** - * {@inheritdoc} - */ - public function guess($mimeType) - { - return isset($this->defaultExtensions[$mimeType]) ? $this->defaultExtensions[$mimeType] : null; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-foundation/File/MimeType/MimeTypeGuesser.php b/sitecake/2.2.9/server/vendor/symfony/http-foundation/File/MimeType/MimeTypeGuesser.php deleted file mode 100644 index 81b2b02..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-foundation/File/MimeType/MimeTypeGuesser.php +++ /dev/null @@ -1,136 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\File\MimeType; - -use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException; -use Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException; - -/** - * A singleton mime type guesser. - * - * By default, all mime type guessers provided by the framework are installed - * (if available on the current OS/PHP setup). - * - * You can register custom guessers by calling the register() method on the - * singleton instance. Custom guessers are always called before any default ones. - * - * $guesser = MimeTypeGuesser::getInstance(); - * $guesser->register(new MyCustomMimeTypeGuesser()); - * - * If you want to change the order of the default guessers, just re-register your - * preferred one as a custom one. The last registered guesser is preferred over - * previously registered ones. - * - * Re-registering a built-in guesser also allows you to configure it: - * - * $guesser = MimeTypeGuesser::getInstance(); - * $guesser->register(new FileinfoMimeTypeGuesser('/path/to/magic/file')); - * - * @author Bernhard Schussek - */ -class MimeTypeGuesser implements MimeTypeGuesserInterface -{ - /** - * The singleton instance. - * - * @var MimeTypeGuesser - */ - private static $instance = null; - - /** - * All registered MimeTypeGuesserInterface instances. - * - * @var array - */ - protected $guessers = array(); - - /** - * Returns the singleton instance. - * - * @return MimeTypeGuesser - */ - public static function getInstance() - { - if (null === self::$instance) { - self::$instance = new self(); - } - - return self::$instance; - } - - /** - * Registers all natively provided mime type guessers. - */ - private function __construct() - { - if (FileBinaryMimeTypeGuesser::isSupported()) { - $this->register(new FileBinaryMimeTypeGuesser()); - } - - if (FileinfoMimeTypeGuesser::isSupported()) { - $this->register(new FileinfoMimeTypeGuesser()); - } - } - - /** - * Registers a new mime type guesser. - * - * When guessing, this guesser is preferred over previously registered ones. - * - * @param MimeTypeGuesserInterface $guesser - */ - public function register(MimeTypeGuesserInterface $guesser) - { - array_unshift($this->guessers, $guesser); - } - - /** - * Tries to guess the mime type of the given file. - * - * The file is passed to each registered mime type guesser in reverse order - * of their registration (last registered is queried first). Once a guesser - * returns a value that is not NULL, this method terminates and returns the - * value. - * - * @param string $path The path to the file - * - * @return string The mime type or NULL, if none could be guessed - * - * @throws \LogicException - * @throws FileNotFoundException - * @throws AccessDeniedException - */ - public function guess($path) - { - if (!is_file($path)) { - throw new FileNotFoundException($path); - } - - if (!is_readable($path)) { - throw new AccessDeniedException($path); - } - - if (!$this->guessers) { - $msg = 'Unable to guess the mime type as no guessers are available'; - if (!FileinfoMimeTypeGuesser::isSupported()) { - $msg .= ' (Did you enable the php_fileinfo extension?)'; - } - throw new \LogicException($msg); - } - - foreach ($this->guessers as $guesser) { - if (null !== $mimeType = $guesser->guess($path)) { - return $mimeType; - } - } - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-foundation/File/MimeType/MimeTypeGuesserInterface.php b/sitecake/2.2.9/server/vendor/symfony/http-foundation/File/MimeType/MimeTypeGuesserInterface.php deleted file mode 100644 index f8c3ad2..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-foundation/File/MimeType/MimeTypeGuesserInterface.php +++ /dev/null @@ -1,35 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\File\MimeType; - -use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException; -use Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException; - -/** - * Guesses the mime type of a file. - * - * @author Bernhard Schussek - */ -interface MimeTypeGuesserInterface -{ - /** - * Guesses the mime type of the file with the given path. - * - * @param string $path The path to the file - * - * @return string The mime type or NULL, if none could be guessed - * - * @throws FileNotFoundException If the file does not exist - * @throws AccessDeniedException If the file could not be read - */ - public function guess($path); -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-foundation/File/UploadedFile.php b/sitecake/2.2.9/server/vendor/symfony/http-foundation/File/UploadedFile.php deleted file mode 100644 index 0f3f802..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-foundation/File/UploadedFile.php +++ /dev/null @@ -1,309 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\File; - -use Symfony\Component\HttpFoundation\File\Exception\FileException; -use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException; -use Symfony\Component\HttpFoundation\File\MimeType\ExtensionGuesser; - -/** - * A file uploaded through a form. - * - * @author Bernhard Schussek - * @author Florian Eckerstorfer - * @author Fabien Potencier - * - * @api - */ -class UploadedFile extends File -{ - /** - * Whether the test mode is activated. - * - * Local files are used in test mode hence the code should not enforce HTTP uploads. - * - * @var bool - */ - private $test = false; - - /** - * The original name of the uploaded file. - * - * @var string - */ - private $originalName; - - /** - * The mime type provided by the uploader. - * - * @var string - */ - private $mimeType; - - /** - * The file size provided by the uploader. - * - * @var string - */ - private $size; - - /** - * The UPLOAD_ERR_XXX constant provided by the uploader. - * - * @var int - */ - private $error; - - /** - * Accepts the information of the uploaded file as provided by the PHP global $_FILES. - * - * The file object is only created when the uploaded file is valid (i.e. when the - * isValid() method returns true). Otherwise the only methods that could be called - * on an UploadedFile instance are: - * - * * getClientOriginalName, - * * getClientMimeType, - * * isValid, - * * getError. - * - * Calling any other method on an non-valid instance will cause an unpredictable result. - * - * @param string $path The full temporary path to the file - * @param string $originalName The original file name - * @param string $mimeType The type of the file as provided by PHP - * @param int $size The file size - * @param int $error The error constant of the upload (one of PHP's UPLOAD_ERR_XXX constants) - * @param bool $test Whether the test mode is active - * - * @throws FileException If file_uploads is disabled - * @throws FileNotFoundException If the file does not exist - * - * @api - */ - public function __construct($path, $originalName, $mimeType = null, $size = null, $error = null, $test = false) - { - $this->originalName = $this->getName($originalName); - $this->mimeType = $mimeType ?: 'application/octet-stream'; - $this->size = $size; - $this->error = $error ?: UPLOAD_ERR_OK; - $this->test = (bool) $test; - - parent::__construct($path, UPLOAD_ERR_OK === $this->error); - } - - /** - * Returns the original file name. - * - * It is extracted from the request from which the file has been uploaded. - * Then it should not be considered as a safe value. - * - * @return string|null The original name - * - * @api - */ - public function getClientOriginalName() - { - return $this->originalName; - } - - /** - * Returns the original file extension. - * - * It is extracted from the original file name that was uploaded. - * Then it should not be considered as a safe value. - * - * @return string The extension - */ - public function getClientOriginalExtension() - { - return pathinfo($this->originalName, PATHINFO_EXTENSION); - } - - /** - * Returns the file mime type. - * - * The client mime type is extracted from the request from which the file - * was uploaded, so it should not be considered as a safe value. - * - * For a trusted mime type, use getMimeType() instead (which guesses the mime - * type based on the file content). - * - * @return string|null The mime type - * - * @see getMimeType() - * - * @api - */ - public function getClientMimeType() - { - return $this->mimeType; - } - - /** - * Returns the extension based on the client mime type. - * - * If the mime type is unknown, returns null. - * - * This method uses the mime type as guessed by getClientMimeType() - * to guess the file extension. As such, the extension returned - * by this method cannot be trusted. - * - * For a trusted extension, use guessExtension() instead (which guesses - * the extension based on the guessed mime type for the file). - * - * @return string|null The guessed extension or null if it cannot be guessed - * - * @see guessExtension() - * @see getClientMimeType() - */ - public function guessClientExtension() - { - $type = $this->getClientMimeType(); - $guesser = ExtensionGuesser::getInstance(); - - return $guesser->guess($type); - } - - /** - * Returns the file size. - * - * It is extracted from the request from which the file has been uploaded. - * Then it should not be considered as a safe value. - * - * @return int|null The file size - * - * @api - */ - public function getClientSize() - { - return $this->size; - } - - /** - * Returns the upload error. - * - * If the upload was successful, the constant UPLOAD_ERR_OK is returned. - * Otherwise one of the other UPLOAD_ERR_XXX constants is returned. - * - * @return int The upload error - * - * @api - */ - public function getError() - { - return $this->error; - } - - /** - * Returns whether the file was uploaded successfully. - * - * @return bool True if the file has been uploaded with HTTP and no error occurred. - * - * @api - */ - public function isValid() - { - $isOk = $this->error === UPLOAD_ERR_OK; - - return $this->test ? $isOk : $isOk && is_uploaded_file($this->getPathname()); - } - - /** - * Moves the file to a new location. - * - * @param string $directory The destination folder - * @param string $name The new file name - * - * @return File A File object representing the new file - * - * @throws FileException if, for any reason, the file could not have been moved - * - * @api - */ - public function move($directory, $name = null) - { - if ($this->isValid()) { - if ($this->test) { - return parent::move($directory, $name); - } - - $target = $this->getTargetFile($directory, $name); - - if (!@move_uploaded_file($this->getPathname(), $target)) { - $error = error_get_last(); - throw new FileException(sprintf('Could not move the file "%s" to "%s" (%s)', $this->getPathname(), $target, strip_tags($error['message']))); - } - - @chmod($target, 0666 & ~umask()); - - return $target; - } - - throw new FileException($this->getErrorMessage()); - } - - /** - * Returns the maximum size of an uploaded file as configured in php.ini. - * - * @return int The maximum size of an uploaded file in bytes - */ - public static function getMaxFilesize() - { - $iniMax = strtolower(ini_get('upload_max_filesize')); - - if ('' === $iniMax) { - return PHP_INT_MAX; - } - - $max = ltrim($iniMax, '+'); - if (0 === strpos($max, '0x')) { - $max = intval($max, 16); - } elseif (0 === strpos($max, '0')) { - $max = intval($max, 8); - } else { - $max = (int) $max; - } - - switch (substr($iniMax, -1)) { - case 't': $max *= 1024; - case 'g': $max *= 1024; - case 'm': $max *= 1024; - case 'k': $max *= 1024; - } - - return $max; - } - - /** - * Returns an informative upload error message. - * - * @return string The error message regarding the specified error code - */ - public function getErrorMessage() - { - static $errors = array( - UPLOAD_ERR_INI_SIZE => 'The file "%s" exceeds your upload_max_filesize ini directive (limit is %d KiB).', - UPLOAD_ERR_FORM_SIZE => 'The file "%s" exceeds the upload limit defined in your form.', - UPLOAD_ERR_PARTIAL => 'The file "%s" was only partially uploaded.', - UPLOAD_ERR_NO_FILE => 'No file was uploaded.', - UPLOAD_ERR_CANT_WRITE => 'The file "%s" could not be written on disk.', - UPLOAD_ERR_NO_TMP_DIR => 'File could not be uploaded: missing temporary directory.', - UPLOAD_ERR_EXTENSION => 'File upload was stopped by a PHP extension.', - ); - - $errorCode = $this->error; - $maxFilesize = $errorCode === UPLOAD_ERR_INI_SIZE ? self::getMaxFilesize() / 1024 : 0; - $message = isset($errors[$errorCode]) ? $errors[$errorCode] : 'The file "%s" was not uploaded due to an unknown error.'; - - return sprintf($message, $this->getClientOriginalName(), $maxFilesize); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-foundation/FileBag.php b/sitecake/2.2.9/server/vendor/symfony/http-foundation/FileBag.php deleted file mode 100644 index 43b8af3..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-foundation/FileBag.php +++ /dev/null @@ -1,155 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation; - -use Symfony\Component\HttpFoundation\File\UploadedFile; - -/** - * FileBag is a container for uploaded files. - * - * @author Fabien Potencier - * @author Bulat Shakirzyanov - * - * @api - */ -class FileBag extends ParameterBag -{ - private static $fileKeys = array('error', 'name', 'size', 'tmp_name', 'type'); - - /** - * Constructor. - * - * @param array $parameters An array of HTTP files - * - * @api - */ - public function __construct(array $parameters = array()) - { - $this->replace($parameters); - } - - /** - * {@inheritdoc} - * - * @api - */ - public function replace(array $files = array()) - { - $this->parameters = array(); - $this->add($files); - } - - /** - * {@inheritdoc} - * - * @api - */ - public function set($key, $value) - { - if (!is_array($value) && !$value instanceof UploadedFile) { - throw new \InvalidArgumentException('An uploaded file must be an array or an instance of UploadedFile.'); - } - - parent::set($key, $this->convertFileInformation($value)); - } - - /** - * {@inheritdoc} - * - * @api - */ - public function add(array $files = array()) - { - foreach ($files as $key => $file) { - $this->set($key, $file); - } - } - - /** - * Converts uploaded files to UploadedFile instances. - * - * @param array|UploadedFile $file A (multi-dimensional) array of uploaded file information - * - * @return array A (multi-dimensional) array of UploadedFile instances - */ - protected function convertFileInformation($file) - { - if ($file instanceof UploadedFile) { - return $file; - } - - $file = $this->fixPhpFilesArray($file); - if (is_array($file)) { - $keys = array_keys($file); - sort($keys); - - if ($keys == self::$fileKeys) { - if (UPLOAD_ERR_NO_FILE == $file['error']) { - $file = null; - } else { - $file = new UploadedFile($file['tmp_name'], $file['name'], $file['type'], $file['size'], $file['error']); - } - } else { - $file = array_map(array($this, 'convertFileInformation'), $file); - } - } - - return $file; - } - - /** - * Fixes a malformed PHP $_FILES array. - * - * PHP has a bug that the format of the $_FILES array differs, depending on - * whether the uploaded file fields had normal field names or array-like - * field names ("normal" vs. "parent[child]"). - * - * This method fixes the array to look like the "normal" $_FILES array. - * - * It's safe to pass an already converted array, in which case this method - * just returns the original array unmodified. - * - * @param array $data - * - * @return array - */ - protected function fixPhpFilesArray($data) - { - if (!is_array($data)) { - return $data; - } - - $keys = array_keys($data); - sort($keys); - - if (self::$fileKeys != $keys || !isset($data['name']) || !is_array($data['name'])) { - return $data; - } - - $files = $data; - foreach (self::$fileKeys as $k) { - unset($files[$k]); - } - - foreach ($data['name'] as $key => $name) { - $files[$key] = $this->fixPhpFilesArray(array( - 'error' => $data['error'][$key], - 'name' => $name, - 'type' => $data['type'][$key], - 'tmp_name' => $data['tmp_name'][$key], - 'size' => $data['size'][$key], - )); - } - - return $files; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-foundation/HeaderBag.php b/sitecake/2.2.9/server/vendor/symfony/http-foundation/HeaderBag.php deleted file mode 100644 index d3adffa..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-foundation/HeaderBag.php +++ /dev/null @@ -1,348 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation; - -/** - * HeaderBag is a container for HTTP headers. - * - * @author Fabien Potencier - * - * @api - */ -class HeaderBag implements \IteratorAggregate, \Countable -{ - protected $headers = array(); - protected $cacheControl = array(); - - /** - * Constructor. - * - * @param array $headers An array of HTTP headers - * - * @api - */ - public function __construct(array $headers = array()) - { - foreach ($headers as $key => $values) { - $this->set($key, $values); - } - } - - /** - * Returns the headers as a string. - * - * @return string The headers - */ - public function __toString() - { - if (!$this->headers) { - return ''; - } - - $max = max(array_map('strlen', array_keys($this->headers))) + 1; - $content = ''; - ksort($this->headers); - foreach ($this->headers as $name => $values) { - $name = implode('-', array_map('ucfirst', explode('-', $name))); - foreach ($values as $value) { - $content .= sprintf("%-{$max}s %s\r\n", $name.':', $value); - } - } - - return $content; - } - - /** - * Returns the headers. - * - * @return array An array of headers - * - * @api - */ - public function all() - { - return $this->headers; - } - - /** - * Returns the parameter keys. - * - * @return array An array of parameter keys - * - * @api - */ - public function keys() - { - return array_keys($this->headers); - } - - /** - * Replaces the current HTTP headers by a new set. - * - * @param array $headers An array of HTTP headers - * - * @api - */ - public function replace(array $headers = array()) - { - $this->headers = array(); - $this->add($headers); - } - - /** - * Adds new headers the current HTTP headers set. - * - * @param array $headers An array of HTTP headers - * - * @api - */ - public function add(array $headers) - { - foreach ($headers as $key => $values) { - $this->set($key, $values); - } - } - - /** - * Returns a header value by name. - * - * @param string $key The header name - * @param mixed $default The default value - * @param bool $first Whether to return the first value or all header values - * - * @return string|array The first header value if $first is true, an array of values otherwise - * - * @api - */ - public function get($key, $default = null, $first = true) - { - $key = strtr(strtolower($key), '_', '-'); - - if (!array_key_exists($key, $this->headers)) { - if (null === $default) { - return $first ? null : array(); - } - - return $first ? $default : array($default); - } - - if ($first) { - return count($this->headers[$key]) ? $this->headers[$key][0] : $default; - } - - return $this->headers[$key]; - } - - /** - * Sets a header by name. - * - * @param string $key The key - * @param string|array $values The value or an array of values - * @param bool $replace Whether to replace the actual value or not (true by default) - * - * @api - */ - public function set($key, $values, $replace = true) - { - $key = strtr(strtolower($key), '_', '-'); - - $values = array_values((array) $values); - - if (true === $replace || !isset($this->headers[$key])) { - $this->headers[$key] = $values; - } else { - $this->headers[$key] = array_merge($this->headers[$key], $values); - } - - if ('cache-control' === $key) { - $this->cacheControl = $this->parseCacheControl($values[0]); - } - } - - /** - * Returns true if the HTTP header is defined. - * - * @param string $key The HTTP header - * - * @return bool true if the parameter exists, false otherwise - * - * @api - */ - public function has($key) - { - return array_key_exists(strtr(strtolower($key), '_', '-'), $this->headers); - } - - /** - * Returns true if the given HTTP header contains the given value. - * - * @param string $key The HTTP header name - * @param string $value The HTTP value - * - * @return bool true if the value is contained in the header, false otherwise - * - * @api - */ - public function contains($key, $value) - { - return in_array($value, $this->get($key, null, false)); - } - - /** - * Removes a header. - * - * @param string $key The HTTP header name - * - * @api - */ - public function remove($key) - { - $key = strtr(strtolower($key), '_', '-'); - - unset($this->headers[$key]); - - if ('cache-control' === $key) { - $this->cacheControl = array(); - } - } - - /** - * Returns the HTTP header value converted to a date. - * - * @param string $key The parameter key - * @param \DateTime $default The default value - * - * @return null|\DateTime The parsed DateTime or the default value if the header does not exist - * - * @throws \RuntimeException When the HTTP header is not parseable - * - * @api - */ - public function getDate($key, \DateTime $default = null) - { - if (null === $value = $this->get($key)) { - return $default; - } - - if (false === $date = \DateTime::createFromFormat(DATE_RFC2822, $value)) { - throw new \RuntimeException(sprintf('The %s HTTP header is not parseable (%s).', $key, $value)); - } - - return $date; - } - - /** - * Adds a custom Cache-Control directive. - * - * @param string $key The Cache-Control directive name - * @param mixed $value The Cache-Control directive value - */ - public function addCacheControlDirective($key, $value = true) - { - $this->cacheControl[$key] = $value; - - $this->set('Cache-Control', $this->getCacheControlHeader()); - } - - /** - * Returns true if the Cache-Control directive is defined. - * - * @param string $key The Cache-Control directive - * - * @return bool true if the directive exists, false otherwise - */ - public function hasCacheControlDirective($key) - { - return array_key_exists($key, $this->cacheControl); - } - - /** - * Returns a Cache-Control directive value by name. - * - * @param string $key The directive name - * - * @return mixed|null The directive value if defined, null otherwise - */ - public function getCacheControlDirective($key) - { - return array_key_exists($key, $this->cacheControl) ? $this->cacheControl[$key] : null; - } - - /** - * Removes a Cache-Control directive. - * - * @param string $key The Cache-Control directive - */ - public function removeCacheControlDirective($key) - { - unset($this->cacheControl[$key]); - - $this->set('Cache-Control', $this->getCacheControlHeader()); - } - - /** - * Returns an iterator for headers. - * - * @return \ArrayIterator An \ArrayIterator instance - */ - public function getIterator() - { - return new \ArrayIterator($this->headers); - } - - /** - * Returns the number of headers. - * - * @return int The number of headers - */ - public function count() - { - return count($this->headers); - } - - protected function getCacheControlHeader() - { - $parts = array(); - ksort($this->cacheControl); - foreach ($this->cacheControl as $key => $value) { - if (true === $value) { - $parts[] = $key; - } else { - if (preg_match('#[^a-zA-Z0-9._-]#', $value)) { - $value = '"'.$value.'"'; - } - - $parts[] = "$key=$value"; - } - } - - return implode(', ', $parts); - } - - /** - * Parses a Cache-Control HTTP header. - * - * @param string $header The value of the Cache-Control HTTP header - * - * @return array An array representing the attribute values - */ - protected function parseCacheControl($header) - { - $cacheControl = array(); - preg_match_all('#([a-zA-Z][a-zA-Z_-]*)\s*(?:=(?:"([^"]*)"|([^ \t",;]*)))?#', $header, $matches, PREG_SET_ORDER); - foreach ($matches as $match) { - $cacheControl[strtolower($match[1])] = isset($match[3]) ? $match[3] : (isset($match[2]) ? $match[2] : true); - } - - return $cacheControl; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-foundation/IpUtils.php b/sitecake/2.2.9/server/vendor/symfony/http-foundation/IpUtils.php deleted file mode 100644 index fb906b6..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-foundation/IpUtils.php +++ /dev/null @@ -1,128 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation; - -/** - * Http utility functions. - * - * @author Fabien Potencier - */ -class IpUtils -{ - /** - * This class should not be instantiated. - */ - private function __construct() - { - } - - /** - * Checks if an IPv4 or IPv6 address is contained in the list of given IPs or subnets. - * - * @param string $requestIp IP to check - * @param string|array $ips List of IPs or subnets (can be a string if only a single one) - * - * @return bool Whether the IP is valid - */ - public static function checkIp($requestIp, $ips) - { - if (!is_array($ips)) { - $ips = array($ips); - } - - $method = substr_count($requestIp, ':') > 1 ? 'checkIp6' : 'checkIp4'; - - foreach ($ips as $ip) { - if (self::$method($requestIp, $ip)) { - return true; - } - } - - return false; - } - - /** - * Compares two IPv4 addresses. - * In case a subnet is given, it checks if it contains the request IP. - * - * @param string $requestIp IPv4 address to check - * @param string $ip IPv4 address or subnet in CIDR notation - * - * @return bool Whether the IP is valid - */ - public static function checkIp4($requestIp, $ip) - { - if (false !== strpos($ip, '/')) { - if ('0.0.0.0/0' === $ip) { - return true; - } - - list($address, $netmask) = explode('/', $ip, 2); - - if ($netmask < 1 || $netmask > 32) { - return false; - } - } else { - $address = $ip; - $netmask = 32; - } - - return 0 === substr_compare(sprintf('%032b', ip2long($requestIp)), sprintf('%032b', ip2long($address)), 0, $netmask); - } - - /** - * Compares two IPv6 addresses. - * In case a subnet is given, it checks if it contains the request IP. - * - * @author David Soria Parra - * - * @see https://github.com/dsp/v6tools - * - * @param string $requestIp IPv6 address to check - * @param string $ip IPv6 address or subnet in CIDR notation - * - * @return bool Whether the IP is valid - * - * @throws \RuntimeException When IPV6 support is not enabled - */ - public static function checkIp6($requestIp, $ip) - { - if (!((extension_loaded('sockets') && defined('AF_INET6')) || @inet_pton('::1'))) { - throw new \RuntimeException('Unable to check Ipv6. Check that PHP was not compiled with option "disable-ipv6".'); - } - - if (false !== strpos($ip, '/')) { - list($address, $netmask) = explode('/', $ip, 2); - - if ($netmask < 1 || $netmask > 128) { - return false; - } - } else { - $address = $ip; - $netmask = 128; - } - - $bytesAddr = unpack('n*', inet_pton($address)); - $bytesTest = unpack('n*', inet_pton($requestIp)); - - for ($i = 1, $ceil = ceil($netmask / 16); $i <= $ceil; ++$i) { - $left = $netmask - 16 * ($i - 1); - $left = ($left <= 16) ? $left : 16; - $mask = ~(0xffff >> $left) & 0xffff; - if (($bytesAddr[$i] & $mask) != ($bytesTest[$i] & $mask)) { - return false; - } - } - - return true; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-foundation/JsonResponse.php b/sitecake/2.2.9/server/vendor/symfony/http-foundation/JsonResponse.php deleted file mode 100644 index fa80c68..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-foundation/JsonResponse.php +++ /dev/null @@ -1,202 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation; - -/** - * Response represents an HTTP response in JSON format. - * - * Note that this class does not force the returned JSON content to be an - * object. It is however recommended that you do return an object as it - * protects yourself against XSSI and JSON-JavaScript Hijacking. - * - * @see https://www.owasp.org/index.php/OWASP_AJAX_Security_Guidelines#Always_return_JSON_with_an_Object_on_the_outside - * - * @author Igor Wiedler - */ -class JsonResponse extends Response -{ - protected $data; - protected $callback; - protected $encodingOptions; - - /** - * Constructor. - * - * @param mixed $data The response data - * @param int $status The response status code - * @param array $headers An array of response headers - */ - public function __construct($data = null, $status = 200, $headers = array()) - { - parent::__construct('', $status, $headers); - - if (null === $data) { - $data = new \ArrayObject(); - } - - // Encode <, >, ', &, and " for RFC4627-compliant JSON, which may also be embedded into HTML. - $this->encodingOptions = JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT; - - $this->setData($data); - } - - /** - * {@inheritdoc} - */ - public static function create($data = null, $status = 200, $headers = array()) - { - return new static($data, $status, $headers); - } - - /** - * Sets the JSONP callback. - * - * @param string|null $callback The JSONP callback or null to use none - * - * @return JsonResponse - * - * @throws \InvalidArgumentException When the callback name is not valid - */ - public function setCallback($callback = null) - { - if (null !== $callback) { - // taken from http://www.geekality.net/2011/08/03/valid-javascript-identifier/ - $pattern = '/^[$_\p{L}][$_\p{L}\p{Mn}\p{Mc}\p{Nd}\p{Pc}\x{200C}\x{200D}]*+$/u'; - $parts = explode('.', $callback); - foreach ($parts as $part) { - if (!preg_match($pattern, $part)) { - throw new \InvalidArgumentException('The callback name is not valid.'); - } - } - } - - $this->callback = $callback; - - return $this->update(); - } - - /** - * Sets the data to be sent as JSON. - * - * @param mixed $data - * - * @return JsonResponse - * - * @throws \InvalidArgumentException - */ - public function setData($data = array()) - { - $errorHandler = null; - $errorHandler = set_error_handler(function () use (&$errorHandler) { - if (JSON_ERROR_NONE !== json_last_error()) { - return; - } - - if ($errorHandler) { - call_user_func_array($errorHandler, func_get_args()); - } - }); - - try { - // Clear json_last_error() - json_encode(null); - - $this->data = json_encode($data, $this->encodingOptions); - - restore_error_handler(); - } catch (\Exception $exception) { - restore_error_handler(); - - throw $exception; - } - - if (JSON_ERROR_NONE !== json_last_error()) { - throw new \InvalidArgumentException($this->transformJsonError()); - } - - return $this->update(); - } - - /** - * Returns options used while encoding data to JSON. - * - * @return int - */ - public function getEncodingOptions() - { - return $this->encodingOptions; - } - - /** - * Sets options used while encoding data to JSON. - * - * @param int $encodingOptions - * - * @return JsonResponse - */ - public function setEncodingOptions($encodingOptions) - { - $this->encodingOptions = (int) $encodingOptions; - - return $this->setData(json_decode($this->data)); - } - - /** - * Updates the content and headers according to the JSON data and callback. - * - * @return JsonResponse - */ - protected function update() - { - if (null !== $this->callback) { - // Not using application/javascript for compatibility reasons with older browsers. - $this->headers->set('Content-Type', 'text/javascript'); - - return $this->setContent(sprintf('/**/%s(%s);', $this->callback, $this->data)); - } - - // Only set the header when there is none or when it equals 'text/javascript' (from a previous update with callback) - // in order to not overwrite a custom definition. - if (!$this->headers->has('Content-Type') || 'text/javascript' === $this->headers->get('Content-Type')) { - $this->headers->set('Content-Type', 'application/json'); - } - - return $this->setContent($this->data); - } - - private function transformJsonError() - { - if (function_exists('json_last_error_msg')) { - return json_last_error_msg(); - } - - switch (json_last_error()) { - case JSON_ERROR_DEPTH: - return 'Maximum stack depth exceeded.'; - - case JSON_ERROR_STATE_MISMATCH: - return 'Underflow or the modes mismatch.'; - - case JSON_ERROR_CTRL_CHAR: - return 'Unexpected control character found.'; - - case JSON_ERROR_SYNTAX: - return 'Syntax error, malformed JSON.'; - - case JSON_ERROR_UTF8: - return 'Malformed UTF-8 characters, possibly incorrectly encoded.'; - - default: - return 'Unknown error.'; - } - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-foundation/LICENSE b/sitecake/2.2.9/server/vendor/symfony/http-foundation/LICENSE deleted file mode 100644 index 43028bc..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-foundation/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2004-2015 Fabien Potencier - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/sitecake/2.2.9/server/vendor/symfony/http-foundation/ParameterBag.php b/sitecake/2.2.9/server/vendor/symfony/http-foundation/ParameterBag.php deleted file mode 100644 index 6081f3f..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-foundation/ParameterBag.php +++ /dev/null @@ -1,319 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation; - -/** - * ParameterBag is a container for key/value pairs. - * - * @author Fabien Potencier - * - * @api - */ -class ParameterBag implements \IteratorAggregate, \Countable -{ - /** - * Parameter storage. - * - * @var array - */ - protected $parameters; - - /** - * Constructor. - * - * @param array $parameters An array of parameters - * - * @api - */ - public function __construct(array $parameters = array()) - { - $this->parameters = $parameters; - } - - /** - * Returns the parameters. - * - * @return array An array of parameters - * - * @api - */ - public function all() - { - return $this->parameters; - } - - /** - * Returns the parameter keys. - * - * @return array An array of parameter keys - * - * @api - */ - public function keys() - { - return array_keys($this->parameters); - } - - /** - * Replaces the current parameters by a new set. - * - * @param array $parameters An array of parameters - * - * @api - */ - public function replace(array $parameters = array()) - { - $this->parameters = $parameters; - } - - /** - * Adds parameters. - * - * @param array $parameters An array of parameters - * - * @api - */ - public function add(array $parameters = array()) - { - $this->parameters = array_replace($this->parameters, $parameters); - } - - /** - * Returns a parameter by name. - * - * @param string $path The key - * @param mixed $default The default value if the parameter key does not exist - * @param bool $deep If true, a path like foo[bar] will find deeper items - * - * @return mixed - * - * @throws \InvalidArgumentException - * - * @api - */ - public function get($path, $default = null, $deep = false) - { - if (!$deep || false === $pos = strpos($path, '[')) { - return array_key_exists($path, $this->parameters) ? $this->parameters[$path] : $default; - } - - $root = substr($path, 0, $pos); - if (!array_key_exists($root, $this->parameters)) { - return $default; - } - - $value = $this->parameters[$root]; - $currentKey = null; - for ($i = $pos, $c = strlen($path); $i < $c; ++$i) { - $char = $path[$i]; - - if ('[' === $char) { - if (null !== $currentKey) { - throw new \InvalidArgumentException(sprintf('Malformed path. Unexpected "[" at position %d.', $i)); - } - - $currentKey = ''; - } elseif (']' === $char) { - if (null === $currentKey) { - throw new \InvalidArgumentException(sprintf('Malformed path. Unexpected "]" at position %d.', $i)); - } - - if (!is_array($value) || !array_key_exists($currentKey, $value)) { - return $default; - } - - $value = $value[$currentKey]; - $currentKey = null; - } else { - if (null === $currentKey) { - throw new \InvalidArgumentException(sprintf('Malformed path. Unexpected "%s" at position %d.', $char, $i)); - } - - $currentKey .= $char; - } - } - - if (null !== $currentKey) { - throw new \InvalidArgumentException(sprintf('Malformed path. Path must end with "]".')); - } - - return $value; - } - - /** - * Sets a parameter by name. - * - * @param string $key The key - * @param mixed $value The value - * - * @api - */ - public function set($key, $value) - { - $this->parameters[$key] = $value; - } - - /** - * Returns true if the parameter is defined. - * - * @param string $key The key - * - * @return bool true if the parameter exists, false otherwise - * - * @api - */ - public function has($key) - { - return array_key_exists($key, $this->parameters); - } - - /** - * Removes a parameter. - * - * @param string $key The key - * - * @api - */ - public function remove($key) - { - unset($this->parameters[$key]); - } - - /** - * Returns the alphabetic characters of the parameter value. - * - * @param string $key The parameter key - * @param mixed $default The default value if the parameter key does not exist - * @param bool $deep If true, a path like foo[bar] will find deeper items - * - * @return string The filtered value - * - * @api - */ - public function getAlpha($key, $default = '', $deep = false) - { - return preg_replace('/[^[:alpha:]]/', '', $this->get($key, $default, $deep)); - } - - /** - * Returns the alphabetic characters and digits of the parameter value. - * - * @param string $key The parameter key - * @param mixed $default The default value if the parameter key does not exist - * @param bool $deep If true, a path like foo[bar] will find deeper items - * - * @return string The filtered value - * - * @api - */ - public function getAlnum($key, $default = '', $deep = false) - { - return preg_replace('/[^[:alnum:]]/', '', $this->get($key, $default, $deep)); - } - - /** - * Returns the digits of the parameter value. - * - * @param string $key The parameter key - * @param mixed $default The default value if the parameter key does not exist - * @param bool $deep If true, a path like foo[bar] will find deeper items - * - * @return string The filtered value - * - * @api - */ - public function getDigits($key, $default = '', $deep = false) - { - // we need to remove - and + because they're allowed in the filter - return str_replace(array('-', '+'), '', $this->filter($key, $default, $deep, FILTER_SANITIZE_NUMBER_INT)); - } - - /** - * Returns the parameter value converted to integer. - * - * @param string $key The parameter key - * @param mixed $default The default value if the parameter key does not exist - * @param bool $deep If true, a path like foo[bar] will find deeper items - * - * @return int The filtered value - * - * @api - */ - public function getInt($key, $default = 0, $deep = false) - { - return (int) $this->get($key, $default, $deep); - } - - /** - * Returns the parameter value converted to boolean. - * - * @param string $key The parameter key - * @param mixed $default The default value if the parameter key does not exist - * @param bool $deep If true, a path like foo[bar] will find deeper items - * - * @return bool The filtered value - */ - public function getBoolean($key, $default = false, $deep = false) - { - return $this->filter($key, $default, $deep, FILTER_VALIDATE_BOOLEAN); - } - - /** - * Filter key. - * - * @param string $key Key. - * @param mixed $default Default = null. - * @param bool $deep Default = false. - * @param int $filter FILTER_* constant. - * @param mixed $options Filter options. - * - * @see http://php.net/manual/en/function.filter-var.php - * - * @return mixed - */ - public function filter($key, $default = null, $deep = false, $filter = FILTER_DEFAULT, $options = array()) - { - $value = $this->get($key, $default, $deep); - - // Always turn $options into an array - this allows filter_var option shortcuts. - if (!is_array($options) && $options) { - $options = array('flags' => $options); - } - - // Add a convenience check for arrays. - if (is_array($value) && !isset($options['flags'])) { - $options['flags'] = FILTER_REQUIRE_ARRAY; - } - - return filter_var($value, $filter, $options); - } - - /** - * Returns an iterator for parameters. - * - * @return \ArrayIterator An \ArrayIterator instance - */ - public function getIterator() - { - return new \ArrayIterator($this->parameters); - } - - /** - * Returns the number of parameters. - * - * @return int The number of parameters - */ - public function count() - { - return count($this->parameters); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-foundation/README.md b/sitecake/2.2.9/server/vendor/symfony/http-foundation/README.md deleted file mode 100644 index 11ad6ee..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-foundation/README.md +++ /dev/null @@ -1,56 +0,0 @@ -HttpFoundation Component -======================== - -HttpFoundation defines an object-oriented layer for the HTTP specification. - -It provides an abstraction for requests, responses, uploaded files, cookies, -sessions, ... - -In this example, we get a Request object from the current PHP global -variables: - -```php -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; - -$request = Request::createFromGlobals(); -echo $request->getPathInfo(); -``` - -You can also create a Request directly -- that's interesting for unit testing: - -```php -$request = Request::create('/?foo=bar', 'GET'); -echo $request->getPathInfo(); -``` - -And here is how to create and send a Response: - -```php -$response = new Response('Not Found', 404, array('Content-Type' => 'text/plain')); -$response->send(); -``` - -The Request and the Response classes have many other methods that implement -the HTTP specification. - -Loading -------- - -If you are not using Composer but are using PHP 5.3.x, you must add the following to your autoloader: - -```php -// SessionHandlerInterface -if (!interface_exists('SessionHandlerInterface')) { - $loader->registerPrefixFallback(__DIR__.'/../vendor/symfony/src/Symfony/Component/HttpFoundation/Resources/stubs'); -} -``` - -Resources ---------- - -You can run the unit tests with the following command: - - $ cd path/to/Symfony/Component/HttpFoundation/ - $ composer install - $ phpunit diff --git a/sitecake/2.2.9/server/vendor/symfony/http-foundation/RedirectResponse.php b/sitecake/2.2.9/server/vendor/symfony/http-foundation/RedirectResponse.php deleted file mode 100644 index 5dc0b9e..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-foundation/RedirectResponse.php +++ /dev/null @@ -1,106 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation; - -/** - * RedirectResponse represents an HTTP response doing a redirect. - * - * @author Fabien Potencier - * - * @api - */ -class RedirectResponse extends Response -{ - protected $targetUrl; - - /** - * Creates a redirect response so that it conforms to the rules defined for a redirect status code. - * - * @param string $url The URL to redirect to - * @param int $status The status code (302 by default) - * @param array $headers The headers (Location is always set to the given URL) - * - * @throws \InvalidArgumentException - * - * @see http://tools.ietf.org/html/rfc2616#section-10.3 - * - * @api - */ - public function __construct($url, $status = 302, $headers = array()) - { - if (empty($url)) { - throw new \InvalidArgumentException('Cannot redirect to an empty URL.'); - } - - parent::__construct('', $status, $headers); - - $this->setTargetUrl($url); - - if (!$this->isRedirect()) { - throw new \InvalidArgumentException(sprintf('The HTTP status code is not a redirect ("%s" given).', $status)); - } - } - - /** - * {@inheritdoc} - */ - public static function create($url = '', $status = 302, $headers = array()) - { - return new static($url, $status, $headers); - } - - /** - * Returns the target URL. - * - * @return string target URL - */ - public function getTargetUrl() - { - return $this->targetUrl; - } - - /** - * Sets the redirect target of this response. - * - * @param string $url The URL to redirect to - * - * @return RedirectResponse The current response. - * - * @throws \InvalidArgumentException - */ - public function setTargetUrl($url) - { - if (empty($url)) { - throw new \InvalidArgumentException('Cannot redirect to an empty URL.'); - } - - $this->targetUrl = $url; - - $this->setContent( - sprintf(' - - - - - - Redirecting to %1$s - - - Redirecting to %1$s. - -', htmlspecialchars($url, ENT_QUOTES, 'UTF-8'))); - - $this->headers->set('Location', $url); - - return $this; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-foundation/Request.php b/sitecake/2.2.9/server/vendor/symfony/http-foundation/Request.php deleted file mode 100644 index c2b7640..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-foundation/Request.php +++ /dev/null @@ -1,1989 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation; - -use Symfony\Component\HttpFoundation\Session\SessionInterface; - -/** - * Request represents an HTTP request. - * - * The methods dealing with URL accept / return a raw path (% encoded): - * * getBasePath - * * getBaseUrl - * * getPathInfo - * * getRequestUri - * * getUri - * * getUriForPath - * - * @author Fabien Potencier - * - * @api - */ -class Request -{ - const HEADER_FORWARDED = 'forwarded'; - const HEADER_CLIENT_IP = 'client_ip'; - const HEADER_CLIENT_HOST = 'client_host'; - const HEADER_CLIENT_PROTO = 'client_proto'; - const HEADER_CLIENT_PORT = 'client_port'; - - const METHOD_HEAD = 'HEAD'; - const METHOD_GET = 'GET'; - const METHOD_POST = 'POST'; - const METHOD_PUT = 'PUT'; - const METHOD_PATCH = 'PATCH'; - const METHOD_DELETE = 'DELETE'; - const METHOD_PURGE = 'PURGE'; - const METHOD_OPTIONS = 'OPTIONS'; - const METHOD_TRACE = 'TRACE'; - const METHOD_CONNECT = 'CONNECT'; - - /** - * @var string[] - */ - protected static $trustedProxies = array(); - - /** - * @var string[] - */ - protected static $trustedHostPatterns = array(); - - /** - * @var string[] - */ - protected static $trustedHosts = array(); - - /** - * Names for headers that can be trusted when - * using trusted proxies. - * - * The FORWARDED header is the standard as of rfc7239. - * - * The other headers are non-standard, but widely used - * by popular reverse proxies (like Apache mod_proxy or Amazon EC2). - */ - protected static $trustedHeaders = array( - self::HEADER_FORWARDED => 'FORWARDED', - self::HEADER_CLIENT_IP => 'X_FORWARDED_FOR', - self::HEADER_CLIENT_HOST => 'X_FORWARDED_HOST', - self::HEADER_CLIENT_PROTO => 'X_FORWARDED_PROTO', - self::HEADER_CLIENT_PORT => 'X_FORWARDED_PORT', - ); - - protected static $httpMethodParameterOverride = false; - - /** - * Custom parameters. - * - * @var \Symfony\Component\HttpFoundation\ParameterBag - * - * @api - */ - public $attributes; - - /** - * Request body parameters ($_POST). - * - * @var \Symfony\Component\HttpFoundation\ParameterBag - * - * @api - */ - public $request; - - /** - * Query string parameters ($_GET). - * - * @var \Symfony\Component\HttpFoundation\ParameterBag - * - * @api - */ - public $query; - - /** - * Server and execution environment parameters ($_SERVER). - * - * @var \Symfony\Component\HttpFoundation\ServerBag - * - * @api - */ - public $server; - - /** - * Uploaded files ($_FILES). - * - * @var \Symfony\Component\HttpFoundation\FileBag - * - * @api - */ - public $files; - - /** - * Cookies ($_COOKIE). - * - * @var \Symfony\Component\HttpFoundation\ParameterBag - * - * @api - */ - public $cookies; - - /** - * Headers (taken from the $_SERVER). - * - * @var \Symfony\Component\HttpFoundation\HeaderBag - * - * @api - */ - public $headers; - - /** - * @var string - */ - protected $content; - - /** - * @var array - */ - protected $languages; - - /** - * @var array - */ - protected $charsets; - - /** - * @var array - */ - protected $encodings; - - /** - * @var array - */ - protected $acceptableContentTypes; - - /** - * @var string - */ - protected $pathInfo; - - /** - * @var string - */ - protected $requestUri; - - /** - * @var string - */ - protected $baseUrl; - - /** - * @var string - */ - protected $basePath; - - /** - * @var string - */ - protected $method; - - /** - * @var string - */ - protected $format; - - /** - * @var \Symfony\Component\HttpFoundation\Session\SessionInterface - */ - protected $session; - - /** - * @var string - */ - protected $locale; - - /** - * @var string - */ - protected $defaultLocale = 'en'; - - /** - * @var array - */ - protected static $formats; - - protected static $requestFactory; - - /** - * Constructor. - * - * @param array $query The GET parameters - * @param array $request The POST parameters - * @param array $attributes The request attributes (parameters parsed from the PATH_INFO, ...) - * @param array $cookies The COOKIE parameters - * @param array $files The FILES parameters - * @param array $server The SERVER parameters - * @param string $content The raw body data - * - * @api - */ - public function __construct(array $query = array(), array $request = array(), array $attributes = array(), array $cookies = array(), array $files = array(), array $server = array(), $content = null) - { - $this->initialize($query, $request, $attributes, $cookies, $files, $server, $content); - } - - /** - * Sets the parameters for this request. - * - * This method also re-initializes all properties. - * - * @param array $query The GET parameters - * @param array $request The POST parameters - * @param array $attributes The request attributes (parameters parsed from the PATH_INFO, ...) - * @param array $cookies The COOKIE parameters - * @param array $files The FILES parameters - * @param array $server The SERVER parameters - * @param string $content The raw body data - * - * @api - */ - public function initialize(array $query = array(), array $request = array(), array $attributes = array(), array $cookies = array(), array $files = array(), array $server = array(), $content = null) - { - $this->request = new ParameterBag($request); - $this->query = new ParameterBag($query); - $this->attributes = new ParameterBag($attributes); - $this->cookies = new ParameterBag($cookies); - $this->files = new FileBag($files); - $this->server = new ServerBag($server); - $this->headers = new HeaderBag($this->server->getHeaders()); - - $this->content = $content; - $this->languages = null; - $this->charsets = null; - $this->encodings = null; - $this->acceptableContentTypes = null; - $this->pathInfo = null; - $this->requestUri = null; - $this->baseUrl = null; - $this->basePath = null; - $this->method = null; - $this->format = null; - } - - /** - * Creates a new request with values from PHP's super globals. - * - * @return Request A new request - * - * @api - */ - public static function createFromGlobals() - { - // With the php's bug #66606, the php's built-in web server - // stores the Content-Type and Content-Length header values in - // HTTP_CONTENT_TYPE and HTTP_CONTENT_LENGTH fields. - $server = $_SERVER; - if ('cli-server' === php_sapi_name()) { - if (array_key_exists('HTTP_CONTENT_LENGTH', $_SERVER)) { - $server['CONTENT_LENGTH'] = $_SERVER['HTTP_CONTENT_LENGTH']; - } - if (array_key_exists('HTTP_CONTENT_TYPE', $_SERVER)) { - $server['CONTENT_TYPE'] = $_SERVER['HTTP_CONTENT_TYPE']; - } - } - - $request = self::createRequestFromFactory($_GET, $_POST, array(), $_COOKIE, $_FILES, $server); - - if (0 === strpos($request->headers->get('CONTENT_TYPE'), 'application/x-www-form-urlencoded') - && in_array(strtoupper($request->server->get('REQUEST_METHOD', 'GET')), array('PUT', 'DELETE', 'PATCH')) - ) { - parse_str($request->getContent(), $data); - $request->request = new ParameterBag($data); - } - - return $request; - } - - /** - * Creates a Request based on a given URI and configuration. - * - * The information contained in the URI always take precedence - * over the other information (server and parameters). - * - * @param string $uri The URI - * @param string $method The HTTP method - * @param array $parameters The query (GET) or request (POST) parameters - * @param array $cookies The request cookies ($_COOKIE) - * @param array $files The request files ($_FILES) - * @param array $server The server parameters ($_SERVER) - * @param string $content The raw body data - * - * @return Request A Request instance - * - * @api - */ - public static function create($uri, $method = 'GET', $parameters = array(), $cookies = array(), $files = array(), $server = array(), $content = null) - { - $server = array_replace(array( - 'SERVER_NAME' => 'localhost', - 'SERVER_PORT' => 80, - 'HTTP_HOST' => 'localhost', - 'HTTP_USER_AGENT' => 'Symfony/2.X', - 'HTTP_ACCEPT' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', - 'HTTP_ACCEPT_LANGUAGE' => 'en-us,en;q=0.5', - 'HTTP_ACCEPT_CHARSET' => 'ISO-8859-1,utf-8;q=0.7,*;q=0.7', - 'REMOTE_ADDR' => '127.0.0.1', - 'SCRIPT_NAME' => '', - 'SCRIPT_FILENAME' => '', - 'SERVER_PROTOCOL' => 'HTTP/1.1', - 'REQUEST_TIME' => time(), - ), $server); - - $server['PATH_INFO'] = ''; - $server['REQUEST_METHOD'] = strtoupper($method); - - $components = parse_url($uri); - if (isset($components['host'])) { - $server['SERVER_NAME'] = $components['host']; - $server['HTTP_HOST'] = $components['host']; - } - - if (isset($components['scheme'])) { - if ('https' === $components['scheme']) { - $server['HTTPS'] = 'on'; - $server['SERVER_PORT'] = 443; - } else { - unset($server['HTTPS']); - $server['SERVER_PORT'] = 80; - } - } - - if (isset($components['port'])) { - $server['SERVER_PORT'] = $components['port']; - $server['HTTP_HOST'] = $server['HTTP_HOST'].':'.$components['port']; - } - - if (isset($components['user'])) { - $server['PHP_AUTH_USER'] = $components['user']; - } - - if (isset($components['pass'])) { - $server['PHP_AUTH_PW'] = $components['pass']; - } - - if (!isset($components['path'])) { - $components['path'] = '/'; - } - - switch (strtoupper($method)) { - case 'POST': - case 'PUT': - case 'DELETE': - if (!isset($server['CONTENT_TYPE'])) { - $server['CONTENT_TYPE'] = 'application/x-www-form-urlencoded'; - } - // no break - case 'PATCH': - $request = $parameters; - $query = array(); - break; - default: - $request = array(); - $query = $parameters; - break; - } - - $queryString = ''; - if (isset($components['query'])) { - parse_str(html_entity_decode($components['query']), $qs); - - if ($query) { - $query = array_replace($qs, $query); - $queryString = http_build_query($query, '', '&'); - } else { - $query = $qs; - $queryString = $components['query']; - } - } elseif ($query) { - $queryString = http_build_query($query, '', '&'); - } - - $server['REQUEST_URI'] = $components['path'].('' !== $queryString ? '?'.$queryString : ''); - $server['QUERY_STRING'] = $queryString; - - return self::createRequestFromFactory($query, $request, array(), $cookies, $files, $server, $content); - } - - /** - * Sets a callable able to create a Request instance. - * - * This is mainly useful when you need to override the Request class - * to keep BC with an existing system. It should not be used for any - * other purpose. - * - * @param callable|null $callable A PHP callable - */ - public static function setFactory($callable) - { - self::$requestFactory = $callable; - } - - /** - * Clones a request and overrides some of its parameters. - * - * @param array $query The GET parameters - * @param array $request The POST parameters - * @param array $attributes The request attributes (parameters parsed from the PATH_INFO, ...) - * @param array $cookies The COOKIE parameters - * @param array $files The FILES parameters - * @param array $server The SERVER parameters - * - * @return Request The duplicated request - * - * @api - */ - public function duplicate(array $query = null, array $request = null, array $attributes = null, array $cookies = null, array $files = null, array $server = null) - { - $dup = clone $this; - if ($query !== null) { - $dup->query = new ParameterBag($query); - } - if ($request !== null) { - $dup->request = new ParameterBag($request); - } - if ($attributes !== null) { - $dup->attributes = new ParameterBag($attributes); - } - if ($cookies !== null) { - $dup->cookies = new ParameterBag($cookies); - } - if ($files !== null) { - $dup->files = new FileBag($files); - } - if ($server !== null) { - $dup->server = new ServerBag($server); - $dup->headers = new HeaderBag($dup->server->getHeaders()); - } - $dup->languages = null; - $dup->charsets = null; - $dup->encodings = null; - $dup->acceptableContentTypes = null; - $dup->pathInfo = null; - $dup->requestUri = null; - $dup->baseUrl = null; - $dup->basePath = null; - $dup->method = null; - $dup->format = null; - - if (!$dup->get('_format') && $this->get('_format')) { - $dup->attributes->set('_format', $this->get('_format')); - } - - if (!$dup->getRequestFormat(null)) { - $dup->setRequestFormat($this->getRequestFormat(null)); - } - - return $dup; - } - - /** - * Clones the current request. - * - * Note that the session is not cloned as duplicated requests - * are most of the time sub-requests of the main one. - */ - public function __clone() - { - $this->query = clone $this->query; - $this->request = clone $this->request; - $this->attributes = clone $this->attributes; - $this->cookies = clone $this->cookies; - $this->files = clone $this->files; - $this->server = clone $this->server; - $this->headers = clone $this->headers; - } - - /** - * Returns the request as a string. - * - * @return string The request - */ - public function __toString() - { - return - sprintf('%s %s %s', $this->getMethod(), $this->getRequestUri(), $this->server->get('SERVER_PROTOCOL'))."\r\n". - $this->headers."\r\n". - $this->getContent(); - } - - /** - * Overrides the PHP global variables according to this request instance. - * - * It overrides $_GET, $_POST, $_REQUEST, $_SERVER, $_COOKIE. - * $_FILES is never overridden, see rfc1867 - * - * @api - */ - public function overrideGlobals() - { - $this->server->set('QUERY_STRING', static::normalizeQueryString(http_build_query($this->query->all(), null, '&'))); - - $_GET = $this->query->all(); - $_POST = $this->request->all(); - $_SERVER = $this->server->all(); - $_COOKIE = $this->cookies->all(); - - foreach ($this->headers->all() as $key => $value) { - $key = strtoupper(str_replace('-', '_', $key)); - if (in_array($key, array('CONTENT_TYPE', 'CONTENT_LENGTH'))) { - $_SERVER[$key] = implode(', ', $value); - } else { - $_SERVER['HTTP_'.$key] = implode(', ', $value); - } - } - - $request = array('g' => $_GET, 'p' => $_POST, 'c' => $_COOKIE); - - $requestOrder = ini_get('request_order') ?: ini_get('variables_order'); - $requestOrder = preg_replace('#[^cgp]#', '', strtolower($requestOrder)) ?: 'gp'; - - $_REQUEST = array(); - foreach (str_split($requestOrder) as $order) { - $_REQUEST = array_merge($_REQUEST, $request[$order]); - } - } - - /** - * Sets a list of trusted proxies. - * - * You should only list the reverse proxies that you manage directly. - * - * @param array $proxies A list of trusted proxies - * - * @api - */ - public static function setTrustedProxies(array $proxies) - { - self::$trustedProxies = $proxies; - } - - /** - * Gets the list of trusted proxies. - * - * @return array An array of trusted proxies. - */ - public static function getTrustedProxies() - { - return self::$trustedProxies; - } - - /** - * Sets a list of trusted host patterns. - * - * You should only list the hosts you manage using regexs. - * - * @param array $hostPatterns A list of trusted host patterns - */ - public static function setTrustedHosts(array $hostPatterns) - { - self::$trustedHostPatterns = array_map(function ($hostPattern) { - return sprintf('#%s#i', $hostPattern); - }, $hostPatterns); - // we need to reset trusted hosts on trusted host patterns change - self::$trustedHosts = array(); - } - - /** - * Gets the list of trusted host patterns. - * - * @return array An array of trusted host patterns. - */ - public static function getTrustedHosts() - { - return self::$trustedHostPatterns; - } - - /** - * Sets the name for trusted headers. - * - * The following header keys are supported: - * - * * Request::HEADER_CLIENT_IP: defaults to X-Forwarded-For (see getClientIp()) - * * Request::HEADER_CLIENT_HOST: defaults to X-Forwarded-Host (see getHost()) - * * Request::HEADER_CLIENT_PORT: defaults to X-Forwarded-Port (see getPort()) - * * Request::HEADER_CLIENT_PROTO: defaults to X-Forwarded-Proto (see getScheme() and isSecure()) - * - * Setting an empty value allows to disable the trusted header for the given key. - * - * @param string $key The header key - * @param string $value The header name - * - * @throws \InvalidArgumentException - */ - public static function setTrustedHeaderName($key, $value) - { - if (!array_key_exists($key, self::$trustedHeaders)) { - throw new \InvalidArgumentException(sprintf('Unable to set the trusted header name for key "%s".', $key)); - } - - self::$trustedHeaders[$key] = $value; - } - - /** - * Gets the trusted proxy header name. - * - * @param string $key The header key - * - * @return string The header name - * - * @throws \InvalidArgumentException - */ - public static function getTrustedHeaderName($key) - { - if (!array_key_exists($key, self::$trustedHeaders)) { - throw new \InvalidArgumentException(sprintf('Unable to get the trusted header name for key "%s".', $key)); - } - - return self::$trustedHeaders[$key]; - } - - /** - * Normalizes a query string. - * - * It builds a normalized query string, where keys/value pairs are alphabetized, - * have consistent escaping and unneeded delimiters are removed. - * - * @param string $qs Query string - * - * @return string A normalized query string for the Request - */ - public static function normalizeQueryString($qs) - { - if ('' == $qs) { - return ''; - } - - $parts = array(); - $order = array(); - - foreach (explode('&', $qs) as $param) { - if ('' === $param || '=' === $param[0]) { - // Ignore useless delimiters, e.g. "x=y&". - // Also ignore pairs with empty key, even if there was a value, e.g. "=value", as such nameless values cannot be retrieved anyway. - // PHP also does not include them when building _GET. - continue; - } - - $keyValuePair = explode('=', $param, 2); - - // GET parameters, that are submitted from a HTML form, encode spaces as "+" by default (as defined in enctype application/x-www-form-urlencoded). - // PHP also converts "+" to spaces when filling the global _GET or when using the function parse_str. This is why we use urldecode and then normalize to - // RFC 3986 with rawurlencode. - $parts[] = isset($keyValuePair[1]) ? - rawurlencode(urldecode($keyValuePair[0])).'='.rawurlencode(urldecode($keyValuePair[1])) : - rawurlencode(urldecode($keyValuePair[0])); - $order[] = urldecode($keyValuePair[0]); - } - - array_multisort($order, SORT_ASC, $parts); - - return implode('&', $parts); - } - - /** - * Enables support for the _method request parameter to determine the intended HTTP method. - * - * Be warned that enabling this feature might lead to CSRF issues in your code. - * Check that you are using CSRF tokens when required. - * If the HTTP method parameter override is enabled, an html-form with method "POST" can be altered - * and used to send a "PUT" or "DELETE" request via the _method request parameter. - * If these methods are not protected against CSRF, this presents a possible vulnerability. - * - * The HTTP method can only be overridden when the real HTTP method is POST. - */ - public static function enableHttpMethodParameterOverride() - { - self::$httpMethodParameterOverride = true; - } - - /** - * Checks whether support for the _method request parameter is enabled. - * - * @return bool True when the _method request parameter is enabled, false otherwise - */ - public static function getHttpMethodParameterOverride() - { - return self::$httpMethodParameterOverride; - } - - /** - * Gets a "parameter" value. - * - * This method is mainly useful for libraries that want to provide some flexibility. - * - * Order of precedence: GET, PATH, POST - * - * Avoid using this method in controllers: - * - * * slow - * * prefer to get from a "named" source - * - * It is better to explicitly get request parameters from the appropriate - * public property instead (query, attributes, request). - * - * @param string $key the key - * @param mixed $default the default value - * @param bool $deep is parameter deep in multidimensional array - * - * @return mixed - */ - public function get($key, $default = null, $deep = false) - { - if ($this !== $result = $this->query->get($key, $this, $deep)) { - return $result; - } - - if ($this !== $result = $this->attributes->get($key, $this, $deep)) { - return $result; - } - - if ($this !== $result = $this->request->get($key, $this, $deep)) { - return $result; - } - - return $default; - } - - /** - * Gets the Session. - * - * @return SessionInterface|null The session - * - * @api - */ - public function getSession() - { - return $this->session; - } - - /** - * Whether the request contains a Session which was started in one of the - * previous requests. - * - * @return bool - * - * @api - */ - public function hasPreviousSession() - { - // the check for $this->session avoids malicious users trying to fake a session cookie with proper name - return $this->hasSession() && $this->cookies->has($this->session->getName()); - } - - /** - * Whether the request contains a Session object. - * - * This method does not give any information about the state of the session object, - * like whether the session is started or not. It is just a way to check if this Request - * is associated with a Session instance. - * - * @return bool true when the Request contains a Session object, false otherwise - * - * @api - */ - public function hasSession() - { - return null !== $this->session; - } - - /** - * Sets the Session. - * - * @param SessionInterface $session The Session - * - * @api - */ - public function setSession(SessionInterface $session) - { - $this->session = $session; - } - - /** - * Returns the client IP addresses. - * - * In the returned array the most trusted IP address is first, and the - * least trusted one last. The "real" client IP address is the last one, - * but this is also the least trusted one. Trusted proxies are stripped. - * - * Use this method carefully; you should use getClientIp() instead. - * - * @return array The client IP addresses - * - * @see getClientIp() - */ - public function getClientIps() - { - $clientIps = array(); - $ip = $this->server->get('REMOTE_ADDR'); - - if (!$this->isFromTrustedProxy()) { - return array($ip); - } - - if (self::$trustedHeaders[self::HEADER_FORWARDED] && $this->headers->has(self::$trustedHeaders[self::HEADER_FORWARDED])) { - $forwardedHeader = $this->headers->get(self::$trustedHeaders[self::HEADER_FORWARDED]); - preg_match_all('{(for)=("?\[?)([a-z0-9\.:_\-/]*)}', $forwardedHeader, $matches); - $clientIps = $matches[3]; - } elseif (self::$trustedHeaders[self::HEADER_CLIENT_IP] && $this->headers->has(self::$trustedHeaders[self::HEADER_CLIENT_IP])) { - $clientIps = array_map('trim', explode(',', $this->headers->get(self::$trustedHeaders[self::HEADER_CLIENT_IP]))); - } - - $clientIps[] = $ip; // Complete the IP chain with the IP the request actually came from - $ip = $clientIps[0]; // Fallback to this when the client IP falls into the range of trusted proxies - - foreach ($clientIps as $key => $clientIp) { - // Remove port (unfortunately, it does happen) - if (preg_match('{((?:\d+\.){3}\d+)\:\d+}', $clientIp, $match)) { - $clientIps[$key] = $clientIp = $match[1]; - } - - if (IpUtils::checkIp($clientIp, self::$trustedProxies)) { - unset($clientIps[$key]); - } - } - - // Now the IP chain contains only untrusted proxies and the client IP - return $clientIps ? array_reverse($clientIps) : array($ip); - } - - /** - * Returns the client IP address. - * - * This method can read the client IP address from the "X-Forwarded-For" header - * when trusted proxies were set via "setTrustedProxies()". The "X-Forwarded-For" - * header value is a comma+space separated list of IP addresses, the left-most - * being the original client, and each successive proxy that passed the request - * adding the IP address where it received the request from. - * - * If your reverse proxy uses a different header name than "X-Forwarded-For", - * ("Client-Ip" for instance), configure it via "setTrustedHeaderName()" with - * the "client-ip" key. - * - * @return string The client IP address - * - * @see getClientIps() - * @see http://en.wikipedia.org/wiki/X-Forwarded-For - * - * @api - */ - public function getClientIp() - { - $ipAddresses = $this->getClientIps(); - - return $ipAddresses[0]; - } - - /** - * Returns current script name. - * - * @return string - * - * @api - */ - public function getScriptName() - { - return $this->server->get('SCRIPT_NAME', $this->server->get('ORIG_SCRIPT_NAME', '')); - } - - /** - * Returns the path being requested relative to the executed script. - * - * The path info always starts with a /. - * - * Suppose this request is instantiated from /mysite on localhost: - * - * * http://localhost/mysite returns an empty string - * * http://localhost/mysite/about returns '/about' - * * http://localhost/mysite/enco%20ded returns '/enco%20ded' - * * http://localhost/mysite/about?var=1 returns '/about' - * - * @return string The raw path (i.e. not urldecoded) - * - * @api - */ - public function getPathInfo() - { - if (null === $this->pathInfo) { - $this->pathInfo = $this->preparePathInfo(); - } - - return $this->pathInfo; - } - - /** - * Returns the root path from which this request is executed. - * - * Suppose that an index.php file instantiates this request object: - * - * * http://localhost/index.php returns an empty string - * * http://localhost/index.php/page returns an empty string - * * http://localhost/web/index.php returns '/web' - * * http://localhost/we%20b/index.php returns '/we%20b' - * - * @return string The raw path (i.e. not urldecoded) - * - * @api - */ - public function getBasePath() - { - if (null === $this->basePath) { - $this->basePath = $this->prepareBasePath(); - } - - return $this->basePath; - } - - /** - * Returns the root URL from which this request is executed. - * - * The base URL never ends with a /. - * - * This is similar to getBasePath(), except that it also includes the - * script filename (e.g. index.php) if one exists. - * - * @return string The raw URL (i.e. not urldecoded) - * - * @api - */ - public function getBaseUrl() - { - if (null === $this->baseUrl) { - $this->baseUrl = $this->prepareBaseUrl(); - } - - return $this->baseUrl; - } - - /** - * Gets the request's scheme. - * - * @return string - * - * @api - */ - public function getScheme() - { - return $this->isSecure() ? 'https' : 'http'; - } - - /** - * Returns the port on which the request is made. - * - * This method can read the client port from the "X-Forwarded-Port" header - * when trusted proxies were set via "setTrustedProxies()". - * - * The "X-Forwarded-Port" header must contain the client port. - * - * If your reverse proxy uses a different header name than "X-Forwarded-Port", - * configure it via "setTrustedHeaderName()" with the "client-port" key. - * - * @return string - * - * @api - */ - public function getPort() - { - if ($this->isFromTrustedProxy()) { - if (self::$trustedHeaders[self::HEADER_CLIENT_PORT] && $port = $this->headers->get(self::$trustedHeaders[self::HEADER_CLIENT_PORT])) { - return $port; - } - - if (self::$trustedHeaders[self::HEADER_CLIENT_PROTO] && 'https' === $this->headers->get(self::$trustedHeaders[self::HEADER_CLIENT_PROTO], 'http')) { - return 443; - } - } - - if ($host = $this->headers->get('HOST')) { - if ($host[0] === '[') { - $pos = strpos($host, ':', strrpos($host, ']')); - } else { - $pos = strrpos($host, ':'); - } - - if (false !== $pos) { - return (int) substr($host, $pos + 1); - } - - return 'https' === $this->getScheme() ? 443 : 80; - } - - return $this->server->get('SERVER_PORT'); - } - - /** - * Returns the user. - * - * @return string|null - */ - public function getUser() - { - return $this->headers->get('PHP_AUTH_USER'); - } - - /** - * Returns the password. - * - * @return string|null - */ - public function getPassword() - { - return $this->headers->get('PHP_AUTH_PW'); - } - - /** - * Gets the user info. - * - * @return string A user name and, optionally, scheme-specific information about how to gain authorization to access the server - */ - public function getUserInfo() - { - $userinfo = $this->getUser(); - - $pass = $this->getPassword(); - if ('' != $pass) { - $userinfo .= ":$pass"; - } - - return $userinfo; - } - - /** - * Returns the HTTP host being requested. - * - * The port name will be appended to the host if it's non-standard. - * - * @return string - * - * @api - */ - public function getHttpHost() - { - $scheme = $this->getScheme(); - $port = $this->getPort(); - - if (('http' == $scheme && $port == 80) || ('https' == $scheme && $port == 443)) { - return $this->getHost(); - } - - return $this->getHost().':'.$port; - } - - /** - * Returns the requested URI (path and query string). - * - * @return string The raw URI (i.e. not URI decoded) - * - * @api - */ - public function getRequestUri() - { - if (null === $this->requestUri) { - $this->requestUri = $this->prepareRequestUri(); - } - - return $this->requestUri; - } - - /** - * Gets the scheme and HTTP host. - * - * If the URL was called with basic authentication, the user - * and the password are not added to the generated string. - * - * @return string The scheme and HTTP host - */ - public function getSchemeAndHttpHost() - { - return $this->getScheme().'://'.$this->getHttpHost(); - } - - /** - * Generates a normalized URI (URL) for the Request. - * - * @return string A normalized URI (URL) for the Request - * - * @see getQueryString() - * - * @api - */ - public function getUri() - { - if (null !== $qs = $this->getQueryString()) { - $qs = '?'.$qs; - } - - return $this->getSchemeAndHttpHost().$this->getBaseUrl().$this->getPathInfo().$qs; - } - - /** - * Generates a normalized URI for the given path. - * - * @param string $path A path to use instead of the current one - * - * @return string The normalized URI for the path - * - * @api - */ - public function getUriForPath($path) - { - return $this->getSchemeAndHttpHost().$this->getBaseUrl().$path; - } - - /** - * Returns the path as relative reference from the current Request path. - * - * Only the URIs path component (no schema, host etc.) is relevant and must be given. - * Both paths must be absolute and not contain relative parts. - * Relative URLs from one resource to another are useful when generating self-contained downloadable document archives. - * Furthermore, they can be used to reduce the link size in documents. - * - * Example target paths, given a base path of "/a/b/c/d": - * - "/a/b/c/d" -> "" - * - "/a/b/c/" -> "./" - * - "/a/b/" -> "../" - * - "/a/b/c/other" -> "other" - * - "/a/x/y" -> "../../x/y" - * - * @param string $path The target path - * - * @return string The relative target path - */ - public function getRelativeUriForPath($path) - { - // be sure that we are dealing with an absolute path - if (!isset($path[0]) || '/' !== $path[0]) { - return $path; - } - - if ($path === $basePath = $this->getPathInfo()) { - return ''; - } - - $sourceDirs = explode('/', isset($basePath[0]) && '/' === $basePath[0] ? substr($basePath, 1) : $basePath); - $targetDirs = explode('/', isset($path[0]) && '/' === $path[0] ? substr($path, 1) : $path); - array_pop($sourceDirs); - $targetFile = array_pop($targetDirs); - - foreach ($sourceDirs as $i => $dir) { - if (isset($targetDirs[$i]) && $dir === $targetDirs[$i]) { - unset($sourceDirs[$i], $targetDirs[$i]); - } else { - break; - } - } - - $targetDirs[] = $targetFile; - $path = str_repeat('../', count($sourceDirs)).implode('/', $targetDirs); - - // A reference to the same base directory or an empty subdirectory must be prefixed with "./". - // This also applies to a segment with a colon character (e.g., "file:colon") that cannot be used - // as the first segment of a relative-path reference, as it would be mistaken for a scheme name - // (see http://tools.ietf.org/html/rfc3986#section-4.2). - return !isset($path[0]) || '/' === $path[0] - || false !== ($colonPos = strpos($path, ':')) && ($colonPos < ($slashPos = strpos($path, '/')) || false === $slashPos) - ? "./$path" : $path; - } - - /** - * Generates the normalized query string for the Request. - * - * It builds a normalized query string, where keys/value pairs are alphabetized - * and have consistent escaping. - * - * @return string|null A normalized query string for the Request - * - * @api - */ - public function getQueryString() - { - $qs = static::normalizeQueryString($this->server->get('QUERY_STRING')); - - return '' === $qs ? null : $qs; - } - - /** - * Checks whether the request is secure or not. - * - * This method can read the client port from the "X-Forwarded-Proto" header - * when trusted proxies were set via "setTrustedProxies()". - * - * The "X-Forwarded-Proto" header must contain the protocol: "https" or "http". - * - * If your reverse proxy uses a different header name than "X-Forwarded-Proto" - * ("SSL_HTTPS" for instance), configure it via "setTrustedHeaderName()" with - * the "client-proto" key. - * - * @return bool - * - * @api - */ - public function isSecure() - { - if ($this->isFromTrustedProxy() && self::$trustedHeaders[self::HEADER_CLIENT_PROTO] && $proto = $this->headers->get(self::$trustedHeaders[self::HEADER_CLIENT_PROTO])) { - return in_array(strtolower(current(explode(',', $proto))), array('https', 'on', 'ssl', '1')); - } - - $https = $this->server->get('HTTPS'); - - return !empty($https) && 'off' !== strtolower($https); - } - - /** - * Returns the host name. - * - * This method can read the client port from the "X-Forwarded-Host" header - * when trusted proxies were set via "setTrustedProxies()". - * - * The "X-Forwarded-Host" header must contain the client host name. - * - * If your reverse proxy uses a different header name than "X-Forwarded-Host", - * configure it via "setTrustedHeaderName()" with the "client-host" key. - * - * @return string - * - * @throws \UnexpectedValueException when the host name is invalid - * - * @api - */ - public function getHost() - { - if ($this->isFromTrustedProxy() && self::$trustedHeaders[self::HEADER_CLIENT_HOST] && $host = $this->headers->get(self::$trustedHeaders[self::HEADER_CLIENT_HOST])) { - $elements = explode(',', $host); - - $host = $elements[count($elements) - 1]; - } elseif (!$host = $this->headers->get('HOST')) { - if (!$host = $this->server->get('SERVER_NAME')) { - $host = $this->server->get('SERVER_ADDR', ''); - } - } - - // trim and remove port number from host - // host is lowercase as per RFC 952/2181 - $host = strtolower(preg_replace('/:\d+$/', '', trim($host))); - - // as the host can come from the user (HTTP_HOST and depending on the configuration, SERVER_NAME too can come from the user) - // check that it does not contain forbidden characters (see RFC 952 and RFC 2181) - // use preg_replace() instead of preg_match() to prevent DoS attacks with long host names - if ($host && '' !== preg_replace('/(?:^\[)?[a-zA-Z0-9-:\]_]+\.?/', '', $host)) { - throw new \UnexpectedValueException(sprintf('Invalid Host "%s"', $host)); - } - - if (count(self::$trustedHostPatterns) > 0) { - // to avoid host header injection attacks, you should provide a list of trusted host patterns - - if (in_array($host, self::$trustedHosts)) { - return $host; - } - - foreach (self::$trustedHostPatterns as $pattern) { - if (preg_match($pattern, $host)) { - self::$trustedHosts[] = $host; - - return $host; - } - } - - throw new \UnexpectedValueException(sprintf('Untrusted Host "%s"', $host)); - } - - return $host; - } - - /** - * Sets the request method. - * - * @param string $method - * - * @api - */ - public function setMethod($method) - { - $this->method = null; - $this->server->set('REQUEST_METHOD', $method); - } - - /** - * Gets the request "intended" method. - * - * If the X-HTTP-Method-Override header is set, and if the method is a POST, - * then it is used to determine the "real" intended HTTP method. - * - * The _method request parameter can also be used to determine the HTTP method, - * but only if enableHttpMethodParameterOverride() has been called. - * - * The method is always an uppercased string. - * - * @return string The request method - * - * @api - * - * @see getRealMethod() - */ - public function getMethod() - { - if (null === $this->method) { - $this->method = strtoupper($this->server->get('REQUEST_METHOD', 'GET')); - - if ('POST' === $this->method) { - if ($method = $this->headers->get('X-HTTP-METHOD-OVERRIDE')) { - $this->method = strtoupper($method); - } elseif (self::$httpMethodParameterOverride) { - $this->method = strtoupper($this->request->get('_method', $this->query->get('_method', 'POST'))); - } - } - } - - return $this->method; - } - - /** - * Gets the "real" request method. - * - * @return string The request method - * - * @see getMethod() - */ - public function getRealMethod() - { - return strtoupper($this->server->get('REQUEST_METHOD', 'GET')); - } - - /** - * Gets the mime type associated with the format. - * - * @param string $format The format - * - * @return string The associated mime type (null if not found) - * - * @api - */ - public function getMimeType($format) - { - if (null === static::$formats) { - static::initializeFormats(); - } - - return isset(static::$formats[$format]) ? static::$formats[$format][0] : null; - } - - /** - * Gets the format associated with the mime type. - * - * @param string $mimeType The associated mime type - * - * @return string|null The format (null if not found) - * - * @api - */ - public function getFormat($mimeType) - { - if (false !== $pos = strpos($mimeType, ';')) { - $mimeType = substr($mimeType, 0, $pos); - } - - if (null === static::$formats) { - static::initializeFormats(); - } - - foreach (static::$formats as $format => $mimeTypes) { - if (in_array($mimeType, (array) $mimeTypes)) { - return $format; - } - } - } - - /** - * Associates a format with mime types. - * - * @param string $format The format - * @param string|array $mimeTypes The associated mime types (the preferred one must be the first as it will be used as the content type) - * - * @api - */ - public function setFormat($format, $mimeTypes) - { - if (null === static::$formats) { - static::initializeFormats(); - } - - static::$formats[$format] = is_array($mimeTypes) ? $mimeTypes : array($mimeTypes); - } - - /** - * Gets the request format. - * - * Here is the process to determine the format: - * - * * format defined by the user (with setRequestFormat()) - * * _format request parameter - * * $default - * - * @param string $default The default format - * - * @return string The request format - * - * @api - */ - public function getRequestFormat($default = 'html') - { - if (null === $this->format) { - $this->format = $this->get('_format', $default); - } - - return $this->format; - } - - /** - * Sets the request format. - * - * @param string $format The request format. - * - * @api - */ - public function setRequestFormat($format) - { - $this->format = $format; - } - - /** - * Gets the format associated with the request. - * - * @return string|null The format (null if no content type is present) - * - * @api - */ - public function getContentType() - { - return $this->getFormat($this->headers->get('CONTENT_TYPE')); - } - - /** - * Sets the default locale. - * - * @param string $locale - * - * @api - */ - public function setDefaultLocale($locale) - { - $this->defaultLocale = $locale; - - if (null === $this->locale) { - $this->setPhpDefaultLocale($locale); - } - } - - /** - * Get the default locale. - * - * @return string - */ - public function getDefaultLocale() - { - return $this->defaultLocale; - } - - /** - * Sets the locale. - * - * @param string $locale - * - * @api - */ - public function setLocale($locale) - { - $this->setPhpDefaultLocale($this->locale = $locale); - } - - /** - * Get the locale. - * - * @return string - */ - public function getLocale() - { - return null === $this->locale ? $this->defaultLocale : $this->locale; - } - - /** - * Checks if the request method is of specified type. - * - * @param string $method Uppercase request method (GET, POST etc). - * - * @return bool - */ - public function isMethod($method) - { - return $this->getMethod() === strtoupper($method); - } - - /** - * Checks whether the method is safe or not. - * - * @return bool - * - * @api - */ - public function isMethodSafe() - { - return in_array($this->getMethod(), array('GET', 'HEAD')); - } - - /** - * Returns the request body content. - * - * @param bool $asResource If true, a resource will be returned - * - * @return string|resource The request body content or a resource to read the body stream. - * - * @throws \LogicException - */ - public function getContent($asResource = false) - { - if (PHP_VERSION_ID < 50600 && (false === $this->content || (true === $asResource && null !== $this->content))) { - throw new \LogicException('getContent() can only be called once when using the resource return type and PHP below 5.6.'); - } - - if (true === $asResource) { - $this->content = false; - - return fopen('php://input', 'rb'); - } - - if (null === $this->content) { - $this->content = file_get_contents('php://input'); - } - - return $this->content; - } - - /** - * Gets the Etags. - * - * @return array The entity tags - */ - public function getETags() - { - return preg_split('/\s*,\s*/', $this->headers->get('if_none_match'), null, PREG_SPLIT_NO_EMPTY); - } - - /** - * @return bool - */ - public function isNoCache() - { - return $this->headers->hasCacheControlDirective('no-cache') || 'no-cache' == $this->headers->get('Pragma'); - } - - /** - * Returns the preferred language. - * - * @param array $locales An array of ordered available locales - * - * @return string|null The preferred locale - * - * @api - */ - public function getPreferredLanguage(array $locales = null) - { - $preferredLanguages = $this->getLanguages(); - - if (empty($locales)) { - return isset($preferredLanguages[0]) ? $preferredLanguages[0] : null; - } - - if (!$preferredLanguages) { - return $locales[0]; - } - - $extendedPreferredLanguages = array(); - foreach ($preferredLanguages as $language) { - $extendedPreferredLanguages[] = $language; - if (false !== $position = strpos($language, '_')) { - $superLanguage = substr($language, 0, $position); - if (!in_array($superLanguage, $preferredLanguages)) { - $extendedPreferredLanguages[] = $superLanguage; - } - } - } - - $preferredLanguages = array_values(array_intersect($extendedPreferredLanguages, $locales)); - - return isset($preferredLanguages[0]) ? $preferredLanguages[0] : $locales[0]; - } - - /** - * Gets a list of languages acceptable by the client browser. - * - * @return array Languages ordered in the user browser preferences - * - * @api - */ - public function getLanguages() - { - if (null !== $this->languages) { - return $this->languages; - } - - $languages = AcceptHeader::fromString($this->headers->get('Accept-Language'))->all(); - $this->languages = array(); - foreach ($languages as $lang => $acceptHeaderItem) { - if (false !== strpos($lang, '-')) { - $codes = explode('-', $lang); - if ('i' === $codes[0]) { - // Language not listed in ISO 639 that are not variants - // of any listed language, which can be registered with the - // i-prefix, such as i-cherokee - if (count($codes) > 1) { - $lang = $codes[1]; - } - } else { - for ($i = 0, $max = count($codes); $i < $max; ++$i) { - if ($i === 0) { - $lang = strtolower($codes[0]); - } else { - $lang .= '_'.strtoupper($codes[$i]); - } - } - } - } - - $this->languages[] = $lang; - } - - return $this->languages; - } - - /** - * Gets a list of charsets acceptable by the client browser. - * - * @return array List of charsets in preferable order - * - * @api - */ - public function getCharsets() - { - if (null !== $this->charsets) { - return $this->charsets; - } - - return $this->charsets = array_keys(AcceptHeader::fromString($this->headers->get('Accept-Charset'))->all()); - } - - /** - * Gets a list of encodings acceptable by the client browser. - * - * @return array List of encodings in preferable order - */ - public function getEncodings() - { - if (null !== $this->encodings) { - return $this->encodings; - } - - return $this->encodings = array_keys(AcceptHeader::fromString($this->headers->get('Accept-Encoding'))->all()); - } - - /** - * Gets a list of content types acceptable by the client browser. - * - * @return array List of content types in preferable order - * - * @api - */ - public function getAcceptableContentTypes() - { - if (null !== $this->acceptableContentTypes) { - return $this->acceptableContentTypes; - } - - return $this->acceptableContentTypes = array_keys(AcceptHeader::fromString($this->headers->get('Accept'))->all()); - } - - /** - * Returns true if the request is a XMLHttpRequest. - * - * It works if your JavaScript library sets an X-Requested-With HTTP header. - * It is known to work with common JavaScript frameworks: - * - * @link http://en.wikipedia.org/wiki/List_of_Ajax_frameworks#JavaScript - * - * @return bool true if the request is an XMLHttpRequest, false otherwise - * - * @api - */ - public function isXmlHttpRequest() - { - return 'XMLHttpRequest' == $this->headers->get('X-Requested-With'); - } - - /* - * The following methods are derived from code of the Zend Framework (1.10dev - 2010-01-24) - * - * Code subject to the new BSD license (http://framework.zend.com/license/new-bsd). - * - * Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - */ - - protected function prepareRequestUri() - { - $requestUri = ''; - - if ($this->headers->has('X_ORIGINAL_URL')) { - // IIS with Microsoft Rewrite Module - $requestUri = $this->headers->get('X_ORIGINAL_URL'); - $this->headers->remove('X_ORIGINAL_URL'); - $this->server->remove('HTTP_X_ORIGINAL_URL'); - $this->server->remove('UNENCODED_URL'); - $this->server->remove('IIS_WasUrlRewritten'); - } elseif ($this->headers->has('X_REWRITE_URL')) { - // IIS with ISAPI_Rewrite - $requestUri = $this->headers->get('X_REWRITE_URL'); - $this->headers->remove('X_REWRITE_URL'); - } elseif ($this->server->get('IIS_WasUrlRewritten') == '1' && $this->server->get('UNENCODED_URL') != '') { - // IIS7 with URL Rewrite: make sure we get the unencoded URL (double slash problem) - $requestUri = $this->server->get('UNENCODED_URL'); - $this->server->remove('UNENCODED_URL'); - $this->server->remove('IIS_WasUrlRewritten'); - } elseif ($this->server->has('REQUEST_URI')) { - $requestUri = $this->server->get('REQUEST_URI'); - // HTTP proxy reqs setup request URI with scheme and host [and port] + the URL path, only use URL path - $schemeAndHttpHost = $this->getSchemeAndHttpHost(); - if (strpos($requestUri, $schemeAndHttpHost) === 0) { - $requestUri = substr($requestUri, strlen($schemeAndHttpHost)); - } - } elseif ($this->server->has('ORIG_PATH_INFO')) { - // IIS 5.0, PHP as CGI - $requestUri = $this->server->get('ORIG_PATH_INFO'); - if ('' != $this->server->get('QUERY_STRING')) { - $requestUri .= '?'.$this->server->get('QUERY_STRING'); - } - $this->server->remove('ORIG_PATH_INFO'); - } - - // normalize the request URI to ease creating sub-requests from this request - $this->server->set('REQUEST_URI', $requestUri); - - return $requestUri; - } - - /** - * Prepares the base URL. - * - * @return string - */ - protected function prepareBaseUrl() - { - $filename = basename($this->server->get('SCRIPT_FILENAME')); - - if (basename($this->server->get('SCRIPT_NAME')) === $filename) { - $baseUrl = $this->server->get('SCRIPT_NAME'); - } elseif (basename($this->server->get('PHP_SELF')) === $filename) { - $baseUrl = $this->server->get('PHP_SELF'); - } elseif (basename($this->server->get('ORIG_SCRIPT_NAME')) === $filename) { - $baseUrl = $this->server->get('ORIG_SCRIPT_NAME'); // 1and1 shared hosting compatibility - } else { - // Backtrack up the script_filename to find the portion matching - // php_self - $path = $this->server->get('PHP_SELF', ''); - $file = $this->server->get('SCRIPT_FILENAME', ''); - $segs = explode('/', trim($file, '/')); - $segs = array_reverse($segs); - $index = 0; - $last = count($segs); - $baseUrl = ''; - do { - $seg = $segs[$index]; - $baseUrl = '/'.$seg.$baseUrl; - ++$index; - } while ($last > $index && (false !== $pos = strpos($path, $baseUrl)) && 0 != $pos); - } - - // Does the baseUrl have anything in common with the request_uri? - $requestUri = $this->getRequestUri(); - - if ($baseUrl && false !== $prefix = $this->getUrlencodedPrefix($requestUri, $baseUrl)) { - // full $baseUrl matches - return $prefix; - } - - if ($baseUrl && false !== $prefix = $this->getUrlencodedPrefix($requestUri, rtrim(dirname($baseUrl), '/').'/')) { - // directory portion of $baseUrl matches - return rtrim($prefix, '/'); - } - - $truncatedRequestUri = $requestUri; - if (false !== $pos = strpos($requestUri, '?')) { - $truncatedRequestUri = substr($requestUri, 0, $pos); - } - - $basename = basename($baseUrl); - if (empty($basename) || !strpos(rawurldecode($truncatedRequestUri), $basename)) { - // no match whatsoever; set it blank - return ''; - } - - // If using mod_rewrite or ISAPI_Rewrite strip the script filename - // out of baseUrl. $pos !== 0 makes sure it is not matching a value - // from PATH_INFO or QUERY_STRING - if (strlen($requestUri) >= strlen($baseUrl) && (false !== $pos = strpos($requestUri, $baseUrl)) && $pos !== 0) { - $baseUrl = substr($requestUri, 0, $pos + strlen($baseUrl)); - } - - return rtrim($baseUrl, '/'); - } - - /** - * Prepares the base path. - * - * @return string base path - */ - protected function prepareBasePath() - { - $filename = basename($this->server->get('SCRIPT_FILENAME')); - $baseUrl = $this->getBaseUrl(); - if (empty($baseUrl)) { - return ''; - } - - if (basename($baseUrl) === $filename) { - $basePath = dirname($baseUrl); - } else { - $basePath = $baseUrl; - } - - if ('\\' === DIRECTORY_SEPARATOR) { - $basePath = str_replace('\\', '/', $basePath); - } - - return rtrim($basePath, '/'); - } - - /** - * Prepares the path info. - * - * @return string path info - */ - protected function preparePathInfo() - { - $baseUrl = $this->getBaseUrl(); - - if (null === ($requestUri = $this->getRequestUri())) { - return '/'; - } - - $pathInfo = '/'; - - // Remove the query string from REQUEST_URI - if ($pos = strpos($requestUri, '?')) { - $requestUri = substr($requestUri, 0, $pos); - } - - if (null !== $baseUrl && false === $pathInfo = substr($requestUri, strlen($baseUrl))) { - // If substr() returns false then PATH_INFO is set to an empty string - return '/'; - } elseif (null === $baseUrl) { - return $requestUri; - } - - return (string) $pathInfo; - } - - /** - * Initializes HTTP request formats. - */ - protected static function initializeFormats() - { - static::$formats = array( - 'html' => array('text/html', 'application/xhtml+xml'), - 'txt' => array('text/plain'), - 'js' => array('application/javascript', 'application/x-javascript', 'text/javascript'), - 'css' => array('text/css'), - 'json' => array('application/json', 'application/x-json'), - 'xml' => array('text/xml', 'application/xml', 'application/x-xml'), - 'rdf' => array('application/rdf+xml'), - 'atom' => array('application/atom+xml'), - 'rss' => array('application/rss+xml'), - 'form' => array('application/x-www-form-urlencoded'), - ); - } - - /** - * Sets the default PHP locale. - * - * @param string $locale - */ - private function setPhpDefaultLocale($locale) - { - // if either the class Locale doesn't exist, or an exception is thrown when - // setting the default locale, the intl module is not installed, and - // the call can be ignored: - try { - if (class_exists('Locale', false)) { - \Locale::setDefault($locale); - } - } catch (\Exception $e) { - } - } - - /* - * Returns the prefix as encoded in the string when the string starts with - * the given prefix, false otherwise. - * - * @param string $string The urlencoded string - * @param string $prefix The prefix not encoded - * - * @return string|false The prefix as it is encoded in $string, or false - */ - private function getUrlencodedPrefix($string, $prefix) - { - if (0 !== strpos(rawurldecode($string), $prefix)) { - return false; - } - - $len = strlen($prefix); - - if (preg_match(sprintf('#^(%%[[:xdigit:]]{2}|.){%d}#', $len), $string, $match)) { - return $match[0]; - } - - return false; - } - - private static function createRequestFromFactory(array $query = array(), array $request = array(), array $attributes = array(), array $cookies = array(), array $files = array(), array $server = array(), $content = null) - { - if (self::$requestFactory) { - $request = call_user_func(self::$requestFactory, $query, $request, $attributes, $cookies, $files, $server, $content); - - if (!$request instanceof Request) { - throw new \LogicException('The Request factory must return an instance of Symfony\Component\HttpFoundation\Request.'); - } - - return $request; - } - - return new static($query, $request, $attributes, $cookies, $files, $server, $content); - } - - private function isFromTrustedProxy() - { - return self::$trustedProxies && IpUtils::checkIp($this->server->get('REMOTE_ADDR'), self::$trustedProxies); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-foundation/RequestMatcher.php b/sitecake/2.2.9/server/vendor/symfony/http-foundation/RequestMatcher.php deleted file mode 100644 index c571c60..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-foundation/RequestMatcher.php +++ /dev/null @@ -1,182 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation; - -/** - * RequestMatcher compares a pre-defined set of checks against a Request instance. - * - * @author Fabien Potencier - * - * @api - */ -class RequestMatcher implements RequestMatcherInterface -{ - /** - * @var string - */ - private $path; - - /** - * @var string - */ - private $host; - - /** - * @var array - */ - private $methods = array(); - - /** - * @var string - */ - private $ips = array(); - - /** - * @var array - */ - private $attributes = array(); - - /** - * @var string[] - */ - private $schemes = array(); - - /** - * @param string|null $path - * @param string|null $host - * @param string|string[]|null $methods - * @param string|string[]|null $ips - * @param array $attributes - * @param string|string[]|null $schemes - */ - public function __construct($path = null, $host = null, $methods = null, $ips = null, array $attributes = array(), $schemes = null) - { - $this->matchPath($path); - $this->matchHost($host); - $this->matchMethod($methods); - $this->matchIps($ips); - $this->matchScheme($schemes); - - foreach ($attributes as $k => $v) { - $this->matchAttribute($k, $v); - } - } - - /** - * Adds a check for the HTTP scheme. - * - * @param string|string[]|null $scheme An HTTP scheme or an array of HTTP schemes - */ - public function matchScheme($scheme) - { - $this->schemes = array_map('strtolower', (array) $scheme); - } - - /** - * Adds a check for the URL host name. - * - * @param string $regexp A Regexp - */ - public function matchHost($regexp) - { - $this->host = $regexp; - } - - /** - * Adds a check for the URL path info. - * - * @param string $regexp A Regexp - */ - public function matchPath($regexp) - { - $this->path = $regexp; - } - - /** - * Adds a check for the client IP. - * - * @param string $ip A specific IP address or a range specified using IP/netmask like 192.168.1.0/24 - */ - public function matchIp($ip) - { - $this->matchIps($ip); - } - - /** - * Adds a check for the client IP. - * - * @param string|string[] $ips A specific IP address or a range specified using IP/netmask like 192.168.1.0/24 - */ - public function matchIps($ips) - { - $this->ips = (array) $ips; - } - - /** - * Adds a check for the HTTP method. - * - * @param string|string[] $method An HTTP method or an array of HTTP methods - */ - public function matchMethod($method) - { - $this->methods = array_map('strtoupper', (array) $method); - } - - /** - * Adds a check for request attribute. - * - * @param string $key The request attribute name - * @param string $regexp A Regexp - */ - public function matchAttribute($key, $regexp) - { - $this->attributes[$key] = $regexp; - } - - /** - * {@inheritdoc} - * - * @api - */ - public function matches(Request $request) - { - if ($this->schemes && !in_array($request->getScheme(), $this->schemes)) { - return false; - } - - if ($this->methods && !in_array($request->getMethod(), $this->methods)) { - return false; - } - - foreach ($this->attributes as $key => $pattern) { - if (!preg_match('{'.$pattern.'}', $request->attributes->get($key))) { - return false; - } - } - - if (null !== $this->path && !preg_match('{'.$this->path.'}', rawurldecode($request->getPathInfo()))) { - return false; - } - - if (null !== $this->host && !preg_match('{'.$this->host.'}i', $request->getHost())) { - return false; - } - - if (IpUtils::checkIp($request->getClientIp(), $this->ips)) { - return true; - } - - // Note to future implementors: add additional checks above the - // foreach above or else your check might not be run! - return count($this->ips) === 0; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-foundation/RequestMatcherInterface.php b/sitecake/2.2.9/server/vendor/symfony/http-foundation/RequestMatcherInterface.php deleted file mode 100644 index b45f80c..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-foundation/RequestMatcherInterface.php +++ /dev/null @@ -1,33 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation; - -/** - * RequestMatcherInterface is an interface for strategies to match a Request. - * - * @author Fabien Potencier - * - * @api - */ -interface RequestMatcherInterface -{ - /** - * Decides whether the rule(s) implemented by the strategy matches the supplied request. - * - * @param Request $request The request to check for a match - * - * @return bool true if the request matches, false otherwise - * - * @api - */ - public function matches(Request $request); -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-foundation/RequestStack.php b/sitecake/2.2.9/server/vendor/symfony/http-foundation/RequestStack.php deleted file mode 100644 index 3d9cfd0..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-foundation/RequestStack.php +++ /dev/null @@ -1,103 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation; - -/** - * Request stack that controls the lifecycle of requests. - * - * @author Benjamin Eberlei - */ -class RequestStack -{ - /** - * @var Request[] - */ - private $requests = array(); - - /** - * Pushes a Request on the stack. - * - * This method should generally not be called directly as the stack - * management should be taken care of by the application itself. - */ - public function push(Request $request) - { - $this->requests[] = $request; - } - - /** - * Pops the current request from the stack. - * - * This operation lets the current request go out of scope. - * - * This method should generally not be called directly as the stack - * management should be taken care of by the application itself. - * - * @return Request|null - */ - public function pop() - { - if (!$this->requests) { - return; - } - - return array_pop($this->requests); - } - - /** - * @return Request|null - */ - public function getCurrentRequest() - { - return end($this->requests) ?: null; - } - - /** - * Gets the master Request. - * - * Be warned that making your code aware of the master request - * might make it un-compatible with other features of your framework - * like ESI support. - * - * @return Request|null - */ - public function getMasterRequest() - { - if (!$this->requests) { - return; - } - - return $this->requests[0]; - } - - /** - * Returns the parent request of the current. - * - * Be warned that making your code aware of the parent request - * might make it un-compatible with other features of your framework - * like ESI support. - * - * If current Request is the master request, it returns null. - * - * @return Request|null - */ - public function getParentRequest() - { - $pos = count($this->requests) - 2; - - if (!isset($this->requests[$pos])) { - return; - } - - return $this->requests[$pos]; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-foundation/Resources/stubs/SessionHandlerInterface.php b/sitecake/2.2.9/server/vendor/symfony/http-foundation/Resources/stubs/SessionHandlerInterface.php deleted file mode 100644 index 9baa7bc..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-foundation/Resources/stubs/SessionHandlerInterface.php +++ /dev/null @@ -1,102 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -/** - * SessionHandlerInterface for PHP < 5.4. - * - * The order in which these methods are invoked by PHP are: - * 1. open [session_start] - * 2. read - * 3. gc [optional depending on probability settings: gc_probability / gc_divisor] - * 4. destroy [optional when session_regenerate_id(true) is used] - * 5. write [session_write_close] or destroy [session_destroy] - * 6. close - * - * Extensive documentation can be found at php.net, see links: - * - * @see http://php.net/sessionhandlerinterface - * @see http://php.net/session.customhandler - * @see http://php.net/session-set-save-handler - * - * @author Drak - * @author Tobias Schultze - */ -interface SessionHandlerInterface -{ - /** - * Re-initializes existing session, or creates a new one. - * - * @see http://php.net/sessionhandlerinterface.open - * - * @param string $savePath Save path - * @param string $sessionName Session name, see http://php.net/function.session-name.php - * - * @return bool true on success, false on failure - */ - public function open($savePath, $sessionName); - - /** - * Closes the current session. - * - * @see http://php.net/sessionhandlerinterface.close - * - * @return bool true on success, false on failure - */ - public function close(); - - /** - * Reads the session data. - * - * @see http://php.net/sessionhandlerinterface.read - * - * @param string $sessionId Session ID, see http://php.net/function.session-id - * - * @return string Same session data as passed in write() or empty string when non-existent or on failure - */ - public function read($sessionId); - - /** - * Writes the session data to the storage. - * - * Care, the session ID passed to write() can be different from the one previously - * received in read() when the session ID changed due to session_regenerate_id(). - * - * @see http://php.net/sessionhandlerinterface.write - * - * @param string $sessionId Session ID , see http://php.net/function.session-id - * @param string $data Serialized session data to save - * - * @return bool true on success, false on failure - */ - public function write($sessionId, $data); - - /** - * Destroys a session. - * - * @see http://php.net/sessionhandlerinterface.destroy - * - * @param string $sessionId Session ID, see http://php.net/function.session-id - * - * @return bool true on success, false on failure - */ - public function destroy($sessionId); - - /** - * Cleans up expired sessions (garbage collection). - * - * @see http://php.net/sessionhandlerinterface.gc - * - * @param string|int $maxlifetime Sessions that have not updated for the last maxlifetime seconds will be removed - * - * @return bool true on success, false on failure - */ - public function gc($maxlifetime); -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-foundation/Response.php b/sitecake/2.2.9/server/vendor/symfony/http-foundation/Response.php deleted file mode 100644 index 6641e51..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-foundation/Response.php +++ /dev/null @@ -1,1275 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation; - -/** - * Response represents an HTTP response. - * - * @author Fabien Potencier - * - * @api - */ -class Response -{ - const HTTP_CONTINUE = 100; - const HTTP_SWITCHING_PROTOCOLS = 101; - const HTTP_PROCESSING = 102; // RFC2518 - const HTTP_OK = 200; - const HTTP_CREATED = 201; - const HTTP_ACCEPTED = 202; - const HTTP_NON_AUTHORITATIVE_INFORMATION = 203; - const HTTP_NO_CONTENT = 204; - const HTTP_RESET_CONTENT = 205; - const HTTP_PARTIAL_CONTENT = 206; - const HTTP_MULTI_STATUS = 207; // RFC4918 - const HTTP_ALREADY_REPORTED = 208; // RFC5842 - const HTTP_IM_USED = 226; // RFC3229 - const HTTP_MULTIPLE_CHOICES = 300; - const HTTP_MOVED_PERMANENTLY = 301; - const HTTP_FOUND = 302; - const HTTP_SEE_OTHER = 303; - const HTTP_NOT_MODIFIED = 304; - const HTTP_USE_PROXY = 305; - const HTTP_RESERVED = 306; - const HTTP_TEMPORARY_REDIRECT = 307; - const HTTP_PERMANENTLY_REDIRECT = 308; // RFC7238 - const HTTP_BAD_REQUEST = 400; - const HTTP_UNAUTHORIZED = 401; - const HTTP_PAYMENT_REQUIRED = 402; - const HTTP_FORBIDDEN = 403; - const HTTP_NOT_FOUND = 404; - const HTTP_METHOD_NOT_ALLOWED = 405; - const HTTP_NOT_ACCEPTABLE = 406; - const HTTP_PROXY_AUTHENTICATION_REQUIRED = 407; - const HTTP_REQUEST_TIMEOUT = 408; - const HTTP_CONFLICT = 409; - const HTTP_GONE = 410; - const HTTP_LENGTH_REQUIRED = 411; - const HTTP_PRECONDITION_FAILED = 412; - const HTTP_REQUEST_ENTITY_TOO_LARGE = 413; - const HTTP_REQUEST_URI_TOO_LONG = 414; - const HTTP_UNSUPPORTED_MEDIA_TYPE = 415; - const HTTP_REQUESTED_RANGE_NOT_SATISFIABLE = 416; - const HTTP_EXPECTATION_FAILED = 417; - const HTTP_I_AM_A_TEAPOT = 418; // RFC2324 - const HTTP_UNPROCESSABLE_ENTITY = 422; // RFC4918 - const HTTP_LOCKED = 423; // RFC4918 - const HTTP_FAILED_DEPENDENCY = 424; // RFC4918 - const HTTP_RESERVED_FOR_WEBDAV_ADVANCED_COLLECTIONS_EXPIRED_PROPOSAL = 425; // RFC2817 - const HTTP_UPGRADE_REQUIRED = 426; // RFC2817 - const HTTP_PRECONDITION_REQUIRED = 428; // RFC6585 - const HTTP_TOO_MANY_REQUESTS = 429; // RFC6585 - const HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE = 431; // RFC6585 - const HTTP_INTERNAL_SERVER_ERROR = 500; - const HTTP_NOT_IMPLEMENTED = 501; - const HTTP_BAD_GATEWAY = 502; - const HTTP_SERVICE_UNAVAILABLE = 503; - const HTTP_GATEWAY_TIMEOUT = 504; - const HTTP_VERSION_NOT_SUPPORTED = 505; - const HTTP_VARIANT_ALSO_NEGOTIATES_EXPERIMENTAL = 506; // RFC2295 - const HTTP_INSUFFICIENT_STORAGE = 507; // RFC4918 - const HTTP_LOOP_DETECTED = 508; // RFC5842 - const HTTP_NOT_EXTENDED = 510; // RFC2774 - const HTTP_NETWORK_AUTHENTICATION_REQUIRED = 511; // RFC6585 - - /** - * @var \Symfony\Component\HttpFoundation\ResponseHeaderBag - */ - public $headers; - - /** - * @var string - */ - protected $content; - - /** - * @var string - */ - protected $version; - - /** - * @var int - */ - protected $statusCode; - - /** - * @var string - */ - protected $statusText; - - /** - * @var string - */ - protected $charset; - - /** - * Status codes translation table. - * - * The list of codes is complete according to the - * {@link http://www.iana.org/assignments/http-status-codes/ Hypertext Transfer Protocol (HTTP) Status Code Registry} - * (last updated 2012-02-13). - * - * Unless otherwise noted, the status code is defined in RFC2616. - * - * @var array - */ - public static $statusTexts = array( - 100 => 'Continue', - 101 => 'Switching Protocols', - 102 => 'Processing', // RFC2518 - 200 => 'OK', - 201 => 'Created', - 202 => 'Accepted', - 203 => 'Non-Authoritative Information', - 204 => 'No Content', - 205 => 'Reset Content', - 206 => 'Partial Content', - 207 => 'Multi-Status', // RFC4918 - 208 => 'Already Reported', // RFC5842 - 226 => 'IM Used', // RFC3229 - 300 => 'Multiple Choices', - 301 => 'Moved Permanently', - 302 => 'Found', - 303 => 'See Other', - 304 => 'Not Modified', - 305 => 'Use Proxy', - 306 => 'Reserved', - 307 => 'Temporary Redirect', - 308 => 'Permanent Redirect', // RFC7238 - 400 => 'Bad Request', - 401 => 'Unauthorized', - 402 => 'Payment Required', - 403 => 'Forbidden', - 404 => 'Not Found', - 405 => 'Method Not Allowed', - 406 => 'Not Acceptable', - 407 => 'Proxy Authentication Required', - 408 => 'Request Timeout', - 409 => 'Conflict', - 410 => 'Gone', - 411 => 'Length Required', - 412 => 'Precondition Failed', - 413 => 'Request Entity Too Large', - 414 => 'Request-URI Too Long', - 415 => 'Unsupported Media Type', - 416 => 'Requested Range Not Satisfiable', - 417 => 'Expectation Failed', - 418 => 'I\'m a teapot', // RFC2324 - 422 => 'Unprocessable Entity', // RFC4918 - 423 => 'Locked', // RFC4918 - 424 => 'Failed Dependency', // RFC4918 - 425 => 'Reserved for WebDAV advanced collections expired proposal', // RFC2817 - 426 => 'Upgrade Required', // RFC2817 - 428 => 'Precondition Required', // RFC6585 - 429 => 'Too Many Requests', // RFC6585 - 431 => 'Request Header Fields Too Large', // RFC6585 - 500 => 'Internal Server Error', - 501 => 'Not Implemented', - 502 => 'Bad Gateway', - 503 => 'Service Unavailable', - 504 => 'Gateway Timeout', - 505 => 'HTTP Version Not Supported', - 506 => 'Variant Also Negotiates (Experimental)', // RFC2295 - 507 => 'Insufficient Storage', // RFC4918 - 508 => 'Loop Detected', // RFC5842 - 510 => 'Not Extended', // RFC2774 - 511 => 'Network Authentication Required', // RFC6585 - ); - - /** - * Constructor. - * - * @param mixed $content The response content, see setContent() - * @param int $status The response status code - * @param array $headers An array of response headers - * - * @throws \InvalidArgumentException When the HTTP status code is not valid - * - * @api - */ - public function __construct($content = '', $status = 200, $headers = array()) - { - $this->headers = new ResponseHeaderBag($headers); - $this->setContent($content); - $this->setStatusCode($status); - $this->setProtocolVersion('1.0'); - if (!$this->headers->has('Date')) { - $this->setDate(new \DateTime(null, new \DateTimeZone('UTC'))); - } - } - - /** - * Factory method for chainability. - * - * Example: - * - * return Response::create($body, 200) - * ->setSharedMaxAge(300); - * - * @param mixed $content The response content, see setContent() - * @param int $status The response status code - * @param array $headers An array of response headers - * - * @return Response - */ - public static function create($content = '', $status = 200, $headers = array()) - { - return new static($content, $status, $headers); - } - - /** - * Returns the Response as an HTTP string. - * - * The string representation of the Response is the same as the - * one that will be sent to the client only if the prepare() method - * has been called before. - * - * @return string The Response as an HTTP string - * - * @see prepare() - */ - public function __toString() - { - return - sprintf('HTTP/%s %s %s', $this->version, $this->statusCode, $this->statusText)."\r\n". - $this->headers."\r\n". - $this->getContent(); - } - - /** - * Clones the current Response instance. - */ - public function __clone() - { - $this->headers = clone $this->headers; - } - - /** - * Prepares the Response before it is sent to the client. - * - * This method tweaks the Response to ensure that it is - * compliant with RFC 2616. Most of the changes are based on - * the Request that is "associated" with this Response. - * - * @param Request $request A Request instance - * - * @return Response The current response. - */ - public function prepare(Request $request) - { - $headers = $this->headers; - - if ($this->isInformational() || $this->isEmpty()) { - $this->setContent(null); - $headers->remove('Content-Type'); - $headers->remove('Content-Length'); - } else { - // Content-type based on the Request - if (!$headers->has('Content-Type')) { - $format = $request->getRequestFormat(); - if (null !== $format && $mimeType = $request->getMimeType($format)) { - $headers->set('Content-Type', $mimeType); - } - } - - // Fix Content-Type - $charset = $this->charset ?: 'UTF-8'; - if (!$headers->has('Content-Type')) { - $headers->set('Content-Type', 'text/html; charset='.$charset); - } elseif (0 === stripos($headers->get('Content-Type'), 'text/') && false === stripos($headers->get('Content-Type'), 'charset')) { - // add the charset - $headers->set('Content-Type', $headers->get('Content-Type').'; charset='.$charset); - } - - // Fix Content-Length - if ($headers->has('Transfer-Encoding')) { - $headers->remove('Content-Length'); - } - - if ($request->isMethod('HEAD')) { - // cf. RFC2616 14.13 - $length = $headers->get('Content-Length'); - $this->setContent(null); - if ($length) { - $headers->set('Content-Length', $length); - } - } - } - - // Fix protocol - if ('HTTP/1.0' != $request->server->get('SERVER_PROTOCOL')) { - $this->setProtocolVersion('1.1'); - } - - // Check if we need to send extra expire info headers - if ('1.0' == $this->getProtocolVersion() && 'no-cache' == $this->headers->get('Cache-Control')) { - $this->headers->set('pragma', 'no-cache'); - $this->headers->set('expires', -1); - } - - $this->ensureIEOverSSLCompatibility($request); - - return $this; - } - - /** - * Sends HTTP headers. - * - * @return Response - */ - public function sendHeaders() - { - // headers have already been sent by the developer - if (headers_sent()) { - return $this; - } - - // status - header(sprintf('HTTP/%s %s %s', $this->version, $this->statusCode, $this->statusText), true, $this->statusCode); - - // headers - foreach ($this->headers->allPreserveCase() as $name => $values) { - foreach ($values as $value) { - header($name.': '.$value, false, $this->statusCode); - } - } - - // cookies - foreach ($this->headers->getCookies() as $cookie) { - setcookie($cookie->getName(), $cookie->getValue(), $cookie->getExpiresTime(), $cookie->getPath(), $cookie->getDomain(), $cookie->isSecure(), $cookie->isHttpOnly()); - } - - return $this; - } - - /** - * Sends content for the current web response. - * - * @return Response - */ - public function sendContent() - { - echo $this->content; - - return $this; - } - - /** - * Sends HTTP headers and content. - * - * @return Response - * - * @api - */ - public function send() - { - $this->sendHeaders(); - $this->sendContent(); - - if (function_exists('fastcgi_finish_request')) { - fastcgi_finish_request(); - } elseif ('cli' !== PHP_SAPI) { - static::closeOutputBuffers(0, true); - } - - return $this; - } - - /** - * Sets the response content. - * - * Valid types are strings, numbers, null, and objects that implement a __toString() method. - * - * @param mixed $content Content that can be cast to string - * - * @return Response - * - * @throws \UnexpectedValueException - * - * @api - */ - public function setContent($content) - { - if (null !== $content && !is_string($content) && !is_numeric($content) && !is_callable(array($content, '__toString'))) { - throw new \UnexpectedValueException(sprintf('The Response content must be a string or object implementing __toString(), "%s" given.', gettype($content))); - } - - $this->content = (string) $content; - - return $this; - } - - /** - * Gets the current response content. - * - * @return string Content - * - * @api - */ - public function getContent() - { - return $this->content; - } - - /** - * Sets the HTTP protocol version (1.0 or 1.1). - * - * @param string $version The HTTP protocol version - * - * @return Response - * - * @api - */ - public function setProtocolVersion($version) - { - $this->version = $version; - - return $this; - } - - /** - * Gets the HTTP protocol version. - * - * @return string The HTTP protocol version - * - * @api - */ - public function getProtocolVersion() - { - return $this->version; - } - - /** - * Sets the response status code. - * - * @param int $code HTTP status code - * @param mixed $text HTTP status text - * - * If the status text is null it will be automatically populated for the known - * status codes and left empty otherwise. - * - * @return Response - * - * @throws \InvalidArgumentException When the HTTP status code is not valid - * - * @api - */ - public function setStatusCode($code, $text = null) - { - $this->statusCode = $code = (int) $code; - if ($this->isInvalid()) { - throw new \InvalidArgumentException(sprintf('The HTTP status code "%s" is not valid.', $code)); - } - - if (null === $text) { - $this->statusText = isset(self::$statusTexts[$code]) ? self::$statusTexts[$code] : ''; - - return $this; - } - - if (false === $text) { - $this->statusText = ''; - - return $this; - } - - $this->statusText = $text; - - return $this; - } - - /** - * Retrieves the status code for the current web response. - * - * @return int Status code - * - * @api - */ - public function getStatusCode() - { - return $this->statusCode; - } - - /** - * Sets the response charset. - * - * @param string $charset Character set - * - * @return Response - * - * @api - */ - public function setCharset($charset) - { - $this->charset = $charset; - - return $this; - } - - /** - * Retrieves the response charset. - * - * @return string Character set - * - * @api - */ - public function getCharset() - { - return $this->charset; - } - - /** - * Returns true if the response is worth caching under any circumstance. - * - * Responses marked "private" with an explicit Cache-Control directive are - * considered uncacheable. - * - * Responses with neither a freshness lifetime (Expires, max-age) nor cache - * validator (Last-Modified, ETag) are considered uncacheable. - * - * @return bool true if the response is worth caching, false otherwise - * - * @api - */ - public function isCacheable() - { - if (!in_array($this->statusCode, array(200, 203, 300, 301, 302, 404, 410))) { - return false; - } - - if ($this->headers->hasCacheControlDirective('no-store') || $this->headers->getCacheControlDirective('private')) { - return false; - } - - return $this->isValidateable() || $this->isFresh(); - } - - /** - * Returns true if the response is "fresh". - * - * Fresh responses may be served from cache without any interaction with the - * origin. A response is considered fresh when it includes a Cache-Control/max-age - * indicator or Expires header and the calculated age is less than the freshness lifetime. - * - * @return bool true if the response is fresh, false otherwise - * - * @api - */ - public function isFresh() - { - return $this->getTtl() > 0; - } - - /** - * Returns true if the response includes headers that can be used to validate - * the response with the origin server using a conditional GET request. - * - * @return bool true if the response is validateable, false otherwise - * - * @api - */ - public function isValidateable() - { - return $this->headers->has('Last-Modified') || $this->headers->has('ETag'); - } - - /** - * Marks the response as "private". - * - * It makes the response ineligible for serving other clients. - * - * @return Response - * - * @api - */ - public function setPrivate() - { - $this->headers->removeCacheControlDirective('public'); - $this->headers->addCacheControlDirective('private'); - - return $this; - } - - /** - * Marks the response as "public". - * - * It makes the response eligible for serving other clients. - * - * @return Response - * - * @api - */ - public function setPublic() - { - $this->headers->addCacheControlDirective('public'); - $this->headers->removeCacheControlDirective('private'); - - return $this; - } - - /** - * Returns true if the response must be revalidated by caches. - * - * This method indicates that the response must not be served stale by a - * cache in any circumstance without first revalidating with the origin. - * When present, the TTL of the response should not be overridden to be - * greater than the value provided by the origin. - * - * @return bool true if the response must be revalidated by a cache, false otherwise - * - * @api - */ - public function mustRevalidate() - { - return $this->headers->hasCacheControlDirective('must-revalidate') || $this->headers->has('proxy-revalidate'); - } - - /** - * Returns the Date header as a DateTime instance. - * - * @return \DateTime A \DateTime instance - * - * @throws \RuntimeException When the header is not parseable - * - * @api - */ - public function getDate() - { - return $this->headers->getDate('Date', new \DateTime()); - } - - /** - * Sets the Date header. - * - * @param \DateTime $date A \DateTime instance - * - * @return Response - * - * @api - */ - public function setDate(\DateTime $date) - { - $date->setTimezone(new \DateTimeZone('UTC')); - $this->headers->set('Date', $date->format('D, d M Y H:i:s').' GMT'); - - return $this; - } - - /** - * Returns the age of the response. - * - * @return int The age of the response in seconds - */ - public function getAge() - { - if (null !== $age = $this->headers->get('Age')) { - return (int) $age; - } - - return max(time() - $this->getDate()->format('U'), 0); - } - - /** - * Marks the response stale by setting the Age header to be equal to the maximum age of the response. - * - * @return Response - * - * @api - */ - public function expire() - { - if ($this->isFresh()) { - $this->headers->set('Age', $this->getMaxAge()); - } - - return $this; - } - - /** - * Returns the value of the Expires header as a DateTime instance. - * - * @return \DateTime|null A DateTime instance or null if the header does not exist - * - * @api - */ - public function getExpires() - { - try { - return $this->headers->getDate('Expires'); - } catch (\RuntimeException $e) { - // according to RFC 2616 invalid date formats (e.g. "0" and "-1") must be treated as in the past - return \DateTime::createFromFormat(DATE_RFC2822, 'Sat, 01 Jan 00 00:00:00 +0000'); - } - } - - /** - * Sets the Expires HTTP header with a DateTime instance. - * - * Passing null as value will remove the header. - * - * @param \DateTime|null $date A \DateTime instance or null to remove the header - * - * @return Response - * - * @api - */ - public function setExpires(\DateTime $date = null) - { - if (null === $date) { - $this->headers->remove('Expires'); - } else { - $date = clone $date; - $date->setTimezone(new \DateTimeZone('UTC')); - $this->headers->set('Expires', $date->format('D, d M Y H:i:s').' GMT'); - } - - return $this; - } - - /** - * Returns the number of seconds after the time specified in the response's Date - * header when the response should no longer be considered fresh. - * - * First, it checks for a s-maxage directive, then a max-age directive, and then it falls - * back on an expires header. It returns null when no maximum age can be established. - * - * @return int|null Number of seconds - * - * @api - */ - public function getMaxAge() - { - if ($this->headers->hasCacheControlDirective('s-maxage')) { - return (int) $this->headers->getCacheControlDirective('s-maxage'); - } - - if ($this->headers->hasCacheControlDirective('max-age')) { - return (int) $this->headers->getCacheControlDirective('max-age'); - } - - if (null !== $this->getExpires()) { - return $this->getExpires()->format('U') - $this->getDate()->format('U'); - } - } - - /** - * Sets the number of seconds after which the response should no longer be considered fresh. - * - * This methods sets the Cache-Control max-age directive. - * - * @param int $value Number of seconds - * - * @return Response - * - * @api - */ - public function setMaxAge($value) - { - $this->headers->addCacheControlDirective('max-age', $value); - - return $this; - } - - /** - * Sets the number of seconds after which the response should no longer be considered fresh by shared caches. - * - * This methods sets the Cache-Control s-maxage directive. - * - * @param int $value Number of seconds - * - * @return Response - * - * @api - */ - public function setSharedMaxAge($value) - { - $this->setPublic(); - $this->headers->addCacheControlDirective('s-maxage', $value); - - return $this; - } - - /** - * Returns the response's time-to-live in seconds. - * - * It returns null when no freshness information is present in the response. - * - * When the responses TTL is <= 0, the response may not be served from cache without first - * revalidating with the origin. - * - * @return int|null The TTL in seconds - * - * @api - */ - public function getTtl() - { - if (null !== $maxAge = $this->getMaxAge()) { - return $maxAge - $this->getAge(); - } - } - - /** - * Sets the response's time-to-live for shared caches. - * - * This method adjusts the Cache-Control/s-maxage directive. - * - * @param int $seconds Number of seconds - * - * @return Response - * - * @api - */ - public function setTtl($seconds) - { - $this->setSharedMaxAge($this->getAge() + $seconds); - - return $this; - } - - /** - * Sets the response's time-to-live for private/client caches. - * - * This method adjusts the Cache-Control/max-age directive. - * - * @param int $seconds Number of seconds - * - * @return Response - * - * @api - */ - public function setClientTtl($seconds) - { - $this->setMaxAge($this->getAge() + $seconds); - - return $this; - } - - /** - * Returns the Last-Modified HTTP header as a DateTime instance. - * - * @return \DateTime|null A DateTime instance or null if the header does not exist - * - * @throws \RuntimeException When the HTTP header is not parseable - * - * @api - */ - public function getLastModified() - { - return $this->headers->getDate('Last-Modified'); - } - - /** - * Sets the Last-Modified HTTP header with a DateTime instance. - * - * Passing null as value will remove the header. - * - * @param \DateTime|null $date A \DateTime instance or null to remove the header - * - * @return Response - * - * @api - */ - public function setLastModified(\DateTime $date = null) - { - if (null === $date) { - $this->headers->remove('Last-Modified'); - } else { - $date = clone $date; - $date->setTimezone(new \DateTimeZone('UTC')); - $this->headers->set('Last-Modified', $date->format('D, d M Y H:i:s').' GMT'); - } - - return $this; - } - - /** - * Returns the literal value of the ETag HTTP header. - * - * @return string|null The ETag HTTP header or null if it does not exist - * - * @api - */ - public function getEtag() - { - return $this->headers->get('ETag'); - } - - /** - * Sets the ETag value. - * - * @param string|null $etag The ETag unique identifier or null to remove the header - * @param bool $weak Whether you want a weak ETag or not - * - * @return Response - * - * @api - */ - public function setEtag($etag = null, $weak = false) - { - if (null === $etag) { - $this->headers->remove('Etag'); - } else { - if (0 !== strpos($etag, '"')) { - $etag = '"'.$etag.'"'; - } - - $this->headers->set('ETag', (true === $weak ? 'W/' : '').$etag); - } - - return $this; - } - - /** - * Sets the response's cache headers (validation and/or expiration). - * - * Available options are: etag, last_modified, max_age, s_maxage, private, and public. - * - * @param array $options An array of cache options - * - * @return Response - * - * @throws \InvalidArgumentException - * - * @api - */ - public function setCache(array $options) - { - if ($diff = array_diff(array_keys($options), array('etag', 'last_modified', 'max_age', 's_maxage', 'private', 'public'))) { - throw new \InvalidArgumentException(sprintf('Response does not support the following options: "%s".', implode('", "', array_values($diff)))); - } - - if (isset($options['etag'])) { - $this->setEtag($options['etag']); - } - - if (isset($options['last_modified'])) { - $this->setLastModified($options['last_modified']); - } - - if (isset($options['max_age'])) { - $this->setMaxAge($options['max_age']); - } - - if (isset($options['s_maxage'])) { - $this->setSharedMaxAge($options['s_maxage']); - } - - if (isset($options['public'])) { - if ($options['public']) { - $this->setPublic(); - } else { - $this->setPrivate(); - } - } - - if (isset($options['private'])) { - if ($options['private']) { - $this->setPrivate(); - } else { - $this->setPublic(); - } - } - - return $this; - } - - /** - * Modifies the response so that it conforms to the rules defined for a 304 status code. - * - * This sets the status, removes the body, and discards any headers - * that MUST NOT be included in 304 responses. - * - * @return Response - * - * @see http://tools.ietf.org/html/rfc2616#section-10.3.5 - * - * @api - */ - public function setNotModified() - { - $this->setStatusCode(304); - $this->setContent(null); - - // remove headers that MUST NOT be included with 304 Not Modified responses - foreach (array('Allow', 'Content-Encoding', 'Content-Language', 'Content-Length', 'Content-MD5', 'Content-Type', 'Last-Modified') as $header) { - $this->headers->remove($header); - } - - return $this; - } - - /** - * Returns true if the response includes a Vary header. - * - * @return bool true if the response includes a Vary header, false otherwise - * - * @api - */ - public function hasVary() - { - return null !== $this->headers->get('Vary'); - } - - /** - * Returns an array of header names given in the Vary header. - * - * @return array An array of Vary names - * - * @api - */ - public function getVary() - { - if (!$vary = $this->headers->get('Vary', null, false)) { - return array(); - } - - $ret = array(); - foreach ($vary as $item) { - $ret = array_merge($ret, preg_split('/[\s,]+/', $item)); - } - - return $ret; - } - - /** - * Sets the Vary header. - * - * @param string|array $headers - * @param bool $replace Whether to replace the actual value of not (true by default) - * - * @return Response - * - * @api - */ - public function setVary($headers, $replace = true) - { - $this->headers->set('Vary', $headers, $replace); - - return $this; - } - - /** - * Determines if the Response validators (ETag, Last-Modified) match - * a conditional value specified in the Request. - * - * If the Response is not modified, it sets the status code to 304 and - * removes the actual content by calling the setNotModified() method. - * - * @param Request $request A Request instance - * - * @return bool true if the Response validators match the Request, false otherwise - * - * @api - */ - public function isNotModified(Request $request) - { - if (!$request->isMethodSafe()) { - return false; - } - - $notModified = false; - $lastModified = $this->headers->get('Last-Modified'); - $modifiedSince = $request->headers->get('If-Modified-Since'); - - if ($etags = $request->getETags()) { - $notModified = in_array($this->getEtag(), $etags) || in_array('*', $etags); - } - - if ($modifiedSince && $lastModified) { - $notModified = strtotime($modifiedSince) >= strtotime($lastModified) && (!$etags || $notModified); - } - - if ($notModified) { - $this->setNotModified(); - } - - return $notModified; - } - - // http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html - /** - * Is response invalid? - * - * @return bool - * - * @api - */ - public function isInvalid() - { - return $this->statusCode < 100 || $this->statusCode >= 600; - } - - /** - * Is response informative? - * - * @return bool - * - * @api - */ - public function isInformational() - { - return $this->statusCode >= 100 && $this->statusCode < 200; - } - - /** - * Is response successful? - * - * @return bool - * - * @api - */ - public function isSuccessful() - { - return $this->statusCode >= 200 && $this->statusCode < 300; - } - - /** - * Is the response a redirect? - * - * @return bool - * - * @api - */ - public function isRedirection() - { - return $this->statusCode >= 300 && $this->statusCode < 400; - } - - /** - * Is there a client error? - * - * @return bool - * - * @api - */ - public function isClientError() - { - return $this->statusCode >= 400 && $this->statusCode < 500; - } - - /** - * Was there a server side error? - * - * @return bool - * - * @api - */ - public function isServerError() - { - return $this->statusCode >= 500 && $this->statusCode < 600; - } - - /** - * Is the response OK? - * - * @return bool - * - * @api - */ - public function isOk() - { - return 200 === $this->statusCode; - } - - /** - * Is the response forbidden? - * - * @return bool - * - * @api - */ - public function isForbidden() - { - return 403 === $this->statusCode; - } - - /** - * Is the response a not found error? - * - * @return bool - * - * @api - */ - public function isNotFound() - { - return 404 === $this->statusCode; - } - - /** - * Is the response a redirect of some form? - * - * @param string $location - * - * @return bool - * - * @api - */ - public function isRedirect($location = null) - { - return in_array($this->statusCode, array(201, 301, 302, 303, 307, 308)) && (null === $location ?: $location == $this->headers->get('Location')); - } - - /** - * Is the response empty? - * - * @return bool - * - * @api - */ - public function isEmpty() - { - return in_array($this->statusCode, array(204, 304)); - } - - /** - * Cleans or flushes output buffers up to target level. - * - * Resulting level can be greater than target level if a non-removable buffer has been encountered. - * - * @param int $targetLevel The target output buffering level - * @param bool $flush Whether to flush or clean the buffers - */ - public static function closeOutputBuffers($targetLevel, $flush) - { - $status = ob_get_status(true); - $level = count($status); - - while ($level-- > $targetLevel - && (!empty($status[$level]['del']) - || (isset($status[$level]['flags']) - && ($status[$level]['flags'] & PHP_OUTPUT_HANDLER_REMOVABLE) - && ($status[$level]['flags'] & ($flush ? PHP_OUTPUT_HANDLER_FLUSHABLE : PHP_OUTPUT_HANDLER_CLEANABLE)) - ) - ) - ) { - if ($flush) { - ob_end_flush(); - } else { - ob_end_clean(); - } - } - } - - /** - * Checks if we need to remove Cache-Control for SSL encrypted downloads when using IE < 9. - * - * @link http://support.microsoft.com/kb/323308 - */ - protected function ensureIEOverSSLCompatibility(Request $request) - { - if (false !== stripos($this->headers->get('Content-Disposition'), 'attachment') && preg_match('/MSIE (.*?);/i', $request->server->get('HTTP_USER_AGENT'), $match) == 1 && true === $request->isSecure()) { - if ((int) preg_replace('/(MSIE )(.*?);/', '$2', $match[0]) < 9) { - $this->headers->remove('Cache-Control'); - } - } - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-foundation/ResponseHeaderBag.php b/sitecake/2.2.9/server/vendor/symfony/http-foundation/ResponseHeaderBag.php deleted file mode 100644 index 375d191..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-foundation/ResponseHeaderBag.php +++ /dev/null @@ -1,322 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation; - -/** - * ResponseHeaderBag is a container for Response HTTP headers. - * - * @author Fabien Potencier - * - * @api - */ -class ResponseHeaderBag extends HeaderBag -{ - const COOKIES_FLAT = 'flat'; - const COOKIES_ARRAY = 'array'; - - const DISPOSITION_ATTACHMENT = 'attachment'; - const DISPOSITION_INLINE = 'inline'; - - /** - * @var array - */ - protected $computedCacheControl = array(); - - /** - * @var array - */ - protected $cookies = array(); - - /** - * @var array - */ - protected $headerNames = array(); - - /** - * Constructor. - * - * @param array $headers An array of HTTP headers - * - * @api - */ - public function __construct(array $headers = array()) - { - parent::__construct($headers); - - if (!isset($this->headers['cache-control'])) { - $this->set('Cache-Control', ''); - } - } - - /** - * {@inheritdoc} - */ - public function __toString() - { - $cookies = ''; - foreach ($this->getCookies() as $cookie) { - $cookies .= 'Set-Cookie: '.$cookie."\r\n"; - } - - ksort($this->headerNames); - - return parent::__toString().$cookies; - } - - /** - * Returns the headers, with original capitalizations. - * - * @return array An array of headers - */ - public function allPreserveCase() - { - return array_combine($this->headerNames, $this->headers); - } - - /** - * {@inheritdoc} - * - * @api - */ - public function replace(array $headers = array()) - { - $this->headerNames = array(); - - parent::replace($headers); - - if (!isset($this->headers['cache-control'])) { - $this->set('Cache-Control', ''); - } - } - - /** - * {@inheritdoc} - * - * @api - */ - public function set($key, $values, $replace = true) - { - parent::set($key, $values, $replace); - - $uniqueKey = strtr(strtolower($key), '_', '-'); - $this->headerNames[$uniqueKey] = $key; - - // ensure the cache-control header has sensible defaults - if (in_array($uniqueKey, array('cache-control', 'etag', 'last-modified', 'expires'))) { - $computed = $this->computeCacheControlValue(); - $this->headers['cache-control'] = array($computed); - $this->headerNames['cache-control'] = 'Cache-Control'; - $this->computedCacheControl = $this->parseCacheControl($computed); - } - } - - /** - * {@inheritdoc} - * - * @api - */ - public function remove($key) - { - parent::remove($key); - - $uniqueKey = strtr(strtolower($key), '_', '-'); - unset($this->headerNames[$uniqueKey]); - - if ('cache-control' === $uniqueKey) { - $this->computedCacheControl = array(); - } - } - - /** - * {@inheritdoc} - */ - public function hasCacheControlDirective($key) - { - return array_key_exists($key, $this->computedCacheControl); - } - - /** - * {@inheritdoc} - */ - public function getCacheControlDirective($key) - { - return array_key_exists($key, $this->computedCacheControl) ? $this->computedCacheControl[$key] : null; - } - - /** - * Sets a cookie. - * - * @param Cookie $cookie - * - * @api - */ - public function setCookie(Cookie $cookie) - { - $this->cookies[$cookie->getDomain()][$cookie->getPath()][$cookie->getName()] = $cookie; - } - - /** - * Removes a cookie from the array, but does not unset it in the browser. - * - * @param string $name - * @param string $path - * @param string $domain - * - * @api - */ - public function removeCookie($name, $path = '/', $domain = null) - { - if (null === $path) { - $path = '/'; - } - - unset($this->cookies[$domain][$path][$name]); - - if (empty($this->cookies[$domain][$path])) { - unset($this->cookies[$domain][$path]); - - if (empty($this->cookies[$domain])) { - unset($this->cookies[$domain]); - } - } - } - - /** - * Returns an array with all cookies. - * - * @param string $format - * - * @throws \InvalidArgumentException When the $format is invalid - * - * @return array - * - * @api - */ - public function getCookies($format = self::COOKIES_FLAT) - { - if (!in_array($format, array(self::COOKIES_FLAT, self::COOKIES_ARRAY))) { - throw new \InvalidArgumentException(sprintf('Format "%s" invalid (%s).', $format, implode(', ', array(self::COOKIES_FLAT, self::COOKIES_ARRAY)))); - } - - if (self::COOKIES_ARRAY === $format) { - return $this->cookies; - } - - $flattenedCookies = array(); - foreach ($this->cookies as $path) { - foreach ($path as $cookies) { - foreach ($cookies as $cookie) { - $flattenedCookies[] = $cookie; - } - } - } - - return $flattenedCookies; - } - - /** - * Clears a cookie in the browser. - * - * @param string $name - * @param string $path - * @param string $domain - * @param bool $secure - * @param bool $httpOnly - * - * @api - */ - public function clearCookie($name, $path = '/', $domain = null, $secure = false, $httpOnly = true) - { - $this->setCookie(new Cookie($name, null, 1, $path, $domain, $secure, $httpOnly)); - } - - /** - * Generates a HTTP Content-Disposition field-value. - * - * @param string $disposition One of "inline" or "attachment" - * @param string $filename A unicode string - * @param string $filenameFallback A string containing only ASCII characters that - * is semantically equivalent to $filename. If the filename is already ASCII, - * it can be omitted, or just copied from $filename - * - * @return string A string suitable for use as a Content-Disposition field-value. - * - * @throws \InvalidArgumentException - * - * @see RFC 6266 - */ - public function makeDisposition($disposition, $filename, $filenameFallback = '') - { - if (!in_array($disposition, array(self::DISPOSITION_ATTACHMENT, self::DISPOSITION_INLINE))) { - throw new \InvalidArgumentException(sprintf('The disposition must be either "%s" or "%s".', self::DISPOSITION_ATTACHMENT, self::DISPOSITION_INLINE)); - } - - if ('' == $filenameFallback) { - $filenameFallback = $filename; - } - - // filenameFallback is not ASCII. - if (!preg_match('/^[\x20-\x7e]*$/', $filenameFallback)) { - throw new \InvalidArgumentException('The filename fallback must only contain ASCII characters.'); - } - - // percent characters aren't safe in fallback. - if (false !== strpos($filenameFallback, '%')) { - throw new \InvalidArgumentException('The filename fallback cannot contain the "%" character.'); - } - - // path separators aren't allowed in either. - if (false !== strpos($filename, '/') || false !== strpos($filename, '\\') || false !== strpos($filenameFallback, '/') || false !== strpos($filenameFallback, '\\')) { - throw new \InvalidArgumentException('The filename and the fallback cannot contain the "/" and "\\" characters.'); - } - - $output = sprintf('%s; filename="%s"', $disposition, str_replace('"', '\\"', $filenameFallback)); - - if ($filename !== $filenameFallback) { - $output .= sprintf("; filename*=utf-8''%s", rawurlencode($filename)); - } - - return $output; - } - - /** - * Returns the calculated value of the cache-control header. - * - * This considers several other headers and calculates or modifies the - * cache-control header to a sensible, conservative value. - * - * @return string - */ - protected function computeCacheControlValue() - { - if (!$this->cacheControl && !$this->has('ETag') && !$this->has('Last-Modified') && !$this->has('Expires')) { - return 'no-cache'; - } - - if (!$this->cacheControl) { - // conservative by default - return 'private, must-revalidate'; - } - - $header = $this->getCacheControlHeader(); - if (isset($this->cacheControl['public']) || isset($this->cacheControl['private'])) { - return $header; - } - - // public if s-maxage is defined, private otherwise - if (!isset($this->cacheControl['s-maxage'])) { - return $header.', private'; - } - - return $header; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-foundation/ServerBag.php b/sitecake/2.2.9/server/vendor/symfony/http-foundation/ServerBag.php deleted file mode 100644 index fa1cb2f..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-foundation/ServerBag.php +++ /dev/null @@ -1,98 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation; - -/** - * ServerBag is a container for HTTP headers from the $_SERVER variable. - * - * @author Fabien Potencier - * @author Bulat Shakirzyanov - * @author Robert Kiss - */ -class ServerBag extends ParameterBag -{ - /** - * Gets the HTTP headers. - * - * @return array - */ - public function getHeaders() - { - $headers = array(); - $contentHeaders = array('CONTENT_LENGTH' => true, 'CONTENT_MD5' => true, 'CONTENT_TYPE' => true); - foreach ($this->parameters as $key => $value) { - if (0 === strpos($key, 'HTTP_')) { - $headers[substr($key, 5)] = $value; - } - // CONTENT_* are not prefixed with HTTP_ - elseif (isset($contentHeaders[$key])) { - $headers[$key] = $value; - } - } - - if (isset($this->parameters['PHP_AUTH_USER'])) { - $headers['PHP_AUTH_USER'] = $this->parameters['PHP_AUTH_USER']; - $headers['PHP_AUTH_PW'] = isset($this->parameters['PHP_AUTH_PW']) ? $this->parameters['PHP_AUTH_PW'] : ''; - } else { - /* - * php-cgi under Apache does not pass HTTP Basic user/pass to PHP by default - * For this workaround to work, add these lines to your .htaccess file: - * RewriteCond %{HTTP:Authorization} ^(.+)$ - * RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] - * - * A sample .htaccess file: - * RewriteEngine On - * RewriteCond %{HTTP:Authorization} ^(.+)$ - * RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] - * RewriteCond %{REQUEST_FILENAME} !-f - * RewriteRule ^(.*)$ app.php [QSA,L] - */ - - $authorizationHeader = null; - if (isset($this->parameters['HTTP_AUTHORIZATION'])) { - $authorizationHeader = $this->parameters['HTTP_AUTHORIZATION']; - } elseif (isset($this->parameters['REDIRECT_HTTP_AUTHORIZATION'])) { - $authorizationHeader = $this->parameters['REDIRECT_HTTP_AUTHORIZATION']; - } - - if (null !== $authorizationHeader) { - if (0 === stripos($authorizationHeader, 'basic ')) { - // Decode AUTHORIZATION header into PHP_AUTH_USER and PHP_AUTH_PW when authorization header is basic - $exploded = explode(':', base64_decode(substr($authorizationHeader, 6)), 2); - if (count($exploded) == 2) { - list($headers['PHP_AUTH_USER'], $headers['PHP_AUTH_PW']) = $exploded; - } - } elseif (empty($this->parameters['PHP_AUTH_DIGEST']) && (0 === stripos($authorizationHeader, 'digest '))) { - // In some circumstances PHP_AUTH_DIGEST needs to be set - $headers['PHP_AUTH_DIGEST'] = $authorizationHeader; - $this->parameters['PHP_AUTH_DIGEST'] = $authorizationHeader; - } elseif (0 === stripos($authorizationHeader, 'bearer ')) { - /* - * XXX: Since there is no PHP_AUTH_BEARER in PHP predefined variables, - * I'll just set $headers['AUTHORIZATION'] here. - * http://php.net/manual/en/reserved.variables.server.php - */ - $headers['AUTHORIZATION'] = $authorizationHeader; - } - } - } - - // PHP_AUTH_USER/PHP_AUTH_PW - if (isset($headers['PHP_AUTH_USER'])) { - $headers['AUTHORIZATION'] = 'Basic '.base64_encode($headers['PHP_AUTH_USER'].':'.$headers['PHP_AUTH_PW']); - } elseif (isset($headers['PHP_AUTH_DIGEST'])) { - $headers['AUTHORIZATION'] = $headers['PHP_AUTH_DIGEST']; - } - - return $headers; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Attribute/AttributeBag.php b/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Attribute/AttributeBag.php deleted file mode 100644 index af292e3..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Attribute/AttributeBag.php +++ /dev/null @@ -1,157 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Session\Attribute; - -/** - * This class relates to session attribute storage. - */ -class AttributeBag implements AttributeBagInterface, \IteratorAggregate, \Countable -{ - private $name = 'attributes'; - - /** - * @var string - */ - private $storageKey; - - /** - * @var array - */ - protected $attributes = array(); - - /** - * Constructor. - * - * @param string $storageKey The key used to store attributes in the session - */ - public function __construct($storageKey = '_sf2_attributes') - { - $this->storageKey = $storageKey; - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return $this->name; - } - - public function setName($name) - { - $this->name = $name; - } - - /** - * {@inheritdoc} - */ - public function initialize(array &$attributes) - { - $this->attributes = &$attributes; - } - - /** - * {@inheritdoc} - */ - public function getStorageKey() - { - return $this->storageKey; - } - - /** - * {@inheritdoc} - */ - public function has($name) - { - return array_key_exists($name, $this->attributes); - } - - /** - * {@inheritdoc} - */ - public function get($name, $default = null) - { - return array_key_exists($name, $this->attributes) ? $this->attributes[$name] : $default; - } - - /** - * {@inheritdoc} - */ - public function set($name, $value) - { - $this->attributes[$name] = $value; - } - - /** - * {@inheritdoc} - */ - public function all() - { - return $this->attributes; - } - - /** - * {@inheritdoc} - */ - public function replace(array $attributes) - { - $this->attributes = array(); - foreach ($attributes as $key => $value) { - $this->set($key, $value); - } - } - - /** - * {@inheritdoc} - */ - public function remove($name) - { - $retval = null; - if (array_key_exists($name, $this->attributes)) { - $retval = $this->attributes[$name]; - unset($this->attributes[$name]); - } - - return $retval; - } - - /** - * {@inheritdoc} - */ - public function clear() - { - $return = $this->attributes; - $this->attributes = array(); - - return $return; - } - - /** - * Returns an iterator for attributes. - * - * @return \ArrayIterator An \ArrayIterator instance - */ - public function getIterator() - { - return new \ArrayIterator($this->attributes); - } - - /** - * Returns the number of attributes. - * - * @return int The number of attributes - */ - public function count() - { - return count($this->attributes); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Attribute/AttributeBagInterface.php b/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Attribute/AttributeBagInterface.php deleted file mode 100644 index 0d8d179..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Attribute/AttributeBagInterface.php +++ /dev/null @@ -1,72 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Session\Attribute; - -use Symfony\Component\HttpFoundation\Session\SessionBagInterface; - -/** - * Attributes store. - * - * @author Drak - */ -interface AttributeBagInterface extends SessionBagInterface -{ - /** - * Checks if an attribute is defined. - * - * @param string $name The attribute name - * - * @return bool true if the attribute is defined, false otherwise - */ - public function has($name); - - /** - * Returns an attribute. - * - * @param string $name The attribute name - * @param mixed $default The default value if not found - * - * @return mixed - */ - public function get($name, $default = null); - - /** - * Sets an attribute. - * - * @param string $name - * @param mixed $value - */ - public function set($name, $value); - - /** - * Returns attributes. - * - * @return array Attributes - */ - public function all(); - - /** - * Sets attributes. - * - * @param array $attributes Attributes - */ - public function replace(array $attributes); - - /** - * Removes an attribute. - * - * @param string $name - * - * @return mixed The removed value or null when it does not exist - */ - public function remove($name); -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Attribute/NamespacedAttributeBag.php b/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Attribute/NamespacedAttributeBag.php deleted file mode 100644 index 68cecf6..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Attribute/NamespacedAttributeBag.php +++ /dev/null @@ -1,160 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Session\Attribute; - -/** - * This class provides structured storage of session attributes using - * a name spacing character in the key. - * - * @author Drak - */ -class NamespacedAttributeBag extends AttributeBag -{ - /** - * Namespace character. - * - * @var string - */ - private $namespaceCharacter; - - /** - * Constructor. - * - * @param string $storageKey Session storage key. - * @param string $namespaceCharacter Namespace character to use in keys. - */ - public function __construct($storageKey = '_sf2_attributes', $namespaceCharacter = '/') - { - $this->namespaceCharacter = $namespaceCharacter; - parent::__construct($storageKey); - } - - /** - * {@inheritdoc} - */ - public function has($name) - { - // reference mismatch: if fixed, re-introduced in array_key_exists; keep as it is - $attributes = $this->resolveAttributePath($name); - $name = $this->resolveKey($name); - - if (null === $attributes) { - return false; - } - - return array_key_exists($name, $attributes); - } - - /** - * {@inheritdoc} - */ - public function get($name, $default = null) - { - // reference mismatch: if fixed, re-introduced in array_key_exists; keep as it is - $attributes = $this->resolveAttributePath($name); - $name = $this->resolveKey($name); - - if (null === $attributes) { - return $default; - } - - return array_key_exists($name, $attributes) ? $attributes[$name] : $default; - } - - /** - * {@inheritdoc} - */ - public function set($name, $value) - { - $attributes = &$this->resolveAttributePath($name, true); - $name = $this->resolveKey($name); - $attributes[$name] = $value; - } - - /** - * {@inheritdoc} - */ - public function remove($name) - { - $retval = null; - $attributes = &$this->resolveAttributePath($name); - $name = $this->resolveKey($name); - if (null !== $attributes && array_key_exists($name, $attributes)) { - $retval = $attributes[$name]; - unset($attributes[$name]); - } - - return $retval; - } - - /** - * Resolves a path in attributes property and returns it as a reference. - * - * This method allows structured namespacing of session attributes. - * - * @param string $name Key name - * @param bool $writeContext Write context, default false - * - * @return array - */ - protected function &resolveAttributePath($name, $writeContext = false) - { - $array = &$this->attributes; - $name = (strpos($name, $this->namespaceCharacter) === 0) ? substr($name, 1) : $name; - - // Check if there is anything to do, else return - if (!$name) { - return $array; - } - - $parts = explode($this->namespaceCharacter, $name); - if (count($parts) < 2) { - if (!$writeContext) { - return $array; - } - - $array[$parts[0]] = array(); - - return $array; - } - - unset($parts[count($parts) - 1]); - - foreach ($parts as $part) { - if (null !== $array && !array_key_exists($part, $array)) { - $array[$part] = $writeContext ? array() : null; - } - - $array = &$array[$part]; - } - - return $array; - } - - /** - * Resolves the key from the name. - * - * This is the last part in a dot separated string. - * - * @param string $name - * - * @return string - */ - protected function resolveKey($name) - { - if (false !== $pos = strrpos($name, $this->namespaceCharacter)) { - $name = substr($name, $pos + 1); - } - - return $name; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Flash/AutoExpireFlashBag.php b/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Flash/AutoExpireFlashBag.php deleted file mode 100644 index b9de5ce..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Flash/AutoExpireFlashBag.php +++ /dev/null @@ -1,175 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Session\Flash; - -/** - * AutoExpireFlashBag flash message container. - * - * @author Drak - */ -class AutoExpireFlashBag implements FlashBagInterface -{ - private $name = 'flashes'; - - /** - * Flash messages. - * - * @var array - */ - private $flashes = array('display' => array(), 'new' => array()); - - /** - * The storage key for flashes in the session. - * - * @var string - */ - private $storageKey; - - /** - * Constructor. - * - * @param string $storageKey The key used to store flashes in the session. - */ - public function __construct($storageKey = '_sf2_flashes') - { - $this->storageKey = $storageKey; - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return $this->name; - } - - public function setName($name) - { - $this->name = $name; - } - - /** - * {@inheritdoc} - */ - public function initialize(array &$flashes) - { - $this->flashes = &$flashes; - - // The logic: messages from the last request will be stored in new, so we move them to previous - // This request we will show what is in 'display'. What is placed into 'new' this time round will - // be moved to display next time round. - $this->flashes['display'] = array_key_exists('new', $this->flashes) ? $this->flashes['new'] : array(); - $this->flashes['new'] = array(); - } - - /** - * {@inheritdoc} - */ - public function add($type, $message) - { - $this->flashes['new'][$type][] = $message; - } - - /** - * {@inheritdoc} - */ - public function peek($type, array $default = array()) - { - return $this->has($type) ? $this->flashes['display'][$type] : $default; - } - - /** - * {@inheritdoc} - */ - public function peekAll() - { - return array_key_exists('display', $this->flashes) ? (array) $this->flashes['display'] : array(); - } - - /** - * {@inheritdoc} - */ - public function get($type, array $default = array()) - { - $return = $default; - - if (!$this->has($type)) { - return $return; - } - - if (isset($this->flashes['display'][$type])) { - $return = $this->flashes['display'][$type]; - unset($this->flashes['display'][$type]); - } - - return $return; - } - - /** - * {@inheritdoc} - */ - public function all() - { - $return = $this->flashes['display']; - $this->flashes = array('new' => array(), 'display' => array()); - - return $return; - } - - /** - * {@inheritdoc} - */ - public function setAll(array $messages) - { - $this->flashes['new'] = $messages; - } - - /** - * {@inheritdoc} - */ - public function set($type, $messages) - { - $this->flashes['new'][$type] = (array) $messages; - } - - /** - * {@inheritdoc} - */ - public function has($type) - { - return array_key_exists($type, $this->flashes['display']) && $this->flashes['display'][$type]; - } - - /** - * {@inheritdoc} - */ - public function keys() - { - return array_keys($this->flashes['display']); - } - - /** - * {@inheritdoc} - */ - public function getStorageKey() - { - return $this->storageKey; - } - - /** - * {@inheritdoc} - */ - public function clear() - { - return $this->all(); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Flash/FlashBag.php b/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Flash/FlashBag.php deleted file mode 100644 index 0da7715..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Flash/FlashBag.php +++ /dev/null @@ -1,182 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Session\Flash; - -/** - * FlashBag flash message container. - * - * \IteratorAggregate implementation is deprecated and will be removed in 3.0. - * - * @author Drak - */ -class FlashBag implements FlashBagInterface, \IteratorAggregate -{ - private $name = 'flashes'; - - /** - * Flash messages. - * - * @var array - */ - private $flashes = array(); - - /** - * The storage key for flashes in the session. - * - * @var string - */ - private $storageKey; - - /** - * Constructor. - * - * @param string $storageKey The key used to store flashes in the session. - */ - public function __construct($storageKey = '_sf2_flashes') - { - $this->storageKey = $storageKey; - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return $this->name; - } - - public function setName($name) - { - $this->name = $name; - } - - /** - * {@inheritdoc} - */ - public function initialize(array &$flashes) - { - $this->flashes = &$flashes; - } - - /** - * {@inheritdoc} - */ - public function add($type, $message) - { - $this->flashes[$type][] = $message; - } - - /** - * {@inheritdoc} - */ - public function peek($type, array $default = array()) - { - return $this->has($type) ? $this->flashes[$type] : $default; - } - - /** - * {@inheritdoc} - */ - public function peekAll() - { - return $this->flashes; - } - - /** - * {@inheritdoc} - */ - public function get($type, array $default = array()) - { - if (!$this->has($type)) { - return $default; - } - - $return = $this->flashes[$type]; - - unset($this->flashes[$type]); - - return $return; - } - - /** - * {@inheritdoc} - */ - public function all() - { - $return = $this->peekAll(); - $this->flashes = array(); - - return $return; - } - - /** - * {@inheritdoc} - */ - public function set($type, $messages) - { - $this->flashes[$type] = (array) $messages; - } - - /** - * {@inheritdoc} - */ - public function setAll(array $messages) - { - $this->flashes = $messages; - } - - /** - * {@inheritdoc} - */ - public function has($type) - { - return array_key_exists($type, $this->flashes) && $this->flashes[$type]; - } - - /** - * {@inheritdoc} - */ - public function keys() - { - return array_keys($this->flashes); - } - - /** - * {@inheritdoc} - */ - public function getStorageKey() - { - return $this->storageKey; - } - - /** - * {@inheritdoc} - */ - public function clear() - { - return $this->all(); - } - - /** - * Returns an iterator for flashes. - * - * @deprecated since version 2.4, to be removed in 3.0. - * - * @return \ArrayIterator An \ArrayIterator instance - */ - public function getIterator() - { - @trigger_error('The '.__METHOD__.' method is deprecated since version 2.4 and will be removed in 3.0.', E_USER_DEPRECATED); - - return new \ArrayIterator($this->all()); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Flash/FlashBagInterface.php b/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Flash/FlashBagInterface.php deleted file mode 100644 index be79d9d..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Flash/FlashBagInterface.php +++ /dev/null @@ -1,93 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Session\Flash; - -use Symfony\Component\HttpFoundation\Session\SessionBagInterface; - -/** - * FlashBagInterface. - * - * @author Drak - */ -interface FlashBagInterface extends SessionBagInterface -{ - /** - * Adds a flash message for type. - * - * @param string $type - * @param string $message - */ - public function add($type, $message); - - /** - * Registers a message for a given type. - * - * @param string $type - * @param string|array $message - */ - public function set($type, $message); - - /** - * Gets flash messages for a given type. - * - * @param string $type Message category type. - * @param array $default Default value if $type does not exist. - * - * @return array - */ - public function peek($type, array $default = array()); - - /** - * Gets all flash messages. - * - * @return array - */ - public function peekAll(); - - /** - * Gets and clears flash from the stack. - * - * @param string $type - * @param array $default Default value if $type does not exist. - * - * @return array - */ - public function get($type, array $default = array()); - - /** - * Gets and clears flashes from the stack. - * - * @return array - */ - public function all(); - - /** - * Sets all flash messages. - */ - public function setAll(array $messages); - - /** - * Has flash messages for a given type? - * - * @param string $type - * - * @return bool - */ - public function has($type); - - /** - * Returns a list of all defined types. - * - * @return array - */ - public function keys(); -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Session.php b/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Session.php deleted file mode 100644 index ac626fd..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Session.php +++ /dev/null @@ -1,251 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Session; - -use Symfony\Component\HttpFoundation\Session\Storage\SessionStorageInterface; -use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag; -use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBagInterface; -use Symfony\Component\HttpFoundation\Session\Flash\FlashBag; -use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface; -use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage; - -/** - * Session. - * - * @author Fabien Potencier - * @author Drak - * - * @api - */ -class Session implements SessionInterface, \IteratorAggregate, \Countable -{ - /** - * Storage driver. - * - * @var SessionStorageInterface - */ - protected $storage; - - /** - * @var string - */ - private $flashName; - - /** - * @var string - */ - private $attributeName; - - /** - * Constructor. - * - * @param SessionStorageInterface $storage A SessionStorageInterface instance. - * @param AttributeBagInterface $attributes An AttributeBagInterface instance, (defaults null for default AttributeBag) - * @param FlashBagInterface $flashes A FlashBagInterface instance (defaults null for default FlashBag) - */ - public function __construct(SessionStorageInterface $storage = null, AttributeBagInterface $attributes = null, FlashBagInterface $flashes = null) - { - $this->storage = $storage ?: new NativeSessionStorage(); - - $attributes = $attributes ?: new AttributeBag(); - $this->attributeName = $attributes->getName(); - $this->registerBag($attributes); - - $flashes = $flashes ?: new FlashBag(); - $this->flashName = $flashes->getName(); - $this->registerBag($flashes); - } - - /** - * {@inheritdoc} - */ - public function start() - { - return $this->storage->start(); - } - - /** - * {@inheritdoc} - */ - public function has($name) - { - return $this->storage->getBag($this->attributeName)->has($name); - } - - /** - * {@inheritdoc} - */ - public function get($name, $default = null) - { - return $this->storage->getBag($this->attributeName)->get($name, $default); - } - - /** - * {@inheritdoc} - */ - public function set($name, $value) - { - $this->storage->getBag($this->attributeName)->set($name, $value); - } - - /** - * {@inheritdoc} - */ - public function all() - { - return $this->storage->getBag($this->attributeName)->all(); - } - - /** - * {@inheritdoc} - */ - public function replace(array $attributes) - { - $this->storage->getBag($this->attributeName)->replace($attributes); - } - - /** - * {@inheritdoc} - */ - public function remove($name) - { - return $this->storage->getBag($this->attributeName)->remove($name); - } - - /** - * {@inheritdoc} - */ - public function clear() - { - $this->storage->getBag($this->attributeName)->clear(); - } - - /** - * {@inheritdoc} - */ - public function isStarted() - { - return $this->storage->isStarted(); - } - - /** - * Returns an iterator for attributes. - * - * @return \ArrayIterator An \ArrayIterator instance - */ - public function getIterator() - { - return new \ArrayIterator($this->storage->getBag($this->attributeName)->all()); - } - - /** - * Returns the number of attributes. - * - * @return int The number of attributes - */ - public function count() - { - return count($this->storage->getBag($this->attributeName)->all()); - } - - /** - * {@inheritdoc} - */ - public function invalidate($lifetime = null) - { - $this->storage->clear(); - - return $this->migrate(true, $lifetime); - } - - /** - * {@inheritdoc} - */ - public function migrate($destroy = false, $lifetime = null) - { - return $this->storage->regenerate($destroy, $lifetime); - } - - /** - * {@inheritdoc} - */ - public function save() - { - $this->storage->save(); - } - - /** - * {@inheritdoc} - */ - public function getId() - { - return $this->storage->getId(); - } - - /** - * {@inheritdoc} - */ - public function setId($id) - { - $this->storage->setId($id); - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return $this->storage->getName(); - } - - /** - * {@inheritdoc} - */ - public function setName($name) - { - $this->storage->setName($name); - } - - /** - * {@inheritdoc} - */ - public function getMetadataBag() - { - return $this->storage->getMetadataBag(); - } - - /** - * {@inheritdoc} - */ - public function registerBag(SessionBagInterface $bag) - { - $this->storage->registerBag($bag); - } - - /** - * {@inheritdoc} - */ - public function getBag($name) - { - return $this->storage->getBag($name); - } - - /** - * Gets the flashbag interface. - * - * @return FlashBagInterface - */ - public function getFlashBag() - { - return $this->getBag($this->flashName); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/SessionBagInterface.php b/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/SessionBagInterface.php deleted file mode 100644 index 182a47d..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/SessionBagInterface.php +++ /dev/null @@ -1,48 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Session; - -/** - * Session Bag store. - * - * @author Drak - */ -interface SessionBagInterface -{ - /** - * Gets this bag's name. - * - * @return string - */ - public function getName(); - - /** - * Initializes the Bag. - * - * @param array $array - */ - public function initialize(array &$array); - - /** - * Gets the storage key for this bag. - * - * @return string - */ - public function getStorageKey(); - - /** - * Clears out data from bag. - * - * @return mixed Whatever data was contained. - */ - public function clear(); -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/SessionInterface.php b/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/SessionInterface.php deleted file mode 100644 index 773dc7a..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/SessionInterface.php +++ /dev/null @@ -1,208 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Session; - -use Symfony\Component\HttpFoundation\Session\Storage\MetadataBag; - -/** - * Interface for the session. - * - * @author Drak - */ -interface SessionInterface -{ - /** - * Starts the session storage. - * - * @return bool True if session started. - * - * @throws \RuntimeException If session fails to start. - * - * @api - */ - public function start(); - - /** - * Returns the session ID. - * - * @return string The session ID. - * - * @api - */ - public function getId(); - - /** - * Sets the session ID. - * - * @param string $id - * - * @api - */ - public function setId($id); - - /** - * Returns the session name. - * - * @return mixed The session name. - * - * @api - */ - public function getName(); - - /** - * Sets the session name. - * - * @param string $name - * - * @api - */ - public function setName($name); - - /** - * Invalidates the current session. - * - * Clears all session attributes and flashes and regenerates the - * session and deletes the old session from persistence. - * - * @param int $lifetime Sets the cookie lifetime for the session cookie. A null value - * will leave the system settings unchanged, 0 sets the cookie - * to expire with browser session. Time is in seconds, and is - * not a Unix timestamp. - * - * @return bool True if session invalidated, false if error. - * - * @api - */ - public function invalidate($lifetime = null); - - /** - * Migrates the current session to a new session id while maintaining all - * session attributes. - * - * @param bool $destroy Whether to delete the old session or leave it to garbage collection. - * @param int $lifetime Sets the cookie lifetime for the session cookie. A null value - * will leave the system settings unchanged, 0 sets the cookie - * to expire with browser session. Time is in seconds, and is - * not a Unix timestamp. - * - * @return bool True if session migrated, false if error. - * - * @api - */ - public function migrate($destroy = false, $lifetime = null); - - /** - * Force the session to be saved and closed. - * - * This method is generally not required for real sessions as - * the session will be automatically saved at the end of - * code execution. - */ - public function save(); - - /** - * Checks if an attribute is defined. - * - * @param string $name The attribute name - * - * @return bool true if the attribute is defined, false otherwise - * - * @api - */ - public function has($name); - - /** - * Returns an attribute. - * - * @param string $name The attribute name - * @param mixed $default The default value if not found. - * - * @return mixed - * - * @api - */ - public function get($name, $default = null); - - /** - * Sets an attribute. - * - * @param string $name - * @param mixed $value - * - * @api - */ - public function set($name, $value); - - /** - * Returns attributes. - * - * @return array Attributes - * - * @api - */ - public function all(); - - /** - * Sets attributes. - * - * @param array $attributes Attributes - */ - public function replace(array $attributes); - - /** - * Removes an attribute. - * - * @param string $name - * - * @return mixed The removed value or null when it does not exist - * - * @api - */ - public function remove($name); - - /** - * Clears all attributes. - * - * @api - */ - public function clear(); - - /** - * Checks if the session was started. - * - * @return bool - */ - public function isStarted(); - - /** - * Registers a SessionBagInterface with the session. - * - * @param SessionBagInterface $bag - */ - public function registerBag(SessionBagInterface $bag); - - /** - * Gets a bag instance by name. - * - * @param string $name - * - * @return SessionBagInterface - */ - public function getBag($name); - - /** - * Gets session meta. - * - * @return MetadataBag - */ - public function getMetadataBag(); -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Storage/Handler/LegacyPdoSessionHandler.php b/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Storage/Handler/LegacyPdoSessionHandler.php deleted file mode 100644 index eefaf8d..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Storage/Handler/LegacyPdoSessionHandler.php +++ /dev/null @@ -1,271 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Session\Storage\Handler; - -@trigger_error('The '.__NAMESPACE__.'\LegacyPdoSessionHandler class is deprecated since version 2.6 and will be removed in 3.0. Use the Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler class instead.', E_USER_DEPRECATED); - -/** - * Session handler using a PDO connection to read and write data. - * - * Session data is a binary string that can contain non-printable characters like the null byte. - * For this reason this handler base64 encodes the data to be able to save it in a character column. - * - * This version of the PdoSessionHandler does NOT implement locking. So concurrent requests to the - * same session can result in data loss due to race conditions. - * - * @author Fabien Potencier - * @author Michael Williams - * @author Tobias Schultze - * - * @deprecated since version 2.6, to be removed in 3.0. Use - * {@link PdoSessionHandler} instead. - */ -class LegacyPdoSessionHandler implements \SessionHandlerInterface -{ - /** - * @var \PDO PDO instance - */ - private $pdo; - - /** - * @var string Table name - */ - private $table; - - /** - * @var string Column for session id - */ - private $idCol; - - /** - * @var string Column for session data - */ - private $dataCol; - - /** - * @var string Column for timestamp - */ - private $timeCol; - - /** - * Constructor. - * - * List of available options: - * * db_table: The name of the table [required] - * * db_id_col: The column where to store the session id [default: sess_id] - * * db_data_col: The column where to store the session data [default: sess_data] - * * db_time_col: The column where to store the timestamp [default: sess_time] - * - * @param \PDO $pdo A \PDO instance - * @param array $dbOptions An associative array of DB options - * - * @throws \InvalidArgumentException When "db_table" option is not provided - */ - public function __construct(\PDO $pdo, array $dbOptions = array()) - { - if (!array_key_exists('db_table', $dbOptions)) { - throw new \InvalidArgumentException('You must provide the "db_table" option for a PdoSessionStorage.'); - } - if (\PDO::ERRMODE_EXCEPTION !== $pdo->getAttribute(\PDO::ATTR_ERRMODE)) { - throw new \InvalidArgumentException(sprintf('"%s" requires PDO error mode attribute be set to throw Exceptions (i.e. $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION))', __CLASS__)); - } - - $this->pdo = $pdo; - $dbOptions = array_merge(array( - 'db_id_col' => 'sess_id', - 'db_data_col' => 'sess_data', - 'db_time_col' => 'sess_time', - ), $dbOptions); - - $this->table = $dbOptions['db_table']; - $this->idCol = $dbOptions['db_id_col']; - $this->dataCol = $dbOptions['db_data_col']; - $this->timeCol = $dbOptions['db_time_col']; - } - - /** - * {@inheritdoc} - */ - public function open($savePath, $sessionName) - { - return true; - } - - /** - * {@inheritdoc} - */ - public function close() - { - return true; - } - - /** - * {@inheritdoc} - */ - public function destroy($sessionId) - { - // delete the record associated with this id - $sql = "DELETE FROM $this->table WHERE $this->idCol = :id"; - - try { - $stmt = $this->pdo->prepare($sql); - $stmt->bindParam(':id', $sessionId, \PDO::PARAM_STR); - $stmt->execute(); - } catch (\PDOException $e) { - throw new \RuntimeException(sprintf('PDOException was thrown when trying to delete a session: %s', $e->getMessage()), 0, $e); - } - - return true; - } - - /** - * {@inheritdoc} - */ - public function gc($maxlifetime) - { - // delete the session records that have expired - $sql = "DELETE FROM $this->table WHERE $this->timeCol < :time"; - - try { - $stmt = $this->pdo->prepare($sql); - $stmt->bindValue(':time', time() - $maxlifetime, \PDO::PARAM_INT); - $stmt->execute(); - } catch (\PDOException $e) { - throw new \RuntimeException(sprintf('PDOException was thrown when trying to delete expired sessions: %s', $e->getMessage()), 0, $e); - } - - return true; - } - - /** - * {@inheritdoc} - */ - public function read($sessionId) - { - $sql = "SELECT $this->dataCol FROM $this->table WHERE $this->idCol = :id"; - - try { - $stmt = $this->pdo->prepare($sql); - $stmt->bindParam(':id', $sessionId, \PDO::PARAM_STR); - $stmt->execute(); - - // We use fetchAll instead of fetchColumn to make sure the DB cursor gets closed - $sessionRows = $stmt->fetchAll(\PDO::FETCH_NUM); - - if ($sessionRows) { - return base64_decode($sessionRows[0][0]); - } - - return ''; - } catch (\PDOException $e) { - throw new \RuntimeException(sprintf('PDOException was thrown when trying to read the session data: %s', $e->getMessage()), 0, $e); - } - } - - /** - * {@inheritdoc} - */ - public function write($sessionId, $data) - { - $encoded = base64_encode($data); - - try { - // We use a single MERGE SQL query when supported by the database. - $mergeSql = $this->getMergeSql(); - - if (null !== $mergeSql) { - $mergeStmt = $this->pdo->prepare($mergeSql); - $mergeStmt->bindParam(':id', $sessionId, \PDO::PARAM_STR); - $mergeStmt->bindParam(':data', $encoded, \PDO::PARAM_STR); - $mergeStmt->bindValue(':time', time(), \PDO::PARAM_INT); - $mergeStmt->execute(); - - return true; - } - - $updateStmt = $this->pdo->prepare( - "UPDATE $this->table SET $this->dataCol = :data, $this->timeCol = :time WHERE $this->idCol = :id" - ); - $updateStmt->bindParam(':id', $sessionId, \PDO::PARAM_STR); - $updateStmt->bindParam(':data', $encoded, \PDO::PARAM_STR); - $updateStmt->bindValue(':time', time(), \PDO::PARAM_INT); - $updateStmt->execute(); - - // When MERGE is not supported, like in Postgres, we have to use this approach that can result in - // duplicate key errors when the same session is written simultaneously. We can just catch such an - // error and re-execute the update. This is similar to a serializable transaction with retry logic - // on serialization failures but without the overhead and without possible false positives due to - // longer gap locking. - if (!$updateStmt->rowCount()) { - try { - $insertStmt = $this->pdo->prepare( - "INSERT INTO $this->table ($this->idCol, $this->dataCol, $this->timeCol) VALUES (:id, :data, :time)" - ); - $insertStmt->bindParam(':id', $sessionId, \PDO::PARAM_STR); - $insertStmt->bindParam(':data', $encoded, \PDO::PARAM_STR); - $insertStmt->bindValue(':time', time(), \PDO::PARAM_INT); - $insertStmt->execute(); - } catch (\PDOException $e) { - // Handle integrity violation SQLSTATE 23000 (or a subclass like 23505 in Postgres) for duplicate keys - if (0 === strpos($e->getCode(), '23')) { - $updateStmt->execute(); - } else { - throw $e; - } - } - } - } catch (\PDOException $e) { - throw new \RuntimeException(sprintf('PDOException was thrown when trying to write the session data: %s', $e->getMessage()), 0, $e); - } - - return true; - } - - /** - * Returns a merge/upsert (i.e. insert or update) SQL query when supported by the database. - * - * @return string|null The SQL string or null when not supported - */ - private function getMergeSql() - { - $driver = $this->pdo->getAttribute(\PDO::ATTR_DRIVER_NAME); - - switch ($driver) { - case 'mysql': - return "INSERT INTO $this->table ($this->idCol, $this->dataCol, $this->timeCol) VALUES (:id, :data, :time) ". - "ON DUPLICATE KEY UPDATE $this->dataCol = VALUES($this->dataCol), $this->timeCol = VALUES($this->timeCol)"; - case 'oci': - // DUAL is Oracle specific dummy table - return "MERGE INTO $this->table USING DUAL ON ($this->idCol = :id) ". - "WHEN NOT MATCHED THEN INSERT ($this->idCol, $this->dataCol, $this->timeCol) VALUES (:id, :data, :time) ". - "WHEN MATCHED THEN UPDATE SET $this->dataCol = :data, $this->timeCol = :time"; - case 'sqlsrv' === $driver && version_compare($this->pdo->getAttribute(\PDO::ATTR_SERVER_VERSION), '10', '>='): - // MERGE is only available since SQL Server 2008 and must be terminated by semicolon - // It also requires HOLDLOCK according to http://weblogs.sqlteam.com/dang/archive/2009/01/31/UPSERT-Race-Condition-With-MERGE.aspx - return "MERGE INTO $this->table WITH (HOLDLOCK) USING (SELECT 1 AS dummy) AS src ON ($this->idCol = :id) ". - "WHEN NOT MATCHED THEN INSERT ($this->idCol, $this->dataCol, $this->timeCol) VALUES (:id, :data, :time) ". - "WHEN MATCHED THEN UPDATE SET $this->dataCol = :data, $this->timeCol = :time;"; - case 'sqlite': - return "INSERT OR REPLACE INTO $this->table ($this->idCol, $this->dataCol, $this->timeCol) VALUES (:id, :data, :time)"; - } - } - - /** - * Return a PDO instance - * - * @return \PDO - */ - protected function getConnection() - { - return $this->pdo; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Storage/Handler/MemcacheSessionHandler.php b/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Storage/Handler/MemcacheSessionHandler.php deleted file mode 100644 index 183093f..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Storage/Handler/MemcacheSessionHandler.php +++ /dev/null @@ -1,119 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Session\Storage\Handler; - -/** - * MemcacheSessionHandler. - * - * @author Drak - */ -class MemcacheSessionHandler implements \SessionHandlerInterface -{ - /** - * @var \Memcache Memcache driver. - */ - private $memcache; - - /** - * @var int Time to live in seconds - */ - private $ttl; - - /** - * @var string Key prefix for shared environments. - */ - private $prefix; - - /** - * Constructor. - * - * List of available options: - * * prefix: The prefix to use for the memcache keys in order to avoid collision - * * expiretime: The time to live in seconds - * - * @param \Memcache $memcache A \Memcache instance - * @param array $options An associative array of Memcache options - * - * @throws \InvalidArgumentException When unsupported options are passed - */ - public function __construct(\Memcache $memcache, array $options = array()) - { - if ($diff = array_diff(array_keys($options), array('prefix', 'expiretime'))) { - throw new \InvalidArgumentException(sprintf( - 'The following options are not supported "%s"', implode(', ', $diff) - )); - } - - $this->memcache = $memcache; - $this->ttl = isset($options['expiretime']) ? (int) $options['expiretime'] : 86400; - $this->prefix = isset($options['prefix']) ? $options['prefix'] : 'sf2s'; - } - - /** - * {@inheritdoc} - */ - public function open($savePath, $sessionName) - { - return true; - } - - /** - * {@inheritdoc} - */ - public function close() - { - return $this->memcache->close(); - } - - /** - * {@inheritdoc} - */ - public function read($sessionId) - { - return $this->memcache->get($this->prefix.$sessionId) ?: ''; - } - - /** - * {@inheritdoc} - */ - public function write($sessionId, $data) - { - return $this->memcache->set($this->prefix.$sessionId, $data, 0, time() + $this->ttl); - } - - /** - * {@inheritdoc} - */ - public function destroy($sessionId) - { - return $this->memcache->delete($this->prefix.$sessionId); - } - - /** - * {@inheritdoc} - */ - public function gc($maxlifetime) - { - // not required here because memcache will auto expire the records anyhow. - return true; - } - - /** - * Return a Memcache instance - * - * @return \Memcache - */ - protected function getMemcache() - { - return $this->memcache; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Storage/Handler/MemcachedSessionHandler.php b/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Storage/Handler/MemcachedSessionHandler.php deleted file mode 100644 index 1f9d97e..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Storage/Handler/MemcachedSessionHandler.php +++ /dev/null @@ -1,125 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Session\Storage\Handler; - -/** - * MemcachedSessionHandler. - * - * Memcached based session storage handler based on the Memcached class - * provided by the PHP memcached extension. - * - * @see http://php.net/memcached - * - * @author Drak - */ -class MemcachedSessionHandler implements \SessionHandlerInterface -{ - /** - * @var \Memcached Memcached driver. - */ - private $memcached; - - /** - * @var int Time to live in seconds - */ - private $ttl; - - /** - * @var string Key prefix for shared environments. - */ - private $prefix; - - /** - * Constructor. - * - * List of available options: - * * prefix: The prefix to use for the memcached keys in order to avoid collision - * * expiretime: The time to live in seconds - * - * @param \Memcached $memcached A \Memcached instance - * @param array $options An associative array of Memcached options - * - * @throws \InvalidArgumentException When unsupported options are passed - */ - public function __construct(\Memcached $memcached, array $options = array()) - { - $this->memcached = $memcached; - - if ($diff = array_diff(array_keys($options), array('prefix', 'expiretime'))) { - throw new \InvalidArgumentException(sprintf( - 'The following options are not supported "%s"', implode(', ', $diff) - )); - } - - $this->ttl = isset($options['expiretime']) ? (int) $options['expiretime'] : 86400; - $this->prefix = isset($options['prefix']) ? $options['prefix'] : 'sf2s'; - } - - /** - * {@inheritdoc} - */ - public function open($savePath, $sessionName) - { - return true; - } - - /** - * {@inheritdoc} - */ - public function close() - { - return true; - } - - /** - * {@inheritdoc} - */ - public function read($sessionId) - { - return $this->memcached->get($this->prefix.$sessionId) ?: ''; - } - - /** - * {@inheritdoc} - */ - public function write($sessionId, $data) - { - return $this->memcached->set($this->prefix.$sessionId, $data, time() + $this->ttl); - } - - /** - * {@inheritdoc} - */ - public function destroy($sessionId) - { - return $this->memcached->delete($this->prefix.$sessionId); - } - - /** - * {@inheritdoc} - */ - public function gc($maxlifetime) - { - // not required here because memcached will auto expire the records anyhow. - return true; - } - - /** - * Return a Memcached instance - * - * @return \Memcached - */ - protected function getMemcached() - { - return $this->memcached; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Storage/Handler/MongoDbSessionHandler.php b/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Storage/Handler/MongoDbSessionHandler.php deleted file mode 100644 index fa4ecfb..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Storage/Handler/MongoDbSessionHandler.php +++ /dev/null @@ -1,188 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Session\Storage\Handler; - -/** - * MongoDB session handler. - * - * @author Markus Bachmann - */ -class MongoDbSessionHandler implements \SessionHandlerInterface -{ - /** - * @var \Mongo - */ - private $mongo; - - /** - * @var \MongoCollection - */ - private $collection; - - /** - * @var array - */ - private $options; - - /** - * Constructor. - * - * List of available options: - * * database: The name of the database [required] - * * collection: The name of the collection [required] - * * id_field: The field name for storing the session id [default: _id] - * * data_field: The field name for storing the session data [default: data] - * * time_field: The field name for storing the timestamp [default: time] - * * expiry_field: The field name for storing the expiry-timestamp [default: expires_at] - * - * It is strongly recommended to put an index on the `expiry_field` for - * garbage-collection. Alternatively it's possible to automatically expire - * the sessions in the database as described below: - * - * A TTL collections can be used on MongoDB 2.2+ to cleanup expired sessions - * automatically. Such an index can for example look like this: - * - * db..ensureIndex( - * { "": 1 }, - * { "expireAfterSeconds": 0 } - * ) - * - * More details on: http://docs.mongodb.org/manual/tutorial/expire-data/ - * - * If you use such an index, you can drop `gc_probability` to 0 since - * no garbage-collection is required. - * - * @param \Mongo|\MongoClient $mongo A MongoClient or Mongo instance - * @param array $options An associative array of field options - * - * @throws \InvalidArgumentException When MongoClient or Mongo instance not provided - * @throws \InvalidArgumentException When "database" or "collection" not provided - */ - public function __construct($mongo, array $options) - { - if (!($mongo instanceof \MongoClient || $mongo instanceof \Mongo)) { - throw new \InvalidArgumentException('MongoClient or Mongo instance required'); - } - - if (!isset($options['database']) || !isset($options['collection'])) { - throw new \InvalidArgumentException('You must provide the "database" and "collection" option for MongoDBSessionHandler'); - } - - $this->mongo = $mongo; - - $this->options = array_merge(array( - 'id_field' => '_id', - 'data_field' => 'data', - 'time_field' => 'time', - 'expiry_field' => 'expires_at', - ), $options); - } - - /** - * {@inheritdoc} - */ - public function open($savePath, $sessionName) - { - return true; - } - - /** - * {@inheritdoc} - */ - public function close() - { - return true; - } - - /** - * {@inheritdoc} - */ - public function destroy($sessionId) - { - $this->getCollection()->remove(array( - $this->options['id_field'] => $sessionId, - )); - - return true; - } - - /** - * {@inheritdoc} - */ - public function gc($maxlifetime) - { - $this->getCollection()->remove(array( - $this->options['expiry_field'] => array('$lt' => new \MongoDate()), - )); - - return true; - } - - /** - * {@inheritdoc} - */ - public function write($sessionId, $data) - { - $expiry = new \MongoDate(time() + (int) ini_get('session.gc_maxlifetime')); - - $fields = array( - $this->options['data_field'] => new \MongoBinData($data, \MongoBinData::BYTE_ARRAY), - $this->options['time_field'] => new \MongoDate(), - $this->options['expiry_field'] => $expiry, - ); - - $this->getCollection()->update( - array($this->options['id_field'] => $sessionId), - array('$set' => $fields), - array('upsert' => true, 'multiple' => false) - ); - - return true; - } - - /** - * {@inheritdoc} - */ - public function read($sessionId) - { - $dbData = $this->getCollection()->findOne(array( - $this->options['id_field'] => $sessionId, - $this->options['expiry_field'] => array('$gte' => new \MongoDate()), - )); - - return null === $dbData ? '' : $dbData[$this->options['data_field']]->bin; - } - - /** - * Return a "MongoCollection" instance. - * - * @return \MongoCollection - */ - private function getCollection() - { - if (null === $this->collection) { - $this->collection = $this->mongo->selectCollection($this->options['database'], $this->options['collection']); - } - - return $this->collection; - } - - /** - * Return a Mongo instance - * - * @return \Mongo - */ - protected function getMongo() - { - return $this->mongo; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Storage/Handler/NativeFileSessionHandler.php b/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Storage/Handler/NativeFileSessionHandler.php deleted file mode 100644 index f39235c..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Storage/Handler/NativeFileSessionHandler.php +++ /dev/null @@ -1,58 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Session\Storage\Handler; - -/** - * NativeFileSessionHandler. - * - * Native session handler using PHP's built in file storage. - * - * @author Drak - */ -class NativeFileSessionHandler extends NativeSessionHandler -{ - /** - * Constructor. - * - * @param string $savePath Path of directory to save session files. - * Default null will leave setting as defined by PHP. - * '/path', 'N;/path', or 'N;octal-mode;/path - * - * @see http://php.net/session.configuration.php#ini.session.save-path for further details. - * - * @throws \InvalidArgumentException On invalid $savePath - */ - public function __construct($savePath = null) - { - if (null === $savePath) { - $savePath = ini_get('session.save_path'); - } - - $baseDir = $savePath; - - if ($count = substr_count($savePath, ';')) { - if ($count > 2) { - throw new \InvalidArgumentException(sprintf('Invalid argument $savePath \'%s\'', $savePath)); - } - - // characters after last ';' are the path - $baseDir = ltrim(strrchr($savePath, ';'), ';'); - } - - if ($baseDir && !is_dir($baseDir)) { - mkdir($baseDir, 0777, true); - } - - ini_set('session.save_path', $savePath); - ini_set('session.save_handler', 'files'); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Storage/Handler/NativeSessionHandler.php b/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Storage/Handler/NativeSessionHandler.php deleted file mode 100644 index 95d5cdb..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Storage/Handler/NativeSessionHandler.php +++ /dev/null @@ -1,24 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Session\Storage\Handler; - -// Adds SessionHandler functionality if available. -// @see http://php.net/sessionhandler -if (PHP_VERSION_ID >= 50400) { - class NativeSessionHandler extends \SessionHandler - { - } -} else { - class NativeSessionHandler - { - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Storage/Handler/NullSessionHandler.php b/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Storage/Handler/NullSessionHandler.php deleted file mode 100644 index d88ce89..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Storage/Handler/NullSessionHandler.php +++ /dev/null @@ -1,72 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Session\Storage\Handler; - -/** - * NullSessionHandler. - * - * Can be used in unit testing or in a situations where persisted sessions are not desired. - * - * @author Drak - * - * @api - */ -class NullSessionHandler implements \SessionHandlerInterface -{ - /** - * {@inheritdoc} - */ - public function open($savePath, $sessionName) - { - return true; - } - - /** - * {@inheritdoc} - */ - public function close() - { - return true; - } - - /** - * {@inheritdoc} - */ - public function read($sessionId) - { - return ''; - } - - /** - * {@inheritdoc} - */ - public function write($sessionId, $data) - { - return true; - } - - /** - * {@inheritdoc} - */ - public function destroy($sessionId) - { - return true; - } - - /** - * {@inheritdoc} - */ - public function gc($maxlifetime) - { - return true; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php b/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php deleted file mode 100644 index 32b7396..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php +++ /dev/null @@ -1,695 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Session\Storage\Handler; - -/** - * Session handler using a PDO connection to read and write data. - * - * It works with MySQL, PostgreSQL, Oracle, SQL Server and SQLite and implements - * different locking strategies to handle concurrent access to the same session. - * Locking is necessary to prevent loss of data due to race conditions and to keep - * the session data consistent between read() and write(). With locking, requests - * for the same session will wait until the other one finished writing. For this - * reason it's best practice to close a session as early as possible to improve - * concurrency. PHPs internal files session handler also implements locking. - * - * Attention: Since SQLite does not support row level locks but locks the whole database, - * it means only one session can be accessed at a time. Even different sessions would wait - * for another to finish. So saving session in SQLite should only be considered for - * development or prototypes. - * - * Session data is a binary string that can contain non-printable characters like the null byte. - * For this reason it must be saved in a binary column in the database like BLOB in MySQL. - * Saving it in a character column could corrupt the data. You can use createTable() - * to initialize a correctly defined table. - * - * @see http://php.net/sessionhandlerinterface - * - * @author Fabien Potencier - * @author Michael Williams - * @author Tobias Schultze - */ -class PdoSessionHandler implements \SessionHandlerInterface -{ - /** - * No locking is done. This means sessions are prone to loss of data due to - * race conditions of concurrent requests to the same session. The last session - * write will win in this case. It might be useful when you implement your own - * logic to deal with this like an optimistic approach. - */ - const LOCK_NONE = 0; - - /** - * Creates an application-level lock on a session. The disadvantage is that the - * lock is not enforced by the database and thus other, unaware parts of the - * application could still concurrently modify the session. The advantage is it - * does not require a transaction. - * This mode is not available for SQLite and not yet implemented for oci and sqlsrv. - */ - const LOCK_ADVISORY = 1; - - /** - * Issues a real row lock. Since it uses a transaction between opening and - * closing a session, you have to be careful when you use same database connection - * that you also use for your application logic. This mode is the default because - * it's the only reliable solution across DBMSs. - */ - const LOCK_TRANSACTIONAL = 2; - - /** - * @var \PDO|null PDO instance or null when not connected yet - */ - private $pdo; - - /** - * @var string|null|false DSN string or null for session.save_path or false when lazy connection disabled - */ - private $dsn = false; - - /** - * @var string Database driver - */ - private $driver; - - /** - * @var string Table name - */ - private $table = 'sessions'; - - /** - * @var string Column for session id - */ - private $idCol = 'sess_id'; - - /** - * @var string Column for session data - */ - private $dataCol = 'sess_data'; - - /** - * @var string Column for lifetime - */ - private $lifetimeCol = 'sess_lifetime'; - - /** - * @var string Column for timestamp - */ - private $timeCol = 'sess_time'; - - /** - * @var string Username when lazy-connect - */ - private $username = ''; - - /** - * @var string Password when lazy-connect - */ - private $password = ''; - - /** - * @var array Connection options when lazy-connect - */ - private $connectionOptions = array(); - - /** - * @var int The strategy for locking, see constants - */ - private $lockMode = self::LOCK_TRANSACTIONAL; - - /** - * It's an array to support multiple reads before closing which is manual, non-standard usage - * - * @var \PDOStatement[] An array of statements to release advisory locks - */ - private $unlockStatements = array(); - - /** - * @var bool True when the current session exists but expired according to session.gc_maxlifetime - */ - private $sessionExpired = false; - - /** - * @var bool Whether a transaction is active - */ - private $inTransaction = false; - - /** - * @var bool Whether gc() has been called - */ - private $gcCalled = false; - - /** - * Constructor. - * - * You can either pass an existing database connection as PDO instance or - * pass a DSN string that will be used to lazy-connect to the database - * when the session is actually used. Furthermore it's possible to pass null - * which will then use the session.save_path ini setting as PDO DSN parameter. - * - * List of available options: - * * db_table: The name of the table [default: sessions] - * * db_id_col: The column where to store the session id [default: sess_id] - * * db_data_col: The column where to store the session data [default: sess_data] - * * db_lifetime_col: The column where to store the lifetime [default: sess_lifetime] - * * db_time_col: The column where to store the timestamp [default: sess_time] - * * db_username: The username when lazy-connect [default: ''] - * * db_password: The password when lazy-connect [default: ''] - * * db_connection_options: An array of driver-specific connection options [default: array()] - * * lock_mode: The strategy for locking, see constants [default: LOCK_TRANSACTIONAL] - * - * @param \PDO|string|null $pdoOrDsn A \PDO instance or DSN string or null - * @param array $options An associative array of options - * - * @throws \InvalidArgumentException When PDO error mode is not PDO::ERRMODE_EXCEPTION - */ - public function __construct($pdoOrDsn = null, array $options = array()) - { - if ($pdoOrDsn instanceof \PDO) { - if (\PDO::ERRMODE_EXCEPTION !== $pdoOrDsn->getAttribute(\PDO::ATTR_ERRMODE)) { - throw new \InvalidArgumentException(sprintf('"%s" requires PDO error mode attribute be set to throw Exceptions (i.e. $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION))', __CLASS__)); - } - - $this->pdo = $pdoOrDsn; - $this->driver = $this->pdo->getAttribute(\PDO::ATTR_DRIVER_NAME); - } else { - $this->dsn = $pdoOrDsn; - } - - $this->table = isset($options['db_table']) ? $options['db_table'] : $this->table; - $this->idCol = isset($options['db_id_col']) ? $options['db_id_col'] : $this->idCol; - $this->dataCol = isset($options['db_data_col']) ? $options['db_data_col'] : $this->dataCol; - $this->lifetimeCol = isset($options['db_lifetime_col']) ? $options['db_lifetime_col'] : $this->lifetimeCol; - $this->timeCol = isset($options['db_time_col']) ? $options['db_time_col'] : $this->timeCol; - $this->username = isset($options['db_username']) ? $options['db_username'] : $this->username; - $this->password = isset($options['db_password']) ? $options['db_password'] : $this->password; - $this->connectionOptions = isset($options['db_connection_options']) ? $options['db_connection_options'] : $this->connectionOptions; - $this->lockMode = isset($options['lock_mode']) ? $options['lock_mode'] : $this->lockMode; - } - - /** - * Creates the table to store sessions which can be called once for setup. - * - * Session ID is saved in a column of maximum length 128 because that is enough even - * for a 512 bit configured session.hash_function like Whirlpool. Session data is - * saved in a BLOB. One could also use a shorter inlined varbinary column - * if one was sure the data fits into it. - * - * @throws \PDOException When the table already exists - * @throws \DomainException When an unsupported PDO driver is used - */ - public function createTable() - { - // connect if we are not yet - $this->getConnection(); - - switch ($this->driver) { - case 'mysql': - // We use varbinary for the ID column because it prevents unwanted conversions: - // - character set conversions between server and client - // - trailing space removal - // - case-insensitivity - // - language processing like é == e - $sql = "CREATE TABLE $this->table ($this->idCol VARBINARY(128) NOT NULL PRIMARY KEY, $this->dataCol BLOB NOT NULL, $this->lifetimeCol MEDIUMINT NOT NULL, $this->timeCol INTEGER UNSIGNED NOT NULL) COLLATE utf8_bin, ENGINE = InnoDB"; - break; - case 'sqlite': - $sql = "CREATE TABLE $this->table ($this->idCol TEXT NOT NULL PRIMARY KEY, $this->dataCol BLOB NOT NULL, $this->lifetimeCol INTEGER NOT NULL, $this->timeCol INTEGER NOT NULL)"; - break; - case 'pgsql': - $sql = "CREATE TABLE $this->table ($this->idCol VARCHAR(128) NOT NULL PRIMARY KEY, $this->dataCol BYTEA NOT NULL, $this->lifetimeCol INTEGER NOT NULL, $this->timeCol INTEGER NOT NULL)"; - break; - case 'oci': - $sql = "CREATE TABLE $this->table ($this->idCol VARCHAR2(128) NOT NULL PRIMARY KEY, $this->dataCol BLOB NOT NULL, $this->lifetimeCol INTEGER NOT NULL, $this->timeCol INTEGER NOT NULL)"; - break; - case 'sqlsrv': - $sql = "CREATE TABLE $this->table ($this->idCol VARCHAR(128) NOT NULL PRIMARY KEY, $this->dataCol VARBINARY(MAX) NOT NULL, $this->lifetimeCol INTEGER NOT NULL, $this->timeCol INTEGER NOT NULL)"; - break; - default: - throw new \DomainException(sprintf('Creating the session table is currently not implemented for PDO driver "%s".', $this->driver)); - } - - try { - $this->pdo->exec($sql); - } catch (\PDOException $e) { - $this->rollback(); - - throw $e; - } - } - - /** - * Returns true when the current session exists but expired according to session.gc_maxlifetime. - * - * Can be used to distinguish between a new session and one that expired due to inactivity. - * - * @return bool Whether current session expired - */ - public function isSessionExpired() - { - return $this->sessionExpired; - } - - /** - * {@inheritdoc} - */ - public function open($savePath, $sessionName) - { - if (null === $this->pdo) { - $this->connect($this->dsn ?: $savePath); - } - - return true; - } - - /** - * {@inheritdoc} - */ - public function read($sessionId) - { - try { - return $this->doRead($sessionId); - } catch (\PDOException $e) { - $this->rollback(); - - throw $e; - } - } - - /** - * {@inheritdoc} - */ - public function gc($maxlifetime) - { - // We delay gc() to close() so that it is executed outside the transactional and blocking read-write process. - // This way, pruning expired sessions does not block them from being started while the current session is used. - $this->gcCalled = true; - - return true; - } - - /** - * {@inheritdoc} - */ - public function destroy($sessionId) - { - // delete the record associated with this id - $sql = "DELETE FROM $this->table WHERE $this->idCol = :id"; - - try { - $stmt = $this->pdo->prepare($sql); - $stmt->bindParam(':id', $sessionId, \PDO::PARAM_STR); - $stmt->execute(); - } catch (\PDOException $e) { - $this->rollback(); - - throw $e; - } - - return true; - } - - /** - * {@inheritdoc} - */ - public function write($sessionId, $data) - { - $maxlifetime = (int) ini_get('session.gc_maxlifetime'); - - try { - // We use a single MERGE SQL query when supported by the database. - $mergeSql = $this->getMergeSql(); - - if (null !== $mergeSql) { - $mergeStmt = $this->pdo->prepare($mergeSql); - $mergeStmt->bindParam(':id', $sessionId, \PDO::PARAM_STR); - $mergeStmt->bindParam(':data', $data, \PDO::PARAM_LOB); - $mergeStmt->bindParam(':lifetime', $maxlifetime, \PDO::PARAM_INT); - $mergeStmt->bindValue(':time', time(), \PDO::PARAM_INT); - $mergeStmt->execute(); - - return true; - } - - $updateStmt = $this->pdo->prepare( - "UPDATE $this->table SET $this->dataCol = :data, $this->lifetimeCol = :lifetime, $this->timeCol = :time WHERE $this->idCol = :id" - ); - $updateStmt->bindParam(':id', $sessionId, \PDO::PARAM_STR); - $updateStmt->bindParam(':data', $data, \PDO::PARAM_LOB); - $updateStmt->bindParam(':lifetime', $maxlifetime, \PDO::PARAM_INT); - $updateStmt->bindValue(':time', time(), \PDO::PARAM_INT); - $updateStmt->execute(); - - // When MERGE is not supported, like in Postgres, we have to use this approach that can result in - // duplicate key errors when the same session is written simultaneously (given the LOCK_NONE behavior). - // We can just catch such an error and re-execute the update. This is similar to a serializable - // transaction with retry logic on serialization failures but without the overhead and without possible - // false positives due to longer gap locking. - if (!$updateStmt->rowCount()) { - try { - $insertStmt = $this->pdo->prepare( - "INSERT INTO $this->table ($this->idCol, $this->dataCol, $this->lifetimeCol, $this->timeCol) VALUES (:id, :data, :lifetime, :time)" - ); - $insertStmt->bindParam(':id', $sessionId, \PDO::PARAM_STR); - $insertStmt->bindParam(':data', $data, \PDO::PARAM_LOB); - $insertStmt->bindParam(':lifetime', $maxlifetime, \PDO::PARAM_INT); - $insertStmt->bindValue(':time', time(), \PDO::PARAM_INT); - $insertStmt->execute(); - } catch (\PDOException $e) { - // Handle integrity violation SQLSTATE 23000 (or a subclass like 23505 in Postgres) for duplicate keys - if (0 === strpos($e->getCode(), '23')) { - $updateStmt->execute(); - } else { - throw $e; - } - } - } - } catch (\PDOException $e) { - $this->rollback(); - - throw $e; - } - - return true; - } - - /** - * {@inheritdoc} - */ - public function close() - { - $this->commit(); - - while ($unlockStmt = array_shift($this->unlockStatements)) { - $unlockStmt->execute(); - } - - if ($this->gcCalled) { - $this->gcCalled = false; - - // delete the session records that have expired - $sql = "DELETE FROM $this->table WHERE $this->lifetimeCol + $this->timeCol < :time"; - - $stmt = $this->pdo->prepare($sql); - $stmt->bindValue(':time', time(), \PDO::PARAM_INT); - $stmt->execute(); - } - - if (false !== $this->dsn) { - $this->pdo = null; // only close lazy-connection - } - - return true; - } - - /** - * Lazy-connects to the database. - * - * @param string $dsn DSN string - */ - private function connect($dsn) - { - $this->pdo = new \PDO($dsn, $this->username, $this->password, $this->connectionOptions); - $this->pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); - $this->driver = $this->pdo->getAttribute(\PDO::ATTR_DRIVER_NAME); - } - - /** - * Helper method to begin a transaction. - * - * Since SQLite does not support row level locks, we have to acquire a reserved lock - * on the database immediately. Because of https://bugs.php.net/42766 we have to create - * such a transaction manually which also means we cannot use PDO::commit or - * PDO::rollback or PDO::inTransaction for SQLite. - * - * Also MySQLs default isolation, REPEATABLE READ, causes deadlock for different sessions - * due to http://www.mysqlperformanceblog.com/2013/12/12/one-more-innodb-gap-lock-to-avoid/ . - * So we change it to READ COMMITTED. - */ - private function beginTransaction() - { - if (!$this->inTransaction) { - if ('sqlite' === $this->driver) { - $this->pdo->exec('BEGIN IMMEDIATE TRANSACTION'); - } else { - if ('mysql' === $this->driver) { - $this->pdo->exec('SET TRANSACTION ISOLATION LEVEL READ COMMITTED'); - } - $this->pdo->beginTransaction(); - } - $this->inTransaction = true; - } - } - - /** - * Helper method to commit a transaction. - */ - private function commit() - { - if ($this->inTransaction) { - try { - // commit read-write transaction which also releases the lock - if ('sqlite' === $this->driver) { - $this->pdo->exec('COMMIT'); - } else { - $this->pdo->commit(); - } - $this->inTransaction = false; - } catch (\PDOException $e) { - $this->rollback(); - - throw $e; - } - } - } - - /** - * Helper method to rollback a transaction. - */ - private function rollback() - { - // We only need to rollback if we are in a transaction. Otherwise the resulting - // error would hide the real problem why rollback was called. We might not be - // in a transaction when not using the transactional locking behavior or when - // two callbacks (e.g. destroy and write) are invoked that both fail. - if ($this->inTransaction) { - if ('sqlite' === $this->driver) { - $this->pdo->exec('ROLLBACK'); - } else { - $this->pdo->rollback(); - } - $this->inTransaction = false; - } - } - - /** - * Reads the session data in respect to the different locking strategies. - * - * We need to make sure we do not return session data that is already considered garbage according - * to the session.gc_maxlifetime setting because gc() is called after read() and only sometimes. - * - * @param string $sessionId Session ID - * - * @return string The session data - */ - private function doRead($sessionId) - { - $this->sessionExpired = false; - - if (self::LOCK_ADVISORY === $this->lockMode) { - $this->unlockStatements[] = $this->doAdvisoryLock($sessionId); - } - - $selectSql = $this->getSelectSql(); - $selectStmt = $this->pdo->prepare($selectSql); - $selectStmt->bindParam(':id', $sessionId, \PDO::PARAM_STR); - $selectStmt->execute(); - - $sessionRows = $selectStmt->fetchAll(\PDO::FETCH_NUM); - - if ($sessionRows) { - if ($sessionRows[0][1] + $sessionRows[0][2] < time()) { - $this->sessionExpired = true; - - return ''; - } - - return is_resource($sessionRows[0][0]) ? stream_get_contents($sessionRows[0][0]) : $sessionRows[0][0]; - } - - if (self::LOCK_TRANSACTIONAL === $this->lockMode && 'sqlite' !== $this->driver) { - // Exclusive-reading of non-existent rows does not block, so we need to do an insert to block - // until other connections to the session are committed. - try { - $insertStmt = $this->pdo->prepare( - "INSERT INTO $this->table ($this->idCol, $this->dataCol, $this->lifetimeCol, $this->timeCol) VALUES (:id, :data, :lifetime, :time)" - ); - $insertStmt->bindParam(':id', $sessionId, \PDO::PARAM_STR); - $insertStmt->bindValue(':data', '', \PDO::PARAM_LOB); - $insertStmt->bindValue(':lifetime', 0, \PDO::PARAM_INT); - $insertStmt->bindValue(':time', time(), \PDO::PARAM_INT); - $insertStmt->execute(); - } catch (\PDOException $e) { - // Catch duplicate key error because other connection created the session already. - // It would only not be the case when the other connection destroyed the session. - if (0 === strpos($e->getCode(), '23')) { - // Retrieve finished session data written by concurrent connection. SELECT - // FOR UPDATE is necessary to avoid deadlock of connection that starts reading - // before we write (transform intention to real lock). - $selectStmt->execute(); - $sessionRows = $selectStmt->fetchAll(\PDO::FETCH_NUM); - - if ($sessionRows) { - return is_resource($sessionRows[0][0]) ? stream_get_contents($sessionRows[0][0]) : $sessionRows[0][0]; - } - - return ''; - } - - throw $e; - } - } - - return ''; - } - - /** - * Executes an application-level lock on the database. - * - * @param string $sessionId Session ID - * - * @return \PDOStatement The statement that needs to be executed later to release the lock - * - * @throws \DomainException When an unsupported PDO driver is used - * - * @todo implement missing advisory locks - * - for oci using DBMS_LOCK.REQUEST - * - for sqlsrv using sp_getapplock with LockOwner = Session - */ - private function doAdvisoryLock($sessionId) - { - switch ($this->driver) { - case 'mysql': - // should we handle the return value? 0 on timeout, null on error - // we use a timeout of 50 seconds which is also the default for innodb_lock_wait_timeout - $stmt = $this->pdo->prepare('SELECT GET_LOCK(:key, 50)'); - $stmt->bindValue(':key', $sessionId, \PDO::PARAM_STR); - $stmt->execute(); - - $releaseStmt = $this->pdo->prepare('DO RELEASE_LOCK(:key)'); - $releaseStmt->bindValue(':key', $sessionId, \PDO::PARAM_STR); - - return $releaseStmt; - case 'pgsql': - // Obtaining an exclusive session level advisory lock requires an integer key. - // So we convert the HEX representation of the session id to an integer. - // Since integers are signed, we have to skip one hex char to fit in the range. - if (4 === PHP_INT_SIZE) { - $sessionInt1 = hexdec(substr($sessionId, 0, 7)); - $sessionInt2 = hexdec(substr($sessionId, 7, 7)); - - $stmt = $this->pdo->prepare('SELECT pg_advisory_lock(:key1, :key2)'); - $stmt->bindValue(':key1', $sessionInt1, \PDO::PARAM_INT); - $stmt->bindValue(':key2', $sessionInt2, \PDO::PARAM_INT); - $stmt->execute(); - - $releaseStmt = $this->pdo->prepare('SELECT pg_advisory_unlock(:key1, :key2)'); - $releaseStmt->bindValue(':key1', $sessionInt1, \PDO::PARAM_INT); - $releaseStmt->bindValue(':key2', $sessionInt2, \PDO::PARAM_INT); - } else { - $sessionBigInt = hexdec(substr($sessionId, 0, 15)); - - $stmt = $this->pdo->prepare('SELECT pg_advisory_lock(:key)'); - $stmt->bindValue(':key', $sessionBigInt, \PDO::PARAM_INT); - $stmt->execute(); - - $releaseStmt = $this->pdo->prepare('SELECT pg_advisory_unlock(:key)'); - $releaseStmt->bindValue(':key', $sessionBigInt, \PDO::PARAM_INT); - } - - return $releaseStmt; - case 'sqlite': - throw new \DomainException('SQLite does not support advisory locks.'); - default: - throw new \DomainException(sprintf('Advisory locks are currently not implemented for PDO driver "%s".', $this->driver)); - } - } - - /** - * Return a locking or nonlocking SQL query to read session information. - * - * @return string The SQL string - * - * @throws \DomainException When an unsupported PDO driver is used - */ - private function getSelectSql() - { - if (self::LOCK_TRANSACTIONAL === $this->lockMode) { - $this->beginTransaction(); - - switch ($this->driver) { - case 'mysql': - case 'oci': - case 'pgsql': - return "SELECT $this->dataCol, $this->lifetimeCol, $this->timeCol FROM $this->table WHERE $this->idCol = :id FOR UPDATE"; - case 'sqlsrv': - return "SELECT $this->dataCol, $this->lifetimeCol, $this->timeCol FROM $this->table WITH (UPDLOCK, ROWLOCK) WHERE $this->idCol = :id"; - case 'sqlite': - // we already locked when starting transaction - break; - default: - throw new \DomainException(sprintf('Transactional locks are currently not implemented for PDO driver "%s".', $this->driver)); - } - } - - return "SELECT $this->dataCol, $this->lifetimeCol, $this->timeCol FROM $this->table WHERE $this->idCol = :id"; - } - - /** - * Returns a merge/upsert (i.e. insert or update) SQL query when supported by the database for writing session data. - * - * @return string|null The SQL string or null when not supported - */ - private function getMergeSql() - { - switch ($this->driver) { - case 'mysql': - return "INSERT INTO $this->table ($this->idCol, $this->dataCol, $this->lifetimeCol, $this->timeCol) VALUES (:id, :data, :lifetime, :time) ". - "ON DUPLICATE KEY UPDATE $this->dataCol = VALUES($this->dataCol), $this->lifetimeCol = VALUES($this->lifetimeCol), $this->timeCol = VALUES($this->timeCol)"; - case 'oci': - // DUAL is Oracle specific dummy table - return "MERGE INTO $this->table USING DUAL ON ($this->idCol = :id) ". - "WHEN NOT MATCHED THEN INSERT ($this->idCol, $this->dataCol, $this->lifetimeCol, $this->timeCol) VALUES (:id, :data, :lifetime, :time) ". - "WHEN MATCHED THEN UPDATE SET $this->dataCol = :data, $this->lifetimeCol = :lifetime, $this->timeCol = :time"; - case 'sqlsrv' === $this->driver && version_compare($this->pdo->getAttribute(\PDO::ATTR_SERVER_VERSION), '10', '>='): - // MERGE is only available since SQL Server 2008 and must be terminated by semicolon - // It also requires HOLDLOCK according to http://weblogs.sqlteam.com/dang/archive/2009/01/31/UPSERT-Race-Condition-With-MERGE.aspx - return "MERGE INTO $this->table WITH (HOLDLOCK) USING (SELECT 1 AS dummy) AS src ON ($this->idCol = :id) ". - "WHEN NOT MATCHED THEN INSERT ($this->idCol, $this->dataCol, $this->lifetimeCol, $this->timeCol) VALUES (:id, :data, :lifetime, :time) ". - "WHEN MATCHED THEN UPDATE SET $this->dataCol = :data, $this->lifetimeCol = :lifetime, $this->timeCol = :time;"; - case 'sqlite': - return "INSERT OR REPLACE INTO $this->table ($this->idCol, $this->dataCol, $this->lifetimeCol, $this->timeCol) VALUES (:id, :data, :lifetime, :time)"; - } - } - - /** - * Return a PDO instance - * - * @return \PDO - */ - protected function getConnection() - { - if (null === $this->pdo) { - $this->connect($this->dsn ?: ini_get('session.save_path')); - } - - return $this->pdo; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Storage/Handler/WriteCheckSessionHandler.php b/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Storage/Handler/WriteCheckSessionHandler.php deleted file mode 100644 index d49c36c..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Storage/Handler/WriteCheckSessionHandler.php +++ /dev/null @@ -1,91 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Session\Storage\Handler; - -/** - * Wraps another SessionHandlerInterface to only write the session when it has been modified. - * - * @author Adrien Brault - */ -class WriteCheckSessionHandler implements \SessionHandlerInterface -{ - /** - * @var \SessionHandlerInterface - */ - private $wrappedSessionHandler; - - /** - * @var array sessionId => session - */ - private $readSessions; - - public function __construct(\SessionHandlerInterface $wrappedSessionHandler) - { - $this->wrappedSessionHandler = $wrappedSessionHandler; - } - - /** - * {@inheritdoc} - */ - public function close() - { - return $this->wrappedSessionHandler->close(); - } - - /** - * {@inheritdoc} - */ - public function destroy($sessionId) - { - return $this->wrappedSessionHandler->destroy($sessionId); - } - - /** - * {@inheritdoc} - */ - public function gc($maxlifetime) - { - return $this->wrappedSessionHandler->gc($maxlifetime); - } - - /** - * {@inheritdoc} - */ - public function open($savePath, $sessionName) - { - return $this->wrappedSessionHandler->open($savePath, $sessionName); - } - - /** - * {@inheritdoc} - */ - public function read($sessionId) - { - $session = $this->wrappedSessionHandler->read($sessionId); - - $this->readSessions[$sessionId] = $session; - - return $session; - } - - /** - * {@inheritdoc} - */ - public function write($sessionId, $data) - { - if (isset($this->readSessions[$sessionId]) && $data === $this->readSessions[$sessionId]) { - return true; - } - - return $this->wrappedSessionHandler->write($sessionId, $data); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Storage/MetadataBag.php b/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Storage/MetadataBag.php deleted file mode 100644 index ec7b267..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Storage/MetadataBag.php +++ /dev/null @@ -1,170 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Session\Storage; - -use Symfony\Component\HttpFoundation\Session\SessionBagInterface; - -/** - * Metadata container. - * - * Adds metadata to the session. - * - * @author Drak - */ -class MetadataBag implements SessionBagInterface -{ - const CREATED = 'c'; - const UPDATED = 'u'; - const LIFETIME = 'l'; - - /** - * @var string - */ - private $name = '__metadata'; - - /** - * @var string - */ - private $storageKey; - - /** - * @var array - */ - protected $meta = array(self::CREATED => 0, self::UPDATED => 0, self::LIFETIME => 0); - - /** - * Unix timestamp. - * - * @var int - */ - private $lastUsed; - - /** - * @var int - */ - private $updateThreshold; - - /** - * Constructor. - * - * @param string $storageKey The key used to store bag in the session. - * @param int $updateThreshold The time to wait between two UPDATED updates - */ - public function __construct($storageKey = '_sf2_meta', $updateThreshold = 0) - { - $this->storageKey = $storageKey; - $this->updateThreshold = $updateThreshold; - } - - /** - * {@inheritdoc} - */ - public function initialize(array &$array) - { - $this->meta = &$array; - - if (isset($array[self::CREATED])) { - $this->lastUsed = $this->meta[self::UPDATED]; - - $timeStamp = time(); - if ($timeStamp - $array[self::UPDATED] >= $this->updateThreshold) { - $this->meta[self::UPDATED] = $timeStamp; - } - } else { - $this->stampCreated(); - } - } - - /** - * Gets the lifetime that the session cookie was set with. - * - * @return int - */ - public function getLifetime() - { - return $this->meta[self::LIFETIME]; - } - - /** - * Stamps a new session's metadata. - * - * @param int $lifetime Sets the cookie lifetime for the session cookie. A null value - * will leave the system settings unchanged, 0 sets the cookie - * to expire with browser session. Time is in seconds, and is - * not a Unix timestamp. - */ - public function stampNew($lifetime = null) - { - $this->stampCreated($lifetime); - } - - /** - * {@inheritdoc} - */ - public function getStorageKey() - { - return $this->storageKey; - } - - /** - * Gets the created timestamp metadata. - * - * @return int Unix timestamp - */ - public function getCreated() - { - return $this->meta[self::CREATED]; - } - - /** - * Gets the last used metadata. - * - * @return int Unix timestamp - */ - public function getLastUsed() - { - return $this->lastUsed; - } - - /** - * {@inheritdoc} - */ - public function clear() - { - // nothing to do - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return $this->name; - } - - /** - * Sets name. - * - * @param string $name - */ - public function setName($name) - { - $this->name = $name; - } - - private function stampCreated($lifetime = null) - { - $timeStamp = time(); - $this->meta[self::CREATED] = $this->meta[self::UPDATED] = $this->lastUsed = $timeStamp; - $this->meta[self::LIFETIME] = (null === $lifetime) ? ini_get('session.cookie_lifetime') : $lifetime; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Storage/MockArraySessionStorage.php b/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Storage/MockArraySessionStorage.php deleted file mode 100644 index f3eeb08..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Storage/MockArraySessionStorage.php +++ /dev/null @@ -1,268 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Session\Storage; - -use Symfony\Component\HttpFoundation\Session\SessionBagInterface; - -/** - * MockArraySessionStorage mocks the session for unit tests. - * - * No PHP session is actually started since a session can be initialized - * and shutdown only once per PHP execution cycle. - * - * When doing functional testing, you should use MockFileSessionStorage instead. - * - * @author Fabien Potencier - * @author Bulat Shakirzyanov - * @author Drak - */ -class MockArraySessionStorage implements SessionStorageInterface -{ - /** - * @var string - */ - protected $id = ''; - - /** - * @var string - */ - protected $name; - - /** - * @var bool - */ - protected $started = false; - - /** - * @var bool - */ - protected $closed = false; - - /** - * @var array - */ - protected $data = array(); - - /** - * @var MetadataBag - */ - protected $metadataBag; - - /** - * @var array - */ - protected $bags; - - /** - * Constructor. - * - * @param string $name Session name - * @param MetadataBag $metaBag MetadataBag instance. - */ - public function __construct($name = 'MOCKSESSID', MetadataBag $metaBag = null) - { - $this->name = $name; - $this->setMetadataBag($metaBag); - } - - /** - * Sets the session data. - * - * @param array $array - */ - public function setSessionData(array $array) - { - $this->data = $array; - } - - /** - * {@inheritdoc} - */ - public function start() - { - if ($this->started) { - return true; - } - - if (empty($this->id)) { - $this->id = $this->generateId(); - } - - $this->loadSession(); - - return true; - } - - /** - * {@inheritdoc} - */ - public function regenerate($destroy = false, $lifetime = null) - { - if (!$this->started) { - $this->start(); - } - - $this->metadataBag->stampNew($lifetime); - $this->id = $this->generateId(); - - return true; - } - - /** - * {@inheritdoc} - */ - public function getId() - { - return $this->id; - } - - /** - * {@inheritdoc} - */ - public function setId($id) - { - if ($this->started) { - throw new \LogicException('Cannot set session ID after the session has started.'); - } - - $this->id = $id; - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return $this->name; - } - - /** - * {@inheritdoc} - */ - public function setName($name) - { - $this->name = $name; - } - - /** - * {@inheritdoc} - */ - public function save() - { - if (!$this->started || $this->closed) { - throw new \RuntimeException('Trying to save a session that was not started yet or was already closed'); - } - // nothing to do since we don't persist the session data - $this->closed = false; - $this->started = false; - } - - /** - * {@inheritdoc} - */ - public function clear() - { - // clear out the bags - foreach ($this->bags as $bag) { - $bag->clear(); - } - - // clear out the session - $this->data = array(); - - // reconnect the bags to the session - $this->loadSession(); - } - - /** - * {@inheritdoc} - */ - public function registerBag(SessionBagInterface $bag) - { - $this->bags[$bag->getName()] = $bag; - } - - /** - * {@inheritdoc} - */ - public function getBag($name) - { - if (!isset($this->bags[$name])) { - throw new \InvalidArgumentException(sprintf('The SessionBagInterface %s is not registered.', $name)); - } - - if (!$this->started) { - $this->start(); - } - - return $this->bags[$name]; - } - - /** - * {@inheritdoc} - */ - public function isStarted() - { - return $this->started; - } - - /** - * Sets the MetadataBag. - * - * @param MetadataBag $bag - */ - public function setMetadataBag(MetadataBag $bag = null) - { - if (null === $bag) { - $bag = new MetadataBag(); - } - - $this->metadataBag = $bag; - } - - /** - * Gets the MetadataBag. - * - * @return MetadataBag - */ - public function getMetadataBag() - { - return $this->metadataBag; - } - - /** - * Generates a session ID. - * - * This doesn't need to be particularly cryptographically secure since this is just - * a mock. - * - * @return string - */ - protected function generateId() - { - return hash('sha256', uniqid(mt_rand())); - } - - protected function loadSession() - { - $bags = array_merge($this->bags, array($this->metadataBag)); - - foreach ($bags as $bag) { - $key = $bag->getStorageKey(); - $this->data[$key] = isset($this->data[$key]) ? $this->data[$key] : array(); - $bag->initialize($this->data[$key]); - } - - $this->started = true; - $this->closed = false; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Storage/MockFileSessionStorage.php b/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Storage/MockFileSessionStorage.php deleted file mode 100644 index 1f4117b..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Storage/MockFileSessionStorage.php +++ /dev/null @@ -1,138 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Session\Storage; - -/** - * MockFileSessionStorage is used to mock sessions for - * functional testing when done in a single PHP process. - * - * No PHP session is actually started since a session can be initialized - * and shutdown only once per PHP execution cycle and this class does - * not pollute any session related globals, including session_*() functions - * or session.* PHP ini directives. - * - * @author Drak - */ -class MockFileSessionStorage extends MockArraySessionStorage -{ - /** - * @var string - */ - private $savePath; - - /** - * Constructor. - * - * @param string $savePath Path of directory to save session files. - * @param string $name Session name. - * @param MetadataBag $metaBag MetadataBag instance. - */ - public function __construct($savePath = null, $name = 'MOCKSESSID', MetadataBag $metaBag = null) - { - if (null === $savePath) { - $savePath = sys_get_temp_dir(); - } - - if (!is_dir($savePath)) { - mkdir($savePath, 0777, true); - } - - $this->savePath = $savePath; - - parent::__construct($name, $metaBag); - } - - /** - * {@inheritdoc} - */ - public function start() - { - if ($this->started) { - return true; - } - - if (!$this->id) { - $this->id = $this->generateId(); - } - - $this->read(); - - $this->started = true; - - return true; - } - - /** - * {@inheritdoc} - */ - public function regenerate($destroy = false, $lifetime = null) - { - if (!$this->started) { - $this->start(); - } - - if ($destroy) { - $this->destroy(); - } - - return parent::regenerate($destroy, $lifetime); - } - - /** - * {@inheritdoc} - */ - public function save() - { - if (!$this->started) { - throw new \RuntimeException('Trying to save a session that was not started yet or was already closed'); - } - - file_put_contents($this->getFilePath(), serialize($this->data)); - - // this is needed for Silex, where the session object is re-used across requests - // in functional tests. In Symfony, the container is rebooted, so we don't have - // this issue - $this->started = false; - } - - /** - * Deletes a session from persistent storage. - * Deliberately leaves session data in memory intact. - */ - private function destroy() - { - if (is_file($this->getFilePath())) { - unlink($this->getFilePath()); - } - } - - /** - * Calculate path to file. - * - * @return string File path - */ - private function getFilePath() - { - return $this->savePath.'/'.$this->id.'.mocksess'; - } - - /** - * Reads session from storage and loads session. - */ - private function read() - { - $filePath = $this->getFilePath(); - $this->data = is_readable($filePath) && is_file($filePath) ? unserialize(file_get_contents($filePath)) : array(); - - $this->loadSession(); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php b/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php deleted file mode 100644 index a5bdbe9..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php +++ /dev/null @@ -1,414 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Session\Storage; - -use Symfony\Component\HttpFoundation\Session\SessionBagInterface; -use Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeSessionHandler; -use Symfony\Component\HttpFoundation\Session\Storage\Proxy\NativeProxy; -use Symfony\Component\HttpFoundation\Session\Storage\Proxy\AbstractProxy; -use Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy; - -/** - * This provides a base class for session attribute storage. - * - * @author Drak - */ -class NativeSessionStorage implements SessionStorageInterface -{ - /** - * Array of SessionBagInterface. - * - * @var SessionBagInterface[] - */ - protected $bags; - - /** - * @var bool - */ - protected $started = false; - - /** - * @var bool - */ - protected $closed = false; - - /** - * @var AbstractProxy - */ - protected $saveHandler; - - /** - * @var MetadataBag - */ - protected $metadataBag; - - /** - * Constructor. - * - * Depending on how you want the storage driver to behave you probably - * want to override this constructor entirely. - * - * List of options for $options array with their defaults. - * - * @see http://php.net/session.configuration for options - * but we omit 'session.' from the beginning of the keys for convenience. - * - * ("auto_start", is not supported as it tells PHP to start a session before - * PHP starts to execute user-land code. Setting during runtime has no effect). - * - * cache_limiter, "nocache" (use "0" to prevent headers from being sent entirely). - * cookie_domain, "" - * cookie_httponly, "" - * cookie_lifetime, "0" - * cookie_path, "/" - * cookie_secure, "" - * entropy_file, "" - * entropy_length, "0" - * gc_divisor, "100" - * gc_maxlifetime, "1440" - * gc_probability, "1" - * hash_bits_per_character, "4" - * hash_function, "0" - * name, "PHPSESSID" - * referer_check, "" - * serialize_handler, "php" - * use_cookies, "1" - * use_only_cookies, "1" - * use_trans_sid, "0" - * upload_progress.enabled, "1" - * upload_progress.cleanup, "1" - * upload_progress.prefix, "upload_progress_" - * upload_progress.name, "PHP_SESSION_UPLOAD_PROGRESS" - * upload_progress.freq, "1%" - * upload_progress.min-freq, "1" - * url_rewriter.tags, "a=href,area=href,frame=src,form=,fieldset=" - * - * @param array $options Session configuration options. - * @param AbstractProxy|NativeSessionHandler|\SessionHandlerInterface|null $handler - * @param MetadataBag $metaBag MetadataBag. - */ - public function __construct(array $options = array(), $handler = null, MetadataBag $metaBag = null) - { - session_cache_limiter(''); // disable by default because it's managed by HeaderBag (if used) - ini_set('session.use_cookies', 1); - - if (PHP_VERSION_ID >= 50400) { - session_register_shutdown(); - } else { - register_shutdown_function('session_write_close'); - } - - $this->setMetadataBag($metaBag); - $this->setOptions($options); - $this->setSaveHandler($handler); - } - - /** - * Gets the save handler instance. - * - * @return AbstractProxy - */ - public function getSaveHandler() - { - return $this->saveHandler; - } - - /** - * {@inheritdoc} - */ - public function start() - { - if ($this->started) { - return true; - } - - if (PHP_VERSION_ID >= 50400 && \PHP_SESSION_ACTIVE === session_status()) { - throw new \RuntimeException('Failed to start the session: already started by PHP.'); - } - - if (PHP_VERSION_ID < 50400 && !$this->closed && isset($_SESSION) && session_id()) { - // not 100% fool-proof, but is the most reliable way to determine if a session is active in PHP 5.3 - throw new \RuntimeException('Failed to start the session: already started by PHP ($_SESSION is set).'); - } - - if (ini_get('session.use_cookies') && headers_sent($file, $line)) { - throw new \RuntimeException(sprintf('Failed to start the session because headers have already been sent by "%s" at line %d.', $file, $line)); - } - - // ok to try and start the session - if (!session_start()) { - throw new \RuntimeException('Failed to start the session'); - } - - $this->loadSession(); - if (!$this->saveHandler->isWrapper() && !$this->saveHandler->isSessionHandlerInterface()) { - // This condition matches only PHP 5.3 with internal save handlers - $this->saveHandler->setActive(true); - } - - return true; - } - - /** - * {@inheritdoc} - */ - public function getId() - { - return $this->saveHandler->getId(); - } - - /** - * {@inheritdoc} - */ - public function setId($id) - { - $this->saveHandler->setId($id); - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return $this->saveHandler->getName(); - } - - /** - * {@inheritdoc} - */ - public function setName($name) - { - $this->saveHandler->setName($name); - } - - /** - * {@inheritdoc} - */ - public function regenerate($destroy = false, $lifetime = null) - { - if (null !== $lifetime) { - ini_set('session.cookie_lifetime', $lifetime); - } - - if ($destroy) { - $this->metadataBag->stampNew(); - } - - return session_regenerate_id($destroy); - } - - /** - * {@inheritdoc} - */ - public function save() - { - session_write_close(); - - if (!$this->saveHandler->isWrapper() && !$this->saveHandler->isSessionHandlerInterface()) { - // This condition matches only PHP 5.3 with internal save handlers - $this->saveHandler->setActive(false); - } - - $this->closed = true; - $this->started = false; - } - - /** - * {@inheritdoc} - */ - public function clear() - { - // clear out the bags - foreach ($this->bags as $bag) { - $bag->clear(); - } - - // clear out the session - $_SESSION = array(); - - // reconnect the bags to the session - $this->loadSession(); - } - - /** - * {@inheritdoc} - */ - public function registerBag(SessionBagInterface $bag) - { - $this->bags[$bag->getName()] = $bag; - } - - /** - * {@inheritdoc} - */ - public function getBag($name) - { - if (!isset($this->bags[$name])) { - throw new \InvalidArgumentException(sprintf('The SessionBagInterface %s is not registered.', $name)); - } - - if ($this->saveHandler->isActive() && !$this->started) { - $this->loadSession(); - } elseif (!$this->started) { - $this->start(); - } - - return $this->bags[$name]; - } - - /** - * Sets the MetadataBag. - * - * @param MetadataBag $metaBag - */ - public function setMetadataBag(MetadataBag $metaBag = null) - { - if (null === $metaBag) { - $metaBag = new MetadataBag(); - } - - $this->metadataBag = $metaBag; - } - - /** - * Gets the MetadataBag. - * - * @return MetadataBag - */ - public function getMetadataBag() - { - return $this->metadataBag; - } - - /** - * {@inheritdoc} - */ - public function isStarted() - { - return $this->started; - } - - /** - * Sets session.* ini variables. - * - * For convenience we omit 'session.' from the beginning of the keys. - * Explicitly ignores other ini keys. - * - * @param array $options Session ini directives array(key => value). - * - * @see http://php.net/session.configuration - */ - public function setOptions(array $options) - { - $validOptions = array_flip(array( - 'cache_limiter', 'cookie_domain', 'cookie_httponly', - 'cookie_lifetime', 'cookie_path', 'cookie_secure', - 'entropy_file', 'entropy_length', 'gc_divisor', - 'gc_maxlifetime', 'gc_probability', 'hash_bits_per_character', - 'hash_function', 'name', 'referer_check', - 'serialize_handler', 'use_cookies', - 'use_only_cookies', 'use_trans_sid', 'upload_progress.enabled', - 'upload_progress.cleanup', 'upload_progress.prefix', 'upload_progress.name', - 'upload_progress.freq', 'upload_progress.min-freq', 'url_rewriter.tags', - )); - - foreach ($options as $key => $value) { - if (isset($validOptions[$key])) { - ini_set('session.'.$key, $value); - } - } - } - - /** - * Registers session save handler as a PHP session handler. - * - * To use internal PHP session save handlers, override this method using ini_set with - * session.save_handler and session.save_path e.g. - * - * ini_set('session.save_handler', 'files'); - * ini_set('session.save_path', /tmp'); - * - * or pass in a NativeSessionHandler instance which configures session.save_handler in the - * constructor, for a template see NativeFileSessionHandler or use handlers in - * composer package drak/native-session - * - * @see http://php.net/session-set-save-handler - * @see http://php.net/sessionhandlerinterface - * @see http://php.net/sessionhandler - * @see http://github.com/drak/NativeSession - * - * @param AbstractProxy|NativeSessionHandler|\SessionHandlerInterface|null $saveHandler - * - * @throws \InvalidArgumentException - */ - public function setSaveHandler($saveHandler = null) - { - if (!$saveHandler instanceof AbstractProxy && - !$saveHandler instanceof NativeSessionHandler && - !$saveHandler instanceof \SessionHandlerInterface && - null !== $saveHandler) { - throw new \InvalidArgumentException('Must be instance of AbstractProxy or NativeSessionHandler; implement \SessionHandlerInterface; or be null.'); - } - - // Wrap $saveHandler in proxy and prevent double wrapping of proxy - if (!$saveHandler instanceof AbstractProxy && $saveHandler instanceof \SessionHandlerInterface) { - $saveHandler = new SessionHandlerProxy($saveHandler); - } elseif (!$saveHandler instanceof AbstractProxy) { - $saveHandler = PHP_VERSION_ID >= 50400 ? - new SessionHandlerProxy(new \SessionHandler()) : new NativeProxy(); - } - $this->saveHandler = $saveHandler; - - if ($this->saveHandler instanceof \SessionHandlerInterface) { - if (PHP_VERSION_ID >= 50400) { - session_set_save_handler($this->saveHandler, false); - } else { - session_set_save_handler( - array($this->saveHandler, 'open'), - array($this->saveHandler, 'close'), - array($this->saveHandler, 'read'), - array($this->saveHandler, 'write'), - array($this->saveHandler, 'destroy'), - array($this->saveHandler, 'gc') - ); - } - } - } - - /** - * Load the session with attributes. - * - * After starting the session, PHP retrieves the session from whatever handlers - * are set to (either PHP's internal, or a custom save handler set with session_set_save_handler()). - * PHP takes the return value from the read() handler, unserializes it - * and populates $_SESSION with the result automatically. - * - * @param array|null $session - */ - protected function loadSession(array &$session = null) - { - if (null === $session) { - $session = &$_SESSION; - } - - $bags = array_merge($this->bags, array($this->metadataBag)); - - foreach ($bags as $bag) { - $key = $bag->getStorageKey(); - $session[$key] = isset($session[$key]) ? $session[$key] : array(); - $bag->initialize($session[$key]); - } - - $this->started = true; - $this->closed = false; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Storage/PhpBridgeSessionStorage.php b/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Storage/PhpBridgeSessionStorage.php deleted file mode 100644 index ced706f..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Storage/PhpBridgeSessionStorage.php +++ /dev/null @@ -1,68 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Session\Storage; - -use Symfony\Component\HttpFoundation\Session\Storage\Proxy\AbstractProxy; -use Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeSessionHandler; - -/** - * Allows session to be started by PHP and managed by Symfony. - * - * @author Drak - */ -class PhpBridgeSessionStorage extends NativeSessionStorage -{ - /** - * Constructor. - * - * @param AbstractProxy|NativeSessionHandler|\SessionHandlerInterface|null $handler - * @param MetadataBag $metaBag MetadataBag - */ - public function __construct($handler = null, MetadataBag $metaBag = null) - { - $this->setMetadataBag($metaBag); - $this->setSaveHandler($handler); - } - - /** - * {@inheritdoc} - */ - public function start() - { - if ($this->started) { - return true; - } - - $this->loadSession(); - if (!$this->saveHandler->isWrapper() && !$this->saveHandler->isSessionHandlerInterface()) { - // This condition matches only PHP 5.3 + internal save handlers - $this->saveHandler->setActive(true); - } - - return true; - } - - /** - * {@inheritdoc} - */ - public function clear() - { - // clear out the bags and nothing else that may be set - // since the purpose of this driver is to share a handler - foreach ($this->bags as $bag) { - $bag->clear(); - } - - // reconnect the bags to the session - $this->loadSession(); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Storage/Proxy/AbstractProxy.php b/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Storage/Proxy/AbstractProxy.php deleted file mode 100644 index 1036818..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Storage/Proxy/AbstractProxy.php +++ /dev/null @@ -1,154 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Session\Storage\Proxy; - -/** - * AbstractProxy. - * - * @author Drak - */ -abstract class AbstractProxy -{ - /** - * Flag if handler wraps an internal PHP session handler (using \SessionHandler). - * - * @var bool - */ - protected $wrapper = false; - - /** - * @var bool - */ - protected $active = false; - - /** - * @var string - */ - protected $saveHandlerName; - - /** - * Gets the session.save_handler name. - * - * @return string - */ - public function getSaveHandlerName() - { - return $this->saveHandlerName; - } - - /** - * Is this proxy handler and instance of \SessionHandlerInterface. - * - * @return bool - */ - public function isSessionHandlerInterface() - { - return ($this instanceof \SessionHandlerInterface); - } - - /** - * Returns true if this handler wraps an internal PHP session save handler using \SessionHandler. - * - * @return bool - */ - public function isWrapper() - { - return $this->wrapper; - } - - /** - * Has a session started? - * - * @return bool - */ - public function isActive() - { - if (PHP_VERSION_ID >= 50400) { - return $this->active = \PHP_SESSION_ACTIVE === session_status(); - } - - return $this->active; - } - - /** - * Sets the active flag. - * - * Has no effect under PHP 5.4+ as status is detected - * automatically in isActive() - * - * @internal - * - * @param bool $flag - * - * @throws \LogicException - */ - public function setActive($flag) - { - if (PHP_VERSION_ID >= 50400) { - throw new \LogicException('This method is disabled in PHP 5.4.0+'); - } - - $this->active = (bool) $flag; - } - - /** - * Gets the session ID. - * - * @return string - */ - public function getId() - { - return session_id(); - } - - /** - * Sets the session ID. - * - * @param string $id - * - * @throws \LogicException - */ - public function setId($id) - { - if ($this->isActive()) { - throw new \LogicException('Cannot change the ID of an active session'); - } - - session_id($id); - } - - /** - * Gets the session name. - * - * @return string - */ - public function getName() - { - return session_name(); - } - - /** - * Sets the session name. - * - * @param string $name - * - * @throws \LogicException - */ - public function setName($name) - { - if ($this->isActive()) { - throw new \LogicException('Cannot change the name of an active session'); - } - - session_name($name); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Storage/Proxy/NativeProxy.php b/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Storage/Proxy/NativeProxy.php deleted file mode 100644 index 5bb2c71..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Storage/Proxy/NativeProxy.php +++ /dev/null @@ -1,41 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Session\Storage\Proxy; - -/** - * NativeProxy. - * - * This proxy is built-in session handlers in PHP 5.3.x - * - * @author Drak - */ -class NativeProxy extends AbstractProxy -{ - /** - * Constructor. - */ - public function __construct() - { - // this makes an educated guess as to what the handler is since it should already be set. - $this->saveHandlerName = ini_get('session.save_handler'); - } - - /** - * Returns true if this handler wraps an internal PHP session save handler using \SessionHandler. - * - * @return bool False. - */ - public function isWrapper() - { - return false; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Storage/Proxy/SessionHandlerProxy.php b/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Storage/Proxy/SessionHandlerProxy.php deleted file mode 100644 index 81643c7..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Storage/Proxy/SessionHandlerProxy.php +++ /dev/null @@ -1,95 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Session\Storage\Proxy; - -/** - * SessionHandler proxy. - * - * @author Drak - */ -class SessionHandlerProxy extends AbstractProxy implements \SessionHandlerInterface -{ - /** - * @var \SessionHandlerInterface - */ - protected $handler; - - /** - * Constructor. - * - * @param \SessionHandlerInterface $handler - */ - public function __construct(\SessionHandlerInterface $handler) - { - $this->handler = $handler; - $this->wrapper = ($handler instanceof \SessionHandler); - $this->saveHandlerName = $this->wrapper ? ini_get('session.save_handler') : 'user'; - } - - // \SessionHandlerInterface - - /** - * {@inheritdoc} - */ - public function open($savePath, $sessionName) - { - $return = (bool) $this->handler->open($savePath, $sessionName); - - if (true === $return) { - $this->active = true; - } - - return $return; - } - - /** - * {@inheritdoc} - */ - public function close() - { - $this->active = false; - - return (bool) $this->handler->close(); - } - - /** - * {@inheritdoc} - */ - public function read($sessionId) - { - return (string) $this->handler->read($sessionId); - } - - /** - * {@inheritdoc} - */ - public function write($sessionId, $data) - { - return (bool) $this->handler->write($sessionId, $data); - } - - /** - * {@inheritdoc} - */ - public function destroy($sessionId) - { - return (bool) $this->handler->destroy($sessionId); - } - - /** - * {@inheritdoc} - */ - public function gc($maxlifetime) - { - return (bool) $this->handler->gc($maxlifetime); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Storage/SessionStorageInterface.php b/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Storage/SessionStorageInterface.php deleted file mode 100644 index 5dd309c..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-foundation/Session/Storage/SessionStorageInterface.php +++ /dev/null @@ -1,153 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Session\Storage; - -use Symfony\Component\HttpFoundation\Session\SessionBagInterface; - -/** - * StorageInterface. - * - * @author Fabien Potencier - * @author Drak - * - * @api - */ -interface SessionStorageInterface -{ - /** - * Starts the session. - * - * @throws \RuntimeException If something goes wrong starting the session. - * - * @return bool True if started. - * - * @api - */ - public function start(); - - /** - * Checks if the session is started. - * - * @return bool True if started, false otherwise. - */ - public function isStarted(); - - /** - * Returns the session ID. - * - * @return string The session ID or empty. - * - * @api - */ - public function getId(); - - /** - * Sets the session ID. - * - * @param string $id - * - * @api - */ - public function setId($id); - - /** - * Returns the session name. - * - * @return mixed The session name. - * - * @api - */ - public function getName(); - - /** - * Sets the session name. - * - * @param string $name - * - * @api - */ - public function setName($name); - - /** - * Regenerates id that represents this storage. - * - * This method must invoke session_regenerate_id($destroy) unless - * this interface is used for a storage object designed for unit - * or functional testing where a real PHP session would interfere - * with testing. - * - * Note regenerate+destroy should not clear the session data in memory - * only delete the session data from persistent storage. - * - * Care: When regenerating the session ID no locking is involved in PHPs - * session design. See https://bugs.php.net/bug.php?id=61470 for a discussion. - * So you must make sure the regenerated session is saved BEFORE sending the - * headers with the new ID. Symfonys HttpKernel offers a listener for this. - * See Symfony\Component\HttpKernel\EventListener\SaveSessionListener. - * Otherwise session data could get lost again for concurrent requests with the - * new ID. One result could be that you get logged out after just logging in. - * - * @param bool $destroy Destroy session when regenerating? - * @param int $lifetime Sets the cookie lifetime for the session cookie. A null value - * will leave the system settings unchanged, 0 sets the cookie - * to expire with browser session. Time is in seconds, and is - * not a Unix timestamp. - * - * @return bool True if session regenerated, false if error - * - * @throws \RuntimeException If an error occurs while regenerating this storage - * - * @api - */ - public function regenerate($destroy = false, $lifetime = null); - - /** - * Force the session to be saved and closed. - * - * This method must invoke session_write_close() unless this interface is - * used for a storage object design for unit or functional testing where - * a real PHP session would interfere with testing, in which case it - * it should actually persist the session data if required. - * - * @throws \RuntimeException If the session is saved without being started, or if the session - * is already closed. - */ - public function save(); - - /** - * Clear all session data in memory. - */ - public function clear(); - - /** - * Gets a SessionBagInterface by name. - * - * @param string $name - * - * @return SessionBagInterface - * - * @throws \InvalidArgumentException If the bag does not exist - */ - public function getBag($name); - - /** - * Registers a SessionBagInterface for use. - * - * @param SessionBagInterface $bag - */ - public function registerBag(SessionBagInterface $bag); - - /** - * @return MetadataBag - */ - public function getMetadataBag(); -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-foundation/StreamedResponse.php b/sitecake/2.2.9/server/vendor/symfony/http-foundation/StreamedResponse.php deleted file mode 100644 index 38986e8..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-foundation/StreamedResponse.php +++ /dev/null @@ -1,123 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation; - -/** - * StreamedResponse represents a streamed HTTP response. - * - * A StreamedResponse uses a callback for its content. - * - * The callback should use the standard PHP functions like echo - * to stream the response back to the client. The flush() method - * can also be used if needed. - * - * @see flush() - * - * @author Fabien Potencier - * - * @api - */ -class StreamedResponse extends Response -{ - protected $callback; - protected $streamed; - - /** - * Constructor. - * - * @param callable|null $callback A valid PHP callback or null to set it later - * @param int $status The response status code - * @param array $headers An array of response headers - * - * @api - */ - public function __construct($callback = null, $status = 200, $headers = array()) - { - parent::__construct(null, $status, $headers); - - if (null !== $callback) { - $this->setCallback($callback); - } - $this->streamed = false; - } - - /** - * Factory method for chainability - * - * @param callable|null $callback A valid PHP callback or null to set it later - * @param int $status The response status code - * @param array $headers An array of response headers - * - * @return StreamedResponse - */ - public static function create($callback = null, $status = 200, $headers = array()) - { - return new static($callback, $status, $headers); - } - - /** - * Sets the PHP callback associated with this Response. - * - * @param callable $callback A valid PHP callback - * - * @throws \LogicException - */ - public function setCallback($callback) - { - if (!is_callable($callback)) { - throw new \LogicException('The Response callback must be a valid PHP callable.'); - } - $this->callback = $callback; - } - - /** - * {@inheritdoc} - * - * This method only sends the content once. - */ - public function sendContent() - { - if ($this->streamed) { - return; - } - - $this->streamed = true; - - if (null === $this->callback) { - throw new \LogicException('The Response callback must not be null.'); - } - - call_user_func($this->callback); - } - - /** - * {@inheritdoc} - * - * @throws \LogicException when the content is not null - */ - public function setContent($content) - { - if (null !== $content) { - throw new \LogicException('The content cannot be set on a StreamedResponse instance.'); - } - } - - /** - * {@inheritdoc} - * - * @return false - */ - public function getContent() - { - return false; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-foundation/composer.json b/sitecake/2.2.9/server/vendor/symfony/http-foundation/composer.json deleted file mode 100644 index 80f4436..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-foundation/composer.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "symfony/http-foundation", - "type": "library", - "description": "Symfony HttpFoundation Component", - "keywords": [], - "homepage": "https://symfony.com", - "license": "MIT", - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "require": { - "php": ">=5.3.9" - }, - "require-dev": { - "symfony/phpunit-bridge": "~2.7", - "symfony/expression-language": "~2.4" - }, - "autoload": { - "psr-4": { "Symfony\\Component\\HttpFoundation\\": "" }, - "classmap": [ "Resources/stubs" ] - }, - "minimum-stability": "dev", - "extra": { - "branch-alias": { - "dev-master": "2.7-dev" - } - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-foundation/phpunit.xml.dist b/sitecake/2.2.9/server/vendor/symfony/http-foundation/phpunit.xml.dist deleted file mode 100644 index 9ffdb43..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-foundation/phpunit.xml.dist +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - ./Tests/ - - - - - - ./ - - ./Resources - ./Tests - ./vendor - - - - diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Bundle/Bundle.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/Bundle/Bundle.php deleted file mode 100644 index c58f0f0..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Bundle/Bundle.php +++ /dev/null @@ -1,215 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Bundle; - -use Symfony\Component\DependencyInjection\ContainerAware; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Container; -use Symfony\Component\Console\Application; -use Symfony\Component\Finder\Finder; -use Symfony\Component\DependencyInjection\Extension\ExtensionInterface; - -/** - * An implementation of BundleInterface that adds a few conventions - * for DependencyInjection extensions and Console commands. - * - * @author Fabien Potencier - * - * @api - */ -abstract class Bundle extends ContainerAware implements BundleInterface -{ - protected $name; - protected $extension; - protected $path; - - /** - * Boots the Bundle. - */ - public function boot() - { - } - - /** - * Shutdowns the Bundle. - */ - public function shutdown() - { - } - - /** - * Builds the bundle. - * - * It is only ever called once when the cache is empty. - * - * This method can be overridden to register compilation passes, - * other extensions, ... - * - * @param ContainerBuilder $container A ContainerBuilder instance - */ - public function build(ContainerBuilder $container) - { - } - - /** - * Returns the bundle's container extension. - * - * @return ExtensionInterface|null The container extension - * - * @throws \LogicException - * - * @api - */ - public function getContainerExtension() - { - if (null === $this->extension) { - $class = $this->getContainerExtensionClass(); - if (class_exists($class)) { - $extension = new $class(); - - if (!$extension instanceof ExtensionInterface) { - throw new \LogicException(sprintf('Extension %s must implement Symfony\Component\DependencyInjection\Extension\ExtensionInterface.', $class)); - } - - // check naming convention - $basename = preg_replace('/Bundle$/', '', $this->getName()); - $expectedAlias = Container::underscore($basename); - if ($expectedAlias != $extension->getAlias()) { - throw new \LogicException(sprintf( - 'Users will expect the alias of the default extension of a bundle to be the underscored version of the bundle name ("%s"). You can override "Bundle::getContainerExtension()" if you want to use "%s" or another alias.', - $expectedAlias, $extension->getAlias() - )); - } - - $this->extension = $extension; - } else { - $this->extension = false; - } - } - - if ($this->extension) { - return $this->extension; - } - } - - /** - * Gets the Bundle namespace. - * - * @return string The Bundle namespace - * - * @api - */ - public function getNamespace() - { - $class = get_class($this); - - return substr($class, 0, strrpos($class, '\\')); - } - - /** - * Gets the Bundle directory path. - * - * @return string The Bundle absolute path - * - * @api - */ - public function getPath() - { - if (null === $this->path) { - $reflected = new \ReflectionObject($this); - $this->path = dirname($reflected->getFileName()); - } - - return $this->path; - } - - /** - * Returns the bundle parent name. - * - * @return string The Bundle parent name it overrides or null if no parent - * - * @api - */ - public function getParent() - { - } - - /** - * Returns the bundle name (the class short name). - * - * @return string The Bundle name - * - * @api - */ - final public function getName() - { - if (null !== $this->name) { - return $this->name; - } - - $name = get_class($this); - $pos = strrpos($name, '\\'); - - return $this->name = false === $pos ? $name : substr($name, $pos + 1); - } - - /** - * Finds and registers Commands. - * - * Override this method if your bundle commands do not follow the conventions: - * - * * Commands are in the 'Command' sub-directory - * * Commands extend Symfony\Component\Console\Command\Command - * - * @param Application $application An Application instance - */ - public function registerCommands(Application $application) - { - if (!is_dir($dir = $this->getPath().'/Command')) { - return; - } - - $finder = new Finder(); - $finder->files()->name('*Command.php')->in($dir); - - $prefix = $this->getNamespace().'\\Command'; - foreach ($finder as $file) { - $ns = $prefix; - if ($relativePath = $file->getRelativePath()) { - $ns .= '\\'.strtr($relativePath, '/', '\\'); - } - $class = $ns.'\\'.$file->getBasename('.php'); - if ($this->container) { - $alias = 'console.command.'.strtolower(str_replace('\\', '_', $class)); - if ($this->container->has($alias)) { - continue; - } - } - $r = new \ReflectionClass($class); - if ($r->isSubclassOf('Symfony\\Component\\Console\\Command\\Command') && !$r->isAbstract() && !$r->getConstructor()->getNumberOfRequiredParameters()) { - $application->add($r->newInstance()); - } - } - } - - /** - * Returns the bundle's container extension class. - * - * @return string - */ - protected function getContainerExtensionClass() - { - $basename = preg_replace('/Bundle$/', '', $this->getName()); - - return $this->getNamespace().'\\DependencyInjection\\'.$basename.'Extension'; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Bundle/BundleInterface.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/Bundle/BundleInterface.php deleted file mode 100644 index 3203d84..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Bundle/BundleInterface.php +++ /dev/null @@ -1,102 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Bundle; - -use Symfony\Component\DependencyInjection\ContainerAwareInterface; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Extension\ExtensionInterface; - -/** - * BundleInterface. - * - * @author Fabien Potencier - * - * @api - */ -interface BundleInterface extends ContainerAwareInterface -{ - /** - * Boots the Bundle. - * - * @api - */ - public function boot(); - - /** - * Shutdowns the Bundle. - * - * @api - */ - public function shutdown(); - - /** - * Builds the bundle. - * - * It is only ever called once when the cache is empty. - * - * @param ContainerBuilder $container A ContainerBuilder instance - * - * @api - */ - public function build(ContainerBuilder $container); - - /** - * Returns the container extension that should be implicitly loaded. - * - * @return ExtensionInterface|null The default extension or null if there is none - * - * @api - */ - public function getContainerExtension(); - - /** - * Returns the bundle name that this bundle overrides. - * - * Despite its name, this method does not imply any parent/child relationship - * between the bundles, just a way to extend and override an existing - * bundle. - * - * @return string The Bundle name it overrides or null if no parent - * - * @api - */ - public function getParent(); - - /** - * Returns the bundle name (the class short name). - * - * @return string The Bundle name - * - * @api - */ - public function getName(); - - /** - * Gets the Bundle namespace. - * - * @return string The Bundle namespace - * - * @api - */ - public function getNamespace(); - - /** - * Gets the Bundle directory path. - * - * The path should always be returned as a Unix path (with /). - * - * @return string The Bundle absolute path - * - * @api - */ - public function getPath(); -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/CHANGELOG.md b/sitecake/2.2.9/server/vendor/symfony/http-kernel/CHANGELOG.md deleted file mode 100644 index ad27886..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/CHANGELOG.md +++ /dev/null @@ -1,73 +0,0 @@ -CHANGELOG -========= - -2.7.0 ------ - - * added the HTTP status code to profiles - -2.6.0 ------ - - * deprecated `Symfony\Component\HttpKernel\EventListener\ErrorsLoggerListener`, use `Symfony\Component\HttpKernel\EventListener\DebugHandlersListener` instead - * deprecated unused method `Symfony\Component\HttpKernel\Kernel::isClassInActiveBundle` and `Symfony\Component\HttpKernel\KernelInterface::isClassInActiveBundle` - -2.5.0 ------ - - * deprecated `Symfony\Component\HttpKernel\DependencyInjection\RegisterListenersPass`, use `Symfony\Component\EventDispatcher\DependencyInjection\RegisterListenersPass` instead - -2.4.0 ------ - - * added event listeners for the session - * added the KernelEvents::FINISH_REQUEST event - -2.3.0 ------ - - * [BC BREAK] renamed `Symfony\Component\HttpKernel\EventListener\DeprecationLoggerListener` to `Symfony\Component\HttpKernel\EventListener\ErrorsLoggerListener` and changed its constructor - * deprecated `Symfony\Component\HttpKernel\Debug\ErrorHandler`, `Symfony\Component\HttpKernel\Debug\ExceptionHandler`, - `Symfony\Component\HttpKernel\Exception\FatalErrorException` and `Symfony\Component\HttpKernel\Exception\FlattenException` - * deprecated `Symfony\Component\HttpKernel\Kernel::init()`` - * added the possibility to specify an id an extra attributes to hinclude tags - * added the collect of data if a controller is a Closure in the Request collector - * pass exceptions from the ExceptionListener to the logger using the logging context to allow for more - detailed messages - -2.2.0 ------ - - * [BC BREAK] the path info for sub-request is now always _fragment (or whatever you configured instead of the default) - * added Symfony\Component\HttpKernel\EventListener\FragmentListener - * added Symfony\Component\HttpKernel\UriSigner - * added Symfony\Component\HttpKernel\FragmentRenderer and rendering strategies (in Symfony\Component\HttpKernel\Fragment\FragmentRendererInterface) - * added Symfony\Component\HttpKernel\DependencyInjection\ContainerAwareHttpKernel - * added ControllerReference to create reference of Controllers (used in the FragmentRenderer class) - * [BC BREAK] renamed TimeDataCollector::getTotalTime() to - TimeDataCollector::getDuration() - * updated the MemoryDataCollector to include the memory used in the - kernel.terminate event listeners - * moved the Stopwatch classes to a new component - * added TraceableControllerResolver - * added TraceableEventDispatcher (removed ContainerAwareTraceableEventDispatcher) - * added support for WinCache opcode cache in ConfigDataCollector - -2.1.0 ------ - - * [BC BREAK] the charset is now configured via the Kernel::getCharset() method - * [BC BREAK] the current locale for the user is not stored anymore in the session - * added the HTTP method to the profiler storage - * updated all listeners to implement EventSubscriberInterface - * added TimeDataCollector - * added ContainerAwareTraceableEventDispatcher - * moved TraceableEventDispatcherInterface to the EventDispatcher component - * added RouterListener, LocaleListener, and StreamedResponseListener - * added CacheClearerInterface (and ChainCacheClearer) - * added a kernel.terminate event (via TerminableInterface and PostResponseEvent) - * added a Stopwatch class - * added WarmableInterface - * improved extensibility between bundles - * added profiler storages for Memcache(d), File-based, MongoDB, Redis - * moved Filesystem class to its own component diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/CacheClearer/CacheClearerInterface.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/CacheClearer/CacheClearerInterface.php deleted file mode 100644 index d4a2db3..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/CacheClearer/CacheClearerInterface.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\CacheClearer; - -/** - * CacheClearerInterface. - * - * @author Dustin Dobervich - */ -interface CacheClearerInterface -{ - /** - * Clears any caches necessary. - * - * @param string $cacheDir The cache directory. - */ - public function clear($cacheDir); -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/CacheClearer/ChainCacheClearer.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/CacheClearer/ChainCacheClearer.php deleted file mode 100644 index 81c43b6..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/CacheClearer/ChainCacheClearer.php +++ /dev/null @@ -1,55 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\CacheClearer; - -/** - * ChainCacheClearer. - * - * @author Dustin Dobervich - */ -class ChainCacheClearer implements CacheClearerInterface -{ - /** - * @var array - */ - protected $clearers; - - /** - * Constructs a new instance of ChainCacheClearer. - * - * @param array $clearers The initial clearers. - */ - public function __construct(array $clearers = array()) - { - $this->clearers = $clearers; - } - - /** - * {@inheritdoc} - */ - public function clear($cacheDir) - { - foreach ($this->clearers as $clearer) { - $clearer->clear($cacheDir); - } - } - - /** - * Adds a cache clearer to the aggregate. - * - * @param CacheClearerInterface $clearer - */ - public function add(CacheClearerInterface $clearer) - { - $this->clearers[] = $clearer; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/CacheWarmer/CacheWarmer.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/CacheWarmer/CacheWarmer.php deleted file mode 100644 index 948b3ff..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/CacheWarmer/CacheWarmer.php +++ /dev/null @@ -1,32 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\CacheWarmer; - -/** - * Abstract cache warmer that knows how to write a file to the cache. - * - * @author Fabien Potencier - */ -abstract class CacheWarmer implements CacheWarmerInterface -{ - protected function writeCacheFile($file, $content) - { - $tmpFile = tempnam(dirname($file), basename($file)); - if (false !== @file_put_contents($tmpFile, $content) && @rename($tmpFile, $file)) { - @chmod($file, 0666 & ~umask()); - - return; - } - - throw new \RuntimeException(sprintf('Failed to write cache file "%s".', $file)); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/CacheWarmer/CacheWarmerAggregate.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/CacheWarmer/CacheWarmerAggregate.php deleted file mode 100644 index e5f4e4f..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/CacheWarmer/CacheWarmerAggregate.php +++ /dev/null @@ -1,74 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\CacheWarmer; - -/** - * Aggregates several cache warmers into a single one. - * - * @author Fabien Potencier - */ -class CacheWarmerAggregate implements CacheWarmerInterface -{ - protected $warmers = array(); - protected $optionalsEnabled = false; - - public function __construct(array $warmers = array()) - { - foreach ($warmers as $warmer) { - $this->add($warmer); - } - } - - public function enableOptionalWarmers() - { - $this->optionalsEnabled = true; - } - - /** - * Warms up the cache. - * - * @param string $cacheDir The cache directory - */ - public function warmUp($cacheDir) - { - foreach ($this->warmers as $warmer) { - if (!$this->optionalsEnabled && $warmer->isOptional()) { - continue; - } - - $warmer->warmUp($cacheDir); - } - } - - /** - * Checks whether this warmer is optional or not. - * - * @return bool always false - */ - public function isOptional() - { - return false; - } - - public function setWarmers(array $warmers) - { - $this->warmers = array(); - foreach ($warmers as $warmer) { - $this->add($warmer); - } - } - - public function add(CacheWarmerInterface $warmer) - { - $this->warmers[] = $warmer; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/CacheWarmer/CacheWarmerInterface.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/CacheWarmer/CacheWarmerInterface.php deleted file mode 100644 index 8fece5e..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/CacheWarmer/CacheWarmerInterface.php +++ /dev/null @@ -1,32 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\CacheWarmer; - -/** - * Interface for classes able to warm up the cache. - * - * @author Fabien Potencier - */ -interface CacheWarmerInterface extends WarmableInterface -{ - /** - * Checks whether this warmer is optional or not. - * - * Optional warmers can be ignored on certain conditions. - * - * A warmer should return true if the cache can be - * generated incrementally and on-demand. - * - * @return bool true if the warmer is optional, false otherwise - */ - public function isOptional(); -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/CacheWarmer/WarmableInterface.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/CacheWarmer/WarmableInterface.php deleted file mode 100644 index 25d8ee8..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/CacheWarmer/WarmableInterface.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\CacheWarmer; - -/** - * Interface for classes that support warming their cache. - * - * @author Fabien Potencier - */ -interface WarmableInterface -{ - /** - * Warms up the cache. - * - * @param string $cacheDir The cache directory - */ - public function warmUp($cacheDir); -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Client.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/Client.php deleted file mode 100644 index 0503f5d..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Client.php +++ /dev/null @@ -1,228 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel; - -use Symfony\Component\BrowserKit\Client as BaseClient; -use Symfony\Component\BrowserKit\Request as DomRequest; -use Symfony\Component\BrowserKit\Response as DomResponse; -use Symfony\Component\BrowserKit\Cookie as DomCookie; -use Symfony\Component\BrowserKit\History; -use Symfony\Component\BrowserKit\CookieJar; -use Symfony\Component\HttpFoundation\File\UploadedFile; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; - -/** - * Client simulates a browser and makes requests to a Kernel object. - * - * @author Fabien Potencier - * - * @api - */ -class Client extends BaseClient -{ - protected $kernel; - - /** - * Constructor. - * - * @param HttpKernelInterface $kernel An HttpKernel instance - * @param array $server The server parameters (equivalent of $_SERVER) - * @param History $history A History instance to store the browser history - * @param CookieJar $cookieJar A CookieJar instance to store the cookies - */ - public function __construct(HttpKernelInterface $kernel, array $server = array(), History $history = null, CookieJar $cookieJar = null) - { - // These class properties must be set before calling the parent constructor, as it may depend on it. - $this->kernel = $kernel; - $this->followRedirects = false; - - parent::__construct($server, $history, $cookieJar); - } - - /** - * {@inheritdoc} - * - * @return Request|null A Request instance - */ - public function getRequest() - { - return parent::getRequest(); - } - - /** - * {@inheritdoc} - * - * @return Response|null A Response instance - */ - public function getResponse() - { - return parent::getResponse(); - } - - /** - * Makes a request. - * - * @param Request $request A Request instance - * - * @return Response A Response instance - */ - protected function doRequest($request) - { - $response = $this->kernel->handle($request); - - if ($this->kernel instanceof TerminableInterface) { - $this->kernel->terminate($request, $response); - } - - return $response; - } - - /** - * Returns the script to execute when the request must be insulated. - * - * @param Request $request A Request instance - * - * @return string - */ - protected function getScript($request) - { - $kernel = str_replace("'", "\\'", serialize($this->kernel)); - $request = str_replace("'", "\\'", serialize($request)); - - $r = new \ReflectionClass('\\Symfony\\Component\\ClassLoader\\ClassLoader'); - $requirePath = str_replace("'", "\\'", $r->getFileName()); - $symfonyPath = str_replace("'", "\\'", realpath(__DIR__.'/../../..')); - $errorReporting = error_reporting(); - - $code = <<addPrefix('Symfony', '$symfonyPath'); -\$loader->register(); - -\$kernel = unserialize('$kernel'); -\$request = unserialize('$request'); -EOF; - - return $code.$this->getHandleScript(); - } - - protected function getHandleScript() - { - return <<<'EOF' -$response = $kernel->handle($request); - -if ($kernel instanceof Symfony\Component\HttpKernel\TerminableInterface) { - $kernel->terminate($request, $response); -} - -echo serialize($response); -EOF; - } - - /** - * Converts the BrowserKit request to a HttpKernel request. - * - * @param DomRequest $request A DomRequest instance - * - * @return Request A Request instance - */ - protected function filterRequest(DomRequest $request) - { - $httpRequest = Request::create($request->getUri(), $request->getMethod(), $request->getParameters(), $request->getCookies(), $request->getFiles(), $request->getServer(), $request->getContent()); - - foreach ($this->filterFiles($httpRequest->files->all()) as $key => $value) { - $httpRequest->files->set($key, $value); - } - - return $httpRequest; - } - - /** - * Filters an array of files. - * - * This method created test instances of UploadedFile so that the move() - * method can be called on those instances. - * - * If the size of a file is greater than the allowed size (from php.ini) then - * an invalid UploadedFile is returned with an error set to UPLOAD_ERR_INI_SIZE. - * - * @see UploadedFile - * - * @param array $files An array of files - * - * @return array An array with all uploaded files marked as already moved - */ - protected function filterFiles(array $files) - { - $filtered = array(); - foreach ($files as $key => $value) { - if (is_array($value)) { - $filtered[$key] = $this->filterFiles($value); - } elseif ($value instanceof UploadedFile) { - if ($value->isValid() && $value->getSize() > UploadedFile::getMaxFilesize()) { - $filtered[$key] = new UploadedFile( - '', - $value->getClientOriginalName(), - $value->getClientMimeType(), - 0, - UPLOAD_ERR_INI_SIZE, - true - ); - } else { - $filtered[$key] = new UploadedFile( - $value->getPathname(), - $value->getClientOriginalName(), - $value->getClientMimeType(), - $value->getClientSize(), - $value->getError(), - true - ); - } - } - } - - return $filtered; - } - - /** - * Converts the HttpKernel response to a BrowserKit response. - * - * @param Response $response A Response instance - * - * @return DomResponse A DomResponse instance - */ - protected function filterResponse($response) - { - $headers = $response->headers->all(); - if ($response->headers->getCookies()) { - $cookies = array(); - foreach ($response->headers->getCookies() as $cookie) { - $cookies[] = new DomCookie($cookie->getName(), $cookie->getValue(), $cookie->getExpiresTime(), $cookie->getPath(), $cookie->getDomain(), $cookie->isSecure(), $cookie->isHttpOnly()); - } - $headers['Set-Cookie'] = $cookies; - } - - // this is needed to support StreamedResponse - ob_start(); - $response->sendContent(); - $content = ob_get_clean(); - - return new DomResponse($content, $response->getStatusCode(), $headers); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Config/EnvParametersResource.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/Config/EnvParametersResource.php deleted file mode 100644 index 5f54450..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Config/EnvParametersResource.php +++ /dev/null @@ -1,95 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Config; - -use Symfony\Component\Config\Resource\ResourceInterface; - -/** - * EnvParametersResource represents resources stored in prefixed environment variables. - * - * @author Chris Wilkinson - */ -class EnvParametersResource implements ResourceInterface, \Serializable -{ - /** - * @var string - */ - private $prefix; - - /** - * @var string - */ - private $variables; - - /** - * Constructor. - * - * @param string $prefix - */ - public function __construct($prefix) - { - $this->prefix = $prefix; - $this->variables = $this->findVariables(); - } - - /** - * {@inheritdoc} - */ - public function __toString() - { - return serialize($this->getResource()); - } - - /** - * {@inheritdoc} - */ - public function getResource() - { - return array('prefix' => $this->prefix, 'variables' => $this->variables); - } - - /** - * {@inheritdoc} - */ - public function isFresh($timestamp) - { - return $this->findVariables() === $this->variables; - } - - public function serialize() - { - return serialize(array('prefix' => $this->prefix, 'variables' => $this->variables)); - } - - public function unserialize($serialized) - { - $unserialized = unserialize($serialized); - - $this->prefix = $unserialized['prefix']; - $this->variables = $unserialized['variables']; - } - - private function findVariables() - { - $variables = array(); - - foreach ($_SERVER as $key => $value) { - if (0 === strpos($key, $this->prefix)) { - $variables[$key] = $value; - } - } - - ksort($variables); - - return $variables; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Config/FileLocator.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/Config/FileLocator.php deleted file mode 100644 index 169c9ad..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Config/FileLocator.php +++ /dev/null @@ -1,56 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Config; - -use Symfony\Component\Config\FileLocator as BaseFileLocator; -use Symfony\Component\HttpKernel\KernelInterface; - -/** - * FileLocator uses the KernelInterface to locate resources in bundles. - * - * @author Fabien Potencier - */ -class FileLocator extends BaseFileLocator -{ - private $kernel; - private $path; - - /** - * Constructor. - * - * @param KernelInterface $kernel A KernelInterface instance - * @param null|string $path The path the global resource directory - * @param array $paths An array of paths where to look for resources - */ - public function __construct(KernelInterface $kernel, $path = null, array $paths = array()) - { - $this->kernel = $kernel; - if (null !== $path) { - $this->path = $path; - $paths[] = $path; - } - - parent::__construct($paths); - } - - /** - * {@inheritdoc} - */ - public function locate($file, $currentPath = null, $first = true) - { - if (isset($file[0]) && '@' === $file[0]) { - return $this->kernel->locateResource($file, $this->path, $first); - } - - return parent::locate($file, $currentPath, $first); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Controller/ControllerReference.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/Controller/ControllerReference.php deleted file mode 100644 index 3d1592e..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Controller/ControllerReference.php +++ /dev/null @@ -1,46 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Controller; - -use Symfony\Component\HttpKernel\Fragment\FragmentRendererInterface; - -/** - * Acts as a marker and a data holder for a Controller. - * - * Some methods in Symfony accept both a URI (as a string) or a controller as - * an argument. In the latter case, instead of passing an array representing - * the controller, you can use an instance of this class. - * - * @author Fabien Potencier - * - * @see FragmentRendererInterface - */ -class ControllerReference -{ - public $controller; - public $attributes = array(); - public $query = array(); - - /** - * Constructor. - * - * @param string $controller The controller name - * @param array $attributes An array of parameters to add to the Request attributes - * @param array $query An array of parameters to add to the Request query string - */ - public function __construct($controller, array $attributes = array(), array $query = array()) - { - $this->controller = $controller; - $this->attributes = $attributes; - $this->query = $query; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Controller/ControllerResolver.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/Controller/ControllerResolver.php deleted file mode 100644 index 94df05e..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Controller/ControllerResolver.php +++ /dev/null @@ -1,170 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Controller; - -use Psr\Log\LoggerInterface; -use Symfony\Component\HttpFoundation\Request; - -/** - * ControllerResolver. - * - * This implementation uses the '_controller' request attribute to determine - * the controller to execute and uses the request attributes to determine - * the controller method arguments. - * - * @author Fabien Potencier - * - * @api - */ -class ControllerResolver implements ControllerResolverInterface -{ - private $logger; - - /** - * Constructor. - * - * @param LoggerInterface $logger A LoggerInterface instance - */ - public function __construct(LoggerInterface $logger = null) - { - $this->logger = $logger; - } - - /** - * {@inheritdoc} - * - * This method looks for a '_controller' request attribute that represents - * the controller name (a string like ClassName::MethodName). - * - * @api - */ - public function getController(Request $request) - { - if (!$controller = $request->attributes->get('_controller')) { - if (null !== $this->logger) { - $this->logger->warning('Unable to look for the controller as the "_controller" parameter is missing.'); - } - - return false; - } - - if (is_array($controller)) { - return $controller; - } - - if (is_object($controller)) { - if (method_exists($controller, '__invoke')) { - return $controller; - } - - throw new \InvalidArgumentException(sprintf('Controller "%s" for URI "%s" is not callable.', get_class($controller), $request->getPathInfo())); - } - - if (false === strpos($controller, ':')) { - if (method_exists($controller, '__invoke')) { - return $this->instantiateController($controller); - } elseif (function_exists($controller)) { - return $controller; - } - } - - $callable = $this->createController($controller); - - if (!is_callable($callable)) { - throw new \InvalidArgumentException(sprintf('Controller "%s" for URI "%s" is not callable.', $controller, $request->getPathInfo())); - } - - return $callable; - } - - /** - * {@inheritdoc} - * - * @api - */ - public function getArguments(Request $request, $controller) - { - if (is_array($controller)) { - $r = new \ReflectionMethod($controller[0], $controller[1]); - } elseif (is_object($controller) && !$controller instanceof \Closure) { - $r = new \ReflectionObject($controller); - $r = $r->getMethod('__invoke'); - } else { - $r = new \ReflectionFunction($controller); - } - - return $this->doGetArguments($request, $controller, $r->getParameters()); - } - - protected function doGetArguments(Request $request, $controller, array $parameters) - { - $attributes = $request->attributes->all(); - $arguments = array(); - foreach ($parameters as $param) { - if (array_key_exists($param->name, $attributes)) { - $arguments[] = $attributes[$param->name]; - } elseif ($param->getClass() && $param->getClass()->isInstance($request)) { - $arguments[] = $request; - } elseif ($param->isDefaultValueAvailable()) { - $arguments[] = $param->getDefaultValue(); - } else { - if (is_array($controller)) { - $repr = sprintf('%s::%s()', get_class($controller[0]), $controller[1]); - } elseif (is_object($controller)) { - $repr = get_class($controller); - } else { - $repr = $controller; - } - - throw new \RuntimeException(sprintf('Controller "%s" requires that you provide a value for the "$%s" argument (because there is no default value or because there is a non optional argument after this one).', $repr, $param->name)); - } - } - - return $arguments; - } - - /** - * Returns a callable for the given controller. - * - * @param string $controller A Controller string - * - * @return mixed A PHP callable - * - * @throws \InvalidArgumentException - */ - protected function createController($controller) - { - if (false === strpos($controller, '::')) { - throw new \InvalidArgumentException(sprintf('Unable to find controller "%s".', $controller)); - } - - list($class, $method) = explode('::', $controller, 2); - - if (!class_exists($class)) { - throw new \InvalidArgumentException(sprintf('Class "%s" does not exist.', $class)); - } - - return array($this->instantiateController($class), $method); - } - - /** - * Returns an instantiated controller - * - * @param string $class A class name - * - * @return object - */ - protected function instantiateController($class) - { - return new $class(); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Controller/ControllerResolverInterface.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/Controller/ControllerResolverInterface.php deleted file mode 100644 index 6f805ed..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Controller/ControllerResolverInterface.php +++ /dev/null @@ -1,63 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Controller; - -use Symfony\Component\HttpFoundation\Request; - -/** - * A ControllerResolverInterface implementation knows how to determine the - * controller to execute based on a Request object. - * - * It can also determine the arguments to pass to the Controller. - * - * A Controller can be any valid PHP callable. - * - * @author Fabien Potencier - * - * @api - */ -interface ControllerResolverInterface -{ - /** - * Returns the Controller instance associated with a Request. - * - * As several resolvers can exist for a single application, a resolver must - * return false when it is not able to determine the controller. - * - * The resolver must only throw an exception when it should be able to load - * controller but cannot because of some errors made by the developer. - * - * @param Request $request A Request instance - * - * @return callable|false A PHP callable representing the Controller, - * or false if this resolver is not able to determine the controller - * - * @throws \LogicException If the controller can't be found - * - * @api - */ - public function getController(Request $request); - - /** - * Returns the arguments to pass to the controller. - * - * @param Request $request A Request instance - * @param callable $controller A PHP callable - * - * @return array An array of arguments to pass to the controller - * - * @throws \RuntimeException When value for argument given is not provided - * - * @api - */ - public function getArguments(Request $request, $controller); -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Controller/TraceableControllerResolver.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/Controller/TraceableControllerResolver.php deleted file mode 100644 index f8de31c..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Controller/TraceableControllerResolver.php +++ /dev/null @@ -1,66 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Controller; - -use Symfony\Component\Stopwatch\Stopwatch; -use Symfony\Component\HttpFoundation\Request; - -/** - * TraceableControllerResolver. - * - * @author Fabien Potencier - */ -class TraceableControllerResolver implements ControllerResolverInterface -{ - private $resolver; - private $stopwatch; - - /** - * Constructor. - * - * @param ControllerResolverInterface $resolver A ControllerResolverInterface instance - * @param Stopwatch $stopwatch A Stopwatch instance - */ - public function __construct(ControllerResolverInterface $resolver, Stopwatch $stopwatch) - { - $this->resolver = $resolver; - $this->stopwatch = $stopwatch; - } - - /** - * {@inheritdoc} - */ - public function getController(Request $request) - { - $e = $this->stopwatch->start('controller.get_callable'); - - $ret = $this->resolver->getController($request); - - $e->stop(); - - return $ret; - } - - /** - * {@inheritdoc} - */ - public function getArguments(Request $request, $controller) - { - $e = $this->stopwatch->start('controller.get_arguments'); - - $ret = $this->resolver->getArguments($request, $controller); - - $e->stop(); - - return $ret; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/DataCollector/ConfigDataCollector.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/DataCollector/ConfigDataCollector.php deleted file mode 100644 index 853adcb..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/DataCollector/ConfigDataCollector.php +++ /dev/null @@ -1,291 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\DataCollector; - -use Symfony\Component\HttpKernel\KernelInterface; -use Symfony\Component\HttpKernel\Kernel; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; - -/** - * ConfigDataCollector. - * - * @author Fabien Potencier - */ -class ConfigDataCollector extends DataCollector -{ - /** - * @var KernelInterface - */ - private $kernel; - private $name; - private $version; - private $cacheVersionInfo = true; - - /** - * Constructor. - * - * @param string $name The name of the application using the web profiler - * @param string $version The version of the application using the web profiler - */ - public function __construct($name = null, $version = null) - { - $this->name = $name; - $this->version = $version; - } - - /** - * Sets the Kernel associated with this Request. - * - * @param KernelInterface $kernel A KernelInterface instance - */ - public function setKernel(KernelInterface $kernel = null) - { - $this->kernel = $kernel; - } - - /** - * {@inheritdoc} - */ - public function collect(Request $request, Response $response, \Exception $exception = null) - { - $this->data = array( - 'app_name' => $this->name, - 'app_version' => $this->version, - 'token' => $response->headers->get('X-Debug-Token'), - 'symfony_version' => Kernel::VERSION, - 'symfony_state' => 'unknown', - 'name' => isset($this->kernel) ? $this->kernel->getName() : 'n/a', - 'env' => isset($this->kernel) ? $this->kernel->getEnvironment() : 'n/a', - 'debug' => isset($this->kernel) ? $this->kernel->isDebug() : 'n/a', - 'php_version' => PHP_VERSION, - 'xdebug_enabled' => extension_loaded('xdebug'), - 'eaccel_enabled' => extension_loaded('eaccelerator') && ini_get('eaccelerator.enable'), - 'apc_enabled' => extension_loaded('apc') && ini_get('apc.enabled'), - 'xcache_enabled' => extension_loaded('xcache') && ini_get('xcache.cacher'), - 'wincache_enabled' => extension_loaded('wincache') && ini_get('wincache.ocenabled'), - 'zend_opcache_enabled' => extension_loaded('Zend OPcache') && ini_get('opcache.enable'), - 'bundles' => array(), - 'sapi_name' => php_sapi_name(), - ); - - if (isset($this->kernel)) { - foreach ($this->kernel->getBundles() as $name => $bundle) { - $this->data['bundles'][$name] = $bundle->getPath(); - } - - $this->data['symfony_state'] = $this->determineSymfonyState(); - } - } - - public function getApplicationName() - { - return $this->data['app_name']; - } - - public function getApplicationVersion() - { - return $this->data['app_version']; - } - - /** - * Gets the token. - * - * @return string The token - */ - public function getToken() - { - return $this->data['token']; - } - - /** - * Gets the Symfony version. - * - * @return string The Symfony version - */ - public function getSymfonyVersion() - { - return $this->data['symfony_version']; - } - - /** - * Returns the state of the current Symfony release. - * - * @return string One of: unknown, dev, stable, eom, eol - */ - public function getSymfonyState() - { - return $this->data['symfony_state']; - } - - public function setCacheVersionInfo($cacheVersionInfo) - { - $this->cacheVersionInfo = $cacheVersionInfo; - } - - /** - * Gets the PHP version. - * - * @return string The PHP version - */ - public function getPhpVersion() - { - return $this->data['php_version']; - } - - /** - * Gets the application name. - * - * @return string The application name - */ - public function getAppName() - { - return $this->data['name']; - } - - /** - * Gets the environment. - * - * @return string The environment - */ - public function getEnv() - { - return $this->data['env']; - } - - /** - * Returns true if the debug is enabled. - * - * @return bool true if debug is enabled, false otherwise - */ - public function isDebug() - { - return $this->data['debug']; - } - - /** - * Returns true if the XDebug is enabled. - * - * @return bool true if XDebug is enabled, false otherwise - */ - public function hasXDebug() - { - return $this->data['xdebug_enabled']; - } - - /** - * Returns true if EAccelerator is enabled. - * - * @return bool true if EAccelerator is enabled, false otherwise - */ - public function hasEAccelerator() - { - return $this->data['eaccel_enabled']; - } - - /** - * Returns true if APC is enabled. - * - * @return bool true if APC is enabled, false otherwise - */ - public function hasApc() - { - return $this->data['apc_enabled']; - } - - /** - * Returns true if Zend OPcache is enabled. - * - * @return bool true if Zend OPcache is enabled, false otherwise - */ - public function hasZendOpcache() - { - return $this->data['zend_opcache_enabled']; - } - - /** - * Returns true if XCache is enabled. - * - * @return bool true if XCache is enabled, false otherwise - */ - public function hasXCache() - { - return $this->data['xcache_enabled']; - } - - /** - * Returns true if WinCache is enabled. - * - * @return bool true if WinCache is enabled, false otherwise - */ - public function hasWinCache() - { - return $this->data['wincache_enabled']; - } - - /** - * Returns true if any accelerator is enabled. - * - * @return bool true if any accelerator is enabled, false otherwise - */ - public function hasAccelerator() - { - return $this->hasApc() || $this->hasZendOpcache() || $this->hasEAccelerator() || $this->hasXCache() || $this->hasWinCache(); - } - - public function getBundles() - { - return $this->data['bundles']; - } - - /** - * Gets the PHP SAPI name. - * - * @return string The environment - */ - public function getSapiName() - { - return $this->data['sapi_name']; - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return 'config'; - } - - /** - * Tries to retrieve information about the current Symfony version. - * - * @return string One of: dev, stable, eom, eol - */ - private function determineSymfonyState() - { - $now = new \DateTime(); - $eom = \DateTime::createFromFormat('m/Y', Kernel::END_OF_MAINTENANCE)->modify('last day of this month'); - $eol = \DateTime::createFromFormat('m/Y', Kernel::END_OF_LIFE)->modify('last day of this month'); - - if ($now > $eol) { - $versionState = 'eol'; - } elseif ($now > $eom) { - $versionState = 'eom'; - } elseif ('' !== Kernel::EXTRA_VERSION) { - $versionState = 'dev'; - } else { - $versionState = 'stable'; - } - - return $versionState; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/DataCollector/DataCollector.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/DataCollector/DataCollector.php deleted file mode 100644 index 5dca652..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/DataCollector/DataCollector.php +++ /dev/null @@ -1,58 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\DataCollector; - -use Symfony\Component\HttpKernel\DataCollector\Util\ValueExporter; - -/** - * DataCollector. - * - * Children of this class must store the collected data in the data property. - * - * @author Fabien Potencier - * @author Bernhard Schussek - */ -abstract class DataCollector implements DataCollectorInterface, \Serializable -{ - protected $data = array(); - - /** - * @var ValueExporter - */ - private $valueExporter; - - public function serialize() - { - return serialize($this->data); - } - - public function unserialize($data) - { - $this->data = unserialize($data); - } - - /** - * Converts a PHP variable to a string. - * - * @param mixed $var A PHP variable - * - * @return string The string representation of the variable - */ - protected function varToString($var) - { - if (null === $this->valueExporter) { - $this->valueExporter = new ValueExporter(); - } - - return $this->valueExporter->exportValue($var); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/DataCollector/DataCollectorInterface.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/DataCollector/DataCollectorInterface.php deleted file mode 100644 index cf4cdfd..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/DataCollector/DataCollectorInterface.php +++ /dev/null @@ -1,45 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\DataCollector; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; - -/** - * DataCollectorInterface. - * - * @author Fabien Potencier - * - * @api - */ -interface DataCollectorInterface -{ - /** - * Collects data for the given Request and Response. - * - * @param Request $request A Request instance - * @param Response $response A Response instance - * @param \Exception $exception An Exception instance - * - * @api - */ - public function collect(Request $request, Response $response, \Exception $exception = null); - - /** - * Returns the name of the collector. - * - * @return string The collector name - * - * @api - */ - public function getName(); -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/DataCollector/DumpDataCollector.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/DataCollector/DumpDataCollector.php deleted file mode 100644 index 09abfb1..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/DataCollector/DumpDataCollector.php +++ /dev/null @@ -1,303 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\DataCollector; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\RequestStack; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\Stopwatch\Stopwatch; -use Symfony\Component\VarDumper\Cloner\Data; -use Symfony\Component\VarDumper\Cloner\VarCloner; -use Symfony\Component\VarDumper\Dumper\CliDumper; -use Symfony\Component\VarDumper\Dumper\HtmlDumper; -use Symfony\Component\VarDumper\Dumper\DataDumperInterface; - -/** - * @author Nicolas Grekas - */ -class DumpDataCollector extends DataCollector implements DataDumperInterface -{ - private $stopwatch; - private $fileLinkFormat; - private $dataCount = 0; - private $isCollected = true; - private $clonesCount = 0; - private $clonesIndex = 0; - private $rootRefs; - private $charset; - private $dumper; - private $dumperIsInjected; - - public function __construct(Stopwatch $stopwatch = null, $fileLinkFormat = null, $charset = null, RequestStack $requestStack = null, DataDumperInterface $dumper = null) - { - $this->stopwatch = $stopwatch; - $this->fileLinkFormat = $fileLinkFormat ?: ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format'); - $this->charset = $charset ?: ini_get('php.output_encoding') ?: ini_get('default_charset') ?: 'UTF-8'; - $this->requestStack = $requestStack; - $this->dumper = $dumper; - $this->dumperIsInjected = null !== $dumper; - - // All clones share these properties by reference: - $this->rootRefs = array( - &$this->data, - &$this->dataCount, - &$this->isCollected, - &$this->clonesCount, - ); - } - - public function __clone() - { - $this->clonesIndex = ++$this->clonesCount; - } - - public function dump(Data $data) - { - if ($this->stopwatch) { - $this->stopwatch->start('dump'); - } - if ($this->isCollected) { - $this->isCollected = false; - } - - $trace = DEBUG_BACKTRACE_PROVIDE_OBJECT | DEBUG_BACKTRACE_IGNORE_ARGS; - if (PHP_VERSION_ID >= 50400) { - $trace = debug_backtrace($trace, 7); - } else { - $trace = debug_backtrace($trace); - } - - $file = $trace[0]['file']; - $line = $trace[0]['line']; - $name = false; - $fileExcerpt = false; - - for ($i = 1; $i < 7; ++$i) { - if (isset($trace[$i]['class'], $trace[$i]['function']) - && 'dump' === $trace[$i]['function'] - && 'Symfony\Component\VarDumper\VarDumper' === $trace[$i]['class'] - ) { - $file = $trace[$i]['file']; - $line = $trace[$i]['line']; - - while (++$i < 7) { - if (isset($trace[$i]['function'], $trace[$i]['file']) && empty($trace[$i]['class']) && 0 !== strpos($trace[$i]['function'], 'call_user_func')) { - $file = $trace[$i]['file']; - $line = $trace[$i]['line']; - - break; - } elseif (isset($trace[$i]['object']) && $trace[$i]['object'] instanceof \Twig_Template) { - $info = $trace[$i]['object']; - $name = $info->getTemplateName(); - $src = $info->getEnvironment()->getLoader()->getSource($name); - $info = $info->getDebugInfo(); - if (isset($info[$trace[$i - 1]['line']])) { - $file = false; - $line = $info[$trace[$i - 1]['line']]; - $src = explode("\n", $src); - $fileExcerpt = array(); - - for ($i = max($line - 3, 1), $max = min($line + 3, count($src)); $i <= $max; ++$i) { - $fileExcerpt[] = ''.$this->htmlEncode($src[$i - 1]).''; - } - - $fileExcerpt = '
      '.implode("\n", $fileExcerpt).'
    '; - } - break; - } - } - break; - } - } - - if (false === $name) { - $name = strtr($file, '\\', '/'); - $name = substr($name, strrpos($name, '/') + 1); - } - - if ($this->dumper) { - $this->doDump($data, $name, $file, $line); - } - - $this->data[] = compact('data', 'name', 'file', 'line', 'fileExcerpt'); - ++$this->dataCount; - - if ($this->stopwatch) { - $this->stopwatch->stop('dump'); - } - } - - public function collect(Request $request, Response $response, \Exception $exception = null) - { - // Sub-requests and programmatic calls stay in the collected profile. - if ($this->dumper || ($this->requestStack && $this->requestStack->getMasterRequest() !== $request) || $request->isXmlHttpRequest() || $request->headers->has('Origin')) { - return; - } - - // In all other conditions that remove the web debug toolbar, dumps are written on the output. - if (!$this->requestStack - || !$response->headers->has('X-Debug-Token') - || $response->isRedirection() - || ($response->headers->has('Content-Type') && false === strpos($response->headers->get('Content-Type'), 'html')) - || 'html' !== $request->getRequestFormat() - || false === strripos($response->getContent(), '') - ) { - if ($response->headers->has('Content-Type') && false !== strpos($response->headers->get('Content-Type'), 'html')) { - $this->dumper = new HtmlDumper('php://output', $this->charset); - } else { - $this->dumper = new CliDumper('php://output', $this->charset); - } - - foreach ($this->data as $dump) { - $this->doDump($dump['data'], $dump['name'], $dump['file'], $dump['line']); - } - } - } - - public function serialize() - { - if ($this->clonesCount !== $this->clonesIndex) { - return 'a:0:{}'; - } - - $ser = serialize($this->data); - $this->data = array(); - $this->dataCount = 0; - $this->isCollected = true; - if (!$this->dumperIsInjected) { - $this->dumper = null; - } - - return $ser; - } - - public function unserialize($data) - { - parent::unserialize($data); - $this->dataCount = count($this->data); - self::__construct($this->stopwatch); - } - - public function getDumpsCount() - { - return $this->dataCount; - } - - public function getDumps($format, $maxDepthLimit = -1, $maxItemsPerDepth = -1) - { - $data = fopen('php://memory', 'r+b'); - - if ('html' === $format) { - $dumper = new HtmlDumper($data, $this->charset); - } else { - throw new \InvalidArgumentException(sprintf('Invalid dump format: %s', $format)); - } - $dumps = array(); - - foreach ($this->data as $dump) { - if (method_exists($dump['data'], 'withMaxDepth')) { - $dumper->dump($dump['data']->withMaxDepth($maxDepthLimit)->withMaxItemsPerDepth($maxItemsPerDepth)); - } else { - // getLimitedClone is @deprecated, to be removed in 3.0 - $dumper->dump($dump['data']->getLimitedClone($maxDepthLimit, $maxItemsPerDepth)); - } - rewind($data); - $dump['data'] = stream_get_contents($data); - ftruncate($data, 0); - rewind($data); - $dumps[] = $dump; - } - - return $dumps; - } - - public function getName() - { - return 'dump'; - } - - public function __destruct() - { - if (0 === $this->clonesCount-- && !$this->isCollected && $this->data) { - $this->clonesCount = 0; - $this->isCollected = true; - - $h = headers_list(); - $i = count($h); - array_unshift($h, 'Content-Type: '.ini_get('default_mimetype')); - while (0 !== stripos($h[$i], 'Content-Type:')) { - --$i; - } - - if ('cli' !== PHP_SAPI && stripos($h[$i], 'html')) { - $this->dumper = new HtmlDumper('php://output', $this->charset); - } else { - $this->dumper = new CliDumper('php://output', $this->charset); - } - - foreach ($this->data as $i => $dump) { - $this->data[$i] = null; - $this->doDump($dump['data'], $dump['name'], $dump['file'], $dump['line']); - } - - $this->data = array(); - $this->dataCount = 0; - } - } - - private function doDump($data, $name, $file, $line) - { - if (PHP_VERSION_ID >= 50400 && $this->dumper instanceof CliDumper) { - $contextDumper = function ($name, $file, $line, $fileLinkFormat) { - if ($this instanceof HtmlDumper) { - if ('' !== $file) { - $s = $this->style('meta', '%s'); - $name = strip_tags($this->style('', $name)); - $file = strip_tags($this->style('', $file)); - if ($fileLinkFormat) { - $link = strtr(strip_tags($this->style('', $fileLinkFormat)), array('%f' => $file, '%l' => (int) $line)); - $name = sprintf(''.$s.'', $link, $file, $name); - } else { - $name = sprintf(''.$s.'', $file, $name); - } - } else { - $name = $this->style('meta', $name); - } - $this->line = $name.' on line '.$this->style('meta', $line).':'; - } else { - $this->line = $this->style('meta', $name).' on line '.$this->style('meta', $line).':'; - } - $this->dumpLine(0); - }; - $contextDumper = $contextDumper->bindTo($this->dumper, $this->dumper); - $contextDumper($name, $file, $line, $this->fileLinkFormat); - } else { - $cloner = new VarCloner(); - $this->dumper->dump($cloner->cloneVar($name.' on line '.$line.':')); - } - $this->dumper->dump($data); - } - - private function htmlEncode($s) - { - $html = ''; - - $dumper = new HtmlDumper(function ($line) use (&$html) {$html .= $line;}, $this->charset); - $dumper->setDumpHeader(''); - $dumper->setDumpBoundaries('', ''); - - $cloner = new VarCloner(); - $dumper->dump($cloner->cloneVar($s)); - - return substr(strip_tags($html), 1, -1); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/DataCollector/EventDataCollector.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/DataCollector/EventDataCollector.php deleted file mode 100644 index 0a87bc3..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/DataCollector/EventDataCollector.php +++ /dev/null @@ -1,107 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\DataCollector; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcherInterface; - -/** - * EventDataCollector. - * - * @author Fabien Potencier - */ -class EventDataCollector extends DataCollector implements LateDataCollectorInterface -{ - protected $dispatcher; - - public function __construct(EventDispatcherInterface $dispatcher = null) - { - $this->dispatcher = $dispatcher; - } - - /** - * {@inheritdoc} - */ - public function collect(Request $request, Response $response, \Exception $exception = null) - { - $this->data = array( - 'called_listeners' => array(), - 'not_called_listeners' => array(), - ); - } - - public function lateCollect() - { - if ($this->dispatcher instanceof TraceableEventDispatcherInterface) { - $this->setCalledListeners($this->dispatcher->getCalledListeners()); - $this->setNotCalledListeners($this->dispatcher->getNotCalledListeners()); - } - } - - /** - * Sets the called listeners. - * - * @param array $listeners An array of called listeners - * - * @see TraceableEventDispatcherInterface - */ - public function setCalledListeners(array $listeners) - { - $this->data['called_listeners'] = $listeners; - } - - /** - * Gets the called listeners. - * - * @return array An array of called listeners - * - * @see TraceableEventDispatcherInterface - */ - public function getCalledListeners() - { - return $this->data['called_listeners']; - } - - /** - * Sets the not called listeners. - * - * @param array $listeners An array of not called listeners - * - * @see TraceableEventDispatcherInterface - */ - public function setNotCalledListeners(array $listeners) - { - $this->data['not_called_listeners'] = $listeners; - } - - /** - * Gets the not called listeners. - * - * @return array An array of not called listeners - * - * @see TraceableEventDispatcherInterface - */ - public function getNotCalledListeners() - { - return $this->data['not_called_listeners']; - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return 'events'; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/DataCollector/ExceptionDataCollector.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/DataCollector/ExceptionDataCollector.php deleted file mode 100644 index 9fe8264..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/DataCollector/ExceptionDataCollector.php +++ /dev/null @@ -1,104 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\DataCollector; - -use Symfony\Component\Debug\Exception\FlattenException; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; - -/** - * ExceptionDataCollector. - * - * @author Fabien Potencier - */ -class ExceptionDataCollector extends DataCollector -{ - /** - * {@inheritdoc} - */ - public function collect(Request $request, Response $response, \Exception $exception = null) - { - if (null !== $exception) { - $this->data = array( - 'exception' => FlattenException::create($exception), - ); - } - } - - /** - * Checks if the exception is not null. - * - * @return bool true if the exception is not null, false otherwise - */ - public function hasException() - { - return isset($this->data['exception']); - } - - /** - * Gets the exception. - * - * @return \Exception The exception - */ - public function getException() - { - return $this->data['exception']; - } - - /** - * Gets the exception message. - * - * @return string The exception message - */ - public function getMessage() - { - return $this->data['exception']->getMessage(); - } - - /** - * Gets the exception code. - * - * @return int The exception code - */ - public function getCode() - { - return $this->data['exception']->getCode(); - } - - /** - * Gets the status code. - * - * @return int The status code - */ - public function getStatusCode() - { - return $this->data['exception']->getStatusCode(); - } - - /** - * Gets the exception trace. - * - * @return array The exception trace - */ - public function getTrace() - { - return $this->data['exception']->getTrace(); - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return 'exception'; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/DataCollector/LateDataCollectorInterface.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/DataCollector/LateDataCollectorInterface.php deleted file mode 100644 index 012332d..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/DataCollector/LateDataCollectorInterface.php +++ /dev/null @@ -1,25 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\DataCollector; - -/** - * LateDataCollectorInterface. - * - * @author Fabien Potencier - */ -interface LateDataCollectorInterface -{ - /** - * Collects data as late as possible. - */ - public function lateCollect(); -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/DataCollector/LoggerDataCollector.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/DataCollector/LoggerDataCollector.php deleted file mode 100644 index 0d1decd..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/DataCollector/LoggerDataCollector.php +++ /dev/null @@ -1,164 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\DataCollector; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\Log\DebugLoggerInterface; - -/** - * LogDataCollector. - * - * @author Fabien Potencier - */ -class LoggerDataCollector extends DataCollector implements LateDataCollectorInterface -{ - private $logger; - - public function __construct($logger = null) - { - if (null !== $logger && $logger instanceof DebugLoggerInterface) { - $this->logger = $logger; - } - } - - /** - * {@inheritdoc} - */ - public function collect(Request $request, Response $response, \Exception $exception = null) - { - // everything is done as late as possible - } - - /** - * {@inheritdoc} - */ - public function lateCollect() - { - if (null !== $this->logger) { - $this->data = $this->computeErrorsCount(); - $this->data['logs'] = $this->sanitizeLogs($this->logger->getLogs()); - } - } - - /** - * Gets the called events. - * - * @return array An array of called events - * - * @see TraceableEventDispatcherInterface - */ - public function countErrors() - { - return isset($this->data['error_count']) ? $this->data['error_count'] : 0; - } - - /** - * Gets the logs. - * - * @return array An array of logs - */ - public function getLogs() - { - return isset($this->data['logs']) ? $this->data['logs'] : array(); - } - - public function getPriorities() - { - return isset($this->data['priorities']) ? $this->data['priorities'] : array(); - } - - public function countDeprecations() - { - return isset($this->data['deprecation_count']) ? $this->data['deprecation_count'] : 0; - } - - public function countScreams() - { - return isset($this->data['scream_count']) ? $this->data['scream_count'] : 0; - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return 'logger'; - } - - private function sanitizeLogs($logs) - { - foreach ($logs as $i => $log) { - $context = $this->sanitizeContext($log['context']); - if (isset($context['type'], $context['level']) && !($context['type'] & $context['level'])) { - $context['scream'] = true; - } - $logs[$i]['context'] = $context; - } - - return $logs; - } - - private function sanitizeContext($context) - { - if (is_array($context)) { - foreach ($context as $key => $value) { - $context[$key] = $this->sanitizeContext($value); - } - - return $context; - } - - if (is_resource($context)) { - return sprintf('Resource(%s)', get_resource_type($context)); - } - - if (is_object($context)) { - return sprintf('Object(%s)', get_class($context)); - } - - return $context; - } - - private function computeErrorsCount() - { - $count = array( - 'error_count' => $this->logger->countErrors(), - 'deprecation_count' => 0, - 'scream_count' => 0, - 'priorities' => array(), - ); - - foreach ($this->logger->getLogs() as $log) { - if (isset($count['priorities'][$log['priority']])) { - ++$count['priorities'][$log['priority']]['count']; - } else { - $count['priorities'][$log['priority']] = array( - 'count' => 1, - 'name' => $log['priorityName'], - ); - } - - if (isset($log['context']['type'], $log['context']['level'])) { - if (E_DEPRECATED === $log['context']['type'] || E_USER_DEPRECATED === $log['context']['type']) { - ++$count['deprecation_count']; - } elseif (!($log['context']['type'] & $log['context']['level'])) { - ++$count['scream_count']; - } - } - } - - ksort($count['priorities']); - - return $count; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/DataCollector/MemoryDataCollector.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/DataCollector/MemoryDataCollector.php deleted file mode 100644 index 9385010..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/DataCollector/MemoryDataCollector.php +++ /dev/null @@ -1,109 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\DataCollector; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; - -/** - * MemoryDataCollector. - * - * @author Fabien Potencier - */ -class MemoryDataCollector extends DataCollector implements LateDataCollectorInterface -{ - public function __construct() - { - $this->data = array( - 'memory' => 0, - 'memory_limit' => $this->convertToBytes(ini_get('memory_limit')), - ); - } - - /** - * {@inheritdoc} - */ - public function collect(Request $request, Response $response, \Exception $exception = null) - { - $this->updateMemoryUsage(); - } - - /** - * {@inheritdoc} - */ - public function lateCollect() - { - $this->updateMemoryUsage(); - } - - /** - * Gets the memory. - * - * @return int The memory - */ - public function getMemory() - { - return $this->data['memory']; - } - - /** - * Gets the PHP memory limit. - * - * @return int The memory limit - */ - public function getMemoryLimit() - { - return $this->data['memory_limit']; - } - - /** - * Updates the memory usage data. - */ - public function updateMemoryUsage() - { - $this->data['memory'] = memory_get_peak_usage(true); - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return 'memory'; - } - - private function convertToBytes($memoryLimit) - { - if ('-1' === $memoryLimit) { - return -1; - } - - $memoryLimit = strtolower($memoryLimit); - $max = strtolower(ltrim($memoryLimit, '+')); - if (0 === strpos($max, '0x')) { - $max = intval($max, 16); - } elseif (0 === strpos($max, '0')) { - $max = intval($max, 8); - } else { - $max = (int) $max; - } - - switch (substr($memoryLimit, -1)) { - case 't': $max *= 1024; - case 'g': $max *= 1024; - case 'm': $max *= 1024; - case 'k': $max *= 1024; - } - - return $max; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/DataCollector/RequestDataCollector.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/DataCollector/RequestDataCollector.php deleted file mode 100644 index 0f06f87..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/DataCollector/RequestDataCollector.php +++ /dev/null @@ -1,342 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\DataCollector; - -use Symfony\Component\HttpFoundation\ParameterBag; -use Symfony\Component\HttpFoundation\HeaderBag; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpFoundation\ResponseHeaderBag; -use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\HttpKernel\Event\FilterControllerEvent; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; - -/** - * RequestDataCollector. - * - * @author Fabien Potencier - */ -class RequestDataCollector extends DataCollector implements EventSubscriberInterface -{ - protected $controllers; - - public function __construct() - { - $this->controllers = new \SplObjectStorage(); - } - - /** - * {@inheritdoc} - */ - public function collect(Request $request, Response $response, \Exception $exception = null) - { - $responseHeaders = $response->headers->all(); - $cookies = array(); - foreach ($response->headers->getCookies() as $cookie) { - $cookies[] = $this->getCookieHeader($cookie->getName(), $cookie->getValue(), $cookie->getExpiresTime(), $cookie->getPath(), $cookie->getDomain(), $cookie->isSecure(), $cookie->isHttpOnly()); - } - if (count($cookies) > 0) { - $responseHeaders['Set-Cookie'] = $cookies; - } - - // attributes are serialized and as they can be anything, they need to be converted to strings. - $attributes = array(); - foreach ($request->attributes->all() as $key => $value) { - if ('_route' === $key && is_object($value)) { - $attributes[$key] = $this->varToString($value->getPath()); - } elseif ('_route_params' === $key) { - // we need to keep route params as an array (see getRouteParams()) - foreach ($value as $k => $v) { - $value[$k] = $this->varToString($v); - } - $attributes[$key] = $value; - } else { - $attributes[$key] = $this->varToString($value); - } - } - - $content = null; - try { - $content = $request->getContent(); - } catch (\LogicException $e) { - // the user already got the request content as a resource - $content = false; - } - - $sessionMetadata = array(); - $sessionAttributes = array(); - $flashes = array(); - if ($request->hasSession()) { - $session = $request->getSession(); - if ($session->isStarted()) { - $sessionMetadata['Created'] = date(DATE_RFC822, $session->getMetadataBag()->getCreated()); - $sessionMetadata['Last used'] = date(DATE_RFC822, $session->getMetadataBag()->getLastUsed()); - $sessionMetadata['Lifetime'] = $session->getMetadataBag()->getLifetime(); - $sessionAttributes = $session->all(); - $flashes = $session->getFlashBag()->peekAll(); - } - } - - $statusCode = $response->getStatusCode(); - - $this->data = array( - 'format' => $request->getRequestFormat(), - 'content' => $content, - 'content_type' => $response->headers->get('Content-Type', 'text/html'), - 'status_text' => isset(Response::$statusTexts[$statusCode]) ? Response::$statusTexts[$statusCode] : '', - 'status_code' => $statusCode, - 'request_query' => $request->query->all(), - 'request_request' => $request->request->all(), - 'request_headers' => $request->headers->all(), - 'request_server' => $request->server->all(), - 'request_cookies' => $request->cookies->all(), - 'request_attributes' => $attributes, - 'response_headers' => $responseHeaders, - 'session_metadata' => $sessionMetadata, - 'session_attributes' => $sessionAttributes, - 'flashes' => $flashes, - 'path_info' => $request->getPathInfo(), - 'controller' => 'n/a', - 'locale' => $request->getLocale(), - ); - - if (isset($this->data['request_headers']['php-auth-pw'])) { - $this->data['request_headers']['php-auth-pw'] = '******'; - } - - if (isset($this->data['request_server']['PHP_AUTH_PW'])) { - $this->data['request_server']['PHP_AUTH_PW'] = '******'; - } - - if (isset($this->data['request_request']['_password'])) { - $this->data['request_request']['_password'] = '******'; - } - - if (isset($this->controllers[$request])) { - $controller = $this->controllers[$request]; - if (is_array($controller)) { - try { - $r = new \ReflectionMethod($controller[0], $controller[1]); - $this->data['controller'] = array( - 'class' => is_object($controller[0]) ? get_class($controller[0]) : $controller[0], - 'method' => $controller[1], - 'file' => $r->getFileName(), - 'line' => $r->getStartLine(), - ); - } catch (\ReflectionException $re) { - if (is_callable($controller)) { - // using __call or __callStatic - $this->data['controller'] = array( - 'class' => is_object($controller[0]) ? get_class($controller[0]) : $controller[0], - 'method' => $controller[1], - 'file' => 'n/a', - 'line' => 'n/a', - ); - } - } - } elseif ($controller instanceof \Closure) { - $r = new \ReflectionFunction($controller); - $this->data['controller'] = array( - 'class' => $r->getName(), - 'method' => null, - 'file' => $r->getFileName(), - 'line' => $r->getStartLine(), - ); - } elseif (is_object($controller)) { - $r = new \ReflectionClass($controller); - $this->data['controller'] = array( - 'class' => $r->getName(), - 'method' => null, - 'file' => $r->getFileName(), - 'line' => $r->getStartLine(), - ); - } else { - $this->data['controller'] = (string) $controller ?: 'n/a'; - } - unset($this->controllers[$request]); - } - } - - public function getPathInfo() - { - return $this->data['path_info']; - } - - public function getRequestRequest() - { - return new ParameterBag($this->data['request_request']); - } - - public function getRequestQuery() - { - return new ParameterBag($this->data['request_query']); - } - - public function getRequestHeaders() - { - return new HeaderBag($this->data['request_headers']); - } - - public function getRequestServer() - { - return new ParameterBag($this->data['request_server']); - } - - public function getRequestCookies() - { - return new ParameterBag($this->data['request_cookies']); - } - - public function getRequestAttributes() - { - return new ParameterBag($this->data['request_attributes']); - } - - public function getResponseHeaders() - { - return new ResponseHeaderBag($this->data['response_headers']); - } - - public function getSessionMetadata() - { - return $this->data['session_metadata']; - } - - public function getSessionAttributes() - { - return $this->data['session_attributes']; - } - - public function getFlashes() - { - return $this->data['flashes']; - } - - public function getContent() - { - return $this->data['content']; - } - - public function getContentType() - { - return $this->data['content_type']; - } - - public function getStatusText() - { - return $this->data['status_text']; - } - - public function getStatusCode() - { - return $this->data['status_code']; - } - - public function getFormat() - { - return $this->data['format']; - } - - public function getLocale() - { - return $this->data['locale']; - } - - /** - * Gets the route name. - * - * The _route request attributes is automatically set by the Router Matcher. - * - * @return string The route - */ - public function getRoute() - { - return isset($this->data['request_attributes']['_route']) ? $this->data['request_attributes']['_route'] : ''; - } - - /** - * Gets the route parameters. - * - * The _route_params request attributes is automatically set by the RouterListener. - * - * @return array The parameters - */ - public function getRouteParams() - { - return isset($this->data['request_attributes']['_route_params']) ? $this->data['request_attributes']['_route_params'] : array(); - } - - /** - * Gets the controller. - * - * @return string The controller as a string - */ - public function getController() - { - return $this->data['controller']; - } - - public function onKernelController(FilterControllerEvent $event) - { - $this->controllers[$event->getRequest()] = $event->getController(); - } - - public static function getSubscribedEvents() - { - return array(KernelEvents::CONTROLLER => 'onKernelController'); - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return 'request'; - } - - private function getCookieHeader($name, $value, $expires, $path, $domain, $secure, $httponly) - { - $cookie = sprintf('%s=%s', $name, urlencode($value)); - - if (0 !== $expires) { - if (is_numeric($expires)) { - $expires = (int) $expires; - } elseif ($expires instanceof \DateTime) { - $expires = $expires->getTimestamp(); - } else { - $tmp = strtotime($expires); - if (false === $tmp || -1 == $tmp) { - throw new \InvalidArgumentException(sprintf('The "expires" cookie parameter is not valid (%s).', $expires)); - } - $expires = $tmp; - } - - $cookie .= '; expires='.str_replace('+0000', '', \DateTime::createFromFormat('U', $expires, new \DateTimeZone('GMT'))->format('D, d-M-Y H:i:s T')); - } - - if ($domain) { - $cookie .= '; domain='.$domain; - } - - $cookie .= '; path='.$path; - - if ($secure) { - $cookie .= '; secure'; - } - - if ($httponly) { - $cookie .= '; httponly'; - } - - return $cookie; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/DataCollector/RouterDataCollector.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/DataCollector/RouterDataCollector.php deleted file mode 100644 index 76d9623..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/DataCollector/RouterDataCollector.php +++ /dev/null @@ -1,102 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\DataCollector; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpFoundation\RedirectResponse; -use Symfony\Component\HttpKernel\Event\FilterControllerEvent; - -/** - * RouterDataCollector. - * - * @author Fabien Potencier - */ -class RouterDataCollector extends DataCollector -{ - protected $controllers; - - public function __construct() - { - $this->controllers = new \SplObjectStorage(); - - $this->data = array( - 'redirect' => false, - 'url' => null, - 'route' => null, - ); - } - - /** - * {@inheritdoc} - */ - public function collect(Request $request, Response $response, \Exception $exception = null) - { - if ($response instanceof RedirectResponse) { - $this->data['redirect'] = true; - $this->data['url'] = $response->getTargetUrl(); - - if ($this->controllers->contains($request)) { - $this->data['route'] = $this->guessRoute($request, $this->controllers[$request]); - } - } - - unset($this->controllers[$request]); - } - - protected function guessRoute(Request $request, $controller) - { - return 'n/a'; - } - - /** - * Remembers the controller associated to each request. - * - * @param FilterControllerEvent $event The filter controller event - */ - public function onKernelController(FilterControllerEvent $event) - { - $this->controllers[$event->getRequest()] = $event->getController(); - } - - /** - * @return bool Whether this request will result in a redirect - */ - public function getRedirect() - { - return $this->data['redirect']; - } - - /** - * @return string|null The target URL - */ - public function getTargetUrl() - { - return $this->data['url']; - } - - /** - * @return string|null The target route - */ - public function getTargetRoute() - { - return $this->data['route']; - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return 'router'; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/DataCollector/TimeDataCollector.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/DataCollector/TimeDataCollector.php deleted file mode 100644 index 4ccaafa..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/DataCollector/TimeDataCollector.php +++ /dev/null @@ -1,136 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\DataCollector; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\KernelInterface; - -/** - * TimeDataCollector. - * - * @author Fabien Potencier - */ -class TimeDataCollector extends DataCollector implements LateDataCollectorInterface -{ - protected $kernel; - protected $stopwatch; - - public function __construct(KernelInterface $kernel = null, $stopwatch = null) - { - $this->kernel = $kernel; - $this->stopwatch = $stopwatch; - } - - /** - * {@inheritdoc} - */ - public function collect(Request $request, Response $response, \Exception $exception = null) - { - if (null !== $this->kernel) { - $startTime = $this->kernel->getStartTime(); - } else { - $startTime = $request->server->get('REQUEST_TIME_FLOAT', $request->server->get('REQUEST_TIME')); - } - - $this->data = array( - 'token' => $response->headers->get('X-Debug-Token'), - 'start_time' => $startTime * 1000, - 'events' => array(), - ); - } - - /** - * {@inheritdoc} - */ - public function lateCollect() - { - if (null !== $this->stopwatch && isset($this->data['token'])) { - $this->setEvents($this->stopwatch->getSectionEvents($this->data['token'])); - } - unset($this->data['token']); - } - - /** - * Sets the request events. - * - * @param array $events The request events - */ - public function setEvents(array $events) - { - foreach ($events as $event) { - $event->ensureStopped(); - } - - $this->data['events'] = $events; - } - - /** - * Gets the request events. - * - * @return array The request events - */ - public function getEvents() - { - return $this->data['events']; - } - - /** - * Gets the request elapsed time. - * - * @return float The elapsed time - */ - public function getDuration() - { - if (!isset($this->data['events']['__section__'])) { - return 0; - } - - $lastEvent = $this->data['events']['__section__']; - - return $lastEvent->getOrigin() + $lastEvent->getDuration() - $this->getStartTime(); - } - - /** - * Gets the initialization time. - * - * This is the time spent until the beginning of the request handling. - * - * @return float The elapsed time - */ - public function getInitTime() - { - if (!isset($this->data['events']['__section__'])) { - return 0; - } - - return $this->data['events']['__section__']->getOrigin() - $this->getStartTime(); - } - - /** - * Gets the request time. - * - * @return int The time - */ - public function getStartTime() - { - return $this->data['start_time']; - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return 'time'; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/DataCollector/Util/ValueExporter.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/DataCollector/Util/ValueExporter.php deleted file mode 100644 index 20d6074..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/DataCollector/Util/ValueExporter.php +++ /dev/null @@ -1,78 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\DataCollector\Util; - -/** - * @author Bernhard Schussek - */ -class ValueExporter -{ - /** - * Converts a PHP value to a string. - * - * @param mixed $value The PHP value - * @param int $depth only for internal usage - * @param bool $deep only for internal usage - * - * @return string The string representation of the given value - */ - public function exportValue($value, $depth = 1, $deep = false) - { - if (is_object($value)) { - if ($value instanceof \DateTime || $value instanceof \DateTimeInterface) { - return sprintf('Object(%s) - %s', get_class($value), $value->format(\DateTime::ISO8601)); - } - - return sprintf('Object(%s)', get_class($value)); - } - - if (is_array($value)) { - if (empty($value)) { - return '[]'; - } - - $indent = str_repeat(' ', $depth); - - $a = array(); - foreach ($value as $k => $v) { - if (is_array($v)) { - $deep = true; - } - $a[] = sprintf('%s => %s', $k, $this->exportValue($v, $depth + 1, $deep)); - } - - if ($deep) { - return sprintf("[\n%s%s\n%s]", $indent, implode(sprintf(", \n%s", $indent), $a), str_repeat(' ', $depth - 1)); - } - - return sprintf("[%s]", implode(', ', $a)); - } - - if (is_resource($value)) { - return sprintf('Resource(%s#%d)', get_resource_type($value), $value); - } - - if (null === $value) { - return 'null'; - } - - if (false === $value) { - return 'false'; - } - - if (true === $value) { - return 'true'; - } - - return (string) $value; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Debug/ErrorHandler.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/Debug/ErrorHandler.php deleted file mode 100644 index af714a3..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Debug/ErrorHandler.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Debug; - -@trigger_error('The '.__NAMESPACE__.'\ErrorHandler class is deprecated since version 2.3 and will be removed in 3.0. Use the Symfony\Component\Debug\ErrorHandler class instead.', E_USER_DEPRECATED); - -use Symfony\Component\Debug\ErrorHandler as DebugErrorHandler; - -/** - * ErrorHandler. - * - * @author Fabien Potencier - * - * @deprecated since version 2.3, to be removed in 3.0. Use the same class from the Debug component instead. - */ -class ErrorHandler extends DebugErrorHandler -{ -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Debug/ExceptionHandler.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/Debug/ExceptionHandler.php deleted file mode 100644 index 50755d9..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Debug/ExceptionHandler.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Debug; - -@trigger_error('The '.__NAMESPACE__.'\ExceptionHandler class is deprecated since version 2.3 and will be removed in 3.0. Use the Symfony\Component\Debug\ExceptionHandler class instead.', E_USER_DEPRECATED); - -use Symfony\Component\Debug\ExceptionHandler as DebugExceptionHandler; - -/** - * ExceptionHandler converts an exception to a Response object. - * - * @author Fabien Potencier - * - * @deprecated since version 2.3, to be removed in 3.0. Use the same class from the Debug component instead. - */ -class ExceptionHandler extends DebugExceptionHandler -{ -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Debug/TraceableEventDispatcher.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/Debug/TraceableEventDispatcher.php deleted file mode 100644 index eb1d8a8..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Debug/TraceableEventDispatcher.php +++ /dev/null @@ -1,99 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Debug; - -use Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcher as BaseTraceableEventDispatcher; -use Symfony\Component\HttpKernel\Profiler\Profiler; -use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\EventDispatcher\Event; - -/** - * Collects some data about event listeners. - * - * This event dispatcher delegates the dispatching to another one. - * - * @author Fabien Potencier - */ -class TraceableEventDispatcher extends BaseTraceableEventDispatcher -{ - /** - * Sets the profiler. - * - * The traceable event dispatcher does not use the profiler anymore. - * The job is now done directly by the Profiler listener and the - * data collectors themselves. - * - * @param Profiler|null $profiler A Profiler instance - * - * @deprecated since version 2.4, to be removed in 3.0. - */ - public function setProfiler(Profiler $profiler = null) - { - @trigger_error('The '.__METHOD__.' method is deprecated since version 2.4 and will be removed in 3.0.', E_USER_DEPRECATED); - } - - /** - * {@inheritdoc} - */ - protected function preDispatch($eventName, Event $event) - { - switch ($eventName) { - case KernelEvents::REQUEST: - $this->stopwatch->openSection(); - break; - case KernelEvents::VIEW: - case KernelEvents::RESPONSE: - // stop only if a controller has been executed - if ($this->stopwatch->isStarted('controller')) { - $this->stopwatch->stop('controller'); - } - break; - case KernelEvents::TERMINATE: - $token = $event->getResponse()->headers->get('X-Debug-Token'); - // There is a very special case when using built-in AppCache class as kernel wrapper, in the case - // of an ESI request leading to a `stale` response [B] inside a `fresh` cached response [A]. - // In this case, `$token` contains the [B] debug token, but the open `stopwatch` section ID - // is equal to the [A] debug token. Trying to reopen section with the [B] token throws an exception - // which must be caught. - try { - $this->stopwatch->openSection($token); - } catch (\LogicException $e) { - } - break; - } - } - - /** - * {@inheritdoc} - */ - protected function postDispatch($eventName, Event $event) - { - switch ($eventName) { - case KernelEvents::CONTROLLER: - $this->stopwatch->start('controller', 'section'); - break; - case KernelEvents::RESPONSE: - $token = $event->getResponse()->headers->get('X-Debug-Token'); - $this->stopwatch->stopSection($token); - break; - case KernelEvents::TERMINATE: - // In the special case described in the `preDispatch` method above, the `$token` section - // does not exist, then closing it throws an exception which must be caught. - $token = $event->getResponse()->headers->get('X-Debug-Token'); - try { - $this->stopwatch->stopSection($token); - } catch (\LogicException $e) { - } - break; - } - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/DependencyInjection/AddClassesToCachePass.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/DependencyInjection/AddClassesToCachePass.php deleted file mode 100644 index 09af6bd..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/DependencyInjection/AddClassesToCachePass.php +++ /dev/null @@ -1,46 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\DependencyInjection; - -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; -use Symfony\Component\HttpKernel\Kernel; - -/** - * Sets the classes to compile in the cache for the container. - * - * @author Fabien Potencier - */ -class AddClassesToCachePass implements CompilerPassInterface -{ - private $kernel; - - public function __construct(Kernel $kernel) - { - $this->kernel = $kernel; - } - - /** - * {@inheritdoc} - */ - public function process(ContainerBuilder $container) - { - $classes = array(); - foreach ($container->getExtensions() as $extension) { - if ($extension instanceof Extension) { - $classes = array_merge($classes, $extension->getClassesToCompile()); - } - } - - $this->kernel->setClassCache(array_unique($container->getParameterBag()->resolveValue($classes))); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/DependencyInjection/ConfigurableExtension.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/DependencyInjection/ConfigurableExtension.php deleted file mode 100644 index 3ec454b..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/DependencyInjection/ConfigurableExtension.php +++ /dev/null @@ -1,45 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\DependencyInjection; - -use Symfony\Component\DependencyInjection\ContainerBuilder; - -/** - * This extension sub-class provides first-class integration with the - * Config/Definition Component. - * - * You can use this as base class if you - * - * a) use the Config/Definition component for configuration - * b) your configuration class is named "Configuration" and - * c) the configuration class resides in the DependencyInjection sub-folder - * - * @author Johannes M. Schmitt - */ -abstract class ConfigurableExtension extends Extension -{ - /** - * {@inheritdoc} - */ - final public function load(array $configs, ContainerBuilder $container) - { - $this->loadInternal($this->processConfiguration($this->getConfiguration($configs, $container), $configs), $container); - } - - /** - * Configures the passed container according to the merged configuration. - * - * @param array $mergedConfig - * @param ContainerBuilder $container - */ - abstract protected function loadInternal(array $mergedConfig, ContainerBuilder $container); -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/DependencyInjection/ContainerAwareHttpKernel.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/DependencyInjection/ContainerAwareHttpKernel.php deleted file mode 100644 index 97aa740..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/DependencyInjection/ContainerAwareHttpKernel.php +++ /dev/null @@ -1,82 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\DependencyInjection; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\RequestStack; -use Symfony\Component\HttpKernel\HttpKernelInterface; -use Symfony\Component\HttpKernel\HttpKernel; -use Symfony\Component\HttpKernel\Controller\ControllerResolverInterface; -use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Symfony\Component\DependencyInjection\ContainerInterface; -use Symfony\Component\DependencyInjection\Scope; - -/** - * Adds a managed request scope. - * - * @author Fabien Potencier - * @author Johannes M. Schmitt - * - * @deprecated since version 2.7, to be removed in 3.0. - */ -class ContainerAwareHttpKernel extends HttpKernel -{ - protected $container; - - /** - * Constructor. - * - * @param EventDispatcherInterface $dispatcher An EventDispatcherInterface instance - * @param ContainerInterface $container A ContainerInterface instance - * @param ControllerResolverInterface $controllerResolver A ControllerResolverInterface instance - * @param RequestStack $requestStack A stack for master/sub requests - * @param bool $triggerDeprecation Whether or not to trigger the deprecation warning for the ContainerAwareHttpKernel - */ - public function __construct(EventDispatcherInterface $dispatcher, ContainerInterface $container, ControllerResolverInterface $controllerResolver, RequestStack $requestStack = null, $triggerDeprecation = true) - { - parent::__construct($dispatcher, $controllerResolver, $requestStack); - - if ($triggerDeprecation) { - @trigger_error('The '.__CLASS__.' class is deprecated since version 2.7 and will be removed in 3.0. Use the Symfony\Component\HttpKernel\HttpKernel class instead.', E_USER_DEPRECATED); - } - - $this->container = $container; - - // the request scope might have been created before (see FrameworkBundle) - if (!$container->hasScope('request')) { - $container->addScope(new Scope('request')); - } - } - - /** - * {@inheritdoc} - */ - public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true) - { - $this->container->enterScope('request'); - $this->container->set('request', $request, 'request'); - - try { - $response = parent::handle($request, $type, $catch); - } catch (\Exception $e) { - $this->container->set('request', null, 'request'); - $this->container->leaveScope('request'); - - throw $e; - } - - $this->container->set('request', null, 'request'); - $this->container->leaveScope('request'); - - return $response; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/DependencyInjection/Extension.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/DependencyInjection/Extension.php deleted file mode 100644 index 2ca0f13..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/DependencyInjection/Extension.php +++ /dev/null @@ -1,44 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\DependencyInjection; - -use Symfony\Component\DependencyInjection\Extension\Extension as BaseExtension; - -/** - * Allow adding classes to the class cache. - * - * @author Fabien Potencier - */ -abstract class Extension extends BaseExtension -{ - private $classes = array(); - - /** - * Gets the classes to cache. - * - * @return array An array of classes - */ - public function getClassesToCompile() - { - return $this->classes; - } - - /** - * Adds classes to the class cache. - * - * @param array $classes An array of classes - */ - public function addClassesToCompile(array $classes) - { - $this->classes = array_merge($this->classes, $classes); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/DependencyInjection/FragmentRendererPass.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/DependencyInjection/FragmentRendererPass.php deleted file mode 100644 index dc44b2d..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/DependencyInjection/FragmentRendererPass.php +++ /dev/null @@ -1,73 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\DependencyInjection; - -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Reference; -use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; - -/** - * Adds services tagged kernel.fragment_renderer as HTTP content rendering strategies. - * - * @author Fabien Potencier - */ -class FragmentRendererPass implements CompilerPassInterface -{ - private $handlerService; - private $rendererTag; - - /** - * @param string $handlerService Service name of the fragment handler in the container - * @param string $rendererTag Tag name used for fragments - */ - public function __construct($handlerService = 'fragment.handler', $rendererTag = 'kernel.fragment_renderer') - { - $this->handlerService = $handlerService; - $this->rendererTag = $rendererTag; - } - - public function process(ContainerBuilder $container) - { - if (!$container->hasDefinition($this->handlerService)) { - return; - } - - $definition = $container->getDefinition($this->handlerService); - foreach ($container->findTaggedServiceIds($this->rendererTag) as $id => $tags) { - $def = $container->getDefinition($id); - if (!$def->isPublic()) { - throw new \InvalidArgumentException(sprintf('The service "%s" must be public as fragment renderer are lazy-loaded.', $id)); - } - - if ($def->isAbstract()) { - throw new \InvalidArgumentException(sprintf('The service "%s" must not be abstract as fragment renderer are lazy-loaded.', $id)); - } - - $refClass = new \ReflectionClass($container->getParameterBag()->resolveValue($def->getClass())); - $interface = 'Symfony\Component\HttpKernel\Fragment\FragmentRendererInterface'; - if (!$refClass->implementsInterface($interface)) { - throw new \InvalidArgumentException(sprintf('Service "%s" must implement interface "%s".', $id, $interface)); - } - - foreach ($tags as $tag) { - if (!isset($tag['alias'])) { - @trigger_error(sprintf('Service "%s" will have to define the "alias" attribute on the "%s" tag as of Symfony 3.0.', $id, $this->rendererTag), E_USER_DEPRECATED); - - // register the handler as a non-lazy-loaded one - $definition->addMethodCall('addRenderer', array(new Reference($id))); - } else { - $definition->addMethodCall('addRendererService', array($tag['alias'], $id)); - } - } - } - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/DependencyInjection/LazyLoadingFragmentHandler.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/DependencyInjection/LazyLoadingFragmentHandler.php deleted file mode 100644 index 4efe7cb..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/DependencyInjection/LazyLoadingFragmentHandler.php +++ /dev/null @@ -1,58 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\DependencyInjection; - -use Symfony\Component\DependencyInjection\ContainerInterface; -use Symfony\Component\HttpFoundation\RequestStack; -use Symfony\Component\HttpKernel\Fragment\FragmentHandler; - -/** - * Lazily loads fragment renderers from the dependency injection container. - * - * @author Fabien Potencier - */ -class LazyLoadingFragmentHandler extends FragmentHandler -{ - private $container; - private $rendererIds = array(); - - public function __construct(ContainerInterface $container, $debug = false, RequestStack $requestStack = null) - { - $this->container = $container; - - parent::__construct(array(), $debug, $requestStack); - } - - /** - * Adds a service as a fragment renderer. - * - * @param string $renderer The render service id - */ - public function addRendererService($name, $renderer) - { - $this->rendererIds[$name] = $renderer; - } - - /** - * {@inheritdoc} - */ - public function render($uri, $renderer = 'inline', array $options = array()) - { - if (isset($this->rendererIds[$renderer])) { - $this->addRenderer($this->container->get($this->rendererIds[$renderer])); - - unset($this->rendererIds[$renderer]); - } - - return parent::render($uri, $renderer, $options); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/DependencyInjection/MergeExtensionConfigurationPass.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/DependencyInjection/MergeExtensionConfigurationPass.php deleted file mode 100644 index dcd7382..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/DependencyInjection/MergeExtensionConfigurationPass.php +++ /dev/null @@ -1,41 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\DependencyInjection; - -use Symfony\Component\DependencyInjection\Compiler\MergeExtensionConfigurationPass as BaseMergeExtensionConfigurationPass; -use Symfony\Component\DependencyInjection\ContainerBuilder; - -/** - * Ensures certain extensions are always loaded. - * - * @author Kris Wallsmith - */ -class MergeExtensionConfigurationPass extends BaseMergeExtensionConfigurationPass -{ - private $extensions; - - public function __construct(array $extensions) - { - $this->extensions = $extensions; - } - - public function process(ContainerBuilder $container) - { - foreach ($this->extensions as $extension) { - if (!count($container->getExtensionConfig($extension))) { - $container->loadFromExtension($extension, array()); - } - } - - parent::process($container); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/DependencyInjection/RegisterListenersPass.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/DependencyInjection/RegisterListenersPass.php deleted file mode 100644 index f1c2247..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/DependencyInjection/RegisterListenersPass.php +++ /dev/null @@ -1,25 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\DependencyInjection; - -@trigger_error('The '.__NAMESPACE__.'\RegisterListenersPass is deprecated since version 2.5 and will be removed in 3.0. Use the Symfony\Component\EventDispatcher\DependencyInjection\RegisterListenersPass class instead.', E_USER_DEPRECATED); - -use Symfony\Component\EventDispatcher\DependencyInjection\RegisterListenersPass as BaseRegisterListenersPass; - -/** - * Compiler pass to register tagged services for an event dispatcher. - * - * @deprecated since version 2.5, to be removed in 3.0. Use the Symfony\Component\EventDispatcher\DependencyInjection\RegisterListenersPass class instead. - */ -class RegisterListenersPass extends BaseRegisterListenersPass -{ -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Event/FilterControllerEvent.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/Event/FilterControllerEvent.php deleted file mode 100644 index e33a011..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Event/FilterControllerEvent.php +++ /dev/null @@ -1,110 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Event; - -use Symfony\Component\HttpKernel\HttpKernelInterface; -use Symfony\Component\HttpFoundation\Request; - -/** - * Allows filtering of a controller callable. - * - * You can call getController() to retrieve the current controller. With - * setController() you can set a new controller that is used in the processing - * of the request. - * - * Controllers should be callables. - * - * @author Bernhard Schussek - * - * @api - */ -class FilterControllerEvent extends KernelEvent -{ - /** - * The current controller. - * - * @var callable - */ - private $controller; - - public function __construct(HttpKernelInterface $kernel, $controller, Request $request, $requestType) - { - parent::__construct($kernel, $request, $requestType); - - $this->setController($controller); - } - - /** - * Returns the current controller. - * - * @return callable - * - * @api - */ - public function getController() - { - return $this->controller; - } - - /** - * Sets a new controller. - * - * @param callable $controller - * - * @throws \LogicException - * - * @api - */ - public function setController($controller) - { - // controller must be a callable - if (!is_callable($controller)) { - throw new \LogicException(sprintf('The controller must be a callable (%s given).', $this->varToString($controller))); - } - - $this->controller = $controller; - } - - private function varToString($var) - { - if (is_object($var)) { - return sprintf('Object(%s)', get_class($var)); - } - - if (is_array($var)) { - $a = array(); - foreach ($var as $k => $v) { - $a[] = sprintf('%s => %s', $k, $this->varToString($v)); - } - - return sprintf('Array(%s)', implode(', ', $a)); - } - - if (is_resource($var)) { - return sprintf('Resource(%s)', get_resource_type($var)); - } - - if (null === $var) { - return 'null'; - } - - if (false === $var) { - return 'false'; - } - - if (true === $var) { - return 'true'; - } - - return (string) $var; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Event/FilterResponseEvent.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/Event/FilterResponseEvent.php deleted file mode 100644 index fd88f87..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Event/FilterResponseEvent.php +++ /dev/null @@ -1,68 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Event; - -use Symfony\Component\HttpKernel\HttpKernelInterface; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; - -/** - * Allows to filter a Response object. - * - * You can call getResponse() to retrieve the current response. With - * setResponse() you can set a new response that will be returned to the - * browser. - * - * @author Bernhard Schussek - * - * @api - */ -class FilterResponseEvent extends KernelEvent -{ - /** - * The current response object. - * - * @var Response - */ - private $response; - - public function __construct(HttpKernelInterface $kernel, Request $request, $requestType, Response $response) - { - parent::__construct($kernel, $request, $requestType); - - $this->setResponse($response); - } - - /** - * Returns the current response object. - * - * @return Response - * - * @api - */ - public function getResponse() - { - return $this->response; - } - - /** - * Sets a new response object. - * - * @param Response $response - * - * @api - */ - public function setResponse(Response $response) - { - $this->response = $response; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Event/FinishRequestEvent.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/Event/FinishRequestEvent.php deleted file mode 100644 index ee72484..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Event/FinishRequestEvent.php +++ /dev/null @@ -1,21 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Event; - -/** - * Triggered whenever a request is fully processed. - * - * @author Benjamin Eberlei - */ -class FinishRequestEvent extends KernelEvent -{ -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Event/GetResponseEvent.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/Event/GetResponseEvent.php deleted file mode 100644 index b9310fa..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Event/GetResponseEvent.php +++ /dev/null @@ -1,73 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Event; - -use Symfony\Component\HttpFoundation\Response; - -/** - * Allows to create a response for a request. - * - * Call setResponse() to set the response that will be returned for the - * current request. The propagation of this event is stopped as soon as a - * response is set. - * - * @author Bernhard Schussek - * - * @api - */ -class GetResponseEvent extends KernelEvent -{ - /** - * The response object. - * - * @var Response - */ - private $response; - - /** - * Returns the response object. - * - * @return Response - * - * @api - */ - public function getResponse() - { - return $this->response; - } - - /** - * Sets a response and stops event propagation. - * - * @param Response $response - * - * @api - */ - public function setResponse(Response $response) - { - $this->response = $response; - - $this->stopPropagation(); - } - - /** - * Returns whether a response was set. - * - * @return bool Whether a response was set - * - * @api - */ - public function hasResponse() - { - return null !== $this->response; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Event/GetResponseForControllerResultEvent.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/Event/GetResponseForControllerResultEvent.php deleted file mode 100644 index afb1c45..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Event/GetResponseForControllerResultEvent.php +++ /dev/null @@ -1,67 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Event; - -use Symfony\Component\HttpKernel\HttpKernelInterface; -use Symfony\Component\HttpFoundation\Request; - -/** - * Allows to create a response for the return value of a controller. - * - * Call setResponse() to set the response that will be returned for the - * current request. The propagation of this event is stopped as soon as a - * response is set. - * - * @author Bernhard Schussek - * - * @api - */ -class GetResponseForControllerResultEvent extends GetResponseEvent -{ - /** - * The return value of the controller. - * - * @var mixed - */ - private $controllerResult; - - public function __construct(HttpKernelInterface $kernel, Request $request, $requestType, $controllerResult) - { - parent::__construct($kernel, $request, $requestType); - - $this->controllerResult = $controllerResult; - } - - /** - * Returns the return value of the controller. - * - * @return mixed The controller return value - * - * @api - */ - public function getControllerResult() - { - return $this->controllerResult; - } - - /** - * Assigns the return value of the controller. - * - * @param mixed $controllerResult The controller return value - * - * @api - */ - public function setControllerResult($controllerResult) - { - $this->controllerResult = $controllerResult; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Event/GetResponseForExceptionEvent.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/Event/GetResponseForExceptionEvent.php deleted file mode 100644 index 3b5957e..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Event/GetResponseForExceptionEvent.php +++ /dev/null @@ -1,73 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Event; - -use Symfony\Component\HttpKernel\HttpKernelInterface; -use Symfony\Component\HttpFoundation\Request; - -/** - * Allows to create a response for a thrown exception. - * - * Call setResponse() to set the response that will be returned for the - * current request. The propagation of this event is stopped as soon as a - * response is set. - * - * You can also call setException() to replace the thrown exception. This - * exception will be thrown if no response is set during processing of this - * event. - * - * @author Bernhard Schussek - * - * @api - */ -class GetResponseForExceptionEvent extends GetResponseEvent -{ - /** - * The exception object. - * - * @var \Exception - */ - private $exception; - - public function __construct(HttpKernelInterface $kernel, Request $request, $requestType, \Exception $e) - { - parent::__construct($kernel, $request, $requestType); - - $this->setException($e); - } - - /** - * Returns the thrown exception. - * - * @return \Exception The thrown exception - * - * @api - */ - public function getException() - { - return $this->exception; - } - - /** - * Replaces the thrown exception. - * - * This exception will be thrown if no response is set in the event. - * - * @param \Exception $exception The thrown exception - * - * @api - */ - public function setException(\Exception $exception) - { - $this->exception = $exception; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Event/KernelEvent.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/Event/KernelEvent.php deleted file mode 100644 index 1d97ead..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Event/KernelEvent.php +++ /dev/null @@ -1,104 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Event; - -use Symfony\Component\HttpKernel\HttpKernelInterface; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\EventDispatcher\Event; - -/** - * Base class for events thrown in the HttpKernel component. - * - * @author Bernhard Schussek - * - * @api - */ -class KernelEvent extends Event -{ - /** - * The kernel in which this event was thrown. - * - * @var HttpKernelInterface - */ - private $kernel; - - /** - * The request the kernel is currently processing. - * - * @var Request - */ - private $request; - - /** - * The request type the kernel is currently processing. One of - * HttpKernelInterface::MASTER_REQUEST and HttpKernelInterface::SUB_REQUEST. - * - * @var int - */ - private $requestType; - - public function __construct(HttpKernelInterface $kernel, Request $request, $requestType) - { - $this->kernel = $kernel; - $this->request = $request; - $this->requestType = $requestType; - } - - /** - * Returns the kernel in which this event was thrown. - * - * @return HttpKernelInterface - * - * @api - */ - public function getKernel() - { - return $this->kernel; - } - - /** - * Returns the request the kernel is currently processing. - * - * @return Request - * - * @api - */ - public function getRequest() - { - return $this->request; - } - - /** - * Returns the request type the kernel is currently processing. - * - * @return int One of HttpKernelInterface::MASTER_REQUEST and - * HttpKernelInterface::SUB_REQUEST - * - * @api - */ - public function getRequestType() - { - return $this->requestType; - } - - /** - * Checks if this is a master request. - * - * @return bool True if the request is a master request - * - * @api - */ - public function isMasterRequest() - { - return HttpKernelInterface::MASTER_REQUEST === $this->requestType; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Event/PostResponseEvent.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/Event/PostResponseEvent.php deleted file mode 100644 index 5d4450b..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Event/PostResponseEvent.php +++ /dev/null @@ -1,73 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Event; - -use Symfony\Component\HttpKernel\HttpKernelInterface; -use Symfony\Component\EventDispatcher\Event; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; - -/** - * Allows to execute logic after a response was sent. - * - * @author Jordi Boggiano - */ -class PostResponseEvent extends Event -{ - /** - * The kernel in which this event was thrown. - * - * @var HttpKernelInterface - */ - private $kernel; - - private $request; - - private $response; - - public function __construct(HttpKernelInterface $kernel, Request $request, Response $response) - { - $this->kernel = $kernel; - $this->request = $request; - $this->response = $response; - } - - /** - * Returns the kernel in which this event was thrown. - * - * @return HttpKernelInterface - */ - public function getKernel() - { - return $this->kernel; - } - - /** - * Returns the request for which this event was thrown. - * - * @return Request - */ - public function getRequest() - { - return $this->request; - } - - /** - * Returns the response for which this event was thrown. - * - * @return Response - */ - public function getResponse() - { - return $this->response; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/EventListener/AddRequestFormatsListener.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/EventListener/AddRequestFormatsListener.php deleted file mode 100644 index c37a537..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/EventListener/AddRequestFormatsListener.php +++ /dev/null @@ -1,57 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\EventListener; - -use Symfony\Component\EventDispatcher\EventSubscriberInterface; -use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\HttpKernel\Event\GetResponseEvent; - -/** - * Adds configured formats to each request - * - * @author Gildas Quemener - */ -class AddRequestFormatsListener implements EventSubscriberInterface -{ - /** - * @var array - */ - protected $formats; - - /** - * @param array $formats - */ - public function __construct(array $formats) - { - $this->formats = $formats; - } - - /** - * Adds request formats - * - * @param GetResponseEvent $event - */ - public function onKernelRequest(GetResponseEvent $event) - { - foreach ($this->formats as $format => $mimeTypes) { - $event->getRequest()->setFormat($format, $mimeTypes); - } - } - - /** - * {@inheritdoc} - */ - public static function getSubscribedEvents() - { - return array(KernelEvents::REQUEST => 'onKernelRequest'); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/EventListener/DebugHandlersListener.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/EventListener/DebugHandlersListener.php deleted file mode 100644 index f50e4d6..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/EventListener/DebugHandlersListener.php +++ /dev/null @@ -1,136 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\EventListener; - -use Psr\Log\LoggerInterface; -use Symfony\Component\Debug\ErrorHandler; -use Symfony\Component\Debug\ExceptionHandler; -use Symfony\Component\EventDispatcher\Event; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; -use Symfony\Component\HttpKernel\Event\KernelEvent; -use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\Console\ConsoleEvents; -use Symfony\Component\Console\Event\ConsoleEvent; -use Symfony\Component\Console\Output\ConsoleOutputInterface; - -/** - * Configures errors and exceptions handlers. - * - * @author Nicolas Grekas - */ -class DebugHandlersListener implements EventSubscriberInterface -{ - private $exceptionHandler; - private $logger; - private $levels; - private $throwAt; - private $scream; - private $fileLinkFormat; - private $firstCall = true; - - /** - * @param callable|null $exceptionHandler A handler that will be called on Exception - * @param LoggerInterface|null $logger A PSR-3 logger - * @param array|int $levels An array map of E_* to LogLevel::* or an integer bit field of E_* constants - * @param int|null $throwAt Thrown errors in a bit field of E_* constants, or null to keep the current value - * @param bool $scream Enables/disables screaming mode, where even silenced errors are logged - * @param string $fileLinkFormat The format for links to source files - */ - public function __construct($exceptionHandler, LoggerInterface $logger = null, $levels = null, $throwAt = -1, $scream = true, $fileLinkFormat = null) - { - $this->exceptionHandler = $exceptionHandler; - $this->logger = $logger; - $this->levels = $levels; - $this->throwAt = is_numeric($throwAt) ? (int) $throwAt : (null === $throwAt ? null : ($throwAt ? -1 : null)); - $this->scream = (bool) $scream; - $this->fileLinkFormat = $fileLinkFormat ?: ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format'); - } - - /** - * Configures the error handler. - * - * @param Event|null $event The triggering event - */ - public function configure(Event $event = null) - { - if (!$this->firstCall) { - return; - } - $this->firstCall = false; - if ($this->logger || null !== $this->throwAt) { - $handler = set_error_handler('var_dump', 0); - $handler = is_array($handler) ? $handler[0] : null; - restore_error_handler(); - if ($handler instanceof ErrorHandler) { - if ($this->logger) { - $handler->setDefaultLogger($this->logger, $this->levels); - if (is_array($this->levels)) { - $scream = 0; - foreach ($this->levels as $type => $log) { - $scream |= $type; - } - } else { - $scream = null === $this->levels ? E_ALL | E_STRICT : $this->levels; - } - if ($this->scream) { - $handler->screamAt($scream); - } - $this->logger = $this->levels = null; - } - if (null !== $this->throwAt) { - $handler->throwAt($this->throwAt, true); - } - } - } - if (!$this->exceptionHandler) { - if ($event instanceof KernelEvent) { - $this->exceptionHandler = array($event->getKernel(), 'terminateWithException'); - } elseif ($event instanceof ConsoleEvent && $app = $event->getCommand()->getApplication()) { - $output = $event->getOutput(); - if ($output instanceof ConsoleOutputInterface) { - $output = $output->getErrorOutput(); - } - $this->exceptionHandler = function ($e) use ($app, $output) { - $app->renderException($e, $output); - }; - } - } - if ($this->exceptionHandler) { - $handler = set_exception_handler('var_dump'); - $handler = is_array($handler) ? $handler[0] : null; - restore_exception_handler(); - if ($handler instanceof ErrorHandler) { - $h = $handler->setExceptionHandler('var_dump') ?: $this->exceptionHandler; - $handler->setExceptionHandler($h); - $handler = is_array($h) ? $h[0] : null; - } - if ($handler instanceof ExceptionHandler) { - $handler->setHandler($this->exceptionHandler); - if (null !== $this->fileLinkFormat) { - $handler->setFileLinkFormat($this->fileLinkFormat); - } - } - $this->exceptionHandler = null; - } - } - - public static function getSubscribedEvents() - { - $events = array(KernelEvents::REQUEST => array('configure', 2048)); - - if (defined('Symfony\Component\Console\ConsoleEvents::COMMAND')) { - $events[ConsoleEvents::COMMAND] = array('configure', 2048); - } - - return $events; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/EventListener/DumpListener.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/EventListener/DumpListener.php deleted file mode 100644 index bccde8e..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/EventListener/DumpListener.php +++ /dev/null @@ -1,55 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\EventListener; - -use Symfony\Component\EventDispatcher\EventSubscriberInterface; -use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\VarDumper\Cloner\ClonerInterface; -use Symfony\Component\VarDumper\Dumper\DataDumperInterface; -use Symfony\Component\VarDumper\VarDumper; - -/** - * Configures dump() handler. - * - * @author Nicolas Grekas - */ -class DumpListener implements EventSubscriberInterface -{ - private $cloner; - private $dumper; - - /** - * @param ClonerInterface $cloner Cloner service. - * @param DataDumperInterface $dumper Dumper service. - */ - public function __construct(ClonerInterface $cloner, DataDumperInterface $dumper) - { - $this->cloner = $cloner; - $this->dumper = $dumper; - } - - public function configure() - { - $cloner = $this->cloner; - $dumper = $this->dumper; - - VarDumper::setHandler(function ($var) use ($cloner, $dumper) { - $dumper->dump($cloner->cloneVar($var)); - }); - } - - public static function getSubscribedEvents() - { - // Register early to have a working dump() as early as possible - return array(KernelEvents::REQUEST => array('configure', 1024)); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/EventListener/ErrorsLoggerListener.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/EventListener/ErrorsLoggerListener.php deleted file mode 100644 index 80c3fe5..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/EventListener/ErrorsLoggerListener.php +++ /dev/null @@ -1,52 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\EventListener; - -@trigger_error('The '.__NAMESPACE__.'\ErrorsLoggerListener class is deprecated since version 2.6 and will be removed in 3.0. Use the Symfony\Component\HttpKernel\EventListener\DebugHandlersListener class instead.', E_USER_DEPRECATED); - -use Psr\Log\LoggerInterface; -use Symfony\Component\Debug\ErrorHandler; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; -use Symfony\Component\HttpKernel\KernelEvents; - -/** - * Injects the logger into the ErrorHandler, so that it can log various errors. - * - * @author Colin Frei - * @author Konstantin Myakshin - * - * @deprecated since version 2.6, to be removed in 3.0. Use the DebugHandlersListener class instead. - */ -class ErrorsLoggerListener implements EventSubscriberInterface -{ - private $channel; - private $logger; - - public function __construct($channel, LoggerInterface $logger = null) - { - $this->channel = $channel; - $this->logger = $logger; - } - - public function injectLogger() - { - if (null !== $this->logger) { - ErrorHandler::setLogger($this->logger, $this->channel); - $this->logger = null; - } - } - - public static function getSubscribedEvents() - { - return array(KernelEvents::REQUEST => array('injectLogger', 2048)); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/EventListener/EsiListener.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/EventListener/EsiListener.php deleted file mode 100644 index bceb672..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/EventListener/EsiListener.php +++ /dev/null @@ -1,25 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\EventListener; - -@trigger_error('The '.__NAMESPACE__.'\EsiListener class is deprecated since version 2.6 and will be removed in 3.0. Use the Symfony\Component\HttpKernel\EventListener\SurrogateListener class instead.', E_USER_DEPRECATED); - -/** - * EsiListener adds a Surrogate-Control HTTP header when the Response needs to be parsed for ESI. - * - * @author Fabien Potencier - * - * @deprecated since version 2.6, to be removed in 3.0. Use SurrogateListener instead - */ -class EsiListener extends SurrogateListener -{ -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/EventListener/ExceptionListener.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/EventListener/ExceptionListener.php deleted file mode 100644 index fc2efed..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/EventListener/ExceptionListener.php +++ /dev/null @@ -1,120 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\EventListener; - -use Psr\Log\LoggerInterface; -use Symfony\Component\Debug\Exception\FlattenException; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpKernel\Log\DebugLoggerInterface; -use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; -use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\HttpKernel\HttpKernelInterface; -use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; - -/** - * ExceptionListener. - * - * @author Fabien Potencier - */ -class ExceptionListener implements EventSubscriberInterface -{ - protected $controller; - protected $logger; - - public function __construct($controller, LoggerInterface $logger = null) - { - $this->controller = $controller; - $this->logger = $logger; - } - - public function onKernelException(GetResponseForExceptionEvent $event) - { - $exception = $event->getException(); - $request = $event->getRequest(); - - $this->logException($exception, sprintf('Uncaught PHP Exception %s: "%s" at %s line %s', get_class($exception), $exception->getMessage(), $exception->getFile(), $exception->getLine())); - - $request = $this->duplicateRequest($exception, $request); - - try { - $response = $event->getKernel()->handle($request, HttpKernelInterface::SUB_REQUEST, false); - } catch (\Exception $e) { - $this->logException($e, sprintf('Exception thrown when handling an exception (%s: %s at %s line %s)', get_class($e), $e->getMessage(), $e->getFile(), $e->getLine()), false); - - $wrapper = $e; - - while ($prev = $wrapper->getPrevious()) { - if ($exception === $wrapper = $prev) { - throw $e; - } - } - - $prev = new \ReflectionProperty('Exception', 'previous'); - $prev->setAccessible(true); - $prev->setValue($wrapper, $exception); - - throw $e; - } - - $event->setResponse($response); - } - - public static function getSubscribedEvents() - { - return array( - KernelEvents::EXCEPTION => array('onKernelException', -128), - ); - } - - /** - * Logs an exception. - * - * @param \Exception $exception The \Exception instance - * @param string $message The error message to log - */ - protected function logException(\Exception $exception, $message) - { - if (null !== $this->logger) { - if (!$exception instanceof HttpExceptionInterface || $exception->getStatusCode() >= 500) { - $this->logger->critical($message, array('exception' => $exception)); - } else { - $this->logger->error($message, array('exception' => $exception)); - } - } - } - - /** - * Clones the request for the exception. - * - * @param \Exception $exception The thrown exception. - * @param Request $request The original request. - * - * @return Request $request The cloned request. - */ - protected function duplicateRequest(\Exception $exception, Request $request) - { - $attributes = array( - '_controller' => $this->controller, - 'exception' => FlattenException::create($exception), - 'logger' => $this->logger instanceof DebugLoggerInterface ? $this->logger : null, - // keep for BC -- as $format can be an argument of the controller callable - // see src/Symfony/Bundle/TwigBundle/Controller/ExceptionController.php - // @deprecated since version 2.4, to be removed in 3.0 - 'format' => $request->getRequestFormat(), - ); - $request = $request->duplicate(null, null, $attributes); - $request->setMethod('GET'); - - return $request; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/EventListener/FragmentListener.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/EventListener/FragmentListener.php deleted file mode 100644 index 302faa1..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/EventListener/FragmentListener.php +++ /dev/null @@ -1,108 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\EventListener; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpKernel\Event\GetResponseEvent; -use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; -use Symfony\Component\HttpKernel\UriSigner; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; - -/** - * Handles content fragments represented by special URIs. - * - * All URL paths starting with /_fragment are handled as - * content fragments by this listener. - * - * If throws an AccessDeniedHttpException exception if the request - * is not signed or if it is not an internal sub-request. - * - * @author Fabien Potencier - */ -class FragmentListener implements EventSubscriberInterface -{ - private $signer; - private $fragmentPath; - - /** - * Constructor. - * - * @param UriSigner $signer A UriSigner instance - * @param string $fragmentPath The path that triggers this listener - */ - public function __construct(UriSigner $signer, $fragmentPath = '/_fragment') - { - $this->signer = $signer; - $this->fragmentPath = $fragmentPath; - } - - /** - * Fixes request attributes when the path is '/_fragment'. - * - * @param GetResponseEvent $event A GetResponseEvent instance - * - * @throws AccessDeniedHttpException if the request does not come from a trusted IP. - */ - public function onKernelRequest(GetResponseEvent $event) - { - $request = $event->getRequest(); - - if ($request->attributes->has('_controller') || $this->fragmentPath !== rawurldecode($request->getPathInfo())) { - return; - } - - if ($event->isMasterRequest()) { - $this->validateRequest($request); - } - - parse_str($request->query->get('_path', ''), $attributes); - $request->attributes->add($attributes); - $request->attributes->set('_route_params', array_replace($request->attributes->get('_route_params', array()), $attributes)); - $request->query->remove('_path'); - } - - protected function validateRequest(Request $request) - { - // is the Request safe? - if (!$request->isMethodSafe()) { - throw new AccessDeniedHttpException(); - } - - // is the Request signed? - // we cannot use $request->getUri() here as we want to work with the original URI (no query string reordering) - if ($this->signer->check($request->getSchemeAndHttpHost().$request->getBaseUrl().$request->getPathInfo().(null !== ($qs = $request->server->get('QUERY_STRING')) ? '?'.$qs : ''))) { - return; - } - - throw new AccessDeniedHttpException(); - } - - /** - * @deprecated since version 2.3.19, to be removed in 3.0. - * - * @return string[] - */ - protected function getLocalIpAddresses() - { - @trigger_error('The '.__METHOD__.' method is deprecated since version 2.3.19 and will be removed in 3.0.', E_USER_DEPRECATED); - - return array('127.0.0.1', 'fe80::1', '::1'); - } - - public static function getSubscribedEvents() - { - return array( - KernelEvents::REQUEST => array(array('onKernelRequest', 48)), - ); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/EventListener/LocaleListener.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/EventListener/LocaleListener.php deleted file mode 100644 index 564f6dc..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/EventListener/LocaleListener.php +++ /dev/null @@ -1,113 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\EventListener; - -use Symfony\Component\HttpKernel\Event\GetResponseEvent; -use Symfony\Component\HttpKernel\Event\FinishRequestEvent; -use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\HttpFoundation\RequestStack; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\Routing\RequestContextAwareInterface; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; - -/** - * Initializes the locale based on the current request. - * - * This listener works in 2 modes: - * - * * 2.3 compatibility mode where you must call setRequest whenever the Request changes. - * * 2.4+ mode where you must pass a RequestStack instance in the constructor. - * - * @author Fabien Potencier - */ -class LocaleListener implements EventSubscriberInterface -{ - private $router; - private $defaultLocale; - private $requestStack; - - /** - * RequestStack will become required in 3.0. - */ - public function __construct($defaultLocale = 'en', RequestContextAwareInterface $router = null, RequestStack $requestStack = null) - { - $this->defaultLocale = $defaultLocale; - $this->requestStack = $requestStack; - $this->router = $router; - } - - /** - * Sets the current Request. - * - * This method was used to synchronize the Request, but as the HttpKernel - * is doing that automatically now, you should never call it directly. - * It is kept public for BC with the 2.3 version. - * - * @param Request|null $request A Request instance - * - * @deprecated since version 2.4, to be removed in 3.0. - */ - public function setRequest(Request $request = null) - { - @trigger_error('The '.__METHOD__.' method is deprecated since version 2.4 and will be removed in 3.0.', E_USER_DEPRECATED); - - if (null === $request) { - return; - } - - $this->setLocale($request); - $this->setRouterContext($request); - } - - public function onKernelRequest(GetResponseEvent $event) - { - $request = $event->getRequest(); - $request->setDefaultLocale($this->defaultLocale); - - $this->setLocale($request); - $this->setRouterContext($request); - } - - public function onKernelFinishRequest(FinishRequestEvent $event) - { - if (null === $this->requestStack) { - return; // removed when requestStack is required - } - - if (null !== $parentRequest = $this->requestStack->getParentRequest()) { - $this->setRouterContext($parentRequest); - } - } - - private function setLocale(Request $request) - { - if ($locale = $request->attributes->get('_locale')) { - $request->setLocale($locale); - } - } - - private function setRouterContext(Request $request) - { - if (null !== $this->router) { - $this->router->getContext()->setParameter('_locale', $request->getLocale()); - } - } - - public static function getSubscribedEvents() - { - return array( - // must be registered after the Router to have access to the _locale - KernelEvents::REQUEST => array(array('onKernelRequest', 16)), - KernelEvents::FINISH_REQUEST => array(array('onKernelFinishRequest', 0)), - ); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/EventListener/ProfilerListener.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/EventListener/ProfilerListener.php deleted file mode 100644 index 06a5bbf..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/EventListener/ProfilerListener.php +++ /dev/null @@ -1,165 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\EventListener; - -use Symfony\Component\HttpKernel\Event\GetResponseEvent; -use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; -use Symfony\Component\HttpKernel\Event\FilterResponseEvent; -use Symfony\Component\HttpKernel\Event\PostResponseEvent; -use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\HttpKernel\Profiler\Profiler; -use Symfony\Component\HttpFoundation\RequestMatcherInterface; -use Symfony\Component\HttpFoundation\RequestStack; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; - -/** - * ProfilerListener collects data for the current request by listening to the kernel events. - * - * @author Fabien Potencier - */ -class ProfilerListener implements EventSubscriberInterface -{ - protected $profiler; - protected $matcher; - protected $onlyException; - protected $onlyMasterRequests; - protected $exception; - protected $requests = array(); - protected $profiles; - protected $requestStack; - protected $parents; - - /** - * Constructor. - * - * @param Profiler $profiler A Profiler instance - * @param RequestMatcherInterface|null $matcher A RequestMatcher instance - * @param bool $onlyException true if the profiler only collects data when an exception occurs, false otherwise - * @param bool $onlyMasterRequests true if the profiler only collects data when the request is a master request, false otherwise - * @param RequestStack|null $requestStack A RequestStack instance - */ - public function __construct(Profiler $profiler, RequestMatcherInterface $matcher = null, $onlyException = false, $onlyMasterRequests = false, RequestStack $requestStack = null) - { - if (null === $requestStack) { - // Prevent the deprecation notice to be triggered all the time. - // The onKernelRequest() method fires some logic only when the - // RequestStack instance is not provided as a dependency. - @trigger_error('Since version 2.4, the '.__METHOD__.' method must accept a RequestStack instance to get the request instead of using the '.__CLASS__.'::onKernelRequest method that will be removed in 3.0.', E_USER_DEPRECATED); - } - - $this->profiler = $profiler; - $this->matcher = $matcher; - $this->onlyException = (bool) $onlyException; - $this->onlyMasterRequests = (bool) $onlyMasterRequests; - $this->profiles = new \SplObjectStorage(); - $this->parents = new \SplObjectStorage(); - $this->requestStack = $requestStack; - } - - /** - * Handles the onKernelException event. - * - * @param GetResponseForExceptionEvent $event A GetResponseForExceptionEvent instance - */ - public function onKernelException(GetResponseForExceptionEvent $event) - { - if ($this->onlyMasterRequests && !$event->isMasterRequest()) { - return; - } - - $this->exception = $event->getException(); - } - - /** - * @deprecated since version 2.4, to be removed in 3.0. - */ - public function onKernelRequest(GetResponseEvent $event) - { - if (null === $this->requestStack) { - $this->requests[] = $event->getRequest(); - } - } - - /** - * Handles the onKernelResponse event. - * - * @param FilterResponseEvent $event A FilterResponseEvent instance - */ - public function onKernelResponse(FilterResponseEvent $event) - { - $master = $event->isMasterRequest(); - if ($this->onlyMasterRequests && !$master) { - return; - } - - if ($this->onlyException && null === $this->exception) { - return; - } - - $request = $event->getRequest(); - $exception = $this->exception; - $this->exception = null; - - if (null !== $this->matcher && !$this->matcher->matches($request)) { - return; - } - - if (!$profile = $this->profiler->collect($request, $event->getResponse(), $exception)) { - return; - } - - $this->profiles[$request] = $profile; - - if (null !== $this->requestStack) { - $this->parents[$request] = $this->requestStack->getParentRequest(); - } elseif (!$master) { - // to be removed when requestStack is required - array_pop($this->requests); - - $this->parents[$request] = end($this->requests); - } - } - - public function onKernelTerminate(PostResponseEvent $event) - { - // attach children to parents - foreach ($this->profiles as $request) { - // isset call should be removed when requestStack is required - if (isset($this->parents[$request]) && null !== $parentRequest = $this->parents[$request]) { - if (isset($this->profiles[$parentRequest])) { - $this->profiles[$parentRequest]->addChild($this->profiles[$request]); - } - } - } - - // save profiles - foreach ($this->profiles as $request) { - $this->profiler->saveProfile($this->profiles[$request]); - } - - $this->profiles = new \SplObjectStorage(); - $this->parents = new \SplObjectStorage(); - $this->requests = array(); - } - - public static function getSubscribedEvents() - { - return array( - // kernel.request must be registered as early as possible to not break - // when an exception is thrown in any other kernel.request listener - KernelEvents::REQUEST => array('onKernelRequest', 1024), - KernelEvents::RESPONSE => array('onKernelResponse', -100), - KernelEvents::EXCEPTION => 'onKernelException', - KernelEvents::TERMINATE => array('onKernelTerminate', -1024), - ); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/EventListener/ResponseListener.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/EventListener/ResponseListener.php deleted file mode 100644 index eeb2b0f..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/EventListener/ResponseListener.php +++ /dev/null @@ -1,58 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\EventListener; - -use Symfony\Component\HttpKernel\Event\FilterResponseEvent; -use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; - -/** - * ResponseListener fixes the Response headers based on the Request. - * - * @author Fabien Potencier - */ -class ResponseListener implements EventSubscriberInterface -{ - private $charset; - - public function __construct($charset) - { - $this->charset = $charset; - } - - /** - * Filters the Response. - * - * @param FilterResponseEvent $event A FilterResponseEvent instance - */ - public function onKernelResponse(FilterResponseEvent $event) - { - if (!$event->isMasterRequest()) { - return; - } - - $response = $event->getResponse(); - - if (null === $response->getCharset()) { - $response->setCharset($this->charset); - } - - $response->prepare($event->getRequest()); - } - - public static function getSubscribedEvents() - { - return array( - KernelEvents::RESPONSE => 'onKernelResponse', - ); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/EventListener/RouterListener.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/EventListener/RouterListener.php deleted file mode 100644 index 00dc60c..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/EventListener/RouterListener.php +++ /dev/null @@ -1,174 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\EventListener; - -use Psr\Log\LoggerInterface; -use Symfony\Component\HttpKernel\Event\GetResponseEvent; -use Symfony\Component\HttpKernel\Event\FinishRequestEvent; -use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException; -use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; -use Symfony\Component\HttpFoundation\RequestStack; -use Symfony\Component\Routing\Exception\MethodNotAllowedException; -use Symfony\Component\Routing\Exception\ResourceNotFoundException; -use Symfony\Component\Routing\Matcher\UrlMatcherInterface; -use Symfony\Component\Routing\Matcher\RequestMatcherInterface; -use Symfony\Component\Routing\RequestContext; -use Symfony\Component\Routing\RequestContextAwareInterface; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; -use Symfony\Component\HttpFoundation\Request; - -/** - * Initializes the context from the request and sets request attributes based on a matching route. - * - * This listener works in 2 modes: - * - * * 2.3 compatibility mode where you must call setRequest whenever the Request changes. - * * 2.4+ mode where you must pass a RequestStack instance in the constructor. - * - * @author Fabien Potencier - */ -class RouterListener implements EventSubscriberInterface -{ - private $matcher; - private $context; - private $logger; - private $request; - private $requestStack; - - /** - * Constructor. - * - * RequestStack will become required in 3.0. - * - * @param UrlMatcherInterface|RequestMatcherInterface $matcher The Url or Request matcher - * @param RequestContext|null $context The RequestContext (can be null when $matcher implements RequestContextAwareInterface) - * @param LoggerInterface|null $logger The logger - * @param RequestStack|null $requestStack A RequestStack instance - * - * @throws \InvalidArgumentException - */ - public function __construct($matcher, RequestContext $context = null, LoggerInterface $logger = null, RequestStack $requestStack = null) - { - if (!$matcher instanceof UrlMatcherInterface && !$matcher instanceof RequestMatcherInterface) { - throw new \InvalidArgumentException('Matcher must either implement UrlMatcherInterface or RequestMatcherInterface.'); - } - - if (null === $context && !$matcher instanceof RequestContextAwareInterface) { - throw new \InvalidArgumentException('You must either pass a RequestContext or the matcher must implement RequestContextAwareInterface.'); - } - - if (!$requestStack instanceof RequestStack) { - @trigger_error('The '.__METHOD__.' method now requires a RequestStack instance as '.__CLASS__.'::setRequest method will not be supported anymore in 3.0.', E_USER_DEPRECATED); - } - - $this->matcher = $matcher; - $this->context = $context ?: $matcher->getContext(); - $this->requestStack = $requestStack; - $this->logger = $logger; - } - - /** - * Sets the current Request. - * - * This method was used to synchronize the Request, but as the HttpKernel - * is doing that automatically now, you should never call it directly. - * It is kept public for BC with the 2.3 version. - * - * @param Request|null $request A Request instance - * - * @deprecated since version 2.4, to be removed in 3.0. - */ - public function setRequest(Request $request = null) - { - @trigger_error('The '.__METHOD__.' method is deprecated since version 2.4 and will be made private in 3.0.', E_USER_DEPRECATED); - - $this->setCurrentRequest($request); - } - - private function setCurrentRequest(Request $request = null) - { - if (null !== $request && $this->request !== $request) { - $this->context->fromRequest($request); - } - - $this->request = $request; - } - - public function onKernelFinishRequest(FinishRequestEvent $event) - { - if (null === $this->requestStack) { - return; // removed when requestStack is required - } - - $this->setCurrentRequest($this->requestStack->getParentRequest()); - } - - public function onKernelRequest(GetResponseEvent $event) - { - $request = $event->getRequest(); - - // initialize the context that is also used by the generator (assuming matcher and generator share the same context instance) - // we call setCurrentRequest even if most of the time, it has already been done to keep compatibility - // with frameworks which do not use the Symfony service container - // when we have a RequestStack, no need to do it - if (null !== $this->requestStack) { - $this->setCurrentRequest($request); - } - - if ($request->attributes->has('_controller')) { - // routing is already done - return; - } - - // add attributes based on the request (routing) - try { - // matching a request is more powerful than matching a URL path + context, so try that first - if ($this->matcher instanceof RequestMatcherInterface) { - $parameters = $this->matcher->matchRequest($request); - } else { - $parameters = $this->matcher->match($request->getPathInfo()); - } - - if (null !== $this->logger) { - $this->logger->info(sprintf('Matched route "%s".', $parameters['_route']), array( - 'route_parameters' => $parameters, - 'request_uri' => $request->getUri(), - )); - } - - $request->attributes->add($parameters); - unset($parameters['_route'], $parameters['_controller']); - $request->attributes->set('_route_params', $parameters); - } catch (ResourceNotFoundException $e) { - $message = sprintf('No route found for "%s %s"', $request->getMethod(), $request->getPathInfo()); - - if ($referer = $request->headers->get('referer')) { - $message .= sprintf(' (from "%s")', $referer); - } - - throw new NotFoundHttpException($message, $e); - } catch (MethodNotAllowedException $e) { - $message = sprintf('No route found for "%s %s": Method Not Allowed (Allow: %s)', $request->getMethod(), $request->getPathInfo(), implode(', ', $e->getAllowedMethods())); - - throw new MethodNotAllowedHttpException($e->getAllowedMethods(), $message, $e); - } - } - - public static function getSubscribedEvents() - { - return array( - KernelEvents::REQUEST => array(array('onKernelRequest', 32)), - KernelEvents::FINISH_REQUEST => array(array('onKernelFinishRequest', 0)), - ); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/EventListener/SaveSessionListener.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/EventListener/SaveSessionListener.php deleted file mode 100644 index 36809b5..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/EventListener/SaveSessionListener.php +++ /dev/null @@ -1,66 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\EventListener; - -use Symfony\Component\EventDispatcher\EventSubscriberInterface; -use Symfony\Component\HttpKernel\Event\FilterResponseEvent; -use Symfony\Component\HttpKernel\KernelEvents; - -/** - * Saves the session, in case it is still open, before sending the response/headers. - * - * This ensures several things in case the developer did not save the session explicitly: - * - * * If a session save handler without locking is used, it ensures the data is available - * on the next request, e.g. after a redirect. PHPs auto-save at script end via - * session_register_shutdown is executed after fastcgi_finish_request. So in this case - * the data could be missing the next request because it might not be saved the moment - * the new request is processed. - * * A locking save handler (e.g. the native 'files') circumvents concurrency problems like - * the one above. But by saving the session before long-running things in the terminate event, - * we ensure the session is not blocked longer than needed. - * * When regenerating the session ID no locking is involved in PHPs session design. See - * https://bugs.php.net/bug.php?id=61470 for a discussion. So in this case, the session must - * be saved anyway before sending the headers with the new session ID. Otherwise session - * data could get lost again for concurrent requests with the new ID. One result could be - * that you get logged out after just logging in. - * - * This listener should be executed as one of the last listeners, so that previous listeners - * can still operate on the open session. This prevents the overhead of restarting it. - * Listeners after closing the session can still work with the session as usual because - * Symfonys session implementation starts the session on demand. So writing to it after - * it is saved will just restart it. - * - * @author Tobias Schultze - */ -class SaveSessionListener implements EventSubscriberInterface -{ - public function onKernelResponse(FilterResponseEvent $event) - { - if (!$event->isMasterRequest()) { - return; - } - - $session = $event->getRequest()->getSession(); - if ($session && $session->isStarted()) { - $session->save(); - } - } - - public static function getSubscribedEvents() - { - return array( - // low priority but higher than StreamedResponseListener - KernelEvents::RESPONSE => array(array('onKernelResponse', -1000)), - ); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/EventListener/SessionListener.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/EventListener/SessionListener.php deleted file mode 100644 index ecf065f..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/EventListener/SessionListener.php +++ /dev/null @@ -1,53 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\EventListener; - -use Symfony\Component\HttpKernel\Event\GetResponseEvent; -use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; - -/** - * Sets the session in the request. - * - * @author Johannes M. Schmitt - */ -abstract class SessionListener implements EventSubscriberInterface -{ - public function onKernelRequest(GetResponseEvent $event) - { - if (!$event->isMasterRequest()) { - return; - } - - $request = $event->getRequest(); - $session = $this->getSession(); - if (null === $session || $request->hasSession()) { - return; - } - - $request->setSession($session); - } - - public static function getSubscribedEvents() - { - return array( - KernelEvents::REQUEST => array('onKernelRequest', 128), - ); - } - - /** - * Gets the session object. - * - * @return SessionInterface|null A SessionInterface instance or null if no session is available - */ - abstract protected function getSession(); -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/EventListener/StreamedResponseListener.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/EventListener/StreamedResponseListener.php deleted file mode 100644 index 571cd74..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/EventListener/StreamedResponseListener.php +++ /dev/null @@ -1,51 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\EventListener; - -use Symfony\Component\HttpFoundation\StreamedResponse; -use Symfony\Component\HttpKernel\Event\FilterResponseEvent; -use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; - -/** - * StreamedResponseListener is responsible for sending the Response - * to the client. - * - * @author Fabien Potencier - */ -class StreamedResponseListener implements EventSubscriberInterface -{ - /** - * Filters the Response. - * - * @param FilterResponseEvent $event A FilterResponseEvent instance - */ - public function onKernelResponse(FilterResponseEvent $event) - { - if (!$event->isMasterRequest()) { - return; - } - - $response = $event->getResponse(); - - if ($response instanceof StreamedResponse) { - $response->send(); - } - } - - public static function getSubscribedEvents() - { - return array( - KernelEvents::RESPONSE => array('onKernelResponse', -1024), - ); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/EventListener/SurrogateListener.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/EventListener/SurrogateListener.php deleted file mode 100644 index 00f4fbf..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/EventListener/SurrogateListener.php +++ /dev/null @@ -1,58 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\EventListener; - -use Symfony\Component\HttpKernel\Event\FilterResponseEvent; -use Symfony\Component\HttpKernel\HttpCache\SurrogateInterface; -use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; - -/** - * SurrogateListener adds a Surrogate-Control HTTP header when the Response needs to be parsed for Surrogates - * - * @author Fabien Potencier - */ -class SurrogateListener implements EventSubscriberInterface -{ - private $surrogate; - - /** - * Constructor. - * - * @param SurrogateInterface $surrogate An SurrogateInterface instance - */ - public function __construct(SurrogateInterface $surrogate = null) - { - $this->surrogate = $surrogate; - } - - /** - * Filters the Response. - * - * @param FilterResponseEvent $event A FilterResponseEvent instance - */ - public function onKernelResponse(FilterResponseEvent $event) - { - if (!$event->isMasterRequest() || null === $this->surrogate) { - return; - } - - $this->surrogate->addSurrogateControl($event->getResponse()); - } - - public static function getSubscribedEvents() - { - return array( - KernelEvents::RESPONSE => 'onKernelResponse', - ); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/EventListener/TestSessionListener.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/EventListener/TestSessionListener.php deleted file mode 100644 index 42a0f20..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/EventListener/TestSessionListener.php +++ /dev/null @@ -1,83 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\EventListener; - -use Symfony\Component\HttpFoundation\Cookie; -use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\HttpKernel\Event\FilterResponseEvent; -use Symfony\Component\HttpKernel\Event\GetResponseEvent; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; - -/** - * TestSessionListener. - * - * Saves session in test environment. - * - * @author Bulat Shakirzyanov - * @author Fabien Potencier - */ -abstract class TestSessionListener implements EventSubscriberInterface -{ - public function onKernelRequest(GetResponseEvent $event) - { - if (!$event->isMasterRequest()) { - return; - } - - // bootstrap the session - $session = $this->getSession(); - if (!$session) { - return; - } - - $cookies = $event->getRequest()->cookies; - - if ($cookies->has($session->getName())) { - $session->setId($cookies->get($session->getName())); - } - } - - /** - * Checks if session was initialized and saves if current request is master - * Runs on 'kernel.response' in test environment - * - * @param FilterResponseEvent $event - */ - public function onKernelResponse(FilterResponseEvent $event) - { - if (!$event->isMasterRequest()) { - return; - } - - $session = $event->getRequest()->getSession(); - if ($session && $session->isStarted()) { - $session->save(); - $params = session_get_cookie_params(); - $event->getResponse()->headers->setCookie(new Cookie($session->getName(), $session->getId(), 0 === $params['lifetime'] ? 0 : time() + $params['lifetime'], $params['path'], $params['domain'], $params['secure'], $params['httponly'])); - } - } - - public static function getSubscribedEvents() - { - return array( - KernelEvents::REQUEST => array('onKernelRequest', 192), - KernelEvents::RESPONSE => array('onKernelResponse', -128), - ); - } - - /** - * Gets the session object. - * - * @return SessionInterface|null A SessionInterface instance or null if no session is available - */ - abstract protected function getSession(); -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/EventListener/TranslatorListener.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/EventListener/TranslatorListener.php deleted file mode 100644 index 6967ad0..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/EventListener/TranslatorListener.php +++ /dev/null @@ -1,69 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\EventListener; - -use Symfony\Component\EventDispatcher\EventSubscriberInterface; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpKernel\Event\GetResponseEvent; -use Symfony\Component\HttpKernel\Event\FinishRequestEvent; -use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\HttpFoundation\RequestStack; -use Symfony\Component\Translation\TranslatorInterface; - -/** - * Synchronizes the locale between the request and the translator. - * - * @author Fabien Potencier - */ -class TranslatorListener implements EventSubscriberInterface -{ - private $translator; - private $requestStack; - - public function __construct(TranslatorInterface $translator, RequestStack $requestStack) - { - $this->translator = $translator; - $this->requestStack = $requestStack; - } - - public function onKernelRequest(GetResponseEvent $event) - { - $this->setLocale($event->getRequest()); - } - - public function onKernelFinishRequest(FinishRequestEvent $event) - { - if (null === $parentRequest = $this->requestStack->getParentRequest()) { - return; - } - - $this->setLocale($parentRequest); - } - - public static function getSubscribedEvents() - { - return array( - // must be registered after the Locale listener - KernelEvents::REQUEST => array(array('onKernelRequest', 10)), - KernelEvents::FINISH_REQUEST => array(array('onKernelFinishRequest', 0)), - ); - } - - private function setLocale(Request $request) - { - try { - $this->translator->setLocale($request->getLocale()); - } catch (\InvalidArgumentException $e) { - $this->translator->setLocale($request->getDefaultLocale()); - } - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Exception/AccessDeniedHttpException.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/Exception/AccessDeniedHttpException.php deleted file mode 100644 index 79d8639..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Exception/AccessDeniedHttpException.php +++ /dev/null @@ -1,33 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Exception; - -/** - * AccessDeniedHttpException. - * - * @author Fabien Potencier - * @author Christophe Coevoet - */ -class AccessDeniedHttpException extends HttpException -{ - /** - * Constructor. - * - * @param string $message The internal exception message - * @param \Exception $previous The previous exception - * @param int $code The internal exception code - */ - public function __construct($message = null, \Exception $previous = null, $code = 0) - { - parent::__construct(403, $message, $previous, array(), $code); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Exception/BadRequestHttpException.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/Exception/BadRequestHttpException.php deleted file mode 100644 index 5f68172..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Exception/BadRequestHttpException.php +++ /dev/null @@ -1,32 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Exception; - -/** - * BadRequestHttpException. - * - * @author Ben Ramsey - */ -class BadRequestHttpException extends HttpException -{ - /** - * Constructor. - * - * @param string $message The internal exception message - * @param \Exception $previous The previous exception - * @param int $code The internal exception code - */ - public function __construct($message = null, \Exception $previous = null, $code = 0) - { - parent::__construct(400, $message, $previous, array(), $code); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Exception/ConflictHttpException.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/Exception/ConflictHttpException.php deleted file mode 100644 index 34d738e..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Exception/ConflictHttpException.php +++ /dev/null @@ -1,32 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Exception; - -/** - * ConflictHttpException. - * - * @author Ben Ramsey - */ -class ConflictHttpException extends HttpException -{ - /** - * Constructor. - * - * @param string $message The internal exception message - * @param \Exception $previous The previous exception - * @param int $code The internal exception code - */ - public function __construct($message = null, \Exception $previous = null, $code = 0) - { - parent::__construct(409, $message, $previous, array(), $code); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Exception/FatalErrorException.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/Exception/FatalErrorException.php deleted file mode 100644 index 0d2b4f9..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Exception/FatalErrorException.php +++ /dev/null @@ -1,23 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Exception; - -@trigger_error('The '.__NAMESPACE__.'\FatalErrorException class is deprecated since version 2.3 and will be removed in 3.0. Use the Symfony\Component\Debug\Exception\FatalErrorException class instead.', E_USER_DEPRECATED); - -/* - * Fatal Error Exception. - * - * @author Konstanton Myakshin - * - * @deprecated since version 2.3, to be removed in 3.0. Use the same class from the Debug component instead. - */ -class_exists('Symfony\Component\Debug\Exception\FatalErrorException'); diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Exception/FlattenException.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/Exception/FlattenException.php deleted file mode 100644 index 599aa95..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Exception/FlattenException.php +++ /dev/null @@ -1,25 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Exception; - -@trigger_error('The '.__NAMESPACE__.'\FlattenException class is deprecated since version 2.3 and will be removed in 3.0. Use the Symfony\Component\Debug\Exception\FlattenException class instead.', E_USER_DEPRECATED); - -/* - * FlattenException wraps a PHP Exception to be able to serialize it. - * - * Basically, this class removes all objects from the trace. - * - * @author Fabien Potencier - * - * @deprecated since version 2.3, to be removed in 3.0. Use the same class from the Debug component instead. - */ -class_exists('Symfony\Component\Debug\Exception\FlattenException'); diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Exception/GoneHttpException.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/Exception/GoneHttpException.php deleted file mode 100644 index 16ea223..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Exception/GoneHttpException.php +++ /dev/null @@ -1,32 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Exception; - -/** - * GoneHttpException. - * - * @author Ben Ramsey - */ -class GoneHttpException extends HttpException -{ - /** - * Constructor. - * - * @param string $message The internal exception message - * @param \Exception $previous The previous exception - * @param int $code The internal exception code - */ - public function __construct($message = null, \Exception $previous = null, $code = 0) - { - parent::__construct(410, $message, $previous, array(), $code); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Exception/HttpException.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/Exception/HttpException.php deleted file mode 100644 index 4e1b526..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Exception/HttpException.php +++ /dev/null @@ -1,41 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Exception; - -/** - * HttpException. - * - * @author Kris Wallsmith - */ -class HttpException extends \RuntimeException implements HttpExceptionInterface -{ - private $statusCode; - private $headers; - - public function __construct($statusCode, $message = null, \Exception $previous = null, array $headers = array(), $code = 0) - { - $this->statusCode = $statusCode; - $this->headers = $headers; - - parent::__construct($message, $code, $previous); - } - - public function getStatusCode() - { - return $this->statusCode; - } - - public function getHeaders() - { - return $this->headers; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Exception/HttpExceptionInterface.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/Exception/HttpExceptionInterface.php deleted file mode 100644 index 8aa50a9..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Exception/HttpExceptionInterface.php +++ /dev/null @@ -1,34 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Exception; - -/** - * Interface for HTTP error exceptions. - * - * @author Kris Wallsmith - */ -interface HttpExceptionInterface -{ - /** - * Returns the status code. - * - * @return int An HTTP response status code - */ - public function getStatusCode(); - - /** - * Returns response headers. - * - * @return array Response headers - */ - public function getHeaders(); -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Exception/LengthRequiredHttpException.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/Exception/LengthRequiredHttpException.php deleted file mode 100644 index 0c4b943..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Exception/LengthRequiredHttpException.php +++ /dev/null @@ -1,32 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Exception; - -/** - * LengthRequiredHttpException. - * - * @author Ben Ramsey - */ -class LengthRequiredHttpException extends HttpException -{ - /** - * Constructor. - * - * @param string $message The internal exception message - * @param \Exception $previous The previous exception - * @param int $code The internal exception code - */ - public function __construct($message = null, \Exception $previous = null, $code = 0) - { - parent::__construct(411, $message, $previous, array(), $code); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Exception/MethodNotAllowedHttpException.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/Exception/MethodNotAllowedHttpException.php deleted file mode 100644 index 78dd26b..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Exception/MethodNotAllowedHttpException.php +++ /dev/null @@ -1,35 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Exception; - -/** - * MethodNotAllowedHttpException. - * - * @author Kris Wallsmith - */ -class MethodNotAllowedHttpException extends HttpException -{ - /** - * Constructor. - * - * @param array $allow An array of allowed methods - * @param string $message The internal exception message - * @param \Exception $previous The previous exception - * @param int $code The internal exception code - */ - public function __construct(array $allow, $message = null, \Exception $previous = null, $code = 0) - { - $headers = array('Allow' => strtoupper(implode(', ', $allow))); - - parent::__construct(405, $message, $previous, $headers, $code); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Exception/NotAcceptableHttpException.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/Exception/NotAcceptableHttpException.php deleted file mode 100644 index cc6be4b..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Exception/NotAcceptableHttpException.php +++ /dev/null @@ -1,32 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Exception; - -/** - * NotAcceptableHttpException. - * - * @author Ben Ramsey - */ -class NotAcceptableHttpException extends HttpException -{ - /** - * Constructor. - * - * @param string $message The internal exception message - * @param \Exception $previous The previous exception - * @param int $code The internal exception code - */ - public function __construct($message = null, \Exception $previous = null, $code = 0) - { - parent::__construct(406, $message, $previous, array(), $code); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Exception/NotFoundHttpException.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/Exception/NotFoundHttpException.php deleted file mode 100644 index 4639e37..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Exception/NotFoundHttpException.php +++ /dev/null @@ -1,32 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Exception; - -/** - * NotFoundHttpException. - * - * @author Fabien Potencier - */ -class NotFoundHttpException extends HttpException -{ - /** - * Constructor. - * - * @param string $message The internal exception message - * @param \Exception $previous The previous exception - * @param int $code The internal exception code - */ - public function __construct($message = null, \Exception $previous = null, $code = 0) - { - parent::__construct(404, $message, $previous, array(), $code); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Exception/PreconditionFailedHttpException.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/Exception/PreconditionFailedHttpException.php deleted file mode 100644 index 9df0e7b..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Exception/PreconditionFailedHttpException.php +++ /dev/null @@ -1,32 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Exception; - -/** - * PreconditionFailedHttpException. - * - * @author Ben Ramsey - */ -class PreconditionFailedHttpException extends HttpException -{ - /** - * Constructor. - * - * @param string $message The internal exception message - * @param \Exception $previous The previous exception - * @param int $code The internal exception code - */ - public function __construct($message = null, \Exception $previous = null, $code = 0) - { - parent::__construct(412, $message, $previous, array(), $code); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Exception/PreconditionRequiredHttpException.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/Exception/PreconditionRequiredHttpException.php deleted file mode 100644 index 08ebca2..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Exception/PreconditionRequiredHttpException.php +++ /dev/null @@ -1,34 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Exception; - -/** - * PreconditionRequiredHttpException. - * - * @author Ben Ramsey - * - * @see http://tools.ietf.org/html/rfc6585 - */ -class PreconditionRequiredHttpException extends HttpException -{ - /** - * Constructor. - * - * @param string $message The internal exception message - * @param \Exception $previous The previous exception - * @param int $code The internal exception code - */ - public function __construct($message = null, \Exception $previous = null, $code = 0) - { - parent::__construct(428, $message, $previous, array(), $code); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Exception/ServiceUnavailableHttpException.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/Exception/ServiceUnavailableHttpException.php deleted file mode 100644 index 32b9e2d..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Exception/ServiceUnavailableHttpException.php +++ /dev/null @@ -1,38 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Exception; - -/** - * ServiceUnavailableHttpException. - * - * @author Ben Ramsey - */ -class ServiceUnavailableHttpException extends HttpException -{ - /** - * Constructor. - * - * @param int|string $retryAfter The number of seconds or HTTP-date after which the request may be retried - * @param string $message The internal exception message - * @param \Exception $previous The previous exception - * @param int $code The internal exception code - */ - public function __construct($retryAfter = null, $message = null, \Exception $previous = null, $code = 0) - { - $headers = array(); - if ($retryAfter) { - $headers = array('Retry-After' => $retryAfter); - } - - parent::__construct(503, $message, $previous, $headers, $code); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Exception/TooManyRequestsHttpException.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/Exception/TooManyRequestsHttpException.php deleted file mode 100644 index ab86e09..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Exception/TooManyRequestsHttpException.php +++ /dev/null @@ -1,40 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Exception; - -/** - * TooManyRequestsHttpException. - * - * @author Ben Ramsey - * - * @see http://tools.ietf.org/html/rfc6585 - */ -class TooManyRequestsHttpException extends HttpException -{ - /** - * Constructor. - * - * @param int|string $retryAfter The number of seconds or HTTP-date after which the request may be retried - * @param string $message The internal exception message - * @param \Exception $previous The previous exception - * @param int $code The internal exception code - */ - public function __construct($retryAfter = null, $message = null, \Exception $previous = null, $code = 0) - { - $headers = array(); - if ($retryAfter) { - $headers = array('Retry-After' => $retryAfter); - } - - parent::__construct(429, $message, $previous, $headers, $code); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Exception/UnauthorizedHttpException.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/Exception/UnauthorizedHttpException.php deleted file mode 100644 index 0dfe42d..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Exception/UnauthorizedHttpException.php +++ /dev/null @@ -1,35 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Exception; - -/** - * UnauthorizedHttpException. - * - * @author Ben Ramsey - */ -class UnauthorizedHttpException extends HttpException -{ - /** - * Constructor. - * - * @param string $challenge WWW-Authenticate challenge string - * @param string $message The internal exception message - * @param \Exception $previous The previous exception - * @param int $code The internal exception code - */ - public function __construct($challenge, $message = null, \Exception $previous = null, $code = 0) - { - $headers = array('WWW-Authenticate' => $challenge); - - parent::__construct(401, $message, $previous, $headers, $code); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Exception/UnprocessableEntityHttpException.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/Exception/UnprocessableEntityHttpException.php deleted file mode 100644 index eb13f56..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Exception/UnprocessableEntityHttpException.php +++ /dev/null @@ -1,32 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Exception; - -/** - * UnprocessableEntityHttpException. - * - * @author Steve Hutchins - */ -class UnprocessableEntityHttpException extends HttpException -{ - /** - * Constructor. - * - * @param string $message The internal exception message - * @param \Exception $previous The previous exception - * @param int $code The internal exception code - */ - public function __construct($message = null, \Exception $previous = null, $code = 0) - { - parent::__construct(422, $message, $previous, array(), $code); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Exception/UnsupportedMediaTypeHttpException.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/Exception/UnsupportedMediaTypeHttpException.php deleted file mode 100644 index a9d8fa0..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Exception/UnsupportedMediaTypeHttpException.php +++ /dev/null @@ -1,32 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Exception; - -/** - * UnsupportedMediaTypeHttpException. - * - * @author Ben Ramsey - */ -class UnsupportedMediaTypeHttpException extends HttpException -{ - /** - * Constructor. - * - * @param string $message The internal exception message - * @param \Exception $previous The previous exception - * @param int $code The internal exception code - */ - public function __construct($message = null, \Exception $previous = null, $code = 0) - { - parent::__construct(415, $message, $previous, array(), $code); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Fragment/AbstractSurrogateFragmentRenderer.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/Fragment/AbstractSurrogateFragmentRenderer.php deleted file mode 100644 index 1968001..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Fragment/AbstractSurrogateFragmentRenderer.php +++ /dev/null @@ -1,95 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Fragment; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\Controller\ControllerReference; -use Symfony\Component\HttpKernel\HttpCache\SurrogateInterface; -use Symfony\Component\HttpKernel\UriSigner; - -/** - * Implements Surrogate rendering strategy. - * - * @author Fabien Potencier - */ -abstract class AbstractSurrogateFragmentRenderer extends RoutableFragmentRenderer -{ - private $surrogate; - private $inlineStrategy; - private $signer; - - /** - * Constructor. - * - * The "fallback" strategy when surrogate is not available should always be an - * instance of InlineFragmentRenderer. - * - * @param SurrogateInterface $surrogate An Surrogate instance - * @param FragmentRendererInterface $inlineStrategy The inline strategy to use when the surrogate is not supported - * @param UriSigner $signer - */ - public function __construct(SurrogateInterface $surrogate = null, FragmentRendererInterface $inlineStrategy, UriSigner $signer = null) - { - $this->surrogate = $surrogate; - $this->inlineStrategy = $inlineStrategy; - $this->signer = $signer; - } - - /** - * {@inheritdoc} - * - * Note that if the current Request has no surrogate capability, this method - * falls back to use the inline rendering strategy. - * - * Additional available options: - * - * * alt: an alternative URI to render in case of an error - * * comment: a comment to add when returning the surrogate tag - * - * Note, that not all surrogate strategies support all options. For now - * 'alt' and 'comment' are only supported by ESI. - * - * @see Symfony\Component\HttpKernel\HttpCache\SurrogateInterface - */ - public function render($uri, Request $request, array $options = array()) - { - if (!$this->surrogate || !$this->surrogate->hasSurrogateCapability($request)) { - return $this->inlineStrategy->render($uri, $request, $options); - } - - if ($uri instanceof ControllerReference) { - $uri = $this->generateSignedFragmentUri($uri, $request); - } - - $alt = isset($options['alt']) ? $options['alt'] : null; - if ($alt instanceof ControllerReference) { - $alt = $this->generateSignedFragmentUri($alt, $request); - } - - $tag = $this->surrogate->renderIncludeTag($uri, $alt, isset($options['ignore_errors']) ? $options['ignore_errors'] : false, isset($options['comment']) ? $options['comment'] : ''); - - return new Response($tag); - } - - private function generateSignedFragmentUri($uri, Request $request) - { - if (null === $this->signer) { - throw new \LogicException('You must use a URI when using the ESI rendering strategy or set a URL signer.'); - } - - // we need to sign the absolute URI, but want to return the path only. - $fragmentUri = $this->signer->sign($this->generateFragmentUri($uri, $request, true)); - - return substr($fragmentUri, strlen($request->getSchemeAndHttpHost())); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Fragment/EsiFragmentRenderer.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/Fragment/EsiFragmentRenderer.php deleted file mode 100644 index a4570e3..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Fragment/EsiFragmentRenderer.php +++ /dev/null @@ -1,28 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Fragment; - -/** - * Implements the ESI rendering strategy. - * - * @author Fabien Potencier - */ -class EsiFragmentRenderer extends AbstractSurrogateFragmentRenderer -{ - /** - * {@inheritdoc} - */ - public function getName() - { - return 'esi'; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Fragment/FragmentHandler.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/Fragment/FragmentHandler.php deleted file mode 100644 index 774870a..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Fragment/FragmentHandler.php +++ /dev/null @@ -1,150 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Fragment; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpFoundation\StreamedResponse; -use Symfony\Component\HttpFoundation\RequestStack; -use Symfony\Component\HttpKernel\Controller\ControllerReference; - -/** - * Renders a URI that represents a resource fragment. - * - * This class handles the rendering of resource fragments that are included into - * a main resource. The handling of the rendering is managed by specialized renderers. - * - * This listener works in 2 modes: - * - * * 2.3 compatibility mode where you must call setRequest whenever the Request changes. - * * 2.4+ mode where you must pass a RequestStack instance in the constructor. - * - * @author Fabien Potencier - * - * @see FragmentRendererInterface - */ -class FragmentHandler -{ - private $debug; - private $renderers = array(); - private $request; - private $requestStack; - - /** - * Constructor. - * - * RequestStack will become required in 3.0. - * - * @param FragmentRendererInterface[] $renderers An array of FragmentRendererInterface instances - * @param bool $debug Whether the debug mode is enabled or not - * @param RequestStack|null $requestStack The Request stack that controls the lifecycle of requests - */ - public function __construct(array $renderers = array(), $debug = false, RequestStack $requestStack = null) - { - $this->requestStack = $requestStack; - foreach ($renderers as $renderer) { - $this->addRenderer($renderer); - } - $this->debug = $debug; - } - - /** - * Adds a renderer. - * - * @param FragmentRendererInterface $renderer A FragmentRendererInterface instance - */ - public function addRenderer(FragmentRendererInterface $renderer) - { - $this->renderers[$renderer->getName()] = $renderer; - } - - /** - * Sets the current Request. - * - * This method was used to synchronize the Request, but as the HttpKernel - * is doing that automatically now, you should never call it directly. - * It is kept public for BC with the 2.3 version. - * - * @param Request|null $request A Request instance - * - * @deprecated since version 2.4, to be removed in 3.0. - */ - public function setRequest(Request $request = null) - { - @trigger_error('The '.__METHOD__.' method is deprecated since version 2.4 and will be removed in 3.0.', E_USER_DEPRECATED); - - $this->request = $request; - } - - /** - * Renders a URI and returns the Response content. - * - * Available options: - * - * * ignore_errors: true to return an empty string in case of an error - * - * @param string|ControllerReference $uri A URI as a string or a ControllerReference instance - * @param string $renderer The renderer name - * @param array $options An array of options - * - * @return string|null The Response content or null when the Response is streamed - * - * @throws \InvalidArgumentException when the renderer does not exist - * @throws \LogicException when no master request is being handled - */ - public function render($uri, $renderer = 'inline', array $options = array()) - { - if (!isset($options['ignore_errors'])) { - $options['ignore_errors'] = !$this->debug; - } - - if (!isset($this->renderers[$renderer])) { - throw new \InvalidArgumentException(sprintf('The "%s" renderer does not exist.', $renderer)); - } - - if (!$request = $this->getRequest()) { - throw new \LogicException('Rendering a fragment can only be done when handling a Request.'); - } - - return $this->deliver($this->renderers[$renderer]->render($uri, $request, $options)); - } - - /** - * Delivers the Response as a string. - * - * When the Response is a StreamedResponse, the content is streamed immediately - * instead of being returned. - * - * @param Response $response A Response instance - * - * @return string|null The Response content or null when the Response is streamed - * - * @throws \RuntimeException when the Response is not successful - */ - protected function deliver(Response $response) - { - if (!$response->isSuccessful()) { - throw new \RuntimeException(sprintf('Error when rendering "%s" (Status code is %s).', $this->getRequest()->getUri(), $response->getStatusCode())); - } - - if (!$response instanceof StreamedResponse) { - return $response->getContent(); - } - - $response->sendContent(); - } - - private function getRequest() - { - return $this->requestStack ? $this->requestStack->getCurrentRequest() : $this->request; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Fragment/FragmentRendererInterface.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/Fragment/FragmentRendererInterface.php deleted file mode 100644 index b177c3a..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Fragment/FragmentRendererInterface.php +++ /dev/null @@ -1,42 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Fragment; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpKernel\Controller\ControllerReference; -use Symfony\Component\HttpFoundation\Response; - -/** - * Interface implemented by all rendering strategies. - * - * @author Fabien Potencier - */ -interface FragmentRendererInterface -{ - /** - * Renders a URI and returns the Response content. - * - * @param string|ControllerReference $uri A URI as a string or a ControllerReference instance - * @param Request $request A Request instance - * @param array $options An array of options - * - * @return Response A Response instance - */ - public function render($uri, Request $request, array $options = array()); - - /** - * Gets the name of the strategy. - * - * @return string The strategy name - */ - public function getName(); -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Fragment/HIncludeFragmentRenderer.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/Fragment/HIncludeFragmentRenderer.php deleted file mode 100644 index 56c96b3..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Fragment/HIncludeFragmentRenderer.php +++ /dev/null @@ -1,164 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Fragment; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\Templating\EngineInterface; -use Symfony\Component\HttpKernel\Controller\ControllerReference; -use Symfony\Component\HttpKernel\UriSigner; - -/** - * Implements the Hinclude rendering strategy. - * - * @author Fabien Potencier - */ -class HIncludeFragmentRenderer extends RoutableFragmentRenderer -{ - private $globalDefaultTemplate; - private $signer; - private $templating; - private $charset; - - /** - * Constructor. - * - * @param EngineInterface|\Twig_Environment $templating An EngineInterface or a \Twig_Environment instance - * @param UriSigner $signer A UriSigner instance - * @param string $globalDefaultTemplate The global default content (it can be a template name or the content) - * @param string $charset - */ - public function __construct($templating = null, UriSigner $signer = null, $globalDefaultTemplate = null, $charset = 'utf-8') - { - $this->setTemplating($templating); - $this->globalDefaultTemplate = $globalDefaultTemplate; - $this->signer = $signer; - $this->charset = $charset; - } - - /** - * Sets the templating engine to use to render the default content. - * - * @param EngineInterface|\Twig_Environment|null $templating An EngineInterface or a \Twig_Environment instance - * - * @throws \InvalidArgumentException - */ - public function setTemplating($templating) - { - if (null !== $templating && !$templating instanceof EngineInterface && !$templating instanceof \Twig_Environment) { - throw new \InvalidArgumentException('The hinclude rendering strategy needs an instance of \Twig_Environment or Symfony\Component\Templating\EngineInterface'); - } - - $this->templating = $templating; - } - - /** - * Checks if a templating engine has been set. - * - * @return bool true if the templating engine has been set, false otherwise - */ - public function hasTemplating() - { - return null !== $this->templating; - } - - /** - * {@inheritdoc} - * - * Additional available options: - * - * * default: The default content (it can be a template name or the content) - * * id: An optional hx:include tag id attribute - * * attributes: An optional array of hx:include tag attributes - */ - public function render($uri, Request $request, array $options = array()) - { - if ($uri instanceof ControllerReference) { - if (null === $this->signer) { - throw new \LogicException('You must use a proper URI when using the Hinclude rendering strategy or set a URL signer.'); - } - - // we need to sign the absolute URI, but want to return the path only. - $uri = substr($this->signer->sign($this->generateFragmentUri($uri, $request, true)), strlen($request->getSchemeAndHttpHost())); - } - - // We need to replace ampersands in the URI with the encoded form in order to return valid html/xml content. - $uri = str_replace('&', '&', $uri); - - $template = isset($options['default']) ? $options['default'] : $this->globalDefaultTemplate; - if (null !== $this->templating && $template && $this->templateExists($template)) { - $content = $this->templating->render($template); - } else { - $content = $template; - } - - $attributes = isset($options['attributes']) && is_array($options['attributes']) ? $options['attributes'] : array(); - if (isset($options['id']) && $options['id']) { - $attributes['id'] = $options['id']; - } - $renderedAttributes = ''; - if (count($attributes) > 0) { - if (PHP_VERSION_ID >= 50400) { - $flags = ENT_QUOTES | ENT_SUBSTITUTE; - } else { - $flags = ENT_QUOTES; - } - foreach ($attributes as $attribute => $value) { - $renderedAttributes .= sprintf( - ' %s="%s"', - htmlspecialchars($attribute, $flags, $this->charset, false), - htmlspecialchars($value, $flags, $this->charset, false) - ); - } - } - - return new Response(sprintf('%s', $uri, $renderedAttributes, $content)); - } - - /** - * @param string $template - * - * @return bool - */ - private function templateExists($template) - { - if ($this->templating instanceof EngineInterface) { - try { - return $this->templating->exists($template); - } catch (\InvalidArgumentException $e) { - return false; - } - } - - $loader = $this->templating->getLoader(); - if ($loader instanceof \Twig_ExistsLoaderInterface) { - return $loader->exists($template); - } - - try { - $loader->getSource($template); - - return true; - } catch (\Twig_Error_Loader $e) { - } - - return false; - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return 'hinclude'; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Fragment/InlineFragmentRenderer.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/Fragment/InlineFragmentRenderer.php deleted file mode 100644 index a6ab82e..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Fragment/InlineFragmentRenderer.php +++ /dev/null @@ -1,152 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Fragment; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\HttpKernelInterface; -use Symfony\Component\HttpKernel\Controller\ControllerReference; -use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; -use Symfony\Component\EventDispatcher\EventDispatcherInterface; - -/** - * Implements the inline rendering strategy where the Request is rendered by the current HTTP kernel. - * - * @author Fabien Potencier - */ -class InlineFragmentRenderer extends RoutableFragmentRenderer -{ - private $kernel; - private $dispatcher; - - /** - * Constructor. - * - * @param HttpKernelInterface $kernel A HttpKernelInterface instance - * @param EventDispatcherInterface $dispatcher A EventDispatcherInterface instance - */ - public function __construct(HttpKernelInterface $kernel, EventDispatcherInterface $dispatcher = null) - { - $this->kernel = $kernel; - $this->dispatcher = $dispatcher; - } - - /** - * {@inheritdoc} - * - * Additional available options: - * - * * alt: an alternative URI to render in case of an error - */ - public function render($uri, Request $request, array $options = array()) - { - $reference = null; - if ($uri instanceof ControllerReference) { - $reference = $uri; - - // Remove attributes from the generated URI because if not, the Symfony - // routing system will use them to populate the Request attributes. We don't - // want that as we want to preserve objects (so we manually set Request attributes - // below instead) - $attributes = $reference->attributes; - $reference->attributes = array(); - - // The request format and locale might have been overridden by the user - foreach (array('_format', '_locale') as $key) { - if (isset($attributes[$key])) { - $reference->attributes[$key] = $attributes[$key]; - } - } - - $uri = $this->generateFragmentUri($uri, $request, false, false); - - $reference->attributes = array_merge($attributes, $reference->attributes); - } - - $subRequest = $this->createSubRequest($uri, $request); - - // override Request attributes as they can be objects (which are not supported by the generated URI) - if (null !== $reference) { - $subRequest->attributes->add($reference->attributes); - } - - $level = ob_get_level(); - try { - return $this->kernel->handle($subRequest, HttpKernelInterface::SUB_REQUEST, false); - } catch (\Exception $e) { - // we dispatch the exception event to trigger the logging - // the response that comes back is simply ignored - if (isset($options['ignore_errors']) && $options['ignore_errors'] && $this->dispatcher) { - $event = new GetResponseForExceptionEvent($this->kernel, $request, HttpKernelInterface::SUB_REQUEST, $e); - - $this->dispatcher->dispatch(KernelEvents::EXCEPTION, $event); - } - - // let's clean up the output buffers that were created by the sub-request - Response::closeOutputBuffers($level, false); - - if (isset($options['alt'])) { - $alt = $options['alt']; - unset($options['alt']); - - return $this->render($alt, $request, $options); - } - - if (!isset($options['ignore_errors']) || !$options['ignore_errors']) { - throw $e; - } - - return new Response(); - } - } - - protected function createSubRequest($uri, Request $request) - { - $cookies = $request->cookies->all(); - $server = $request->server->all(); - - // Override the arguments to emulate a sub-request. - // Sub-request object will point to localhost as client ip and real client ip - // will be included into trusted header for client ip - try { - if ($trustedHeaderName = Request::getTrustedHeaderName(Request::HEADER_CLIENT_IP)) { - $currentXForwardedFor = $request->headers->get($trustedHeaderName, ''); - - $server['HTTP_'.$trustedHeaderName] = ($currentXForwardedFor ? $currentXForwardedFor.', ' : '').$request->getClientIp(); - } - } catch (\InvalidArgumentException $e) { - // Do nothing - } - - $server['REMOTE_ADDR'] = '127.0.0.1'; - - $subRequest = Request::create($uri, 'get', array(), $cookies, array(), $server); - if ($request->headers->has('Surrogate-Capability')) { - $subRequest->headers->set('Surrogate-Capability', $request->headers->get('Surrogate-Capability')); - } - - if ($session = $request->getSession()) { - $subRequest->setSession($session); - } - - return $subRequest; - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return 'inline'; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Fragment/RoutableFragmentRenderer.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/Fragment/RoutableFragmentRenderer.php deleted file mode 100644 index d7eeb89..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Fragment/RoutableFragmentRenderer.php +++ /dev/null @@ -1,90 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Fragment; - -use Symfony\Component\HttpKernel\Controller\ControllerReference; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpKernel\EventListener\FragmentListener; - -/** - * Adds the possibility to generate a fragment URI for a given Controller. - * - * @author Fabien Potencier - */ -abstract class RoutableFragmentRenderer implements FragmentRendererInterface -{ - private $fragmentPath = '/_fragment'; - - /** - * Sets the fragment path that triggers the fragment listener. - * - * @param string $path The path - * - * @see FragmentListener - */ - public function setFragmentPath($path) - { - $this->fragmentPath = $path; - } - - /** - * Generates a fragment URI for a given controller. - * - * @param ControllerReference $reference A ControllerReference instance - * @param Request $request A Request instance - * @param bool $absolute Whether to generate an absolute URL or not - * @param bool $strict Whether to allow non-scalar attributes or not - * - * @return string A fragment URI - */ - protected function generateFragmentUri(ControllerReference $reference, Request $request, $absolute = false, $strict = true) - { - if ($strict) { - $this->checkNonScalar($reference->attributes); - } - - // We need to forward the current _format and _locale values as we don't have - // a proper routing pattern to do the job for us. - // This makes things inconsistent if you switch from rendering a controller - // to rendering a route if the route pattern does not contain the special - // _format and _locale placeholders. - if (!isset($reference->attributes['_format'])) { - $reference->attributes['_format'] = $request->getRequestFormat(); - } - if (!isset($reference->attributes['_locale'])) { - $reference->attributes['_locale'] = $request->getLocale(); - } - - $reference->attributes['_controller'] = $reference->controller; - - $reference->query['_path'] = http_build_query($reference->attributes, '', '&'); - - $path = $this->fragmentPath.'?'.http_build_query($reference->query, '', '&'); - - if ($absolute) { - return $request->getUriForPath($path); - } - - return $request->getBaseUrl().$path; - } - - private function checkNonScalar($values) - { - foreach ($values as $key => $value) { - if (is_array($value)) { - $this->checkNonScalar($value); - } elseif (!is_scalar($value) && null !== $value) { - throw new \LogicException(sprintf('Controller attributes cannot contain non-scalar/non-null values (value for key "%s" is not a scalar or null).', $key)); - } - } - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Fragment/SsiFragmentRenderer.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/Fragment/SsiFragmentRenderer.php deleted file mode 100644 index 45e7122..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Fragment/SsiFragmentRenderer.php +++ /dev/null @@ -1,28 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Fragment; - -/** - * Implements the SSI rendering strategy. - * - * @author Sebastian Krebs - */ -class SsiFragmentRenderer extends AbstractSurrogateFragmentRenderer -{ - /** - * {@inheritdoc} - */ - public function getName() - { - return 'ssi'; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/HttpCache/Esi.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/HttpCache/Esi.php deleted file mode 100644 index adb7ff3..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/HttpCache/Esi.php +++ /dev/null @@ -1,296 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\HttpCache; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\HttpKernelInterface; - -/** - * Esi implements the ESI capabilities to Request and Response instances. - * - * For more information, read the following W3C notes: - * - * * ESI Language Specification 1.0 (http://www.w3.org/TR/esi-lang) - * - * * Edge Architecture Specification (http://www.w3.org/TR/edge-arch) - * - * @author Fabien Potencier - */ -class Esi implements SurrogateInterface -{ - private $contentTypes; - private $phpEscapeMap = array( - array('', '', '', ''), - ); - - /** - * Constructor. - * - * @param array $contentTypes An array of content-type that should be parsed for ESI information. - * (default: text/html, text/xml, application/xhtml+xml, and application/xml) - */ - public function __construct(array $contentTypes = array('text/html', 'text/xml', 'application/xhtml+xml', 'application/xml')) - { - $this->contentTypes = $contentTypes; - } - - public function getName() - { - return 'esi'; - } - - /** - * Returns a new cache strategy instance. - * - * @return ResponseCacheStrategyInterface A ResponseCacheStrategyInterface instance - */ - public function createCacheStrategy() - { - return new ResponseCacheStrategy(); - } - - /** - * Checks that at least one surrogate has ESI/1.0 capability. - * - * @param Request $request A Request instance - * - * @return bool true if one surrogate has ESI/1.0 capability, false otherwise - */ - public function hasSurrogateCapability(Request $request) - { - if (null === $value = $request->headers->get('Surrogate-Capability')) { - return false; - } - - return false !== strpos($value, 'ESI/1.0'); - } - - /** - * Checks that at least one surrogate has ESI/1.0 capability. - * - * @param Request $request A Request instance - * - * @return bool true if one surrogate has ESI/1.0 capability, false otherwise - * - * @deprecated since version 2.6, to be removed in 3.0. Use hasSurrogateCapability() instead - */ - public function hasSurrogateEsiCapability(Request $request) - { - @trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the hasSurrogateCapability() method instead.', E_USER_DEPRECATED); - - return $this->hasSurrogateCapability($request); - } - - /** - * Adds ESI/1.0 capability to the given Request. - * - * @param Request $request A Request instance - */ - public function addSurrogateCapability(Request $request) - { - $current = $request->headers->get('Surrogate-Capability'); - $new = 'symfony2="ESI/1.0"'; - - $request->headers->set('Surrogate-Capability', $current ? $current.', '.$new : $new); - } - - /** - * Adds ESI/1.0 capability to the given Request. - * - * @param Request $request A Request instance - * - * @deprecated since version 2.6, to be removed in 3.0. Use addSurrogateCapability() instead - */ - public function addSurrogateEsiCapability(Request $request) - { - @trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the addSurrogateCapability() method instead.', E_USER_DEPRECATED); - - $this->addSurrogateCapability($request); - } - - /** - * Adds HTTP headers to specify that the Response needs to be parsed for ESI. - * - * This method only adds an ESI HTTP header if the Response has some ESI tags. - * - * @param Response $response A Response instance - */ - public function addSurrogateControl(Response $response) - { - if (false !== strpos($response->getContent(), 'headers->set('Surrogate-Control', 'content="ESI/1.0"'); - } - } - - /** - * Checks that the Response needs to be parsed for ESI tags. - * - * @param Response $response A Response instance - * - * @return bool true if the Response needs to be parsed, false otherwise - */ - public function needsParsing(Response $response) - { - if (!$control = $response->headers->get('Surrogate-Control')) { - return false; - } - - return (bool) preg_match('#content="[^"]*ESI/1.0[^"]*"#', $control); - } - - /** - * Checks that the Response needs to be parsed for ESI tags. - * - * @param Response $response A Response instance - * - * @return bool true if the Response needs to be parsed, false otherwise - * - * @deprecated since version 2.6, to be removed in 3.0. Use needsParsing() instead - */ - public function needsEsiParsing(Response $response) - { - @trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the needsParsing() method instead.', E_USER_DEPRECATED); - - return $this->needsParsing($response); - } - - /** - * Renders an ESI tag. - * - * @param string $uri A URI - * @param string $alt An alternate URI - * @param bool $ignoreErrors Whether to ignore errors or not - * @param string $comment A comment to add as an esi:include tag - * - * @return string - */ - public function renderIncludeTag($uri, $alt = null, $ignoreErrors = true, $comment = '') - { - $html = sprintf('', - $uri, - $ignoreErrors ? ' onerror="continue"' : '', - $alt ? sprintf(' alt="%s"', $alt) : '' - ); - - if (!empty($comment)) { - return sprintf("\n%s", $comment, $html); - } - - return $html; - } - - /** - * Replaces a Response ESI tags with the included resource content. - * - * @param Request $request A Request instance - * @param Response $response A Response instance - * - * @return Response - */ - public function process(Request $request, Response $response) - { - $this->request = $request; - $type = $response->headers->get('Content-Type'); - if (empty($type)) { - $type = 'text/html'; - } - - $parts = explode(';', $type); - if (!in_array($parts[0], $this->contentTypes)) { - return $response; - } - - // we don't use a proper XML parser here as we can have ESI tags in a plain text response - $content = $response->getContent(); - $content = preg_replace('#.*?#', '', $content); - $content = preg_replace('#]*(?:/|#', '', $content); - - $chunks = preg_split('##', $content, -1, PREG_SPLIT_DELIM_CAPTURE); - $chunks[0] = str_replace($this->phpEscapeMap[0], $this->phpEscapeMap[1], $chunks[0]); - - $i = 1; - while (isset($chunks[$i])) { - $options = array(); - preg_match_all('/(src|onerror|alt)="([^"]*?)"/', $chunks[$i], $matches, PREG_SET_ORDER); - foreach ($matches as $set) { - $options[$set[1]] = $set[2]; - } - - if (!isset($options['src'])) { - throw new \RuntimeException('Unable to process an ESI tag without a "src" attribute.'); - } - - $chunks[$i] = sprintf('surrogate->handle($this, %s, %s, %s) ?>'."\n", - var_export($options['src'], true), - var_export(isset($options['alt']) ? $options['alt'] : '', true), - isset($options['onerror']) && 'continue' == $options['onerror'] ? 'true' : 'false' - ); - ++$i; - $chunks[$i] = str_replace($this->phpEscapeMap[0], $this->phpEscapeMap[1], $chunks[$i]); - ++$i; - } - $content = implode('', $chunks); - - $response->setContent($content); - $response->headers->set('X-Body-Eval', 'ESI'); - - // remove ESI/1.0 from the Surrogate-Control header - if ($response->headers->has('Surrogate-Control')) { - $value = $response->headers->get('Surrogate-Control'); - if ('content="ESI/1.0"' == $value) { - $response->headers->remove('Surrogate-Control'); - } elseif (preg_match('#,\s*content="ESI/1.0"#', $value)) { - $response->headers->set('Surrogate-Control', preg_replace('#,\s*content="ESI/1.0"#', '', $value)); - } elseif (preg_match('#content="ESI/1.0",\s*#', $value)) { - $response->headers->set('Surrogate-Control', preg_replace('#content="ESI/1.0",\s*#', '', $value)); - } - } - } - - /** - * Handles an ESI from the cache. - * - * @param HttpCache $cache An HttpCache instance - * @param string $uri The main URI - * @param string $alt An alternative URI - * @param bool $ignoreErrors Whether to ignore errors or not - * - * @return string - * - * @throws \RuntimeException - * @throws \Exception - */ - public function handle(HttpCache $cache, $uri, $alt, $ignoreErrors) - { - $subRequest = Request::create($uri, 'get', array(), $cache->getRequest()->cookies->all(), array(), $cache->getRequest()->server->all()); - - try { - $response = $cache->handle($subRequest, HttpKernelInterface::SUB_REQUEST, true); - - if (!$response->isSuccessful()) { - throw new \RuntimeException(sprintf('Error when rendering "%s" (Status code is %s).', $subRequest->getUri(), $response->getStatusCode())); - } - - return $response->getContent(); - } catch (\Exception $e) { - if ($alt) { - return $this->handle($cache, $alt, '', $ignoreErrors); - } - - if (!$ignoreErrors) { - throw $e; - } - } - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/HttpCache/EsiResponseCacheStrategy.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/HttpCache/EsiResponseCacheStrategy.php deleted file mode 100644 index 636f60e..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/HttpCache/EsiResponseCacheStrategy.php +++ /dev/null @@ -1,33 +0,0 @@ - - * - * This code is partially based on the Rack-Cache library by Ryan Tomayko, - * which is released under the MIT license. - * (based on commit 02d2b48d75bcb63cf1c0c7149c077ad256542801) - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\HttpCache; - -@trigger_error('The '.__NAMESPACE__.'\EsiResponseCacheStrategy class is deprecated since version 2.6 and will be removed in 3.0. Use the Symfony\Component\HttpKernel\HttpCache\ResponseCacheStrategy class instead.', E_USER_DEPRECATED); - -/** - * EsiResponseCacheStrategy knows how to compute the Response cache HTTP header - * based on the different ESI response cache headers. - * - * This implementation changes the master response TTL to the smallest TTL received - * or force validation if one of the ESI has validation cache strategy. - * - * @author Fabien Potencier - * - * @deprecated since version 2.6, to be removed in 3.0. Use ResponseCacheStrategy instead - */ -class EsiResponseCacheStrategy extends ResponseCacheStrategy implements EsiResponseCacheStrategyInterface -{ -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/HttpCache/EsiResponseCacheStrategyInterface.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/HttpCache/EsiResponseCacheStrategyInterface.php deleted file mode 100644 index 2320867..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/HttpCache/EsiResponseCacheStrategyInterface.php +++ /dev/null @@ -1,30 +0,0 @@ - - * - * This code is partially based on the Rack-Cache library by Ryan Tomayko, - * which is released under the MIT license. - * (based on commit 02d2b48d75bcb63cf1c0c7149c077ad256542801) - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\HttpCache; - -@trigger_error('The '.__NAMESPACE__.'\EsiResponseCacheStrategyInterface class is deprecated since version 2.6 and will be removed in 3.0. Use the Symfony\Component\HttpKernel\HttpCache\ResponseCacheStrategyInterface class instead.', E_USER_DEPRECATED); - -/** - * ResponseCacheStrategyInterface implementations know how to compute the - * Response cache HTTP header based on the different response cache headers. - * - * @author Fabien Potencier - * - * @deprecated since version 2.6, to be removed in 3.0. Use ResponseCacheStrategyInterface instead. - */ -interface EsiResponseCacheStrategyInterface extends ResponseCacheStrategyInterface -{ -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/HttpCache/HttpCache.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/HttpCache/HttpCache.php deleted file mode 100644 index 445f59c..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/HttpCache/HttpCache.php +++ /dev/null @@ -1,711 +0,0 @@ - - * - * This code is partially based on the Rack-Cache library by Ryan Tomayko, - * which is released under the MIT license. - * (based on commit 02d2b48d75bcb63cf1c0c7149c077ad256542801) - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\HttpCache; - -use Symfony\Component\HttpKernel\HttpKernelInterface; -use Symfony\Component\HttpKernel\TerminableInterface; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; - -/** - * Cache provides HTTP caching. - * - * @author Fabien Potencier - * - * @api - */ -class HttpCache implements HttpKernelInterface, TerminableInterface -{ - private $kernel; - private $store; - private $request; - private $surrogate; - private $surrogateCacheStrategy; - private $options = array(); - private $traces = array(); - - /** - * Constructor. - * - * The available options are: - * - * * debug: If true, the traces are added as a HTTP header to ease debugging - * - * * default_ttl The number of seconds that a cache entry should be considered - * fresh when no explicit freshness information is provided in - * a response. Explicit Cache-Control or Expires headers - * override this value. (default: 0) - * - * * private_headers Set of request headers that trigger "private" cache-control behavior - * on responses that don't explicitly state whether the response is - * public or private via a Cache-Control directive. (default: Authorization and Cookie) - * - * * allow_reload Specifies whether the client can force a cache reload by including a - * Cache-Control "no-cache" directive in the request. Set it to ``true`` - * for compliance with RFC 2616. (default: false) - * - * * allow_revalidate Specifies whether the client can force a cache revalidate by including - * a Cache-Control "max-age=0" directive in the request. Set it to ``true`` - * for compliance with RFC 2616. (default: false) - * - * * stale_while_revalidate Specifies the default number of seconds (the granularity is the second as the - * Response TTL precision is a second) during which the cache can immediately return - * a stale response while it revalidates it in the background (default: 2). - * This setting is overridden by the stale-while-revalidate HTTP Cache-Control - * extension (see RFC 5861). - * - * * stale_if_error Specifies the default number of seconds (the granularity is the second) during which - * the cache can serve a stale response when an error is encountered (default: 60). - * This setting is overridden by the stale-if-error HTTP Cache-Control extension - * (see RFC 5861). - * - * @param HttpKernelInterface $kernel An HttpKernelInterface instance - * @param StoreInterface $store A Store instance - * @param SurrogateInterface $surrogate A SurrogateInterface instance - * @param array $options An array of options - */ - public function __construct(HttpKernelInterface $kernel, StoreInterface $store, SurrogateInterface $surrogate = null, array $options = array()) - { - $this->store = $store; - $this->kernel = $kernel; - $this->surrogate = $surrogate; - - // needed in case there is a fatal error because the backend is too slow to respond - register_shutdown_function(array($this->store, 'cleanup')); - - $this->options = array_merge(array( - 'debug' => false, - 'default_ttl' => 0, - 'private_headers' => array('Authorization', 'Cookie'), - 'allow_reload' => false, - 'allow_revalidate' => false, - 'stale_while_revalidate' => 2, - 'stale_if_error' => 60, - ), $options); - } - - /** - * Gets the current store. - * - * @return StoreInterface $store A StoreInterface instance - */ - public function getStore() - { - return $this->store; - } - - /** - * Returns an array of events that took place during processing of the last request. - * - * @return array An array of events - */ - public function getTraces() - { - return $this->traces; - } - - /** - * Returns a log message for the events of the last request processing. - * - * @return string A log message - */ - public function getLog() - { - $log = array(); - foreach ($this->traces as $request => $traces) { - $log[] = sprintf('%s: %s', $request, implode(', ', $traces)); - } - - return implode('; ', $log); - } - - /** - * Gets the Request instance associated with the master request. - * - * @return Request A Request instance - */ - public function getRequest() - { - return $this->request; - } - - /** - * Gets the Kernel instance. - * - * @return HttpKernelInterface An HttpKernelInterface instance - */ - public function getKernel() - { - return $this->kernel; - } - - /** - * Gets the Surrogate instance. - * - * @throws \LogicException - * @return SurrogateInterface A Surrogate instance - */ - public function getSurrogate() - { - return $this->getEsi(); - } - - /** - * Gets the Esi instance. - * - * @throws \LogicException - * - * @return Esi An Esi instance - * - * @deprecated since version 2.6, to be removed in 3.0. Use getSurrogate() instead - */ - public function getEsi() - { - @trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the getSurrogate() method instead.', E_USER_DEPRECATED); - - if (!$this->surrogate instanceof Esi) { - throw new \LogicException('This instance of HttpCache was not set up to use ESI as surrogate handler. You must overwrite and use createSurrogate'); - } - - return $this->surrogate; - } - - /** - * {@inheritdoc} - * - * @api - */ - public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true) - { - // FIXME: catch exceptions and implement a 500 error page here? -> in Varnish, there is a built-in error page mechanism - if (HttpKernelInterface::MASTER_REQUEST === $type) { - $this->traces = array(); - $this->request = $request; - if (null !== $this->surrogate) { - $this->surrogateCacheStrategy = $this->surrogate->createCacheStrategy(); - } - } - - $path = $request->getPathInfo(); - if ($qs = $request->getQueryString()) { - $path .= '?'.$qs; - } - $this->traces[$request->getMethod().' '.$path] = array(); - - if (!$request->isMethodSafe()) { - $response = $this->invalidate($request, $catch); - } elseif ($request->headers->has('expect')) { - $response = $this->pass($request, $catch); - } else { - $response = $this->lookup($request, $catch); - } - - $this->restoreResponseBody($request, $response); - - $response->setDate(new \DateTime(null, new \DateTimeZone('UTC'))); - - if (HttpKernelInterface::MASTER_REQUEST === $type && $this->options['debug']) { - $response->headers->set('X-Symfony-Cache', $this->getLog()); - } - - if (null !== $this->surrogate) { - if (HttpKernelInterface::MASTER_REQUEST === $type) { - $this->surrogateCacheStrategy->update($response); - } else { - $this->surrogateCacheStrategy->add($response); - } - } - - $response->prepare($request); - - $response->isNotModified($request); - - return $response; - } - - /** - * {@inheritdoc} - * - * @api - */ - public function terminate(Request $request, Response $response) - { - if ($this->getKernel() instanceof TerminableInterface) { - $this->getKernel()->terminate($request, $response); - } - } - - /** - * Forwards the Request to the backend without storing the Response in the cache. - * - * @param Request $request A Request instance - * @param bool $catch Whether to process exceptions - * - * @return Response A Response instance - */ - protected function pass(Request $request, $catch = false) - { - $this->record($request, 'pass'); - - return $this->forward($request, $catch); - } - - /** - * Invalidates non-safe methods (like POST, PUT, and DELETE). - * - * @param Request $request A Request instance - * @param bool $catch Whether to process exceptions - * - * @return Response A Response instance - * - * @throws \Exception - * - * @see RFC2616 13.10 - */ - protected function invalidate(Request $request, $catch = false) - { - $response = $this->pass($request, $catch); - - // invalidate only when the response is successful - if ($response->isSuccessful() || $response->isRedirect()) { - try { - $this->store->invalidate($request, $catch); - - // As per the RFC, invalidate Location and Content-Location URLs if present - foreach (array('Location', 'Content-Location') as $header) { - if ($uri = $response->headers->get($header)) { - $subRequest = Request::create($uri, 'get', array(), array(), array(), $request->server->all()); - - $this->store->invalidate($subRequest); - } - } - - $this->record($request, 'invalidate'); - } catch (\Exception $e) { - $this->record($request, 'invalidate-failed'); - - if ($this->options['debug']) { - throw $e; - } - } - } - - return $response; - } - - /** - * Lookups a Response from the cache for the given Request. - * - * When a matching cache entry is found and is fresh, it uses it as the - * response without forwarding any request to the backend. When a matching - * cache entry is found but is stale, it attempts to "validate" the entry with - * the backend using conditional GET. When no matching cache entry is found, - * it triggers "miss" processing. - * - * @param Request $request A Request instance - * @param bool $catch whether to process exceptions - * - * @return Response A Response instance - * - * @throws \Exception - */ - protected function lookup(Request $request, $catch = false) - { - // if allow_reload and no-cache Cache-Control, allow a cache reload - if ($this->options['allow_reload'] && $request->isNoCache()) { - $this->record($request, 'reload'); - - return $this->fetch($request, $catch); - } - - try { - $entry = $this->store->lookup($request); - } catch (\Exception $e) { - $this->record($request, 'lookup-failed'); - - if ($this->options['debug']) { - throw $e; - } - - return $this->pass($request, $catch); - } - - if (null === $entry) { - $this->record($request, 'miss'); - - return $this->fetch($request, $catch); - } - - if (!$this->isFreshEnough($request, $entry)) { - $this->record($request, 'stale'); - - return $this->validate($request, $entry, $catch); - } - - $this->record($request, 'fresh'); - - $entry->headers->set('Age', $entry->getAge()); - - return $entry; - } - - /** - * Validates that a cache entry is fresh. - * - * The original request is used as a template for a conditional - * GET request with the backend. - * - * @param Request $request A Request instance - * @param Response $entry A Response instance to validate - * @param bool $catch Whether to process exceptions - * - * @return Response A Response instance - */ - protected function validate(Request $request, Response $entry, $catch = false) - { - $subRequest = clone $request; - - // send no head requests because we want content - $subRequest->setMethod('GET'); - - // add our cached last-modified validator - $subRequest->headers->set('if_modified_since', $entry->headers->get('Last-Modified')); - - // Add our cached etag validator to the environment. - // We keep the etags from the client to handle the case when the client - // has a different private valid entry which is not cached here. - $cachedEtags = $entry->getEtag() ? array($entry->getEtag()) : array(); - $requestEtags = $request->getETags(); - if ($etags = array_unique(array_merge($cachedEtags, $requestEtags))) { - $subRequest->headers->set('if_none_match', implode(', ', $etags)); - } - - $response = $this->forward($subRequest, $catch, $entry); - - if (304 == $response->getStatusCode()) { - $this->record($request, 'valid'); - - // return the response and not the cache entry if the response is valid but not cached - $etag = $response->getEtag(); - if ($etag && in_array($etag, $requestEtags) && !in_array($etag, $cachedEtags)) { - return $response; - } - - $entry = clone $entry; - $entry->headers->remove('Date'); - - foreach (array('Date', 'Expires', 'Cache-Control', 'ETag', 'Last-Modified') as $name) { - if ($response->headers->has($name)) { - $entry->headers->set($name, $response->headers->get($name)); - } - } - - $response = $entry; - } else { - $this->record($request, 'invalid'); - } - - if ($response->isCacheable()) { - $this->store($request, $response); - } - - return $response; - } - - /** - * Forwards the Request to the backend and determines whether the response should be stored. - * - * This methods is triggered when the cache missed or a reload is required. - * - * @param Request $request A Request instance - * @param bool $catch whether to process exceptions - * - * @return Response A Response instance - */ - protected function fetch(Request $request, $catch = false) - { - $subRequest = clone $request; - - // send no head requests because we want content - $subRequest->setMethod('GET'); - - // avoid that the backend sends no content - $subRequest->headers->remove('if_modified_since'); - $subRequest->headers->remove('if_none_match'); - - $response = $this->forward($subRequest, $catch); - - if ($response->isCacheable()) { - $this->store($request, $response); - } - - return $response; - } - - /** - * Forwards the Request to the backend and returns the Response. - * - * @param Request $request A Request instance - * @param bool $catch Whether to catch exceptions or not - * @param Response $entry A Response instance (the stale entry if present, null otherwise) - * - * @return Response A Response instance - */ - protected function forward(Request $request, $catch = false, Response $entry = null) - { - if ($this->surrogate) { - $this->surrogate->addSurrogateCapability($request); - } - - // modify the X-Forwarded-For header if needed - $forwardedFor = $request->headers->get('X-Forwarded-For'); - if ($forwardedFor) { - $request->headers->set('X-Forwarded-For', $forwardedFor.', '.$request->server->get('REMOTE_ADDR')); - } else { - $request->headers->set('X-Forwarded-For', $request->server->get('REMOTE_ADDR')); - } - - // fix the client IP address by setting it to 127.0.0.1 as HttpCache - // is always called from the same process as the backend. - $request->server->set('REMOTE_ADDR', '127.0.0.1'); - - // make sure HttpCache is a trusted proxy - if (!in_array('127.0.0.1', $trustedProxies = Request::getTrustedProxies())) { - $trustedProxies[] = '127.0.0.1'; - Request::setTrustedProxies($trustedProxies); - } - - // always a "master" request (as the real master request can be in cache) - $response = $this->kernel->handle($request, HttpKernelInterface::MASTER_REQUEST, $catch); - // FIXME: we probably need to also catch exceptions if raw === true - - // we don't implement the stale-if-error on Requests, which is nonetheless part of the RFC - if (null !== $entry && in_array($response->getStatusCode(), array(500, 502, 503, 504))) { - if (null === $age = $entry->headers->getCacheControlDirective('stale-if-error')) { - $age = $this->options['stale_if_error']; - } - - if (abs($entry->getTtl()) < $age) { - $this->record($request, 'stale-if-error'); - - return $entry; - } - } - - $this->processResponseBody($request, $response); - - if ($this->isPrivateRequest($request) && !$response->headers->hasCacheControlDirective('public')) { - $response->setPrivate(true); - } elseif ($this->options['default_ttl'] > 0 && null === $response->getTtl() && !$response->headers->getCacheControlDirective('must-revalidate')) { - $response->setTtl($this->options['default_ttl']); - } - - return $response; - } - - /** - * Checks whether the cache entry is "fresh enough" to satisfy the Request. - * - * @param Request $request A Request instance - * @param Response $entry A Response instance - * - * @return bool true if the cache entry if fresh enough, false otherwise - */ - protected function isFreshEnough(Request $request, Response $entry) - { - if (!$entry->isFresh()) { - return $this->lock($request, $entry); - } - - if ($this->options['allow_revalidate'] && null !== $maxAge = $request->headers->getCacheControlDirective('max-age')) { - return $maxAge > 0 && $maxAge >= $entry->getAge(); - } - - return true; - } - - /** - * Locks a Request during the call to the backend. - * - * @param Request $request A Request instance - * @param Response $entry A Response instance - * - * @return bool true if the cache entry can be returned even if it is staled, false otherwise - */ - protected function lock(Request $request, Response $entry) - { - // try to acquire a lock to call the backend - $lock = $this->store->lock($request); - - // there is already another process calling the backend - if (true !== $lock) { - // check if we can serve the stale entry - if (null === $age = $entry->headers->getCacheControlDirective('stale-while-revalidate')) { - $age = $this->options['stale_while_revalidate']; - } - - if (abs($entry->getTtl()) < $age) { - $this->record($request, 'stale-while-revalidate'); - - // server the stale response while there is a revalidation - return true; - } - - // wait for the lock to be released - $wait = 0; - while ($this->store->isLocked($request) && $wait < 5000000) { - usleep(50000); - $wait += 50000; - } - - if ($wait < 2000000) { - // replace the current entry with the fresh one - $new = $this->lookup($request); - $entry->headers = $new->headers; - $entry->setContent($new->getContent()); - $entry->setStatusCode($new->getStatusCode()); - $entry->setProtocolVersion($new->getProtocolVersion()); - foreach ($new->headers->getCookies() as $cookie) { - $entry->headers->setCookie($cookie); - } - } else { - // backend is slow as hell, send a 503 response (to avoid the dog pile effect) - $entry->setStatusCode(503); - $entry->setContent('503 Service Unavailable'); - $entry->headers->set('Retry-After', 10); - } - - return true; - } - - // we have the lock, call the backend - return false; - } - - /** - * Writes the Response to the cache. - * - * @param Request $request A Request instance - * @param Response $response A Response instance - * - * @throws \Exception - */ - protected function store(Request $request, Response $response) - { - try { - $this->store->write($request, $response); - - $this->record($request, 'store'); - - $response->headers->set('Age', $response->getAge()); - } catch (\Exception $e) { - $this->record($request, 'store-failed'); - - if ($this->options['debug']) { - throw $e; - } - } - - // now that the response is cached, release the lock - $this->store->unlock($request); - } - - /** - * Restores the Response body. - * - * @param Request $request A Request instance - * @param Response $response A Response instance - */ - private function restoreResponseBody(Request $request, Response $response) - { - if ($request->isMethod('HEAD') || 304 === $response->getStatusCode()) { - $response->setContent(null); - $response->headers->remove('X-Body-Eval'); - $response->headers->remove('X-Body-File'); - - return; - } - - if ($response->headers->has('X-Body-Eval')) { - ob_start(); - - if ($response->headers->has('X-Body-File')) { - include $response->headers->get('X-Body-File'); - } else { - eval('; ?>'.$response->getContent().'setContent(ob_get_clean()); - $response->headers->remove('X-Body-Eval'); - if (!$response->headers->has('Transfer-Encoding')) { - $response->headers->set('Content-Length', strlen($response->getContent())); - } - } elseif ($response->headers->has('X-Body-File')) { - $response->setContent(file_get_contents($response->headers->get('X-Body-File'))); - } else { - return; - } - - $response->headers->remove('X-Body-File'); - } - - protected function processResponseBody(Request $request, Response $response) - { - if (null !== $this->surrogate && $this->surrogate->needsParsing($response)) { - $this->surrogate->process($request, $response); - } - } - - /** - * Checks if the Request includes authorization or other sensitive information - * that should cause the Response to be considered private by default. - * - * @param Request $request A Request instance - * - * @return bool true if the Request is private, false otherwise - */ - private function isPrivateRequest(Request $request) - { - foreach ($this->options['private_headers'] as $key) { - $key = strtolower(str_replace('HTTP_', '', $key)); - - if ('cookie' === $key) { - if (count($request->cookies->all())) { - return true; - } - } elseif ($request->headers->has($key)) { - return true; - } - } - - return false; - } - - /** - * Records that an event took place. - * - * @param Request $request A Request instance - * @param string $event The event name - */ - private function record(Request $request, $event) - { - $path = $request->getPathInfo(); - if ($qs = $request->getQueryString()) { - $path .= '?'.$qs; - } - $this->traces[$request->getMethod().' '.$path][] = $event; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/HttpCache/ResponseCacheStrategy.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/HttpCache/ResponseCacheStrategy.php deleted file mode 100644 index d22dff1..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/HttpCache/ResponseCacheStrategy.php +++ /dev/null @@ -1,85 +0,0 @@ - - * - * This code is partially based on the Rack-Cache library by Ryan Tomayko, - * which is released under the MIT license. - * (based on commit 02d2b48d75bcb63cf1c0c7149c077ad256542801) - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\HttpCache; - -use Symfony\Component\HttpFoundation\Response; - -/** - * ResponseCacheStrategy knows how to compute the Response cache HTTP header - * based on the different response cache headers. - * - * This implementation changes the master response TTL to the smallest TTL received - * or force validation if one of the surrogates has validation cache strategy. - * - * @author Fabien Potencier - */ -class ResponseCacheStrategy implements ResponseCacheStrategyInterface -{ - private $cacheable = true; - private $embeddedResponses = 0; - private $ttls = array(); - private $maxAges = array(); - - /** - * {@inheritdoc} - */ - public function add(Response $response) - { - if ($response->isValidateable()) { - $this->cacheable = false; - } else { - $this->ttls[] = $response->getTtl(); - $this->maxAges[] = $response->getMaxAge(); - } - - $this->embeddedResponses++; - } - - /** - * {@inheritdoc} - */ - public function update(Response $response) - { - // if we have no embedded Response, do nothing - if (0 === $this->embeddedResponses) { - return; - } - - // Remove validation related headers in order to avoid browsers using - // their own cache, because some of the response content comes from - // at least one embedded response (which likely has a different caching strategy). - if ($response->isValidateable()) { - $response->setEtag(null); - $response->setLastModified(null); - $this->cacheable = false; - } - - if (!$this->cacheable) { - $response->headers->set('Cache-Control', 'no-cache, must-revalidate'); - - return; - } - - $this->ttls[] = $response->getTtl(); - $this->maxAges[] = $response->getMaxAge(); - - if (null !== $maxAge = min($this->maxAges)) { - $response->setSharedMaxAge($maxAge); - $response->headers->set('Age', $maxAge - min($this->ttls)); - } - $response->setMaxAge(0); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/HttpCache/ResponseCacheStrategyInterface.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/HttpCache/ResponseCacheStrategyInterface.php deleted file mode 100644 index d70c2e0..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/HttpCache/ResponseCacheStrategyInterface.php +++ /dev/null @@ -1,41 +0,0 @@ - - * - * This code is partially based on the Rack-Cache library by Ryan Tomayko, - * which is released under the MIT license. - * (based on commit 02d2b48d75bcb63cf1c0c7149c077ad256542801) - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\HttpCache; - -use Symfony\Component\HttpFoundation\Response; - -/** - * ResponseCacheStrategyInterface implementations know how to compute the - * Response cache HTTP header based on the different response cache headers. - * - * @author Fabien Potencier - */ -interface ResponseCacheStrategyInterface -{ - /** - * Adds a Response. - * - * @param Response $response - */ - public function add(Response $response); - - /** - * Updates the Response HTTP headers based on the embedded Responses. - * - * @param Response $response - */ - public function update(Response $response); -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/HttpCache/Ssi.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/HttpCache/Ssi.php deleted file mode 100644 index 7bb54cf..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/HttpCache/Ssi.php +++ /dev/null @@ -1,195 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\HttpCache; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\HttpKernelInterface; - -/** - * Ssi implements the SSI capabilities to Request and Response instances. - * - * @author Sebastian Krebs - */ -class Ssi implements SurrogateInterface -{ - private $contentTypes; - private $phpEscapeMap = array( - array('', '', '', ''), - ); - - /** - * Constructor. - * - * @param array $contentTypes An array of content-type that should be parsed for SSI information. - * (default: text/html, text/xml, application/xhtml+xml, and application/xml) - */ - public function __construct(array $contentTypes = array('text/html', 'text/xml', 'application/xhtml+xml', 'application/xml')) - { - $this->contentTypes = $contentTypes; - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return 'ssi'; - } - - /** - * {@inheritdoc} - */ - public function createCacheStrategy() - { - return new ResponseCacheStrategy(); - } - - /** - * {@inheritdoc} - */ - public function hasSurrogateCapability(Request $request) - { - if (null === $value = $request->headers->get('Surrogate-Capability')) { - return false; - } - - return false !== strpos($value, 'SSI/1.0'); - } - - /** - * {@inheritdoc} - */ - public function addSurrogateCapability(Request $request) - { - $current = $request->headers->get('Surrogate-Capability'); - $new = 'symfony2="SSI/1.0"'; - - $request->headers->set('Surrogate-Capability', $current ? $current.', '.$new : $new); - } - - /** - * {@inheritdoc} - */ - public function addSurrogateControl(Response $response) - { - if (false !== strpos($response->getContent(), '', $uri); - } - - /** - * {@inheritdoc} - */ - public function process(Request $request, Response $response) - { - $this->request = $request; - $type = $response->headers->get('Content-Type'); - if (empty($type)) { - $type = 'text/html'; - } - - $parts = explode(';', $type); - if (!in_array($parts[0], $this->contentTypes)) { - return $response; - } - - // we don't use a proper XML parser here as we can have SSI tags in a plain text response - $content = $response->getContent(); - - $chunks = preg_split('##', $content, -1, PREG_SPLIT_DELIM_CAPTURE); - $chunks[0] = str_replace($this->phpEscapeMap[0], $this->phpEscapeMap[1], $chunks[0]); - - $i = 1; - while (isset($chunks[$i])) { - $options = array(); - preg_match_all('/(virtual)="([^"]*?)"/', $chunks[$i], $matches, PREG_SET_ORDER); - foreach ($matches as $set) { - $options[$set[1]] = $set[2]; - } - - if (!isset($options['virtual'])) { - throw new \RuntimeException('Unable to process an SSI tag without a "virtual" attribute.'); - } - - $chunks[$i] = sprintf('surrogate->handle($this, %s, \'\', false) ?>'."\n", - var_export($options['virtual'], true) - ); - ++$i; - $chunks[$i] = str_replace($this->phpEscapeMap[0], $this->phpEscapeMap[1], $chunks[$i]); - ++$i; - } - $content = implode('', $chunks); - - $response->setContent($content); - $response->headers->set('X-Body-Eval', 'SSI'); - - // remove SSI/1.0 from the Surrogate-Control header - if ($response->headers->has('Surrogate-Control')) { - $value = $response->headers->get('Surrogate-Control'); - if ('content="SSI/1.0"' == $value) { - $response->headers->remove('Surrogate-Control'); - } elseif (preg_match('#,\s*content="SSI/1.0"#', $value)) { - $response->headers->set('Surrogate-Control', preg_replace('#,\s*content="SSI/1.0"#', '', $value)); - } elseif (preg_match('#content="SSI/1.0",\s*#', $value)) { - $response->headers->set('Surrogate-Control', preg_replace('#content="SSI/1.0",\s*#', '', $value)); - } - } - } - - /** - * {@inheritdoc} - */ - public function handle(HttpCache $cache, $uri, $alt, $ignoreErrors) - { - $subRequest = Request::create($uri, 'get', array(), $cache->getRequest()->cookies->all(), array(), $cache->getRequest()->server->all()); - - try { - $response = $cache->handle($subRequest, HttpKernelInterface::SUB_REQUEST, true); - - if (!$response->isSuccessful()) { - throw new \RuntimeException(sprintf('Error when rendering "%s" (Status code is %s).', $subRequest->getUri(), $response->getStatusCode())); - } - - return $response->getContent(); - } catch (\Exception $e) { - if ($alt) { - return $this->handle($cache, $alt, '', $ignoreErrors); - } - - if (!$ignoreErrors) { - throw $e; - } - } - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/HttpCache/Store.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/HttpCache/Store.php deleted file mode 100644 index 044d14e..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/HttpCache/Store.php +++ /dev/null @@ -1,449 +0,0 @@ - - * - * This code is partially based on the Rack-Cache library by Ryan Tomayko, - * which is released under the MIT license. - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\HttpCache; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; - -/** - * Store implements all the logic for storing cache metadata (Request and Response headers). - * - * @author Fabien Potencier - */ -class Store implements StoreInterface -{ - protected $root; - private $keyCache; - private $locks; - - /** - * Constructor. - * - * @param string $root The path to the cache directory - */ - public function __construct($root) - { - $this->root = $root; - if (!is_dir($this->root)) { - mkdir($this->root, 0777, true); - } - $this->keyCache = new \SplObjectStorage(); - $this->locks = array(); - } - - /** - * Cleanups storage. - */ - public function cleanup() - { - // unlock everything - foreach ($this->locks as $lock) { - if (file_exists($lock)) { - @unlink($lock); - } - } - - $error = error_get_last(); - if (1 === $error['type'] && false === headers_sent()) { - // send a 503 - header('HTTP/1.0 503 Service Unavailable'); - header('Retry-After: 10'); - echo '503 Service Unavailable'; - } - } - - /** - * Locks the cache for a given Request. - * - * @param Request $request A Request instance - * - * @return bool|string true if the lock is acquired, the path to the current lock otherwise - */ - public function lock(Request $request) - { - $path = $this->getPath($this->getCacheKey($request).'.lck'); - if (!is_dir(dirname($path)) && false === @mkdir(dirname($path), 0777, true)) { - return false; - } - - $lock = @fopen($path, 'x'); - if (false !== $lock) { - fclose($lock); - - $this->locks[] = $path; - - return true; - } - - return !file_exists($path) ?: $path; - } - - /** - * Releases the lock for the given Request. - * - * @param Request $request A Request instance - * - * @return bool False if the lock file does not exist or cannot be unlocked, true otherwise - */ - public function unlock(Request $request) - { - $file = $this->getPath($this->getCacheKey($request).'.lck'); - - return is_file($file) ? @unlink($file) : false; - } - - public function isLocked(Request $request) - { - return is_file($this->getPath($this->getCacheKey($request).'.lck')); - } - - /** - * Locates a cached Response for the Request provided. - * - * @param Request $request A Request instance - * - * @return Response|null A Response instance, or null if no cache entry was found - */ - public function lookup(Request $request) - { - $key = $this->getCacheKey($request); - - if (!$entries = $this->getMetadata($key)) { - return; - } - - // find a cached entry that matches the request. - $match = null; - foreach ($entries as $entry) { - if ($this->requestsMatch(isset($entry[1]['vary'][0]) ? implode(', ', $entry[1]['vary']) : '', $request->headers->all(), $entry[0])) { - $match = $entry; - - break; - } - } - - if (null === $match) { - return; - } - - list($req, $headers) = $match; - if (is_file($body = $this->getPath($headers['x-content-digest'][0]))) { - return $this->restoreResponse($headers, $body); - } - - // TODO the metaStore referenced an entity that doesn't exist in - // the entityStore. We definitely want to return nil but we should - // also purge the entry from the meta-store when this is detected. - } - - /** - * Writes a cache entry to the store for the given Request and Response. - * - * Existing entries are read and any that match the response are removed. This - * method calls write with the new list of cache entries. - * - * @param Request $request A Request instance - * @param Response $response A Response instance - * - * @return string The key under which the response is stored - * - * @throws \RuntimeException - */ - public function write(Request $request, Response $response) - { - $key = $this->getCacheKey($request); - $storedEnv = $this->persistRequest($request); - - // write the response body to the entity store if this is the original response - if (!$response->headers->has('X-Content-Digest')) { - $digest = $this->generateContentDigest($response); - - if (false === $this->save($digest, $response->getContent())) { - throw new \RuntimeException('Unable to store the entity.'); - } - - $response->headers->set('X-Content-Digest', $digest); - - if (!$response->headers->has('Transfer-Encoding')) { - $response->headers->set('Content-Length', strlen($response->getContent())); - } - } - - // read existing cache entries, remove non-varying, and add this one to the list - $entries = array(); - $vary = $response->headers->get('vary'); - foreach ($this->getMetadata($key) as $entry) { - if (!isset($entry[1]['vary'][0])) { - $entry[1]['vary'] = array(''); - } - - if ($vary != $entry[1]['vary'][0] || !$this->requestsMatch($vary, $entry[0], $storedEnv)) { - $entries[] = $entry; - } - } - - $headers = $this->persistResponse($response); - unset($headers['age']); - - array_unshift($entries, array($storedEnv, $headers)); - - if (false === $this->save($key, serialize($entries))) { - throw new \RuntimeException('Unable to store the metadata.'); - } - - return $key; - } - - /** - * Returns content digest for $response. - * - * @param Response $response - * - * @return string - */ - protected function generateContentDigest(Response $response) - { - return 'en'.hash('sha256', $response->getContent()); - } - - /** - * Invalidates all cache entries that match the request. - * - * @param Request $request A Request instance - * - * @throws \RuntimeException - */ - public function invalidate(Request $request) - { - $modified = false; - $key = $this->getCacheKey($request); - - $entries = array(); - foreach ($this->getMetadata($key) as $entry) { - $response = $this->restoreResponse($entry[1]); - if ($response->isFresh()) { - $response->expire(); - $modified = true; - $entries[] = array($entry[0], $this->persistResponse($response)); - } else { - $entries[] = $entry; - } - } - - if ($modified) { - if (false === $this->save($key, serialize($entries))) { - throw new \RuntimeException('Unable to store the metadata.'); - } - } - } - - /** - * Determines whether two Request HTTP header sets are non-varying based on - * the vary response header value provided. - * - * @param string $vary A Response vary header - * @param array $env1 A Request HTTP header array - * @param array $env2 A Request HTTP header array - * - * @return bool true if the two environments match, false otherwise - */ - private function requestsMatch($vary, $env1, $env2) - { - if (empty($vary)) { - return true; - } - - foreach (preg_split('/[\s,]+/', $vary) as $header) { - $key = strtr(strtolower($header), '_', '-'); - $v1 = isset($env1[$key]) ? $env1[$key] : null; - $v2 = isset($env2[$key]) ? $env2[$key] : null; - if ($v1 !== $v2) { - return false; - } - } - - return true; - } - - /** - * Gets all data associated with the given key. - * - * Use this method only if you know what you are doing. - * - * @param string $key The store key - * - * @return array An array of data associated with the key - */ - private function getMetadata($key) - { - if (false === $entries = $this->load($key)) { - return array(); - } - - return unserialize($entries); - } - - /** - * Purges data for the given URL. - * - * @param string $url A URL - * - * @return bool true if the URL exists and has been purged, false otherwise - */ - public function purge($url) - { - if (is_file($path = $this->getPath($this->getCacheKey(Request::create($url))))) { - unlink($path); - - return true; - } - - return false; - } - - /** - * Loads data for the given key. - * - * @param string $key The store key - * - * @return string The data associated with the key - */ - private function load($key) - { - $path = $this->getPath($key); - - return is_file($path) ? file_get_contents($path) : false; - } - - /** - * Save data for the given key. - * - * @param string $key The store key - * @param string $data The data to store - * - * @return bool - */ - private function save($key, $data) - { - $path = $this->getPath($key); - if (!is_dir(dirname($path)) && false === @mkdir(dirname($path), 0777, true)) { - return false; - } - - $tmpFile = tempnam(dirname($path), basename($path)); - if (false === $fp = @fopen($tmpFile, 'wb')) { - return false; - } - @fwrite($fp, $data); - @fclose($fp); - - if ($data != file_get_contents($tmpFile)) { - return false; - } - - if (false === @rename($tmpFile, $path)) { - return false; - } - - @chmod($path, 0666 & ~umask()); - } - - public function getPath($key) - { - return $this->root.DIRECTORY_SEPARATOR.substr($key, 0, 2).DIRECTORY_SEPARATOR.substr($key, 2, 2).DIRECTORY_SEPARATOR.substr($key, 4, 2).DIRECTORY_SEPARATOR.substr($key, 6); - } - - /** - * Generates a cache key for the given Request. - * - * This method should return a key that must only depend on a - * normalized version of the request URI. - * - * If the same URI can have more than one representation, based on some - * headers, use a Vary header to indicate them, and each representation will - * be stored independently under the same cache key. - * - * @param Request $request A Request instance - * - * @return string A key for the given Request - */ - protected function generateCacheKey(Request $request) - { - return 'md'.hash('sha256', $request->getUri()); - } - - /** - * Returns a cache key for the given Request. - * - * @param Request $request A Request instance - * - * @return string A key for the given Request - */ - private function getCacheKey(Request $request) - { - if (isset($this->keyCache[$request])) { - return $this->keyCache[$request]; - } - - return $this->keyCache[$request] = $this->generateCacheKey($request); - } - - /** - * Persists the Request HTTP headers. - * - * @param Request $request A Request instance - * - * @return array An array of HTTP headers - */ - private function persistRequest(Request $request) - { - return $request->headers->all(); - } - - /** - * Persists the Response HTTP headers. - * - * @param Response $response A Response instance - * - * @return array An array of HTTP headers - */ - private function persistResponse(Response $response) - { - $headers = $response->headers->all(); - $headers['X-Status'] = array($response->getStatusCode()); - - return $headers; - } - - /** - * Restores a Response from the HTTP headers and body. - * - * @param array $headers An array of HTTP headers for the Response - * @param string $body The Response body - * - * @return Response - */ - private function restoreResponse($headers, $body = null) - { - $status = $headers['X-Status'][0]; - unset($headers['X-Status']); - - if (null !== $body) { - $headers['X-Body-File'] = array($body); - } - - return new Response($body, $status, $headers); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/HttpCache/StoreInterface.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/HttpCache/StoreInterface.php deleted file mode 100644 index ddc0c04..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/HttpCache/StoreInterface.php +++ /dev/null @@ -1,96 +0,0 @@ - - * - * This code is partially based on the Rack-Cache library by Ryan Tomayko, - * which is released under the MIT license. - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\HttpCache; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; - -/** - * Interface implemented by HTTP cache stores. - * - * @author Fabien Potencier - */ -interface StoreInterface -{ - /** - * Locates a cached Response for the Request provided. - * - * @param Request $request A Request instance - * - * @return Response|null A Response instance, or null if no cache entry was found - */ - public function lookup(Request $request); - - /** - * Writes a cache entry to the store for the given Request and Response. - * - * Existing entries are read and any that match the response are removed. This - * method calls write with the new list of cache entries. - * - * @param Request $request A Request instance - * @param Response $response A Response instance - * - * @return string The key under which the response is stored - */ - public function write(Request $request, Response $response); - - /** - * Invalidates all cache entries that match the request. - * - * @param Request $request A Request instance - */ - public function invalidate(Request $request); - - /** - * Locks the cache for a given Request. - * - * @param Request $request A Request instance - * - * @return bool|string true if the lock is acquired, the path to the current lock otherwise - */ - public function lock(Request $request); - - /** - * Releases the lock for the given Request. - * - * @param Request $request A Request instance - * - * @return bool False if the lock file does not exist or cannot be unlocked, true otherwise - */ - public function unlock(Request $request); - - /** - * Returns whether or not a lock exists. - * - * @param Request $request A Request instance - * - * @return bool true if lock exists, false otherwise - */ - public function isLocked(Request $request); - - /** - * Purges data for the given URL. - * - * @param string $url A URL - * - * @return bool true if the URL exists and has been purged, false otherwise - */ - public function purge($url); - - /** - * Cleanups storage. - */ - public function cleanup(); -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/HttpCache/SurrogateInterface.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/HttpCache/SurrogateInterface.php deleted file mode 100644 index 46b788d..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/HttpCache/SurrogateInterface.php +++ /dev/null @@ -1,103 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\HttpCache; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; - -interface SurrogateInterface -{ - /** - * Returns surrogate name - * - * @return string - */ - public function getName(); - - /** - * Returns a new cache strategy instance. - * - * @return ResponseCacheStrategyInterface A ResponseCacheStrategyInterface instance - */ - public function createCacheStrategy(); - - /** - * Checks that at least one surrogate has Surrogate capability. - * - * @param Request $request A Request instance - * - * @return bool true if one surrogate has Surrogate capability, false otherwise - */ - public function hasSurrogateCapability(Request $request); - - /** - * Adds Surrogate-capability to the given Request. - * - * @param Request $request A Request instance - */ - public function addSurrogateCapability(Request $request); - - /** - * Adds HTTP headers to specify that the Response needs to be parsed for Surrogate. - * - * This method only adds an Surrogate HTTP header if the Response has some Surrogate tags. - * - * @param Response $response A Response instance - */ - public function addSurrogateControl(Response $response); - - /** - * Checks that the Response needs to be parsed for Surrogate tags. - * - * @param Response $response A Response instance - * - * @return bool true if the Response needs to be parsed, false otherwise - */ - public function needsParsing(Response $response); - - /** - * Renders a Surrogate tag. - * - * @param string $uri A URI - * @param string $alt An alternate URI - * @param bool $ignoreErrors Whether to ignore errors or not - * @param string $comment A comment to add as an esi:include tag - * - * @return string - */ - public function renderIncludeTag($uri, $alt = null, $ignoreErrors = true, $comment = ''); - - /** - * Replaces a Response Surrogate tags with the included resource content. - * - * @param Request $request A Request instance - * @param Response $response A Response instance - * - * @return Response - */ - public function process(Request $request, Response $response); - - /** - * Handles a Surrogate from the cache. - * - * @param HttpCache $cache An HttpCache instance - * @param string $uri The main URI - * @param string $alt An alternative URI - * @param bool $ignoreErrors Whether to ignore errors or not - * - * @return string - * - * @throws \RuntimeException - * @throws \Exception - */ - public function handle(HttpCache $cache, $uri, $alt, $ignoreErrors); -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/HttpKernel.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/HttpKernel.php deleted file mode 100644 index 473f780..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/HttpKernel.php +++ /dev/null @@ -1,293 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel; - -use Symfony\Component\HttpKernel\Controller\ControllerResolverInterface; -use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; -use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface; -use Symfony\Component\HttpKernel\Event\FilterControllerEvent; -use Symfony\Component\HttpKernel\Event\FilterResponseEvent; -use Symfony\Component\HttpKernel\Event\FinishRequestEvent; -use Symfony\Component\HttpKernel\Event\GetResponseEvent; -use Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent; -use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; -use Symfony\Component\HttpKernel\Event\PostResponseEvent; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\RequestStack; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\EventDispatcher\EventDispatcherInterface; - -/** - * HttpKernel notifies events to convert a Request object to a Response one. - * - * @author Fabien Potencier - * - * @api - */ -class HttpKernel implements HttpKernelInterface, TerminableInterface -{ - protected $dispatcher; - protected $resolver; - protected $requestStack; - - /** - * Constructor. - * - * @param EventDispatcherInterface $dispatcher An EventDispatcherInterface instance - * @param ControllerResolverInterface $resolver A ControllerResolverInterface instance - * @param RequestStack $requestStack A stack for master/sub requests - * - * @api - */ - public function __construct(EventDispatcherInterface $dispatcher, ControllerResolverInterface $resolver, RequestStack $requestStack = null) - { - $this->dispatcher = $dispatcher; - $this->resolver = $resolver; - $this->requestStack = $requestStack ?: new RequestStack(); - } - - /** - * {@inheritdoc} - * - * @api - */ - public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true) - { - $request->headers->set('X-Php-Ob-Level', ob_get_level()); - - try { - return $this->handleRaw($request, $type); - } catch (\Exception $e) { - if (false === $catch) { - $this->finishRequest($request, $type); - - throw $e; - } - - return $this->handleException($e, $request, $type); - } - } - - /** - * {@inheritdoc} - * - * @api - */ - public function terminate(Request $request, Response $response) - { - $this->dispatcher->dispatch(KernelEvents::TERMINATE, new PostResponseEvent($this, $request, $response)); - } - - /** - * @throws \LogicException If the request stack is empty - * - * @internal - */ - public function terminateWithException(\Exception $exception) - { - if (!$request = $this->requestStack->getMasterRequest()) { - throw new \LogicException('Request stack is empty', 0, $exception); - } - - $response = $this->handleException($exception, $request, self::MASTER_REQUEST); - - $response->sendHeaders(); - $response->sendContent(); - - $this->terminate($request, $response); - } - - /** - * Handles a request to convert it to a response. - * - * Exceptions are not caught. - * - * @param Request $request A Request instance - * @param int $type The type of the request (one of HttpKernelInterface::MASTER_REQUEST or HttpKernelInterface::SUB_REQUEST) - * - * @return Response A Response instance - * - * @throws \LogicException If one of the listener does not behave as expected - * @throws NotFoundHttpException When controller cannot be found - */ - private function handleRaw(Request $request, $type = self::MASTER_REQUEST) - { - $this->requestStack->push($request); - - // request - $event = new GetResponseEvent($this, $request, $type); - $this->dispatcher->dispatch(KernelEvents::REQUEST, $event); - - if ($event->hasResponse()) { - return $this->filterResponse($event->getResponse(), $request, $type); - } - - // load controller - if (false === $controller = $this->resolver->getController($request)) { - throw new NotFoundHttpException(sprintf('Unable to find the controller for path "%s". The route is wrongly configured.', $request->getPathInfo())); - } - - $event = new FilterControllerEvent($this, $controller, $request, $type); - $this->dispatcher->dispatch(KernelEvents::CONTROLLER, $event); - $controller = $event->getController(); - - // controller arguments - $arguments = $this->resolver->getArguments($request, $controller); - - // call controller - $response = call_user_func_array($controller, $arguments); - - // view - if (!$response instanceof Response) { - $event = new GetResponseForControllerResultEvent($this, $request, $type, $response); - $this->dispatcher->dispatch(KernelEvents::VIEW, $event); - - if ($event->hasResponse()) { - $response = $event->getResponse(); - } - - if (!$response instanceof Response) { - $msg = sprintf('The controller must return a response (%s given).', $this->varToString($response)); - - // the user may have forgotten to return something - if (null === $response) { - $msg .= ' Did you forget to add a return statement somewhere in your controller?'; - } - throw new \LogicException($msg); - } - } - - return $this->filterResponse($response, $request, $type); - } - - /** - * Filters a response object. - * - * @param Response $response A Response instance - * @param Request $request An error message in case the response is not a Response object - * @param int $type The type of the request (one of HttpKernelInterface::MASTER_REQUEST or HttpKernelInterface::SUB_REQUEST) - * - * @return Response The filtered Response instance - * - * @throws \RuntimeException if the passed object is not a Response instance - */ - private function filterResponse(Response $response, Request $request, $type) - { - $event = new FilterResponseEvent($this, $request, $type, $response); - - $this->dispatcher->dispatch(KernelEvents::RESPONSE, $event); - - $this->finishRequest($request, $type); - - return $event->getResponse(); - } - - /** - * Publishes the finish request event, then pop the request from the stack. - * - * Note that the order of the operations is important here, otherwise - * operations such as {@link RequestStack::getParentRequest()} can lead to - * weird results. - * - * @param Request $request - * @param int $type - */ - private function finishRequest(Request $request, $type) - { - $this->dispatcher->dispatch(KernelEvents::FINISH_REQUEST, new FinishRequestEvent($this, $request, $type)); - $this->requestStack->pop(); - } - - /** - * Handles an exception by trying to convert it to a Response. - * - * @param \Exception $e An \Exception instance - * @param Request $request A Request instance - * @param int $type The type of the request - * - * @return Response A Response instance - * - * @throws \Exception - */ - private function handleException(\Exception $e, $request, $type) - { - $event = new GetResponseForExceptionEvent($this, $request, $type, $e); - $this->dispatcher->dispatch(KernelEvents::EXCEPTION, $event); - - // a listener might have replaced the exception - $e = $event->getException(); - - if (!$event->hasResponse()) { - $this->finishRequest($request, $type); - - throw $e; - } - - $response = $event->getResponse(); - - // the developer asked for a specific status code - if ($response->headers->has('X-Status-Code')) { - $response->setStatusCode($response->headers->get('X-Status-Code')); - - $response->headers->remove('X-Status-Code'); - } elseif (!$response->isClientError() && !$response->isServerError() && !$response->isRedirect()) { - // ensure that we actually have an error response - if ($e instanceof HttpExceptionInterface) { - // keep the HTTP status code and headers - $response->setStatusCode($e->getStatusCode()); - $response->headers->add($e->getHeaders()); - } else { - $response->setStatusCode(500); - } - } - - try { - return $this->filterResponse($response, $request, $type); - } catch (\Exception $e) { - return $response; - } - } - - private function varToString($var) - { - if (is_object($var)) { - return sprintf('Object(%s)', get_class($var)); - } - - if (is_array($var)) { - $a = array(); - foreach ($var as $k => $v) { - $a[] = sprintf('%s => %s', $k, $this->varToString($v)); - } - - return sprintf('Array(%s)', implode(', ', $a)); - } - - if (is_resource($var)) { - return sprintf('Resource(%s)', get_resource_type($var)); - } - - if (null === $var) { - return 'null'; - } - - if (false === $var) { - return 'false'; - } - - if (true === $var) { - return 'true'; - } - - return (string) $var; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/HttpKernelInterface.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/HttpKernelInterface.php deleted file mode 100644 index d09da6b..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/HttpKernelInterface.php +++ /dev/null @@ -1,47 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; - -/** - * HttpKernelInterface handles a Request to convert it to a Response. - * - * @author Fabien Potencier - * - * @api - */ -interface HttpKernelInterface -{ - const MASTER_REQUEST = 1; - const SUB_REQUEST = 2; - - /** - * Handles a Request to convert it to a Response. - * - * When $catch is true, the implementation must catch all exceptions - * and do its best to convert them to a Response instance. - * - * @param Request $request A Request instance - * @param int $type The type of the request - * (one of HttpKernelInterface::MASTER_REQUEST or HttpKernelInterface::SUB_REQUEST) - * @param bool $catch Whether to catch exceptions or not - * - * @return Response A Response instance - * - * @throws \Exception When an Exception occurs during processing - * - * @api - */ - public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true); -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Kernel.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/Kernel.php deleted file mode 100644 index 25e5d3b..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Kernel.php +++ /dev/null @@ -1,797 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel; - -use Symfony\Bridge\ProxyManager\LazyProxy\Instantiator\RuntimeInstantiator; -use Symfony\Bridge\ProxyManager\LazyProxy\PhpDumper\ProxyDumper; -use Symfony\Component\DependencyInjection\ContainerInterface; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Dumper\PhpDumper; -use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; -use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; -use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; -use Symfony\Component\DependencyInjection\Loader\IniFileLoader; -use Symfony\Component\DependencyInjection\Loader\PhpFileLoader; -use Symfony\Component\DependencyInjection\Loader\ClosureLoader; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\Bundle\BundleInterface; -use Symfony\Component\HttpKernel\Config\EnvParametersResource; -use Symfony\Component\HttpKernel\Config\FileLocator; -use Symfony\Component\HttpKernel\DependencyInjection\MergeExtensionConfigurationPass; -use Symfony\Component\HttpKernel\DependencyInjection\AddClassesToCachePass; -use Symfony\Component\Config\Loader\LoaderResolver; -use Symfony\Component\Config\Loader\DelegatingLoader; -use Symfony\Component\Config\ConfigCache; -use Symfony\Component\ClassLoader\ClassCollectionLoader; - -/** - * The Kernel is the heart of the Symfony system. - * - * It manages an environment made of bundles. - * - * @author Fabien Potencier - * - * @api - */ -abstract class Kernel implements KernelInterface, TerminableInterface -{ - /** - * @var BundleInterface[] - */ - protected $bundles = array(); - - protected $bundleMap; - protected $container; - protected $rootDir; - protected $environment; - protected $debug; - protected $booted = false; - protected $name; - protected $startTime; - protected $loadClassCache; - - const VERSION = '2.7.1'; - const VERSION_ID = '20701'; - const MAJOR_VERSION = '2'; - const MINOR_VERSION = '7'; - const RELEASE_VERSION = '1'; - const EXTRA_VERSION = ''; - - const END_OF_MAINTENANCE = '05/2018'; - const END_OF_LIFE = '05/2019'; - - /** - * Constructor. - * - * @param string $environment The environment - * @param bool $debug Whether to enable debugging or not - * - * @api - */ - public function __construct($environment, $debug) - { - $this->environment = $environment; - $this->debug = (bool) $debug; - $this->rootDir = $this->getRootDir(); - $this->name = $this->getName(); - - if ($this->debug) { - $this->startTime = microtime(true); - } - - $defClass = new \ReflectionMethod($this, 'init'); - $defClass = $defClass->getDeclaringClass()->name; - - if (__CLASS__ !== $defClass) { - @trigger_error(sprintf('Calling the %s::init() method is deprecated since version 2.3 and will be removed in 3.0. Move your logic to the constructor method instead.', $defClass), E_USER_DEPRECATED); - $this->init(); - } - } - - /** - * @deprecated since version 2.3, to be removed in 3.0. Move your logic in the constructor instead. - */ - public function init() - { - @trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0. Move your logic to the constructor method instead.', E_USER_DEPRECATED); - } - - public function __clone() - { - if ($this->debug) { - $this->startTime = microtime(true); - } - - $this->booted = false; - $this->container = null; - } - - /** - * Boots the current kernel. - * - * @api - */ - public function boot() - { - if (true === $this->booted) { - return; - } - - if ($this->loadClassCache) { - $this->doLoadClassCache($this->loadClassCache[0], $this->loadClassCache[1]); - } - - // init bundles - $this->initializeBundles(); - - // init container - $this->initializeContainer(); - - foreach ($this->getBundles() as $bundle) { - $bundle->setContainer($this->container); - $bundle->boot(); - } - - $this->booted = true; - } - - /** - * {@inheritdoc} - * - * @api - */ - public function terminate(Request $request, Response $response) - { - if (false === $this->booted) { - return; - } - - if ($this->getHttpKernel() instanceof TerminableInterface) { - $this->getHttpKernel()->terminate($request, $response); - } - } - - /** - * {@inheritdoc} - * - * @api - */ - public function shutdown() - { - if (false === $this->booted) { - return; - } - - $this->booted = false; - - foreach ($this->getBundles() as $bundle) { - $bundle->shutdown(); - $bundle->setContainer(null); - } - - $this->container = null; - } - - /** - * {@inheritdoc} - * - * @api - */ - public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true) - { - if (false === $this->booted) { - $this->boot(); - } - - return $this->getHttpKernel()->handle($request, $type, $catch); - } - - /** - * Gets a HTTP kernel from the container. - * - * @return HttpKernel - */ - protected function getHttpKernel() - { - return $this->container->get('http_kernel'); - } - - /** - * {@inheritdoc} - * - * @api - */ - public function getBundles() - { - return $this->bundles; - } - - /** - * {@inheritdoc} - * - * @api - * - * @deprecated since version 2.6, to be removed in 3.0. - */ - public function isClassInActiveBundle($class) - { - @trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in version 3.0.', E_USER_DEPRECATED); - - foreach ($this->getBundles() as $bundle) { - if (0 === strpos($class, $bundle->getNamespace())) { - return true; - } - } - - return false; - } - - /** - * {@inheritdoc} - * - * @api - */ - public function getBundle($name, $first = true) - { - if (!isset($this->bundleMap[$name])) { - throw new \InvalidArgumentException(sprintf('Bundle "%s" does not exist or it is not enabled. Maybe you forgot to add it in the registerBundles() method of your %s.php file?', $name, get_class($this))); - } - - if (true === $first) { - return $this->bundleMap[$name][0]; - } - - return $this->bundleMap[$name]; - } - - /** - * {@inheritdoc} - * - * @throws \RuntimeException if a custom resource is hidden by a resource in a derived bundle - */ - public function locateResource($name, $dir = null, $first = true) - { - if ('@' !== $name[0]) { - throw new \InvalidArgumentException(sprintf('A resource name must start with @ ("%s" given).', $name)); - } - - if (false !== strpos($name, '..')) { - throw new \RuntimeException(sprintf('File name "%s" contains invalid characters (..).', $name)); - } - - $bundleName = substr($name, 1); - $path = ''; - if (false !== strpos($bundleName, '/')) { - list($bundleName, $path) = explode('/', $bundleName, 2); - } - - $isResource = 0 === strpos($path, 'Resources') && null !== $dir; - $overridePath = substr($path, 9); - $resourceBundle = null; - $bundles = $this->getBundle($bundleName, false); - $files = array(); - - foreach ($bundles as $bundle) { - if ($isResource && file_exists($file = $dir.'/'.$bundle->getName().$overridePath)) { - if (null !== $resourceBundle) { - throw new \RuntimeException(sprintf('"%s" resource is hidden by a resource from the "%s" derived bundle. Create a "%s" file to override the bundle resource.', - $file, - $resourceBundle, - $dir.'/'.$bundles[0]->getName().$overridePath - )); - } - - if ($first) { - return $file; - } - $files[] = $file; - } - - if (file_exists($file = $bundle->getPath().'/'.$path)) { - if ($first && !$isResource) { - return $file; - } - $files[] = $file; - $resourceBundle = $bundle->getName(); - } - } - - if (count($files) > 0) { - return $first && $isResource ? $files[0] : $files; - } - - throw new \InvalidArgumentException(sprintf('Unable to find file "%s".', $name)); - } - - /** - * {@inheritdoc} - * - * @api - */ - public function getName() - { - if (null === $this->name) { - $this->name = preg_replace('/[^a-zA-Z0-9_]+/', '', basename($this->rootDir)); - } - - return $this->name; - } - - /** - * {@inheritdoc} - * - * @api - */ - public function getEnvironment() - { - return $this->environment; - } - - /** - * {@inheritdoc} - * - * @api - */ - public function isDebug() - { - return $this->debug; - } - - /** - * {@inheritdoc} - * - * @api - */ - public function getRootDir() - { - if (null === $this->rootDir) { - $r = new \ReflectionObject($this); - $this->rootDir = str_replace('\\', '/', dirname($r->getFileName())); - } - - return $this->rootDir; - } - - /** - * {@inheritdoc} - * - * @api - */ - public function getContainer() - { - return $this->container; - } - - /** - * Loads the PHP class cache. - * - * This methods only registers the fact that you want to load the cache classes. - * The cache will actually only be loaded when the Kernel is booted. - * - * That optimization is mainly useful when using the HttpCache class in which - * case the class cache is not loaded if the Response is in the cache. - * - * @param string $name The cache name prefix - * @param string $extension File extension of the resulting file - */ - public function loadClassCache($name = 'classes', $extension = '.php') - { - $this->loadClassCache = array($name, $extension); - } - - /** - * Used internally. - */ - public function setClassCache(array $classes) - { - file_put_contents($this->getCacheDir().'/classes.map', sprintf('debug ? $this->startTime : -INF; - } - - /** - * {@inheritdoc} - * - * @api - */ - public function getCacheDir() - { - return $this->rootDir.'/cache/'.$this->environment; - } - - /** - * {@inheritdoc} - * - * @api - */ - public function getLogDir() - { - return $this->rootDir.'/logs'; - } - - /** - * {@inheritdoc} - * - * @api - */ - public function getCharset() - { - return 'UTF-8'; - } - - protected function doLoadClassCache($name, $extension) - { - if (!$this->booted && is_file($this->getCacheDir().'/classes.map')) { - ClassCollectionLoader::load(include($this->getCacheDir().'/classes.map'), $this->getCacheDir(), $name, $this->debug, false, $extension); - } - } - - /** - * Initializes the data structures related to the bundle management. - * - * - the bundles property maps a bundle name to the bundle instance, - * - the bundleMap property maps a bundle name to the bundle inheritance hierarchy (most derived bundle first). - * - * @throws \LogicException if two bundles share a common name - * @throws \LogicException if a bundle tries to extend a non-registered bundle - * @throws \LogicException if a bundle tries to extend itself - * @throws \LogicException if two bundles extend the same ancestor - */ - protected function initializeBundles() - { - // init bundles - $this->bundles = array(); - $topMostBundles = array(); - $directChildren = array(); - - foreach ($this->registerBundles() as $bundle) { - $name = $bundle->getName(); - if (isset($this->bundles[$name])) { - throw new \LogicException(sprintf('Trying to register two bundles with the same name "%s"', $name)); - } - $this->bundles[$name] = $bundle; - - if ($parentName = $bundle->getParent()) { - if (isset($directChildren[$parentName])) { - throw new \LogicException(sprintf('Bundle "%s" is directly extended by two bundles "%s" and "%s".', $parentName, $name, $directChildren[$parentName])); - } - if ($parentName == $name) { - throw new \LogicException(sprintf('Bundle "%s" can not extend itself.', $name)); - } - $directChildren[$parentName] = $name; - } else { - $topMostBundles[$name] = $bundle; - } - } - - // look for orphans - if (!empty($directChildren) && count($diff = array_diff_key($directChildren, $this->bundles))) { - $diff = array_keys($diff); - - throw new \LogicException(sprintf('Bundle "%s" extends bundle "%s", which is not registered.', $directChildren[$diff[0]], $diff[0])); - } - - // inheritance - $this->bundleMap = array(); - foreach ($topMostBundles as $name => $bundle) { - $bundleMap = array($bundle); - $hierarchy = array($name); - - while (isset($directChildren[$name])) { - $name = $directChildren[$name]; - array_unshift($bundleMap, $this->bundles[$name]); - $hierarchy[] = $name; - } - - foreach ($hierarchy as $bundle) { - $this->bundleMap[$bundle] = $bundleMap; - array_pop($bundleMap); - } - } - } - - /** - * Gets the container class. - * - * @return string The container class - */ - protected function getContainerClass() - { - return $this->name.ucfirst($this->environment).($this->debug ? 'Debug' : '').'ProjectContainer'; - } - - /** - * Gets the container's base class. - * - * All names except Container must be fully qualified. - * - * @return string - */ - protected function getContainerBaseClass() - { - return 'Container'; - } - - /** - * Initializes the service container. - * - * The cached version of the service container is used when fresh, otherwise the - * container is built. - */ - protected function initializeContainer() - { - $class = $this->getContainerClass(); - $cache = new ConfigCache($this->getCacheDir().'/'.$class.'.php', $this->debug); - $fresh = true; - if (!$cache->isFresh()) { - $container = $this->buildContainer(); - $container->compile(); - $this->dumpContainer($cache, $container, $class, $this->getContainerBaseClass()); - - $fresh = false; - } - - require_once $cache->getPath(); - - $this->container = new $class(); - $this->container->set('kernel', $this); - - if (!$fresh && $this->container->has('cache_warmer')) { - $this->container->get('cache_warmer')->warmUp($this->container->getParameter('kernel.cache_dir')); - } - } - - /** - * Returns the kernel parameters. - * - * @return array An array of kernel parameters - */ - protected function getKernelParameters() - { - $bundles = array(); - foreach ($this->bundles as $name => $bundle) { - $bundles[$name] = get_class($bundle); - } - - return array_merge( - array( - 'kernel.root_dir' => realpath($this->rootDir) ?: $this->rootDir, - 'kernel.environment' => $this->environment, - 'kernel.debug' => $this->debug, - 'kernel.name' => $this->name, - 'kernel.cache_dir' => realpath($this->getCacheDir()) ?: $this->getCacheDir(), - 'kernel.logs_dir' => realpath($this->getLogDir()) ?: $this->getLogDir(), - 'kernel.bundles' => $bundles, - 'kernel.charset' => $this->getCharset(), - 'kernel.container_class' => $this->getContainerClass(), - ), - $this->getEnvParameters() - ); - } - - /** - * Gets the environment parameters. - * - * Only the parameters starting with "SYMFONY__" are considered. - * - * @return array An array of parameters - */ - protected function getEnvParameters() - { - $parameters = array(); - foreach ($_SERVER as $key => $value) { - if (0 === strpos($key, 'SYMFONY__')) { - $parameters[strtolower(str_replace('__', '.', substr($key, 9)))] = $value; - } - } - - return $parameters; - } - - /** - * Builds the service container. - * - * @return ContainerBuilder The compiled service container - * - * @throws \RuntimeException - */ - protected function buildContainer() - { - foreach (array('cache' => $this->getCacheDir(), 'logs' => $this->getLogDir()) as $name => $dir) { - if (!is_dir($dir)) { - if (false === @mkdir($dir, 0777, true) && !is_dir($dir)) { - throw new \RuntimeException(sprintf("Unable to create the %s directory (%s)\n", $name, $dir)); - } - } elseif (!is_writable($dir)) { - throw new \RuntimeException(sprintf("Unable to write in the %s directory (%s)\n", $name, $dir)); - } - } - - $container = $this->getContainerBuilder(); - $container->addObjectResource($this); - $this->prepareContainer($container); - - if (null !== $cont = $this->registerContainerConfiguration($this->getContainerLoader($container))) { - $container->merge($cont); - } - - $container->addCompilerPass(new AddClassesToCachePass($this)); - $container->addResource(new EnvParametersResource('SYMFONY__')); - - return $container; - } - - /** - * Prepares the ContainerBuilder before it is compiled. - * - * @param ContainerBuilder $container A ContainerBuilder instance - */ - protected function prepareContainer(ContainerBuilder $container) - { - $extensions = array(); - foreach ($this->bundles as $bundle) { - if ($extension = $bundle->getContainerExtension()) { - $container->registerExtension($extension); - $extensions[] = $extension->getAlias(); - } - - if ($this->debug) { - $container->addObjectResource($bundle); - } - } - foreach ($this->bundles as $bundle) { - $bundle->build($container); - } - - // ensure these extensions are implicitly loaded - $container->getCompilerPassConfig()->setMergePass(new MergeExtensionConfigurationPass($extensions)); - } - - /** - * Gets a new ContainerBuilder instance used to build the service container. - * - * @return ContainerBuilder - */ - protected function getContainerBuilder() - { - $container = new ContainerBuilder(new ParameterBag($this->getKernelParameters())); - - if (class_exists('ProxyManager\Configuration') && class_exists('Symfony\Bridge\ProxyManager\LazyProxy\Instantiator\RuntimeInstantiator')) { - $container->setProxyInstantiator(new RuntimeInstantiator()); - } - - return $container; - } - - /** - * Dumps the service container to PHP code in the cache. - * - * @param ConfigCache $cache The config cache - * @param ContainerBuilder $container The service container - * @param string $class The name of the class to generate - * @param string $baseClass The name of the container's base class - */ - protected function dumpContainer(ConfigCache $cache, ContainerBuilder $container, $class, $baseClass) - { - // cache the container - $dumper = new PhpDumper($container); - - if (class_exists('ProxyManager\Configuration') && class_exists('Symfony\Bridge\ProxyManager\LazyProxy\PhpDumper\ProxyDumper')) { - $dumper->setProxyDumper(new ProxyDumper(md5($cache->getPath()))); - } - - $content = $dumper->dump(array('class' => $class, 'base_class' => $baseClass, 'file' => $cache->getPath())); - if (!$this->debug) { - $content = static::stripComments($content); - } - - $cache->write($content, $container->getResources()); - } - - /** - * Returns a loader for the container. - * - * @param ContainerInterface $container The service container - * - * @return DelegatingLoader The loader - */ - protected function getContainerLoader(ContainerInterface $container) - { - $locator = new FileLocator($this); - $resolver = new LoaderResolver(array( - new XmlFileLoader($container, $locator), - new YamlFileLoader($container, $locator), - new IniFileLoader($container, $locator), - new PhpFileLoader($container, $locator), - new ClosureLoader($container), - )); - - return new DelegatingLoader($resolver); - } - - /** - * Removes comments from a PHP source string. - * - * We don't use the PHP php_strip_whitespace() function - * as we want the content to be readable and well-formatted. - * - * @param string $source A PHP string - * - * @return string The PHP string with the comments removed - */ - public static function stripComments($source) - { - if (!function_exists('token_get_all')) { - return $source; - } - - $rawChunk = ''; - $output = ''; - $tokens = token_get_all($source); - $ignoreSpace = false; - for (reset($tokens); false !== $token = current($tokens); next($tokens)) { - if (is_string($token)) { - $rawChunk .= $token; - } elseif (T_START_HEREDOC === $token[0]) { - $output .= $rawChunk.$token[1]; - do { - $token = next($tokens); - $output .= $token[1]; - } while ($token[0] !== T_END_HEREDOC); - $rawChunk = ''; - } elseif (T_WHITESPACE === $token[0]) { - if ($ignoreSpace) { - $ignoreSpace = false; - - continue; - } - - // replace multiple new lines with a single newline - $rawChunk .= preg_replace(array('/\n{2,}/S'), "\n", $token[1]); - } elseif (in_array($token[0], array(T_COMMENT, T_DOC_COMMENT))) { - $ignoreSpace = true; - } else { - $rawChunk .= $token[1]; - - // The PHP-open tag already has a new-line - if (T_OPEN_TAG === $token[0]) { - $ignoreSpace = true; - } - } - } - - $output .= $rawChunk; - - return $output; - } - - public function serialize() - { - return serialize(array($this->environment, $this->debug)); - } - - public function unserialize($data) - { - list($environment, $debug) = unserialize($data); - - $this->__construct($environment, $debug); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/KernelEvents.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/KernelEvents.php deleted file mode 100644 index e259af5..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/KernelEvents.php +++ /dev/null @@ -1,127 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel; - -/** - * Contains all events thrown in the HttpKernel component. - * - * @author Bernhard Schussek - * - * @api - */ -final class KernelEvents -{ - /** - * The REQUEST event occurs at the very beginning of request - * dispatching. - * - * This event allows you to create a response for a request before any - * other code in the framework is executed. The event listener method - * receives a Symfony\Component\HttpKernel\Event\GetResponseEvent - * instance. - * - * @Event - * - * @var string - * - * @api - */ - const REQUEST = 'kernel.request'; - - /** - * The EXCEPTION event occurs when an uncaught exception appears. - * - * This event allows you to create a response for a thrown exception or - * to modify the thrown exception. The event listener method receives - * a Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent - * instance. - * - * @Event - * - * @var string - * - * @api - */ - const EXCEPTION = 'kernel.exception'; - - /** - * The VIEW event occurs when the return value of a controller - * is not a Response instance. - * - * This event allows you to create a response for the return value of the - * controller. The event listener method receives a - * Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent - * instance. - * - * @Event - * - * @var string - * - * @api - */ - const VIEW = 'kernel.view'; - - /** - * The CONTROLLER event occurs once a controller was found for - * handling a request. - * - * This event allows you to change the controller that will handle the - * request. The event listener method receives a - * Symfony\Component\HttpKernel\Event\FilterControllerEvent instance. - * - * @Event - * - * @var string - * - * @api - */ - const CONTROLLER = 'kernel.controller'; - - /** - * The RESPONSE event occurs once a response was created for - * replying to a request. - * - * This event allows you to modify or replace the response that will be - * replied. The event listener method receives a - * Symfony\Component\HttpKernel\Event\FilterResponseEvent instance. - * - * @Event - * - * @var string - * - * @api - */ - const RESPONSE = 'kernel.response'; - - /** - * The TERMINATE event occurs once a response was sent. - * - * This event allows you to run expensive post-response jobs. - * The event listener method receives a - * Symfony\Component\HttpKernel\Event\PostResponseEvent instance. - * - * @Event - * - * @var string - */ - const TERMINATE = 'kernel.terminate'; - - /** - * The FINISH_REQUEST event occurs when a response was generated for a request. - * - * This event allows you to reset the global and environmental state of - * the application, when it was changed during the request. - * - * @var string - */ - const FINISH_REQUEST = 'kernel.finish_request'; -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/KernelInterface.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/KernelInterface.php deleted file mode 100644 index 06c3c0c..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/KernelInterface.php +++ /dev/null @@ -1,211 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel; - -use Symfony\Component\DependencyInjection\ContainerInterface; -use Symfony\Component\HttpKernel\Bundle\BundleInterface; -use Symfony\Component\Config\Loader\LoaderInterface; - -/** - * The Kernel is the heart of the Symfony system. - * - * It manages an environment made of bundles. - * - * @author Fabien Potencier - * - * @api - */ -interface KernelInterface extends HttpKernelInterface, \Serializable -{ - /** - * Returns an array of bundles to register. - * - * @return BundleInterface[] An array of bundle instances. - * - * @api - */ - public function registerBundles(); - - /** - * Loads the container configuration. - * - * @param LoaderInterface $loader A LoaderInterface instance - * - * @api - */ - public function registerContainerConfiguration(LoaderInterface $loader); - - /** - * Boots the current kernel. - * - * @api - */ - public function boot(); - - /** - * Shutdowns the kernel. - * - * This method is mainly useful when doing functional testing. - * - * @api - */ - public function shutdown(); - - /** - * Gets the registered bundle instances. - * - * @return BundleInterface[] An array of registered bundle instances - * - * @api - */ - public function getBundles(); - - /** - * Checks if a given class name belongs to an active bundle. - * - * @param string $class A class name - * - * @return bool true if the class belongs to an active bundle, false otherwise - * - * @api - * - * @deprecated since version 2.6, to be removed in 3.0. - */ - public function isClassInActiveBundle($class); - - /** - * Returns a bundle and optionally its descendants by its name. - * - * @param string $name Bundle name - * @param bool $first Whether to return the first bundle only or together with its descendants - * - * @return BundleInterface|BundleInterface[] A BundleInterface instance or an array of BundleInterface instances if $first is false - * - * @throws \InvalidArgumentException when the bundle is not enabled - * - * @api - */ - public function getBundle($name, $first = true); - - /** - * Returns the file path for a given resource. - * - * A Resource can be a file or a directory. - * - * The resource name must follow the following pattern: - * - * "@BundleName/path/to/a/file.something" - * - * where BundleName is the name of the bundle - * and the remaining part is the relative path in the bundle. - * - * If $dir is passed, and the first segment of the path is "Resources", - * this method will look for a file named: - * - * $dir//path/without/Resources - * - * before looking in the bundle resource folder. - * - * @param string $name A resource name to locate - * @param string $dir A directory where to look for the resource first - * @param bool $first Whether to return the first path or paths for all matching bundles - * - * @return string|array The absolute path of the resource or an array if $first is false - * - * @throws \InvalidArgumentException if the file cannot be found or the name is not valid - * @throws \RuntimeException if the name contains invalid/unsafe characters - * - * @api - */ - public function locateResource($name, $dir = null, $first = true); - - /** - * Gets the name of the kernel. - * - * @return string The kernel name - * - * @api - */ - public function getName(); - - /** - * Gets the environment. - * - * @return string The current environment - * - * @api - */ - public function getEnvironment(); - - /** - * Checks if debug mode is enabled. - * - * @return bool true if debug mode is enabled, false otherwise - * - * @api - */ - public function isDebug(); - - /** - * Gets the application root dir. - * - * @return string The application root dir - * - * @api - */ - public function getRootDir(); - - /** - * Gets the current container. - * - * @return ContainerInterface A ContainerInterface instance - * - * @api - */ - public function getContainer(); - - /** - * Gets the request start time (not available if debug is disabled). - * - * @return int The request start timestamp - * - * @api - */ - public function getStartTime(); - - /** - * Gets the cache directory. - * - * @return string The cache directory - * - * @api - */ - public function getCacheDir(); - - /** - * Gets the log directory. - * - * @return string The log directory - * - * @api - */ - public function getLogDir(); - - /** - * Gets the charset of the application. - * - * @return string The charset - * - * @api - */ - public function getCharset(); -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/LICENSE b/sitecake/2.2.9/server/vendor/symfony/http-kernel/LICENSE deleted file mode 100644 index 43028bc..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2004-2015 Fabien Potencier - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Log/DebugLoggerInterface.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/Log/DebugLoggerInterface.php deleted file mode 100644 index 5635a21..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Log/DebugLoggerInterface.php +++ /dev/null @@ -1,38 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Log; - -/** - * DebugLoggerInterface. - * - * @author Fabien Potencier - */ -interface DebugLoggerInterface -{ - /** - * Returns an array of logs. - * - * A log is an array with the following mandatory keys: - * timestamp, message, priority, and priorityName. - * It can also have an optional context key containing an array. - * - * @return array An array of logs - */ - public function getLogs(); - - /** - * Returns the number of errors. - * - * @return int The number of errors - */ - public function countErrors(); -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Log/LoggerInterface.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/Log/LoggerInterface.php deleted file mode 100644 index 737ba4e..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Log/LoggerInterface.php +++ /dev/null @@ -1,54 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Log; - -use Psr\Log\LoggerInterface as PsrLogger; - -/** - * LoggerInterface. - * - * @author Fabien Potencier - * - * @deprecated since version 2.2, to be removed in 3.0. Type-hint \Psr\Log\LoggerInterface instead. - * - * @api - */ -interface LoggerInterface extends PsrLogger -{ - /** - * @api - * - * @deprecated since version 2.2, to be removed in 3.0. Use emergency() which is PSR-3 compatible. - */ - public function emerg($message, array $context = array()); - - /** - * @api - * - * @deprecated since version 2.2, to be removed in 3.0. Use critical() which is PSR-3 compatible. - */ - public function crit($message, array $context = array()); - - /** - * @api - * - * @deprecated since version 2.2, to be removed in 3.0. Use error() which is PSR-3 compatible. - */ - public function err($message, array $context = array()); - - /** - * @api - * - * @deprecated since version 2.2, to be removed in 3.0. Use warning() which is PSR-3 compatible. - */ - public function warn($message, array $context = array()); -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Log/NullLogger.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/Log/NullLogger.php deleted file mode 100644 index b9e3ac4..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Log/NullLogger.php +++ /dev/null @@ -1,58 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Log; - -@trigger_error('The '.__NAMESPACE__.'\NullLogger class is deprecated since version 2.2 and will be removed in 3.0. Use the Psr\Log\NullLogger class instead from the psr/log Composer package.', E_USER_DEPRECATED); - -use Psr\Log\NullLogger as PsrNullLogger; - -/** - * NullLogger. - * - * @author Fabien Potencier - * - * @api - */ -class NullLogger extends PsrNullLogger implements LoggerInterface -{ - /** - * @api - */ - public function emerg($message, array $context = array()) - { - @trigger_error('The '.__METHOD__.' method is deprecated since version 2.2 and will be removed in 3.0. You should use the new emergency() method instead, which is PSR-3 compatible.', E_USER_DEPRECATED); - } - - /** - * @api - */ - public function crit($message, array $context = array()) - { - @trigger_error('The '.__METHOD__.' method is deprecated since version 2.2 and will be removed in 3.0. You should use the new critical() method instead, which is PSR-3 compatible.', E_USER_DEPRECATED); - } - - /** - * @api - */ - public function err($message, array $context = array()) - { - @trigger_error('The '.__METHOD__.' method is deprecated since version 2.2 and will be removed in 3.0. You should use the new error() method instead, which is PSR-3 compatible.', E_USER_DEPRECATED); - } - - /** - * @api - */ - public function warn($message, array $context = array()) - { - @trigger_error('The '.__METHOD__.' method is deprecated since version 2.2 and will be removed in 3.0. You should use the new warning() method instead, which is PSR-3 compatible.', E_USER_DEPRECATED); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Profiler/BaseMemcacheProfilerStorage.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/Profiler/BaseMemcacheProfilerStorage.php deleted file mode 100644 index c6395bd..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Profiler/BaseMemcacheProfilerStorage.php +++ /dev/null @@ -1,310 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Profiler; - -/** - * Base Memcache storage for profiling information in a Memcache. - * - * @author Andrej Hudec - */ -abstract class BaseMemcacheProfilerStorage implements ProfilerStorageInterface -{ - const TOKEN_PREFIX = 'sf_profiler_'; - - protected $dsn; - protected $lifetime; - - /** - * Constructor. - * - * @param string $dsn A data source name - * @param string $username - * @param string $password - * @param int $lifetime The lifetime to use for the purge - */ - public function __construct($dsn, $username = '', $password = '', $lifetime = 86400) - { - $this->dsn = $dsn; - $this->lifetime = (int) $lifetime; - } - - /** - * {@inheritdoc} - */ - public function find($ip, $url, $limit, $method, $start = null, $end = null) - { - $indexName = $this->getIndexName(); - - $indexContent = $this->getValue($indexName); - if (!$indexContent) { - return array(); - } - - $profileList = explode("\n", $indexContent); - $result = array(); - - foreach ($profileList as $item) { - if ($limit === 0) { - break; - } - - if ($item == '') { - continue; - } - - $values = explode("\t", $item, 7); - list($itemToken, $itemIp, $itemMethod, $itemUrl, $itemTime, $itemParent) = $values; - $statusCode = isset($values[6]) ? $values[6] : null; - - $itemTime = (int) $itemTime; - - if ($ip && false === strpos($itemIp, $ip) || $url && false === strpos($itemUrl, $url) || $method && false === strpos($itemMethod, $method)) { - continue; - } - - if (!empty($start) && $itemTime < $start) { - continue; - } - - if (!empty($end) && $itemTime > $end) { - continue; - } - - $result[$itemToken] = array( - 'token' => $itemToken, - 'ip' => $itemIp, - 'method' => $itemMethod, - 'url' => $itemUrl, - 'time' => $itemTime, - 'parent' => $itemParent, - 'status_code' => $statusCode, - ); - --$limit; - } - - usort($result, function ($a, $b) { - if ($a['time'] === $b['time']) { - return 0; - } - - return $a['time'] > $b['time'] ? -1 : 1; - }); - - return $result; - } - - /** - * {@inheritdoc} - */ - public function purge() - { - // delete only items from index - $indexName = $this->getIndexName(); - - $indexContent = $this->getValue($indexName); - - if (!$indexContent) { - return false; - } - - $profileList = explode("\n", $indexContent); - - foreach ($profileList as $item) { - if ($item == '') { - continue; - } - - if (false !== $pos = strpos($item, "\t")) { - $this->delete($this->getItemName(substr($item, 0, $pos))); - } - } - - return $this->delete($indexName); - } - - /** - * {@inheritdoc} - */ - public function read($token) - { - if (empty($token)) { - return false; - } - - $profile = $this->getValue($this->getItemName($token)); - - if (false !== $profile) { - $profile = $this->createProfileFromData($token, $profile); - } - - return $profile; - } - - /** - * {@inheritdoc} - */ - public function write(Profile $profile) - { - $data = array( - 'token' => $profile->getToken(), - 'parent' => $profile->getParentToken(), - 'children' => array_map(function ($p) { return $p->getToken(); }, $profile->getChildren()), - 'data' => $profile->getCollectors(), - 'ip' => $profile->getIp(), - 'method' => $profile->getMethod(), - 'url' => $profile->getUrl(), - 'time' => $profile->getTime(), - ); - - $profileIndexed = false !== $this->getValue($this->getItemName($profile->getToken())); - - if ($this->setValue($this->getItemName($profile->getToken()), $data, $this->lifetime)) { - if (!$profileIndexed) { - // Add to index - $indexName = $this->getIndexName(); - - $indexRow = implode("\t", array( - $profile->getToken(), - $profile->getIp(), - $profile->getMethod(), - $profile->getUrl(), - $profile->getTime(), - $profile->getParentToken(), - $profile->getStatusCode(), - ))."\n"; - - return $this->appendValue($indexName, $indexRow, $this->lifetime); - } - - return true; - } - - return false; - } - - /** - * Retrieve item from the memcache server. - * - * @param string $key - * - * @return mixed - */ - abstract protected function getValue($key); - - /** - * Store an item on the memcache server under the specified key. - * - * @param string $key - * @param mixed $value - * @param int $expiration - * - * @return bool - */ - abstract protected function setValue($key, $value, $expiration = 0); - - /** - * Delete item from the memcache server. - * - * @param string $key - * - * @return bool - */ - abstract protected function delete($key); - - /** - * Append data to an existing item on the memcache server. - * - * @param string $key - * @param string $value - * @param int $expiration - * - * @return bool - */ - abstract protected function appendValue($key, $value, $expiration = 0); - - private function createProfileFromData($token, $data, $parent = null) - { - $profile = new Profile($token); - $profile->setIp($data['ip']); - $profile->setMethod($data['method']); - $profile->setUrl($data['url']); - $profile->setTime($data['time']); - $profile->setCollectors($data['data']); - - if (!$parent && $data['parent']) { - $parent = $this->read($data['parent']); - } - - if ($parent) { - $profile->setParent($parent); - } - - foreach ($data['children'] as $token) { - if (!$token) { - continue; - } - - if (!$childProfileData = $this->getValue($this->getItemName($token))) { - continue; - } - - $profile->addChild($this->createProfileFromData($token, $childProfileData, $profile)); - } - - return $profile; - } - - /** - * Get item name. - * - * @param string $token - * - * @return string - */ - private function getItemName($token) - { - $name = self::TOKEN_PREFIX.$token; - - if ($this->isItemNameValid($name)) { - return $name; - } - - return false; - } - - /** - * Get name of index. - * - * @return string - */ - private function getIndexName() - { - $name = self::TOKEN_PREFIX.'index'; - - if ($this->isItemNameValid($name)) { - return $name; - } - - return false; - } - - private function isItemNameValid($name) - { - $length = strlen($name); - - if ($length > 250) { - throw new \RuntimeException(sprintf('The memcache item key "%s" is too long (%s bytes). Allowed maximum size is 250 bytes.', $name, $length)); - } - - return true; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Profiler/FileProfilerStorage.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/Profiler/FileProfilerStorage.php deleted file mode 100644 index 581ab64..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Profiler/FileProfilerStorage.php +++ /dev/null @@ -1,282 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Profiler; - -/** - * Storage for profiler using files. - * - * @author Alexandre Salomé - */ -class FileProfilerStorage implements ProfilerStorageInterface -{ - /** - * Folder where profiler data are stored. - * - * @var string - */ - private $folder; - - /** - * Constructs the file storage using a "dsn-like" path. - * - * Example : "file:/path/to/the/storage/folder" - * - * @param string $dsn The DSN - * - * @throws \RuntimeException - */ - public function __construct($dsn) - { - if (0 !== strpos($dsn, 'file:')) { - throw new \RuntimeException(sprintf('Please check your configuration. You are trying to use FileStorage with an invalid dsn "%s". The expected format is "file:/path/to/the/storage/folder".', $dsn)); - } - $this->folder = substr($dsn, 5); - - if (!is_dir($this->folder)) { - mkdir($this->folder, 0777, true); - } - } - - /** - * {@inheritdoc} - */ - public function find($ip, $url, $limit, $method, $start = null, $end = null) - { - $file = $this->getIndexFilename(); - - if (!file_exists($file)) { - return array(); - } - - $file = fopen($file, 'r'); - fseek($file, 0, SEEK_END); - - $result = array(); - while (count($result) < $limit && $line = $this->readLineFromFile($file)) { - $values = str_getcsv($line); - list($csvToken, $csvIp, $csvMethod, $csvUrl, $csvTime, $csvParent) = $values; - $csvStatusCode = isset($values[6]) ? $values[6] : null; - - $csvTime = (int) $csvTime; - - if ($ip && false === strpos($csvIp, $ip) || $url && false === strpos($csvUrl, $url) || $method && false === strpos($csvMethod, $method)) { - continue; - } - - if (!empty($start) && $csvTime < $start) { - continue; - } - - if (!empty($end) && $csvTime > $end) { - continue; - } - - $result[$csvToken] = array( - 'token' => $csvToken, - 'ip' => $csvIp, - 'method' => $csvMethod, - 'url' => $csvUrl, - 'time' => $csvTime, - 'parent' => $csvParent, - 'status_code' => $csvStatusCode, - ); - } - - fclose($file); - - return array_values($result); - } - - /** - * {@inheritdoc} - */ - public function purge() - { - $flags = \FilesystemIterator::SKIP_DOTS; - $iterator = new \RecursiveDirectoryIterator($this->folder, $flags); - $iterator = new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::CHILD_FIRST); - - foreach ($iterator as $file) { - if (is_file($file)) { - unlink($file); - } else { - rmdir($file); - } - } - } - - /** - * {@inheritdoc} - */ - public function read($token) - { - if (!$token || !file_exists($file = $this->getFilename($token))) { - return; - } - - return $this->createProfileFromData($token, unserialize(file_get_contents($file))); - } - - /** - * {@inheritdoc} - */ - public function write(Profile $profile) - { - $file = $this->getFilename($profile->getToken()); - - $profileIndexed = is_file($file); - if (!$profileIndexed) { - // Create directory - $dir = dirname($file); - if (!is_dir($dir)) { - mkdir($dir, 0777, true); - } - } - - // Store profile - $data = array( - 'token' => $profile->getToken(), - 'parent' => $profile->getParentToken(), - 'children' => array_map(function ($p) { return $p->getToken(); }, $profile->getChildren()), - 'data' => $profile->getCollectors(), - 'ip' => $profile->getIp(), - 'method' => $profile->getMethod(), - 'url' => $profile->getUrl(), - 'time' => $profile->getTime(), - ); - - if (false === file_put_contents($file, serialize($data))) { - return false; - } - - if (!$profileIndexed) { - // Add to index - if (false === $file = fopen($this->getIndexFilename(), 'a')) { - return false; - } - - fputcsv($file, array( - $profile->getToken(), - $profile->getIp(), - $profile->getMethod(), - $profile->getUrl(), - $profile->getTime(), - $profile->getParentToken(), - $profile->getStatusCode(), - )); - fclose($file); - } - - return true; - } - - /** - * Gets filename to store data, associated to the token. - * - * @param string $token - * - * @return string The profile filename - */ - protected function getFilename($token) - { - // Uses 4 last characters, because first are mostly the same. - $folderA = substr($token, -2, 2); - $folderB = substr($token, -4, 2); - - return $this->folder.'/'.$folderA.'/'.$folderB.'/'.$token; - } - - /** - * Gets the index filename. - * - * @return string The index filename - */ - protected function getIndexFilename() - { - return $this->folder.'/index.csv'; - } - - /** - * Reads a line in the file, backward. - * - * This function automatically skips the empty lines and do not include the line return in result value. - * - * @param resource $file The file resource, with the pointer placed at the end of the line to read - * - * @return mixed A string representing the line or null if beginning of file is reached - */ - protected function readLineFromFile($file) - { - $line = ''; - $position = ftell($file); - - if (0 === $position) { - return; - } - - while (true) { - $chunkSize = min($position, 1024); - $position -= $chunkSize; - fseek($file, $position); - - if (0 === $chunkSize) { - // bof reached - break; - } - - $buffer = fread($file, $chunkSize); - - if (false === ($upTo = strrpos($buffer, "\n"))) { - $line = $buffer.$line; - continue; - } - - $position += $upTo; - $line = substr($buffer, $upTo + 1).$line; - fseek($file, max(0, $position), SEEK_SET); - - if ('' !== $line) { - break; - } - } - - return '' === $line ? null : $line; - } - - protected function createProfileFromData($token, $data, $parent = null) - { - $profile = new Profile($token); - $profile->setIp($data['ip']); - $profile->setMethod($data['method']); - $profile->setUrl($data['url']); - $profile->setTime($data['time']); - $profile->setCollectors($data['data']); - - if (!$parent && $data['parent']) { - $parent = $this->read($data['parent']); - } - - if ($parent) { - $profile->setParent($parent); - } - - foreach ($data['children'] as $token) { - if (!$token || !file_exists($file = $this->getFilename($token))) { - continue; - } - - $profile->addChild($this->createProfileFromData($token, unserialize(file_get_contents($file)), $profile)); - } - - return $profile; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Profiler/MemcacheProfilerStorage.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/Profiler/MemcacheProfilerStorage.php deleted file mode 100644 index 2727405..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Profiler/MemcacheProfilerStorage.php +++ /dev/null @@ -1,107 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Profiler; - -/** - * Memcache Profiler Storage. - * - * @author Andrej Hudec - */ -class MemcacheProfilerStorage extends BaseMemcacheProfilerStorage -{ - /** - * @var \Memcache - */ - private $memcache; - - /** - * Internal convenience method that returns the instance of the Memcache. - * - * @return \Memcache - * - * @throws \RuntimeException - */ - protected function getMemcache() - { - if (null === $this->memcache) { - if (!preg_match('#^memcache://(?(?=\[.*\])\[(.*)\]|(.*)):(.*)$#', $this->dsn, $matches)) { - throw new \RuntimeException(sprintf('Please check your configuration. You are trying to use Memcache with an invalid dsn "%s". The expected format is "memcache://[host]:port".', $this->dsn)); - } - - $host = $matches[1] ?: $matches[2]; - $port = $matches[3]; - - $memcache = new \Memcache(); - $memcache->addserver($host, $port); - - $this->memcache = $memcache; - } - - return $this->memcache; - } - - /** - * Set instance of the Memcache. - * - * @param \Memcache $memcache - */ - public function setMemcache($memcache) - { - $this->memcache = $memcache; - } - - /** - * {@inheritdoc} - */ - protected function getValue($key) - { - return $this->getMemcache()->get($key); - } - - /** - * {@inheritdoc} - */ - protected function setValue($key, $value, $expiration = 0) - { - return $this->getMemcache()->set($key, $value, false, time() + $expiration); - } - - /** - * {@inheritdoc} - */ - protected function delete($key) - { - return $this->getMemcache()->delete($key); - } - - /** - * {@inheritdoc} - */ - protected function appendValue($key, $value, $expiration = 0) - { - $memcache = $this->getMemcache(); - - if (method_exists($memcache, 'append')) { - // Memcache v3.0 - if (!$result = $memcache->append($key, $value, false, $expiration)) { - return $memcache->set($key, $value, false, $expiration); - } - - return $result; - } - - // simulate append in Memcache <3.0 - $content = $memcache->get($key); - - return $memcache->set($key, $content.$value, false, $expiration); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Profiler/MemcachedProfilerStorage.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/Profiler/MemcachedProfilerStorage.php deleted file mode 100644 index 0c57373..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Profiler/MemcachedProfilerStorage.php +++ /dev/null @@ -1,103 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Profiler; - -/** - * Memcached Profiler Storage. - * - * @author Andrej Hudec - */ -class MemcachedProfilerStorage extends BaseMemcacheProfilerStorage -{ - /** - * @var \Memcached - */ - private $memcached; - - /** - * Internal convenience method that returns the instance of the Memcached. - * - * @return \Memcached - * - * @throws \RuntimeException - */ - protected function getMemcached() - { - if (null === $this->memcached) { - if (!preg_match('#^memcached://(?(?=\[.*\])\[(.*)\]|(.*)):(.*)$#', $this->dsn, $matches)) { - throw new \RuntimeException(sprintf('Please check your configuration. You are trying to use Memcached with an invalid dsn "%s". The expected format is "memcached://[host]:port".', $this->dsn)); - } - - $host = $matches[1] ?: $matches[2]; - $port = $matches[3]; - - $memcached = new \Memcached(); - - // disable compression to allow appending - $memcached->setOption(\Memcached::OPT_COMPRESSION, false); - - $memcached->addServer($host, $port); - - $this->memcached = $memcached; - } - - return $this->memcached; - } - - /** - * Set instance of the Memcached. - * - * @param \Memcached $memcached - */ - public function setMemcached($memcached) - { - $this->memcached = $memcached; - } - - /** - * {@inheritdoc} - */ - protected function getValue($key) - { - return $this->getMemcached()->get($key); - } - - /** - * {@inheritdoc} - */ - protected function setValue($key, $value, $expiration = 0) - { - return $this->getMemcached()->set($key, $value, time() + $expiration); - } - - /** - * {@inheritdoc} - */ - protected function delete($key) - { - return $this->getMemcached()->delete($key); - } - - /** - * {@inheritdoc} - */ - protected function appendValue($key, $value, $expiration = 0) - { - $memcached = $this->getMemcached(); - - if (!$result = $memcached->append($key, $value)) { - return $memcached->set($key, $value, $expiration); - } - - return $result; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Profiler/MongoDbProfilerStorage.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/Profiler/MongoDbProfilerStorage.php deleted file mode 100644 index f35a7f7..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Profiler/MongoDbProfilerStorage.php +++ /dev/null @@ -1,259 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Profiler; - -class MongoDbProfilerStorage implements ProfilerStorageInterface -{ - protected $dsn; - protected $lifetime; - private $mongo; - - /** - * Constructor. - * - * @param string $dsn A data source name - * @param string $username Not used - * @param string $password Not used - * @param int $lifetime The lifetime to use for the purge - */ - public function __construct($dsn, $username = '', $password = '', $lifetime = 86400) - { - $this->dsn = $dsn; - $this->lifetime = (int) $lifetime; - } - - /** - * {@inheritdoc} - */ - public function find($ip, $url, $limit, $method, $start = null, $end = null) - { - $cursor = $this->getMongo()->find($this->buildQuery($ip, $url, $method, $start, $end), array('_id', 'parent', 'ip', 'method', 'url', 'time', 'status_code'))->sort(array('time' => -1))->limit($limit); - - $tokens = array(); - foreach ($cursor as $profile) { - $tokens[] = $this->getData($profile); - } - - return $tokens; - } - - /** - * {@inheritdoc} - */ - public function purge() - { - $this->getMongo()->remove(array()); - } - - /** - * {@inheritdoc} - */ - public function read($token) - { - $profile = $this->getMongo()->findOne(array('_id' => $token, 'data' => array('$exists' => true))); - - if (null !== $profile) { - $profile = $this->createProfileFromData($this->getData($profile)); - } - - return $profile; - } - - /** - * {@inheritdoc} - */ - public function write(Profile $profile) - { - $this->cleanup(); - - $record = array( - '_id' => $profile->getToken(), - 'parent' => $profile->getParentToken(), - 'data' => base64_encode(serialize($profile->getCollectors())), - 'ip' => $profile->getIp(), - 'method' => $profile->getMethod(), - 'url' => $profile->getUrl(), - 'time' => $profile->getTime(), - 'status_code' => $profile->getStatusCode(), - ); - - $result = $this->getMongo()->update(array('_id' => $profile->getToken()), array_filter($record, function ($v) { return !empty($v); }), array('upsert' => true)); - - return (bool) (isset($result['ok']) ? $result['ok'] : $result); - } - - /** - * Internal convenience method that returns the instance of the MongoDB Collection. - * - * @return \MongoCollection - * - * @throws \RuntimeException - */ - protected function getMongo() - { - if (null !== $this->mongo) { - return $this->mongo; - } - - if (!$parsedDsn = $this->parseDsn($this->dsn)) { - throw new \RuntimeException(sprintf('Please check your configuration. You are trying to use MongoDB with an invalid dsn "%s". The expected format is "mongodb://[user:pass@]host/database/collection"', $this->dsn)); - } - - list($server, $database, $collection) = $parsedDsn; - $mongoClass = version_compare(phpversion('mongo'), '1.3.0', '<') ? '\Mongo' : '\MongoClient'; - $mongo = new $mongoClass($server); - - return $this->mongo = $mongo->selectCollection($database, $collection); - } - - /** - * @param array $data - * - * @return Profile - */ - protected function createProfileFromData(array $data) - { - $profile = $this->getProfile($data); - - if ($data['parent']) { - $parent = $this->getMongo()->findOne(array('_id' => $data['parent'], 'data' => array('$exists' => true))); - if ($parent) { - $profile->setParent($this->getProfile($this->getData($parent))); - } - } - - $profile->setChildren($this->readChildren($data['token'])); - - return $profile; - } - - /** - * @param string $token - * - * @return Profile[] An array of Profile instances - */ - protected function readChildren($token) - { - $profiles = array(); - - $cursor = $this->getMongo()->find(array('parent' => $token, 'data' => array('$exists' => true))); - foreach ($cursor as $d) { - $profiles[] = $this->getProfile($this->getData($d)); - } - - return $profiles; - } - - protected function cleanup() - { - $this->getMongo()->remove(array('time' => array('$lt' => time() - $this->lifetime))); - } - - /** - * @param string $ip - * @param string $url - * @param string $method - * @param int $start - * @param int $end - * - * @return array - */ - private function buildQuery($ip, $url, $method, $start, $end) - { - $query = array(); - - if (!empty($ip)) { - $query['ip'] = $ip; - } - - if (!empty($url)) { - $query['url'] = $url; - } - - if (!empty($method)) { - $query['method'] = $method; - } - - if (!empty($start) || !empty($end)) { - $query['time'] = array(); - } - - if (!empty($start)) { - $query['time']['$gte'] = $start; - } - - if (!empty($end)) { - $query['time']['$lte'] = $end; - } - - return $query; - } - - /** - * @param array $data - * - * @return array - */ - private function getData(array $data) - { - return array( - 'token' => $data['_id'], - 'parent' => isset($data['parent']) ? $data['parent'] : null, - 'ip' => isset($data['ip']) ? $data['ip'] : null, - 'method' => isset($data['method']) ? $data['method'] : null, - 'url' => isset($data['url']) ? $data['url'] : null, - 'time' => isset($data['time']) ? $data['time'] : null, - 'data' => isset($data['data']) ? $data['data'] : null, - 'status_code' => isset($data['status_code']) ? $data['status_code'] : null, - ); - } - - /** - * @param array $data - * - * @return Profile - */ - private function getProfile(array $data) - { - $profile = new Profile($data['token']); - $profile->setIp($data['ip']); - $profile->setMethod($data['method']); - $profile->setUrl($data['url']); - $profile->setTime($data['time']); - $profile->setCollectors(unserialize(base64_decode($data['data']))); - - return $profile; - } - - /** - * @param string $dsn - * - * @return null|array Array($server, $database, $collection) - */ - private function parseDsn($dsn) - { - if (!preg_match('#^(mongodb://.*)/(.*)/(.*)$#', $dsn, $matches)) { - return; - } - - $server = $matches[1]; - $database = $matches[2]; - $collection = $matches[3]; - preg_match('#^mongodb://(([^:]+):?(.*)(?=@))?@?([^/]*)(.*)$#', $server, $matchesServer); - - if ('' == $matchesServer[5] && '' != $matches[2]) { - $server .= '/'.$matches[2]; - } - - return array($server, $database, $collection); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Profiler/MysqlProfilerStorage.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/Profiler/MysqlProfilerStorage.php deleted file mode 100644 index 92e8a1b..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Profiler/MysqlProfilerStorage.php +++ /dev/null @@ -1,79 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Profiler; - -/** - * A ProfilerStorage for Mysql. - * - * @author Jan Schumann - */ -class MysqlProfilerStorage extends PdoProfilerStorage -{ - /** - * {@inheritdoc} - */ - protected function initDb() - { - if (null === $this->db) { - if (0 !== strpos($this->dsn, 'mysql')) { - throw new \RuntimeException(sprintf('Please check your configuration. You are trying to use Mysql with an invalid dsn "%s". The expected format is "mysql:dbname=database_name;host=host_name".', $this->dsn)); - } - - if (!class_exists('PDO') || !in_array('mysql', \PDO::getAvailableDrivers(), true)) { - throw new \RuntimeException('You need to enable PDO_Mysql extension for the profiler to run properly.'); - } - - $db = new \PDO($this->dsn, $this->username, $this->password); - $db->exec('CREATE TABLE IF NOT EXISTS sf_profiler_data (token VARCHAR(255) PRIMARY KEY, data LONGTEXT, ip VARCHAR(64), method VARCHAR(6), url VARCHAR(255), time INTEGER UNSIGNED, parent VARCHAR(255), created_at INTEGER UNSIGNED, status_code SMALLINT UNSIGNED, KEY (created_at), KEY (ip), KEY (method), KEY (url), KEY (parent))'); - - $this->db = $db; - } - - return $this->db; - } - - /** - * {@inheritdoc} - */ - protected function buildCriteria($ip, $url, $start, $end, $limit, $method) - { - $criteria = array(); - $args = array(); - - if ($ip = preg_replace('/[^\d\.]/', '', $ip)) { - $criteria[] = 'ip LIKE :ip'; - $args[':ip'] = '%'.$ip.'%'; - } - - if ($url) { - $criteria[] = 'url LIKE :url'; - $args[':url'] = '%'.addcslashes($url, '%_\\').'%'; - } - - if ($method) { - $criteria[] = 'method = :method'; - $args[':method'] = $method; - } - - if (!empty($start)) { - $criteria[] = 'time >= :start'; - $args[':start'] = $start; - } - - if (!empty($end)) { - $criteria[] = 'time <= :end'; - $args[':end'] = $end; - } - - return array($criteria, $args); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Profiler/PdoProfilerStorage.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/Profiler/PdoProfilerStorage.php deleted file mode 100644 index 48f813f..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Profiler/PdoProfilerStorage.php +++ /dev/null @@ -1,263 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Profiler; - -/** - * Base PDO storage for profiling information in a PDO database. - * - * @author Fabien Potencier - * @author Jan Schumann - */ -abstract class PdoProfilerStorage implements ProfilerStorageInterface -{ - protected $dsn; - protected $username; - protected $password; - protected $lifetime; - protected $db; - - /** - * Constructor. - * - * @param string $dsn A data source name - * @param string $username The username for the database - * @param string $password The password for the database - * @param int $lifetime The lifetime to use for the purge - */ - public function __construct($dsn, $username = '', $password = '', $lifetime = 86400) - { - $this->dsn = $dsn; - $this->username = $username; - $this->password = $password; - $this->lifetime = (int) $lifetime; - } - - /** - * {@inheritdoc} - */ - public function find($ip, $url, $limit, $method, $start = null, $end = null) - { - if (null === $start) { - $start = 0; - } - - if (null === $end) { - $end = time(); - } - - list($criteria, $args) = $this->buildCriteria($ip, $url, $start, $end, $limit, $method); - - $criteria = $criteria ? 'WHERE '.implode(' AND ', $criteria) : ''; - - $db = $this->initDb(); - $tokens = $this->fetch($db, 'SELECT token, ip, method, url, time, parent, status_code FROM sf_profiler_data '.$criteria.' ORDER BY time DESC LIMIT '.((int) $limit), $args); - $this->close($db); - - return $tokens; - } - - /** - * {@inheritdoc} - */ - public function read($token) - { - $db = $this->initDb(); - $args = array(':token' => $token); - $data = $this->fetch($db, 'SELECT data, parent, ip, method, url, time FROM sf_profiler_data WHERE token = :token LIMIT 1', $args); - $this->close($db); - if (isset($data[0]['data'])) { - return $this->createProfileFromData($token, $data[0]); - } - } - - /** - * {@inheritdoc} - */ - public function write(Profile $profile) - { - $db = $this->initDb(); - $args = array( - ':token' => $profile->getToken(), - ':parent' => $profile->getParentToken(), - ':data' => base64_encode(serialize($profile->getCollectors())), - ':ip' => $profile->getIp(), - ':method' => $profile->getMethod(), - ':url' => $profile->getUrl(), - ':time' => $profile->getTime(), - ':created_at' => time(), - ':status_code' => $profile->getStatusCode(), - ); - - try { - if ($this->has($profile->getToken())) { - $this->exec($db, 'UPDATE sf_profiler_data SET parent = :parent, data = :data, ip = :ip, method = :method, url = :url, time = :time, created_at = :created_at, status_code = :status_code WHERE token = :token', $args); - } else { - $this->exec($db, 'INSERT INTO sf_profiler_data (token, parent, data, ip, method, url, time, created_at, status_code) VALUES (:token, :parent, :data, :ip, :method, :url, :time, :created_at, :status_code)', $args); - } - $this->cleanup(); - $status = true; - } catch (\Exception $e) { - $status = false; - } - - $this->close($db); - - return $status; - } - - /** - * {@inheritdoc} - */ - public function purge() - { - $db = $this->initDb(); - $this->exec($db, 'DELETE FROM sf_profiler_data'); - $this->close($db); - } - - /** - * Build SQL criteria to fetch records by ip and url. - * - * @param string $ip The IP - * @param string $url The URL - * @param string $start The start period to search from - * @param string $end The end period to search to - * @param string $limit The maximum number of tokens to return - * @param string $method The request method - * - * @return array An array with (criteria, args) - */ - abstract protected function buildCriteria($ip, $url, $start, $end, $limit, $method); - - /** - * Initializes the database. - * - * @throws \RuntimeException When the requested database driver is not installed - */ - abstract protected function initDb(); - - protected function cleanup() - { - $db = $this->initDb(); - $this->exec($db, 'DELETE FROM sf_profiler_data WHERE created_at < :time', array(':time' => time() - $this->lifetime)); - $this->close($db); - } - - protected function exec($db, $query, array $args = array()) - { - $stmt = $this->prepareStatement($db, $query); - - foreach ($args as $arg => $val) { - $stmt->bindValue($arg, $val, is_int($val) ? \PDO::PARAM_INT : \PDO::PARAM_STR); - } - $success = $stmt->execute(); - if (!$success) { - throw new \RuntimeException(sprintf('Error executing query "%s"', $query)); - } - } - - protected function prepareStatement($db, $query) - { - try { - $stmt = $db->prepare($query); - } catch (\Exception $e) { - $stmt = false; - } - - if (false === $stmt) { - throw new \RuntimeException('The database cannot successfully prepare the statement'); - } - - return $stmt; - } - - protected function fetch($db, $query, array $args = array()) - { - $stmt = $this->prepareStatement($db, $query); - - foreach ($args as $arg => $val) { - $stmt->bindValue($arg, $val, is_int($val) ? \PDO::PARAM_INT : \PDO::PARAM_STR); - } - $stmt->execute(); - $return = $stmt->fetchAll(\PDO::FETCH_ASSOC); - - return $return; - } - - protected function close($db) - { - } - - protected function createProfileFromData($token, $data, $parent = null) - { - $profile = new Profile($token); - $profile->setIp($data['ip']); - $profile->setMethod($data['method']); - $profile->setUrl($data['url']); - $profile->setTime($data['time']); - $profile->setCollectors(unserialize(base64_decode($data['data']))); - - if (!$parent && !empty($data['parent'])) { - $parent = $this->read($data['parent']); - } - - if ($parent) { - $profile->setParent($parent); - } - - $profile->setChildren($this->readChildren($token, $profile)); - - return $profile; - } - - /** - * Reads the child profiles for the given token. - * - * @param string $token The parent token - * @param string $parent The parent instance - * - * @return Profile[] An array of Profile instance - */ - protected function readChildren($token, $parent) - { - $db = $this->initDb(); - $data = $this->fetch($db, 'SELECT token, data, ip, method, url, time FROM sf_profiler_data WHERE parent = :token', array(':token' => $token)); - $this->close($db); - - if (!$data) { - return array(); - } - - $profiles = array(); - foreach ($data as $d) { - $profiles[] = $this->createProfileFromData($d['token'], $d, $parent); - } - - return $profiles; - } - - /** - * Returns whether data for the given token already exists in storage. - * - * @param string $token The profile token - * - * @return string - */ - protected function has($token) - { - $db = $this->initDb(); - $tokenExists = $this->fetch($db, 'SELECT 1 FROM sf_profiler_data WHERE token = :token LIMIT 1', array(':token' => $token)); - $this->close($db); - - return !empty($tokenExists); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Profiler/Profile.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/Profiler/Profile.php deleted file mode 100644 index a4e4ba6..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Profiler/Profile.php +++ /dev/null @@ -1,292 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Profiler; - -use Symfony\Component\HttpKernel\DataCollector\DataCollectorInterface; - -/** - * Profile. - * - * @author Fabien Potencier - */ -class Profile -{ - private $token; - - /** - * @var DataCollectorInterface[] - */ - private $collectors = array(); - - private $ip; - private $method; - private $url; - private $time; - private $statusCode; - - /** - * @var Profile - */ - private $parent; - - /** - * @var Profile[] - */ - private $children = array(); - - /** - * Constructor. - * - * @param string $token The token - */ - public function __construct($token) - { - $this->token = $token; - } - - /** - * Sets the token. - * - * @param string $token The token - */ - public function setToken($token) - { - $this->token = $token; - } - - /** - * Gets the token. - * - * @return string The token - */ - public function getToken() - { - return $this->token; - } - - /** - * Sets the parent token. - * - * @param Profile $parent The parent Profile - */ - public function setParent(Profile $parent) - { - $this->parent = $parent; - } - - /** - * Returns the parent profile. - * - * @return Profile The parent profile - */ - public function getParent() - { - return $this->parent; - } - - /** - * Returns the parent token. - * - * @return null|string The parent token - */ - public function getParentToken() - { - return $this->parent ? $this->parent->getToken() : null; - } - - /** - * Returns the IP. - * - * @return string The IP - */ - public function getIp() - { - return $this->ip; - } - - /** - * Sets the IP. - * - * @param string $ip - */ - public function setIp($ip) - { - $this->ip = $ip; - } - - /** - * Returns the request method. - * - * @return string The request method - */ - public function getMethod() - { - return $this->method; - } - - public function setMethod($method) - { - $this->method = $method; - } - - /** - * Returns the URL. - * - * @return string The URL - */ - public function getUrl() - { - return $this->url; - } - - public function setUrl($url) - { - $this->url = $url; - } - - /** - * Returns the time. - * - * @return string The time - */ - public function getTime() - { - if (null === $this->time) { - return 0; - } - - return $this->time; - } - - public function setTime($time) - { - $this->time = $time; - } - - /** - * @param int $statusCode - */ - public function setStatusCode($statusCode) - { - $this->statusCode = $statusCode; - } - - /** - * @return int - */ - public function getStatusCode() - { - return $this->statusCode; - } - - /** - * Finds children profilers. - * - * @return Profile[] An array of Profile - */ - public function getChildren() - { - return $this->children; - } - - /** - * Sets children profiler. - * - * @param Profile[] $children An array of Profile - */ - public function setChildren(array $children) - { - $this->children = array(); - foreach ($children as $child) { - $this->addChild($child); - } - } - - /** - * Adds the child token. - * - * @param Profile $child The child Profile - */ - public function addChild(Profile $child) - { - $this->children[] = $child; - $child->setParent($this); - } - - /** - * Gets a Collector by name. - * - * @param string $name A collector name - * - * @return DataCollectorInterface A DataCollectorInterface instance - * - * @throws \InvalidArgumentException if the collector does not exist - */ - public function getCollector($name) - { - if (!isset($this->collectors[$name])) { - throw new \InvalidArgumentException(sprintf('Collector "%s" does not exist.', $name)); - } - - return $this->collectors[$name]; - } - - /** - * Gets the Collectors associated with this profile. - * - * @return DataCollectorInterface[] - */ - public function getCollectors() - { - return $this->collectors; - } - - /** - * Sets the Collectors associated with this profile. - * - * @param DataCollectorInterface[] $collectors - */ - public function setCollectors(array $collectors) - { - $this->collectors = array(); - foreach ($collectors as $collector) { - $this->addCollector($collector); - } - } - - /** - * Adds a Collector. - * - * @param DataCollectorInterface $collector A DataCollectorInterface instance - */ - public function addCollector(DataCollectorInterface $collector) - { - $this->collectors[$collector->getName()] = $collector; - } - - /** - * Returns true if a Collector for the given name exists. - * - * @param string $name A collector name - * - * @return bool - */ - public function hasCollector($name) - { - return isset($this->collectors[$name]); - } - - public function __sleep() - { - return array('token', 'parent', 'children', 'collectors', 'ip', 'method', 'url', 'time'); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Profiler/Profiler.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/Profiler/Profiler.php deleted file mode 100644 index 864f624..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Profiler/Profiler.php +++ /dev/null @@ -1,296 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Profiler; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\DataCollector\DataCollectorInterface; -use Symfony\Component\HttpKernel\DataCollector\LateDataCollectorInterface; -use Psr\Log\LoggerInterface; - -/** - * Profiler. - * - * @author Fabien Potencier - */ -class Profiler -{ - /** - * @var ProfilerStorageInterface - */ - private $storage; - - /** - * @var DataCollectorInterface[] - */ - private $collectors = array(); - - /** - * @var LoggerInterface - */ - private $logger; - - /** - * @var bool - */ - private $enabled = true; - - /** - * Constructor. - * - * @param ProfilerStorageInterface $storage A ProfilerStorageInterface instance - * @param LoggerInterface $logger A LoggerInterface instance - */ - public function __construct(ProfilerStorageInterface $storage, LoggerInterface $logger = null) - { - $this->storage = $storage; - $this->logger = $logger; - } - - /** - * Disables the profiler. - */ - public function disable() - { - $this->enabled = false; - } - - /** - * Enables the profiler. - */ - public function enable() - { - $this->enabled = true; - } - - /** - * Loads the Profile for the given Response. - * - * @param Response $response A Response instance - * - * @return Profile A Profile instance - */ - public function loadProfileFromResponse(Response $response) - { - if (!$token = $response->headers->get('X-Debug-Token')) { - return false; - } - - return $this->loadProfile($token); - } - - /** - * Loads the Profile for the given token. - * - * @param string $token A token - * - * @return Profile A Profile instance - */ - public function loadProfile($token) - { - return $this->storage->read($token); - } - - /** - * Saves a Profile. - * - * @param Profile $profile A Profile instance - * - * @return bool - */ - public function saveProfile(Profile $profile) - { - // late collect - foreach ($profile->getCollectors() as $collector) { - if ($collector instanceof LateDataCollectorInterface) { - $collector->lateCollect(); - } - } - - if (!($ret = $this->storage->write($profile)) && null !== $this->logger) { - $this->logger->warning('Unable to store the profiler information.', array('configured_storage' => get_class($this->storage))); - } - - return $ret; - } - - /** - * Purges all data from the storage. - */ - public function purge() - { - $this->storage->purge(); - } - - /** - * Exports the current profiler data. - * - * @param Profile $profile A Profile instance - * - * @return string The exported data - */ - public function export(Profile $profile) - { - return base64_encode(serialize($profile)); - } - - /** - * Imports data into the profiler storage. - * - * @param string $data A data string as exported by the export() method - * - * @return Profile A Profile instance - */ - public function import($data) - { - $profile = unserialize(base64_decode($data)); - - if ($this->storage->read($profile->getToken())) { - return false; - } - - $this->saveProfile($profile); - - return $profile; - } - - /** - * Finds profiler tokens for the given criteria. - * - * @param string $ip The IP - * @param string $url The URL - * @param string $limit The maximum number of tokens to return - * @param string $method The request method - * @param string $start The start date to search from - * @param string $end The end date to search to - * - * @return array An array of tokens - * - * @see http://php.net/manual/en/datetime.formats.php for the supported date/time formats - */ - public function find($ip, $url, $limit, $method, $start, $end) - { - return $this->storage->find($ip, $url, $limit, $method, $this->getTimestamp($start), $this->getTimestamp($end)); - } - - /** - * Collects data for the given Response. - * - * @param Request $request A Request instance - * @param Response $response A Response instance - * @param \Exception $exception An exception instance if the request threw one - * - * @return Profile|null A Profile instance or null if the profiler is disabled - */ - public function collect(Request $request, Response $response, \Exception $exception = null) - { - if (false === $this->enabled) { - return; - } - - $profile = new Profile(substr(hash('sha256', uniqid(mt_rand(), true)), 0, 6)); - $profile->setTime(time()); - $profile->setUrl($request->getUri()); - $profile->setIp($request->getClientIp()); - $profile->setMethod($request->getMethod()); - $profile->setStatusCode($response->getStatusCode()); - - $response->headers->set('X-Debug-Token', $profile->getToken()); - - foreach ($this->collectors as $collector) { - $collector->collect($request, $response, $exception); - - // we need to clone for sub-requests - $profile->addCollector(clone $collector); - } - - return $profile; - } - - /** - * Gets the Collectors associated with this profiler. - * - * @return array An array of collectors - */ - public function all() - { - return $this->collectors; - } - - /** - * Sets the Collectors associated with this profiler. - * - * @param DataCollectorInterface[] $collectors An array of collectors - */ - public function set(array $collectors = array()) - { - $this->collectors = array(); - foreach ($collectors as $collector) { - $this->add($collector); - } - } - - /** - * Adds a Collector. - * - * @param DataCollectorInterface $collector A DataCollectorInterface instance - */ - public function add(DataCollectorInterface $collector) - { - $this->collectors[$collector->getName()] = $collector; - } - - /** - * Returns true if a Collector for the given name exists. - * - * @param string $name A collector name - * - * @return bool - */ - public function has($name) - { - return isset($this->collectors[$name]); - } - - /** - * Gets a Collector by name. - * - * @param string $name A collector name - * - * @return DataCollectorInterface A DataCollectorInterface instance - * - * @throws \InvalidArgumentException if the collector does not exist - */ - public function get($name) - { - if (!isset($this->collectors[$name])) { - throw new \InvalidArgumentException(sprintf('Collector "%s" does not exist.', $name)); - } - - return $this->collectors[$name]; - } - - private function getTimestamp($value) - { - if (null === $value || '' == $value) { - return; - } - - try { - $value = new \DateTime(is_numeric($value) ? '@'.$value : $value); - } catch (\Exception $e) { - return; - } - - return $value->getTimestamp(); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Profiler/ProfilerStorageInterface.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/Profiler/ProfilerStorageInterface.php deleted file mode 100644 index ea72af2..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Profiler/ProfilerStorageInterface.php +++ /dev/null @@ -1,59 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Profiler; - -/** - * ProfilerStorageInterface. - * - * @author Fabien Potencier - */ -interface ProfilerStorageInterface -{ - /** - * Finds profiler tokens for the given criteria. - * - * @param string $ip The IP - * @param string $url The URL - * @param string $limit The maximum number of tokens to return - * @param string $method The request method - * @param int|null $start The start date to search from - * @param int|null $end The end date to search to - * - * @return array An array of tokens - */ - public function find($ip, $url, $limit, $method, $start = null, $end = null); - - /** - * Reads data associated with the given token. - * - * The method returns false if the token does not exist in the storage. - * - * @param string $token A token - * - * @return Profile The profile associated with token - */ - public function read($token); - - /** - * Saves a Profile. - * - * @param Profile $profile A Profile instance - * - * @return bool Write operation successful - */ - public function write(Profile $profile); - - /** - * Purges all data from the database. - */ - public function purge(); -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Profiler/RedisProfilerStorage.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/Profiler/RedisProfilerStorage.php deleted file mode 100644 index b0e14ea..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Profiler/RedisProfilerStorage.php +++ /dev/null @@ -1,394 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Profiler; - -/** - * RedisProfilerStorage stores profiling information in Redis. - * - * @author Andrej Hudec - * @author Stephane PY - */ -class RedisProfilerStorage implements ProfilerStorageInterface -{ - const TOKEN_PREFIX = 'sf_profiler_'; - - const REDIS_OPT_SERIALIZER = 1; - const REDIS_OPT_PREFIX = 2; - const REDIS_SERIALIZER_NONE = 0; - const REDIS_SERIALIZER_PHP = 1; - - protected $dsn; - protected $lifetime; - - /** - * @var \Redis - */ - private $redis; - - /** - * Constructor. - * - * @param string $dsn A data source name - * @param string $username Not used - * @param string $password Not used - * @param int $lifetime The lifetime to use for the purge - */ - public function __construct($dsn, $username = '', $password = '', $lifetime = 86400) - { - $this->dsn = $dsn; - $this->lifetime = (int) $lifetime; - } - - /** - * {@inheritdoc} - */ - public function find($ip, $url, $limit, $method, $start = null, $end = null) - { - $indexName = $this->getIndexName(); - - if (!$indexContent = $this->getValue($indexName, self::REDIS_SERIALIZER_NONE)) { - return array(); - } - - $profileList = array_reverse(explode("\n", $indexContent)); - $result = array(); - - foreach ($profileList as $item) { - if ($limit === 0) { - break; - } - - if ($item == '') { - continue; - } - - $values = explode("\t", $item, 7); - list($itemToken, $itemIp, $itemMethod, $itemUrl, $itemTime, $itemParent) = $values; - $statusCode = isset($values[6]) ? $values[6] : null; - - $itemTime = (int) $itemTime; - - if ($ip && false === strpos($itemIp, $ip) || $url && false === strpos($itemUrl, $url) || $method && false === strpos($itemMethod, $method)) { - continue; - } - - if (!empty($start) && $itemTime < $start) { - continue; - } - - if (!empty($end) && $itemTime > $end) { - continue; - } - - $result[] = array( - 'token' => $itemToken, - 'ip' => $itemIp, - 'method' => $itemMethod, - 'url' => $itemUrl, - 'time' => $itemTime, - 'parent' => $itemParent, - 'status_code' => $statusCode, - ); - --$limit; - } - - return $result; - } - - /** - * {@inheritdoc} - */ - public function purge() - { - // delete only items from index - $indexName = $this->getIndexName(); - - $indexContent = $this->getValue($indexName, self::REDIS_SERIALIZER_NONE); - - if (!$indexContent) { - return false; - } - - $profileList = explode("\n", $indexContent); - - $result = array(); - - foreach ($profileList as $item) { - if ($item == '') { - continue; - } - - if (false !== $pos = strpos($item, "\t")) { - $result[] = $this->getItemName(substr($item, 0, $pos)); - } - } - - $result[] = $indexName; - - return $this->delete($result); - } - - /** - * {@inheritdoc} - */ - public function read($token) - { - if (empty($token)) { - return false; - } - - $profile = $this->getValue($this->getItemName($token), self::REDIS_SERIALIZER_PHP); - - if (false !== $profile) { - $profile = $this->createProfileFromData($token, $profile); - } - - return $profile; - } - - /** - * {@inheritdoc} - */ - public function write(Profile $profile) - { - $data = array( - 'token' => $profile->getToken(), - 'parent' => $profile->getParentToken(), - 'children' => array_map(function ($p) { return $p->getToken(); }, $profile->getChildren()), - 'data' => $profile->getCollectors(), - 'ip' => $profile->getIp(), - 'method' => $profile->getMethod(), - 'url' => $profile->getUrl(), - 'time' => $profile->getTime(), - ); - - $profileIndexed = false !== $this->getValue($this->getItemName($profile->getToken())); - - if ($this->setValue($this->getItemName($profile->getToken()), $data, $this->lifetime, self::REDIS_SERIALIZER_PHP)) { - if (!$profileIndexed) { - // Add to index - $indexName = $this->getIndexName(); - - $indexRow = implode("\t", array( - $profile->getToken(), - $profile->getIp(), - $profile->getMethod(), - $profile->getUrl(), - $profile->getTime(), - $profile->getParentToken(), - $profile->getStatusCode(), - ))."\n"; - - return $this->appendValue($indexName, $indexRow, $this->lifetime); - } - - return true; - } - - return false; - } - - /** - * Internal convenience method that returns the instance of Redis. - * - * @return \Redis - * - * @throws \RuntimeException - */ - protected function getRedis() - { - if (null === $this->redis) { - $data = parse_url($this->dsn); - - if (false === $data || !isset($data['scheme']) || $data['scheme'] !== 'redis' || !isset($data['host']) || !isset($data['port'])) { - throw new \RuntimeException(sprintf('Please check your configuration. You are trying to use Redis with an invalid dsn "%s". The minimal expected format is "redis://[host]:port".', $this->dsn)); - } - - if (!extension_loaded('redis')) { - throw new \RuntimeException('RedisProfilerStorage requires that the redis extension is loaded.'); - } - - $redis = new \Redis(); - $redis->connect($data['host'], $data['port']); - - if (isset($data['path'])) { - $redis->select(substr($data['path'], 1)); - } - - if (isset($data['pass'])) { - $redis->auth($data['pass']); - } - - $redis->setOption(self::REDIS_OPT_PREFIX, self::TOKEN_PREFIX); - - $this->redis = $redis; - } - - return $this->redis; - } - - /** - * Set instance of the Redis. - * - * @param \Redis $redis - */ - public function setRedis($redis) - { - $this->redis = $redis; - } - - private function createProfileFromData($token, $data, $parent = null) - { - $profile = new Profile($token); - $profile->setIp($data['ip']); - $profile->setMethod($data['method']); - $profile->setUrl($data['url']); - $profile->setTime($data['time']); - $profile->setCollectors($data['data']); - - if (!$parent && $data['parent']) { - $parent = $this->read($data['parent']); - } - - if ($parent) { - $profile->setParent($parent); - } - - foreach ($data['children'] as $token) { - if (!$token) { - continue; - } - - if (!$childProfileData = $this->getValue($this->getItemName($token), self::REDIS_SERIALIZER_PHP)) { - continue; - } - - $profile->addChild($this->createProfileFromData($token, $childProfileData, $profile)); - } - - return $profile; - } - - /** - * Gets the item name. - * - * @param string $token - * - * @return string - */ - private function getItemName($token) - { - $name = $token; - - if ($this->isItemNameValid($name)) { - return $name; - } - - return false; - } - - /** - * Gets the name of the index. - * - * @return string - */ - private function getIndexName() - { - $name = 'index'; - - if ($this->isItemNameValid($name)) { - return $name; - } - - return false; - } - - private function isItemNameValid($name) - { - $length = strlen($name); - - if ($length > 2147483648) { - throw new \RuntimeException(sprintf('The Redis item key "%s" is too long (%s bytes). Allowed maximum size is 2^31 bytes.', $name, $length)); - } - - return true; - } - - /** - * Retrieves an item from the Redis server. - * - * @param string $key - * @param int $serializer - * - * @return mixed - */ - private function getValue($key, $serializer = self::REDIS_SERIALIZER_NONE) - { - $redis = $this->getRedis(); - $redis->setOption(self::REDIS_OPT_SERIALIZER, $serializer); - - return $redis->get($key); - } - - /** - * Stores an item on the Redis server under the specified key. - * - * @param string $key - * @param mixed $value - * @param int $expiration - * @param int $serializer - * - * @return bool - */ - private function setValue($key, $value, $expiration = 0, $serializer = self::REDIS_SERIALIZER_NONE) - { - $redis = $this->getRedis(); - $redis->setOption(self::REDIS_OPT_SERIALIZER, $serializer); - - return $redis->setex($key, $expiration, $value); - } - - /** - * Appends data to an existing item on the Redis server. - * - * @param string $key - * @param string $value - * @param int $expiration - * - * @return bool - */ - private function appendValue($key, $value, $expiration = 0) - { - $redis = $this->getRedis(); - $redis->setOption(self::REDIS_OPT_SERIALIZER, self::REDIS_SERIALIZER_NONE); - - if ($redis->exists($key)) { - $redis->append($key, $value); - - return $redis->setTimeout($key, $expiration); - } - - return $redis->setex($key, $expiration, $value); - } - - /** - * Removes the specified keys. - * - * @param array $keys - * - * @return bool - */ - private function delete(array $keys) - { - return (bool) $this->getRedis()->delete($keys); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Profiler/SqliteProfilerStorage.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/Profiler/SqliteProfilerStorage.php deleted file mode 100644 index 4a996fd..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/Profiler/SqliteProfilerStorage.php +++ /dev/null @@ -1,139 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Profiler; - -/** - * SqliteProfilerStorage stores profiling information in a SQLite database. - * - * @author Fabien Potencier - */ -class SqliteProfilerStorage extends PdoProfilerStorage -{ - /** - * @throws \RuntimeException When neither of SQLite3 or PDO_SQLite extension is enabled - */ - protected function initDb() - { - if (null === $this->db || $this->db instanceof \SQLite3) { - if (0 !== strpos($this->dsn, 'sqlite')) { - throw new \RuntimeException(sprintf('Please check your configuration. You are trying to use Sqlite with an invalid dsn "%s". The expected format is "sqlite:/path/to/the/db/file".', $this->dsn)); - } - if (class_exists('SQLite3')) { - $db = new \SQLite3(substr($this->dsn, 7, strlen($this->dsn)), \SQLITE3_OPEN_READWRITE | \SQLITE3_OPEN_CREATE); - if (method_exists($db, 'busyTimeout')) { - // busyTimeout only exists for PHP >= 5.3.3 - $db->busyTimeout(1000); - } - } elseif (class_exists('PDO') && in_array('sqlite', \PDO::getAvailableDrivers(), true)) { - $db = new \PDO($this->dsn); - } else { - throw new \RuntimeException('You need to enable either the SQLite3 or PDO_SQLite extension for the profiler to run properly.'); - } - - $db->exec('PRAGMA temp_store=MEMORY; PRAGMA journal_mode=MEMORY;'); - $db->exec('CREATE TABLE IF NOT EXISTS sf_profiler_data (token STRING, data STRING, ip STRING, method STRING, url STRING, time INTEGER, parent STRING, created_at INTEGER, status_code INTEGER)'); - $db->exec('CREATE INDEX IF NOT EXISTS data_created_at ON sf_profiler_data (created_at)'); - $db->exec('CREATE INDEX IF NOT EXISTS data_ip ON sf_profiler_data (ip)'); - $db->exec('CREATE INDEX IF NOT EXISTS data_method ON sf_profiler_data (method)'); - $db->exec('CREATE INDEX IF NOT EXISTS data_url ON sf_profiler_data (url)'); - $db->exec('CREATE INDEX IF NOT EXISTS data_parent ON sf_profiler_data (parent)'); - $db->exec('CREATE UNIQUE INDEX IF NOT EXISTS data_token ON sf_profiler_data (token)'); - - $this->db = $db; - } - - return $this->db; - } - - protected function exec($db, $query, array $args = array()) - { - if ($db instanceof \SQLite3) { - $stmt = $this->prepareStatement($db, $query); - foreach ($args as $arg => $val) { - $stmt->bindValue($arg, $val, is_int($val) ? \SQLITE3_INTEGER : \SQLITE3_TEXT); - } - - $res = $stmt->execute(); - if (false === $res) { - throw new \RuntimeException(sprintf('Error executing SQLite query "%s"', $query)); - } - $res->finalize(); - } else { - parent::exec($db, $query, $args); - } - } - - protected function fetch($db, $query, array $args = array()) - { - $return = array(); - - if ($db instanceof \SQLite3) { - $stmt = $this->prepareStatement($db, $query, true); - foreach ($args as $arg => $val) { - $stmt->bindValue($arg, $val, is_int($val) ? \SQLITE3_INTEGER : \SQLITE3_TEXT); - } - $res = $stmt->execute(); - while ($row = $res->fetchArray(\SQLITE3_ASSOC)) { - $return[] = $row; - } - $res->finalize(); - $stmt->close(); - } else { - $return = parent::fetch($db, $query, $args); - } - - return $return; - } - - /** - * {@inheritdoc} - */ - protected function buildCriteria($ip, $url, $start, $end, $limit, $method) - { - $criteria = array(); - $args = array(); - - if ($ip = preg_replace('/[^\d\.]/', '', $ip)) { - $criteria[] = 'ip LIKE :ip'; - $args[':ip'] = '%'.$ip.'%'; - } - - if ($url) { - $criteria[] = 'url LIKE :url ESCAPE "\"'; - $args[':url'] = '%'.addcslashes($url, '%_\\').'%'; - } - - if ($method) { - $criteria[] = 'method = :method'; - $args[':method'] = $method; - } - - if (!empty($start)) { - $criteria[] = 'time >= :start'; - $args[':start'] = $start; - } - - if (!empty($end)) { - $criteria[] = 'time <= :end'; - $args[':end'] = $end; - } - - return array($criteria, $args); - } - - protected function close($db) - { - if ($db instanceof \SQLite3) { - $db->close(); - } - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/README.md b/sitecake/2.2.9/server/vendor/symfony/http-kernel/README.md deleted file mode 100644 index 9ec8c04..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/README.md +++ /dev/null @@ -1,99 +0,0 @@ -HttpKernel Component -==================== - -HttpKernel provides the building blocks to create flexible and fast HTTP-based -frameworks. - -``HttpKernelInterface`` is the core interface of the Symfony full-stack -framework: - -```php -interface HttpKernelInterface -{ - /** - * Handles a Request to convert it to a Response. - * - * @param Request $request A Request instance - * - * @return Response A Response instance - */ - function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true); -} -``` - -It takes a ``Request`` as an input and should return a ``Response`` as an -output. Using this interface makes your code compatible with all frameworks -using the Symfony components. And this will give you many cool features for -free. - -Creating a framework based on the Symfony components is really easy. Here is -a very simple, but fully-featured framework based on the Symfony components: - -```php -$routes = new RouteCollection(); -$routes->add('hello', new Route('/hello', array('_controller' => - function (Request $request) { - return new Response(sprintf("Hello %s", $request->get('name'))); - } -))); - -$request = Request::createFromGlobals(); - -$context = new RequestContext(); -$context->fromRequest($request); - -$matcher = new UrlMatcher($routes, $context); - -$dispatcher = new EventDispatcher(); -$dispatcher->addSubscriber(new RouterListener($matcher)); - -$resolver = new ControllerResolver(); - -$kernel = new HttpKernel($dispatcher, $resolver); - -$kernel->handle($request)->send(); -``` - -This is all you need to create a flexible framework with the Symfony -components. - -Want to add an HTTP reverse proxy and benefit from HTTP caching and Edge Side -Includes? - -```php -$kernel = new HttpKernel($dispatcher, $resolver); - -$kernel = new HttpCache($kernel, new Store(__DIR__.'/cache')); -``` - -Want to functional test this small framework? - -```php -$client = new Client($kernel); -$crawler = $client->request('GET', '/hello/Fabien'); - -$this->assertEquals('Fabien', $crawler->filter('p > span')->text()); -``` - -Want nice error pages instead of ugly PHP exceptions? - -```php -$dispatcher->addSubscriber(new ExceptionListener(function (Request $request) { - $msg = 'Something went wrong! ('.$request->get('exception')->getMessage().')'; - - return new Response($msg, 500); -})); -``` - -And that's why the simple looking ``HttpKernelInterface`` is so powerful. It -gives you access to a lot of cool features, ready to be used out of the box, -with no efforts. - -Resources ---------- - -You can run the unit tests with the following command: - - $ cd path/to/Symfony/Component/HttpKernel/ - $ composer install - $ phpunit diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/TerminableInterface.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/TerminableInterface.php deleted file mode 100644 index fc0e580..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/TerminableInterface.php +++ /dev/null @@ -1,39 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; - -/** - * Terminable extends the Kernel request/response cycle with dispatching a post - * response event after sending the response and before shutting down the kernel. - * - * @author Jordi Boggiano - * @author Pierre Minnieur - * - * @api - */ -interface TerminableInterface -{ - /** - * Terminates a request/response cycle. - * - * Should be called after sending the response and before shutting down the kernel. - * - * @param Request $request A Request instance - * @param Response $response A Response instance - * - * @api - */ - public function terminate(Request $request, Response $response); -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/UriSigner.php b/sitecake/2.2.9/server/vendor/symfony/http-kernel/UriSigner.php deleted file mode 100644 index 6ddce87..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/UriSigner.php +++ /dev/null @@ -1,109 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel; - -/** - * Signs URIs. - * - * @author Fabien Potencier - */ -class UriSigner -{ - private $secret; - - /** - * Constructor. - * - * @param string $secret A secret - */ - public function __construct($secret) - { - $this->secret = $secret; - } - - /** - * Signs a URI. - * - * The given URI is signed by adding a _hash query string parameter - * which value depends on the URI and the secret. - * - * @param string $uri A URI to sign - * - * @return string The signed URI - */ - public function sign($uri) - { - $url = parse_url($uri); - if (isset($url['query'])) { - parse_str($url['query'], $params); - } else { - $params = array(); - } - - $uri = $this->buildUrl($url, $params); - - return $uri.(false === (strpos($uri, '?')) ? '?' : '&').'_hash='.$this->computeHash($uri); - } - - /** - * Checks that a URI contains the correct hash. - * - * The _hash query string parameter must be the last one - * (as it is generated that way by the sign() method, it should - * never be a problem). - * - * @param string $uri A signed URI - * - * @return bool True if the URI is signed correctly, false otherwise - */ - public function check($uri) - { - $url = parse_url($uri); - if (isset($url['query'])) { - parse_str($url['query'], $params); - } else { - $params = array(); - } - - if (empty($params['_hash'])) { - return false; - } - - $hash = urlencode($params['_hash']); - unset($params['_hash']); - - return $this->computeHash($this->buildUrl($url, $params)) === $hash; - } - - private function computeHash($uri) - { - return urlencode(base64_encode(hash_hmac('sha256', $uri, $this->secret, true))); - } - - private function buildUrl(array $url, array $params = array()) - { - ksort($params); - $url['query'] = http_build_query($params, '', '&'); - - $scheme = isset($url['scheme']) ? $url['scheme'].'://' : ''; - $host = isset($url['host']) ? $url['host'] : ''; - $port = isset($url['port']) ? ':'.$url['port'] : ''; - $user = isset($url['user']) ? $url['user'] : ''; - $pass = isset($url['pass']) ? ':'.$url['pass'] : ''; - $pass = ($user || $pass) ? "$pass@" : ''; - $path = isset($url['path']) ? $url['path'] : ''; - $query = isset($url['query']) && $url['query'] ? '?'.$url['query'] : ''; - $fragment = isset($url['fragment']) ? '#'.$url['fragment'] : ''; - - return $scheme.$user.$pass.$host.$port.$path.$query.$fragment; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/composer.json b/sitecake/2.2.9/server/vendor/symfony/http-kernel/composer.json deleted file mode 100644 index 9c1cc0b..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/composer.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "name": "symfony/http-kernel", - "type": "library", - "description": "Symfony HttpKernel Component", - "keywords": [], - "homepage": "https://symfony.com", - "license": "MIT", - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "require": { - "php": ">=5.3.9", - "symfony/event-dispatcher": "~2.5.9|~2.6,>=2.6.2", - "symfony/http-foundation": "~2.5,>=2.5.4", - "symfony/debug": "~2.6,>=2.6.2", - "psr/log": "~1.0" - }, - "require-dev": { - "symfony/phpunit-bridge": "~2.7", - "symfony/browser-kit": "~2.3", - "symfony/class-loader": "~2.1", - "symfony/config": "~2.7", - "symfony/console": "~2.3", - "symfony/css-selector": "~2.0,>=2.0.5", - "symfony/dependency-injection": "~2.2", - "symfony/dom-crawler": "~2.0,>=2.0.5", - "symfony/expression-language": "~2.4", - "symfony/finder": "~2.0,>=2.0.5", - "symfony/process": "~2.0,>=2.0.5", - "symfony/routing": "~2.2", - "symfony/stopwatch": "~2.3", - "symfony/templating": "~2.2", - "symfony/translation": "~2.0,>=2.0.5", - "symfony/var-dumper": "~2.6" - }, - "conflict": { - "symfony/config": "<2.7" - }, - "suggest": { - "symfony/browser-kit": "", - "symfony/class-loader": "", - "symfony/config": "", - "symfony/console": "", - "symfony/dependency-injection": "", - "symfony/finder": "", - "symfony/var-dumper": "" - }, - "autoload": { - "psr-4": { "Symfony\\Component\\HttpKernel\\": "" } - }, - "minimum-stability": "dev", - "extra": { - "branch-alias": { - "dev-master": "2.7-dev" - } - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/http-kernel/phpunit.xml.dist b/sitecake/2.2.9/server/vendor/symfony/http-kernel/phpunit.xml.dist deleted file mode 100644 index 1314966..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/http-kernel/phpunit.xml.dist +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - ./Tests/ - - - - - - ./ - - ./Tests - ./vendor - - - - diff --git a/sitecake/2.2.9/server/vendor/symfony/routing/Annotation/Route.php b/sitecake/2.2.9/server/vendor/symfony/routing/Annotation/Route.php deleted file mode 100644 index d5bfea5..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/routing/Annotation/Route.php +++ /dev/null @@ -1,182 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Annotation; - -/** - * Annotation class for @Route(). - * - * @Annotation - * @Target({"CLASS", "METHOD"}) - * - * @author Fabien Potencier - */ -class Route -{ - private $path; - private $name; - private $requirements = array(); - private $options = array(); - private $defaults = array(); - private $host; - private $methods = array(); - private $schemes = array(); - private $condition; - - /** - * Constructor. - * - * @param array $data An array of key/value parameters. - * - * @throws \BadMethodCallException - */ - public function __construct(array $data) - { - if (isset($data['value'])) { - $data['path'] = $data['value']; - unset($data['value']); - } - - foreach ($data as $key => $value) { - $method = 'set'.str_replace('_', '', $key); - if (!method_exists($this, $method)) { - throw new \BadMethodCallException(sprintf("Unknown property '%s' on annotation '%s'.", $key, get_class($this))); - } - $this->$method($value); - } - } - - /** - * @deprecated since version 2.2, to be removed in 3.0. Use setPath instead. - */ - public function setPattern($pattern) - { - @trigger_error('The '.__METHOD__.' method is deprecated since version 2.2 and will be removed in 3.0. Use the setPath() method instead and use the "path" option instead of the "pattern" option in the route definition.', E_USER_DEPRECATED); - - $this->path = $pattern; - } - - /** - * @deprecated since version 2.2, to be removed in 3.0. Use getPath instead. - */ - public function getPattern() - { - @trigger_error('The '.__METHOD__.' method is deprecated since version 2.2 and will be removed in 3.0. Use the getPath() method instead and use the "path" option instead of the "pattern" option in the route definition.', E_USER_DEPRECATED); - - return $this->path; - } - - public function setPath($path) - { - $this->path = $path; - } - - public function getPath() - { - return $this->path; - } - - public function setHost($pattern) - { - $this->host = $pattern; - } - - public function getHost() - { - return $this->host; - } - - public function setName($name) - { - $this->name = $name; - } - - public function getName() - { - return $this->name; - } - - public function setRequirements($requirements) - { - if (isset($requirements['_method'])) { - if (0 === count($this->methods)) { - $this->methods = explode('|', $requirements['_method']); - } - - @trigger_error('The "_method" requirement is deprecated since version 2.2 and will be removed in 3.0. Use the "methods" option instead.', E_USER_DEPRECATED); - } - - if (isset($requirements['_scheme'])) { - if (0 === count($this->schemes)) { - $this->schemes = explode('|', $requirements['_scheme']); - } - - @trigger_error('The "_scheme" requirement is deprecated since version 2.2 and will be removed in 3.0. Use the "schemes" option instead.', E_USER_DEPRECATED); - } - - $this->requirements = $requirements; - } - - public function getRequirements() - { - return $this->requirements; - } - - public function setOptions($options) - { - $this->options = $options; - } - - public function getOptions() - { - return $this->options; - } - - public function setDefaults($defaults) - { - $this->defaults = $defaults; - } - - public function getDefaults() - { - return $this->defaults; - } - - public function setSchemes($schemes) - { - $this->schemes = is_array($schemes) ? $schemes : array($schemes); - } - - public function getSchemes() - { - return $this->schemes; - } - - public function setMethods($methods) - { - $this->methods = is_array($methods) ? $methods : array($methods); - } - - public function getMethods() - { - return $this->methods; - } - - public function setCondition($condition) - { - $this->condition = $condition; - } - - public function getCondition() - { - return $this->condition; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/routing/CHANGELOG.md b/sitecake/2.2.9/server/vendor/symfony/routing/CHANGELOG.md deleted file mode 100644 index b5fd9db..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/routing/CHANGELOG.md +++ /dev/null @@ -1,177 +0,0 @@ -CHANGELOG -========= - -2.5.0 ------ - - * [DEPRECATION] The `ApacheMatcherDumper` and `ApacheUrlMatcher` were deprecated and - will be removed in Symfony 3.0, since the performance gains were minimal and - it's hard to replicate the behaviour of PHP implementation. - -2.3.0 ------ - - * added RequestContext::getQueryString() - -2.2.0 ------ - - * [DEPRECATION] Several route settings have been renamed (the old ones will be removed in 3.0): - - * The `pattern` setting for a route has been deprecated in favor of `path` - * The `_scheme` and `_method` requirements have been moved to the `schemes` and `methods` settings - - Before: - - ```yaml - article_edit: - pattern: /article/{id} - requirements: { '_method': 'POST|PUT', '_scheme': 'https', 'id': '\d+' } - ``` - - ```xml - - POST|PUT - https - \d+ - - ``` - - ```php - $route = new Route(); - $route->setPattern('/article/{id}'); - $route->setRequirement('_method', 'POST|PUT'); - $route->setRequirement('_scheme', 'https'); - ``` - - After: - - ```yaml - article_edit: - path: /article/{id} - methods: [POST, PUT] - schemes: https - requirements: { 'id': '\d+' } - ``` - - ```xml - - \d+ - - ``` - - ```php - $route = new Route(); - $route->setPath('/article/{id}'); - $route->setMethods(array('POST', 'PUT')); - $route->setSchemes('https'); - ``` - - * [BC BREAK] RouteCollection does not behave like a tree structure anymore but as - a flat array of Routes. So when using PHP to build the RouteCollection, you must - make sure to add routes to the sub-collection before adding it to the parent - collection (this is not relevant when using YAML or XML for Route definitions). - - Before: - - ```php - $rootCollection = new RouteCollection(); - $subCollection = new RouteCollection(); - $rootCollection->addCollection($subCollection); - $subCollection->add('foo', new Route('/foo')); - ``` - - After: - - ```php - $rootCollection = new RouteCollection(); - $subCollection = new RouteCollection(); - $subCollection->add('foo', new Route('/foo')); - $rootCollection->addCollection($subCollection); - ``` - - Also one must call `addCollection` from the bottom to the top hierarchy. - So the correct sequence is the following (and not the reverse): - - ```php - $childCollection->addCollection($grandchildCollection); - $rootCollection->addCollection($childCollection); - ``` - - * [DEPRECATION] The methods `RouteCollection::getParent()` and `RouteCollection::getRoot()` - have been deprecated and will be removed in Symfony 2.3. - * [BC BREAK] Misusing the `RouteCollection::addPrefix` method to add defaults, requirements - or options without adding a prefix is not supported anymore. So if you called `addPrefix` - with an empty prefix or `/` only (both have no relevance), like - `addPrefix('', $defaultsArray, $requirementsArray, $optionsArray)` - you need to use the new dedicated methods `addDefaults($defaultsArray)`, - `addRequirements($requirementsArray)` or `addOptions($optionsArray)` instead. - * [DEPRECATION] The `$options` parameter to `RouteCollection::addPrefix()` has been deprecated - because adding options has nothing to do with adding a path prefix. If you want to add options - to all child routes of a RouteCollection, you can use `addOptions()`. - * [DEPRECATION] The method `RouteCollection::getPrefix()` has been deprecated - because it suggested that all routes in the collection would have this prefix, which is - not necessarily true. On top of that, since there is no tree structure anymore, this method - is also useless. Don't worry about performance, prefix optimization for matching is still done - in the dumper, which was also improved in 2.2.0 to find even more grouping possibilities. - * [DEPRECATION] `RouteCollection::addCollection(RouteCollection $collection)` should now only be - used with a single parameter. The other params `$prefix`, `$default`, `$requirements` and `$options` - will still work, but have been deprecated. The `addPrefix` method should be used for this - use-case instead. - Before: `$parentCollection->addCollection($collection, '/prefix', array(...), array(...))` - After: - ```php - $collection->addPrefix('/prefix', array(...), array(...)); - $parentCollection->addCollection($collection); - ``` - * added support for the method default argument values when defining a @Route - * Adjacent placeholders without separator work now, e.g. `/{x}{y}{z}.{_format}`. - * Characters that function as separator between placeholders are now whitelisted - to fix routes with normal text around a variable, e.g. `/prefix{var}suffix`. - * [BC BREAK] The default requirement of a variable has been changed slightly. - Previously it disallowed the previous and the next char around a variable. Now - it disallows the slash (`/`) and the next char. Using the previous char added - no value and was problematic because the route `/index.{_format}` would be - matched by `/index.ht/ml`. - * The default requirement now uses possessive quantifiers when possible which - improves matching performance by up to 20% because it prevents backtracking - when it's not needed. - * The ConfigurableRequirementsInterface can now also be used to disable the requirements - check on URL generation completely by calling `setStrictRequirements(null)`. It - improves performance in production environment as you should know that params always - pass the requirements (otherwise it would break your link anyway). - * There is no restriction on the route name anymore. So non-alphanumeric characters - are now also allowed. - * [BC BREAK] `RouteCompilerInterface::compile(Route $route)` was made static - (only relevant if you implemented your own RouteCompiler). - * Added possibility to generate relative paths and network paths in the UrlGenerator, e.g. - "../parent-file" and "//example.com/dir/file". The third parameter in - `UrlGeneratorInterface::generate($name, $parameters = array(), $referenceType = self::ABSOLUTE_PATH)` - now accepts more values and you should use the constants defined in `UrlGeneratorInterface` for - claritiy. The old method calls with a Boolean parameter will continue to work because they - equal the signature using the constants. - -2.1.0 ------ - - * added RequestMatcherInterface - * added RequestContext::fromRequest() - * the UrlMatcher does not throw a \LogicException anymore when the required - scheme is not the current one - * added TraceableUrlMatcher - * added the possibility to define options, default values and requirements - for placeholders in prefix, including imported routes - * added RouterInterface::getRouteCollection - * [BC BREAK] the UrlMatcher urldecodes the route parameters only once, they - were decoded twice before. Note that the `urldecode()` calls have been - changed for a single `rawurldecode()` in order to support `+` for input - paths. - * added RouteCollection::getRoot method to retrieve the root of a - RouteCollection tree - * [BC BREAK] made RouteCollection::setParent private which could not have - been used anyway without creating inconsistencies - * [BC BREAK] RouteCollection::remove also removes a route from parent - collections (not only from its children) - * added ConfigurableRequirementsInterface that allows to disable exceptions - (and generate empty URLs instead) when generating a route with an invalid - parameter value diff --git a/sitecake/2.2.9/server/vendor/symfony/routing/CompiledRoute.php b/sitecake/2.2.9/server/vendor/symfony/routing/CompiledRoute.php deleted file mode 100644 index 3eca9ec..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/routing/CompiledRoute.php +++ /dev/null @@ -1,166 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing; - -/** - * CompiledRoutes are returned by the RouteCompiler class. - * - * @author Fabien Potencier - */ -class CompiledRoute implements \Serializable -{ - private $variables; - private $tokens; - private $staticPrefix; - private $regex; - private $pathVariables; - private $hostVariables; - private $hostRegex; - private $hostTokens; - - /** - * Constructor. - * - * @param string $staticPrefix The static prefix of the compiled route - * @param string $regex The regular expression to use to match this route - * @param array $tokens An array of tokens to use to generate URL for this route - * @param array $pathVariables An array of path variables - * @param string|null $hostRegex Host regex - * @param array $hostTokens Host tokens - * @param array $hostVariables An array of host variables - * @param array $variables An array of variables (variables defined in the path and in the host patterns) - */ - public function __construct($staticPrefix, $regex, array $tokens, array $pathVariables, $hostRegex = null, array $hostTokens = array(), array $hostVariables = array(), array $variables = array()) - { - $this->staticPrefix = (string) $staticPrefix; - $this->regex = $regex; - $this->tokens = $tokens; - $this->pathVariables = $pathVariables; - $this->hostRegex = $hostRegex; - $this->hostTokens = $hostTokens; - $this->hostVariables = $hostVariables; - $this->variables = $variables; - } - - /** - * {@inheritdoc} - */ - public function serialize() - { - return serialize(array( - 'vars' => $this->variables, - 'path_prefix' => $this->staticPrefix, - 'path_regex' => $this->regex, - 'path_tokens' => $this->tokens, - 'path_vars' => $this->pathVariables, - 'host_regex' => $this->hostRegex, - 'host_tokens' => $this->hostTokens, - 'host_vars' => $this->hostVariables, - )); - } - - /** - * {@inheritdoc} - */ - public function unserialize($serialized) - { - $data = unserialize($serialized); - $this->variables = $data['vars']; - $this->staticPrefix = $data['path_prefix']; - $this->regex = $data['path_regex']; - $this->tokens = $data['path_tokens']; - $this->pathVariables = $data['path_vars']; - $this->hostRegex = $data['host_regex']; - $this->hostTokens = $data['host_tokens']; - $this->hostVariables = $data['host_vars']; - } - - /** - * Returns the static prefix. - * - * @return string The static prefix - */ - public function getStaticPrefix() - { - return $this->staticPrefix; - } - - /** - * Returns the regex. - * - * @return string The regex - */ - public function getRegex() - { - return $this->regex; - } - - /** - * Returns the host regex. - * - * @return string|null The host regex or null - */ - public function getHostRegex() - { - return $this->hostRegex; - } - - /** - * Returns the tokens. - * - * @return array The tokens - */ - public function getTokens() - { - return $this->tokens; - } - - /** - * Returns the host tokens. - * - * @return array The tokens - */ - public function getHostTokens() - { - return $this->hostTokens; - } - - /** - * Returns the variables. - * - * @return array The variables - */ - public function getVariables() - { - return $this->variables; - } - - /** - * Returns the path variables. - * - * @return array The variables - */ - public function getPathVariables() - { - return $this->pathVariables; - } - - /** - * Returns the host variables. - * - * @return array The variables - */ - public function getHostVariables() - { - return $this->hostVariables; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/routing/Exception/ExceptionInterface.php b/sitecake/2.2.9/server/vendor/symfony/routing/Exception/ExceptionInterface.php deleted file mode 100644 index 9fcd224..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/routing/Exception/ExceptionInterface.php +++ /dev/null @@ -1,23 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Exception; - -/** - * ExceptionInterface. - * - * @author Alexandre Salomé - * - * @api - */ -interface ExceptionInterface -{ -} diff --git a/sitecake/2.2.9/server/vendor/symfony/routing/Exception/InvalidParameterException.php b/sitecake/2.2.9/server/vendor/symfony/routing/Exception/InvalidParameterException.php deleted file mode 100644 index ae37c34..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/routing/Exception/InvalidParameterException.php +++ /dev/null @@ -1,23 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Exception; - -/** - * Exception thrown when a parameter is not valid. - * - * @author Alexandre Salomé - * - * @api - */ -class InvalidParameterException extends \InvalidArgumentException implements ExceptionInterface -{ -} diff --git a/sitecake/2.2.9/server/vendor/symfony/routing/Exception/MethodNotAllowedException.php b/sitecake/2.2.9/server/vendor/symfony/routing/Exception/MethodNotAllowedException.php deleted file mode 100644 index 32f1091..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/routing/Exception/MethodNotAllowedException.php +++ /dev/null @@ -1,46 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Exception; - -/** - * The resource was found but the request method is not allowed. - * - * This exception should trigger an HTTP 405 response in your application code. - * - * @author Kris Wallsmith - * - * @api - */ -class MethodNotAllowedException extends \RuntimeException implements ExceptionInterface -{ - /** - * @var array - */ - protected $allowedMethods = array(); - - public function __construct(array $allowedMethods, $message = null, $code = 0, \Exception $previous = null) - { - $this->allowedMethods = array_map('strtoupper', $allowedMethods); - - parent::__construct($message, $code, $previous); - } - - /** - * Gets the allowed HTTP methods. - * - * @return array - */ - public function getAllowedMethods() - { - return $this->allowedMethods; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/routing/Exception/MissingMandatoryParametersException.php b/sitecake/2.2.9/server/vendor/symfony/routing/Exception/MissingMandatoryParametersException.php deleted file mode 100644 index 5a523fa..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/routing/Exception/MissingMandatoryParametersException.php +++ /dev/null @@ -1,24 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Exception; - -/** - * Exception thrown when a route cannot be generated because of missing - * mandatory parameters. - * - * @author Alexandre Salomé - * - * @api - */ -class MissingMandatoryParametersException extends \InvalidArgumentException implements ExceptionInterface -{ -} diff --git a/sitecake/2.2.9/server/vendor/symfony/routing/Exception/ResourceNotFoundException.php b/sitecake/2.2.9/server/vendor/symfony/routing/Exception/ResourceNotFoundException.php deleted file mode 100644 index 362a0d6..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/routing/Exception/ResourceNotFoundException.php +++ /dev/null @@ -1,25 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Exception; - -/** - * The resource was not found. - * - * This exception should trigger an HTTP 404 response in your application code. - * - * @author Kris Wallsmith - * - * @api - */ -class ResourceNotFoundException extends \RuntimeException implements ExceptionInterface -{ -} diff --git a/sitecake/2.2.9/server/vendor/symfony/routing/Exception/RouteNotFoundException.php b/sitecake/2.2.9/server/vendor/symfony/routing/Exception/RouteNotFoundException.php deleted file mode 100644 index 8059e45..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/routing/Exception/RouteNotFoundException.php +++ /dev/null @@ -1,23 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Exception; - -/** - * Exception thrown when a route does not exist. - * - * @author Alexandre Salomé - * - * @api - */ -class RouteNotFoundException extends \InvalidArgumentException implements ExceptionInterface -{ -} diff --git a/sitecake/2.2.9/server/vendor/symfony/routing/Generator/ConfigurableRequirementsInterface.php b/sitecake/2.2.9/server/vendor/symfony/routing/Generator/ConfigurableRequirementsInterface.php deleted file mode 100644 index dc97b7e..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/routing/Generator/ConfigurableRequirementsInterface.php +++ /dev/null @@ -1,55 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Generator; - -/** - * ConfigurableRequirementsInterface must be implemented by URL generators that - * can be configured whether an exception should be generated when the parameters - * do not match the requirements. It is also possible to disable the requirements - * check for URL generation completely. - * - * The possible configurations and use-cases: - * - setStrictRequirements(true): Throw an exception for mismatching requirements. This - * is mostly useful in development environment. - * - setStrictRequirements(false): Don't throw an exception but return null as URL for - * mismatching requirements and log the problem. Useful when you cannot control all - * params because they come from third party libs but don't want to have a 404 in - * production environment. It should log the mismatch so one can review it. - * - setStrictRequirements(null): Return the URL with the given parameters without - * checking the requirements at all. When generating a URL you should either trust - * your params or you validated them beforehand because otherwise it would break your - * link anyway. So in production environment you should know that params always pass - * the requirements. Thus this option allows to disable the check on URL generation for - * performance reasons (saving a preg_match for each requirement every time a URL is - * generated). - * - * @author Fabien Potencier - * @author Tobias Schultze - */ -interface ConfigurableRequirementsInterface -{ - /** - * Enables or disables the exception on incorrect parameters. - * Passing null will deactivate the requirements check completely. - * - * @param bool|null $enabled - */ - public function setStrictRequirements($enabled); - - /** - * Returns whether to throw an exception on incorrect parameters. - * Null means the requirements check is deactivated completely. - * - * @return bool|null - */ - public function isStrictRequirements(); -} diff --git a/sitecake/2.2.9/server/vendor/symfony/routing/Generator/Dumper/GeneratorDumper.php b/sitecake/2.2.9/server/vendor/symfony/routing/Generator/Dumper/GeneratorDumper.php deleted file mode 100644 index 4739bd8..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/routing/Generator/Dumper/GeneratorDumper.php +++ /dev/null @@ -1,45 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Generator\Dumper; - -use Symfony\Component\Routing\RouteCollection; - -/** - * GeneratorDumper is the base class for all built-in generator dumpers. - * - * @author Fabien Potencier - */ -abstract class GeneratorDumper implements GeneratorDumperInterface -{ - /** - * @var RouteCollection - */ - private $routes; - - /** - * Constructor. - * - * @param RouteCollection $routes The RouteCollection to dump - */ - public function __construct(RouteCollection $routes) - { - $this->routes = $routes; - } - - /** - * {@inheritdoc} - */ - public function getRoutes() - { - return $this->routes; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/routing/Generator/Dumper/GeneratorDumperInterface.php b/sitecake/2.2.9/server/vendor/symfony/routing/Generator/Dumper/GeneratorDumperInterface.php deleted file mode 100644 index deb0c0a..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/routing/Generator/Dumper/GeneratorDumperInterface.php +++ /dev/null @@ -1,41 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Generator\Dumper; - -use Symfony\Component\Routing\RouteCollection; - -/** - * GeneratorDumperInterface is the interface that all generator dumper classes must implement. - * - * @author Fabien Potencier - * - * @api - */ -interface GeneratorDumperInterface -{ - /** - * Dumps a set of routes to a string representation of executable code - * that can then be used to generate a URL of such a route. - * - * @param array $options An array of options - * - * @return string Executable code - */ - public function dump(array $options = array()); - - /** - * Gets the routes to dump. - * - * @return RouteCollection A RouteCollection instance - */ - public function getRoutes(); -} diff --git a/sitecake/2.2.9/server/vendor/symfony/routing/Generator/Dumper/PhpGeneratorDumper.php b/sitecake/2.2.9/server/vendor/symfony/routing/Generator/Dumper/PhpGeneratorDumper.php deleted file mode 100644 index 9b7e483..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/routing/Generator/Dumper/PhpGeneratorDumper.php +++ /dev/null @@ -1,124 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Generator\Dumper; - -/** - * PhpGeneratorDumper creates a PHP class able to generate URLs for a given set of routes. - * - * @author Fabien Potencier - * @author Tobias Schultze - * - * @api - */ -class PhpGeneratorDumper extends GeneratorDumper -{ - /** - * Dumps a set of routes to a PHP class. - * - * Available options: - * - * * class: The class name - * * base_class: The base class name - * - * @param array $options An array of options - * - * @return string A PHP class representing the generator class - * - * @api - */ - public function dump(array $options = array()) - { - $options = array_merge(array( - 'class' => 'ProjectUrlGenerator', - 'base_class' => 'Symfony\\Component\\Routing\\Generator\\UrlGenerator', - ), $options); - - return <<generateDeclaredRoutes()}; - - /** - * Constructor. - */ - public function __construct(RequestContext \$context, LoggerInterface \$logger = null) - { - \$this->context = \$context; - \$this->logger = \$logger; - } - -{$this->generateGenerateMethod()} -} - -EOF; - } - - /** - * Generates PHP code representing an array of defined routes - * together with the routes properties (e.g. requirements). - * - * @return string PHP code - */ - private function generateDeclaredRoutes() - { - $routes = "array(\n"; - foreach ($this->getRoutes()->all() as $name => $route) { - $compiledRoute = $route->compile(); - - $properties = array(); - $properties[] = $compiledRoute->getVariables(); - $properties[] = $route->getDefaults(); - $properties[] = $route->getRequirements(); - $properties[] = $compiledRoute->getTokens(); - $properties[] = $compiledRoute->getHostTokens(); - $properties[] = $route->getSchemes(); - - $routes .= sprintf(" '%s' => %s,\n", $name, str_replace("\n", '', var_export($properties, true))); - } - $routes .= ' )'; - - return $routes; - } - - /** - * Generates PHP code representing the `generate` method that implements the UrlGeneratorInterface. - * - * @return string PHP code - */ - private function generateGenerateMethod() - { - return <<doGenerate(\$variables, \$defaults, \$requirements, \$tokens, \$parameters, \$name, \$referenceType, \$hostTokens, \$requiredSchemes); - } -EOF; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/routing/Generator/UrlGenerator.php b/sitecake/2.2.9/server/vendor/symfony/routing/Generator/UrlGenerator.php deleted file mode 100644 index 5fe943b..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/routing/Generator/UrlGenerator.php +++ /dev/null @@ -1,340 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Generator; - -use Symfony\Component\Routing\RouteCollection; -use Symfony\Component\Routing\RequestContext; -use Symfony\Component\Routing\Exception\InvalidParameterException; -use Symfony\Component\Routing\Exception\RouteNotFoundException; -use Symfony\Component\Routing\Exception\MissingMandatoryParametersException; -use Psr\Log\LoggerInterface; - -/** - * UrlGenerator can generate a URL or a path for any route in the RouteCollection - * based on the passed parameters. - * - * @author Fabien Potencier - * @author Tobias Schultze - * - * @api - */ -class UrlGenerator implements UrlGeneratorInterface, ConfigurableRequirementsInterface -{ - /** - * @var RouteCollection - */ - protected $routes; - - /** - * @var RequestContext - */ - protected $context; - - /** - * @var bool|null - */ - protected $strictRequirements = true; - - /** - * @var LoggerInterface|null - */ - protected $logger; - - /** - * This array defines the characters (besides alphanumeric ones) that will not be percent-encoded in the path segment of the generated URL. - * - * PHP's rawurlencode() encodes all chars except "a-zA-Z0-9-._~" according to RFC 3986. But we want to allow some chars - * to be used in their literal form (reasons below). Other chars inside the path must of course be encoded, e.g. - * "?" and "#" (would be interpreted wrongly as query and fragment identifier), - * "'" and """ (are used as delimiters in HTML). - */ - protected $decodedChars = array( - // the slash can be used to designate a hierarchical structure and we want allow using it with this meaning - // some webservers don't allow the slash in encoded form in the path for security reasons anyway - // see http://stackoverflow.com/questions/4069002/http-400-if-2f-part-of-get-url-in-jboss - '%2F' => '/', - // the following chars are general delimiters in the URI specification but have only special meaning in the authority component - // so they can safely be used in the path in unencoded form - '%40' => '@', - '%3A' => ':', - // these chars are only sub-delimiters that have no predefined meaning and can therefore be used literally - // so URI producing applications can use these chars to delimit subcomponents in a path segment without being encoded for better readability - '%3B' => ';', - '%2C' => ',', - '%3D' => '=', - '%2B' => '+', - '%21' => '!', - '%2A' => '*', - '%7C' => '|', - ); - - /** - * Constructor. - * - * @param RouteCollection $routes A RouteCollection instance - * @param RequestContext $context The context - * @param LoggerInterface|null $logger A logger instance - * - * @api - */ - public function __construct(RouteCollection $routes, RequestContext $context, LoggerInterface $logger = null) - { - $this->routes = $routes; - $this->context = $context; - $this->logger = $logger; - } - - /** - * {@inheritdoc} - */ - public function setContext(RequestContext $context) - { - $this->context = $context; - } - - /** - * {@inheritdoc} - */ - public function getContext() - { - return $this->context; - } - - /** - * {@inheritdoc} - */ - public function setStrictRequirements($enabled) - { - $this->strictRequirements = null === $enabled ? null : (bool) $enabled; - } - - /** - * {@inheritdoc} - */ - public function isStrictRequirements() - { - return $this->strictRequirements; - } - - /** - * {@inheritdoc} - */ - public function generate($name, $parameters = array(), $referenceType = self::ABSOLUTE_PATH) - { - if (null === $route = $this->routes->get($name)) { - throw new RouteNotFoundException(sprintf('Unable to generate a URL for the named route "%s" as such route does not exist.', $name)); - } - - // the Route has a cache of its own and is not recompiled as long as it does not get modified - $compiledRoute = $route->compile(); - - return $this->doGenerate($compiledRoute->getVariables(), $route->getDefaults(), $route->getRequirements(), $compiledRoute->getTokens(), $parameters, $name, $referenceType, $compiledRoute->getHostTokens(), $route->getSchemes()); - } - - /** - * @throws MissingMandatoryParametersException When some parameters are missing that are mandatory for the route - * @throws InvalidParameterException When a parameter value for a placeholder is not correct because - * it does not match the requirement - */ - protected function doGenerate($variables, $defaults, $requirements, $tokens, $parameters, $name, $referenceType, $hostTokens, array $requiredSchemes = array()) - { - $variables = array_flip($variables); - $mergedParams = array_replace($defaults, $this->context->getParameters(), $parameters); - - // all params must be given - if ($diff = array_diff_key($variables, $mergedParams)) { - throw new MissingMandatoryParametersException(sprintf('Some mandatory parameters are missing ("%s") to generate a URL for route "%s".', implode('", "', array_keys($diff)), $name)); - } - - $url = ''; - $optional = true; - foreach ($tokens as $token) { - if ('variable' === $token[0]) { - if (!$optional || !array_key_exists($token[3], $defaults) || null !== $mergedParams[$token[3]] && (string) $mergedParams[$token[3]] !== (string) $defaults[$token[3]]) { - // check requirement - if (null !== $this->strictRequirements && !preg_match('#^'.$token[2].'$#', $mergedParams[$token[3]])) { - $message = sprintf('Parameter "%s" for route "%s" must match "%s" ("%s" given) to generate a corresponding URL.', $token[3], $name, $token[2], $mergedParams[$token[3]]); - if ($this->strictRequirements) { - throw new InvalidParameterException($message); - } - - if ($this->logger) { - $this->logger->error($message); - } - - return; - } - - $url = $token[1].$mergedParams[$token[3]].$url; - $optional = false; - } - } else { - // static text - $url = $token[1].$url; - $optional = false; - } - } - - if ('' === $url) { - $url = '/'; - } - - // the contexts base URL is already encoded (see Symfony\Component\HttpFoundation\Request) - $url = strtr(rawurlencode($url), $this->decodedChars); - - // the path segments "." and ".." are interpreted as relative reference when resolving a URI; see http://tools.ietf.org/html/rfc3986#section-3.3 - // so we need to encode them as they are not used for this purpose here - // otherwise we would generate a URI that, when followed by a user agent (e.g. browser), does not match this route - $url = strtr($url, array('/../' => '/%2E%2E/', '/./' => '/%2E/')); - if ('/..' === substr($url, -3)) { - $url = substr($url, 0, -2).'%2E%2E'; - } elseif ('/.' === substr($url, -2)) { - $url = substr($url, 0, -1).'%2E'; - } - - $schemeAuthority = ''; - if ($host = $this->context->getHost()) { - $scheme = $this->context->getScheme(); - - if ($requiredSchemes) { - $schemeMatched = false; - foreach ($requiredSchemes as $requiredScheme) { - if ($scheme === $requiredScheme) { - $schemeMatched = true; - - break; - } - } - - if (!$schemeMatched) { - $referenceType = self::ABSOLUTE_URL; - $scheme = current($requiredSchemes); - } - } elseif (isset($requirements['_scheme']) && ($req = strtolower($requirements['_scheme'])) && $scheme !== $req) { - // We do this for BC; to be removed if _scheme is not supported anymore - $referenceType = self::ABSOLUTE_URL; - $scheme = $req; - } - - if ($hostTokens) { - $routeHost = ''; - foreach ($hostTokens as $token) { - if ('variable' === $token[0]) { - if (null !== $this->strictRequirements && !preg_match('#^'.$token[2].'$#i', $mergedParams[$token[3]])) { - $message = sprintf('Parameter "%s" for route "%s" must match "%s" ("%s" given) to generate a corresponding URL.', $token[3], $name, $token[2], $mergedParams[$token[3]]); - - if ($this->strictRequirements) { - throw new InvalidParameterException($message); - } - - if ($this->logger) { - $this->logger->error($message); - } - - return; - } - - $routeHost = $token[1].$mergedParams[$token[3]].$routeHost; - } else { - $routeHost = $token[1].$routeHost; - } - } - - if ($routeHost !== $host) { - $host = $routeHost; - if (self::ABSOLUTE_URL !== $referenceType) { - $referenceType = self::NETWORK_PATH; - } - } - } - - if (self::ABSOLUTE_URL === $referenceType || self::NETWORK_PATH === $referenceType) { - $port = ''; - if ('http' === $scheme && 80 != $this->context->getHttpPort()) { - $port = ':'.$this->context->getHttpPort(); - } elseif ('https' === $scheme && 443 != $this->context->getHttpsPort()) { - $port = ':'.$this->context->getHttpsPort(); - } - - $schemeAuthority = self::NETWORK_PATH === $referenceType ? '//' : "$scheme://"; - $schemeAuthority .= $host.$port; - } - } - - if (self::RELATIVE_PATH === $referenceType) { - $url = self::getRelativePath($this->context->getPathInfo(), $url); - } else { - $url = $schemeAuthority.$this->context->getBaseUrl().$url; - } - - // add a query string if needed - $extra = array_diff_key($parameters, $variables, $defaults); - if ($extra && $query = http_build_query($extra, '', '&')) { - // "/" and "?" can be left decoded for better user experience, see - // http://tools.ietf.org/html/rfc3986#section-3.4 - $url .= '?'.strtr($query, array('%2F' => '/')); - } - - return $url; - } - - /** - * Returns the target path as relative reference from the base path. - * - * Only the URIs path component (no schema, host etc.) is relevant and must be given, starting with a slash. - * Both paths must be absolute and not contain relative parts. - * Relative URLs from one resource to another are useful when generating self-contained downloadable document archives. - * Furthermore, they can be used to reduce the link size in documents. - * - * Example target paths, given a base path of "/a/b/c/d": - * - "/a/b/c/d" -> "" - * - "/a/b/c/" -> "./" - * - "/a/b/" -> "../" - * - "/a/b/c/other" -> "other" - * - "/a/x/y" -> "../../x/y" - * - * @param string $basePath The base path - * @param string $targetPath The target path - * - * @return string The relative target path - */ - public static function getRelativePath($basePath, $targetPath) - { - if ($basePath === $targetPath) { - return ''; - } - - $sourceDirs = explode('/', isset($basePath[0]) && '/' === $basePath[0] ? substr($basePath, 1) : $basePath); - $targetDirs = explode('/', isset($targetPath[0]) && '/' === $targetPath[0] ? substr($targetPath, 1) : $targetPath); - array_pop($sourceDirs); - $targetFile = array_pop($targetDirs); - - foreach ($sourceDirs as $i => $dir) { - if (isset($targetDirs[$i]) && $dir === $targetDirs[$i]) { - unset($sourceDirs[$i], $targetDirs[$i]); - } else { - break; - } - } - - $targetDirs[] = $targetFile; - $path = str_repeat('../', count($sourceDirs)).implode('/', $targetDirs); - - // A reference to the same base directory or an empty subdirectory must be prefixed with "./". - // This also applies to a segment with a colon character (e.g., "file:colon") that cannot be used - // as the first segment of a relative-path reference, as it would be mistaken for a scheme name - // (see http://tools.ietf.org/html/rfc3986#section-4.2). - return '' === $path || '/' === $path[0] - || false !== ($colonPos = strpos($path, ':')) && ($colonPos < ($slashPos = strpos($path, '/')) || false === $slashPos) - ? "./$path" : $path; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/routing/Generator/UrlGeneratorInterface.php b/sitecake/2.2.9/server/vendor/symfony/routing/Generator/UrlGeneratorInterface.php deleted file mode 100644 index a70c90a..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/routing/Generator/UrlGeneratorInterface.php +++ /dev/null @@ -1,88 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Generator; - -use Symfony\Component\Routing\Exception\InvalidParameterException; -use Symfony\Component\Routing\Exception\MissingMandatoryParametersException; -use Symfony\Component\Routing\Exception\RouteNotFoundException; -use Symfony\Component\Routing\RequestContextAwareInterface; - -/** - * UrlGeneratorInterface is the interface that all URL generator classes must implement. - * - * The constants in this interface define the different types of resource references that - * are declared in RFC 3986: http://tools.ietf.org/html/rfc3986 - * We are using the term "URL" instead of "URI" as this is more common in web applications - * and we do not need to distinguish them as the difference is mostly semantical and - * less technical. Generating URIs, i.e. representation-independent resource identifiers, - * is also possible. - * - * @author Fabien Potencier - * @author Tobias Schultze - * - * @api - */ -interface UrlGeneratorInterface extends RequestContextAwareInterface -{ - /** - * Generates an absolute URL, e.g. "http://example.com/dir/file". - */ - const ABSOLUTE_URL = true; - - /** - * Generates an absolute path, e.g. "/dir/file". - */ - const ABSOLUTE_PATH = false; - - /** - * Generates a relative path based on the current request path, e.g. "../parent-file". - * - * @see UrlGenerator::getRelativePath() - */ - const RELATIVE_PATH = 'relative'; - - /** - * Generates a network path, e.g. "//example.com/dir/file". - * Such reference reuses the current scheme but specifies the host. - */ - const NETWORK_PATH = 'network'; - - /** - * Generates a URL or path for a specific route based on the given parameters. - * - * Parameters that reference placeholders in the route pattern will substitute them in the - * path or host. Extra params are added as query string to the URL. - * - * When the passed reference type cannot be generated for the route because it requires a different - * host or scheme than the current one, the method will return a more comprehensive reference - * that includes the required params. For example, when you call this method with $referenceType = ABSOLUTE_PATH - * but the route requires the https scheme whereas the current scheme is http, it will instead return an - * ABSOLUTE_URL with the https scheme and the current host. This makes sure the generated URL matches - * the route in any case. - * - * If there is no route with the given name, the generator must throw the RouteNotFoundException. - * - * @param string $name The name of the route - * @param mixed $parameters An array of parameters - * @param bool|string $referenceType The type of reference to be generated (one of the constants) - * - * @return string The generated URL - * - * @throws RouteNotFoundException If the named route doesn't exist - * @throws MissingMandatoryParametersException When some parameters are missing that are mandatory for the route - * @throws InvalidParameterException When a parameter value for a placeholder is not correct because - * it does not match the requirement - * - * @api - */ - public function generate($name, $parameters = array(), $referenceType = self::ABSOLUTE_PATH); -} diff --git a/sitecake/2.2.9/server/vendor/symfony/routing/LICENSE b/sitecake/2.2.9/server/vendor/symfony/routing/LICENSE deleted file mode 100644 index 43028bc..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/routing/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2004-2015 Fabien Potencier - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/sitecake/2.2.9/server/vendor/symfony/routing/Loader/AnnotationClassLoader.php b/sitecake/2.2.9/server/vendor/symfony/routing/Loader/AnnotationClassLoader.php deleted file mode 100644 index da881ef..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/routing/Loader/AnnotationClassLoader.php +++ /dev/null @@ -1,268 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Loader; - -use Doctrine\Common\Annotations\Reader; -use Symfony\Component\Config\Resource\FileResource; -use Symfony\Component\Routing\Route; -use Symfony\Component\Routing\RouteCollection; -use Symfony\Component\Config\Loader\LoaderInterface; -use Symfony\Component\Config\Loader\LoaderResolverInterface; - -/** - * AnnotationClassLoader loads routing information from a PHP class and its methods. - * - * You need to define an implementation for the getRouteDefaults() method. Most of the - * time, this method should define some PHP callable to be called for the route - * (a controller in MVC speak). - * - * The @Route annotation can be set on the class (for global parameters), - * and on each method. - * - * The @Route annotation main value is the route path. The annotation also - * recognizes several parameters: requirements, options, defaults, schemes, - * methods, host, and name. The name parameter is mandatory. - * Here is an example of how you should be able to use it: - * - * /** - * * @Route("/Blog") - * * / - * class Blog - * { - * /** - * * @Route("/", name="blog_index") - * * / - * public function index() - * { - * } - * - * /** - * * @Route("/{id}", name="blog_post", requirements = {"id" = "\d+"}) - * * / - * public function show() - * { - * } - * } - * - * @author Fabien Potencier - */ -abstract class AnnotationClassLoader implements LoaderInterface -{ - /** - * @var Reader - */ - protected $reader; - - /** - * @var string - */ - protected $routeAnnotationClass = 'Symfony\\Component\\Routing\\Annotation\\Route'; - - /** - * @var int - */ - protected $defaultRouteIndex = 0; - - /** - * Constructor. - * - * @param Reader $reader - */ - public function __construct(Reader $reader) - { - $this->reader = $reader; - } - - /** - * Sets the annotation class to read route properties from. - * - * @param string $class A fully-qualified class name - */ - public function setRouteAnnotationClass($class) - { - $this->routeAnnotationClass = $class; - } - - /** - * Loads from annotations from a class. - * - * @param string $class A class name - * @param string|null $type The resource type - * - * @return RouteCollection A RouteCollection instance - * - * @throws \InvalidArgumentException When route can't be parsed - */ - public function load($class, $type = null) - { - if (!class_exists($class)) { - throw new \InvalidArgumentException(sprintf('Class "%s" does not exist.', $class)); - } - - $class = new \ReflectionClass($class); - if ($class->isAbstract()) { - throw new \InvalidArgumentException(sprintf('Annotations from class "%s" cannot be read as it is abstract.', $class)); - } - - $globals = $this->getGlobals($class); - - $collection = new RouteCollection(); - $collection->addResource(new FileResource($class->getFileName())); - - foreach ($class->getMethods() as $method) { - $this->defaultRouteIndex = 0; - foreach ($this->reader->getMethodAnnotations($method) as $annot) { - if ($annot instanceof $this->routeAnnotationClass) { - $this->addRoute($collection, $annot, $globals, $class, $method); - } - } - } - - return $collection; - } - - protected function addRoute(RouteCollection $collection, $annot, $globals, \ReflectionClass $class, \ReflectionMethod $method) - { - $name = $annot->getName(); - if (null === $name) { - $name = $this->getDefaultRouteName($class, $method); - } - - $defaults = array_replace($globals['defaults'], $annot->getDefaults()); - foreach ($method->getParameters() as $param) { - if (!isset($defaults[$param->getName()]) && $param->isOptional()) { - $defaults[$param->getName()] = $param->getDefaultValue(); - } - } - $requirements = array_replace($globals['requirements'], $annot->getRequirements()); - $options = array_replace($globals['options'], $annot->getOptions()); - $schemes = array_merge($globals['schemes'], $annot->getSchemes()); - $methods = array_merge($globals['methods'], $annot->getMethods()); - - $host = $annot->getHost(); - if (null === $host) { - $host = $globals['host']; - } - - $condition = $annot->getCondition(); - if (null === $condition) { - $condition = $globals['condition']; - } - - $route = $this->createRoute($globals['path'].$annot->getPath(), $defaults, $requirements, $options, $host, $schemes, $methods, $condition); - - $this->configureRoute($route, $class, $method, $annot); - - $collection->add($name, $route); - } - - /** - * {@inheritdoc} - */ - public function supports($resource, $type = null) - { - return is_string($resource) && preg_match('/^(?:\\\\?[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)+$/', $resource) && (!$type || 'annotation' === $type); - } - - /** - * {@inheritdoc} - */ - public function setResolver(LoaderResolverInterface $resolver) - { - } - - /** - * {@inheritdoc} - */ - public function getResolver() - { - } - - /** - * Gets the default route name for a class method. - * - * @param \ReflectionClass $class - * @param \ReflectionMethod $method - * - * @return string - */ - protected function getDefaultRouteName(\ReflectionClass $class, \ReflectionMethod $method) - { - $name = strtolower(str_replace('\\', '_', $class->name).'_'.$method->name); - if ($this->defaultRouteIndex > 0) { - $name .= '_'.$this->defaultRouteIndex; - } - ++$this->defaultRouteIndex; - - return $name; - } - - protected function getGlobals(\ReflectionClass $class) - { - $globals = array( - 'path' => '', - 'requirements' => array(), - 'options' => array(), - 'defaults' => array(), - 'schemes' => array(), - 'methods' => array(), - 'host' => '', - 'condition' => '', - ); - - if ($annot = $this->reader->getClassAnnotation($class, $this->routeAnnotationClass)) { - // for BC reasons - if (null !== $annot->getPath()) { - $globals['path'] = $annot->getPath(); - } elseif (null !== $annot->getPattern()) { - $globals['path'] = $annot->getPattern(); - } - - if (null !== $annot->getRequirements()) { - $globals['requirements'] = $annot->getRequirements(); - } - - if (null !== $annot->getOptions()) { - $globals['options'] = $annot->getOptions(); - } - - if (null !== $annot->getDefaults()) { - $globals['defaults'] = $annot->getDefaults(); - } - - if (null !== $annot->getSchemes()) { - $globals['schemes'] = $annot->getSchemes(); - } - - if (null !== $annot->getMethods()) { - $globals['methods'] = $annot->getMethods(); - } - - if (null !== $annot->getHost()) { - $globals['host'] = $annot->getHost(); - } - - if (null !== $annot->getCondition()) { - $globals['condition'] = $annot->getCondition(); - } - } - - return $globals; - } - - protected function createRoute($path, $defaults, $requirements, $options, $host, $schemes, $methods, $condition) - { - return new Route($path, $defaults, $requirements, $options, $host, $schemes, $methods, $condition); - } - - abstract protected function configureRoute(Route $route, \ReflectionClass $class, \ReflectionMethod $method, $annot); -} diff --git a/sitecake/2.2.9/server/vendor/symfony/routing/Loader/AnnotationDirectoryLoader.php b/sitecake/2.2.9/server/vendor/symfony/routing/Loader/AnnotationDirectoryLoader.php deleted file mode 100644 index abd68ed..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/routing/Loader/AnnotationDirectoryLoader.php +++ /dev/null @@ -1,77 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Loader; - -use Symfony\Component\Routing\RouteCollection; -use Symfony\Component\Config\Resource\DirectoryResource; - -/** - * AnnotationDirectoryLoader loads routing information from annotations set - * on PHP classes and methods. - * - * @author Fabien Potencier - */ -class AnnotationDirectoryLoader extends AnnotationFileLoader -{ - /** - * Loads from annotations from a directory. - * - * @param string $path A directory path - * @param string|null $type The resource type - * - * @return RouteCollection A RouteCollection instance - * - * @throws \InvalidArgumentException When the directory does not exist or its routes cannot be parsed - */ - public function load($path, $type = null) - { - $dir = $this->locator->locate($path); - - $collection = new RouteCollection(); - $collection->addResource(new DirectoryResource($dir, '/\.php$/')); - $files = iterator_to_array(new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($dir), \RecursiveIteratorIterator::LEAVES_ONLY)); - usort($files, function (\SplFileInfo $a, \SplFileInfo $b) { - return (string) $a > (string) $b ? 1 : -1; - }); - - foreach ($files as $file) { - if (!$file->isFile() || '.php' !== substr($file->getFilename(), -4)) { - continue; - } - - if ($class = $this->findClass($file)) { - $refl = new \ReflectionClass($class); - if ($refl->isAbstract()) { - continue; - } - - $collection->addCollection($this->loader->load($class, $type)); - } - } - - return $collection; - } - - /** - * {@inheritdoc} - */ - public function supports($resource, $type = null) - { - try { - $path = $this->locator->locate($resource); - } catch (\Exception $e) { - return false; - } - - return is_string($resource) && is_dir($path) && (!$type || 'annotation' === $type); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/routing/Loader/AnnotationFileLoader.php b/sitecake/2.2.9/server/vendor/symfony/routing/Loader/AnnotationFileLoader.php deleted file mode 100644 index 8ce57ac..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/routing/Loader/AnnotationFileLoader.php +++ /dev/null @@ -1,121 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Loader; - -use Symfony\Component\Routing\RouteCollection; -use Symfony\Component\Config\Resource\FileResource; -use Symfony\Component\Config\Loader\FileLoader; -use Symfony\Component\Config\FileLocatorInterface; - -/** - * AnnotationFileLoader loads routing information from annotations set - * on a PHP class and its methods. - * - * @author Fabien Potencier - */ -class AnnotationFileLoader extends FileLoader -{ - protected $loader; - - /** - * Constructor. - * - * @param FileLocatorInterface $locator A FileLocator instance - * @param AnnotationClassLoader $loader An AnnotationClassLoader instance - * - * @throws \RuntimeException - */ - public function __construct(FileLocatorInterface $locator, AnnotationClassLoader $loader) - { - if (!function_exists('token_get_all')) { - throw new \RuntimeException('The Tokenizer extension is required for the routing annotation loaders.'); - } - - parent::__construct($locator); - - $this->loader = $loader; - } - - /** - * Loads from annotations from a file. - * - * @param string $file A PHP file path - * @param string|null $type The resource type - * - * @return RouteCollection A RouteCollection instance - * - * @throws \InvalidArgumentException When the file does not exist or its routes cannot be parsed - */ - public function load($file, $type = null) - { - $path = $this->locator->locate($file); - - $collection = new RouteCollection(); - if ($class = $this->findClass($path)) { - $collection->addResource(new FileResource($path)); - $collection->addCollection($this->loader->load($class, $type)); - } - - return $collection; - } - - /** - * {@inheritdoc} - */ - public function supports($resource, $type = null) - { - return is_string($resource) && 'php' === pathinfo($resource, PATHINFO_EXTENSION) && (!$type || 'annotation' === $type); - } - - /** - * Returns the full class name for the first class in the file. - * - * @param string $file A PHP file path - * - * @return string|false Full class name if found, false otherwise - */ - protected function findClass($file) - { - $class = false; - $namespace = false; - $tokens = token_get_all(file_get_contents($file)); - for ($i = 0, $count = count($tokens); $i < $count; ++$i) { - $token = $tokens[$i]; - - if (!is_array($token)) { - continue; - } - - if (true === $class && T_STRING === $token[0]) { - return $namespace.'\\'.$token[1]; - } - - if (true === $namespace && T_STRING === $token[0]) { - $namespace = ''; - do { - $namespace .= $token[1]; - $token = $tokens[++$i]; - } while ($i < $count && is_array($token) && in_array($token[0], array(T_NS_SEPARATOR, T_STRING))); - } - - if (T_CLASS === $token[0]) { - $class = true; - } - - if (T_NAMESPACE === $token[0]) { - $namespace = true; - } - } - - return false; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/routing/Loader/ClosureLoader.php b/sitecake/2.2.9/server/vendor/symfony/routing/Loader/ClosureLoader.php deleted file mode 100644 index 9edab1e..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/routing/Loader/ClosureLoader.php +++ /dev/null @@ -1,52 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Loader; - -use Symfony\Component\Config\Loader\Loader; -use Symfony\Component\Routing\RouteCollection; - -/** - * ClosureLoader loads routes from a PHP closure. - * - * The Closure must return a RouteCollection instance. - * - * @author Fabien Potencier - * - * @api - */ -class ClosureLoader extends Loader -{ - /** - * Loads a Closure. - * - * @param \Closure $closure A Closure - * @param string|null $type The resource type - * - * @return RouteCollection A RouteCollection instance - * - * @api - */ - public function load($closure, $type = null) - { - return $closure(); - } - - /** - * {@inheritdoc} - * - * @api - */ - public function supports($resource, $type = null) - { - return $resource instanceof \Closure && (!$type || 'closure' === $type); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/routing/Loader/PhpFileLoader.php b/sitecake/2.2.9/server/vendor/symfony/routing/Loader/PhpFileLoader.php deleted file mode 100644 index d1970e5..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/routing/Loader/PhpFileLoader.php +++ /dev/null @@ -1,72 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Loader; - -use Symfony\Component\Config\Loader\FileLoader; -use Symfony\Component\Config\Resource\FileResource; -use Symfony\Component\Routing\RouteCollection; - -/** - * PhpFileLoader loads routes from a PHP file. - * - * The file must return a RouteCollection instance. - * - * @author Fabien Potencier - * - * @api - */ -class PhpFileLoader extends FileLoader -{ - /** - * Loads a PHP file. - * - * @param string $file A PHP file path - * @param string|null $type The resource type - * - * @return RouteCollection A RouteCollection instance - * - * @api - */ - public function load($file, $type = null) - { - $path = $this->locator->locate($file); - $this->setCurrentDir(dirname($path)); - - $collection = self::includeFile($path, $this); - $collection->addResource(new FileResource($path)); - - return $collection; - } - - /** - * {@inheritdoc} - * - * @api - */ - public function supports($resource, $type = null) - { - return is_string($resource) && 'php' === pathinfo($resource, PATHINFO_EXTENSION) && (!$type || 'php' === $type); - } - - /** - * Safe include. Used for scope isolation. - * - * @param string $file File to include - * @param PhpFileLoader $loader the loader variable is exposed to the included file below - * - * @return RouteCollection - */ - private static function includeFile($file, PhpFileLoader $loader) - { - return include $file; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/routing/Loader/XmlFileLoader.php b/sitecake/2.2.9/server/vendor/symfony/routing/Loader/XmlFileLoader.php deleted file mode 100644 index e8c7f6b..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/routing/Loader/XmlFileLoader.php +++ /dev/null @@ -1,276 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Loader; - -use Symfony\Component\Routing\RouteCollection; -use Symfony\Component\Routing\Route; -use Symfony\Component\Config\Resource\FileResource; -use Symfony\Component\Config\Loader\FileLoader; -use Symfony\Component\Config\Util\XmlUtils; - -/** - * XmlFileLoader loads XML routing files. - * - * @author Fabien Potencier - * @author Tobias Schultze - * - * @api - */ -class XmlFileLoader extends FileLoader -{ - const NAMESPACE_URI = 'http://symfony.com/schema/routing'; - const SCHEME_PATH = '/schema/routing/routing-1.0.xsd'; - - /** - * Loads an XML file. - * - * @param string $file An XML file path - * @param string|null $type The resource type - * - * @return RouteCollection A RouteCollection instance - * - * @throws \InvalidArgumentException When the file cannot be loaded or when the XML cannot be - * parsed because it does not validate against the scheme. - * - * @api - */ - public function load($file, $type = null) - { - $path = $this->locator->locate($file); - - $xml = $this->loadFile($path); - - $collection = new RouteCollection(); - $collection->addResource(new FileResource($path)); - - // process routes and imports - foreach ($xml->documentElement->childNodes as $node) { - if (!$node instanceof \DOMElement) { - continue; - } - - $this->parseNode($collection, $node, $path, $file); - } - - return $collection; - } - - /** - * Parses a node from a loaded XML file. - * - * @param RouteCollection $collection Collection to associate with the node - * @param \DOMElement $node Element to parse - * @param string $path Full path of the XML file being processed - * @param string $file Loaded file name - * - * @throws \InvalidArgumentException When the XML is invalid - */ - protected function parseNode(RouteCollection $collection, \DOMElement $node, $path, $file) - { - if (self::NAMESPACE_URI !== $node->namespaceURI) { - return; - } - - switch ($node->localName) { - case 'route': - $this->parseRoute($collection, $node, $path); - break; - case 'import': - $this->parseImport($collection, $node, $path, $file); - break; - default: - throw new \InvalidArgumentException(sprintf('Unknown tag "%s" used in file "%s". Expected "route" or "import".', $node->localName, $path)); - } - } - - /** - * {@inheritdoc} - * - * @api - */ - public function supports($resource, $type = null) - { - return is_string($resource) && 'xml' === pathinfo($resource, PATHINFO_EXTENSION) && (!$type || 'xml' === $type); - } - - /** - * Parses a route and adds it to the RouteCollection. - * - * @param RouteCollection $collection RouteCollection instance - * @param \DOMElement $node Element to parse that represents a Route - * @param string $path Full path of the XML file being processed - * - * @throws \InvalidArgumentException When the XML is invalid - */ - protected function parseRoute(RouteCollection $collection, \DOMElement $node, $path) - { - if ('' === ($id = $node->getAttribute('id')) || (!$node->hasAttribute('pattern') && !$node->hasAttribute('path'))) { - throw new \InvalidArgumentException(sprintf('The element in file "%s" must have an "id" and a "path" attribute.', $path)); - } - - if ($node->hasAttribute('pattern')) { - if ($node->hasAttribute('path')) { - throw new \InvalidArgumentException(sprintf('The element in file "%s" cannot define both a "path" and a "pattern" attribute. Use only "path".', $path)); - } - - @trigger_error(sprintf('The "pattern" option in file "%s" is deprecated since version 2.2 and will be removed in 3.0. Use the "path" option in the route definition instead.', $path), E_USER_DEPRECATED); - - $node->setAttribute('path', $node->getAttribute('pattern')); - $node->removeAttribute('pattern'); - } - - $schemes = preg_split('/[\s,\|]++/', $node->getAttribute('schemes'), -1, PREG_SPLIT_NO_EMPTY); - $methods = preg_split('/[\s,\|]++/', $node->getAttribute('methods'), -1, PREG_SPLIT_NO_EMPTY); - - list($defaults, $requirements, $options, $condition) = $this->parseConfigs($node, $path); - - if (isset($requirements['_method'])) { - if (0 === count($methods)) { - $methods = explode('|', $requirements['_method']); - } - - unset($requirements['_method']); - @trigger_error(sprintf('The "_method" requirement of route "%s" in file "%s" is deprecated since version 2.2 and will be removed in 3.0. Use the "methods" attribute instead.', $id, $path), E_USER_DEPRECATED); - } - - if (isset($requirements['_scheme'])) { - if (0 === count($schemes)) { - $schemes = explode('|', $requirements['_scheme']); - } - - unset($requirements['_scheme']); - @trigger_error(sprintf('The "_scheme" requirement of route "%s" in file "%s" is deprecated since version 2.2 and will be removed in 3.0. Use the "schemes" attribute instead.', $id, $path), E_USER_DEPRECATED); - } - - $route = new Route($node->getAttribute('path'), $defaults, $requirements, $options, $node->getAttribute('host'), $schemes, $methods, $condition); - $collection->add($id, $route); - } - - /** - * Parses an import and adds the routes in the resource to the RouteCollection. - * - * @param RouteCollection $collection RouteCollection instance - * @param \DOMElement $node Element to parse that represents a Route - * @param string $path Full path of the XML file being processed - * @param string $file Loaded file name - * - * @throws \InvalidArgumentException When the XML is invalid - */ - protected function parseImport(RouteCollection $collection, \DOMElement $node, $path, $file) - { - if ('' === $resource = $node->getAttribute('resource')) { - throw new \InvalidArgumentException(sprintf('The element in file "%s" must have a "resource" attribute.', $path)); - } - - $type = $node->getAttribute('type'); - $prefix = $node->getAttribute('prefix'); - $host = $node->hasAttribute('host') ? $node->getAttribute('host') : null; - $schemes = $node->hasAttribute('schemes') ? preg_split('/[\s,\|]++/', $node->getAttribute('schemes'), -1, PREG_SPLIT_NO_EMPTY) : null; - $methods = $node->hasAttribute('methods') ? preg_split('/[\s,\|]++/', $node->getAttribute('methods'), -1, PREG_SPLIT_NO_EMPTY) : null; - - list($defaults, $requirements, $options, $condition) = $this->parseConfigs($node, $path); - - $this->setCurrentDir(dirname($path)); - - $subCollection = $this->import($resource, ('' !== $type ? $type : null), false, $file); - /* @var $subCollection RouteCollection */ - $subCollection->addPrefix($prefix); - if (null !== $host) { - $subCollection->setHost($host); - } - if (null !== $condition) { - $subCollection->setCondition($condition); - } - if (null !== $schemes) { - $subCollection->setSchemes($schemes); - } - if (null !== $methods) { - $subCollection->setMethods($methods); - } - $subCollection->addDefaults($defaults); - $subCollection->addRequirements($requirements); - $subCollection->addOptions($options); - - $collection->addCollection($subCollection); - } - - /** - * Loads an XML file. - * - * @param string $file An XML file path - * - * @return \DOMDocument - * - * @throws \InvalidArgumentException When loading of XML file fails because of syntax errors - * or when the XML structure is not as expected by the scheme - - * see validate() - */ - protected function loadFile($file) - { - return XmlUtils::loadFile($file, __DIR__.static::SCHEME_PATH); - } - - /** - * Parses the config elements (default, requirement, option). - * - * @param \DOMElement $node Element to parse that contains the configs - * @param string $path Full path of the XML file being processed - * - * @return array An array with the defaults as first item, requirements as second and options as third. - * - * @throws \InvalidArgumentException When the XML is invalid - */ - private function parseConfigs(\DOMElement $node, $path) - { - $defaults = array(); - $requirements = array(); - $options = array(); - $condition = null; - - foreach ($node->getElementsByTagNameNS(self::NAMESPACE_URI, '*') as $n) { - switch ($n->localName) { - case 'default': - if ($this->isElementValueNull($n)) { - $defaults[$n->getAttribute('key')] = null; - } else { - $defaults[$n->getAttribute('key')] = trim($n->textContent); - } - - break; - case 'requirement': - $requirements[$n->getAttribute('key')] = trim($n->textContent); - break; - case 'option': - $options[$n->getAttribute('key')] = trim($n->textContent); - break; - case 'condition': - $condition = trim($n->textContent); - break; - default: - throw new \InvalidArgumentException(sprintf('Unknown tag "%s" used in file "%s". Expected "default", "requirement" or "option".', $n->localName, $path)); - } - } - - return array($defaults, $requirements, $options, $condition); - } - - private function isElementValueNull(\DOMElement $element) - { - $namespaceUri = 'http://www.w3.org/2001/XMLSchema-instance'; - - if (!$element->hasAttributeNS($namespaceUri, 'nil')) { - return false; - } - - return 'true' === $element->getAttributeNS($namespaceUri, 'nil') || '1' === $element->getAttributeNS($namespaceUri, 'nil'); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/routing/Loader/YamlFileLoader.php b/sitecake/2.2.9/server/vendor/symfony/routing/Loader/YamlFileLoader.php deleted file mode 100644 index d30da91..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/routing/Loader/YamlFileLoader.php +++ /dev/null @@ -1,237 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Loader; - -use Symfony\Component\Routing\RouteCollection; -use Symfony\Component\Routing\Route; -use Symfony\Component\Config\Resource\FileResource; -use Symfony\Component\Yaml\Parser as YamlParser; -use Symfony\Component\Config\Loader\FileLoader; - -/** - * YamlFileLoader loads Yaml routing files. - * - * @author Fabien Potencier - * @author Tobias Schultze - * - * @api - */ -class YamlFileLoader extends FileLoader -{ - private static $availableKeys = array( - 'resource', 'type', 'prefix', 'pattern', 'path', 'host', 'schemes', 'methods', 'defaults', 'requirements', 'options', 'condition', - ); - private $yamlParser; - - /** - * Loads a Yaml file. - * - * @param string $file A Yaml file path - * @param string|null $type The resource type - * - * @return RouteCollection A RouteCollection instance - * - * @throws \InvalidArgumentException When a route can't be parsed because YAML is invalid - * - * @api - */ - public function load($file, $type = null) - { - $path = $this->locator->locate($file); - - if (!stream_is_local($path)) { - throw new \InvalidArgumentException(sprintf('This is not a local file "%s".', $path)); - } - - if (!file_exists($path)) { - throw new \InvalidArgumentException(sprintf('File "%s" not found.', $path)); - } - - if (null === $this->yamlParser) { - $this->yamlParser = new YamlParser(); - } - - $config = $this->yamlParser->parse(file_get_contents($path)); - - $collection = new RouteCollection(); - $collection->addResource(new FileResource($path)); - - // empty file - if (null === $config) { - return $collection; - } - - // not an array - if (!is_array($config)) { - throw new \InvalidArgumentException(sprintf('The file "%s" must contain a YAML array.', $path)); - } - - foreach ($config as $name => $config) { - if (isset($config['pattern'])) { - if (isset($config['path'])) { - throw new \InvalidArgumentException(sprintf('The file "%s" cannot define both a "path" and a "pattern" attribute. Use only "path".', $path)); - } - - @trigger_error(sprintf('The "pattern" option in file "%s" is deprecated since version 2.2 and will be removed in 3.0. Use the "path" option in the route definition instead.', $path), E_USER_DEPRECATED); - - $config['path'] = $config['pattern']; - unset($config['pattern']); - } - - $this->validate($config, $name, $path); - - if (isset($config['resource'])) { - $this->parseImport($collection, $config, $path, $file); - } else { - $this->parseRoute($collection, $name, $config, $path); - } - } - - return $collection; - } - - /** - * {@inheritdoc} - * - * @api - */ - public function supports($resource, $type = null) - { - return is_string($resource) && in_array(pathinfo($resource, PATHINFO_EXTENSION), array('yml', 'yaml'), true) && (!$type || 'yaml' === $type); - } - - /** - * Parses a route and adds it to the RouteCollection. - * - * @param RouteCollection $collection A RouteCollection instance - * @param string $name Route name - * @param array $config Route definition - * @param string $path Full path of the YAML file being processed - */ - protected function parseRoute(RouteCollection $collection, $name, array $config, $path) - { - $defaults = isset($config['defaults']) ? $config['defaults'] : array(); - $requirements = isset($config['requirements']) ? $config['requirements'] : array(); - $options = isset($config['options']) ? $config['options'] : array(); - $host = isset($config['host']) ? $config['host'] : ''; - $schemes = isset($config['schemes']) ? $config['schemes'] : array(); - $methods = isset($config['methods']) ? $config['methods'] : array(); - $condition = isset($config['condition']) ? $config['condition'] : null; - - if (isset($requirements['_method'])) { - if (0 === count($methods)) { - $methods = explode('|', $requirements['_method']); - } - - unset($requirements['_method']); - @trigger_error(sprintf('The "_method" requirement of route "%s" in file "%s" is deprecated since version 2.2 and will be removed in 3.0. Use the "methods" option instead.', $name, $path), E_USER_DEPRECATED); - } - - if (isset($requirements['_scheme'])) { - if (0 === count($schemes)) { - $schemes = explode('|', $requirements['_scheme']); - } - - unset($requirements['_scheme']); - @trigger_error(sprintf('The "_scheme" requirement of route "%s" in file "%s" is deprecated since version 2.2 and will be removed in 3.0. Use the "schemes" option instead.', $name, $path), E_USER_DEPRECATED); - } - - $route = new Route($config['path'], $defaults, $requirements, $options, $host, $schemes, $methods, $condition); - - $collection->add($name, $route); - } - - /** - * Parses an import and adds the routes in the resource to the RouteCollection. - * - * @param RouteCollection $collection A RouteCollection instance - * @param array $config Route definition - * @param string $path Full path of the YAML file being processed - * @param string $file Loaded file name - */ - protected function parseImport(RouteCollection $collection, array $config, $path, $file) - { - $type = isset($config['type']) ? $config['type'] : null; - $prefix = isset($config['prefix']) ? $config['prefix'] : ''; - $defaults = isset($config['defaults']) ? $config['defaults'] : array(); - $requirements = isset($config['requirements']) ? $config['requirements'] : array(); - $options = isset($config['options']) ? $config['options'] : array(); - $host = isset($config['host']) ? $config['host'] : null; - $condition = isset($config['condition']) ? $config['condition'] : null; - $schemes = isset($config['schemes']) ? $config['schemes'] : null; - $methods = isset($config['methods']) ? $config['methods'] : null; - - $this->setCurrentDir(dirname($path)); - - $subCollection = $this->import($config['resource'], $type, false, $file); - /* @var $subCollection RouteCollection */ - $subCollection->addPrefix($prefix); - if (null !== $host) { - $subCollection->setHost($host); - } - if (null !== $condition) { - $subCollection->setCondition($condition); - } - if (null !== $schemes) { - $subCollection->setSchemes($schemes); - } - if (null !== $methods) { - $subCollection->setMethods($methods); - } - $subCollection->addDefaults($defaults); - $subCollection->addRequirements($requirements); - $subCollection->addOptions($options); - - $collection->addCollection($subCollection); - } - - /** - * Validates the route configuration. - * - * @param array $config A resource config - * @param string $name The config key - * @param string $path The loaded file path - * - * @throws \InvalidArgumentException If one of the provided config keys is not supported, - * something is missing or the combination is nonsense - */ - protected function validate($config, $name, $path) - { - if (!is_array($config)) { - throw new \InvalidArgumentException(sprintf('The definition of "%s" in "%s" must be a YAML array.', $name, $path)); - } - if ($extraKeys = array_diff(array_keys($config), self::$availableKeys)) { - throw new \InvalidArgumentException(sprintf( - 'The routing file "%s" contains unsupported keys for "%s": "%s". Expected one of: "%s".', - $path, $name, implode('", "', $extraKeys), implode('", "', self::$availableKeys) - )); - } - if (isset($config['resource']) && isset($config['path'])) { - throw new \InvalidArgumentException(sprintf( - 'The routing file "%s" must not specify both the "resource" key and the "path" key for "%s". Choose between an import and a route definition.', - $path, $name - )); - } - if (!isset($config['resource']) && isset($config['type'])) { - throw new \InvalidArgumentException(sprintf( - 'The "type" key for the route definition "%s" in "%s" is unsupported. It is only available for imports in combination with the "resource" key.', - $name, $path - )); - } - if (!isset($config['resource']) && !isset($config['path'])) { - throw new \InvalidArgumentException(sprintf( - 'You must define a "path" for the route "%s" in file "%s".', - $name, $path - )); - } - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/routing/Loader/schema/routing/routing-1.0.xsd b/sitecake/2.2.9/server/vendor/symfony/routing/Loader/schema/routing/routing-1.0.xsd deleted file mode 100644 index d40aa42..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/routing/Loader/schema/routing/routing-1.0.xsd +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sitecake/2.2.9/server/vendor/symfony/routing/Matcher/ApacheUrlMatcher.php b/sitecake/2.2.9/server/vendor/symfony/routing/Matcher/ApacheUrlMatcher.php deleted file mode 100644 index c0474f2..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/routing/Matcher/ApacheUrlMatcher.php +++ /dev/null @@ -1,124 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Matcher; - -@trigger_error('The '.__NAMESPACE__.'\ApacheUrlMatcher class is deprecated since version 2.5 and will be removed in 3.0. It\'s hard to replicate the behaviour of the PHP implementation and the performance gains are minimal.', E_USER_DEPRECATED); - -use Symfony\Component\Routing\Exception\MethodNotAllowedException; - -/** - * ApacheUrlMatcher matches URL based on Apache mod_rewrite matching (see ApacheMatcherDumper). - * - * @deprecated since version 2.5, to be removed in 3.0. - * The performance gains are minimal and it's very hard to replicate - * the behavior of PHP implementation. - * - * @author Fabien Potencier - * @author Arnaud Le Blanc - */ -class ApacheUrlMatcher extends UrlMatcher -{ - /** - * Tries to match a URL based on Apache mod_rewrite matching. - * - * Returns false if no route matches the URL. - * - * @param string $pathinfo The pathinfo to be parsed - * - * @return array An array of parameters - * - * @throws MethodNotAllowedException If the current method is not allowed - */ - public function match($pathinfo) - { - $parameters = array(); - $defaults = array(); - $allow = array(); - $route = null; - - foreach ($this->denormalizeValues($_SERVER) as $key => $value) { - $name = $key; - - // skip non-routing variables - // this improves performance when $_SERVER contains many usual - // variables like HTTP_*, DOCUMENT_ROOT, REQUEST_URI, ... - if (false === strpos($name, '_ROUTING_')) { - continue; - } - - while (0 === strpos($name, 'REDIRECT_')) { - $name = substr($name, 9); - } - - // expect _ROUTING__ - // or _ROUTING_ - - if (0 !== strpos($name, '_ROUTING_')) { - continue; - } - if (false !== $pos = strpos($name, '_', 9)) { - $type = substr($name, 9, $pos - 9); - $name = substr($name, $pos + 1); - } else { - $type = substr($name, 9); - } - - if ('param' === $type) { - if ('' !== $value) { - $parameters[$name] = $value; - } - } elseif ('default' === $type) { - $defaults[$name] = $value; - } elseif ('route' === $type) { - $route = $value; - } elseif ('allow' === $type) { - $allow[] = $name; - } - - unset($_SERVER[$key]); - } - - if (null !== $route) { - $parameters['_route'] = $route; - - return $this->mergeDefaults($parameters, $defaults); - } elseif (0 < count($allow)) { - throw new MethodNotAllowedException($allow); - } else { - return parent::match($pathinfo); - } - } - - /** - * Denormalizes an array of values. - * - * @param string[] $values - * - * @return array - */ - private function denormalizeValues(array $values) - { - $normalizedValues = array(); - foreach ($values as $key => $value) { - if (preg_match('~^(.*)\[(\d+)\]$~', $key, $matches)) { - if (!isset($normalizedValues[$matches[1]])) { - $normalizedValues[$matches[1]] = array(); - } - $normalizedValues[$matches[1]][(int) $matches[2]] = $value; - } else { - $normalizedValues[$key] = $value; - } - } - - return $normalizedValues; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/routing/Matcher/Dumper/ApacheMatcherDumper.php b/sitecake/2.2.9/server/vendor/symfony/routing/Matcher/Dumper/ApacheMatcherDumper.php deleted file mode 100644 index 1eb5185..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/routing/Matcher/Dumper/ApacheMatcherDumper.php +++ /dev/null @@ -1,278 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Matcher\Dumper; - -@trigger_error('The '.__NAMESPACE__.'\ApacheMatcherDumper class is deprecated since version 2.5 and will be removed in 3.0. It\'s hard to replicate the behaviour of the PHP implementation and the performance gains are minimal.', E_USER_DEPRECATED); - -use Symfony\Component\Routing\Route; - -/** - * Dumps a set of Apache mod_rewrite rules. - * - * @deprecated since version 2.5, to be removed in 3.0. - * The performance gains are minimal and it's very hard to replicate - * the behavior of PHP implementation. - * - * @author Fabien Potencier - * @author Kris Wallsmith - */ -class ApacheMatcherDumper extends MatcherDumper -{ - /** - * Dumps a set of Apache mod_rewrite rules. - * - * Available options: - * - * * script_name: The script name (app.php by default) - * * base_uri: The base URI ("" by default) - * - * @param array $options An array of options - * - * @return string A string to be used as Apache rewrite rules - * - * @throws \LogicException When the route regex is invalid - */ - public function dump(array $options = array()) - { - $options = array_merge(array( - 'script_name' => 'app.php', - 'base_uri' => '', - ), $options); - - $options['script_name'] = self::escape($options['script_name'], ' ', '\\'); - - $rules = array("# skip \"real\" requests\nRewriteCond %{REQUEST_FILENAME} -f\nRewriteRule .* - [QSA,L]"); - $methodVars = array(); - $hostRegexUnique = 0; - $prevHostRegex = ''; - - foreach ($this->getRoutes()->all() as $name => $route) { - if ($route->getCondition()) { - throw new \LogicException(sprintf('Unable to dump the routes for Apache as route "%s" has a condition.', $name)); - } - - $compiledRoute = $route->compile(); - $hostRegex = $compiledRoute->getHostRegex(); - - if (null !== $hostRegex && $prevHostRegex !== $hostRegex) { - $prevHostRegex = $hostRegex; - ++$hostRegexUnique; - - $rule = array(); - - $regex = $this->regexToApacheRegex($hostRegex); - $regex = self::escape($regex, ' ', '\\'); - - $rule[] = sprintf('RewriteCond %%{HTTP:Host} %s', $regex); - - $variables = array(); - $variables[] = sprintf('E=__ROUTING_host_%s:1', $hostRegexUnique); - - foreach ($compiledRoute->getHostVariables() as $i => $variable) { - $variables[] = sprintf('E=__ROUTING_host_%s_%s:%%%d', $hostRegexUnique, $variable, $i + 1); - } - - $variables = implode(',', $variables); - - $rule[] = sprintf('RewriteRule .? - [%s]', $variables); - - $rules[] = implode("\n", $rule); - } - - $rules[] = $this->dumpRoute($name, $route, $options, $hostRegexUnique); - - $methodVars = array_merge($methodVars, $route->getMethods()); - } - if (0 < count($methodVars)) { - $rule = array('# 405 Method Not Allowed'); - $methodVars = array_values(array_unique($methodVars)); - if (in_array('GET', $methodVars) && !in_array('HEAD', $methodVars)) { - $methodVars[] = 'HEAD'; - } - foreach ($methodVars as $i => $methodVar) { - $rule[] = sprintf('RewriteCond %%{ENV:_ROUTING__allow_%s} =1%s', $methodVar, isset($methodVars[$i + 1]) ? ' [OR]' : ''); - } - $rule[] = sprintf('RewriteRule .* %s [QSA,L]', $options['script_name']); - - $rules[] = implode("\n", $rule); - } - - return implode("\n\n", $rules)."\n"; - } - - /** - * Dumps a single route. - * - * @param string $name Route name - * @param Route $route The route - * @param array $options Options - * @param bool $hostRegexUnique Unique identifier for the host regex - * - * @return string The compiled route - */ - private function dumpRoute($name, $route, array $options, $hostRegexUnique) - { - $compiledRoute = $route->compile(); - - // prepare the apache regex - $regex = $this->regexToApacheRegex($compiledRoute->getRegex()); - $regex = '^'.self::escape(preg_quote($options['base_uri']).substr($regex, 1), ' ', '\\'); - - $methods = $this->getRouteMethods($route); - - $hasTrailingSlash = (!$methods || in_array('HEAD', $methods)) && '/$' === substr($regex, -2) && '^/$' !== $regex; - - $variables = array('E=_ROUTING_route:'.$name); - foreach ($compiledRoute->getHostVariables() as $variable) { - $variables[] = sprintf('E=_ROUTING_param_%s:%%{ENV:__ROUTING_host_%s_%s}', $variable, $hostRegexUnique, $variable); - } - foreach ($compiledRoute->getPathVariables() as $i => $variable) { - $variables[] = 'E=_ROUTING_param_'.$variable.':%'.($i + 1); - } - foreach ($this->normalizeValues($route->getDefaults()) as $key => $value) { - $variables[] = 'E=_ROUTING_default_'.$key.':'.strtr($value, array( - ':' => '\\:', - '=' => '\\=', - '\\' => '\\\\', - ' ' => '\\ ', - )); - } - $variables = implode(',', $variables); - - $rule = array("# $name"); - - // method mismatch - if (0 < count($methods)) { - $allow = array(); - foreach ($methods as $method) { - $allow[] = 'E=_ROUTING_allow_'.$method.':1'; - } - - if ($compiledRoute->getHostRegex()) { - $rule[] = sprintf('RewriteCond %%{ENV:__ROUTING_host_%s} =1', $hostRegexUnique); - } - - $rule[] = "RewriteCond %{REQUEST_URI} $regex"; - $rule[] = sprintf('RewriteCond %%{REQUEST_METHOD} !^(%s)$ [NC]', implode('|', $methods)); - $rule[] = sprintf('RewriteRule .* - [S=%d,%s]', $hasTrailingSlash ? 2 : 1, implode(',', $allow)); - } - - // redirect with trailing slash appended - if ($hasTrailingSlash) { - if ($compiledRoute->getHostRegex()) { - $rule[] = sprintf('RewriteCond %%{ENV:__ROUTING_host_%s} =1', $hostRegexUnique); - } - - $rule[] = 'RewriteCond %{REQUEST_URI} '.substr($regex, 0, -2).'$'; - $rule[] = 'RewriteRule .* $0/ [QSA,L,R=301]'; - } - - // the main rule - - if ($compiledRoute->getHostRegex()) { - $rule[] = sprintf('RewriteCond %%{ENV:__ROUTING_host_%s} =1', $hostRegexUnique); - } - - $rule[] = "RewriteCond %{REQUEST_URI} $regex"; - $rule[] = "RewriteRule .* {$options['script_name']} [QSA,L,$variables]"; - - return implode("\n", $rule); - } - - /** - * Returns methods allowed for a route. - * - * @param Route $route The route - * - * @return array The methods - */ - private function getRouteMethods(Route $route) - { - $methods = $route->getMethods(); - - // GET and HEAD are equivalent - if (in_array('GET', $methods) && !in_array('HEAD', $methods)) { - $methods[] = 'HEAD'; - } - - return $methods; - } - - /** - * Converts a regex to make it suitable for mod_rewrite. - * - * @param string $regex The regex - * - * @return string The converted regex - */ - private function regexToApacheRegex($regex) - { - $regexPatternEnd = strrpos($regex, $regex[0]); - - return preg_replace('/\?P<.+?>/', '', substr($regex, 1, $regexPatternEnd - 1)); - } - - /** - * Escapes a string. - * - * @param string $string The string to be escaped - * @param string $char The character to be escaped - * @param string $with The character to be used for escaping - * - * @return string The escaped string - */ - private static function escape($string, $char, $with) - { - $escaped = false; - $output = ''; - foreach (str_split($string) as $symbol) { - if ($escaped) { - $output .= $symbol; - $escaped = false; - continue; - } - if ($symbol === $char) { - $output .= $with.$char; - continue; - } - if ($symbol === $with) { - $escaped = true; - } - $output .= $symbol; - } - - return $output; - } - - /** - * Normalizes an array of values. - * - * @param array $values - * - * @return string[] - */ - private function normalizeValues(array $values) - { - $normalizedValues = array(); - foreach ($values as $key => $value) { - if (is_array($value)) { - foreach ($value as $index => $bit) { - $normalizedValues[sprintf('%s[%s]', $key, $index)] = $bit; - } - } else { - $normalizedValues[$key] = (string) $value; - } - } - - return $normalizedValues; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/routing/Matcher/Dumper/DumperCollection.php b/sitecake/2.2.9/server/vendor/symfony/routing/Matcher/Dumper/DumperCollection.php deleted file mode 100644 index f91df98..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/routing/Matcher/Dumper/DumperCollection.php +++ /dev/null @@ -1,159 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Matcher\Dumper; - -/** - * Collection of routes. - * - * @author Arnaud Le Blanc - */ -class DumperCollection implements \IteratorAggregate -{ - /** - * @var DumperCollection|null - */ - private $parent; - - /** - * @var (DumperCollection|DumperRoute)[] - */ - private $children = array(); - - /** - * @var array - */ - private $attributes = array(); - - /** - * Returns the children routes and collections. - * - * @return (DumperCollection|DumperRoute)[] Array of DumperCollection|DumperRoute - */ - public function all() - { - return $this->children; - } - - /** - * Adds a route or collection. - * - * @param DumperRoute|DumperCollection The route or collection - */ - public function add($child) - { - if ($child instanceof self) { - $child->setParent($this); - } - $this->children[] = $child; - } - - /** - * Sets children. - * - * @param array $children The children - */ - public function setAll(array $children) - { - foreach ($children as $child) { - if ($child instanceof self) { - $child->setParent($this); - } - } - $this->children = $children; - } - - /** - * Returns an iterator over the children. - * - * @return \Iterator The iterator - */ - public function getIterator() - { - return new \ArrayIterator($this->children); - } - - /** - * Returns the root of the collection. - * - * @return DumperCollection The root collection - */ - public function getRoot() - { - return (null !== $this->parent) ? $this->parent->getRoot() : $this; - } - - /** - * Returns the parent collection. - * - * @return DumperCollection|null The parent collection or null if the collection has no parent - */ - protected function getParent() - { - return $this->parent; - } - - /** - * Sets the parent collection. - * - * @param DumperCollection $parent The parent collection - */ - protected function setParent(DumperCollection $parent) - { - $this->parent = $parent; - } - - /** - * Returns true if the attribute is defined. - * - * @param string $name The attribute name - * - * @return bool true if the attribute is defined, false otherwise - */ - public function hasAttribute($name) - { - return array_key_exists($name, $this->attributes); - } - - /** - * Returns an attribute by name. - * - * @param string $name The attribute name - * @param mixed $default Default value is the attribute doesn't exist - * - * @return mixed The attribute value - */ - public function getAttribute($name, $default = null) - { - return $this->hasAttribute($name) ? $this->attributes[$name] : $default; - } - - /** - * Sets an attribute by name. - * - * @param string $name The attribute name - * @param mixed $value The attribute value - */ - public function setAttribute($name, $value) - { - $this->attributes[$name] = $value; - } - - /** - * Sets multiple attributes. - * - * @param array $attributes The attributes - */ - public function setAttributes($attributes) - { - $this->attributes = $attributes; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/routing/Matcher/Dumper/DumperPrefixCollection.php b/sitecake/2.2.9/server/vendor/symfony/routing/Matcher/Dumper/DumperPrefixCollection.php deleted file mode 100644 index 6a615f2..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/routing/Matcher/Dumper/DumperPrefixCollection.php +++ /dev/null @@ -1,105 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Matcher\Dumper; - -/** - * Prefix tree of routes preserving routes order. - * - * @author Arnaud Le Blanc - */ -class DumperPrefixCollection extends DumperCollection -{ - /** - * @var string - */ - private $prefix = ''; - - /** - * Returns the prefix. - * - * @return string The prefix - */ - public function getPrefix() - { - return $this->prefix; - } - - /** - * Sets the prefix. - * - * @param string $prefix The prefix - */ - public function setPrefix($prefix) - { - $this->prefix = $prefix; - } - - /** - * Adds a route in the tree. - * - * @param DumperRoute $route The route - * - * @return DumperPrefixCollection The node the route was added to - * - * @throws \LogicException - */ - public function addPrefixRoute(DumperRoute $route) - { - $prefix = $route->getRoute()->compile()->getStaticPrefix(); - - for ($collection = $this; null !== $collection; $collection = $collection->getParent()) { - // Same prefix, add to current leave - if ($collection->prefix === $prefix) { - $collection->add($route); - - return $collection; - } - - // Prefix starts with route's prefix - if ('' === $collection->prefix || 0 === strpos($prefix, $collection->prefix)) { - $child = new self(); - $child->setPrefix(substr($prefix, 0, strlen($collection->prefix) + 1)); - $collection->add($child); - - return $child->addPrefixRoute($route); - } - } - - // Reached only if the root has a non empty prefix - throw new \LogicException('The collection root must not have a prefix'); - } - - /** - * Merges nodes whose prefix ends with a slash. - * - * Children of a node whose prefix ends with a slash are moved to the parent node - */ - public function mergeSlashNodes() - { - $children = array(); - - foreach ($this as $child) { - if ($child instanceof self) { - $child->mergeSlashNodes(); - if ('/' === substr($child->prefix, -1)) { - $children = array_merge($children, $child->all()); - } else { - $children[] = $child; - } - } else { - $children[] = $child; - } - } - - $this->setAll($children); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/routing/Matcher/Dumper/DumperRoute.php b/sitecake/2.2.9/server/vendor/symfony/routing/Matcher/Dumper/DumperRoute.php deleted file mode 100644 index 2928cdc..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/routing/Matcher/Dumper/DumperRoute.php +++ /dev/null @@ -1,64 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Matcher\Dumper; - -use Symfony\Component\Routing\Route; - -/** - * Container for a Route. - * - * @author Arnaud Le Blanc - */ -class DumperRoute -{ - /** - * @var string - */ - private $name; - - /** - * @var Route - */ - private $route; - - /** - * Constructor. - * - * @param string $name The route name - * @param Route $route The route - */ - public function __construct($name, Route $route) - { - $this->name = $name; - $this->route = $route; - } - - /** - * Returns the route name. - * - * @return string The route name - */ - public function getName() - { - return $this->name; - } - - /** - * Returns the route. - * - * @return Route The route - */ - public function getRoute() - { - return $this->route; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/routing/Matcher/Dumper/MatcherDumper.php b/sitecake/2.2.9/server/vendor/symfony/routing/Matcher/Dumper/MatcherDumper.php deleted file mode 100644 index 52edc01..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/routing/Matcher/Dumper/MatcherDumper.php +++ /dev/null @@ -1,45 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Matcher\Dumper; - -use Symfony\Component\Routing\RouteCollection; - -/** - * MatcherDumper is the abstract class for all built-in matcher dumpers. - * - * @author Fabien Potencier - */ -abstract class MatcherDumper implements MatcherDumperInterface -{ - /** - * @var RouteCollection - */ - private $routes; - - /** - * Constructor. - * - * @param RouteCollection $routes The RouteCollection to dump - */ - public function __construct(RouteCollection $routes) - { - $this->routes = $routes; - } - - /** - * {@inheritdoc} - */ - public function getRoutes() - { - return $this->routes; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/routing/Matcher/Dumper/MatcherDumperInterface.php b/sitecake/2.2.9/server/vendor/symfony/routing/Matcher/Dumper/MatcherDumperInterface.php deleted file mode 100644 index 5e7c134..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/routing/Matcher/Dumper/MatcherDumperInterface.php +++ /dev/null @@ -1,39 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Matcher\Dumper; - -use Symfony\Component\Routing\RouteCollection; - -/** - * MatcherDumperInterface is the interface that all matcher dumper classes must implement. - * - * @author Fabien Potencier - */ -interface MatcherDumperInterface -{ - /** - * Dumps a set of routes to a string representation of executable code - * that can then be used to match a request against these routes. - * - * @param array $options An array of options - * - * @return string Executable code - */ - public function dump(array $options = array()); - - /** - * Gets the routes to dump. - * - * @return RouteCollection A RouteCollection instance - */ - public function getRoutes(); -} diff --git a/sitecake/2.2.9/server/vendor/symfony/routing/Matcher/Dumper/PhpMatcherDumper.php b/sitecake/2.2.9/server/vendor/symfony/routing/Matcher/Dumper/PhpMatcherDumper.php deleted file mode 100644 index de41448..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/routing/Matcher/Dumper/PhpMatcherDumper.php +++ /dev/null @@ -1,409 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Matcher\Dumper; - -use Symfony\Component\Routing\Route; -use Symfony\Component\Routing\RouteCollection; -use Symfony\Component\ExpressionLanguage\ExpressionLanguage; -use Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface; - -/** - * PhpMatcherDumper creates a PHP class able to match URLs for a given set of routes. - * - * @author Fabien Potencier - * @author Tobias Schultze - * @author Arnaud Le Blanc - */ -class PhpMatcherDumper extends MatcherDumper -{ - private $expressionLanguage; - - /** - * @var ExpressionFunctionProviderInterface[] - */ - private $expressionLanguageProviders = array(); - - /** - * Dumps a set of routes to a PHP class. - * - * Available options: - * - * * class: The class name - * * base_class: The base class name - * - * @param array $options An array of options - * - * @return string A PHP class representing the matcher class - */ - public function dump(array $options = array()) - { - $options = array_replace(array( - 'class' => 'ProjectUrlMatcher', - 'base_class' => 'Symfony\\Component\\Routing\\Matcher\\UrlMatcher', - ), $options); - - // trailing slash support is only enabled if we know how to redirect the user - $interfaces = class_implements($options['base_class']); - $supportsRedirections = isset($interfaces['Symfony\\Component\\Routing\\Matcher\\RedirectableUrlMatcherInterface']); - - return <<context = \$context; - } - -{$this->generateMatchMethod($supportsRedirections)} -} - -EOF; - } - - public function addExpressionLanguageProvider(ExpressionFunctionProviderInterface $provider) - { - $this->expressionLanguageProviders[] = $provider; - } - - /** - * Generates the code for the match method implementing UrlMatcherInterface. - * - * @param bool $supportsRedirections Whether redirections are supported by the base class - * - * @return string Match method as PHP code - */ - private function generateMatchMethod($supportsRedirections) - { - $code = rtrim($this->compileRoutes($this->getRoutes(), $supportsRedirections), "\n"); - - return <<context; - \$request = \$this->request; - -$code - - throw 0 < count(\$allow) ? new MethodNotAllowedException(array_unique(\$allow)) : new ResourceNotFoundException(); - } -EOF; - } - - /** - * Generates PHP code to match a RouteCollection with all its routes. - * - * @param RouteCollection $routes A RouteCollection instance - * @param bool $supportsRedirections Whether redirections are supported by the base class - * - * @return string PHP code - */ - private function compileRoutes(RouteCollection $routes, $supportsRedirections) - { - $fetchedHost = false; - - $groups = $this->groupRoutesByHostRegex($routes); - $code = ''; - - foreach ($groups as $collection) { - if (null !== $regex = $collection->getAttribute('host_regex')) { - if (!$fetchedHost) { - $code .= " \$host = \$this->context->getHost();\n\n"; - $fetchedHost = true; - } - - $code .= sprintf(" if (preg_match(%s, \$host, \$hostMatches)) {\n", var_export($regex, true)); - } - - $tree = $this->buildPrefixTree($collection); - $groupCode = $this->compilePrefixRoutes($tree, $supportsRedirections); - - if (null !== $regex) { - // apply extra indention at each line (except empty ones) - $groupCode = preg_replace('/^.{2,}$/m', ' $0', $groupCode); - $code .= $groupCode; - $code .= " }\n\n"; - } else { - $code .= $groupCode; - } - } - - return $code; - } - - /** - * Generates PHP code recursively to match a tree of routes. - * - * @param DumperPrefixCollection $collection A DumperPrefixCollection instance - * @param bool $supportsRedirections Whether redirections are supported by the base class - * @param string $parentPrefix Prefix of the parent collection - * - * @return string PHP code - */ - private function compilePrefixRoutes(DumperPrefixCollection $collection, $supportsRedirections, $parentPrefix = '') - { - $code = ''; - $prefix = $collection->getPrefix(); - $optimizable = 1 < strlen($prefix) && 1 < count($collection->all()); - $optimizedPrefix = $parentPrefix; - - if ($optimizable) { - $optimizedPrefix = $prefix; - - $code .= sprintf(" if (0 === strpos(\$pathinfo, %s)) {\n", var_export($prefix, true)); - } - - foreach ($collection as $route) { - if ($route instanceof DumperCollection) { - $code .= $this->compilePrefixRoutes($route, $supportsRedirections, $optimizedPrefix); - } else { - $code .= $this->compileRoute($route->getRoute(), $route->getName(), $supportsRedirections, $optimizedPrefix)."\n"; - } - } - - if ($optimizable) { - $code .= " }\n\n"; - // apply extra indention at each line (except empty ones) - $code = preg_replace('/^.{2,}$/m', ' $0', $code); - } - - return $code; - } - - /** - * Compiles a single Route to PHP code used to match it against the path info. - * - * @param Route $route A Route instance - * @param string $name The name of the Route - * @param bool $supportsRedirections Whether redirections are supported by the base class - * @param string|null $parentPrefix The prefix of the parent collection used to optimize the code - * - * @return string PHP code - * - * @throws \LogicException - */ - private function compileRoute(Route $route, $name, $supportsRedirections, $parentPrefix = null) - { - $code = ''; - $compiledRoute = $route->compile(); - $conditions = array(); - $hasTrailingSlash = false; - $matches = false; - $hostMatches = false; - $methods = $route->getMethods(); - - // GET and HEAD are equivalent - if (in_array('GET', $methods) && !in_array('HEAD', $methods)) { - $methods[] = 'HEAD'; - } - - $supportsTrailingSlash = $supportsRedirections && (!$methods || in_array('HEAD', $methods)); - - if (!count($compiledRoute->getPathVariables()) && false !== preg_match('#^(.)\^(?P.*?)\$\1#', $compiledRoute->getRegex(), $m)) { - if ($supportsTrailingSlash && substr($m['url'], -1) === '/') { - $conditions[] = sprintf("rtrim(\$pathinfo, '/') === %s", var_export(rtrim(str_replace('\\', '', $m['url']), '/'), true)); - $hasTrailingSlash = true; - } else { - $conditions[] = sprintf("\$pathinfo === %s", var_export(str_replace('\\', '', $m['url']), true)); - } - } else { - if ($compiledRoute->getStaticPrefix() && $compiledRoute->getStaticPrefix() !== $parentPrefix) { - $conditions[] = sprintf("0 === strpos(\$pathinfo, %s)", var_export($compiledRoute->getStaticPrefix(), true)); - } - - $regex = $compiledRoute->getRegex(); - if ($supportsTrailingSlash && $pos = strpos($regex, '/$')) { - $regex = substr($regex, 0, $pos).'/?$'.substr($regex, $pos + 2); - $hasTrailingSlash = true; - } - $conditions[] = sprintf("preg_match(%s, \$pathinfo, \$matches)", var_export($regex, true)); - - $matches = true; - } - - if ($compiledRoute->getHostVariables()) { - $hostMatches = true; - } - - if ($route->getCondition()) { - $conditions[] = $this->getExpressionLanguage()->compile($route->getCondition(), array('context', 'request')); - } - - $conditions = implode(' && ', $conditions); - - $code .= <<context->getMethod() != '$methods[0]') { - \$allow[] = '$methods[0]'; - goto $gotoname; - } - - -EOF; - } else { - $methods = implode("', '", $methods); - $code .= <<context->getMethod(), array('$methods'))) { - \$allow = array_merge(\$allow, array('$methods')); - goto $gotoname; - } - - -EOF; - } - } - - if ($hasTrailingSlash) { - $code .= <<redirect(\$pathinfo.'/', '$name'); - } - - -EOF; - } - - if ($schemes = $route->getSchemes()) { - if (!$supportsRedirections) { - throw new \LogicException('The "schemes" requirement is only supported for URL matchers that implement RedirectableUrlMatcherInterface.'); - } - $schemes = str_replace("\n", '', var_export(array_flip($schemes), true)); - $code .= <<context->getScheme()])) { - return \$this->redirect(\$pathinfo, '$name', key(\$requiredSchemes)); - } - - -EOF; - } - - // optimize parameters array - if ($matches || $hostMatches) { - $vars = array(); - if ($hostMatches) { - $vars[] = '$hostMatches'; - } - if ($matches) { - $vars[] = '$matches'; - } - $vars[] = "array('_route' => '$name')"; - - $code .= sprintf( - " return \$this->mergeDefaults(array_replace(%s), %s);\n", - implode(', ', $vars), - str_replace("\n", '', var_export($route->getDefaults(), true)) - ); - } elseif ($route->getDefaults()) { - $code .= sprintf(" return %s;\n", str_replace("\n", '', var_export(array_replace($route->getDefaults(), array('_route' => $name)), true))); - } else { - $code .= sprintf(" return array('_route' => '%s');\n", $name); - } - $code .= " }\n"; - - if ($methods) { - $code .= " $gotoname:\n"; - } - - return $code; - } - - /** - * Groups consecutive routes having the same host regex. - * - * The result is a collection of collections of routes having the same host regex. - * - * @param RouteCollection $routes A flat RouteCollection - * - * @return DumperCollection A collection with routes grouped by host regex in sub-collections - */ - private function groupRoutesByHostRegex(RouteCollection $routes) - { - $groups = new DumperCollection(); - - $currentGroup = new DumperCollection(); - $currentGroup->setAttribute('host_regex', null); - $groups->add($currentGroup); - - foreach ($routes as $name => $route) { - $hostRegex = $route->compile()->getHostRegex(); - if ($currentGroup->getAttribute('host_regex') !== $hostRegex) { - $currentGroup = new DumperCollection(); - $currentGroup->setAttribute('host_regex', $hostRegex); - $groups->add($currentGroup); - } - $currentGroup->add(new DumperRoute($name, $route)); - } - - return $groups; - } - - /** - * Organizes the routes into a prefix tree. - * - * Routes order is preserved such that traversing the tree will traverse the - * routes in the origin order. - * - * @param DumperCollection $collection A collection of routes - * - * @return DumperPrefixCollection - */ - private function buildPrefixTree(DumperCollection $collection) - { - $tree = new DumperPrefixCollection(); - $current = $tree; - - foreach ($collection as $route) { - $current = $current->addPrefixRoute($route); - } - - $tree->mergeSlashNodes(); - - return $tree; - } - - private function getExpressionLanguage() - { - if (null === $this->expressionLanguage) { - if (!class_exists('Symfony\Component\ExpressionLanguage\ExpressionLanguage')) { - throw new \RuntimeException('Unable to use expressions as the Symfony ExpressionLanguage component is not installed.'); - } - $this->expressionLanguage = new ExpressionLanguage(null, $this->expressionLanguageProviders); - } - - return $this->expressionLanguage; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/routing/Matcher/RedirectableUrlMatcher.php b/sitecake/2.2.9/server/vendor/symfony/routing/Matcher/RedirectableUrlMatcher.php deleted file mode 100644 index 236f55a..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/routing/Matcher/RedirectableUrlMatcher.php +++ /dev/null @@ -1,67 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Matcher; - -use Symfony\Component\Routing\Exception\ResourceNotFoundException; -use Symfony\Component\Routing\Route; - -/** - * @author Fabien Potencier - * - * @api - */ -abstract class RedirectableUrlMatcher extends UrlMatcher implements RedirectableUrlMatcherInterface -{ - /** - * {@inheritdoc} - */ - public function match($pathinfo) - { - try { - $parameters = parent::match($pathinfo); - } catch (ResourceNotFoundException $e) { - if ('/' === substr($pathinfo, -1) || !in_array($this->context->getMethod(), array('HEAD', 'GET'))) { - throw $e; - } - - try { - parent::match($pathinfo.'/'); - - return $this->redirect($pathinfo.'/', null); - } catch (ResourceNotFoundException $e2) { - throw $e; - } - } - - return $parameters; - } - - /** - * {@inheritdoc} - */ - protected function handleRouteRequirements($pathinfo, $name, Route $route) - { - // expression condition - if ($route->getCondition() && !$this->getExpressionLanguage()->evaluate($route->getCondition(), array('context' => $this->context, 'request' => $this->request))) { - return array(self::REQUIREMENT_MISMATCH, null); - } - - // check HTTP scheme requirement - $scheme = $this->context->getScheme(); - $schemes = $route->getSchemes(); - if ($schemes && !$route->hasScheme($scheme)) { - return array(self::ROUTE_MATCH, $this->redirect($pathinfo, $name, current($schemes))); - } - - return array(self::REQUIREMENT_MATCH, null); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/routing/Matcher/RedirectableUrlMatcherInterface.php b/sitecake/2.2.9/server/vendor/symfony/routing/Matcher/RedirectableUrlMatcherInterface.php deleted file mode 100644 index ea91e07..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/routing/Matcher/RedirectableUrlMatcherInterface.php +++ /dev/null @@ -1,35 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Matcher; - -/** - * RedirectableUrlMatcherInterface knows how to redirect the user. - * - * @author Fabien Potencier - * - * @api - */ -interface RedirectableUrlMatcherInterface -{ - /** - * Redirects the user to another URL. - * - * @param string $path The path info to redirect to. - * @param string $route The route name that matched - * @param string|null $scheme The URL scheme (null to keep the current one) - * - * @return array An array of parameters - * - * @api - */ - public function redirect($path, $route, $scheme = null); -} diff --git a/sitecake/2.2.9/server/vendor/symfony/routing/Matcher/RequestMatcherInterface.php b/sitecake/2.2.9/server/vendor/symfony/routing/Matcher/RequestMatcherInterface.php deleted file mode 100644 index b5def3d..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/routing/Matcher/RequestMatcherInterface.php +++ /dev/null @@ -1,39 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Matcher; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\Routing\Exception\ResourceNotFoundException; -use Symfony\Component\Routing\Exception\MethodNotAllowedException; - -/** - * RequestMatcherInterface is the interface that all request matcher classes must implement. - * - * @author Fabien Potencier - */ -interface RequestMatcherInterface -{ - /** - * Tries to match a request with a set of routes. - * - * If the matcher can not find information, it must throw one of the exceptions documented - * below. - * - * @param Request $request The request to match - * - * @return array An array of parameters - * - * @throws ResourceNotFoundException If no matching resource could be found - * @throws MethodNotAllowedException If a matching resource was found but the request method is not allowed - */ - public function matchRequest(Request $request); -} diff --git a/sitecake/2.2.9/server/vendor/symfony/routing/Matcher/TraceableUrlMatcher.php b/sitecake/2.2.9/server/vendor/symfony/routing/Matcher/TraceableUrlMatcher.php deleted file mode 100644 index ef4f24c..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/routing/Matcher/TraceableUrlMatcher.php +++ /dev/null @@ -1,131 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Matcher; - -use Symfony\Component\Routing\Exception\ExceptionInterface; -use Symfony\Component\Routing\Route; -use Symfony\Component\Routing\RouteCollection; - -/** - * TraceableUrlMatcher helps debug path info matching by tracing the match. - * - * @author Fabien Potencier - */ -class TraceableUrlMatcher extends UrlMatcher -{ - const ROUTE_DOES_NOT_MATCH = 0; - const ROUTE_ALMOST_MATCHES = 1; - const ROUTE_MATCHES = 2; - - protected $traces; - - public function getTraces($pathinfo) - { - $this->traces = array(); - - try { - $this->match($pathinfo); - } catch (ExceptionInterface $e) { - } - - return $this->traces; - } - - protected function matchCollection($pathinfo, RouteCollection $routes) - { - foreach ($routes as $name => $route) { - $compiledRoute = $route->compile(); - - if (!preg_match($compiledRoute->getRegex(), $pathinfo, $matches)) { - // does it match without any requirements? - $r = new Route($route->getPath(), $route->getDefaults(), array(), $route->getOptions()); - $cr = $r->compile(); - if (!preg_match($cr->getRegex(), $pathinfo)) { - $this->addTrace(sprintf('Path "%s" does not match', $route->getPath()), self::ROUTE_DOES_NOT_MATCH, $name, $route); - - continue; - } - - foreach ($route->getRequirements() as $n => $regex) { - $r = new Route($route->getPath(), $route->getDefaults(), array($n => $regex), $route->getOptions()); - $cr = $r->compile(); - - if (in_array($n, $cr->getVariables()) && !preg_match($cr->getRegex(), $pathinfo)) { - $this->addTrace(sprintf('Requirement for "%s" does not match (%s)', $n, $regex), self::ROUTE_ALMOST_MATCHES, $name, $route); - - continue 2; - } - } - - continue; - } - - // check host requirement - $hostMatches = array(); - if ($compiledRoute->getHostRegex() && !preg_match($compiledRoute->getHostRegex(), $this->context->getHost(), $hostMatches)) { - $this->addTrace(sprintf('Host "%s" does not match the requirement ("%s")', $this->context->getHost(), $route->getHost()), self::ROUTE_ALMOST_MATCHES, $name, $route); - - continue; - } - - // check HTTP method requirement - if ($requiredMethods = $route->getMethods()) { - // HEAD and GET are equivalent as per RFC - if ('HEAD' === $method = $this->context->getMethod()) { - $method = 'GET'; - } - - if (!in_array($method, $requiredMethods)) { - $this->allow = array_merge($this->allow, $requiredMethods); - - $this->addTrace(sprintf('Method "%s" does not match any of the required methods (%s)', $this->context->getMethod(), implode(', ', $requiredMethods)), self::ROUTE_ALMOST_MATCHES, $name, $route); - - continue; - } - } - - // check condition - if ($condition = $route->getCondition()) { - if (!$this->getExpressionLanguage()->evaluate($condition, array('context' => $this->context, 'request' => $this->request))) { - $this->addTrace(sprintf('Condition "%s" does not evaluate to "true"', $condition), self::ROUTE_ALMOST_MATCHES, $name, $route); - - continue; - } - } - - // check HTTP scheme requirement - if ($requiredSchemes = $route->getSchemes()) { - $scheme = $this->context->getScheme(); - - if (!$route->hasScheme($scheme)) { - $this->addTrace(sprintf('Scheme "%s" does not match any of the required schemes (%s); the user will be redirected to first required scheme', $scheme, implode(', ', $requiredSchemes)), self::ROUTE_ALMOST_MATCHES, $name, $route); - - return true; - } - } - - $this->addTrace('Route matches!', self::ROUTE_MATCHES, $name, $route); - - return true; - } - } - - private function addTrace($log, $level = self::ROUTE_DOES_NOT_MATCH, $name = null, $route = null) - { - $this->traces[] = array( - 'log' => $log, - 'name' => $name, - 'level' => $level, - 'path' => null !== $route ? $route->getPath() : null, - ); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/routing/Matcher/UrlMatcher.php b/sitecake/2.2.9/server/vendor/symfony/routing/Matcher/UrlMatcher.php deleted file mode 100644 index c754144..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/routing/Matcher/UrlMatcher.php +++ /dev/null @@ -1,255 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Matcher; - -use Symfony\Component\Routing\Exception\MethodNotAllowedException; -use Symfony\Component\Routing\Exception\ResourceNotFoundException; -use Symfony\Component\Routing\RouteCollection; -use Symfony\Component\Routing\RequestContext; -use Symfony\Component\Routing\Route; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\ExpressionLanguage\ExpressionLanguage; -use Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface; - -/** - * UrlMatcher matches URL based on a set of routes. - * - * @author Fabien Potencier - * - * @api - */ -class UrlMatcher implements UrlMatcherInterface, RequestMatcherInterface -{ - const REQUIREMENT_MATCH = 0; - const REQUIREMENT_MISMATCH = 1; - const ROUTE_MATCH = 2; - - /** - * @var RequestContext - */ - protected $context; - - /** - * @var array - */ - protected $allow = array(); - - /** - * @var RouteCollection - */ - protected $routes; - - protected $request; - protected $expressionLanguage; - - /** - * @var ExpressionFunctionProviderInterface[] - */ - protected $expressionLanguageProviders = array(); - - /** - * Constructor. - * - * @param RouteCollection $routes A RouteCollection instance - * @param RequestContext $context The context - * - * @api - */ - public function __construct(RouteCollection $routes, RequestContext $context) - { - $this->routes = $routes; - $this->context = $context; - } - - /** - * {@inheritdoc} - */ - public function setContext(RequestContext $context) - { - $this->context = $context; - } - - /** - * {@inheritdoc} - */ - public function getContext() - { - return $this->context; - } - - /** - * {@inheritdoc} - */ - public function match($pathinfo) - { - $this->allow = array(); - - if ($ret = $this->matchCollection(rawurldecode($pathinfo), $this->routes)) { - return $ret; - } - - throw 0 < count($this->allow) - ? new MethodNotAllowedException(array_unique($this->allow)) - : new ResourceNotFoundException(sprintf('No routes found for "%s".', $pathinfo)); - } - - /** - * {@inheritdoc} - */ - public function matchRequest(Request $request) - { - $this->request = $request; - - $ret = $this->match($request->getPathInfo()); - - $this->request = null; - - return $ret; - } - - public function addExpressionLanguageProvider(ExpressionFunctionProviderInterface $provider) - { - $this->expressionLanguageProviders[] = $provider; - } - - /** - * Tries to match a URL with a set of routes. - * - * @param string $pathinfo The path info to be parsed - * @param RouteCollection $routes The set of routes - * - * @return array An array of parameters - * - * @throws ResourceNotFoundException If the resource could not be found - * @throws MethodNotAllowedException If the resource was found but the request method is not allowed - */ - protected function matchCollection($pathinfo, RouteCollection $routes) - { - foreach ($routes as $name => $route) { - $compiledRoute = $route->compile(); - - // check the static prefix of the URL first. Only use the more expensive preg_match when it matches - if ('' !== $compiledRoute->getStaticPrefix() && 0 !== strpos($pathinfo, $compiledRoute->getStaticPrefix())) { - continue; - } - - if (!preg_match($compiledRoute->getRegex(), $pathinfo, $matches)) { - continue; - } - - $hostMatches = array(); - if ($compiledRoute->getHostRegex() && !preg_match($compiledRoute->getHostRegex(), $this->context->getHost(), $hostMatches)) { - continue; - } - - // check HTTP method requirement - if ($requiredMethods = $route->getMethods()) { - // HEAD and GET are equivalent as per RFC - if ('HEAD' === $method = $this->context->getMethod()) { - $method = 'GET'; - } - - if (!in_array($method, $requiredMethods)) { - $this->allow = array_merge($this->allow, $requiredMethods); - - continue; - } - } - - $status = $this->handleRouteRequirements($pathinfo, $name, $route); - - if (self::ROUTE_MATCH === $status[0]) { - return $status[1]; - } - - if (self::REQUIREMENT_MISMATCH === $status[0]) { - continue; - } - - return $this->getAttributes($route, $name, array_replace($matches, $hostMatches)); - } - } - - /** - * Returns an array of values to use as request attributes. - * - * As this method requires the Route object, it is not available - * in matchers that do not have access to the matched Route instance - * (like the PHP and Apache matcher dumpers). - * - * @param Route $route The route we are matching against - * @param string $name The name of the route - * @param array $attributes An array of attributes from the matcher - * - * @return array An array of parameters - */ - protected function getAttributes(Route $route, $name, array $attributes) - { - $attributes['_route'] = $name; - - return $this->mergeDefaults($attributes, $route->getDefaults()); - } - - /** - * Handles specific route requirements. - * - * @param string $pathinfo The path - * @param string $name The route name - * @param Route $route The route - * - * @return array The first element represents the status, the second contains additional information - */ - protected function handleRouteRequirements($pathinfo, $name, Route $route) - { - // expression condition - if ($route->getCondition() && !$this->getExpressionLanguage()->evaluate($route->getCondition(), array('context' => $this->context, 'request' => $this->request))) { - return array(self::REQUIREMENT_MISMATCH, null); - } - - // check HTTP scheme requirement - $scheme = $this->context->getScheme(); - $status = $route->getSchemes() && !$route->hasScheme($scheme) ? self::REQUIREMENT_MISMATCH : self::REQUIREMENT_MATCH; - - return array($status, null); - } - - /** - * Get merged default parameters. - * - * @param array $params The parameters - * @param array $defaults The defaults - * - * @return array Merged default parameters - */ - protected function mergeDefaults($params, $defaults) - { - foreach ($params as $key => $value) { - if (!is_int($key)) { - $defaults[$key] = $value; - } - } - - return $defaults; - } - - protected function getExpressionLanguage() - { - if (null === $this->expressionLanguage) { - if (!class_exists('Symfony\Component\ExpressionLanguage\ExpressionLanguage')) { - throw new \RuntimeException('Unable to use expressions as the Symfony ExpressionLanguage component is not installed.'); - } - $this->expressionLanguage = new ExpressionLanguage(null, $this->expressionLanguageProviders); - } - - return $this->expressionLanguage; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/routing/Matcher/UrlMatcherInterface.php b/sitecake/2.2.9/server/vendor/symfony/routing/Matcher/UrlMatcherInterface.php deleted file mode 100644 index dd718b1..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/routing/Matcher/UrlMatcherInterface.php +++ /dev/null @@ -1,43 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Matcher; - -use Symfony\Component\Routing\RequestContextAwareInterface; -use Symfony\Component\Routing\Exception\ResourceNotFoundException; -use Symfony\Component\Routing\Exception\MethodNotAllowedException; - -/** - * UrlMatcherInterface is the interface that all URL matcher classes must implement. - * - * @author Fabien Potencier - * - * @api - */ -interface UrlMatcherInterface extends RequestContextAwareInterface -{ - /** - * Tries to match a URL path with a set of routes. - * - * If the matcher can not find information, it must throw one of the exceptions documented - * below. - * - * @param string $pathinfo The path info to be parsed (raw format, i.e. not urldecoded) - * - * @return array An array of parameters - * - * @throws ResourceNotFoundException If the resource could not be found - * @throws MethodNotAllowedException If the resource was found but the request method is not allowed - * - * @api - */ - public function match($pathinfo); -} diff --git a/sitecake/2.2.9/server/vendor/symfony/routing/README.md b/sitecake/2.2.9/server/vendor/symfony/routing/README.md deleted file mode 100644 index 1a94583..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/routing/README.md +++ /dev/null @@ -1,36 +0,0 @@ -Routing Component -================= - -Routing associates a request with the code that will convert it to a response. - -The example below demonstrates how you can set up a fully working routing -system: - -```php -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\Routing\Matcher\UrlMatcher; -use Symfony\Component\Routing\RequestContext; -use Symfony\Component\Routing\RouteCollection; -use Symfony\Component\Routing\Route; - -$routes = new RouteCollection(); -$routes->add('hello', new Route('/hello', array('controller' => 'foo'))); - -$context = new RequestContext(); - -// this is optional and can be done without a Request instance -$context->fromRequest(Request::createFromGlobals()); - -$matcher = new UrlMatcher($routes, $context); - -$parameters = $matcher->match('/hello'); -``` - -Resources ---------- - -You can run the unit tests with the following command: - - $ cd path/to/Symfony/Component/Routing/ - $ composer install - $ phpunit diff --git a/sitecake/2.2.9/server/vendor/symfony/routing/RequestContext.php b/sitecake/2.2.9/server/vendor/symfony/routing/RequestContext.php deleted file mode 100644 index 577d1d0..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/routing/RequestContext.php +++ /dev/null @@ -1,364 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing; - -use Symfony\Component\HttpFoundation\Request; - -/** - * Holds information about the current request. - * - * This class implements a fluent interface. - * - * @author Fabien Potencier - * @author Tobias Schultze - * - * @api - */ -class RequestContext -{ - private $baseUrl; - private $pathInfo; - private $method; - private $host; - private $scheme; - private $httpPort; - private $httpsPort; - private $queryString; - - /** - * @var array - */ - private $parameters = array(); - - /** - * Constructor. - * - * @param string $baseUrl The base URL - * @param string $method The HTTP method - * @param string $host The HTTP host name - * @param string $scheme The HTTP scheme - * @param int $httpPort The HTTP port - * @param int $httpsPort The HTTPS port - * @param string $path The path - * @param string $queryString The query string - * - * @api - */ - public function __construct($baseUrl = '', $method = 'GET', $host = 'localhost', $scheme = 'http', $httpPort = 80, $httpsPort = 443, $path = '/', $queryString = '') - { - $this->setBaseUrl($baseUrl); - $this->setMethod($method); - $this->setHost($host); - $this->setScheme($scheme); - $this->setHttpPort($httpPort); - $this->setHttpsPort($httpsPort); - $this->setPathInfo($path); - $this->setQueryString($queryString); - } - - /** - * Updates the RequestContext information based on a HttpFoundation Request. - * - * @param Request $request A Request instance - * - * @return RequestContext The current instance, implementing a fluent interface - */ - public function fromRequest(Request $request) - { - $this->setBaseUrl($request->getBaseUrl()); - $this->setPathInfo($request->getPathInfo()); - $this->setMethod($request->getMethod()); - $this->setHost($request->getHost()); - $this->setScheme($request->getScheme()); - $this->setHttpPort($request->isSecure() ? $this->httpPort : $request->getPort()); - $this->setHttpsPort($request->isSecure() ? $request->getPort() : $this->httpsPort); - $this->setQueryString($request->server->get('QUERY_STRING', '')); - - return $this; - } - - /** - * Gets the base URL. - * - * @return string The base URL - */ - public function getBaseUrl() - { - return $this->baseUrl; - } - - /** - * Sets the base URL. - * - * @param string $baseUrl The base URL - * - * @return RequestContext The current instance, implementing a fluent interface - * - * @api - */ - public function setBaseUrl($baseUrl) - { - $this->baseUrl = $baseUrl; - - return $this; - } - - /** - * Gets the path info. - * - * @return string The path info - */ - public function getPathInfo() - { - return $this->pathInfo; - } - - /** - * Sets the path info. - * - * @param string $pathInfo The path info - * - * @return RequestContext The current instance, implementing a fluent interface - */ - public function setPathInfo($pathInfo) - { - $this->pathInfo = $pathInfo; - - return $this; - } - - /** - * Gets the HTTP method. - * - * The method is always an uppercased string. - * - * @return string The HTTP method - */ - public function getMethod() - { - return $this->method; - } - - /** - * Sets the HTTP method. - * - * @param string $method The HTTP method - * - * @return RequestContext The current instance, implementing a fluent interface - * - * @api - */ - public function setMethod($method) - { - $this->method = strtoupper($method); - - return $this; - } - - /** - * Gets the HTTP host. - * - * The host is always lowercased because it must be treated case-insensitive. - * - * @return string The HTTP host - */ - public function getHost() - { - return $this->host; - } - - /** - * Sets the HTTP host. - * - * @param string $host The HTTP host - * - * @return RequestContext The current instance, implementing a fluent interface - * - * @api - */ - public function setHost($host) - { - $this->host = strtolower($host); - - return $this; - } - - /** - * Gets the HTTP scheme. - * - * @return string The HTTP scheme - */ - public function getScheme() - { - return $this->scheme; - } - - /** - * Sets the HTTP scheme. - * - * @param string $scheme The HTTP scheme - * - * @return RequestContext The current instance, implementing a fluent interface - * - * @api - */ - public function setScheme($scheme) - { - $this->scheme = strtolower($scheme); - - return $this; - } - - /** - * Gets the HTTP port. - * - * @return int The HTTP port - */ - public function getHttpPort() - { - return $this->httpPort; - } - - /** - * Sets the HTTP port. - * - * @param int $httpPort The HTTP port - * - * @return RequestContext The current instance, implementing a fluent interface - * - * @api - */ - public function setHttpPort($httpPort) - { - $this->httpPort = (int) $httpPort; - - return $this; - } - - /** - * Gets the HTTPS port. - * - * @return int The HTTPS port - */ - public function getHttpsPort() - { - return $this->httpsPort; - } - - /** - * Sets the HTTPS port. - * - * @param int $httpsPort The HTTPS port - * - * @return RequestContext The current instance, implementing a fluent interface - * - * @api - */ - public function setHttpsPort($httpsPort) - { - $this->httpsPort = (int) $httpsPort; - - return $this; - } - - /** - * Gets the query string. - * - * @return string The query string without the "?" - */ - public function getQueryString() - { - return $this->queryString; - } - - /** - * Sets the query string. - * - * @param string $queryString The query string (after "?") - * - * @return RequestContext The current instance, implementing a fluent interface - * - * @api - */ - public function setQueryString($queryString) - { - // string cast to be fault-tolerant, accepting null - $this->queryString = (string) $queryString; - - return $this; - } - - /** - * Returns the parameters. - * - * @return array The parameters - */ - public function getParameters() - { - return $this->parameters; - } - - /** - * Sets the parameters. - * - * @param array $parameters The parameters - * - * @return RequestContext The current instance, implementing a fluent interface - */ - public function setParameters(array $parameters) - { - $this->parameters = $parameters; - - return $this; - } - - /** - * Gets a parameter value. - * - * @param string $name A parameter name - * - * @return mixed The parameter value or null if nonexistent - */ - public function getParameter($name) - { - return isset($this->parameters[$name]) ? $this->parameters[$name] : null; - } - - /** - * Checks if a parameter value is set for the given parameter. - * - * @param string $name A parameter name - * - * @return bool True if the parameter value is set, false otherwise - */ - public function hasParameter($name) - { - return array_key_exists($name, $this->parameters); - } - - /** - * Sets a parameter value. - * - * @param string $name A parameter name - * @param mixed $parameter The parameter value - * - * @return RequestContext The current instance, implementing a fluent interface - * - * @api - */ - public function setParameter($name, $parameter) - { - $this->parameters[$name] = $parameter; - - return $this; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/routing/RequestContextAwareInterface.php b/sitecake/2.2.9/server/vendor/symfony/routing/RequestContextAwareInterface.php deleted file mode 100644 index daf5254..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/routing/RequestContextAwareInterface.php +++ /dev/null @@ -1,36 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing; - -/** - * @api - */ -interface RequestContextAwareInterface -{ - /** - * Sets the request context. - * - * @param RequestContext $context The context - * - * @api - */ - public function setContext(RequestContext $context); - - /** - * Gets the request context. - * - * @return RequestContext The context - * - * @api - */ - public function getContext(); -} diff --git a/sitecake/2.2.9/server/vendor/symfony/routing/Route.php b/sitecake/2.2.9/server/vendor/symfony/routing/Route.php deleted file mode 100644 index 19a48f1..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/routing/Route.php +++ /dev/null @@ -1,669 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing; - -/** - * A Route describes a route and its parameters. - * - * @author Fabien Potencier - * @author Tobias Schultze - * - * @api - */ -class Route implements \Serializable -{ - /** - * @var string - */ - private $path = '/'; - - /** - * @var string - */ - private $host = ''; - - /** - * @var array - */ - private $schemes = array(); - - /** - * @var array - */ - private $methods = array(); - - /** - * @var array - */ - private $defaults = array(); - - /** - * @var array - */ - private $requirements = array(); - - /** - * @var array - */ - private $options = array(); - - /** - * @var null|CompiledRoute - */ - private $compiled; - - /** - * @var string - */ - private $condition = ''; - - /** - * Constructor. - * - * Available options: - * - * * compiler_class: A class name able to compile this route instance (RouteCompiler by default) - * - * @param string $path The path pattern to match - * @param array $defaults An array of default parameter values - * @param array $requirements An array of requirements for parameters (regexes) - * @param array $options An array of options - * @param string $host The host pattern to match - * @param string|array $schemes A required URI scheme or an array of restricted schemes - * @param string|array $methods A required HTTP method or an array of restricted methods - * @param string $condition A condition that should evaluate to true for the route to match - * - * @api - */ - public function __construct($path, array $defaults = array(), array $requirements = array(), array $options = array(), $host = '', $schemes = array(), $methods = array(), $condition = '') - { - $this->setPath($path); - $this->setDefaults($defaults); - $this->setRequirements($requirements); - $this->setOptions($options); - $this->setHost($host); - // The conditions make sure that an initial empty $schemes/$methods does not override the corresponding requirement. - // They can be removed when the BC layer is removed. - if ($schemes) { - $this->setSchemes($schemes); - } - if ($methods) { - $this->setMethods($methods); - } - $this->setCondition($condition); - } - - /** - * {@inheritdoc} - */ - public function serialize() - { - return serialize(array( - 'path' => $this->path, - 'host' => $this->host, - 'defaults' => $this->defaults, - 'requirements' => $this->requirements, - 'options' => $this->options, - 'schemes' => $this->schemes, - 'methods' => $this->methods, - 'condition' => $this->condition, - 'compiled' => $this->compiled, - )); - } - - /** - * {@inheritdoc} - */ - public function unserialize($serialized) - { - $data = unserialize($serialized); - $this->path = $data['path']; - $this->host = $data['host']; - $this->defaults = $data['defaults']; - $this->requirements = $data['requirements']; - $this->options = $data['options']; - $this->schemes = $data['schemes']; - $this->methods = $data['methods']; - - if (isset($data['condition'])) { - $this->condition = $data['condition']; - } - if (isset($data['compiled'])) { - $this->compiled = $data['compiled']; - } - } - - /** - * Returns the pattern for the path. - * - * @return string The pattern - * - * @deprecated since version 2.2, to be removed in 3.0. Use getPath instead. - */ - public function getPattern() - { - @trigger_error('The '.__METHOD__.' method is deprecated since version 2.2 and will be removed in 3.0. Use the getPath() method instead.', E_USER_DEPRECATED); - - return $this->path; - } - - /** - * Sets the pattern for the path. - * - * This method implements a fluent interface. - * - * @param string $pattern The path pattern - * - * @return Route The current Route instance - * - * @deprecated since version 2.2, to be removed in 3.0. Use setPath instead. - */ - public function setPattern($pattern) - { - @trigger_error('The '.__METHOD__.' method is deprecated since version 2.2 and will be removed in 3.0. Use the setPath() method instead.', E_USER_DEPRECATED); - - return $this->setPath($pattern); - } - - /** - * Returns the pattern for the path. - * - * @return string The path pattern - */ - public function getPath() - { - return $this->path; - } - - /** - * Sets the pattern for the path. - * - * This method implements a fluent interface. - * - * @param string $pattern The path pattern - * - * @return Route The current Route instance - */ - public function setPath($pattern) - { - // A pattern must start with a slash and must not have multiple slashes at the beginning because the - // generated path for this route would be confused with a network path, e.g. '//domain.com/path'. - $this->path = '/'.ltrim(trim($pattern), '/'); - $this->compiled = null; - - return $this; - } - - /** - * Returns the pattern for the host. - * - * @return string The host pattern - */ - public function getHost() - { - return $this->host; - } - - /** - * Sets the pattern for the host. - * - * This method implements a fluent interface. - * - * @param string $pattern The host pattern - * - * @return Route The current Route instance - */ - public function setHost($pattern) - { - $this->host = (string) $pattern; - $this->compiled = null; - - return $this; - } - - /** - * Returns the lowercased schemes this route is restricted to. - * So an empty array means that any scheme is allowed. - * - * @return array The schemes - */ - public function getSchemes() - { - return $this->schemes; - } - - /** - * Sets the schemes (e.g. 'https') this route is restricted to. - * So an empty array means that any scheme is allowed. - * - * This method implements a fluent interface. - * - * @param string|array $schemes The scheme or an array of schemes - * - * @return Route The current Route instance - */ - public function setSchemes($schemes) - { - $this->schemes = array_map('strtolower', (array) $schemes); - - // this is to keep BC and will be removed in a future version - if ($this->schemes) { - $this->requirements['_scheme'] = implode('|', $this->schemes); - } else { - unset($this->requirements['_scheme']); - } - - $this->compiled = null; - - return $this; - } - - /** - * Checks if a scheme requirement has been set. - * - * @param string $scheme - * - * @return bool true if the scheme requirement exists, otherwise false - */ - public function hasScheme($scheme) - { - return in_array(strtolower($scheme), $this->schemes, true); - } - - /** - * Returns the uppercased HTTP methods this route is restricted to. - * So an empty array means that any method is allowed. - * - * @return array The methods - */ - public function getMethods() - { - return $this->methods; - } - - /** - * Sets the HTTP methods (e.g. 'POST') this route is restricted to. - * So an empty array means that any method is allowed. - * - * This method implements a fluent interface. - * - * @param string|array $methods The method or an array of methods - * - * @return Route The current Route instance - */ - public function setMethods($methods) - { - $this->methods = array_map('strtoupper', (array) $methods); - - // this is to keep BC and will be removed in a future version - if ($this->methods) { - $this->requirements['_method'] = implode('|', $this->methods); - } else { - unset($this->requirements['_method']); - } - - $this->compiled = null; - - return $this; - } - - /** - * Returns the options. - * - * @return array The options - */ - public function getOptions() - { - return $this->options; - } - - /** - * Sets the options. - * - * This method implements a fluent interface. - * - * @param array $options The options - * - * @return Route The current Route instance - */ - public function setOptions(array $options) - { - $this->options = array( - 'compiler_class' => 'Symfony\\Component\\Routing\\RouteCompiler', - ); - - return $this->addOptions($options); - } - - /** - * Adds options. - * - * This method implements a fluent interface. - * - * @param array $options The options - * - * @return Route The current Route instance - */ - public function addOptions(array $options) - { - foreach ($options as $name => $option) { - $this->options[$name] = $option; - } - $this->compiled = null; - - return $this; - } - - /** - * Sets an option value. - * - * This method implements a fluent interface. - * - * @param string $name An option name - * @param mixed $value The option value - * - * @return Route The current Route instance - * - * @api - */ - public function setOption($name, $value) - { - $this->options[$name] = $value; - $this->compiled = null; - - return $this; - } - - /** - * Get an option value. - * - * @param string $name An option name - * - * @return mixed The option value or null when not given - */ - public function getOption($name) - { - return isset($this->options[$name]) ? $this->options[$name] : null; - } - - /** - * Checks if an option has been set. - * - * @param string $name An option name - * - * @return bool true if the option is set, false otherwise - */ - public function hasOption($name) - { - return array_key_exists($name, $this->options); - } - - /** - * Returns the defaults. - * - * @return array The defaults - */ - public function getDefaults() - { - return $this->defaults; - } - - /** - * Sets the defaults. - * - * This method implements a fluent interface. - * - * @param array $defaults The defaults - * - * @return Route The current Route instance - */ - public function setDefaults(array $defaults) - { - $this->defaults = array(); - - return $this->addDefaults($defaults); - } - - /** - * Adds defaults. - * - * This method implements a fluent interface. - * - * @param array $defaults The defaults - * - * @return Route The current Route instance - */ - public function addDefaults(array $defaults) - { - foreach ($defaults as $name => $default) { - $this->defaults[$name] = $default; - } - $this->compiled = null; - - return $this; - } - - /** - * Gets a default value. - * - * @param string $name A variable name - * - * @return mixed The default value or null when not given - */ - public function getDefault($name) - { - return isset($this->defaults[$name]) ? $this->defaults[$name] : null; - } - - /** - * Checks if a default value is set for the given variable. - * - * @param string $name A variable name - * - * @return bool true if the default value is set, false otherwise - */ - public function hasDefault($name) - { - return array_key_exists($name, $this->defaults); - } - - /** - * Sets a default value. - * - * @param string $name A variable name - * @param mixed $default The default value - * - * @return Route The current Route instance - * - * @api - */ - public function setDefault($name, $default) - { - $this->defaults[$name] = $default; - $this->compiled = null; - - return $this; - } - - /** - * Returns the requirements. - * - * @return array The requirements - */ - public function getRequirements() - { - return $this->requirements; - } - - /** - * Sets the requirements. - * - * This method implements a fluent interface. - * - * @param array $requirements The requirements - * - * @return Route The current Route instance - */ - public function setRequirements(array $requirements) - { - $this->requirements = array(); - - return $this->addRequirements($requirements); - } - - /** - * Adds requirements. - * - * This method implements a fluent interface. - * - * @param array $requirements The requirements - * - * @return Route The current Route instance - */ - public function addRequirements(array $requirements) - { - foreach ($requirements as $key => $regex) { - $this->requirements[$key] = $this->sanitizeRequirement($key, $regex); - } - $this->compiled = null; - - return $this; - } - - /** - * Returns the requirement for the given key. - * - * @param string $key The key - * - * @return string|null The regex or null when not given - */ - public function getRequirement($key) - { - if ('_scheme' === $key) { - @trigger_error('The "_scheme" requirement is deprecated since version 2.2 and will be removed in 3.0. Use getSchemes() instead.', E_USER_DEPRECATED); - } elseif ('_method' === $key) { - @trigger_error('The "_method" requirement is deprecated since version 2.2 and will be removed in 3.0. Use getMethods() instead.', E_USER_DEPRECATED); - } - - return isset($this->requirements[$key]) ? $this->requirements[$key] : null; - } - - /** - * Checks if a requirement is set for the given key. - * - * @param string $key A variable name - * - * @return bool true if a requirement is specified, false otherwise - */ - public function hasRequirement($key) - { - return array_key_exists($key, $this->requirements); - } - - /** - * Sets a requirement for the given key. - * - * @param string $key The key - * @param string $regex The regex - * - * @return Route The current Route instance - * - * @api - */ - public function setRequirement($key, $regex) - { - $this->requirements[$key] = $this->sanitizeRequirement($key, $regex); - $this->compiled = null; - - return $this; - } - - /** - * Returns the condition. - * - * @return string The condition - */ - public function getCondition() - { - return $this->condition; - } - - /** - * Sets the condition. - * - * This method implements a fluent interface. - * - * @param string $condition The condition - * - * @return Route The current Route instance - */ - public function setCondition($condition) - { - $this->condition = (string) $condition; - $this->compiled = null; - - return $this; - } - - /** - * Compiles the route. - * - * @return CompiledRoute A CompiledRoute instance - * - * @throws \LogicException If the Route cannot be compiled because the - * path or host pattern is invalid - * - * @see RouteCompiler which is responsible for the compilation process - */ - public function compile() - { - if (null !== $this->compiled) { - return $this->compiled; - } - - $class = $this->getOption('compiler_class'); - - return $this->compiled = $class::compile($this); - } - - private function sanitizeRequirement($key, $regex) - { - if (!is_string($regex)) { - throw new \InvalidArgumentException(sprintf('Routing requirement for "%s" must be a string.', $key)); - } - - if ('' !== $regex && '^' === $regex[0]) { - $regex = (string) substr($regex, 1); // returns false for a single character - } - - if ('$' === substr($regex, -1)) { - $regex = substr($regex, 0, -1); - } - - if ('' === $regex) { - throw new \InvalidArgumentException(sprintf('Routing requirement for "%s" cannot be empty.', $key)); - } - - // this is to keep BC and will be removed in a future version - if ('_scheme' === $key) { - @trigger_error('The "_scheme" requirement is deprecated since version 2.2 and will be removed in 3.0. Use the setSchemes() method instead.', E_USER_DEPRECATED); - - $this->setSchemes(explode('|', $regex)); - } elseif ('_method' === $key) { - @trigger_error('The "_method" requirement is deprecated since version 2.2 and will be removed in 3.0. Use the setMethods() method instead.', E_USER_DEPRECATED); - - $this->setMethods(explode('|', $regex)); - } - - return $regex; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/routing/RouteCollection.php b/sitecake/2.2.9/server/vendor/symfony/routing/RouteCollection.php deleted file mode 100644 index df37f36..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/routing/RouteCollection.php +++ /dev/null @@ -1,285 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing; - -use Symfony\Component\Config\Resource\ResourceInterface; - -/** - * A RouteCollection represents a set of Route instances. - * - * When adding a route at the end of the collection, an existing route - * with the same name is removed first. So there can only be one route - * with a given name. - * - * @author Fabien Potencier - * @author Tobias Schultze - * - * @api - */ -class RouteCollection implements \IteratorAggregate, \Countable -{ - /** - * @var Route[] - */ - private $routes = array(); - - /** - * @var array - */ - private $resources = array(); - - public function __clone() - { - foreach ($this->routes as $name => $route) { - $this->routes[$name] = clone $route; - } - } - - /** - * Gets the current RouteCollection as an Iterator that includes all routes. - * - * It implements \IteratorAggregate. - * - * @see all() - * - * @return \ArrayIterator An \ArrayIterator object for iterating over routes - */ - public function getIterator() - { - return new \ArrayIterator($this->routes); - } - - /** - * Gets the number of Routes in this collection. - * - * @return int The number of routes - */ - public function count() - { - return count($this->routes); - } - - /** - * Adds a route. - * - * @param string $name The route name - * @param Route $route A Route instance - * - * @api - */ - public function add($name, Route $route) - { - unset($this->routes[$name]); - - $this->routes[$name] = $route; - } - - /** - * Returns all routes in this collection. - * - * @return Route[] An array of routes - */ - public function all() - { - return $this->routes; - } - - /** - * Gets a route by name. - * - * @param string $name The route name - * - * @return Route|null A Route instance or null when not found - */ - public function get($name) - { - return isset($this->routes[$name]) ? $this->routes[$name] : null; - } - - /** - * Removes a route or an array of routes by name from the collection. - * - * @param string|array $name The route name or an array of route names - */ - public function remove($name) - { - foreach ((array) $name as $n) { - unset($this->routes[$n]); - } - } - - /** - * Adds a route collection at the end of the current set by appending all - * routes of the added collection. - * - * @param RouteCollection $collection A RouteCollection instance - * - * @api - */ - public function addCollection(RouteCollection $collection) - { - // we need to remove all routes with the same names first because just replacing them - // would not place the new route at the end of the merged array - foreach ($collection->all() as $name => $route) { - unset($this->routes[$name]); - $this->routes[$name] = $route; - } - - $this->resources = array_merge($this->resources, $collection->getResources()); - } - - /** - * Adds a prefix to the path of all child routes. - * - * @param string $prefix An optional prefix to add before each pattern of the route collection - * @param array $defaults An array of default values - * @param array $requirements An array of requirements - * - * @api - */ - public function addPrefix($prefix, array $defaults = array(), array $requirements = array()) - { - $prefix = trim(trim($prefix), '/'); - - if ('' === $prefix) { - return; - } - - foreach ($this->routes as $route) { - $route->setPath('/'.$prefix.$route->getPath()); - $route->addDefaults($defaults); - $route->addRequirements($requirements); - } - } - - /** - * Sets the host pattern on all routes. - * - * @param string $pattern The pattern - * @param array $defaults An array of default values - * @param array $requirements An array of requirements - */ - public function setHost($pattern, array $defaults = array(), array $requirements = array()) - { - foreach ($this->routes as $route) { - $route->setHost($pattern); - $route->addDefaults($defaults); - $route->addRequirements($requirements); - } - } - - /** - * Sets a condition on all routes. - * - * Existing conditions will be overridden. - * - * @param string $condition The condition - */ - public function setCondition($condition) - { - foreach ($this->routes as $route) { - $route->setCondition($condition); - } - } - - /** - * Adds defaults to all routes. - * - * An existing default value under the same name in a route will be overridden. - * - * @param array $defaults An array of default values - */ - public function addDefaults(array $defaults) - { - if ($defaults) { - foreach ($this->routes as $route) { - $route->addDefaults($defaults); - } - } - } - - /** - * Adds requirements to all routes. - * - * An existing requirement under the same name in a route will be overridden. - * - * @param array $requirements An array of requirements - */ - public function addRequirements(array $requirements) - { - if ($requirements) { - foreach ($this->routes as $route) { - $route->addRequirements($requirements); - } - } - } - - /** - * Adds options to all routes. - * - * An existing option value under the same name in a route will be overridden. - * - * @param array $options An array of options - */ - public function addOptions(array $options) - { - if ($options) { - foreach ($this->routes as $route) { - $route->addOptions($options); - } - } - } - - /** - * Sets the schemes (e.g. 'https') all child routes are restricted to. - * - * @param string|array $schemes The scheme or an array of schemes - */ - public function setSchemes($schemes) - { - foreach ($this->routes as $route) { - $route->setSchemes($schemes); - } - } - - /** - * Sets the HTTP methods (e.g. 'POST') all child routes are restricted to. - * - * @param string|array $methods The method or an array of methods - */ - public function setMethods($methods) - { - foreach ($this->routes as $route) { - $route->setMethods($methods); - } - } - - /** - * Returns an array of resources loaded to build this collection. - * - * @return ResourceInterface[] An array of resources - */ - public function getResources() - { - return array_unique($this->resources); - } - - /** - * Adds a resource for this collection. - * - * @param ResourceInterface $resource A resource instance - */ - public function addResource(ResourceInterface $resource) - { - $this->resources[] = $resource; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/routing/RouteCompiler.php b/sitecake/2.2.9/server/vendor/symfony/routing/RouteCompiler.php deleted file mode 100644 index f6637da..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/routing/RouteCompiler.php +++ /dev/null @@ -1,229 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing; - -/** - * RouteCompiler compiles Route instances to CompiledRoute instances. - * - * @author Fabien Potencier - * @author Tobias Schultze - */ -class RouteCompiler implements RouteCompilerInterface -{ - const REGEX_DELIMITER = '#'; - - /** - * This string defines the characters that are automatically considered separators in front of - * optional placeholders (with default and no static text following). Such a single separator - * can be left out together with the optional placeholder from matching and generating URLs. - */ - const SEPARATORS = '/,;.:-_~+*=@|'; - - /** - * {@inheritdoc} - * - * @throws \LogicException If a variable is referenced more than once - * @throws \DomainException If a variable name is numeric because PHP raises an error for such - * subpatterns in PCRE and thus would break matching, e.g. "(?P<123>.+)". - */ - public static function compile(Route $route) - { - $hostVariables = array(); - $variables = array(); - $hostRegex = null; - $hostTokens = array(); - - if ('' !== $host = $route->getHost()) { - $result = self::compilePattern($route, $host, true); - - $hostVariables = $result['variables']; - $variables = $hostVariables; - - $hostTokens = $result['tokens']; - $hostRegex = $result['regex']; - } - - $path = $route->getPath(); - - $result = self::compilePattern($route, $path, false); - - $staticPrefix = $result['staticPrefix']; - - $pathVariables = $result['variables']; - $variables = array_merge($variables, $pathVariables); - - $tokens = $result['tokens']; - $regex = $result['regex']; - - return new CompiledRoute( - $staticPrefix, - $regex, - $tokens, - $pathVariables, - $hostRegex, - $hostTokens, - $hostVariables, - array_unique($variables) - ); - } - - private static function compilePattern(Route $route, $pattern, $isHost) - { - $tokens = array(); - $variables = array(); - $matches = array(); - $pos = 0; - $defaultSeparator = $isHost ? '.' : '/'; - - // Match all variables enclosed in "{}" and iterate over them. But we only want to match the innermost variable - // in case of nested "{}", e.g. {foo{bar}}. This in ensured because \w does not match "{" or "}" itself. - preg_match_all('#\{\w+\}#', $pattern, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER); - foreach ($matches as $match) { - $varName = substr($match[0][0], 1, -1); - // get all static text preceding the current variable - $precedingText = substr($pattern, $pos, $match[0][1] - $pos); - $pos = $match[0][1] + strlen($match[0][0]); - $precedingChar = strlen($precedingText) > 0 ? substr($precedingText, -1) : ''; - $isSeparator = '' !== $precedingChar && false !== strpos(static::SEPARATORS, $precedingChar); - - if (is_numeric($varName)) { - throw new \DomainException(sprintf('Variable name "%s" cannot be numeric in route pattern "%s". Please use a different name.', $varName, $pattern)); - } - if (in_array($varName, $variables)) { - throw new \LogicException(sprintf('Route pattern "%s" cannot reference variable name "%s" more than once.', $pattern, $varName)); - } - - if ($isSeparator && strlen($precedingText) > 1) { - $tokens[] = array('text', substr($precedingText, 0, -1)); - } elseif (!$isSeparator && strlen($precedingText) > 0) { - $tokens[] = array('text', $precedingText); - } - - $regexp = $route->getRequirement($varName); - if (null === $regexp) { - $followingPattern = (string) substr($pattern, $pos); - // Find the next static character after the variable that functions as a separator. By default, this separator and '/' - // are disallowed for the variable. This default requirement makes sure that optional variables can be matched at all - // and that the generating-matching-combination of URLs unambiguous, i.e. the params used for generating the URL are - // the same that will be matched. Example: new Route('/{page}.{_format}', array('_format' => 'html')) - // If {page} would also match the separating dot, {_format} would never match as {page} will eagerly consume everything. - // Also even if {_format} was not optional the requirement prevents that {page} matches something that was originally - // part of {_format} when generating the URL, e.g. _format = 'mobile.html'. - $nextSeparator = self::findNextSeparator($followingPattern); - $regexp = sprintf( - '[^%s%s]+', - preg_quote($defaultSeparator, self::REGEX_DELIMITER), - $defaultSeparator !== $nextSeparator && '' !== $nextSeparator ? preg_quote($nextSeparator, self::REGEX_DELIMITER) : '' - ); - if (('' !== $nextSeparator && !preg_match('#^\{\w+\}#', $followingPattern)) || '' === $followingPattern) { - // When we have a separator, which is disallowed for the variable, we can optimize the regex with a possessive - // quantifier. This prevents useless backtracking of PCRE and improves performance by 20% for matching those patterns. - // Given the above example, there is no point in backtracking into {page} (that forbids the dot) when a dot must follow - // after it. This optimization cannot be applied when the next char is no real separator or when the next variable is - // directly adjacent, e.g. '/{x}{y}'. - $regexp .= '+'; - } - } - - $tokens[] = array('variable', $isSeparator ? $precedingChar : '', $regexp, $varName); - $variables[] = $varName; - } - - if ($pos < strlen($pattern)) { - $tokens[] = array('text', substr($pattern, $pos)); - } - - // find the first optional token - $firstOptional = PHP_INT_MAX; - if (!$isHost) { - for ($i = count($tokens) - 1; $i >= 0; --$i) { - $token = $tokens[$i]; - if ('variable' === $token[0] && $route->hasDefault($token[3])) { - $firstOptional = $i; - } else { - break; - } - } - } - - // compute the matching regexp - $regexp = ''; - for ($i = 0, $nbToken = count($tokens); $i < $nbToken; ++$i) { - $regexp .= self::computeRegexp($tokens, $i, $firstOptional); - } - - return array( - 'staticPrefix' => 'text' === $tokens[0][0] ? $tokens[0][1] : '', - 'regex' => self::REGEX_DELIMITER.'^'.$regexp.'$'.self::REGEX_DELIMITER.'s'.($isHost ? 'i' : ''), - 'tokens' => array_reverse($tokens), - 'variables' => $variables, - ); - } - - /** - * Returns the next static character in the Route pattern that will serve as a separator. - * - * @param string $pattern The route pattern - * - * @return string The next static character that functions as separator (or empty string when none available) - */ - private static function findNextSeparator($pattern) - { - if ('' == $pattern) { - // return empty string if pattern is empty or false (false which can be returned by substr) - return ''; - } - // first remove all placeholders from the pattern so we can find the next real static character - $pattern = preg_replace('#\{\w+\}#', '', $pattern); - - return isset($pattern[0]) && false !== strpos(static::SEPARATORS, $pattern[0]) ? $pattern[0] : ''; - } - - /** - * Computes the regexp used to match a specific token. It can be static text or a subpattern. - * - * @param array $tokens The route tokens - * @param int $index The index of the current token - * @param int $firstOptional The index of the first optional token - * - * @return string The regexp pattern for a single token - */ - private static function computeRegexp(array $tokens, $index, $firstOptional) - { - $token = $tokens[$index]; - if ('text' === $token[0]) { - // Text tokens - return preg_quote($token[1], self::REGEX_DELIMITER); - } else { - // Variable tokens - if (0 === $index && 0 === $firstOptional) { - // When the only token is an optional variable token, the separator is required - return sprintf('%s(?P<%s>%s)?', preg_quote($token[1], self::REGEX_DELIMITER), $token[3], $token[2]); - } else { - $regexp = sprintf('%s(?P<%s>%s)', preg_quote($token[1], self::REGEX_DELIMITER), $token[3], $token[2]); - if ($index >= $firstOptional) { - // Enclose each optional token in a subpattern to make it optional. - // "?:" means it is non-capturing, i.e. the portion of the subject string that - // matched the optional subpattern is not passed back. - $regexp = "(?:$regexp"; - $nbTokens = count($tokens); - if ($nbTokens - 1 == $index) { - // Close the optional subpatterns - $regexp .= str_repeat(')?', $nbTokens - $firstOptional - (0 === $firstOptional ? 1 : 0)); - } - } - - return $regexp; - } - } - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/routing/RouteCompilerInterface.php b/sitecake/2.2.9/server/vendor/symfony/routing/RouteCompilerInterface.php deleted file mode 100644 index e6f8ee6..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/routing/RouteCompilerInterface.php +++ /dev/null @@ -1,32 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing; - -/** - * RouteCompilerInterface is the interface that all RouteCompiler classes must implement. - * - * @author Fabien Potencier - */ -interface RouteCompilerInterface -{ - /** - * Compiles the current route instance. - * - * @param Route $route A Route instance - * - * @return CompiledRoute A CompiledRoute instance - * - * @throws \LogicException If the Route cannot be compiled because the - * path or host pattern is invalid - */ - public static function compile(Route $route); -} diff --git a/sitecake/2.2.9/server/vendor/symfony/routing/Router.php b/sitecake/2.2.9/server/vendor/symfony/routing/Router.php deleted file mode 100644 index e2651ef..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/routing/Router.php +++ /dev/null @@ -1,390 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing; - -use Symfony\Component\Config\Loader\LoaderInterface; -use Symfony\Component\Config\ConfigCacheInterface; -use Symfony\Component\Config\ConfigCacheFactoryInterface; -use Symfony\Component\Config\ConfigCacheFactory; -use Psr\Log\LoggerInterface; -use Symfony\Component\Routing\Generator\ConfigurableRequirementsInterface; -use Symfony\Component\Routing\Generator\UrlGeneratorInterface; -use Symfony\Component\Routing\Generator\Dumper\GeneratorDumperInterface; -use Symfony\Component\Routing\Matcher\RequestMatcherInterface; -use Symfony\Component\Routing\Matcher\UrlMatcherInterface; -use Symfony\Component\Routing\Matcher\Dumper\MatcherDumperInterface; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface; - -/** - * The Router class is an example of the integration of all pieces of the - * routing system for easier use. - * - * @author Fabien Potencier - */ -class Router implements RouterInterface, RequestMatcherInterface -{ - /** - * @var UrlMatcherInterface|null - */ - protected $matcher; - - /** - * @var UrlGeneratorInterface|null - */ - protected $generator; - - /** - * @var RequestContext - */ - protected $context; - - /** - * @var LoaderInterface - */ - protected $loader; - - /** - * @var RouteCollection|null - */ - protected $collection; - - /** - * @var mixed - */ - protected $resource; - - /** - * @var array - */ - protected $options = array(); - - /** - * @var LoggerInterface|null - */ - protected $logger; - - /** - * @var ConfigCacheFactoryInterface|null - */ - private $configCacheFactory; - - /** - * @var ExpressionFunctionProviderInterface[] - */ - private $expressionLanguageProviders = array(); - - /** - * Constructor. - * - * @param LoaderInterface $loader A LoaderInterface instance - * @param mixed $resource The main resource to load - * @param array $options An array of options - * @param RequestContext $context The context - * @param LoggerInterface $logger A logger instance - */ - public function __construct(LoaderInterface $loader, $resource, array $options = array(), RequestContext $context = null, LoggerInterface $logger = null) - { - $this->loader = $loader; - $this->resource = $resource; - $this->logger = $logger; - $this->context = $context ?: new RequestContext(); - $this->setOptions($options); - } - - /** - * Sets options. - * - * Available options: - * - * * cache_dir: The cache directory (or null to disable caching) - * * debug: Whether to enable debugging or not (false by default) - * * resource_type: Type hint for the main resource (optional) - * - * @param array $options An array of options - * - * @throws \InvalidArgumentException When unsupported option is provided - */ - public function setOptions(array $options) - { - $this->options = array( - 'cache_dir' => null, - 'debug' => false, - 'generator_class' => 'Symfony\\Component\\Routing\\Generator\\UrlGenerator', - 'generator_base_class' => 'Symfony\\Component\\Routing\\Generator\\UrlGenerator', - 'generator_dumper_class' => 'Symfony\\Component\\Routing\\Generator\\Dumper\\PhpGeneratorDumper', - 'generator_cache_class' => 'ProjectUrlGenerator', - 'matcher_class' => 'Symfony\\Component\\Routing\\Matcher\\UrlMatcher', - 'matcher_base_class' => 'Symfony\\Component\\Routing\\Matcher\\UrlMatcher', - 'matcher_dumper_class' => 'Symfony\\Component\\Routing\\Matcher\\Dumper\\PhpMatcherDumper', - 'matcher_cache_class' => 'ProjectUrlMatcher', - 'resource_type' => null, - 'strict_requirements' => true, - ); - - // check option names and live merge, if errors are encountered Exception will be thrown - $invalid = array(); - foreach ($options as $key => $value) { - if (array_key_exists($key, $this->options)) { - $this->options[$key] = $value; - } else { - $invalid[] = $key; - } - } - - if ($invalid) { - throw new \InvalidArgumentException(sprintf('The Router does not support the following options: "%s".', implode('", "', $invalid))); - } - } - - /** - * Sets an option. - * - * @param string $key The key - * @param mixed $value The value - * - * @throws \InvalidArgumentException - */ - public function setOption($key, $value) - { - if (!array_key_exists($key, $this->options)) { - throw new \InvalidArgumentException(sprintf('The Router does not support the "%s" option.', $key)); - } - - $this->options[$key] = $value; - } - - /** - * Gets an option value. - * - * @param string $key The key - * - * @return mixed The value - * - * @throws \InvalidArgumentException - */ - public function getOption($key) - { - if (!array_key_exists($key, $this->options)) { - throw new \InvalidArgumentException(sprintf('The Router does not support the "%s" option.', $key)); - } - - return $this->options[$key]; - } - - /** - * {@inheritdoc} - */ - public function getRouteCollection() - { - if (null === $this->collection) { - $this->collection = $this->loader->load($this->resource, $this->options['resource_type']); - } - - return $this->collection; - } - - /** - * {@inheritdoc} - */ - public function setContext(RequestContext $context) - { - $this->context = $context; - - if (null !== $this->matcher) { - $this->getMatcher()->setContext($context); - } - if (null !== $this->generator) { - $this->getGenerator()->setContext($context); - } - } - - /** - * {@inheritdoc} - */ - public function getContext() - { - return $this->context; - } - - /** - * Sets the ConfigCache factory to use. - * - * @param ConfigCacheFactoryInterface $configCacheFactory The factory to use. - */ - public function setConfigCacheFactory(ConfigCacheFactoryInterface $configCacheFactory) - { - $this->configCacheFactory = $configCacheFactory; - } - - /** - * {@inheritdoc} - */ - public function generate($name, $parameters = array(), $referenceType = self::ABSOLUTE_PATH) - { - return $this->getGenerator()->generate($name, $parameters, $referenceType); - } - - /** - * {@inheritdoc} - */ - public function match($pathinfo) - { - return $this->getMatcher()->match($pathinfo); - } - - /** - * {@inheritdoc} - */ - public function matchRequest(Request $request) - { - $matcher = $this->getMatcher(); - if (!$matcher instanceof RequestMatcherInterface) { - // fallback to the default UrlMatcherInterface - return $matcher->match($request->getPathInfo()); - } - - return $matcher->matchRequest($request); - } - - /** - * Gets the UrlMatcher instance associated with this Router. - * - * @return UrlMatcherInterface A UrlMatcherInterface instance - */ - public function getMatcher() - { - if (null !== $this->matcher) { - return $this->matcher; - } - - if (null === $this->options['cache_dir'] || null === $this->options['matcher_cache_class']) { - $this->matcher = new $this->options['matcher_class']($this->getRouteCollection(), $this->context); - if (method_exists($this->matcher, 'addExpressionLanguageProvider')) { - foreach ($this->expressionLanguageProviders as $provider) { - $this->matcher->addExpressionLanguageProvider($provider); - } - } - - return $this->matcher; - } - - $class = $this->options['matcher_cache_class']; - $baseClass = $this->options['matcher_base_class']; - $expressionLanguageProviders = $this->expressionLanguageProviders; - $that = $this; // required for PHP 5.3 where "$this" cannot be use()d in anonymous functions. Change in Symfony 3.0. - - $cache = $this->getConfigCacheFactory()->cache($this->options['cache_dir'].'/'.$class.'.php', - function (ConfigCacheInterface $cache) use ($that, $class, $baseClass, $expressionLanguageProviders) { - $dumper = $that->getMatcherDumperInstance(); - if (method_exists($dumper, 'addExpressionLanguageProvider')) { - foreach ($expressionLanguageProviders as $provider) { - $dumper->addExpressionLanguageProvider($provider); - } - } - - $options = array( - 'class' => $class, - 'base_class' => $baseClass, - ); - - $cache->write($dumper->dump($options), $that->getRouteCollection()->getResources()); - } - ); - - require_once $cache->getPath(); - - return $this->matcher = new $class($this->context); - } - - /** - * Gets the UrlGenerator instance associated with this Router. - * - * @return UrlGeneratorInterface A UrlGeneratorInterface instance - */ - public function getGenerator() - { - if (null !== $this->generator) { - return $this->generator; - } - - if (null === $this->options['cache_dir'] || null === $this->options['generator_cache_class']) { - $this->generator = new $this->options['generator_class']($this->getRouteCollection(), $this->context, $this->logger); - } else { - $class = $this->options['generator_cache_class']; - $baseClass = $this->options['generator_base_class']; - $that = $this; // required for PHP 5.3 where "$this" cannot be use()d in anonymous functions. Change in Symfony 3.0. - $cache = $this->getConfigCacheFactory()->cache($this->options['cache_dir'].'/'.$class.'.php', - function (ConfigCacheInterface $cache) use ($that, $class, $baseClass) { - $dumper = $that->getGeneratorDumperInstance(); - - $options = array( - 'class' => $class, - 'base_class' => $baseClass, - ); - - $cache->write($dumper->dump($options), $that->getRouteCollection()->getResources()); - } - ); - - require_once $cache->getPath(); - - $this->generator = new $class($this->context, $this->logger); - } - - if ($this->generator instanceof ConfigurableRequirementsInterface) { - $this->generator->setStrictRequirements($this->options['strict_requirements']); - } - - return $this->generator; - } - - public function addExpressionLanguageProvider(ExpressionFunctionProviderInterface $provider) - { - $this->expressionLanguageProviders[] = $provider; - } - - /** - * This method is public because it needs to be callable from a closure in PHP 5.3. It should be converted back to protected in 3.0. - * @internal - * @return GeneratorDumperInterface - */ - public function getGeneratorDumperInstance() - { - return new $this->options['generator_dumper_class']($this->getRouteCollection()); - } - - /** - * This method is public because it needs to be callable from a closure in PHP 5.3. It should be converted back to protected in 3.0. - * @internal - * @return MatcherDumperInterface - */ - public function getMatcherDumperInstance() - { - return new $this->options['matcher_dumper_class']($this->getRouteCollection()); - } - - /** - * Provides the ConfigCache factory implementation, falling back to a - * default implementation if necessary. - * - * @return ConfigCacheFactoryInterface $configCacheFactory - */ - private function getConfigCacheFactory() - { - if (null === $this->configCacheFactory) { - $this->configCacheFactory = new ConfigCacheFactory($this->options['debug']); - } - - return $this->configCacheFactory; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/routing/RouterInterface.php b/sitecake/2.2.9/server/vendor/symfony/routing/RouterInterface.php deleted file mode 100644 index a10ae34..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/routing/RouterInterface.php +++ /dev/null @@ -1,32 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing; - -use Symfony\Component\Routing\Generator\UrlGeneratorInterface; -use Symfony\Component\Routing\Matcher\UrlMatcherInterface; - -/** - * RouterInterface is the interface that all Router classes must implement. - * - * This interface is the concatenation of UrlMatcherInterface and UrlGeneratorInterface. - * - * @author Fabien Potencier - */ -interface RouterInterface extends UrlMatcherInterface, UrlGeneratorInterface -{ - /** - * Gets the RouteCollection instance associated with this Router. - * - * @return RouteCollection A RouteCollection instance - */ - public function getRouteCollection(); -} diff --git a/sitecake/2.2.9/server/vendor/symfony/routing/composer.json b/sitecake/2.2.9/server/vendor/symfony/routing/composer.json deleted file mode 100644 index 31b63ae..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/routing/composer.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "name": "symfony/routing", - "type": "library", - "description": "Symfony Routing Component", - "keywords": ["routing", "router", "URL", "URI"], - "homepage": "https://symfony.com", - "license": "MIT", - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "require": { - "php": ">=5.3.9" - }, - "require-dev": { - "symfony/phpunit-bridge": "~2.7", - "symfony/config": "~2.7", - "symfony/http-foundation": "~2.3", - "symfony/yaml": "~2.0,>=2.0.5", - "symfony/expression-language": "~2.4", - "doctrine/annotations": "~1.0", - "doctrine/common": "~2.2", - "psr/log": "~1.0" - }, - "conflict": { - "symfony/config": "<2.7" - }, - "suggest": { - "symfony/config": "For using the all-in-one router or any loader", - "symfony/yaml": "For using the YAML loader", - "symfony/expression-language": "For using expression matching", - "doctrine/annotations": "For using the annotation loader" - }, - "autoload": { - "psr-4": { "Symfony\\Component\\Routing\\": "" } - }, - "minimum-stability": "dev", - "extra": { - "branch-alias": { - "dev-master": "2.7-dev" - } - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/routing/phpunit.xml.dist b/sitecake/2.2.9/server/vendor/symfony/routing/phpunit.xml.dist deleted file mode 100644 index a908308..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/routing/phpunit.xml.dist +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - ./Tests/ - - - - - - ./ - - ./vendor - ./Tests - - - - diff --git a/sitecake/2.2.9/server/vendor/symfony/translation/CHANGELOG.md b/sitecake/2.2.9/server/vendor/symfony/translation/CHANGELOG.md deleted file mode 100644 index 157752c..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/translation/CHANGELOG.md +++ /dev/null @@ -1,47 +0,0 @@ -CHANGELOG -========= - -2.7.0 ------ - - * added DataCollectorTranslator for collecting the translated messages. - -2.6.0 ------ - - * added possibility to cache catalogues - * added TranslatorBagInterface - * added LoggingTranslator - * added Translator::getMessages() for retrieving the message catalogue as an array - -2.5.0 ------ - - * added relative file path template to the file dumpers - * added optional backup to the file dumpers - * changed IcuResFileDumper to extend FileDumper - -2.3.0 ------ - - * added classes to make operations on catalogues (like making a diff or a merge on 2 catalogues) - * added Translator::getFallbackLocales() - * deprecated Translator::setFallbackLocale() in favor of the new Translator::setFallbackLocales() method - -2.2.0 ------ - - * QtTranslationsLoader class renamed to QtFileLoader. QtTranslationsLoader is deprecated and will be removed in 2.3. - * [BC BREAK] uniformized the exception thrown by the load() method when an error occurs. The load() method now - throws Symfony\Component\Translation\Exception\NotFoundResourceException when a resource cannot be found - and Symfony\Component\Translation\Exception\InvalidResourceException when a resource is invalid. - * changed the exception class thrown by some load() methods from \RuntimeException to \InvalidArgumentException - (IcuDatFileLoader, IcuResFileLoader and QtFileLoader) - -2.1.0 ------ - - * added support for more than one fallback locale - * added support for extracting translation messages from templates (Twig and PHP) - * added dumpers for translation catalogs - * added support for QT, gettext, and ResourceBundles diff --git a/sitecake/2.2.9/server/vendor/symfony/translation/Catalogue/AbstractOperation.php b/sitecake/2.2.9/server/vendor/symfony/translation/Catalogue/AbstractOperation.php deleted file mode 100644 index 062056b..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/translation/Catalogue/AbstractOperation.php +++ /dev/null @@ -1,146 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Catalogue; - -use Symfony\Component\Translation\MessageCatalogue; -use Symfony\Component\Translation\MessageCatalogueInterface; - -/** - * Base catalogues binary operation class. - * - * @author Jean-François Simon - */ -abstract class AbstractOperation implements OperationInterface -{ - /** - * @var MessageCatalogueInterface - */ - protected $source; - - /** - * @var MessageCatalogueInterface - */ - protected $target; - - /** - * @var MessageCatalogue - */ - protected $result; - - /** - * @var null|array - */ - private $domains; - - /** - * @var array - */ - protected $messages; - - /** - * @param MessageCatalogueInterface $source - * @param MessageCatalogueInterface $target - * - * @throws \LogicException - */ - public function __construct(MessageCatalogueInterface $source, MessageCatalogueInterface $target) - { - if ($source->getLocale() !== $target->getLocale()) { - throw new \LogicException('Operated catalogues must belong to the same locale.'); - } - - $this->source = $source; - $this->target = $target; - $this->result = new MessageCatalogue($source->getLocale()); - $this->domains = null; - $this->messages = array(); - } - - /** - * {@inheritdoc} - */ - public function getDomains() - { - if (null === $this->domains) { - $this->domains = array_values(array_unique(array_merge($this->source->getDomains(), $this->target->getDomains()))); - } - - return $this->domains; - } - - /** - * {@inheritdoc} - */ - public function getMessages($domain) - { - if (!in_array($domain, $this->getDomains())) { - throw new \InvalidArgumentException(sprintf('Invalid domain: %s.', $domain)); - } - - if (!isset($this->messages[$domain]['all'])) { - $this->processDomain($domain); - } - - return $this->messages[$domain]['all']; - } - - /** - * {@inheritdoc} - */ - public function getNewMessages($domain) - { - if (!in_array($domain, $this->getDomains())) { - throw new \InvalidArgumentException(sprintf('Invalid domain: %s.', $domain)); - } - - if (!isset($this->messages[$domain]['new'])) { - $this->processDomain($domain); - } - - return $this->messages[$domain]['new']; - } - - /** - * {@inheritdoc} - */ - public function getObsoleteMessages($domain) - { - if (!in_array($domain, $this->getDomains())) { - throw new \InvalidArgumentException(sprintf('Invalid domain: %s.', $domain)); - } - - if (!isset($this->messages[$domain]['obsolete'])) { - $this->processDomain($domain); - } - - return $this->messages[$domain]['obsolete']; - } - - /** - * {@inheritdoc} - */ - public function getResult() - { - foreach ($this->getDomains() as $domain) { - if (!isset($this->messages[$domain])) { - $this->processDomain($domain); - } - } - - return $this->result; - } - - /** - * @param string $domain - */ - abstract protected function processDomain($domain); -} diff --git a/sitecake/2.2.9/server/vendor/symfony/translation/Catalogue/DiffOperation.php b/sitecake/2.2.9/server/vendor/symfony/translation/Catalogue/DiffOperation.php deleted file mode 100644 index 2d1994e..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/translation/Catalogue/DiffOperation.php +++ /dev/null @@ -1,55 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Catalogue; - -/** - * Diff operation between two catalogues. - * - * @author Jean-François Simon - */ -class DiffOperation extends AbstractOperation -{ - /** - * {@inheritdoc} - */ - protected function processDomain($domain) - { - $this->messages[$domain] = array( - 'all' => array(), - 'new' => array(), - 'obsolete' => array(), - ); - - foreach ($this->source->all($domain) as $id => $message) { - if ($this->target->has($id, $domain)) { - $this->messages[$domain]['all'][$id] = $message; - $this->result->add(array($id => $message), $domain); - if (null !== $keyMetadata = $this->source->getMetadata($id, $domain)) { - $this->result->setMetadata($id, $keyMetadata, $domain); - } - } else { - $this->messages[$domain]['obsolete'][$id] = $message; - } - } - - foreach ($this->target->all($domain) as $id => $message) { - if (!$this->source->has($id, $domain)) { - $this->messages[$domain]['all'][$id] = $message; - $this->messages[$domain]['new'][$id] = $message; - $this->result->add(array($id => $message), $domain); - if (null !== $keyMetadata = $this->target->getMetadata($id, $domain)) { - $this->result->setMetadata($id, $keyMetadata, $domain); - } - } - } - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/translation/Catalogue/MergeOperation.php b/sitecake/2.2.9/server/vendor/symfony/translation/Catalogue/MergeOperation.php deleted file mode 100644 index 562ca0e..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/translation/Catalogue/MergeOperation.php +++ /dev/null @@ -1,51 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Catalogue; - -/** - * Merge operation between two catalogues. - * - * @author Jean-François Simon - */ -class MergeOperation extends AbstractOperation -{ - /** - * {@inheritdoc} - */ - protected function processDomain($domain) - { - $this->messages[$domain] = array( - 'all' => array(), - 'new' => array(), - 'obsolete' => array(), - ); - - foreach ($this->source->all($domain) as $id => $message) { - $this->messages[$domain]['all'][$id] = $message; - $this->result->add(array($id => $message), $domain); - if (null !== $keyMetadata = $this->source->getMetadata($id, $domain)) { - $this->result->setMetadata($id, $keyMetadata, $domain); - } - } - - foreach ($this->target->all($domain) as $id => $message) { - if (!$this->source->has($id, $domain)) { - $this->messages[$domain]['all'][$id] = $message; - $this->messages[$domain]['new'][$id] = $message; - $this->result->add(array($id => $message), $domain); - if (null !== $keyMetadata = $this->target->getMetadata($id, $domain)) { - $this->result->setMetadata($id, $keyMetadata, $domain); - } - } - } - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/translation/Catalogue/OperationInterface.php b/sitecake/2.2.9/server/vendor/symfony/translation/Catalogue/OperationInterface.php deleted file mode 100644 index d72378a..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/translation/Catalogue/OperationInterface.php +++ /dev/null @@ -1,63 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Catalogue; - -use Symfony\Component\Translation\MessageCatalogueInterface; - -/** - * Represents an operation on catalogue(s). - * - * @author Jean-François Simon - */ -interface OperationInterface -{ - /** - * Returns domains affected by operation. - * - * @return array - */ - public function getDomains(); - - /** - * Returns all valid messages after operation. - * - * @param string $domain - * - * @return array - */ - public function getMessages($domain); - - /** - * Returns new messages after operation. - * - * @param string $domain - * - * @return array - */ - public function getNewMessages($domain); - - /** - * Returns obsolete messages after operation. - * - * @param string $domain - * - * @return array - */ - public function getObsoleteMessages($domain); - - /** - * Returns resulting catalogue. - * - * @return MessageCatalogueInterface - */ - public function getResult(); -} diff --git a/sitecake/2.2.9/server/vendor/symfony/translation/DataCollector/TranslationDataCollector.php b/sitecake/2.2.9/server/vendor/symfony/translation/DataCollector/TranslationDataCollector.php deleted file mode 100644 index eb9d1e7..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/translation/DataCollector/TranslationDataCollector.php +++ /dev/null @@ -1,145 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\DataCollector; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\DataCollector\DataCollector; -use Symfony\Component\HttpKernel\DataCollector\LateDataCollectorInterface; -use Symfony\Component\Translation\DataCollectorTranslator; - -/** - * @author Abdellatif Ait boudad - */ -class TranslationDataCollector extends DataCollector implements LateDataCollectorInterface -{ - /** - * @var DataCollectorTranslator - */ - private $translator; - - /** - * @param DataCollectorTranslator $translator - */ - public function __construct(DataCollectorTranslator $translator) - { - $this->translator = $translator; - } - - /** - * {@inheritdoc} - */ - public function lateCollect() - { - $messages = $this->sanitizeCollectedMessages($this->translator->getCollectedMessages()); - - $this->data = $this->computeCount($messages); - $this->data['messages'] = $messages; - } - - /** - * {@inheritdoc} - */ - public function collect(Request $request, Response $response, \Exception $exception = null) - { - } - - /** - * @return array - */ - public function getMessages() - { - return isset($this->data['messages']) ? $this->data['messages'] : array(); - } - - /** - * @return int - */ - public function getCountMissings() - { - return isset($this->data[DataCollectorTranslator::MESSAGE_MISSING]) ? $this->data[DataCollectorTranslator::MESSAGE_MISSING] : 0; - } - - /** - * @return int - */ - public function getCountFallbacks() - { - return isset($this->data[DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK]) ? $this->data[DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK] : 0; - } - - /** - * @return int - */ - public function getCountDefines() - { - return isset($this->data[DataCollectorTranslator::MESSAGE_DEFINED]) ? $this->data[DataCollectorTranslator::MESSAGE_DEFINED] : 0; - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return 'translation'; - } - - private function sanitizeCollectedMessages($messages) - { - $result = array(); - foreach ($messages as $key => $message) { - $messageId = $message['locale'].$message['domain'].$message['id']; - - if (!isset($result[$messageId])) { - $message['count'] = 1; - $messages[$key]['translation'] = $this->sanitizeString($message['translation']); - $result[$messageId] = $message; - } else { - $result[$messageId]['count']++; - } - - unset($messages[$key]); - } - - return $result; - } - - private function computeCount($messages) - { - $count = array( - DataCollectorTranslator::MESSAGE_DEFINED => 0, - DataCollectorTranslator::MESSAGE_MISSING => 0, - DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK => 0, - ); - - foreach ($messages as $message) { - ++$count[$message['state']]; - } - - return $count; - } - - private function sanitizeString($string, $length = 80) - { - $string = trim(preg_replace('/\s+/', ' ', $string)); - - if (function_exists('mb_strlen') && false !== $encoding = mb_detect_encoding($string)) { - if (mb_strlen($string, $encoding) > $length) { - return mb_substr($string, 0, $length - 3, $encoding).'...'; - } - } elseif (strlen($string) > $length) { - return substr($string, 0, $length - 3).'...'; - } - - return $string; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/translation/DataCollectorTranslator.php b/sitecake/2.2.9/server/vendor/symfony/translation/DataCollectorTranslator.php deleted file mode 100644 index 813a857..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/translation/DataCollectorTranslator.php +++ /dev/null @@ -1,152 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation; - -/** - * @author Abdellatif Ait boudad - */ -class DataCollectorTranslator implements TranslatorInterface, TranslatorBagInterface -{ - const MESSAGE_DEFINED = 0; - const MESSAGE_MISSING = 1; - const MESSAGE_EQUALS_FALLBACK = 2; - - /** - * @var TranslatorInterface|TranslatorBagInterface - */ - private $translator; - - /** - * @var array - */ - private $messages = array(); - - /** - * @param TranslatorInterface $translator The translator must implement TranslatorBagInterface - */ - public function __construct(TranslatorInterface $translator) - { - if (!$translator instanceof TranslatorBagInterface) { - throw new \InvalidArgumentException(sprintf('The Translator "%s" must implement TranslatorInterface and TranslatorBagInterface.', get_class($translator))); - } - - $this->translator = $translator; - } - - /** - * {@inheritdoc} - */ - public function trans($id, array $parameters = array(), $domain = null, $locale = null) - { - $trans = $this->translator->trans($id, $parameters, $domain, $locale); - $this->collectMessage($locale, $domain, $id, $trans); - - return $trans; - } - - /** - * {@inheritdoc} - */ - public function transChoice($id, $number, array $parameters = array(), $domain = null, $locale = null) - { - $trans = $this->translator->transChoice($id, $number, $parameters, $domain, $locale); - $this->collectMessage($locale, $domain, $id, $trans); - - return $trans; - } - - /** - * {@inheritdoc} - * - * @api - */ - public function setLocale($locale) - { - $this->translator->setLocale($locale); - } - - /** - * {@inheritdoc} - * - * @api - */ - public function getLocale() - { - return $this->translator->getLocale(); - } - - /** - * {@inheritdoc} - */ - public function getCatalogue($locale = null) - { - return $this->translator->getCatalogue($locale); - } - - /** - * Passes through all unknown calls onto the translator object. - */ - public function __call($method, $args) - { - return call_user_func_array(array($this->translator, $method), $args); - } - - /** - * @return array - */ - public function getCollectedMessages() - { - return $this->messages; - } - - /** - * @param string|null $locale - * @param string|null $domain - * @param string $id - * @param string $trans - */ - private function collectMessage($locale, $domain, $id, $translation) - { - if (null === $domain) { - $domain = 'messages'; - } - - $id = (string) $id; - $catalogue = $this->translator->getCatalogue($locale); - $locale = $catalogue->getLocale(); - if ($catalogue->defines($id, $domain)) { - $state = self::MESSAGE_DEFINED; - } elseif ($catalogue->has($id, $domain)) { - $state = self::MESSAGE_EQUALS_FALLBACK; - - $fallbackCatalogue = $catalogue->getFallBackCatalogue(); - while ($fallbackCatalogue) { - if ($fallbackCatalogue->defines($id, $domain)) { - $locale = $fallbackCatalogue->getLocale(); - break; - } - - $fallbackCatalogue = $fallbackCatalogue->getFallBackCatalogue(); - } - } else { - $state = self::MESSAGE_MISSING; - } - - $this->messages[] = array( - 'locale' => $locale, - 'domain' => $domain, - 'id' => $id, - 'translation' => $translation, - 'state' => $state, - ); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/translation/Dumper/CsvFileDumper.php b/sitecake/2.2.9/server/vendor/symfony/translation/Dumper/CsvFileDumper.php deleted file mode 100644 index 08005b0..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/translation/Dumper/CsvFileDumper.php +++ /dev/null @@ -1,63 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Dumper; - -use Symfony\Component\Translation\MessageCatalogue; - -/** - * CsvFileDumper generates a csv formatted string representation of a message catalogue. - * - * @author Stealth35 - */ -class CsvFileDumper extends FileDumper -{ - private $delimiter = ';'; - private $enclosure = '"'; - - /** - * {@inheritdoc} - */ - public function format(MessageCatalogue $messages, $domain = 'messages') - { - $handle = fopen('php://memory', 'rb+'); - - foreach ($messages->all($domain) as $source => $target) { - fputcsv($handle, array($source, $target), $this->delimiter, $this->enclosure); - } - - rewind($handle); - $output = stream_get_contents($handle); - fclose($handle); - - return $output; - } - - /** - * Sets the delimiter and escape character for CSV. - * - * @param string $delimiter delimiter character - * @param string $enclosure enclosure character - */ - public function setCsvControl($delimiter = ';', $enclosure = '"') - { - $this->delimiter = $delimiter; - $this->enclosure = $enclosure; - } - - /** - * {@inheritdoc} - */ - protected function getExtension() - { - return 'csv'; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/translation/Dumper/DumperInterface.php b/sitecake/2.2.9/server/vendor/symfony/translation/Dumper/DumperInterface.php deleted file mode 100644 index cebc65e..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/translation/Dumper/DumperInterface.php +++ /dev/null @@ -1,31 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Dumper; - -use Symfony\Component\Translation\MessageCatalogue; - -/** - * DumperInterface is the interface implemented by all translation dumpers. - * There is no common option. - * - * @author Michel Salib - */ -interface DumperInterface -{ - /** - * Dumps the message catalogue. - * - * @param MessageCatalogue $messages The message catalogue - * @param array $options Options that are used by the dumper - */ - public function dump(MessageCatalogue $messages, $options = array()); -} diff --git a/sitecake/2.2.9/server/vendor/symfony/translation/Dumper/FileDumper.php b/sitecake/2.2.9/server/vendor/symfony/translation/Dumper/FileDumper.php deleted file mode 100644 index f2f17d6..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/translation/Dumper/FileDumper.php +++ /dev/null @@ -1,122 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Dumper; - -use Symfony\Component\Translation\MessageCatalogue; - -/** - * FileDumper is an implementation of DumperInterface that dump a message catalogue to file(s). - * Performs backup of already existing files. - * - * Options: - * - path (mandatory): the directory where the files should be saved - * - * @author Michel Salib - */ -abstract class FileDumper implements DumperInterface -{ - /** - * A template for the relative paths to files. - * - * @var string - */ - protected $relativePathTemplate = '%domain%.%locale%.%extension%'; - - /** - * Make file backup before the dump. - * - * @var bool - */ - private $backup = true; - - /** - * Sets the template for the relative paths to files. - * - * @param string $relativePathTemplate A template for the relative paths to files - */ - public function setRelativePathTemplate($relativePathTemplate) - { - $this->relativePathTemplate = $relativePathTemplate; - } - - /** - * Sets backup flag. - * - * @param bool - */ - public function setBackup($backup) - { - $this->backup = $backup; - } - - /** - * {@inheritdoc} - */ - public function dump(MessageCatalogue $messages, $options = array()) - { - if (!array_key_exists('path', $options)) { - throw new \InvalidArgumentException('The file dumper needs a path option.'); - } - - // save a file for each domain - foreach ($messages->getDomains() as $domain) { - // backup - $fullpath = $options['path'].'/'.$this->getRelativePath($domain, $messages->getLocale()); - if (file_exists($fullpath)) { - if ($this->backup) { - copy($fullpath, $fullpath.'~'); - } - } else { - $directory = dirname($fullpath); - if (!file_exists($directory) && !@mkdir($directory, 0777, true)) { - throw new \RuntimeException(sprintf('Unable to create directory "%s".', $directory)); - } - } - // save file - file_put_contents($fullpath, $this->format($messages, $domain)); - } - } - - /** - * Transforms a domain of a message catalogue to its string representation. - * - * @param MessageCatalogue $messages - * @param string $domain - * - * @return string representation - */ - abstract protected function format(MessageCatalogue $messages, $domain); - - /** - * Gets the file extension of the dumper. - * - * @return string file extension - */ - abstract protected function getExtension(); - - /** - * Gets the relative file path using the template. - * - * @param string $domain The domain - * @param string $locale The locale - * - * @return string The relative file path - */ - private function getRelativePath($domain, $locale) - { - return strtr($this->relativePathTemplate, array( - '%domain%' => $domain, - '%locale%' => $locale, - '%extension%' => $this->getExtension(), - )); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/translation/Dumper/IcuResFileDumper.php b/sitecake/2.2.9/server/vendor/symfony/translation/Dumper/IcuResFileDumper.php deleted file mode 100644 index 0a2ed9f..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/translation/Dumper/IcuResFileDumper.php +++ /dev/null @@ -1,112 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Dumper; - -use Symfony\Component\Translation\MessageCatalogue; - -/** - * IcuResDumper generates an ICU ResourceBundle formatted string representation of a message catalogue. - * - * @author Stealth35 - */ -class IcuResFileDumper extends FileDumper -{ - /** - * {@inheritdoc} - */ - protected $relativePathTemplate = '%domain%/%locale%.%extension%'; - - /** - * {@inheritdoc} - */ - public function format(MessageCatalogue $messages, $domain = 'messages') - { - $data = $indexes = $resources = ''; - - foreach ($messages->all($domain) as $source => $target) { - $indexes .= pack('v', strlen($data) + 28); - $data .= $source."\0"; - } - - $data .= $this->writePadding($data); - - $keyTop = $this->getPosition($data); - - foreach ($messages->all($domain) as $source => $target) { - $resources .= pack('V', $this->getPosition($data)); - - $data .= pack('V', strlen($target)) - .mb_convert_encoding($target."\0", 'UTF-16LE', 'UTF-8') - .$this->writePadding($data) - ; - } - - $resOffset = $this->getPosition($data); - - $data .= pack('v', count($messages)) - .$indexes - .$this->writePadding($data) - .$resources - ; - - $bundleTop = $this->getPosition($data); - - $root = pack('V7', - $resOffset + (2 << 28), // Resource Offset + Resource Type - 6, // Index length - $keyTop, // Index keys top - $bundleTop, // Index resources top - $bundleTop, // Index bundle top - count($messages), // Index max table length - 0 // Index attributes - ); - - $header = pack('vC2v4C12@32', - 32, // Header size - 0xDA, 0x27, // Magic number 1 and 2 - 20, 0, 0, 2, // Rest of the header, ..., Size of a char - 0x52, 0x65, 0x73, 0x42, // Data format identifier - 1, 2, 0, 0, // Data version - 1, 4, 0, 0 // Unicode version - ); - - $output = $header - .$root - .$data; - - return $output; - } - - private function writePadding($data) - { - $padding = strlen($data) % 4; - - if ($padding) { - return str_repeat("\xAA", 4 - $padding); - } - } - - private function getPosition($data) - { - $position = (strlen($data) + 28) / 4; - - return $position; - } - - /** - * {@inheritdoc} - */ - protected function getExtension() - { - return 'res'; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/translation/Dumper/IniFileDumper.php b/sitecake/2.2.9/server/vendor/symfony/translation/Dumper/IniFileDumper.php deleted file mode 100644 index 45df389..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/translation/Dumper/IniFileDumper.php +++ /dev/null @@ -1,45 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Dumper; - -use Symfony\Component\Translation\MessageCatalogue; - -/** - * IniFileDumper generates an ini formatted string representation of a message catalogue. - * - * @author Stealth35 - */ -class IniFileDumper extends FileDumper -{ - /** - * {@inheritdoc} - */ - public function format(MessageCatalogue $messages, $domain = 'messages') - { - $output = ''; - - foreach ($messages->all($domain) as $source => $target) { - $escapeTarget = str_replace('"', '\"', $target); - $output .= $source.'="'.$escapeTarget."\"\n"; - } - - return $output; - } - - /** - * {@inheritdoc} - */ - protected function getExtension() - { - return 'ini'; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/translation/Dumper/JsonFileDumper.php b/sitecake/2.2.9/server/vendor/symfony/translation/Dumper/JsonFileDumper.php deleted file mode 100644 index 7ad3518..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/translation/Dumper/JsonFileDumper.php +++ /dev/null @@ -1,38 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Dumper; - -use Symfony\Component\Translation\MessageCatalogue; - -/** - * JsonFileDumper generates an json formatted string representation of a message catalogue. - * - * @author singles - */ -class JsonFileDumper extends FileDumper -{ - /** - * {@inheritdoc} - */ - public function format(MessageCatalogue $messages, $domain = 'messages') - { - return json_encode($messages->all($domain), defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT : 0); - } - - /** - * {@inheritdoc} - */ - protected function getExtension() - { - return 'json'; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/translation/Dumper/MoFileDumper.php b/sitecake/2.2.9/server/vendor/symfony/translation/Dumper/MoFileDumper.php deleted file mode 100644 index f8dc6ac..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/translation/Dumper/MoFileDumper.php +++ /dev/null @@ -1,82 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Dumper; - -use Symfony\Component\Translation\MessageCatalogue; -use Symfony\Component\Translation\Loader\MoFileLoader; - -/** - * MoFileDumper generates a gettext formatted string representation of a message catalogue. - * - * @author Stealth35 - */ -class MoFileDumper extends FileDumper -{ - /** - * {@inheritdoc} - */ - public function format(MessageCatalogue $messages, $domain = 'messages') - { - $output = $sources = $targets = $sourceOffsets = $targetOffsets = ''; - $offsets = array(); - $size = 0; - - foreach ($messages->all($domain) as $source => $target) { - $offsets[] = array_map('strlen', array($sources, $source, $targets, $target)); - $sources .= "\0".$source; - $targets .= "\0".$target; - ++$size; - } - - $header = array( - 'magicNumber' => MoFileLoader::MO_LITTLE_ENDIAN_MAGIC, - 'formatRevision' => 0, - 'count' => $size, - 'offsetId' => MoFileLoader::MO_HEADER_SIZE, - 'offsetTranslated' => MoFileLoader::MO_HEADER_SIZE + (8 * $size), - 'sizeHashes' => 0, - 'offsetHashes' => MoFileLoader::MO_HEADER_SIZE + (16 * $size), - ); - - $sourcesSize = strlen($sources); - $sourcesStart = $header['offsetHashes'] + 1; - - foreach ($offsets as $offset) { - $sourceOffsets .= $this->writeLong($offset[1]) - .$this->writeLong($offset[0] + $sourcesStart); - $targetOffsets .= $this->writeLong($offset[3]) - .$this->writeLong($offset[2] + $sourcesStart + $sourcesSize); - } - - $output = implode(array_map(array($this, 'writeLong'), $header)) - .$sourceOffsets - .$targetOffsets - .$sources - .$targets - ; - - return $output; - } - - /** - * {@inheritdoc} - */ - protected function getExtension() - { - return 'mo'; - } - - private function writeLong($str) - { - return pack('V*', $str); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/translation/Dumper/PhpFileDumper.php b/sitecake/2.2.9/server/vendor/symfony/translation/Dumper/PhpFileDumper.php deleted file mode 100644 index b354c12..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/translation/Dumper/PhpFileDumper.php +++ /dev/null @@ -1,40 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Dumper; - -use Symfony\Component\Translation\MessageCatalogue; - -/** - * PhpFileDumper generates PHP files from a message catalogue. - * - * @author Michel Salib - */ -class PhpFileDumper extends FileDumper -{ - /** - * {@inheritdoc} - */ - protected function format(MessageCatalogue $messages, $domain) - { - $output = "all($domain), true).";\n"; - - return $output; - } - - /** - * {@inheritdoc} - */ - protected function getExtension() - { - return 'php'; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/translation/Dumper/PoFileDumper.php b/sitecake/2.2.9/server/vendor/symfony/translation/Dumper/PoFileDumper.php deleted file mode 100644 index 983064b..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/translation/Dumper/PoFileDumper.php +++ /dev/null @@ -1,61 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Dumper; - -use Symfony\Component\Translation\MessageCatalogue; - -/** - * PoFileDumper generates a gettext formatted string representation of a message catalogue. - * - * @author Stealth35 - */ -class PoFileDumper extends FileDumper -{ - /** - * {@inheritdoc} - */ - public function format(MessageCatalogue $messages, $domain = 'messages') - { - $output = 'msgid ""'."\n"; - $output .= 'msgstr ""'."\n"; - $output .= '"Content-Type: text/plain; charset=UTF-8\n"'."\n"; - $output .= '"Content-Transfer-Encoding: 8bit\n"'."\n"; - $output .= '"Language: '.$messages->getLocale().'\n"'."\n"; - $output .= "\n"; - - $newLine = false; - foreach ($messages->all($domain) as $source => $target) { - if ($newLine) { - $output .= "\n"; - } else { - $newLine = true; - } - $output .= sprintf('msgid "%s"'."\n", $this->escape($source)); - $output .= sprintf('msgstr "%s"', $this->escape($target)); - } - - return $output; - } - - /** - * {@inheritdoc} - */ - protected function getExtension() - { - return 'po'; - } - - private function escape($str) - { - return addcslashes($str, "\0..\37\42\134"); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/translation/Dumper/QtFileDumper.php b/sitecake/2.2.9/server/vendor/symfony/translation/Dumper/QtFileDumper.php deleted file mode 100644 index 42aa093..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/translation/Dumper/QtFileDumper.php +++ /dev/null @@ -1,50 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Dumper; - -use Symfony\Component\Translation\MessageCatalogue; - -/** - * QtFileDumper generates ts files from a message catalogue. - * - * @author Benjamin Eberlei - */ -class QtFileDumper extends FileDumper -{ - /** - * {@inheritdoc} - */ - public function format(MessageCatalogue $messages, $domain) - { - $dom = new \DOMDocument('1.0', 'utf-8'); - $dom->formatOutput = true; - $ts = $dom->appendChild($dom->createElement('TS')); - $context = $ts->appendChild($dom->createElement('context')); - $context->appendChild($dom->createElement('name', $domain)); - - foreach ($messages->all($domain) as $source => $target) { - $message = $context->appendChild($dom->createElement('message')); - $message->appendChild($dom->createElement('source', $source)); - $message->appendChild($dom->createElement('translation', $target)); - } - - return $dom->saveXML(); - } - - /** - * {@inheritdoc} - */ - protected function getExtension() - { - return 'ts'; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/translation/Dumper/XliffFileDumper.php b/sitecake/2.2.9/server/vendor/symfony/translation/Dumper/XliffFileDumper.php deleted file mode 100644 index 58d1973..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/translation/Dumper/XliffFileDumper.php +++ /dev/null @@ -1,109 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Dumper; - -use Symfony\Component\Translation\MessageCatalogue; - -/** - * XliffFileDumper generates xliff files from a message catalogue. - * - * @author Michel Salib - */ -class XliffFileDumper extends FileDumper -{ - /** - * @var string - */ - private $defaultLocale; - - /** - * {@inheritdoc} - */ - public function dump(MessageCatalogue $messages, $options = array()) - { - if (array_key_exists('default_locale', $options)) { - $this->defaultLocale = $options['default_locale']; - } else { - $this->defaultLocale = \Locale::getDefault(); - } - - parent::dump($messages, $options); - } - - /** - * {@inheritdoc} - */ - protected function format(MessageCatalogue $messages, $domain) - { - $dom = new \DOMDocument('1.0', 'utf-8'); - $dom->formatOutput = true; - - $xliff = $dom->appendChild($dom->createElement('xliff')); - $xliff->setAttribute('version', '1.2'); - $xliff->setAttribute('xmlns', 'urn:oasis:names:tc:xliff:document:1.2'); - - $xliffFile = $xliff->appendChild($dom->createElement('file')); - $xliffFile->setAttribute('source-language', str_replace('_', '-', $this->defaultLocale)); - $xliffFile->setAttribute('target-language', str_replace('_', '-', $messages->getLocale())); - $xliffFile->setAttribute('datatype', 'plaintext'); - $xliffFile->setAttribute('original', 'file.ext'); - - $xliffBody = $xliffFile->appendChild($dom->createElement('body')); - foreach ($messages->all($domain) as $source => $target) { - $translation = $dom->createElement('trans-unit'); - - $translation->setAttribute('id', md5($source)); - $translation->setAttribute('resname', $source); - - $s = $translation->appendChild($dom->createElement('source')); - $s->appendChild($dom->createTextNode($source)); - - // Does the target contain characters requiring a CDATA section? - $text = 1 === preg_match('/[&<>]/', $target) ? $dom->createCDATASection($target) : $dom->createTextNode($target); - - $t = $translation->appendChild($dom->createElement('target')); - $t->appendChild($text); - - $metadata = $messages->getMetadata($source, $domain); - if (null !== $metadata && array_key_exists('notes', $metadata) && is_array($metadata['notes'])) { - foreach ($metadata['notes'] as $note) { - if (!isset($note['content'])) { - continue; - } - - $n = $translation->appendChild($dom->createElement('note')); - $n->appendChild($dom->createTextNode($note['content'])); - - if (isset($note['priority'])) { - $n->setAttribute('priority', $note['priority']); - } - - if (isset($note['from'])) { - $n->setAttribute('from', $note['from']); - } - } - } - - $xliffBody->appendChild($translation); - } - - return $dom->saveXML(); - } - - /** - * {@inheritdoc} - */ - protected function getExtension() - { - return 'xlf'; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/translation/Dumper/YamlFileDumper.php b/sitecake/2.2.9/server/vendor/symfony/translation/Dumper/YamlFileDumper.php deleted file mode 100644 index 870fb98..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/translation/Dumper/YamlFileDumper.php +++ /dev/null @@ -1,43 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Dumper; - -use Symfony\Component\Translation\MessageCatalogue; -use Symfony\Component\Yaml\Yaml; - -/** - * YamlFileDumper generates yaml files from a message catalogue. - * - * @author Michel Salib - */ -class YamlFileDumper extends FileDumper -{ - /** - * {@inheritdoc} - */ - protected function format(MessageCatalogue $messages, $domain) - { - if (!class_exists('Symfony\Component\Yaml\Yaml')) { - throw new \LogicException('Dumping translations in the YAML format requires the Symfony Yaml component.'); - } - - return Yaml::dump($messages->all($domain)); - } - - /** - * {@inheritdoc} - */ - protected function getExtension() - { - return 'yml'; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/translation/Exception/ExceptionInterface.php b/sitecake/2.2.9/server/vendor/symfony/translation/Exception/ExceptionInterface.php deleted file mode 100644 index 7757e66..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/translation/Exception/ExceptionInterface.php +++ /dev/null @@ -1,23 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Exception; - -/** - * Exception interface for all exceptions thrown by the component. - * - * @author Fabien Potencier - * - * @api - */ -interface ExceptionInterface -{ -} diff --git a/sitecake/2.2.9/server/vendor/symfony/translation/Exception/InvalidResourceException.php b/sitecake/2.2.9/server/vendor/symfony/translation/Exception/InvalidResourceException.php deleted file mode 100644 index 6413f1a..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/translation/Exception/InvalidResourceException.php +++ /dev/null @@ -1,23 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Exception; - -/** - * Thrown when a resource cannot be loaded. - * - * @author Fabien Potencier - * - * @api - */ -class InvalidResourceException extends \InvalidArgumentException implements ExceptionInterface -{ -} diff --git a/sitecake/2.2.9/server/vendor/symfony/translation/Exception/NotFoundResourceException.php b/sitecake/2.2.9/server/vendor/symfony/translation/Exception/NotFoundResourceException.php deleted file mode 100644 index 7826e5c..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/translation/Exception/NotFoundResourceException.php +++ /dev/null @@ -1,23 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Exception; - -/** - * Thrown when a resource does not exist. - * - * @author Fabien Potencier - * - * @api - */ -class NotFoundResourceException extends \InvalidArgumentException implements ExceptionInterface -{ -} diff --git a/sitecake/2.2.9/server/vendor/symfony/translation/Extractor/AbstractFileExtractor.php b/sitecake/2.2.9/server/vendor/symfony/translation/Extractor/AbstractFileExtractor.php deleted file mode 100644 index 196bc33..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/translation/Extractor/AbstractFileExtractor.php +++ /dev/null @@ -1,83 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Extractor; - -/** - * Base class used by classes that extract translation messages from files. - * - * @author Marcos D. Sánchez - */ -abstract class AbstractFileExtractor -{ - /** - * @param string|array $resource files, a file or a directory - * - * @return array - */ - protected function extractFiles($resource) - { - if (is_array($resource) || $resource instanceof \Traversable) { - $files = array(); - foreach ($resource as $file) { - if ($this->canBeExtracted($file)) { - $files[] = $this->toSplFileInfo($file); - } - } - } elseif (is_file($resource)) { - $files = $this->canBeExtracted($resource) ? array($this->toSplFileInfo($resource)) : array(); - } else { - $files = $this->extractFromDirectory($resource); - } - - return $files; - } - - /** - * @param string $file - * - * @return \SplFileInfo - */ - private function toSplFileInfo($file) - { - return ($file instanceof \SplFileInfo) ? $file : new \SplFileInfo($file); - } - - /** - * @param string $file - * - * @throws \InvalidArgumentException - * - * @return bool - */ - protected function isFile($file) - { - if (!is_file($file)) { - throw new \InvalidArgumentException(sprintf('The "%s" file does not exist.', $file)); - } - - return true; - } - - /** - * @param string $file - * - * @return bool - */ - abstract protected function canBeExtracted($file); - - /** - * @param string|array $resource files, a file or a directory - * - * @return array files to be extracted - */ - abstract protected function extractFromDirectory($resource); -} diff --git a/sitecake/2.2.9/server/vendor/symfony/translation/Extractor/ChainExtractor.php b/sitecake/2.2.9/server/vendor/symfony/translation/Extractor/ChainExtractor.php deleted file mode 100644 index 50e3c84..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/translation/Extractor/ChainExtractor.php +++ /dev/null @@ -1,60 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Extractor; - -use Symfony\Component\Translation\MessageCatalogue; - -/** - * ChainExtractor extracts translation messages from template files. - * - * @author Michel Salib - */ -class ChainExtractor implements ExtractorInterface -{ - /** - * The extractors. - * - * @var ExtractorInterface[] - */ - private $extractors = array(); - - /** - * Adds a loader to the translation extractor. - * - * @param string $format The format of the loader - * @param ExtractorInterface $extractor The loader - */ - public function addExtractor($format, ExtractorInterface $extractor) - { - $this->extractors[$format] = $extractor; - } - - /** - * {@inheritdoc} - */ - public function setPrefix($prefix) - { - foreach ($this->extractors as $extractor) { - $extractor->setPrefix($prefix); - } - } - - /** - * {@inheritdoc} - */ - public function extract($directory, MessageCatalogue $catalogue) - { - foreach ($this->extractors as $extractor) { - $extractor->extract($directory, $catalogue); - } - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/translation/Extractor/ExtractorInterface.php b/sitecake/2.2.9/server/vendor/symfony/translation/Extractor/ExtractorInterface.php deleted file mode 100644 index 438f80b..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/translation/Extractor/ExtractorInterface.php +++ /dev/null @@ -1,38 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Extractor; - -use Symfony\Component\Translation\MessageCatalogue; - -/** - * Extracts translation messages from a directory or files to the catalogue. - * New found messages are injected to the catalogue using the prefix. - * - * @author Michel Salib - */ -interface ExtractorInterface -{ - /** - * Extracts translation messages from files, a file or a directory to the catalogue. - * - * @param string|array $resource files, a file or a directory - * @param MessageCatalogue $catalogue The catalogue - */ - public function extract($resource, MessageCatalogue $catalogue); - - /** - * Sets the prefix that should be used for new found messages. - * - * @param string $prefix The prefix - */ - public function setPrefix($prefix); -} diff --git a/sitecake/2.2.9/server/vendor/symfony/translation/IdentityTranslator.php b/sitecake/2.2.9/server/vendor/symfony/translation/IdentityTranslator.php deleted file mode 100644 index 9c9212e..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/translation/IdentityTranslator.php +++ /dev/null @@ -1,77 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation; - -/** - * IdentityTranslator does not translate anything. - * - * @author Fabien Potencier - * - * @api - */ -class IdentityTranslator implements TranslatorInterface -{ - private $selector; - private $locale; - - /** - * Constructor. - * - * @param MessageSelector|null $selector The message selector for pluralization - * - * @api - */ - public function __construct(MessageSelector $selector = null) - { - $this->selector = $selector ?: new MessageSelector(); - } - - /** - * {@inheritdoc} - * - * @api - */ - public function setLocale($locale) - { - $this->locale = $locale; - } - - /** - * {@inheritdoc} - * - * @api - */ - public function getLocale() - { - return $this->locale ?: \Locale::getDefault(); - } - - /** - * {@inheritdoc} - * - * @api - */ - public function trans($id, array $parameters = array(), $domain = null, $locale = null) - { - return strtr((string) $id, $parameters); - } - - /** - * {@inheritdoc} - * - * @api - */ - public function transChoice($id, $number, array $parameters = array(), $domain = null, $locale = null) - { - return strtr($this->selector->choose((string) $id, (int) $number, $locale ?: $this->getLocale()), $parameters); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/translation/Interval.php b/sitecake/2.2.9/server/vendor/symfony/translation/Interval.php deleted file mode 100644 index 2a51156..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/translation/Interval.php +++ /dev/null @@ -1,107 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation; - -/** - * Tests if a given number belongs to a given math interval. - * - * An interval can represent a finite set of numbers: - * - * {1,2,3,4} - * - * An interval can represent numbers between two numbers: - * - * [1, +Inf] - * ]-1,2[ - * - * The left delimiter can be [ (inclusive) or ] (exclusive). - * The right delimiter can be [ (exclusive) or ] (inclusive). - * Beside numbers, you can use -Inf and +Inf for the infinite. - * - * @author Fabien Potencier - * - * @see http://en.wikipedia.org/wiki/Interval_%28mathematics%29#The_ISO_notation - */ -class Interval -{ - /** - * Tests if the given number is in the math interval. - * - * @param int $number A number - * @param string $interval An interval - * - * @return bool - * - * @throws \InvalidArgumentException - */ - public static function test($number, $interval) - { - $interval = trim($interval); - - if (!preg_match('/^'.self::getIntervalRegexp().'$/x', $interval, $matches)) { - throw new \InvalidArgumentException(sprintf('"%s" is not a valid interval.', $interval)); - } - - if ($matches[1]) { - foreach (explode(',', $matches[2]) as $n) { - if ($number == $n) { - return true; - } - } - } else { - $leftNumber = self::convertNumber($matches['left']); - $rightNumber = self::convertNumber($matches['right']); - - return - ('[' === $matches['left_delimiter'] ? $number >= $leftNumber : $number > $leftNumber) - && (']' === $matches['right_delimiter'] ? $number <= $rightNumber : $number < $rightNumber) - ; - } - - return false; - } - - /** - * Returns a Regexp that matches valid intervals. - * - * @return string A Regexp (without the delimiters) - */ - public static function getIntervalRegexp() - { - return <<[\[\]]) - \s* - (?P-Inf|\-?\d+(\.\d+)?) - \s*,\s* - (?P\+?Inf|\-?\d+(\.\d+)?) - \s* - (?P[\[\]]) -EOF; - } - - private static function convertNumber($number) - { - if ('-Inf' === $number) { - return log(0); - } elseif ('+Inf' === $number || 'Inf' === $number) { - return -log(0); - } - - return (float) $number; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/translation/LICENSE b/sitecake/2.2.9/server/vendor/symfony/translation/LICENSE deleted file mode 100644 index 43028bc..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/translation/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2004-2015 Fabien Potencier - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/sitecake/2.2.9/server/vendor/symfony/translation/Loader/ArrayLoader.php b/sitecake/2.2.9/server/vendor/symfony/translation/Loader/ArrayLoader.php deleted file mode 100644 index 68ba81d..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/translation/Loader/ArrayLoader.php +++ /dev/null @@ -1,70 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Loader; - -use Symfony\Component\Translation\MessageCatalogue; - -/** - * ArrayLoader loads translations from a PHP array. - * - * @author Fabien Potencier - * - * @api - */ -class ArrayLoader implements LoaderInterface -{ - /** - * {@inheritdoc} - * - * @api - */ - public function load($resource, $locale, $domain = 'messages') - { - $this->flatten($resource); - $catalogue = new MessageCatalogue($locale); - $catalogue->add($resource, $domain); - - return $catalogue; - } - - /** - * Flattens an nested array of translations. - * - * The scheme used is: - * 'key' => array('key2' => array('key3' => 'value')) - * Becomes: - * 'key.key2.key3' => 'value' - * - * This function takes an array by reference and will modify it - * - * @param array &$messages The array that will be flattened - * @param array $subnode Current subnode being parsed, used internally for recursive calls - * @param string $path Current path being parsed, used internally for recursive calls - */ - private function flatten(array &$messages, array $subnode = null, $path = null) - { - if (null === $subnode) { - $subnode = &$messages; - } - foreach ($subnode as $key => $value) { - if (is_array($value)) { - $nodePath = $path ? $path.'.'.$key : $key; - $this->flatten($messages, $value, $nodePath); - if (null === $path) { - unset($messages[$key]); - } - } elseif (null !== $path) { - $messages[$path.'.'.$key] = $value; - } - } - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/translation/Loader/CsvFileLoader.php b/sitecake/2.2.9/server/vendor/symfony/translation/Loader/CsvFileLoader.php deleted file mode 100644 index fc92760..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/translation/Loader/CsvFileLoader.php +++ /dev/null @@ -1,95 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Loader; - -use Symfony\Component\Translation\Exception\InvalidResourceException; -use Symfony\Component\Translation\Exception\NotFoundResourceException; -use Symfony\Component\Config\Resource\FileResource; - -/** - * CsvFileLoader loads translations from CSV files. - * - * @author Saša Stamenković - * - * @api - */ -class CsvFileLoader extends ArrayLoader -{ - private $delimiter = ';'; - private $enclosure = '"'; - private $escape = '\\'; - - /** - * {@inheritdoc} - * - * @api - */ - public function load($resource, $locale, $domain = 'messages') - { - if (!stream_is_local($resource)) { - throw new InvalidResourceException(sprintf('This is not a local file "%s".', $resource)); - } - - if (!file_exists($resource)) { - throw new NotFoundResourceException(sprintf('File "%s" not found.', $resource)); - } - - $messages = array(); - - try { - $file = new \SplFileObject($resource, 'rb'); - } catch (\RuntimeException $e) { - throw new NotFoundResourceException(sprintf('Error opening file "%s".', $resource), 0, $e); - } - - $file->setFlags(\SplFileObject::READ_CSV | \SplFileObject::SKIP_EMPTY); - $file->setCsvControl($this->delimiter, $this->enclosure, $this->escape); - - foreach ($file as $data) { - if (substr($data[0], 0, 1) === '#') { - continue; - } - - if (!isset($data[1])) { - continue; - } - - if (count($data) == 2) { - $messages[$data[0]] = $data[1]; - } else { - continue; - } - } - - $catalogue = parent::load($messages, $locale, $domain); - - if (class_exists('Symfony\Component\Config\Resource\FileResource')) { - $catalogue->addResource(new FileResource($resource)); - } - - return $catalogue; - } - - /** - * Sets the delimiter, enclosure, and escape character for CSV. - * - * @param string $delimiter delimiter character - * @param string $enclosure enclosure character - * @param string $escape escape character - */ - public function setCsvControl($delimiter = ';', $enclosure = '"', $escape = '\\') - { - $this->delimiter = $delimiter; - $this->enclosure = $enclosure; - $this->escape = $escape; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/translation/Loader/IcuDatFileLoader.php b/sitecake/2.2.9/server/vendor/symfony/translation/Loader/IcuDatFileLoader.php deleted file mode 100644 index 71ba90a..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/translation/Loader/IcuDatFileLoader.php +++ /dev/null @@ -1,62 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Loader; - -use Symfony\Component\Translation\MessageCatalogue; -use Symfony\Component\Translation\Exception\InvalidResourceException; -use Symfony\Component\Translation\Exception\NotFoundResourceException; -use Symfony\Component\Config\Resource\FileResource; - -/** - * IcuResFileLoader loads translations from a resource bundle. - * - * @author stealth35 - */ -class IcuDatFileLoader extends IcuResFileLoader -{ - /** - * {@inheritdoc} - */ - public function load($resource, $locale, $domain = 'messages') - { - if (!stream_is_local($resource.'.dat')) { - throw new InvalidResourceException(sprintf('This is not a local file "%s".', $resource)); - } - - if (!file_exists($resource.'.dat')) { - throw new NotFoundResourceException(sprintf('File "%s" not found.', $resource)); - } - - try { - $rb = new \ResourceBundle($locale, $resource); - } catch (\Exception $e) { - // HHVM compatibility: constructor throws on invalid resource - $rb = null; - } - - if (!$rb) { - throw new InvalidResourceException(sprintf('Cannot load resource "%s"', $resource)); - } elseif (intl_is_failure($rb->getErrorCode())) { - throw new InvalidResourceException($rb->getErrorMessage(), $rb->getErrorCode()); - } - - $messages = $this->flatten($rb); - $catalogue = new MessageCatalogue($locale); - $catalogue->add($messages, $domain); - - if (class_exists('Symfony\Component\Config\Resource\FileResource')) { - $catalogue->addResource(new FileResource($resource.'.dat')); - } - - return $catalogue; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/translation/Loader/IcuResFileLoader.php b/sitecake/2.2.9/server/vendor/symfony/translation/Loader/IcuResFileLoader.php deleted file mode 100644 index 2f8037f..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/translation/Loader/IcuResFileLoader.php +++ /dev/null @@ -1,92 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Loader; - -use Symfony\Component\Translation\MessageCatalogue; -use Symfony\Component\Translation\Exception\InvalidResourceException; -use Symfony\Component\Translation\Exception\NotFoundResourceException; -use Symfony\Component\Config\Resource\DirectoryResource; - -/** - * IcuResFileLoader loads translations from a resource bundle. - * - * @author stealth35 - */ -class IcuResFileLoader implements LoaderInterface -{ - /** - * {@inheritdoc} - */ - public function load($resource, $locale, $domain = 'messages') - { - if (!stream_is_local($resource)) { - throw new InvalidResourceException(sprintf('This is not a local file "%s".', $resource)); - } - - if (!is_dir($resource)) { - throw new NotFoundResourceException(sprintf('File "%s" not found.', $resource)); - } - - try { - $rb = new \ResourceBundle($locale, $resource); - } catch (\Exception $e) { - // HHVM compatibility: constructor throws on invalid resource - $rb = null; - } - - if (!$rb) { - throw new InvalidResourceException(sprintf('Cannot load resource "%s"', $resource)); - } elseif (intl_is_failure($rb->getErrorCode())) { - throw new InvalidResourceException($rb->getErrorMessage(), $rb->getErrorCode()); - } - - $messages = $this->flatten($rb); - $catalogue = new MessageCatalogue($locale); - $catalogue->add($messages, $domain); - - if (class_exists('Symfony\Component\Config\Resource\DirectoryResource')) { - $catalogue->addResource(new DirectoryResource($resource)); - } - - return $catalogue; - } - - /** - * Flattens an ResourceBundle. - * - * The scheme used is: - * key { key2 { key3 { "value" } } } - * Becomes: - * 'key.key2.key3' => 'value' - * - * This function takes an array by reference and will modify it - * - * @param \ResourceBundle $rb the ResourceBundle that will be flattened - * @param array $messages used internally for recursive calls - * @param string $path current path being parsed, used internally for recursive calls - * - * @return array the flattened ResourceBundle - */ - protected function flatten(\ResourceBundle $rb, array &$messages = array(), $path = null) - { - foreach ($rb as $key => $value) { - $nodePath = $path ? $path.'.'.$key : $key; - if ($value instanceof \ResourceBundle) { - $this->flatten($value, $messages, $nodePath); - } else { - $messages[$nodePath] = $value; - } - } - - return $messages; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/translation/Loader/IniFileLoader.php b/sitecake/2.2.9/server/vendor/symfony/translation/Loader/IniFileLoader.php deleted file mode 100644 index 1b3a7b1..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/translation/Loader/IniFileLoader.php +++ /dev/null @@ -1,48 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Loader; - -use Symfony\Component\Translation\Exception\InvalidResourceException; -use Symfony\Component\Translation\Exception\NotFoundResourceException; -use Symfony\Component\Config\Resource\FileResource; - -/** - * IniFileLoader loads translations from an ini file. - * - * @author stealth35 - */ -class IniFileLoader extends ArrayLoader -{ - /** - * {@inheritdoc} - */ - public function load($resource, $locale, $domain = 'messages') - { - if (!stream_is_local($resource)) { - throw new InvalidResourceException(sprintf('This is not a local file "%s".', $resource)); - } - - if (!file_exists($resource)) { - throw new NotFoundResourceException(sprintf('File "%s" not found.', $resource)); - } - - $messages = parse_ini_file($resource, true); - - $catalogue = parent::load($messages, $locale, $domain); - - if (class_exists('Symfony\Component\Config\Resource\FileResource')) { - $catalogue->addResource(new FileResource($resource)); - } - - return $catalogue; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/translation/Loader/JsonFileLoader.php b/sitecake/2.2.9/server/vendor/symfony/translation/Loader/JsonFileLoader.php deleted file mode 100644 index 0913883..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/translation/Loader/JsonFileLoader.php +++ /dev/null @@ -1,81 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Loader; - -use Symfony\Component\Translation\Exception\InvalidResourceException; -use Symfony\Component\Translation\Exception\NotFoundResourceException; -use Symfony\Component\Config\Resource\FileResource; - -/** - * JsonFileLoader loads translations from an json file. - * - * @author singles - */ -class JsonFileLoader extends ArrayLoader implements LoaderInterface -{ - /** - * {@inheritdoc} - */ - public function load($resource, $locale, $domain = 'messages') - { - if (!stream_is_local($resource)) { - throw new InvalidResourceException(sprintf('This is not a local file "%s".', $resource)); - } - - if (!file_exists($resource)) { - throw new NotFoundResourceException(sprintf('File "%s" not found.', $resource)); - } - - $messages = array(); - if ($data = file_get_contents($resource)) { - $messages = json_decode($data, true); - - if (0 < $errorCode = json_last_error()) { - throw new InvalidResourceException(sprintf('Error parsing JSON - %s', $this->getJSONErrorMessage($errorCode))); - } - } - - if (null === $messages) { - $messages = array(); - } - - $catalogue = parent::load($messages, $locale, $domain); - $catalogue->addResource(new FileResource($resource)); - - return $catalogue; - } - - /** - * Translates JSON_ERROR_* constant into meaningful message. - * - * @param int $errorCode Error code returned by json_last_error() call - * - * @return string Message string - */ - private function getJSONErrorMessage($errorCode) - { - switch ($errorCode) { - case JSON_ERROR_DEPTH: - return 'Maximum stack depth exceeded'; - case JSON_ERROR_STATE_MISMATCH: - return 'Underflow or the modes mismatch'; - case JSON_ERROR_CTRL_CHAR: - return 'Unexpected control character found'; - case JSON_ERROR_SYNTAX: - return 'Syntax error, malformed JSON'; - case JSON_ERROR_UTF8: - return 'Malformed UTF-8 characters, possibly incorrectly encoded'; - default: - return 'Unknown error'; - } - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/translation/Loader/LoaderInterface.php b/sitecake/2.2.9/server/vendor/symfony/translation/Loader/LoaderInterface.php deleted file mode 100644 index 0b28e14..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/translation/Loader/LoaderInterface.php +++ /dev/null @@ -1,42 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Loader; - -use Symfony\Component\Translation\MessageCatalogue; -use Symfony\Component\Translation\Exception\InvalidResourceException; -use Symfony\Component\Translation\Exception\NotFoundResourceException; - -/** - * LoaderInterface is the interface implemented by all translation loaders. - * - * @author Fabien Potencier - * - * @api - */ -interface LoaderInterface -{ - /** - * Loads a locale. - * - * @param mixed $resource A resource - * @param string $locale A locale - * @param string $domain The domain - * - * @return MessageCatalogue A MessageCatalogue instance - * - * @api - * - * @throws NotFoundResourceException when the resource cannot be found - * @throws InvalidResourceException when the resource cannot be loaded - */ - public function load($resource, $locale, $domain = 'messages'); -} diff --git a/sitecake/2.2.9/server/vendor/symfony/translation/Loader/MoFileLoader.php b/sitecake/2.2.9/server/vendor/symfony/translation/Loader/MoFileLoader.php deleted file mode 100644 index 746fd52..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/translation/Loader/MoFileLoader.php +++ /dev/null @@ -1,191 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Loader; - -use Symfony\Component\Translation\Exception\InvalidResourceException; -use Symfony\Component\Translation\Exception\NotFoundResourceException; -use Symfony\Component\Config\Resource\FileResource; - -/** - * @copyright Copyright (c) 2010, Union of RAD http://union-of-rad.org (http://lithify.me/) - */ -class MoFileLoader extends ArrayLoader -{ - /** - * Magic used for validating the format of a MO file as well as - * detecting if the machine used to create that file was little endian. - * - * @var float - */ - const MO_LITTLE_ENDIAN_MAGIC = 0x950412de; - - /** - * Magic used for validating the format of a MO file as well as - * detecting if the machine used to create that file was big endian. - * - * @var float - */ - const MO_BIG_ENDIAN_MAGIC = 0xde120495; - - /** - * The size of the header of a MO file in bytes. - * - * @var int Number of bytes. - */ - const MO_HEADER_SIZE = 28; - - public function load($resource, $locale, $domain = 'messages') - { - if (!stream_is_local($resource)) { - throw new InvalidResourceException(sprintf('This is not a local file "%s".', $resource)); - } - - if (!file_exists($resource)) { - throw new NotFoundResourceException(sprintf('File "%s" not found.', $resource)); - } - - $messages = $this->parse($resource); - - // empty file - if (null === $messages) { - $messages = array(); - } - - // not an array - if (!is_array($messages)) { - throw new InvalidResourceException(sprintf('The file "%s" must contain a valid mo file.', $resource)); - } - - $catalogue = parent::load($messages, $locale, $domain); - - if (class_exists('Symfony\Component\Config\Resource\FileResource')) { - $catalogue->addResource(new FileResource($resource)); - } - - return $catalogue; - } - - /** - * Parses machine object (MO) format, independent of the machine's endian it - * was created on. Both 32bit and 64bit systems are supported. - * - * @param resource $resource - * - * @return array - * - * @throws InvalidResourceException If stream content has an invalid format. - */ - private function parse($resource) - { - $stream = fopen($resource, 'r'); - - $stat = fstat($stream); - - if ($stat['size'] < self::MO_HEADER_SIZE) { - throw new InvalidResourceException('MO stream content has an invalid format.'); - } - $magic = unpack('V1', fread($stream, 4)); - $magic = hexdec(substr(dechex(current($magic)), -8)); - - if ($magic == self::MO_LITTLE_ENDIAN_MAGIC) { - $isBigEndian = false; - } elseif ($magic == self::MO_BIG_ENDIAN_MAGIC) { - $isBigEndian = true; - } else { - throw new InvalidResourceException('MO stream content has an invalid format.'); - } - - // formatRevision - $this->readLong($stream, $isBigEndian); - $count = $this->readLong($stream, $isBigEndian); - $offsetId = $this->readLong($stream, $isBigEndian); - $offsetTranslated = $this->readLong($stream, $isBigEndian); - // sizeHashes - $this->readLong($stream, $isBigEndian); - // offsetHashes - $this->readLong($stream, $isBigEndian); - - $messages = array(); - - for ($i = 0; $i < $count; ++$i) { - $singularId = $pluralId = null; - $translated = null; - - fseek($stream, $offsetId + $i * 8); - - $length = $this->readLong($stream, $isBigEndian); - $offset = $this->readLong($stream, $isBigEndian); - - if ($length < 1) { - continue; - } - - fseek($stream, $offset); - $singularId = fread($stream, $length); - - if (strpos($singularId, "\000") !== false) { - list($singularId, $pluralId) = explode("\000", $singularId); - } - - fseek($stream, $offsetTranslated + $i * 8); - $length = $this->readLong($stream, $isBigEndian); - $offset = $this->readLong($stream, $isBigEndian); - - if ($length < 1) { - continue; - } - - fseek($stream, $offset); - $translated = fread($stream, $length); - - if (strpos($translated, "\000") !== false) { - $translated = explode("\000", $translated); - } - - $ids = array('singular' => $singularId, 'plural' => $pluralId); - $item = compact('ids', 'translated'); - - if (is_array($item['translated'])) { - $messages[$item['ids']['singular']] = stripcslashes($item['translated'][0]); - if (isset($item['ids']['plural'])) { - $plurals = array(); - foreach ($item['translated'] as $plural => $translated) { - $plurals[] = sprintf('{%d} %s', $plural, $translated); - } - $messages[$item['ids']['plural']] = stripcslashes(implode('|', $plurals)); - } - } elseif (!empty($item['ids']['singular'])) { - $messages[$item['ids']['singular']] = stripcslashes($item['translated']); - } - } - - fclose($stream); - - return array_filter($messages); - } - - /** - * Reads an unsigned long from stream respecting endianess. - * - * @param resource $stream - * @param bool $isBigEndian - * - * @return int - */ - private function readLong($stream, $isBigEndian) - { - $result = unpack($isBigEndian ? 'N1' : 'V1', fread($stream, 4)); - $result = current($result); - - return (int) substr($result, -8); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/translation/Loader/PhpFileLoader.php b/sitecake/2.2.9/server/vendor/symfony/translation/Loader/PhpFileLoader.php deleted file mode 100644 index 9ce2e7d..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/translation/Loader/PhpFileLoader.php +++ /dev/null @@ -1,52 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Loader; - -use Symfony\Component\Translation\Exception\InvalidResourceException; -use Symfony\Component\Translation\Exception\NotFoundResourceException; -use Symfony\Component\Config\Resource\FileResource; - -/** - * PhpFileLoader loads translations from PHP files returning an array of translations. - * - * @author Fabien Potencier - * - * @api - */ -class PhpFileLoader extends ArrayLoader -{ - /** - * {@inheritdoc} - * - * @api - */ - public function load($resource, $locale, $domain = 'messages') - { - if (!stream_is_local($resource)) { - throw new InvalidResourceException(sprintf('This is not a local file "%s".', $resource)); - } - - if (!file_exists($resource)) { - throw new NotFoundResourceException(sprintf('File "%s" not found.', $resource)); - } - - $messages = require $resource; - - $catalogue = parent::load($messages, $locale, $domain); - - if (class_exists('Symfony\Component\Config\Resource\FileResource')) { - $catalogue->addResource(new FileResource($resource)); - } - - return $catalogue; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/translation/Loader/PoFileLoader.php b/sitecake/2.2.9/server/vendor/symfony/translation/Loader/PoFileLoader.php deleted file mode 100644 index b5d12e9..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/translation/Loader/PoFileLoader.php +++ /dev/null @@ -1,180 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Loader; - -use Symfony\Component\Translation\Exception\InvalidResourceException; -use Symfony\Component\Translation\Exception\NotFoundResourceException; -use Symfony\Component\Config\Resource\FileResource; - -/** - * @copyright Copyright (c) 2010, Union of RAD http://union-of-rad.org (http://lithify.me/) - * @copyright Copyright (c) 2012, Clemens Tolboom - */ -class PoFileLoader extends ArrayLoader -{ - public function load($resource, $locale, $domain = 'messages') - { - if (!stream_is_local($resource)) { - throw new InvalidResourceException(sprintf('This is not a local file "%s".', $resource)); - } - - if (!file_exists($resource)) { - throw new NotFoundResourceException(sprintf('File "%s" not found.', $resource)); - } - - $messages = $this->parse($resource); - - // empty file - if (null === $messages) { - $messages = array(); - } - - // not an array - if (!is_array($messages)) { - throw new InvalidResourceException(sprintf('The file "%s" must contain a valid po file.', $resource)); - } - - $catalogue = parent::load($messages, $locale, $domain); - - if (class_exists('Symfony\Component\Config\Resource\FileResource')) { - $catalogue->addResource(new FileResource($resource)); - } - - return $catalogue; - } - - /** - * Parses portable object (PO) format. - * - * From http://www.gnu.org/software/gettext/manual/gettext.html#PO-Files - * we should be able to parse files having: - * - * white-space - * # translator-comments - * #. extracted-comments - * #: reference... - * #, flag... - * #| msgid previous-untranslated-string - * msgid untranslated-string - * msgstr translated-string - * - * extra or different lines are: - * - * #| msgctxt previous-context - * #| msgid previous-untranslated-string - * msgctxt context - * - * #| msgid previous-untranslated-string-singular - * #| msgid_plural previous-untranslated-string-plural - * msgid untranslated-string-singular - * msgid_plural untranslated-string-plural - * msgstr[0] translated-string-case-0 - * ... - * msgstr[N] translated-string-case-n - * - * The definition states: - * - white-space and comments are optional. - * - msgid "" that an empty singleline defines a header. - * - * This parser sacrifices some features of the reference implementation the - * differences to that implementation are as follows. - * - No support for comments spanning multiple lines. - * - Translator and extracted comments are treated as being the same type. - * - Message IDs are allowed to have other encodings as just US-ASCII. - * - * Items with an empty id are ignored. - * - * @param resource $resource - * - * @return array - */ - private function parse($resource) - { - $stream = fopen($resource, 'r'); - - $defaults = array( - 'ids' => array(), - 'translated' => null, - ); - - $messages = array(); - $item = $defaults; - - while ($line = fgets($stream)) { - $line = trim($line); - - if ($line === '') { - // Whitespace indicated current item is done - $this->addMessage($messages, $item); - $item = $defaults; - } elseif (substr($line, 0, 7) === 'msgid "') { - // We start a new msg so save previous - // TODO: this fails when comments or contexts are added - $this->addMessage($messages, $item); - $item = $defaults; - $item['ids']['singular'] = substr($line, 7, -1); - } elseif (substr($line, 0, 8) === 'msgstr "') { - $item['translated'] = substr($line, 8, -1); - } elseif ($line[0] === '"') { - $continues = isset($item['translated']) ? 'translated' : 'ids'; - - if (is_array($item[$continues])) { - end($item[$continues]); - $item[$continues][key($item[$continues])] .= substr($line, 1, -1); - } else { - $item[$continues] .= substr($line, 1, -1); - } - } elseif (substr($line, 0, 14) === 'msgid_plural "') { - $item['ids']['plural'] = substr($line, 14, -1); - } elseif (substr($line, 0, 7) === 'msgstr[') { - $size = strpos($line, ']'); - $item['translated'][(int) substr($line, 7, 1)] = substr($line, $size + 3, -1); - } - } - // save last item - $this->addMessage($messages, $item); - fclose($stream); - - return $messages; - } - - /** - * Save a translation item to the messages. - * - * A .po file could contain by error missing plural indexes. We need to - * fix these before saving them. - * - * @param array $messages - * @param array $item - */ - private function addMessage(array &$messages, array $item) - { - if (is_array($item['translated'])) { - $messages[stripcslashes($item['ids']['singular'])] = stripcslashes($item['translated'][0]); - if (isset($item['ids']['plural'])) { - $plurals = $item['translated']; - // PO are by definition indexed so sort by index. - ksort($plurals); - // Make sure every index is filled. - end($plurals); - $count = key($plurals); - // Fill missing spots with '-'. - $empties = array_fill(0, $count + 1, '-'); - $plurals += $empties; - ksort($plurals); - $messages[stripcslashes($item['ids']['plural'])] = stripcslashes(implode('|', $plurals)); - } - } elseif (!empty($item['ids']['singular'])) { - $messages[stripcslashes($item['ids']['singular'])] = stripcslashes($item['translated']); - } - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/translation/Loader/QtFileLoader.php b/sitecake/2.2.9/server/vendor/symfony/translation/Loader/QtFileLoader.php deleted file mode 100644 index 6dd0696..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/translation/Loader/QtFileLoader.php +++ /dev/null @@ -1,81 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Loader; - -use Symfony\Component\Config\Util\XmlUtils; -use Symfony\Component\Translation\MessageCatalogue; -use Symfony\Component\Translation\Exception\InvalidResourceException; -use Symfony\Component\Translation\Exception\NotFoundResourceException; -use Symfony\Component\Config\Resource\FileResource; - -/** - * QtFileLoader loads translations from QT Translations XML files. - * - * @author Benjamin Eberlei - * - * @api - */ -class QtFileLoader implements LoaderInterface -{ - /** - * {@inheritdoc} - * - * @api - */ - public function load($resource, $locale, $domain = 'messages') - { - if (!stream_is_local($resource)) { - throw new InvalidResourceException(sprintf('This is not a local file "%s".', $resource)); - } - - if (!file_exists($resource)) { - throw new NotFoundResourceException(sprintf('File "%s" not found.', $resource)); - } - - try { - $dom = XmlUtils::loadFile($resource); - } catch (\InvalidArgumentException $e) { - throw new InvalidResourceException(sprintf('Unable to load "%s".', $resource), $e->getCode(), $e); - } - - $internalErrors = libxml_use_internal_errors(true); - libxml_clear_errors(); - - $xpath = new \DOMXPath($dom); - $nodes = $xpath->evaluate('//TS/context/name[text()="'.$domain.'"]'); - - $catalogue = new MessageCatalogue($locale); - if ($nodes->length == 1) { - $translations = $nodes->item(0)->nextSibling->parentNode->parentNode->getElementsByTagName('message'); - foreach ($translations as $translation) { - $translationValue = (string) $translation->getElementsByTagName('translation')->item(0)->nodeValue; - - if (!empty($translationValue)) { - $catalogue->set( - (string) $translation->getElementsByTagName('source')->item(0)->nodeValue, - $translationValue, - $domain - ); - } - $translation = $translation->nextSibling; - } - - if (class_exists('Symfony\Component\Config\Resource\FileResource')) { - $catalogue->addResource(new FileResource($resource)); - } - } - - libxml_use_internal_errors($internalErrors); - - return $catalogue; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/translation/Loader/XliffFileLoader.php b/sitecake/2.2.9/server/vendor/symfony/translation/Loader/XliffFileLoader.php deleted file mode 100644 index d2b5407..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/translation/Loader/XliffFileLoader.php +++ /dev/null @@ -1,188 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Loader; - -use Symfony\Component\Config\Util\XmlUtils; -use Symfony\Component\Translation\MessageCatalogue; -use Symfony\Component\Translation\Exception\InvalidResourceException; -use Symfony\Component\Translation\Exception\NotFoundResourceException; -use Symfony\Component\Config\Resource\FileResource; - -/** - * XliffFileLoader loads translations from XLIFF files. - * - * @author Fabien Potencier - * - * @api - */ -class XliffFileLoader implements LoaderInterface -{ - /** - * {@inheritdoc} - * - * @api - */ - public function load($resource, $locale, $domain = 'messages') - { - if (!stream_is_local($resource)) { - throw new InvalidResourceException(sprintf('This is not a local file "%s".', $resource)); - } - - if (!file_exists($resource)) { - throw new NotFoundResourceException(sprintf('File "%s" not found.', $resource)); - } - - list($xml, $encoding) = $this->parseFile($resource); - $xml->registerXPathNamespace('xliff', 'urn:oasis:names:tc:xliff:document:1.2'); - - $catalogue = new MessageCatalogue($locale); - foreach ($xml->xpath('//xliff:trans-unit') as $translation) { - $attributes = $translation->attributes(); - - if (!(isset($attributes['resname']) || isset($translation->source)) || !isset($translation->target)) { - continue; - } - - $source = isset($attributes['resname']) && $attributes['resname'] ? $attributes['resname'] : $translation->source; - // If the xlf file has another encoding specified, try to convert it because - // simple_xml will always return utf-8 encoded values - $target = $this->utf8ToCharset((string) $translation->target, $encoding); - - $catalogue->set((string) $source, $target, $domain); - - if (isset($translation->note)) { - $notes = array(); - foreach ($translation->note as $xmlNote) { - $noteAttributes = $xmlNote->attributes(); - $note = array('content' => $this->utf8ToCharset((string) $xmlNote, $encoding)); - if (isset($noteAttributes['priority'])) { - $note['priority'] = (int) $noteAttributes['priority']; - } - - if (isset($noteAttributes['from'])) { - $note['from'] = (string) $noteAttributes['from']; - } - - $notes[] = $note; - } - - $catalogue->setMetadata((string) $source, array('notes' => $notes), $domain); - } - } - - if (class_exists('Symfony\Component\Config\Resource\FileResource')) { - $catalogue->addResource(new FileResource($resource)); - } - - return $catalogue; - } - - /** - * Convert a UTF8 string to the specified encoding. - * - * @param string $content String to decode - * @param string $encoding Target encoding - * - * @return string - */ - private function utf8ToCharset($content, $encoding = null) - { - if ('UTF-8' !== $encoding && !empty($encoding)) { - if (function_exists('mb_convert_encoding')) { - return mb_convert_encoding($content, $encoding, 'UTF-8'); - } - - if (function_exists('iconv')) { - return iconv('UTF-8', $encoding, $content); - } - - throw new \RuntimeException('No suitable convert encoding function (use UTF-8 as your encoding or install the iconv or mbstring extension).'); - } - - return $content; - } - - /** - * Validates and parses the given file into a SimpleXMLElement. - * - * @param string $file - * - * @throws \RuntimeException - * - * @return \SimpleXMLElement - * - * @throws InvalidResourceException - */ - private function parseFile($file) - { - try { - $dom = XmlUtils::loadFile($file); - } catch (\InvalidArgumentException $e) { - throw new InvalidResourceException(sprintf('Unable to load "%s": %s', $file, $e->getMessage()), $e->getCode(), $e); - } - - $internalErrors = libxml_use_internal_errors(true); - - $location = str_replace('\\', '/', __DIR__).'/schema/dic/xliff-core/xml.xsd'; - $parts = explode('/', $location); - if (0 === stripos($location, 'phar://')) { - $tmpfile = tempnam(sys_get_temp_dir(), 'sf2'); - if ($tmpfile) { - copy($location, $tmpfile); - $parts = explode('/', str_replace('\\', '/', $tmpfile)); - } - } - $drive = '\\' === DIRECTORY_SEPARATOR ? array_shift($parts).'/' : ''; - $location = 'file:///'.$drive.implode('/', array_map('rawurlencode', $parts)); - - $source = file_get_contents(__DIR__.'/schema/dic/xliff-core/xliff-core-1.2-strict.xsd'); - $source = str_replace('http://www.w3.org/2001/xml.xsd', $location, $source); - - if (!@$dom->schemaValidateSource($source)) { - throw new InvalidResourceException(sprintf('Invalid resource provided: "%s"; Errors: %s', $file, implode("\n", $this->getXmlErrors($internalErrors)))); - } - - $dom->normalizeDocument(); - - libxml_clear_errors(); - libxml_use_internal_errors($internalErrors); - - return array(simplexml_import_dom($dom), strtoupper($dom->encoding)); - } - - /** - * Returns the XML errors of the internal XML parser. - * - * @param bool $internalErrors - * - * @return array An array of errors - */ - private function getXmlErrors($internalErrors) - { - $errors = array(); - foreach (libxml_get_errors() as $error) { - $errors[] = sprintf('[%s %s] %s (in %s - line %d, column %d)', - LIBXML_ERR_WARNING == $error->level ? 'WARNING' : 'ERROR', - $error->code, - trim($error->message), - $error->file ?: 'n/a', - $error->line, - $error->column - ); - } - - libxml_clear_errors(); - libxml_use_internal_errors($internalErrors); - - return $errors; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/translation/Loader/YamlFileLoader.php b/sitecake/2.2.9/server/vendor/symfony/translation/Loader/YamlFileLoader.php deleted file mode 100644 index fb0946c..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/translation/Loader/YamlFileLoader.php +++ /dev/null @@ -1,78 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Loader; - -use Symfony\Component\Translation\Exception\InvalidResourceException; -use Symfony\Component\Translation\Exception\NotFoundResourceException; -use Symfony\Component\Config\Resource\FileResource; -use Symfony\Component\Yaml\Parser as YamlParser; -use Symfony\Component\Yaml\Exception\ParseException; - -/** - * YamlFileLoader loads translations from Yaml files. - * - * @author Fabien Potencier - * - * @api - */ -class YamlFileLoader extends ArrayLoader -{ - private $yamlParser; - - /** - * {@inheritdoc} - * - * @api - */ - public function load($resource, $locale, $domain = 'messages') - { - if (!stream_is_local($resource)) { - throw new InvalidResourceException(sprintf('This is not a local file "%s".', $resource)); - } - - if (!file_exists($resource)) { - throw new NotFoundResourceException(sprintf('File "%s" not found.', $resource)); - } - - if (!class_exists('Symfony\Component\Yaml\Parser')) { - throw new \LogicException('Loading translations from the YAML format requires the Symfony Yaml component.'); - } - - if (null === $this->yamlParser) { - $this->yamlParser = new YamlParser(); - } - - try { - $messages = $this->yamlParser->parse(file_get_contents($resource)); - } catch (ParseException $e) { - throw new InvalidResourceException(sprintf('Error parsing YAML, invalid file "%s"', $resource), 0, $e); - } - - // empty file - if (null === $messages) { - $messages = array(); - } - - // not an array - if (!is_array($messages)) { - throw new InvalidResourceException(sprintf('The file "%s" must contain a YAML array.', $resource)); - } - - $catalogue = parent::load($messages, $locale, $domain); - - if (class_exists('Symfony\Component\Config\Resource\FileResource')) { - $catalogue->addResource(new FileResource($resource)); - } - - return $catalogue; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/translation/Loader/schema/dic/xliff-core/xliff-core-1.2-strict.xsd b/sitecake/2.2.9/server/vendor/symfony/translation/Loader/schema/dic/xliff-core/xliff-core-1.2-strict.xsd deleted file mode 100644 index 3ce2a8e..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/translation/Loader/schema/dic/xliff-core/xliff-core-1.2-strict.xsd +++ /dev/null @@ -1,2223 +0,0 @@ - - - - - - - - - - - - - - - Values for the attribute 'context-type'. - - - - - Indicates a database content. - - - - - Indicates the content of an element within an XML document. - - - - - Indicates the name of an element within an XML document. - - - - - Indicates the line number from the sourcefile (see context-type="sourcefile") where the <source> is found. - - - - - Indicates a the number of parameters contained within the <source>. - - - - - Indicates notes pertaining to the parameters in the <source>. - - - - - Indicates the content of a record within a database. - - - - - Indicates the name of a record within a database. - - - - - Indicates the original source file in the case that multiple files are merged to form the original file from which the XLIFF file is created. This differs from the original <file> attribute in that this sourcefile is one of many that make up that file. - - - - - - - Values for the attribute 'count-type'. - - - - - Indicates the count units are items that are used X times in a certain context; example: this is a reusable text unit which is used 42 times in other texts. - - - - - Indicates the count units are translation units existing already in the same document. - - - - - Indicates a total count. - - - - - - - Values for the attribute 'ctype' when used other elements than <ph> or <x>. - - - - - Indicates a run of bolded text. - - - - - Indicates a run of text in italics. - - - - - Indicates a run of underlined text. - - - - - Indicates a run of hyper-text. - - - - - - - Values for the attribute 'ctype' when used with <ph> or <x>. - - - - - Indicates a inline image. - - - - - Indicates a page break. - - - - - Indicates a line break. - - - - - - - - - - - - Values for the attribute 'datatype'. - - - - - Indicates Active Server Page data. - - - - - Indicates C source file data. - - - - - Indicates Channel Definition Format (CDF) data. - - - - - Indicates ColdFusion data. - - - - - Indicates C++ source file data. - - - - - Indicates C-Sharp data. - - - - - Indicates strings from C, ASM, and driver files data. - - - - - Indicates comma-separated values data. - - - - - Indicates database data. - - - - - Indicates portions of document that follows data and contains metadata. - - - - - Indicates portions of document that precedes data and contains metadata. - - - - - Indicates data from standard UI file operations dialogs (e.g., Open, Save, Save As, Export, Import). - - - - - Indicates standard user input screen data. - - - - - Indicates HyperText Markup Language (HTML) data - document instance. - - - - - Indicates content within an HTML document’s <body> element. - - - - - Indicates Windows INI file data. - - - - - Indicates Interleaf data. - - - - - Indicates Java source file data (extension '.java'). - - - - - Indicates Java property resource bundle data. - - - - - Indicates Java list resource bundle data. - - - - - Indicates JavaScript source file data. - - - - - Indicates JScript source file data. - - - - - Indicates information relating to formatting. - - - - - Indicates LISP source file data. - - - - - Indicates information relating to margin formats. - - - - - Indicates a file containing menu. - - - - - Indicates numerically identified string table. - - - - - Indicates Maker Interchange Format (MIF) data. - - - - - Indicates that the datatype attribute value is a MIME Type value and is defined in the mime-type attribute. - - - - - Indicates GNU Machine Object data. - - - - - Indicates Message Librarian strings created by Novell's Message Librarian Tool. - - - - - Indicates information to be displayed at the bottom of each page of a document. - - - - - Indicates information to be displayed at the top of each page of a document. - - - - - Indicates a list of property values (e.g., settings within INI files or preferences dialog). - - - - - Indicates Pascal source file data. - - - - - Indicates Hypertext Preprocessor data. - - - - - Indicates plain text file (no formatting other than, possibly, wrapping). - - - - - Indicates GNU Portable Object file. - - - - - Indicates dynamically generated user defined document. e.g. Oracle Report, Crystal Report, etc. - - - - - Indicates Windows .NET binary resources. - - - - - Indicates Windows .NET Resources. - - - - - Indicates Rich Text Format (RTF) data. - - - - - Indicates Standard Generalized Markup Language (SGML) data - document instance. - - - - - Indicates Standard Generalized Markup Language (SGML) data - Document Type Definition (DTD). - - - - - Indicates Scalable Vector Graphic (SVG) data. - - - - - Indicates VisualBasic Script source file. - - - - - Indicates warning message. - - - - - Indicates Windows (Win32) resources (i.e. resources extracted from an RC script, a message file, or a compiled file). - - - - - Indicates Extensible HyperText Markup Language (XHTML) data - document instance. - - - - - Indicates Extensible Markup Language (XML) data - document instance. - - - - - Indicates Extensible Markup Language (XML) data - Document Type Definition (DTD). - - - - - Indicates Extensible Stylesheet Language (XSL) data. - - - - - Indicates XUL elements. - - - - - - - Values for the attribute 'mtype'. - - - - - Indicates the marked text is an abbreviation. - - - - - ISO-12620 2.1.8: A term resulting from the omission of any part of the full term while designating the same concept. - - - - - ISO-12620 2.1.8.1: An abbreviated form of a simple term resulting from the omission of some of its letters (e.g. 'adj.' for 'adjective'). - - - - - ISO-12620 2.1.8.4: An abbreviated form of a term made up of letters from the full form of a multiword term strung together into a sequence pronounced only syllabically (e.g. 'radar' for 'radio detecting and ranging'). - - - - - ISO-12620: A proper-name term, such as the name of an agency or other proper entity. - - - - - ISO-12620 2.1.18.1: A recurrent word combination characterized by cohesion in that the components of the collocation must co-occur within an utterance or series of utterances, even though they do not necessarily have to maintain immediate proximity to one another. - - - - - ISO-12620 2.1.5: A synonym for an international scientific term that is used in general discourse in a given language. - - - - - Indicates the marked text is a date and/or time. - - - - - ISO-12620 2.1.15: An expression used to represent a concept based on a statement that two mathematical expressions are, for instance, equal as identified by the equal sign (=), or assigned to one another by a similar sign. - - - - - ISO-12620 2.1.7: The complete representation of a term for which there is an abbreviated form. - - - - - ISO-12620 2.1.14: Figures, symbols or the like used to express a concept briefly, such as a mathematical or chemical formula. - - - - - ISO-12620 2.1.1: The concept designation that has been chosen to head a terminological record. - - - - - ISO-12620 2.1.8.3: An abbreviated form of a term consisting of some of the initial letters of the words making up a multiword term or the term elements making up a compound term when these letters are pronounced individually (e.g. 'BSE' for 'bovine spongiform encephalopathy'). - - - - - ISO-12620 2.1.4: A term that is part of an international scientific nomenclature as adopted by an appropriate scientific body. - - - - - ISO-12620 2.1.6: A term that has the same or nearly identical orthographic or phonemic form in many languages. - - - - - ISO-12620 2.1.16: An expression used to represent a concept based on mathematical or logical relations, such as statements of inequality, set relationships, Boolean operations, and the like. - - - - - ISO-12620 2.1.17: A unit to track object. - - - - - Indicates the marked text is a name. - - - - - ISO-12620 2.1.3: A term that represents the same or a very similar concept as another term in the same language, but for which interchangeability is limited to some contexts and inapplicable in others. - - - - - ISO-12620 2.1.17.2: A unique alphanumeric designation assigned to an object in a manufacturing system. - - - - - Indicates the marked text is a phrase. - - - - - ISO-12620 2.1.18: Any group of two or more words that form a unit, the meaning of which frequently cannot be deduced based on the combined sense of the words making up the phrase. - - - - - Indicates the marked text should not be translated. - - - - - ISO-12620 2.1.12: A form of a term resulting from an operation whereby non-Latin writing systems are converted to the Latin alphabet. - - - - - Indicates that the marked text represents a segment. - - - - - ISO-12620 2.1.18.2: A fixed, lexicalized phrase. - - - - - ISO-12620 2.1.8.2: A variant of a multiword term that includes fewer words than the full form of the term (e.g. 'Group of Twenty-four' for 'Intergovernmental Group of Twenty-four on International Monetary Affairs'). - - - - - ISO-12620 2.1.17.1: Stock keeping unit, an inventory item identified by a unique alphanumeric designation assigned to an object in an inventory control system. - - - - - ISO-12620 2.1.19: A fixed chunk of recurring text. - - - - - ISO-12620 2.1.13: A designation of a concept by letters, numerals, pictograms or any combination thereof. - - - - - ISO-12620 2.1.2: Any term that represents the same or a very similar concept as the main entry term in a term entry. - - - - - ISO-12620 2.1.18.3: Phraseological unit in a language that expresses the same semantic content as another phrase in that same language. - - - - - Indicates the marked text is a term. - - - - - ISO-12620 2.1.11: A form of a term resulting from an operation whereby the characters of one writing system are represented by characters from another writing system, taking into account the pronunciation of the characters converted. - - - - - ISO-12620 2.1.10: A form of a term resulting from an operation whereby the characters of an alphabetic writing system are represented by characters from another alphabetic writing system. - - - - - ISO-12620 2.1.8.5: An abbreviated form of a term resulting from the omission of one or more term elements or syllables (e.g. 'flu' for 'influenza'). - - - - - ISO-12620 2.1.9: One of the alternate forms of a term. - - - - - - - Values for the attribute 'restype'. - - - - - Indicates a Windows RC AUTO3STATE control. - - - - - Indicates a Windows RC AUTOCHECKBOX control. - - - - - Indicates a Windows RC AUTORADIOBUTTON control. - - - - - Indicates a Windows RC BEDIT control. - - - - - Indicates a bitmap, for example a BITMAP resource in Windows. - - - - - Indicates a button object, for example a BUTTON control Windows. - - - - - Indicates a caption, such as the caption of a dialog box. - - - - - Indicates the cell in a table, for example the content of the <td> element in HTML. - - - - - Indicates check box object, for example a CHECKBOX control in Windows. - - - - - Indicates a menu item with an associated checkbox. - - - - - Indicates a list box, but with a check-box for each item. - - - - - Indicates a color selection dialog. - - - - - Indicates a combination of edit box and listbox object, for example a COMBOBOX control in Windows. - - - - - Indicates an initialization entry of an extended combobox DLGINIT resource block. (code 0x1234). - - - - - Indicates an initialization entry of a combobox DLGINIT resource block (code 0x0403). - - - - - Indicates a UI base class element that cannot be represented by any other element. - - - - - Indicates a context menu. - - - - - Indicates a Windows RC CTEXT control. - - - - - Indicates a cursor, for example a CURSOR resource in Windows. - - - - - Indicates a date/time picker. - - - - - Indicates a Windows RC DEFPUSHBUTTON control. - - - - - Indicates a dialog box. - - - - - Indicates a Windows RC DLGINIT resource block. - - - - - Indicates an edit box object, for example an EDIT control in Windows. - - - - - Indicates a filename. - - - - - Indicates a file dialog. - - - - - Indicates a footnote. - - - - - Indicates a font name. - - - - - Indicates a footer. - - - - - Indicates a frame object. - - - - - Indicates a XUL grid element. - - - - - Indicates a groupbox object, for example a GROUPBOX control in Windows. - - - - - Indicates a header item. - - - - - Indicates a heading, such has the content of <h1>, <h2>, etc. in HTML. - - - - - Indicates a Windows RC HEDIT control. - - - - - Indicates a horizontal scrollbar. - - - - - Indicates an icon, for example an ICON resource in Windows. - - - - - Indicates a Windows RC IEDIT control. - - - - - Indicates keyword list, such as the content of the Keywords meta-data in HTML, or a K footnote in WinHelp RTF. - - - - - Indicates a label object. - - - - - Indicates a label that is also a HTML link (not necessarily a URL). - - - - - Indicates a list (a group of list-items, for example an <ol> or <ul> element in HTML). - - - - - Indicates a listbox object, for example an LISTBOX control in Windows. - - - - - Indicates an list item (an entry in a list). - - - - - Indicates a Windows RC LTEXT control. - - - - - Indicates a menu (a group of menu-items). - - - - - Indicates a toolbar containing one or more tope level menus. - - - - - Indicates a menu item (an entry in a menu). - - - - - Indicates a XUL menuseparator element. - - - - - Indicates a message, for example an entry in a MESSAGETABLE resource in Windows. - - - - - Indicates a calendar control. - - - - - Indicates an edit box beside a spin control. - - - - - Indicates a catch all for rectangular areas. - - - - - Indicates a standalone menu not necessarily associated with a menubar. - - - - - Indicates a pushbox object, for example a PUSHBOX control in Windows. - - - - - Indicates a Windows RC PUSHBUTTON control. - - - - - Indicates a radio button object. - - - - - Indicates a menuitem with associated radio button. - - - - - Indicates raw data resources for an application. - - - - - Indicates a row in a table. - - - - - Indicates a Windows RC RTEXT control. - - - - - Indicates a user navigable container used to show a portion of a document. - - - - - Indicates a generic divider object (e.g. menu group separator). - - - - - Windows accelerators, shortcuts in resource or property files. - - - - - Indicates a UI control to indicate process activity but not progress. - - - - - Indicates a splitter bar. - - - - - Indicates a Windows RC STATE3 control. - - - - - Indicates a window for providing feedback to the users, like 'read-only', etc. - - - - - Indicates a string, for example an entry in a STRINGTABLE resource in Windows. - - - - - Indicates a layers of controls with a tab to select layers. - - - - - Indicates a display and edits regular two-dimensional tables of cells. - - - - - Indicates a XUL textbox element. - - - - - Indicates a UI button that can be toggled to on or off state. - - - - - Indicates an array of controls, usually buttons. - - - - - Indicates a pop up tool tip text. - - - - - Indicates a bar with a pointer indicating a position within a certain range. - - - - - Indicates a control that displays a set of hierarchical data. - - - - - Indicates a URI (URN or URL). - - - - - Indicates a Windows RC USERBUTTON control. - - - - - Indicates a user-defined control like CONTROL control in Windows. - - - - - Indicates the text of a variable. - - - - - Indicates version information about a resource like VERSIONINFO in Windows. - - - - - Indicates a vertical scrollbar. - - - - - Indicates a graphical window. - - - - - - - Values for the attribute 'size-unit'. - - - - - Indicates a size in 8-bit bytes. - - - - - Indicates a size in Unicode characters. - - - - - Indicates a size in columns. Used for HTML text area. - - - - - Indicates a size in centimeters. - - - - - Indicates a size in dialog units, as defined in Windows resources. - - - - - Indicates a size in 'font-size' units (as defined in CSS). - - - - - Indicates a size in 'x-height' units (as defined in CSS). - - - - - Indicates a size in glyphs. A glyph is considered to be one or more combined Unicode characters that represent a single displayable text character. Sometimes referred to as a 'grapheme cluster' - - - - - Indicates a size in inches. - - - - - Indicates a size in millimeters. - - - - - Indicates a size in percentage. - - - - - Indicates a size in pixels. - - - - - Indicates a size in point. - - - - - Indicates a size in rows. Used for HTML text area. - - - - - - - Values for the attribute 'state'. - - - - - Indicates the terminating state. - - - - - Indicates only non-textual information needs adaptation. - - - - - Indicates both text and non-textual information needs adaptation. - - - - - Indicates only non-textual information needs review. - - - - - Indicates both text and non-textual information needs review. - - - - - Indicates that only the text of the item needs to be reviewed. - - - - - Indicates that the item needs to be translated. - - - - - Indicates that the item is new. For example, translation units that were not in a previous version of the document. - - - - - Indicates that changes are reviewed and approved. - - - - - Indicates that the item has been translated. - - - - - - - Values for the attribute 'state-qualifier'. - - - - - Indicates an exact match. An exact match occurs when a source text of a segment is exactly the same as the source text of a segment that was translated previously. - - - - - Indicates a fuzzy match. A fuzzy match occurs when a source text of a segment is very similar to the source text of a segment that was translated previously (e.g. when the difference is casing, a few changed words, white-space discripancy, etc.). - - - - - Indicates a match based on matching IDs (in addition to matching text). - - - - - Indicates a translation derived from a glossary. - - - - - Indicates a translation derived from existing translation. - - - - - Indicates a translation derived from machine translation. - - - - - Indicates a translation derived from a translation repository. - - - - - Indicates a translation derived from a translation memory. - - - - - Indicates the translation is suggested by machine translation. - - - - - Indicates that the item has been rejected because of incorrect grammar. - - - - - Indicates that the item has been rejected because it is incorrect. - - - - - Indicates that the item has been rejected because it is too long or too short. - - - - - Indicates that the item has been rejected because of incorrect spelling. - - - - - Indicates the translation is suggested by translation memory. - - - - - - - Values for the attribute 'unit'. - - - - - Refers to words. - - - - - Refers to pages. - - - - - Refers to <trans-unit> elements. - - - - - Refers to <bin-unit> elements. - - - - - Refers to glyphs. - - - - - Refers to <trans-unit> and/or <bin-unit> elements. - - - - - Refers to the occurrences of instances defined by the count-type value. - - - - - Refers to characters. - - - - - Refers to lines. - - - - - Refers to sentences. - - - - - Refers to paragraphs. - - - - - Refers to segments. - - - - - Refers to placeables (inline elements). - - - - - - - Values for the attribute 'priority'. - - - - - Highest priority. - - - - - High priority. - - - - - High priority, but not as important as 2. - - - - - High priority, but not as important as 3. - - - - - Medium priority, but more important than 6. - - - - - Medium priority, but less important than 5. - - - - - Low priority, but more important than 8. - - - - - Low priority, but more important than 9. - - - - - Low priority. - - - - - Lowest priority. - - - - - - - - - This value indicates that all properties can be reformatted. This value must be used alone. - - - - - This value indicates that no properties should be reformatted. This value must be used alone. - - - - - - - - - - - - - This value indicates that all information in the coord attribute can be modified. - - - - - This value indicates that the x information in the coord attribute can be modified. - - - - - This value indicates that the y information in the coord attribute can be modified. - - - - - This value indicates that the cx information in the coord attribute can be modified. - - - - - This value indicates that the cy information in the coord attribute can be modified. - - - - - This value indicates that all the information in the font attribute can be modified. - - - - - This value indicates that the name information in the font attribute can be modified. - - - - - This value indicates that the size information in the font attribute can be modified. - - - - - This value indicates that the weight information in the font attribute can be modified. - - - - - This value indicates that the information in the css-style attribute can be modified. - - - - - This value indicates that the information in the style attribute can be modified. - - - - - This value indicates that the information in the exstyle attribute can be modified. - - - - - - - - - - - - - Indicates that the context is informational in nature, specifying for example, how a term should be translated. Thus, should be displayed to anyone editing the XLIFF document. - - - - - Indicates that the context-group is used to specify where the term was found in the translatable source. Thus, it is not displayed. - - - - - Indicates that the context information should be used during translation memory lookups. Thus, it is not displayed. - - - - - - - - - Represents a translation proposal from a translation memory or other resource. - - - - - Represents a previous version of the target element. - - - - - Represents a rejected version of the target element. - - - - - Represents a translation to be used for reference purposes only, for example from a related product or a different language. - - - - - Represents a proposed translation that was used for the translation of the trans-unit, possibly modified. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Values for the attribute 'coord'. - - - - - - - - Version values: 1.0 and 1.1 are allowed for backward compatibility. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sitecake/2.2.9/server/vendor/symfony/translation/Loader/schema/dic/xliff-core/xml.xsd b/sitecake/2.2.9/server/vendor/symfony/translation/Loader/schema/dic/xliff-core/xml.xsd deleted file mode 100644 index a46162a..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/translation/Loader/schema/dic/xliff-core/xml.xsd +++ /dev/null @@ -1,309 +0,0 @@ - - - - - - -
    -

    About the XML namespace

    - -
    -

    - - This schema document describes the XML namespace, in a form - suitable for import by other schema documents. -

    -

    - See - http://www.w3.org/XML/1998/namespace.html and - - http://www.w3.org/TR/REC-xml for information - about this namespace. -

    - -

    - Note that local names in this namespace are intended to be - defined only by the World Wide Web Consortium or its subgroups. - The names currently defined in this namespace are listed below. - They should not be used with conflicting semantics by any Working - Group, specification, or document instance. -

    -

    - See further below in this document for more information about how to refer to this schema document from your own - XSD schema documents and about the - namespace-versioning policy governing this schema document. -

    -
    -
    - -
    -
    - - - - -
    - -

    lang (as an attribute name)

    -

    - - denotes an attribute whose value - is a language code for the natural language of the content of - any element; its value is inherited. This name is reserved - by virtue of its definition in the XML specification.

    - -
    -
    -

    Notes

    -

    - Attempting to install the relevant ISO 2- and 3-letter - codes as the enumerated possible values is probably never - going to be a realistic possibility. -

    -

    - - See BCP 47 at - http://www.rfc-editor.org/rfc/bcp/bcp47.txt - and the IANA language subtag registry at - - http://www.iana.org/assignments/language-subtag-registry - for further information. -

    -

    - - The union allows for the 'un-declaration' of xml:lang with - the empty string. -

    -
    -
    -
    - - - - - - - - - - -
    - - - - - -
    - -

    space (as an attribute name)

    -

    - denotes an attribute whose - value is a keyword indicating what whitespace processing - discipline is intended for the content of the element; its - value is inherited. This name is reserved by virtue of its - definition in the XML specification.

    - -
    -
    -
    - - - - - - - -
    - - - - -
    - -

    base (as an attribute name)

    -

    - denotes an attribute whose value - provides a URI to be used as the base for interpreting any - relative URIs in the scope of the element on which it - appears; its value is inherited. This name is reserved - by virtue of its definition in the XML Base specification.

    - -

    - See http://www.w3.org/TR/xmlbase/ - for information about this attribute. -

    - -
    -
    -
    -
    - - - - -
    - -

    id (as an attribute name)

    -

    - - denotes an attribute whose value - should be interpreted as if declared to be of type ID. - This name is reserved by virtue of its definition in the - xml:id specification.

    - -

    - See http://www.w3.org/TR/xml-id/ - for information about this attribute. -

    -
    -
    -
    - -
    - - - - - - - - - - - -
    - -

    Father (in any context at all)

    - -
    -

    - denotes Jon Bosak, the chair of - the original XML Working Group. This name is reserved by - the following decision of the W3C XML Plenary and - XML Coordination groups: -

    -
    -

    - - In appreciation for his vision, leadership and - dedication the W3C XML Plenary on this 10th day of - February, 2000, reserves for Jon Bosak in perpetuity - the XML name "xml:Father". -

    -
    -
    -
    -
    -
    - - - - -
    -

    About this schema document

    - -
    -

    - This schema defines attributes and an attribute group suitable - for use by schemas wishing to allow xml:base, - xml:lang, xml:space or - xml:id attributes on elements they define. -

    - -

    - To enable this, such a schema must import this schema for - the XML namespace, e.g. as follows: -

    -
    -          <schema.. .>
    -          .. .
    -           <import namespace="http://www.w3.org/XML/1998/namespace"
    -                      schemaLocation="http://www.w3.org/2001/xml.xsd"/>
    -     
    -

    - or -

    -
    -
    -           <import namespace="http://www.w3.org/XML/1998/namespace"
    -                      schemaLocation="http://www.w3.org/2009/01/xml.xsd"/>
    -     
    -

    - Subsequently, qualified reference to any of the attributes or the - group defined below will have the desired effect, e.g. -

    -
    -          <type.. .>
    -          .. .
    -           <attributeGroup ref="xml:specialAttrs"/>
    -     
    -

    - will define a type which will schema-validate an instance element - with any of those attributes. -

    - -
    -
    -
    -
    - - - -
    -

    Versioning policy for this schema document

    - -
    -

    - In keeping with the XML Schema WG's standard versioning - policy, this schema document will persist at - - http://www.w3.org/2009/01/xml.xsd. -

    -

    - At the date of issue it can also be found at - - http://www.w3.org/2001/xml.xsd. -

    - -

    - The schema document at that URI may however change in the future, - in order to remain compatible with the latest version of XML - Schema itself, or with the XML namespace itself. In other words, - if the XML Schema or XML namespaces change, the version of this - document at - http://www.w3.org/2001/xml.xsd - - will change accordingly; the version at - - http://www.w3.org/2009/01/xml.xsd - - will not change. -

    -

    - - Previous dated (and unchanging) versions of this schema - document are at: -

    - -
    -
    -
    -
    - -
    diff --git a/sitecake/2.2.9/server/vendor/symfony/translation/LoggingTranslator.php b/sitecake/2.2.9/server/vendor/symfony/translation/LoggingTranslator.php deleted file mode 100644 index 4ff3531..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/translation/LoggingTranslator.php +++ /dev/null @@ -1,128 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation; - -use Psr\Log\LoggerInterface; - -/** - * @author Abdellatif Ait boudad - */ -class LoggingTranslator implements TranslatorInterface, TranslatorBagInterface -{ - /** - * @var TranslatorInterface|TranslatorBagInterface - */ - private $translator; - - /** - * @var LoggerInterface - */ - private $logger; - - /** - * @param TranslatorInterface $translator The translator must implement TranslatorBagInterface - * @param LoggerInterface $logger - */ - public function __construct(TranslatorInterface $translator, LoggerInterface $logger) - { - if (!$translator instanceof TranslatorBagInterface) { - throw new \InvalidArgumentException(sprintf('The Translator "%s" must implement TranslatorInterface and TranslatorBagInterface.', get_class($translator))); - } - - $this->translator = $translator; - $this->logger = $logger; - } - - /** - * {@inheritdoc} - */ - public function trans($id, array $parameters = array(), $domain = null, $locale = null) - { - $trans = $this->translator->trans($id, $parameters, $domain, $locale); - $this->log($id, $domain, $locale); - - return $trans; - } - - /** - * {@inheritdoc} - */ - public function transChoice($id, $number, array $parameters = array(), $domain = null, $locale = null) - { - $trans = $this->translator->transChoice($id, $number, $parameters, $domain, $locale); - $this->log($id, $domain, $locale); - - return $trans; - } - - /** - * {@inheritdoc} - * - * @api - */ - public function setLocale($locale) - { - $this->translator->setLocale($locale); - } - - /** - * {@inheritdoc} - * - * @api - */ - public function getLocale() - { - return $this->translator->getLocale(); - } - - /** - * {@inheritdoc} - */ - public function getCatalogue($locale = null) - { - return $this->translator->getCatalogue($locale); - } - - /** - * Passes through all unknown calls onto the translator object. - */ - public function __call($method, $args) - { - return call_user_func_array(array($this->translator, $method), $args); - } - - /** - * Logs for missing translations. - * - * @param string $id - * @param string|null $domain - * @param string|null $locale - */ - private function log($id, $domain, $locale) - { - if (null === $domain) { - $domain = 'messages'; - } - - $id = (string) $id; - $catalogue = $this->translator->getCatalogue($locale); - if ($catalogue->defines($id, $domain)) { - return; - } - - if ($catalogue->has($id, $domain)) { - $this->logger->debug('Translation use fallback catalogue.', array('id' => $id, 'domain' => $domain, 'locale' => $catalogue->getLocale())); - } else { - $this->logger->warning('Translation not found.', array('id' => $id, 'domain' => $domain, 'locale' => $catalogue->getLocale())); - } - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/translation/MessageCatalogue.php b/sitecake/2.2.9/server/vendor/symfony/translation/MessageCatalogue.php deleted file mode 100644 index aa92a58..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/translation/MessageCatalogue.php +++ /dev/null @@ -1,293 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation; - -use Symfony\Component\Config\Resource\ResourceInterface; - -/** - * MessageCatalogue. - * - * @author Fabien Potencier - * - * @api - */ -class MessageCatalogue implements MessageCatalogueInterface, MetadataAwareInterface -{ - private $messages = array(); - private $metadata = array(); - private $resources = array(); - private $locale; - private $fallbackCatalogue; - private $parent; - - /** - * Constructor. - * - * @param string $locale The locale - * @param array $messages An array of messages classified by domain - * - * @api - */ - public function __construct($locale, array $messages = array()) - { - $this->locale = $locale; - $this->messages = $messages; - } - - /** - * {@inheritdoc} - * - * @api - */ - public function getLocale() - { - return $this->locale; - } - - /** - * {@inheritdoc} - * - * @api - */ - public function getDomains() - { - return array_keys($this->messages); - } - - /** - * {@inheritdoc} - * - * @api - */ - public function all($domain = null) - { - if (null === $domain) { - return $this->messages; - } - - return isset($this->messages[$domain]) ? $this->messages[$domain] : array(); - } - - /** - * {@inheritdoc} - * - * @api - */ - public function set($id, $translation, $domain = 'messages') - { - $this->add(array($id => $translation), $domain); - } - - /** - * {@inheritdoc} - * - * @api - */ - public function has($id, $domain = 'messages') - { - if (isset($this->messages[$domain][$id])) { - return true; - } - - if (null !== $this->fallbackCatalogue) { - return $this->fallbackCatalogue->has($id, $domain); - } - - return false; - } - - /** - * {@inheritdoc} - */ - public function defines($id, $domain = 'messages') - { - return isset($this->messages[$domain][$id]); - } - - /** - * {@inheritdoc} - * - * @api - */ - public function get($id, $domain = 'messages') - { - if (isset($this->messages[$domain][$id])) { - return $this->messages[$domain][$id]; - } - - if (null !== $this->fallbackCatalogue) { - return $this->fallbackCatalogue->get($id, $domain); - } - - return $id; - } - - /** - * {@inheritdoc} - * - * @api - */ - public function replace($messages, $domain = 'messages') - { - $this->messages[$domain] = array(); - - $this->add($messages, $domain); - } - - /** - * {@inheritdoc} - * - * @api - */ - public function add($messages, $domain = 'messages') - { - if (!isset($this->messages[$domain])) { - $this->messages[$domain] = $messages; - } else { - $this->messages[$domain] = array_replace($this->messages[$domain], $messages); - } - } - - /** - * {@inheritdoc} - * - * @api - */ - public function addCatalogue(MessageCatalogueInterface $catalogue) - { - if ($catalogue->getLocale() !== $this->locale) { - throw new \LogicException(sprintf('Cannot add a catalogue for locale "%s" as the current locale for this catalogue is "%s"', $catalogue->getLocale(), $this->locale)); - } - - foreach ($catalogue->all() as $domain => $messages) { - $this->add($messages, $domain); - } - - foreach ($catalogue->getResources() as $resource) { - $this->addResource($resource); - } - - if ($catalogue instanceof MetadataAwareInterface) { - $metadata = $catalogue->getMetadata('', ''); - $this->addMetadata($metadata); - } - } - - /** - * {@inheritdoc} - * - * @api - */ - public function addFallbackCatalogue(MessageCatalogueInterface $catalogue) - { - // detect circular references - $c = $this; - do { - if ($c->getLocale() === $catalogue->getLocale()) { - throw new \LogicException(sprintf('Circular reference detected when adding a fallback catalogue for locale "%s".', $catalogue->getLocale())); - } - } while ($c = $c->parent); - - $catalogue->parent = $this; - $this->fallbackCatalogue = $catalogue; - - foreach ($catalogue->getResources() as $resource) { - $this->addResource($resource); - } - } - - /** - * {@inheritdoc} - * - * @api - */ - public function getFallbackCatalogue() - { - return $this->fallbackCatalogue; - } - - /** - * {@inheritdoc} - * - * @api - */ - public function getResources() - { - return array_values($this->resources); - } - - /** - * {@inheritdoc} - * - * @api - */ - public function addResource(ResourceInterface $resource) - { - $this->resources[$resource->__toString()] = $resource; - } - - /** - * {@inheritdoc} - */ - public function getMetadata($key = '', $domain = 'messages') - { - if ('' == $domain) { - return $this->metadata; - } - - if (isset($this->metadata[$domain])) { - if ('' == $key) { - return $this->metadata[$domain]; - } - - if (isset($this->metadata[$domain][$key])) { - return $this->metadata[$domain][$key]; - } - } - } - - /** - * {@inheritdoc} - */ - public function setMetadata($key, $value, $domain = 'messages') - { - $this->metadata[$domain][$key] = $value; - } - - /** - * {@inheritdoc} - */ - public function deleteMetadata($key = '', $domain = 'messages') - { - if ('' == $domain) { - $this->metadata = array(); - } elseif ('' == $key) { - unset($this->metadata[$domain]); - } else { - unset($this->metadata[$domain][$key]); - } - } - - /** - * Adds current values with the new values. - * - * @param array $values Values to add - */ - private function addMetadata(array $values) - { - foreach ($values as $domain => $keys) { - foreach ($keys as $key => $value) { - $this->setMetadata($key, $value, $domain); - } - } - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/translation/MessageCatalogueInterface.php b/sitecake/2.2.9/server/vendor/symfony/translation/MessageCatalogueInterface.php deleted file mode 100644 index 647e337..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/translation/MessageCatalogueInterface.php +++ /dev/null @@ -1,172 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation; - -use Symfony\Component\Config\Resource\ResourceInterface; - -/** - * MessageCatalogueInterface. - * - * @author Fabien Potencier - * - * @api - */ -interface MessageCatalogueInterface -{ - /** - * Gets the catalogue locale. - * - * @return string The locale - * - * @api - */ - public function getLocale(); - - /** - * Gets the domains. - * - * @return array An array of domains - * - * @api - */ - public function getDomains(); - - /** - * Gets the messages within a given domain. - * - * If $domain is null, it returns all messages. - * - * @param string $domain The domain name - * - * @return array An array of messages - * - * @api - */ - public function all($domain = null); - - /** - * Sets a message translation. - * - * @param string $id The message id - * @param string $translation The messages translation - * @param string $domain The domain name - * - * @api - */ - public function set($id, $translation, $domain = 'messages'); - - /** - * Checks if a message has a translation. - * - * @param string $id The message id - * @param string $domain The domain name - * - * @return bool true if the message has a translation, false otherwise - * - * @api - */ - public function has($id, $domain = 'messages'); - - /** - * Checks if a message has a translation (it does not take into account the fallback mechanism). - * - * @param string $id The message id - * @param string $domain The domain name - * - * @return bool true if the message has a translation, false otherwise - * - * @api - */ - public function defines($id, $domain = 'messages'); - - /** - * Gets a message translation. - * - * @param string $id The message id - * @param string $domain The domain name - * - * @return string The message translation - * - * @api - */ - public function get($id, $domain = 'messages'); - - /** - * Sets translations for a given domain. - * - * @param array $messages An array of translations - * @param string $domain The domain name - * - * @api - */ - public function replace($messages, $domain = 'messages'); - - /** - * Adds translations for a given domain. - * - * @param array $messages An array of translations - * @param string $domain The domain name - * - * @api - */ - public function add($messages, $domain = 'messages'); - - /** - * Merges translations from the given Catalogue into the current one. - * - * The two catalogues must have the same locale. - * - * @param MessageCatalogueInterface $catalogue A MessageCatalogueInterface instance - * - * @api - */ - public function addCatalogue(MessageCatalogueInterface $catalogue); - - /** - * Merges translations from the given Catalogue into the current one - * only when the translation does not exist. - * - * This is used to provide default translations when they do not exist for the current locale. - * - * @param MessageCatalogueInterface $catalogue A MessageCatalogueInterface instance - * - * @api - */ - public function addFallbackCatalogue(MessageCatalogueInterface $catalogue); - - /** - * Gets the fallback catalogue. - * - * @return MessageCatalogueInterface|null A MessageCatalogueInterface instance or null when no fallback has been set - * - * @api - */ - public function getFallbackCatalogue(); - - /** - * Returns an array of resources loaded to build this collection. - * - * @return ResourceInterface[] An array of resources - * - * @api - */ - public function getResources(); - - /** - * Adds a resource for this collection. - * - * @param ResourceInterface $resource A resource instance - * - * @api - */ - public function addResource(ResourceInterface $resource); -} diff --git a/sitecake/2.2.9/server/vendor/symfony/translation/MessageSelector.php b/sitecake/2.2.9/server/vendor/symfony/translation/MessageSelector.php deleted file mode 100644 index f7fde31..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/translation/MessageSelector.php +++ /dev/null @@ -1,90 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation; - -/** - * MessageSelector. - * - * @author Fabien Potencier - * @author Bernhard Schussek - * - * @api - */ -class MessageSelector -{ - /** - * Given a message with different plural translations separated by a - * pipe (|), this method returns the correct portion of the message based - * on the given number, locale and the pluralization rules in the message - * itself. - * - * The message supports two different types of pluralization rules: - * - * interval: {0} There are no apples|{1} There is one apple|]1,Inf] There are %count% apples - * indexed: There is one apple|There are %count% apples - * - * The indexed solution can also contain labels (e.g. one: There is one apple). - * This is purely for making the translations more clear - it does not - * affect the functionality. - * - * The two methods can also be mixed: - * {0} There are no apples|one: There is one apple|more: There are %count% apples - * - * @param string $message The message being translated - * @param int $number The number of items represented for the message - * @param string $locale The locale to use for choosing - * - * @return string - * - * @throws \InvalidArgumentException - * - * @api - */ - public function choose($message, $number, $locale) - { - $parts = explode('|', $message); - $explicitRules = array(); - $standardRules = array(); - foreach ($parts as $part) { - $part = trim($part); - - if (preg_match('/^(?P'.Interval::getIntervalRegexp().')\s*(?P.*?)$/xs', $part, $matches)) { - $explicitRules[$matches['interval']] = $matches['message']; - } elseif (preg_match('/^\w+\:\s*(.*?)$/', $part, $matches)) { - $standardRules[] = $matches[1]; - } else { - $standardRules[] = $part; - } - } - - // try to match an explicit rule, then fallback to the standard ones - foreach ($explicitRules as $interval => $m) { - if (Interval::test($number, $interval)) { - return $m; - } - } - - $position = PluralizationRules::get($number, $locale); - - if (!isset($standardRules[$position])) { - // when there's exactly one rule given, and that rule is a standard - // rule, use this rule - if (1 === count($parts) && isset($standardRules[0])) { - return $standardRules[0]; - } - - throw new \InvalidArgumentException(sprintf('Unable to choose a translation for "%s" with locale "%s" for value "%d". Double check that this translation has the correct plural options (e.g. "There is one apple|There are %%count%% apples").', $message, $locale, $number)); - } - - return $standardRules[$position]; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/translation/MetadataAwareInterface.php b/sitecake/2.2.9/server/vendor/symfony/translation/MetadataAwareInterface.php deleted file mode 100644 index e93c6fb..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/translation/MetadataAwareInterface.php +++ /dev/null @@ -1,54 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation; - -/** - * MetadataAwareInterface. - * - * @author Fabien Potencier - */ -interface MetadataAwareInterface -{ - /** - * Gets metadata for the given domain and key. - * - * Passing an empty domain will return an array with all metadata indexed by - * domain and then by key. Passing an empty key will return an array with all - * metadata for the given domain. - * - * @param string $key The key - * @param string $domain The domain name - * - * @return mixed The value that was set or an array with the domains/keys or null - */ - public function getMetadata($key = '', $domain = 'messages'); - - /** - * Adds metadata to a message domain. - * - * @param string $key The key - * @param mixed $value The value - * @param string $domain The domain name - */ - public function setMetadata($key, $value, $domain = 'messages'); - - /** - * Deletes metadata for the given key and domain. - * - * Passing an empty domain will delete all metadata. Passing an empty key will - * delete all metadata for the given domain. - * - * @param string $key The key - * @param string $domain The domain name - */ - public function deleteMetadata($key = '', $domain = 'messages'); -} diff --git a/sitecake/2.2.9/server/vendor/symfony/translation/PluralizationRules.php b/sitecake/2.2.9/server/vendor/symfony/translation/PluralizationRules.php deleted file mode 100644 index e1eac82..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/translation/PluralizationRules.php +++ /dev/null @@ -1,214 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation; - -/** - * Returns the plural rules for a given locale. - * - * @author Fabien Potencier - */ -class PluralizationRules -{ - private static $rules = array(); - - /** - * Returns the plural position to use for the given locale and number. - * - * @param int $number The number - * @param string $locale The locale - * - * @return int The plural position - */ - public static function get($number, $locale) - { - if ('pt_BR' === $locale) { - // temporary set a locale for brazilian - $locale = 'xbr'; - } - - if (strlen($locale) > 3) { - $locale = substr($locale, 0, -strlen(strrchr($locale, '_'))); - } - - if (isset(self::$rules[$locale])) { - $return = call_user_func(self::$rules[$locale], $number); - - if (!is_int($return) || $return < 0) { - return 0; - } - - return $return; - } - - /* - * The plural rules are derived from code of the Zend Framework (2010-09-25), - * which is subject to the new BSD license (http://framework.zend.com/license/new-bsd). - * Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - */ - switch ($locale) { - case 'bo': - case 'dz': - case 'id': - case 'ja': - case 'jv': - case 'ka': - case 'km': - case 'kn': - case 'ko': - case 'ms': - case 'th': - case 'tr': - case 'vi': - case 'zh': - return 0; - break; - - case 'af': - case 'az': - case 'bn': - case 'bg': - case 'ca': - case 'da': - case 'de': - case 'el': - case 'en': - case 'eo': - case 'es': - case 'et': - case 'eu': - case 'fa': - case 'fi': - case 'fo': - case 'fur': - case 'fy': - case 'gl': - case 'gu': - case 'ha': - case 'he': - case 'hu': - case 'is': - case 'it': - case 'ku': - case 'lb': - case 'ml': - case 'mn': - case 'mr': - case 'nah': - case 'nb': - case 'ne': - case 'nl': - case 'nn': - case 'no': - case 'om': - case 'or': - case 'pa': - case 'pap': - case 'ps': - case 'pt': - case 'so': - case 'sq': - case 'sv': - case 'sw': - case 'ta': - case 'te': - case 'tk': - case 'ur': - case 'zu': - return ($number == 1) ? 0 : 1; - - case 'am': - case 'bh': - case 'fil': - case 'fr': - case 'gun': - case 'hi': - case 'ln': - case 'mg': - case 'nso': - case 'xbr': - case 'ti': - case 'wa': - return (($number == 0) || ($number == 1)) ? 0 : 1; - - case 'be': - case 'bs': - case 'hr': - case 'ru': - case 'sr': - case 'uk': - return (($number % 10 == 1) && ($number % 100 != 11)) ? 0 : ((($number % 10 >= 2) && ($number % 10 <= 4) && (($number % 100 < 10) || ($number % 100 >= 20))) ? 1 : 2); - - case 'cs': - case 'sk': - return ($number == 1) ? 0 : ((($number >= 2) && ($number <= 4)) ? 1 : 2); - - case 'ga': - return ($number == 1) ? 0 : (($number == 2) ? 1 : 2); - - case 'lt': - return (($number % 10 == 1) && ($number % 100 != 11)) ? 0 : ((($number % 10 >= 2) && (($number % 100 < 10) || ($number % 100 >= 20))) ? 1 : 2); - - case 'sl': - return ($number % 100 == 1) ? 0 : (($number % 100 == 2) ? 1 : ((($number % 100 == 3) || ($number % 100 == 4)) ? 2 : 3)); - - case 'mk': - return ($number % 10 == 1) ? 0 : 1; - - case 'mt': - return ($number == 1) ? 0 : ((($number == 0) || (($number % 100 > 1) && ($number % 100 < 11))) ? 1 : ((($number % 100 > 10) && ($number % 100 < 20)) ? 2 : 3)); - - case 'lv': - return ($number == 0) ? 0 : ((($number % 10 == 1) && ($number % 100 != 11)) ? 1 : 2); - - case 'pl': - return ($number == 1) ? 0 : ((($number % 10 >= 2) && ($number % 10 <= 4) && (($number % 100 < 12) || ($number % 100 > 14))) ? 1 : 2); - - case 'cy': - return ($number == 1) ? 0 : (($number == 2) ? 1 : ((($number == 8) || ($number == 11)) ? 2 : 3)); - - case 'ro': - return ($number == 1) ? 0 : ((($number == 0) || (($number % 100 > 0) && ($number % 100 < 20))) ? 1 : 2); - - case 'ar': - return ($number == 0) ? 0 : (($number == 1) ? 1 : (($number == 2) ? 2 : ((($number % 100 >= 3) && ($number % 100 <= 10)) ? 3 : ((($number % 100 >= 11) && ($number % 100 <= 99)) ? 4 : 5)))); - - default: - return 0; - } - } - - /** - * Overrides the default plural rule for a given locale. - * - * @param string $rule A PHP callable - * @param string $locale The locale - * - * @throws \LogicException - */ - public static function set($rule, $locale) - { - if ('pt_BR' === $locale) { - // temporary set a locale for brazilian - $locale = 'xbr'; - } - - if (strlen($locale) > 3) { - $locale = substr($locale, 0, -strlen(strrchr($locale, '_'))); - } - - if (!is_callable($rule)) { - throw new \LogicException('The given rule can not be called'); - } - - self::$rules[$locale] = $rule; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/translation/README.md b/sitecake/2.2.9/server/vendor/symfony/translation/README.md deleted file mode 100644 index 2b00862..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/translation/README.md +++ /dev/null @@ -1,37 +0,0 @@ -Translation Component -===================== - -Translation provides tools for loading translation files and generating -translated strings from these including support for pluralization. - -```php -use Symfony\Component\Translation\Translator; -use Symfony\Component\Translation\MessageSelector; -use Symfony\Component\Translation\Loader\ArrayLoader; - -$translator = new Translator('fr_FR', new MessageSelector()); -$translator->setFallbackLocales(array('fr')); -$translator->addLoader('array', new ArrayLoader()); -$translator->addResource('array', array( - 'Hello World!' => 'Bonjour', -), 'fr'); - -echo $translator->trans('Hello World!')."\n"; -``` - -Resources ---------- - -Silex integration: - -https://github.com/fabpot/Silex/blob/master/src/Silex/Provider/TranslationServiceProvider.php - -Documentation: - -https://symfony.com/doc/2.7/book/translation.html - -You can run the unit tests with the following command: - - $ cd path/to/Symfony/Component/Translation/ - $ composer install - $ phpunit diff --git a/sitecake/2.2.9/server/vendor/symfony/translation/Translator.php b/sitecake/2.2.9/server/vendor/symfony/translation/Translator.php deleted file mode 100644 index 9b1b735..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/translation/Translator.php +++ /dev/null @@ -1,499 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation; - -use Symfony\Component\Translation\Loader\LoaderInterface; -use Symfony\Component\Translation\Exception\NotFoundResourceException; -use Symfony\Component\Config\ConfigCacheInterface; -use Symfony\Component\Config\ConfigCacheFactoryInterface; -use Symfony\Component\Config\ConfigCacheFactory; - -/** - * Translator. - * - * @author Fabien Potencier - * - * @api - */ -class Translator implements TranslatorInterface, TranslatorBagInterface -{ - /** - * @var MessageCatalogueInterface[] - */ - protected $catalogues = array(); - - /** - * @var string - */ - protected $locale; - - /** - * @var array - */ - private $fallbackLocales = array(); - - /** - * @var LoaderInterface[] - */ - private $loaders = array(); - - /** - * @var array - */ - private $resources = array(); - - /** - * @var MessageSelector - */ - private $selector; - - /** - * @var string - */ - private $cacheDir; - - /** - * @var bool - */ - private $debug; - - /** - * @var ConfigCacheFactoryInterface|null - */ - private $configCacheFactory; - - /** - * Constructor. - * - * @param string $locale The locale - * @param MessageSelector|null $selector The message selector for pluralization - * @param string|null $cacheDir The directory to use for the cache - * @param bool $debug Use cache in debug mode ? - * - * @throws \InvalidArgumentException If a locale contains invalid characters - * - * @api - */ - public function __construct($locale, MessageSelector $selector = null, $cacheDir = null, $debug = false) - { - $this->setLocale($locale); - $this->selector = $selector ?: new MessageSelector(); - $this->cacheDir = $cacheDir; - $this->debug = $debug; - } - - /** - * Sets the ConfigCache factory to use. - * - * @param ConfigCacheFactoryInterface $configCacheFactory - */ - public function setConfigCacheFactory(ConfigCacheFactoryInterface $configCacheFactory) - { - $this->configCacheFactory = $configCacheFactory; - } - - /** - * Adds a Loader. - * - * @param string $format The name of the loader (@see addResource()) - * @param LoaderInterface $loader A LoaderInterface instance - * - * @api - */ - public function addLoader($format, LoaderInterface $loader) - { - $this->loaders[$format] = $loader; - } - - /** - * Adds a Resource. - * - * @param string $format The name of the loader (@see addLoader()) - * @param mixed $resource The resource name - * @param string $locale The locale - * @param string $domain The domain - * - * @throws \InvalidArgumentException If the locale contains invalid characters - * - * @api - */ - public function addResource($format, $resource, $locale, $domain = null) - { - if (null === $domain) { - $domain = 'messages'; - } - - $this->assertValidLocale($locale); - - $this->resources[$locale][] = array($format, $resource, $domain); - - if (in_array($locale, $this->fallbackLocales)) { - $this->catalogues = array(); - } else { - unset($this->catalogues[$locale]); - } - } - - /** - * {@inheritdoc} - * - * @api - */ - public function setLocale($locale) - { - $this->assertValidLocale($locale); - $this->locale = $locale; - } - - /** - * {@inheritdoc} - * - * @api - */ - public function getLocale() - { - return $this->locale; - } - - /** - * Sets the fallback locale(s). - * - * @param string|array $locales The fallback locale(s) - * - * @throws \InvalidArgumentException If a locale contains invalid characters - * - * @deprecated since version 2.3, to be removed in 3.0. Use setFallbackLocales() instead. - * - * @api - */ - public function setFallbackLocale($locales) - { - @trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0. Use the setFallbackLocales() method instead.', E_USER_DEPRECATED); - - $this->setFallbackLocales(is_array($locales) ? $locales : array($locales)); - } - - /** - * Sets the fallback locales. - * - * @param array $locales The fallback locales - * - * @throws \InvalidArgumentException If a locale contains invalid characters - * - * @api - */ - public function setFallbackLocales(array $locales) - { - // needed as the fallback locales are linked to the already loaded catalogues - $this->catalogues = array(); - - foreach ($locales as $locale) { - $this->assertValidLocale($locale); - } - - $this->fallbackLocales = $locales; - } - - /** - * Gets the fallback locales. - * - * @return array $locales The fallback locales - * - * @api - */ - public function getFallbackLocales() - { - return $this->fallbackLocales; - } - - /** - * {@inheritdoc} - * - * @api - */ - public function trans($id, array $parameters = array(), $domain = null, $locale = null) - { - if (null === $domain) { - $domain = 'messages'; - } - - return strtr($this->getCatalogue($locale)->get((string) $id, $domain), $parameters); - } - - /** - * {@inheritdoc} - * - * @api - */ - public function transChoice($id, $number, array $parameters = array(), $domain = null, $locale = null) - { - if (null === $domain) { - $domain = 'messages'; - } - - $id = (string) $id; - $catalogue = $this->getCatalogue($locale); - $locale = $catalogue->getLocale(); - while (!$catalogue->defines($id, $domain)) { - if ($cat = $catalogue->getFallbackCatalogue()) { - $catalogue = $cat; - $locale = $catalogue->getLocale(); - } else { - break; - } - } - - return strtr($this->selector->choose($catalogue->get($id, $domain), (int) $number, $locale), $parameters); - } - - /** - * {@inheritdoc} - */ - public function getCatalogue($locale = null) - { - if (null === $locale) { - $locale = $this->getLocale(); - } else { - $this->assertValidLocale($locale); - } - - if (!isset($this->catalogues[$locale])) { - $this->loadCatalogue($locale); - } - - return $this->catalogues[$locale]; - } - - /** - * Gets the loaders. - * - * @return array LoaderInterface[] - */ - protected function getLoaders() - { - return $this->loaders; - } - - /** - * Collects all messages for the given locale. - * - * @param string|null $locale Locale of translations, by default is current locale - * - * @return array[array] indexed by catalog - */ - public function getMessages($locale = null) - { - $catalogue = $this->getCatalogue($locale); - $messages = $catalogue->all(); - while ($catalogue = $catalogue->getFallbackCatalogue()) { - $messages = array_replace_recursive($catalogue->all(), $messages); - } - - return $messages; - } - - /** - * @param string $locale - */ - protected function loadCatalogue($locale) - { - if (null === $this->cacheDir) { - $this->initializeCatalogue($locale); - } else { - $this->initializeCacheCatalogue($locale); - } - } - - /** - * @param string $locale - */ - protected function initializeCatalogue($locale) - { - $this->assertValidLocale($locale); - - try { - $this->doLoadCatalogue($locale); - } catch (NotFoundResourceException $e) { - if (!$this->computeFallbackLocales($locale)) { - throw $e; - } - } - $this->loadFallbackCatalogues($locale); - } - - /** - * @param string $locale - */ - private function initializeCacheCatalogue($locale) - { - if (isset($this->catalogues[$locale])) { - /* Catalogue already initialized. */ - return; - } - - $this->assertValidLocale($locale); - $self = $this; // required for PHP 5.3 where "$this" cannot be use()d in anonymous functions. Change in Symfony 3.0. - $cache = $this->getConfigCacheFactory()->cache($this->getCatalogueCachePath($locale), - function (ConfigCacheInterface $cache) use ($self, $locale) { - $self->dumpCatalogue($locale, $cache); - } - ); - - if (isset($this->catalogues[$locale])) { - /* Catalogue has been initialized as it was written out to cache. */ - return; - } - - /* Read catalogue from cache. */ - $this->catalogues[$locale] = include $cache->getPath(); - } - - /** - * This method is public because it needs to be callable from a closure in PHP 5.3. It should be made protected (or even private, if possible) in 3.0. - * - * @internal - */ - public function dumpCatalogue($locale, ConfigCacheInterface $cache) - { - $this->initializeCatalogue($locale); - $fallbackContent = $this->getFallbackContent($this->catalogues[$locale]); - - $content = sprintf(<<catalogues[$locale]->all(), true), - $fallbackContent - ); - - $cache->write($content, $this->catalogues[$locale]->getResources()); - } - - private function getFallbackContent(MessageCatalogue $catalogue) - { - $fallbackContent = ''; - $current = ''; - $replacementPattern = '/[^a-z0-9_]/i'; - $fallbackCatalogue = $catalogue->getFallbackCatalogue(); - while ($fallbackCatalogue) { - $fallback = $fallbackCatalogue->getLocale(); - $fallbackSuffix = ucfirst(preg_replace($replacementPattern, '_', $fallback)); - $currentSuffix = ucfirst(preg_replace($replacementPattern, '_', $current)); - - $fallbackContent .= sprintf(<<addFallbackCatalogue(\$catalogue%s); - -EOF - , - $fallbackSuffix, - $fallback, - var_export($fallbackCatalogue->all(), true), - $currentSuffix, - $fallbackSuffix - ); - $current = $fallbackCatalogue->getLocale(); - $fallbackCatalogue = $fallbackCatalogue->getFallbackCatalogue(); - } - - return $fallbackContent; - } - - private function getCatalogueCachePath($locale) - { - return $this->cacheDir.'/catalogue.'.$locale.'.'.sha1(serialize($this->fallbackLocales)).'.php'; - } - - private function doLoadCatalogue($locale) - { - $this->catalogues[$locale] = new MessageCatalogue($locale); - - if (isset($this->resources[$locale])) { - foreach ($this->resources[$locale] as $resource) { - if (!isset($this->loaders[$resource[0]])) { - throw new \RuntimeException(sprintf('The "%s" translation loader is not registered.', $resource[0])); - } - $this->catalogues[$locale]->addCatalogue($this->loaders[$resource[0]]->load($resource[1], $locale, $resource[2])); - } - } - } - - private function loadFallbackCatalogues($locale) - { - $current = $this->catalogues[$locale]; - - foreach ($this->computeFallbackLocales($locale) as $fallback) { - if (!isset($this->catalogues[$fallback])) { - $this->doLoadCatalogue($fallback); - } - - $current->addFallbackCatalogue($this->catalogues[$fallback]); - $current = $this->catalogues[$fallback]; - } - } - - protected function computeFallbackLocales($locale) - { - $locales = array(); - foreach ($this->fallbackLocales as $fallback) { - if ($fallback === $locale) { - continue; - } - - $locales[] = $fallback; - } - - if (strrchr($locale, '_') !== false) { - array_unshift($locales, substr($locale, 0, -strlen(strrchr($locale, '_')))); - } - - return array_unique($locales); - } - - /** - * Asserts that the locale is valid, throws an Exception if not. - * - * @param string $locale Locale to tests - * - * @throws \InvalidArgumentException If the locale contains invalid characters - */ - protected function assertValidLocale($locale) - { - if (1 !== preg_match('/^[a-z0-9@_\\.\\-]*$/i', $locale)) { - throw new \InvalidArgumentException(sprintf('Invalid "%s" locale.', $locale)); - } - } - - /** - * Provides the ConfigCache factory implementation, falling back to a - * default implementation if necessary. - * - * @return ConfigCacheFactoryInterface $configCacheFactory - */ - private function getConfigCacheFactory() - { - if (!$this->configCacheFactory) { - $this->configCacheFactory = new ConfigCacheFactory($this->debug); - } - - return $this->configCacheFactory; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/translation/TranslatorBagInterface.php b/sitecake/2.2.9/server/vendor/symfony/translation/TranslatorBagInterface.php deleted file mode 100644 index 6f650b5..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/translation/TranslatorBagInterface.php +++ /dev/null @@ -1,31 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation; - -/** - * TranslatorBagInterface. - * - * @author Abdellatif Ait boudad - */ -interface TranslatorBagInterface -{ - /** - * Gets the catalogue by locale. - * - * @param string|null $locale The locale or null to use the default - * - * @throws \InvalidArgumentException If the locale contains invalid characters - * - * @return MessageCatalogueInterface - */ - public function getCatalogue($locale = null); -} diff --git a/sitecake/2.2.9/server/vendor/symfony/translation/TranslatorInterface.php b/sitecake/2.2.9/server/vendor/symfony/translation/TranslatorInterface.php deleted file mode 100644 index fe1a865..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/translation/TranslatorInterface.php +++ /dev/null @@ -1,75 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation; - -/** - * TranslatorInterface. - * - * @author Fabien Potencier - * - * @api - */ -interface TranslatorInterface -{ - /** - * Translates the given message. - * - * @param string $id The message id (may also be an object that can be cast to string) - * @param array $parameters An array of parameters for the message - * @param string|null $domain The domain for the message or null to use the default - * @param string|null $locale The locale or null to use the default - * - * @throws \InvalidArgumentException If the locale contains invalid characters - * - * @return string The translated string - * - * @api - */ - public function trans($id, array $parameters = array(), $domain = null, $locale = null); - - /** - * Translates the given choice message by choosing a translation according to a number. - * - * @param string $id The message id (may also be an object that can be cast to string) - * @param int $number The number to use to find the indice of the message - * @param array $parameters An array of parameters for the message - * @param string|null $domain The domain for the message or null to use the default - * @param string|null $locale The locale or null to use the default - * - * @throws \InvalidArgumentException If the locale contains invalid characters - * - * @return string The translated string - * - * @api - */ - public function transChoice($id, $number, array $parameters = array(), $domain = null, $locale = null); - - /** - * Sets the current locale. - * - * @param string $locale The locale - * - * @throws \InvalidArgumentException If the locale contains invalid characters - * - * @api - */ - public function setLocale($locale); - - /** - * Returns the current locale. - * - * @return string The locale - * - * @api - */ - public function getLocale(); -} diff --git a/sitecake/2.2.9/server/vendor/symfony/translation/Writer/TranslationWriter.php b/sitecake/2.2.9/server/vendor/symfony/translation/Writer/TranslationWriter.php deleted file mode 100644 index 44ac182..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/translation/Writer/TranslationWriter.php +++ /dev/null @@ -1,87 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Writer; - -use Symfony\Component\Translation\MessageCatalogue; -use Symfony\Component\Translation\Dumper\DumperInterface; - -/** - * TranslationWriter writes translation messages. - * - * @author Michel Salib - */ -class TranslationWriter -{ - /** - * Dumpers used for export. - * - * @var array - */ - private $dumpers = array(); - - /** - * Adds a dumper to the writer. - * - * @param string $format The format of the dumper - * @param DumperInterface $dumper The dumper - */ - public function addDumper($format, DumperInterface $dumper) - { - $this->dumpers[$format] = $dumper; - } - - /** - * Disables dumper backup. - */ - public function disableBackup() - { - foreach ($this->dumpers as $dumper) { - $dumper->setBackup(false); - } - } - - /** - * Obtains the list of supported formats. - * - * @return array - */ - public function getFormats() - { - return array_keys($this->dumpers); - } - - /** - * Writes translation from the catalogue according to the selected format. - * - * @param MessageCatalogue $catalogue The message catalogue to dump - * @param string $format The format to use to dump the messages - * @param array $options Options that are passed to the dumper - * - * @throws \InvalidArgumentException - */ - public function writeTranslations(MessageCatalogue $catalogue, $format, $options = array()) - { - if (!isset($this->dumpers[$format])) { - throw new \InvalidArgumentException(sprintf('There is no dumper associated with format "%s".', $format)); - } - - // get the right dumper - $dumper = $this->dumpers[$format]; - - if (isset($options['path']) && !is_dir($options['path'])) { - mkdir($options['path'], 0777, true); - } - - // save - $dumper->dump($catalogue, $options); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/translation/composer.json b/sitecake/2.2.9/server/vendor/symfony/translation/composer.json deleted file mode 100644 index 6f1053e..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/translation/composer.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "name": "symfony/translation", - "type": "library", - "description": "Symfony Translation Component", - "keywords": [], - "homepage": "https://symfony.com", - "license": "MIT", - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "require": { - "php": ">=5.3.9" - }, - "require-dev": { - "symfony/phpunit-bridge": "~2.7", - "symfony/config": "~2.7", - "symfony/intl": "~2.3", - "symfony/yaml": "~2.2", - "psr/log": "~1.0" - }, - "conflict": { - "symfony/config": "<2.7" - }, - "suggest": { - "symfony/config": "", - "symfony/yaml": "", - "psr/log": "To use logging capability in translator" - }, - "autoload": { - "psr-4": { "Symfony\\Component\\Translation\\": "" } - }, - "minimum-stability": "dev", - "extra": { - "branch-alias": { - "dev-master": "2.7-dev" - } - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/translation/phpunit.xml.dist b/sitecake/2.2.9/server/vendor/symfony/translation/phpunit.xml.dist deleted file mode 100644 index 16cca4a..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/translation/phpunit.xml.dist +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - ./Tests/ - - - - - - ./ - - ./vendor - ./Tests - - - - diff --git a/sitecake/2.2.9/server/vendor/symfony/yaml/CHANGELOG.md b/sitecake/2.2.9/server/vendor/symfony/yaml/CHANGELOG.md deleted file mode 100644 index 096cf65..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/yaml/CHANGELOG.md +++ /dev/null @@ -1,8 +0,0 @@ -CHANGELOG -========= - -2.1.0 ------ - - * Yaml::parse() does not evaluate loaded files as PHP files by default - anymore (call Yaml::enablePhpParsing() to get back the old behavior) diff --git a/sitecake/2.2.9/server/vendor/symfony/yaml/Dumper.php b/sitecake/2.2.9/server/vendor/symfony/yaml/Dumper.php deleted file mode 100644 index 39cdcfc..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/yaml/Dumper.php +++ /dev/null @@ -1,73 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Yaml; - -/** - * Dumper dumps PHP variables to YAML strings. - * - * @author Fabien Potencier - */ -class Dumper -{ - /** - * The amount of spaces to use for indentation of nested nodes. - * - * @var int - */ - protected $indentation = 4; - - /** - * Sets the indentation. - * - * @param int $num The amount of spaces to use for indentation of nested nodes. - */ - public function setIndentation($num) - { - $this->indentation = (int) $num; - } - - /** - * Dumps a PHP value to YAML. - * - * @param mixed $input The PHP value - * @param int $inline The level where you switch to inline YAML - * @param int $indent The level of indentation (used internally) - * @param bool $exceptionOnInvalidType true if an exception must be thrown on invalid types (a PHP resource or object), false otherwise - * @param bool $objectSupport true if object support is enabled, false otherwise - * - * @return string The YAML representation of the PHP value - */ - public function dump($input, $inline = 0, $indent = 0, $exceptionOnInvalidType = false, $objectSupport = false) - { - $output = ''; - $prefix = $indent ? str_repeat(' ', $indent) : ''; - - if ($inline <= 0 || !is_array($input) || empty($input)) { - $output .= $prefix.Inline::dump($input, $exceptionOnInvalidType, $objectSupport); - } else { - $isAHash = array_keys($input) !== range(0, count($input) - 1); - - foreach ($input as $key => $value) { - $willBeInlined = $inline - 1 <= 0 || !is_array($value) || empty($value); - - $output .= sprintf('%s%s%s%s', - $prefix, - $isAHash ? Inline::dump($key, $exceptionOnInvalidType, $objectSupport).':' : '-', - $willBeInlined ? ' ' : "\n", - $this->dump($value, $inline - 1, $willBeInlined ? 0 : $indent + $this->indentation, $exceptionOnInvalidType, $objectSupport) - ).($willBeInlined ? "\n" : ''); - } - } - - return $output; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/yaml/Escaper.php b/sitecake/2.2.9/server/vendor/symfony/yaml/Escaper.php deleted file mode 100644 index ac325a2..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/yaml/Escaper.php +++ /dev/null @@ -1,97 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Yaml; - -/** - * Escaper encapsulates escaping rules for single and double-quoted - * YAML strings. - * - * @author Matthew Lewinski - */ -class Escaper -{ - // Characters that would cause a dumped string to require double quoting. - const REGEX_CHARACTER_TO_ESCAPE = "[\\x00-\\x1f]|\xc2\x85|\xc2\xa0|\xe2\x80\xa8|\xe2\x80\xa9"; - - // Mapping arrays for escaping a double quoted string. The backslash is - // first to ensure proper escaping because str_replace operates iteratively - // on the input arrays. This ordering of the characters avoids the use of strtr, - // which performs more slowly. - private static $escapees = array('\\', '\\\\', '\\"', '"', - "\x00", "\x01", "\x02", "\x03", "\x04", "\x05", "\x06", "\x07", - "\x08", "\x09", "\x0a", "\x0b", "\x0c", "\x0d", "\x0e", "\x0f", - "\x10", "\x11", "\x12", "\x13", "\x14", "\x15", "\x16", "\x17", - "\x18", "\x19", "\x1a", "\x1b", "\x1c", "\x1d", "\x1e", "\x1f", - "\xc2\x85", "\xc2\xa0", "\xe2\x80\xa8", "\xe2\x80\xa9",); - private static $escaped = array('\\\\', '\\"', '\\\\', '\\"', - '\\0', '\\x01', '\\x02', '\\x03', '\\x04', '\\x05', '\\x06', '\\a', - '\\b', '\\t', '\\n', '\\v', '\\f', '\\r', '\\x0e', '\\x0f', - '\\x10', '\\x11', '\\x12', '\\x13', '\\x14', '\\x15', '\\x16', '\\x17', - '\\x18', '\\x19', '\\x1a', '\\e', '\\x1c', '\\x1d', '\\x1e', '\\x1f', - '\\N', '\\_', '\\L', '\\P',); - - /** - * Determines if a PHP value would require double quoting in YAML. - * - * @param string $value A PHP value - * - * @return bool True if the value would require double quotes. - */ - public static function requiresDoubleQuoting($value) - { - return preg_match('/'.self::REGEX_CHARACTER_TO_ESCAPE.'/u', $value); - } - - /** - * Escapes and surrounds a PHP value with double quotes. - * - * @param string $value A PHP value - * - * @return string The quoted, escaped string - */ - public static function escapeWithDoubleQuotes($value) - { - return sprintf('"%s"', str_replace(self::$escapees, self::$escaped, $value)); - } - - /** - * Determines if a PHP value would require single quoting in YAML. - * - * @param string $value A PHP value - * - * @return bool True if the value would require single quotes. - */ - public static function requiresSingleQuoting($value) - { - // Determines if a PHP value is entirely composed of a value that would - // require single quoting in YAML. - if (in_array(strtolower($value), array('null', '~', 'true', 'false', 'y', 'n', 'yes', 'no', 'on', 'off'))) { - return true; - } - - // Determines if the PHP value contains any single characters that would - // cause it to require single quoting in YAML. - return preg_match('/[ \s \' " \: \{ \} \[ \] , & \* \# \?] | \A[ \- ? | < > = ! % @ ` ]/x', $value); - } - - /** - * Escapes and surrounds a PHP value with single quotes. - * - * @param string $value A PHP value - * - * @return string The quoted, escaped string - */ - public static function escapeWithSingleQuotes($value) - { - return sprintf("'%s'", str_replace('\'', '\'\'', $value)); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/yaml/Exception/DumpException.php b/sitecake/2.2.9/server/vendor/symfony/yaml/Exception/DumpException.php deleted file mode 100644 index 9b3e6de..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/yaml/Exception/DumpException.php +++ /dev/null @@ -1,23 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Yaml\Exception; - -/** - * Exception class thrown when an error occurs during dumping. - * - * @author Fabien Potencier - * - * @api - */ -class DumpException extends RuntimeException -{ -} diff --git a/sitecake/2.2.9/server/vendor/symfony/yaml/Exception/ExceptionInterface.php b/sitecake/2.2.9/server/vendor/symfony/yaml/Exception/ExceptionInterface.php deleted file mode 100644 index 92e5c2e..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/yaml/Exception/ExceptionInterface.php +++ /dev/null @@ -1,23 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Yaml\Exception; - -/** - * Exception interface for all exceptions thrown by the component. - * - * @author Fabien Potencier - * - * @api - */ -interface ExceptionInterface -{ -} diff --git a/sitecake/2.2.9/server/vendor/symfony/yaml/Exception/ParseException.php b/sitecake/2.2.9/server/vendor/symfony/yaml/Exception/ParseException.php deleted file mode 100644 index 0447dff..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/yaml/Exception/ParseException.php +++ /dev/null @@ -1,148 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Yaml\Exception; - -/** - * Exception class thrown when an error occurs during parsing. - * - * @author Fabien Potencier - * - * @api - */ -class ParseException extends RuntimeException -{ - private $parsedFile; - private $parsedLine; - private $snippet; - private $rawMessage; - - /** - * Constructor. - * - * @param string $message The error message - * @param int $parsedLine The line where the error occurred - * @param int $snippet The snippet of code near the problem - * @param string $parsedFile The file name where the error occurred - * @param \Exception $previous The previous exception - */ - public function __construct($message, $parsedLine = -1, $snippet = null, $parsedFile = null, \Exception $previous = null) - { - $this->parsedFile = $parsedFile; - $this->parsedLine = $parsedLine; - $this->snippet = $snippet; - $this->rawMessage = $message; - - $this->updateRepr(); - - parent::__construct($this->message, 0, $previous); - } - - /** - * Gets the snippet of code near the error. - * - * @return string The snippet of code - */ - public function getSnippet() - { - return $this->snippet; - } - - /** - * Sets the snippet of code near the error. - * - * @param string $snippet The code snippet - */ - public function setSnippet($snippet) - { - $this->snippet = $snippet; - - $this->updateRepr(); - } - - /** - * Gets the filename where the error occurred. - * - * This method returns null if a string is parsed. - * - * @return string The filename - */ - public function getParsedFile() - { - return $this->parsedFile; - } - - /** - * Sets the filename where the error occurred. - * - * @param string $parsedFile The filename - */ - public function setParsedFile($parsedFile) - { - $this->parsedFile = $parsedFile; - - $this->updateRepr(); - } - - /** - * Gets the line where the error occurred. - * - * @return int The file line - */ - public function getParsedLine() - { - return $this->parsedLine; - } - - /** - * Sets the line where the error occurred. - * - * @param int $parsedLine The file line - */ - public function setParsedLine($parsedLine) - { - $this->parsedLine = $parsedLine; - - $this->updateRepr(); - } - - private function updateRepr() - { - $this->message = $this->rawMessage; - - $dot = false; - if ('.' === substr($this->message, -1)) { - $this->message = substr($this->message, 0, -1); - $dot = true; - } - - if (null !== $this->parsedFile) { - if (PHP_VERSION_ID >= 50400) { - $jsonOptions = JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE; - } else { - $jsonOptions = 0; - } - $this->message .= sprintf(' in %s', json_encode($this->parsedFile, $jsonOptions)); - } - - if ($this->parsedLine >= 0) { - $this->message .= sprintf(' at line %d', $this->parsedLine); - } - - if ($this->snippet) { - $this->message .= sprintf(' (near "%s")', $this->snippet); - } - - if ($dot) { - $this->message .= '.'; - } - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/yaml/Exception/RuntimeException.php b/sitecake/2.2.9/server/vendor/symfony/yaml/Exception/RuntimeException.php deleted file mode 100644 index 3573bf1..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/yaml/Exception/RuntimeException.php +++ /dev/null @@ -1,23 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Yaml\Exception; - -/** - * Exception class thrown when an error occurs during parsing. - * - * @author Romain Neutron - * - * @api - */ -class RuntimeException extends \RuntimeException implements ExceptionInterface -{ -} diff --git a/sitecake/2.2.9/server/vendor/symfony/yaml/Inline.php b/sitecake/2.2.9/server/vendor/symfony/yaml/Inline.php deleted file mode 100644 index 52ea724..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/yaml/Inline.php +++ /dev/null @@ -1,546 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Yaml; - -use Symfony\Component\Yaml\Exception\ParseException; -use Symfony\Component\Yaml\Exception\DumpException; - -/** - * Inline implements a YAML parser/dumper for the YAML inline syntax. - * - * @author Fabien Potencier - */ -class Inline -{ - const REGEX_QUOTED_STRING = '(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"|\'([^\']*(?:\'\'[^\']*)*)\')'; - - private static $exceptionOnInvalidType = false; - private static $objectSupport = false; - private static $objectForMap = false; - - /** - * Converts a YAML string to a PHP array. - * - * @param string $value A YAML string - * @param bool $exceptionOnInvalidType true if an exception must be thrown on invalid types (a PHP resource or object), false otherwise - * @param bool $objectSupport true if object support is enabled, false otherwise - * @param bool $objectForMap true if maps should return a stdClass instead of array() - * @param array $references Mapping of variable names to values - * - * @return array A PHP array representing the YAML string - * - * @throws ParseException - */ - public static function parse($value, $exceptionOnInvalidType = false, $objectSupport = false, $objectForMap = false, $references = array()) - { - self::$exceptionOnInvalidType = $exceptionOnInvalidType; - self::$objectSupport = $objectSupport; - self::$objectForMap = $objectForMap; - - $value = trim($value); - - if (0 == strlen($value)) { - return ''; - } - - if (function_exists('mb_internal_encoding') && ((int) ini_get('mbstring.func_overload')) & 2) { - $mbEncoding = mb_internal_encoding(); - mb_internal_encoding('ASCII'); - } - - $i = 0; - switch ($value[0]) { - case '[': - $result = self::parseSequence($value, $i, $references); - ++$i; - break; - case '{': - $result = self::parseMapping($value, $i, $references); - ++$i; - break; - default: - $result = self::parseScalar($value, null, array('"', "'"), $i, true, $references); - } - - // some comments are allowed at the end - if (preg_replace('/\s+#.*$/A', '', substr($value, $i))) { - throw new ParseException(sprintf('Unexpected characters near "%s".', substr($value, $i))); - } - - if (isset($mbEncoding)) { - mb_internal_encoding($mbEncoding); - } - - return $result; - } - - /** - * Dumps a given PHP variable to a YAML string. - * - * @param mixed $value The PHP variable to convert - * @param bool $exceptionOnInvalidType true if an exception must be thrown on invalid types (a PHP resource or object), false otherwise - * @param bool $objectSupport true if object support is enabled, false otherwise - * - * @return string The YAML string representing the PHP array - * - * @throws DumpException When trying to dump PHP resource - */ - public static function dump($value, $exceptionOnInvalidType = false, $objectSupport = false) - { - switch (true) { - case is_resource($value): - if ($exceptionOnInvalidType) { - throw new DumpException(sprintf('Unable to dump PHP resources in a YAML file ("%s").', get_resource_type($value))); - } - - return 'null'; - case is_object($value): - if ($objectSupport) { - return '!!php/object:'.serialize($value); - } - - if ($exceptionOnInvalidType) { - throw new DumpException('Object support when dumping a YAML file has been disabled.'); - } - - return 'null'; - case is_array($value): - return self::dumpArray($value, $exceptionOnInvalidType, $objectSupport); - case null === $value: - return 'null'; - case true === $value: - return 'true'; - case false === $value: - return 'false'; - case ctype_digit($value): - return is_string($value) ? "'$value'" : (int) $value; - case is_numeric($value): - $locale = setlocale(LC_NUMERIC, 0); - if (false !== $locale) { - setlocale(LC_NUMERIC, 'C'); - } - if (is_float($value)) { - $repr = (string) $value; - if (is_infinite($value)) { - $repr = str_ireplace('INF', '.Inf', $repr); - } elseif (floor($value) == $value && $repr == $value) { - // Preserve float data type since storing a whole number will result in integer value. - $repr = '!!float '.$repr; - } - } else { - $repr = is_string($value) ? "'$value'" : (string) $value; - } - if (false !== $locale) { - setlocale(LC_NUMERIC, $locale); - } - - return $repr; - case '' == $value: - return "''"; - case Escaper::requiresDoubleQuoting($value): - return Escaper::escapeWithDoubleQuotes($value); - case Escaper::requiresSingleQuoting($value): - case preg_match(self::getHexRegex(), $value): - case preg_match(self::getTimestampRegex(), $value): - return Escaper::escapeWithSingleQuotes($value); - default: - return $value; - } - } - - /** - * Dumps a PHP array to a YAML string. - * - * @param array $value The PHP array to dump - * @param bool $exceptionOnInvalidType true if an exception must be thrown on invalid types (a PHP resource or object), false otherwise - * @param bool $objectSupport true if object support is enabled, false otherwise - * - * @return string The YAML string representing the PHP array - */ - private static function dumpArray($value, $exceptionOnInvalidType, $objectSupport) - { - // array - $keys = array_keys($value); - $keysCount = count($keys); - if ((1 === $keysCount && '0' == $keys[0]) - || ($keysCount > 1 && array_reduce($keys, function ($v, $w) { return (int) $v + $w; }, 0) === $keysCount * ($keysCount - 1) / 2) - ) { - $output = array(); - foreach ($value as $val) { - $output[] = self::dump($val, $exceptionOnInvalidType, $objectSupport); - } - - return sprintf('[%s]', implode(', ', $output)); - } - - // mapping - $output = array(); - foreach ($value as $key => $val) { - $output[] = sprintf('%s: %s', self::dump($key, $exceptionOnInvalidType, $objectSupport), self::dump($val, $exceptionOnInvalidType, $objectSupport)); - } - - return sprintf('{ %s }', implode(', ', $output)); - } - - /** - * Parses a scalar to a YAML string. - * - * @param string $scalar - * @param string $delimiters - * @param array $stringDelimiters - * @param int &$i - * @param bool $evaluate - * @param array $references - * - * @return string A YAML string - * - * @throws ParseException When malformed inline YAML string is parsed - */ - public static function parseScalar($scalar, $delimiters = null, $stringDelimiters = array('"', "'"), &$i = 0, $evaluate = true, $references = array()) - { - if (in_array($scalar[$i], $stringDelimiters)) { - // quoted scalar - $output = self::parseQuotedScalar($scalar, $i); - - if (null !== $delimiters) { - $tmp = ltrim(substr($scalar, $i), ' '); - if (!in_array($tmp[0], $delimiters)) { - throw new ParseException(sprintf('Unexpected characters (%s).', substr($scalar, $i))); - } - } - } else { - // "normal" string - if (!$delimiters) { - $output = substr($scalar, $i); - $i += strlen($output); - - // remove comments - if (false !== $strpos = strpos($output, ' #')) { - $output = rtrim(substr($output, 0, $strpos)); - } - } elseif (preg_match('/^(.+?)('.implode('|', $delimiters).')/', substr($scalar, $i), $match)) { - $output = $match[1]; - $i += strlen($output); - } else { - throw new ParseException(sprintf('Malformed inline YAML string (%s).', $scalar)); - } - - if ($evaluate) { - $output = self::evaluateScalar($output, $references); - } - } - - return $output; - } - - /** - * Parses a quoted scalar to YAML. - * - * @param string $scalar - * @param int &$i - * - * @return string A YAML string - * - * @throws ParseException When malformed inline YAML string is parsed - */ - private static function parseQuotedScalar($scalar, &$i) - { - if (!preg_match('/'.self::REGEX_QUOTED_STRING.'/Au', substr($scalar, $i), $match)) { - throw new ParseException(sprintf('Malformed inline YAML string (%s).', substr($scalar, $i))); - } - - $output = substr($match[0], 1, strlen($match[0]) - 2); - - $unescaper = new Unescaper(); - if ('"' == $scalar[$i]) { - $output = $unescaper->unescapeDoubleQuotedString($output); - } else { - $output = $unescaper->unescapeSingleQuotedString($output); - } - - $i += strlen($match[0]); - - return $output; - } - - /** - * Parses a sequence to a YAML string. - * - * @param string $sequence - * @param int &$i - * @param array $references - * - * @return string A YAML string - * - * @throws ParseException When malformed inline YAML string is parsed - */ - private static function parseSequence($sequence, &$i = 0, $references = array()) - { - $output = array(); - $len = strlen($sequence); - ++$i; - - // [foo, bar, ...] - while ($i < $len) { - switch ($sequence[$i]) { - case '[': - // nested sequence - $output[] = self::parseSequence($sequence, $i, $references); - break; - case '{': - // nested mapping - $output[] = self::parseMapping($sequence, $i, $references); - break; - case ']': - return $output; - case ',': - case ' ': - break; - default: - $isQuoted = in_array($sequence[$i], array('"', "'")); - $value = self::parseScalar($sequence, array(',', ']'), array('"', "'"), $i, true, $references); - - // the value can be an array if a reference has been resolved to an array var - if (!is_array($value) && !$isQuoted && false !== strpos($value, ': ')) { - // embedded mapping? - try { - $pos = 0; - $value = self::parseMapping('{'.$value.'}', $pos, $references); - } catch (\InvalidArgumentException $e) { - // no, it's not - } - } - - $output[] = $value; - - --$i; - } - - ++$i; - } - - throw new ParseException(sprintf('Malformed inline YAML string %s', $sequence)); - } - - /** - * Parses a mapping to a YAML string. - * - * @param string $mapping - * @param int &$i - * @param array $references - * - * @return string A YAML string - * - * @throws ParseException When malformed inline YAML string is parsed - */ - private static function parseMapping($mapping, &$i = 0, $references = array()) - { - $output = array(); - $len = strlen($mapping); - ++$i; - - // {foo: bar, bar:foo, ...} - while ($i < $len) { - switch ($mapping[$i]) { - case ' ': - case ',': - ++$i; - continue 2; - case '}': - if (self::$objectForMap) { - return (object) $output; - } - - return $output; - } - - // key - $key = self::parseScalar($mapping, array(':', ' '), array('"', "'"), $i, false); - - // value - $done = false; - - while ($i < $len) { - switch ($mapping[$i]) { - case '[': - // nested sequence - $value = self::parseSequence($mapping, $i, $references); - // Spec: Keys MUST be unique; first one wins. - // Parser cannot abort this mapping earlier, since lines - // are processed sequentially. - if (!isset($output[$key])) { - $output[$key] = $value; - } - $done = true; - break; - case '{': - // nested mapping - $value = self::parseMapping($mapping, $i, $references); - // Spec: Keys MUST be unique; first one wins. - // Parser cannot abort this mapping earlier, since lines - // are processed sequentially. - if (!isset($output[$key])) { - $output[$key] = $value; - } - $done = true; - break; - case ':': - case ' ': - break; - default: - $value = self::parseScalar($mapping, array(',', '}'), array('"', "'"), $i, true, $references); - // Spec: Keys MUST be unique; first one wins. - // Parser cannot abort this mapping earlier, since lines - // are processed sequentially. - if (!isset($output[$key])) { - $output[$key] = $value; - } - $done = true; - --$i; - } - - ++$i; - - if ($done) { - continue 2; - } - } - } - - throw new ParseException(sprintf('Malformed inline YAML string %s', $mapping)); - } - - /** - * Evaluates scalars and replaces magic values. - * - * @param string $scalar - * @param array $references - * - * @return string A YAML string - * - * @throws ParseException when object parsing support was disabled and the parser detected a PHP object or when a reference could not be resolved - */ - private static function evaluateScalar($scalar, $references = array()) - { - $scalar = trim($scalar); - $scalarLower = strtolower($scalar); - - if (0 === strpos($scalar, '*')) { - if (false !== $pos = strpos($scalar, '#')) { - $value = substr($scalar, 1, $pos - 2); - } else { - $value = substr($scalar, 1); - } - - // an unquoted * - if (false === $value || '' === $value) { - throw new ParseException('A reference must contain at least one character.'); - } - - if (!array_key_exists($value, $references)) { - throw new ParseException(sprintf('Reference "%s" does not exist.', $value)); - } - - return $references[$value]; - } - - switch (true) { - case 'null' === $scalarLower: - case '' === $scalar: - case '~' === $scalar: - return; - case 'true' === $scalarLower: - return true; - case 'false' === $scalarLower: - return false; - // Optimise for returning strings. - case $scalar[0] === '+' || $scalar[0] === '-' || $scalar[0] === '.' || $scalar[0] === '!' || is_numeric($scalar[0]): - switch (true) { - case 0 === strpos($scalar, '!str'): - return (string) substr($scalar, 5); - case 0 === strpos($scalar, '! '): - return (int) self::parseScalar(substr($scalar, 2)); - case 0 === strpos($scalar, '!!php/object:'): - if (self::$objectSupport) { - return unserialize(substr($scalar, 13)); - } - - if (self::$exceptionOnInvalidType) { - throw new ParseException('Object support when parsing a YAML file has been disabled.'); - } - - return; - case 0 === strpos($scalar, '!!float '): - return (float) substr($scalar, 8); - case ctype_digit($scalar): - $raw = $scalar; - $cast = (int) $scalar; - - return '0' == $scalar[0] ? octdec($scalar) : (((string) $raw == (string) $cast) ? $cast : $raw); - case '-' === $scalar[0] && ctype_digit(substr($scalar, 1)): - $raw = $scalar; - $cast = (int) $scalar; - - return '0' == $scalar[1] ? octdec($scalar) : (((string) $raw === (string) $cast) ? $cast : $raw); - case is_numeric($scalar): - case preg_match(self::getHexRegex(), $scalar): - return '0x' === $scalar[0].$scalar[1] ? hexdec($scalar) : (float) $scalar; - case '.inf' === $scalarLower: - case '.nan' === $scalarLower: - return -log(0); - case '-.inf' === $scalarLower: - return log(0); - case preg_match('/^(-|\+)?[0-9,]+(\.[0-9]+)?$/', $scalar): - return (float) str_replace(',', '', $scalar); - case preg_match(self::getTimestampRegex(), $scalar): - return strtotime($scalar); - } - default: - return (string) $scalar; - } - } - - /** - * Gets a regex that matches a YAML date. - * - * @return string The regular expression - * - * @see http://www.yaml.org/spec/1.2/spec.html#id2761573 - */ - private static function getTimestampRegex() - { - return <<[0-9][0-9][0-9][0-9]) - -(?P[0-9][0-9]?) - -(?P[0-9][0-9]?) - (?:(?:[Tt]|[ \t]+) - (?P[0-9][0-9]?) - :(?P[0-9][0-9]) - :(?P[0-9][0-9]) - (?:\.(?P[0-9]*))? - (?:[ \t]*(?PZ|(?P[-+])(?P[0-9][0-9]?) - (?::(?P[0-9][0-9]))?))?)? - $~x -EOF; - } - - /** - * Gets a regex that matches a YAML number in hexadecimal notation. - * - * @return string - */ - private static function getHexRegex() - { - return '~^0x[0-9a-f]++$~i'; - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/yaml/LICENSE b/sitecake/2.2.9/server/vendor/symfony/yaml/LICENSE deleted file mode 100644 index 43028bc..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/yaml/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2004-2015 Fabien Potencier - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/sitecake/2.2.9/server/vendor/symfony/yaml/Parser.php b/sitecake/2.2.9/server/vendor/symfony/yaml/Parser.php deleted file mode 100644 index d72c763..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/yaml/Parser.php +++ /dev/null @@ -1,697 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Yaml; - -use Symfony\Component\Yaml\Exception\ParseException; - -/** - * Parser parses YAML strings to convert them to PHP arrays. - * - * @author Fabien Potencier - */ -class Parser -{ - const FOLDED_SCALAR_PATTERN = '(?P\||>)(?P\+|\-|\d+|\+\d+|\-\d+|\d+\+|\d+\-)?(?P +#.*)?'; - - private $offset = 0; - private $lines = array(); - private $currentLineNb = -1; - private $currentLine = ''; - private $refs = array(); - - /** - * Constructor. - * - * @param int $offset The offset of YAML document (used for line numbers in error messages) - */ - public function __construct($offset = 0) - { - $this->offset = $offset; - } - - /** - * Parses a YAML string to a PHP value. - * - * @param string $value A YAML string - * @param bool $exceptionOnInvalidType true if an exception must be thrown on invalid types (a PHP resource or object), false otherwise - * @param bool $objectSupport true if object support is enabled, false otherwise - * @param bool $objectForMap true if maps should return a stdClass instead of array() - * - * @return mixed A PHP value - * - * @throws ParseException If the YAML is not valid - */ - public function parse($value, $exceptionOnInvalidType = false, $objectSupport = false, $objectForMap = false) - { - if (!preg_match('//u', $value)) { - throw new ParseException('The YAML value does not appear to be valid UTF-8.'); - } - $this->currentLineNb = -1; - $this->currentLine = ''; - $value = $this->cleanup($value); - $this->lines = explode("\n", $value); - - if (function_exists('mb_internal_encoding') && ((int) ini_get('mbstring.func_overload')) & 2) { - $mbEncoding = mb_internal_encoding(); - mb_internal_encoding('UTF-8'); - } - - $data = array(); - $context = null; - $allowOverwrite = false; - while ($this->moveToNextLine()) { - if ($this->isCurrentLineEmpty()) { - continue; - } - - // tab? - if ("\t" === $this->currentLine[0]) { - throw new ParseException('A YAML file cannot contain tabs as indentation.', $this->getRealCurrentLineNb() + 1, $this->currentLine); - } - - $isRef = $mergeNode = false; - if (preg_match('#^\-((?P\s+)(?P.+?))?\s*$#u', $this->currentLine, $values)) { - if ($context && 'mapping' == $context) { - throw new ParseException('You cannot define a sequence item when in a mapping'); - } - $context = 'sequence'; - - if (isset($values['value']) && preg_match('#^&(?P[^ ]+) *(?P.*)#u', $values['value'], $matches)) { - $isRef = $matches['ref']; - $values['value'] = $matches['value']; - } - - // array - if (!isset($values['value']) || '' == trim($values['value'], ' ') || 0 === strpos(ltrim($values['value'], ' '), '#')) { - $c = $this->getRealCurrentLineNb() + 1; - $parser = new self($c); - $parser->refs = &$this->refs; - $data[] = $parser->parse($this->getNextEmbedBlock(null, true), $exceptionOnInvalidType, $objectSupport, $objectForMap); - } else { - if (isset($values['leadspaces']) - && preg_match('#^(?P'.Inline::REGEX_QUOTED_STRING.'|[^ \'"\{\[].*?) *\:(\s+(?P.+?))?\s*$#u', $values['value'], $matches) - ) { - // this is a compact notation element, add to next block and parse - $c = $this->getRealCurrentLineNb(); - $parser = new self($c); - $parser->refs = &$this->refs; - - $block = $values['value']; - if ($this->isNextLineIndented()) { - $block .= "\n".$this->getNextEmbedBlock($this->getCurrentLineIndentation() + strlen($values['leadspaces']) + 1); - } - - $data[] = $parser->parse($block, $exceptionOnInvalidType, $objectSupport, $objectForMap); - } else { - $data[] = $this->parseValue($values['value'], $exceptionOnInvalidType, $objectSupport, $objectForMap); - } - } - } elseif (preg_match('#^(?P'.Inline::REGEX_QUOTED_STRING.'|[^ \'"\[\{].*?) *\:(\s+(?P.+?))?\s*$#u', $this->currentLine, $values) && (false === strpos($values['key'], ' #') || in_array($values['key'][0], array('"', "'")))) { - if ($context && 'sequence' == $context) { - throw new ParseException('You cannot define a mapping item when in a sequence'); - } - $context = 'mapping'; - - // force correct settings - Inline::parse(null, $exceptionOnInvalidType, $objectSupport, $objectForMap, $this->refs); - try { - $key = Inline::parseScalar($values['key']); - } catch (ParseException $e) { - $e->setParsedLine($this->getRealCurrentLineNb() + 1); - $e->setSnippet($this->currentLine); - - throw $e; - } - - if ('<<' === $key) { - $mergeNode = true; - $allowOverwrite = true; - if (isset($values['value']) && 0 === strpos($values['value'], '*')) { - $refName = substr($values['value'], 1); - if (!array_key_exists($refName, $this->refs)) { - throw new ParseException(sprintf('Reference "%s" does not exist.', $refName), $this->getRealCurrentLineNb() + 1, $this->currentLine); - } - - $refValue = $this->refs[$refName]; - - if (!is_array($refValue)) { - throw new ParseException('YAML merge keys used with a scalar value instead of an array.', $this->getRealCurrentLineNb() + 1, $this->currentLine); - } - - foreach ($refValue as $key => $value) { - if (!isset($data[$key])) { - $data[$key] = $value; - } - } - } else { - if (isset($values['value']) && $values['value'] !== '') { - $value = $values['value']; - } else { - $value = $this->getNextEmbedBlock(); - } - $c = $this->getRealCurrentLineNb() + 1; - $parser = new self($c); - $parser->refs = &$this->refs; - $parsed = $parser->parse($value, $exceptionOnInvalidType, $objectSupport, $objectForMap); - - if (!is_array($parsed)) { - throw new ParseException('YAML merge keys used with a scalar value instead of an array.', $this->getRealCurrentLineNb() + 1, $this->currentLine); - } - - if (isset($parsed[0])) { - // If the value associated with the merge key is a sequence, then this sequence is expected to contain mapping nodes - // and each of these nodes is merged in turn according to its order in the sequence. Keys in mapping nodes earlier - // in the sequence override keys specified in later mapping nodes. - foreach ($parsed as $parsedItem) { - if (!is_array($parsedItem)) { - throw new ParseException('Merge items must be arrays.', $this->getRealCurrentLineNb() + 1, $parsedItem); - } - - foreach ($parsedItem as $key => $value) { - if (!isset($data[$key])) { - $data[$key] = $value; - } - } - } - } else { - // If the value associated with the key is a single mapping node, each of its key/value pairs is inserted into the - // current mapping, unless the key already exists in it. - foreach ($parsed as $key => $value) { - if (!isset($data[$key])) { - $data[$key] = $value; - } - } - } - } - } elseif (isset($values['value']) && preg_match('#^&(?P[^ ]+) *(?P.*)#u', $values['value'], $matches)) { - $isRef = $matches['ref']; - $values['value'] = $matches['value']; - } - - if ($mergeNode) { - // Merge keys - } elseif (!isset($values['value']) || '' == trim($values['value'], ' ') || 0 === strpos(ltrim($values['value'], ' '), '#')) { - // hash - // if next line is less indented or equal, then it means that the current value is null - if (!$this->isNextLineIndented() && !$this->isNextLineUnIndentedCollection()) { - // Spec: Keys MUST be unique; first one wins. - // But overwriting is allowed when a merge node is used in current block. - if ($allowOverwrite || !isset($data[$key])) { - $data[$key] = null; - } - } else { - $c = $this->getRealCurrentLineNb() + 1; - $parser = new self($c); - $parser->refs = &$this->refs; - $value = $parser->parse($this->getNextEmbedBlock(), $exceptionOnInvalidType, $objectSupport, $objectForMap); - // Spec: Keys MUST be unique; first one wins. - // But overwriting is allowed when a merge node is used in current block. - if ($allowOverwrite || !isset($data[$key])) { - $data[$key] = $value; - } - } - } else { - $value = $this->parseValue($values['value'], $exceptionOnInvalidType, $objectSupport, $objectForMap); - // Spec: Keys MUST be unique; first one wins. - // But overwriting is allowed when a merge node is used in current block. - if ($allowOverwrite || !isset($data[$key])) { - $data[$key] = $value; - } - } - } else { - // multiple documents are not supported - if ('---' === $this->currentLine) { - throw new ParseException('Multiple documents are not supported.'); - } - - // 1-liner optionally followed by newline(s) - if ($this->lines[0] === trim($value)) { - try { - $value = Inline::parse($this->lines[0], $exceptionOnInvalidType, $objectSupport, $objectForMap, $this->refs); - } catch (ParseException $e) { - $e->setParsedLine($this->getRealCurrentLineNb() + 1); - $e->setSnippet($this->currentLine); - - throw $e; - } - - if (is_array($value)) { - $first = reset($value); - if (is_string($first) && 0 === strpos($first, '*')) { - $data = array(); - foreach ($value as $alias) { - $data[] = $this->refs[substr($alias, 1)]; - } - $value = $data; - } - } - - if (isset($mbEncoding)) { - mb_internal_encoding($mbEncoding); - } - - return $value; - } - - switch (preg_last_error()) { - case PREG_INTERNAL_ERROR: - $error = 'Internal PCRE error.'; - break; - case PREG_BACKTRACK_LIMIT_ERROR: - $error = 'pcre.backtrack_limit reached.'; - break; - case PREG_RECURSION_LIMIT_ERROR: - $error = 'pcre.recursion_limit reached.'; - break; - case PREG_BAD_UTF8_ERROR: - $error = 'Malformed UTF-8 data.'; - break; - case PREG_BAD_UTF8_OFFSET_ERROR: - $error = 'Offset doesn\'t correspond to the begin of a valid UTF-8 code point.'; - break; - default: - $error = 'Unable to parse.'; - } - - throw new ParseException($error, $this->getRealCurrentLineNb() + 1, $this->currentLine); - } - - if ($isRef) { - $this->refs[$isRef] = end($data); - } - } - - if (isset($mbEncoding)) { - mb_internal_encoding($mbEncoding); - } - - return empty($data) ? null : $data; - } - - /** - * Returns the current line number (takes the offset into account). - * - * @return int The current line number - */ - private function getRealCurrentLineNb() - { - return $this->currentLineNb + $this->offset; - } - - /** - * Returns the current line indentation. - * - * @return int The current line indentation - */ - private function getCurrentLineIndentation() - { - return strlen($this->currentLine) - strlen(ltrim($this->currentLine, ' ')); - } - - /** - * Returns the next embed block of YAML. - * - * @param int $indentation The indent level at which the block is to be read, or null for default - * @param bool $inSequence True if the enclosing data structure is a sequence - * - * @return string A YAML string - * - * @throws ParseException When indentation problem are detected - */ - private function getNextEmbedBlock($indentation = null, $inSequence = false) - { - $oldLineIndentation = $this->getCurrentLineIndentation(); - - if (!$this->moveToNextLine()) { - return; - } - - if (null === $indentation) { - $newIndent = $this->getCurrentLineIndentation(); - - $unindentedEmbedBlock = $this->isStringUnIndentedCollectionItem($this->currentLine); - - if (!$this->isCurrentLineEmpty() && 0 === $newIndent && !$unindentedEmbedBlock) { - throw new ParseException('Indentation problem.', $this->getRealCurrentLineNb() + 1, $this->currentLine); - } - } else { - $newIndent = $indentation; - } - - $data = array(); - if ($this->getCurrentLineIndentation() >= $newIndent) { - $data[] = substr($this->currentLine, $newIndent); - } else { - $this->moveToPreviousLine(); - - return; - } - - if ($inSequence && $oldLineIndentation === $newIndent && '-' === $data[0][0]) { - // the previous line contained a dash but no item content, this line is a sequence item with the same indentation - // and therefore no nested list or mapping - $this->moveToPreviousLine(); - - return; - } - - $isItUnindentedCollection = $this->isStringUnIndentedCollectionItem($this->currentLine); - - // Comments must not be removed inside a string block (ie. after a line ending with "|") - $removeCommentsPattern = '~'.self::FOLDED_SCALAR_PATTERN.'$~'; - $removeComments = !preg_match($removeCommentsPattern, $this->currentLine); - - while ($this->moveToNextLine()) { - $indent = $this->getCurrentLineIndentation(); - - if ($indent === $newIndent) { - $removeComments = !preg_match($removeCommentsPattern, $this->currentLine); - } - - if ($isItUnindentedCollection && !$this->isStringUnIndentedCollectionItem($this->currentLine) && $newIndent === $indent) { - $this->moveToPreviousLine(); - break; - } - - if ($this->isCurrentLineBlank()) { - $data[] = substr($this->currentLine, $newIndent); - continue; - } - - if ($removeComments && $this->isCurrentLineComment()) { - continue; - } - - if ($indent >= $newIndent) { - $data[] = substr($this->currentLine, $newIndent); - } elseif (0 == $indent) { - $this->moveToPreviousLine(); - - break; - } else { - throw new ParseException('Indentation problem.', $this->getRealCurrentLineNb() + 1, $this->currentLine); - } - } - - return implode("\n", $data); - } - - /** - * Moves the parser to the next line. - * - * @return bool - */ - private function moveToNextLine() - { - if ($this->currentLineNb >= count($this->lines) - 1) { - return false; - } - - $this->currentLine = $this->lines[++$this->currentLineNb]; - - return true; - } - - /** - * Moves the parser to the previous line. - */ - private function moveToPreviousLine() - { - $this->currentLine = $this->lines[--$this->currentLineNb]; - } - - /** - * Parses a YAML value. - * - * @param string $value A YAML value - * @param bool $exceptionOnInvalidType True if an exception must be thrown on invalid types false otherwise - * @param bool $objectSupport True if object support is enabled, false otherwise - * @param bool $objectForMap true if maps should return a stdClass instead of array() - * - * @return mixed A PHP value - * - * @throws ParseException When reference does not exist - */ - private function parseValue($value, $exceptionOnInvalidType, $objectSupport, $objectForMap) - { - if (0 === strpos($value, '*')) { - if (false !== $pos = strpos($value, '#')) { - $value = substr($value, 1, $pos - 2); - } else { - $value = substr($value, 1); - } - - if (!array_key_exists($value, $this->refs)) { - throw new ParseException(sprintf('Reference "%s" does not exist.', $value), $this->currentLine); - } - - return $this->refs[$value]; - } - - if (preg_match('/^'.self::FOLDED_SCALAR_PATTERN.'$/', $value, $matches)) { - $modifiers = isset($matches['modifiers']) ? $matches['modifiers'] : ''; - - return $this->parseFoldedScalar($matches['separator'], preg_replace('#\d+#', '', $modifiers), (int) abs($modifiers)); - } - - try { - return Inline::parse($value, $exceptionOnInvalidType, $objectSupport, $objectForMap, $this->refs); - } catch (ParseException $e) { - $e->setParsedLine($this->getRealCurrentLineNb() + 1); - $e->setSnippet($this->currentLine); - - throw $e; - } - } - - /** - * Parses a folded scalar. - * - * @param string $separator The separator that was used to begin this folded scalar (| or >) - * @param string $indicator The indicator that was used to begin this folded scalar (+ or -) - * @param int $indentation The indentation that was used to begin this folded scalar - * - * @return string The text value - */ - private function parseFoldedScalar($separator, $indicator = '', $indentation = 0) - { - $notEOF = $this->moveToNextLine(); - if (!$notEOF) { - return ''; - } - - $isCurrentLineBlank = $this->isCurrentLineBlank(); - $text = ''; - - // leading blank lines are consumed before determining indentation - while ($notEOF && $isCurrentLineBlank) { - // newline only if not EOF - if ($notEOF = $this->moveToNextLine()) { - $text .= "\n"; - $isCurrentLineBlank = $this->isCurrentLineBlank(); - } - } - - // determine indentation if not specified - if (0 === $indentation) { - if (preg_match('/^ +/', $this->currentLine, $matches)) { - $indentation = strlen($matches[0]); - } - } - - if ($indentation > 0) { - $pattern = sprintf('/^ {%d}(.*)$/', $indentation); - - while ( - $notEOF && ( - $isCurrentLineBlank || - preg_match($pattern, $this->currentLine, $matches) - ) - ) { - if ($isCurrentLineBlank) { - $text .= substr($this->currentLine, $indentation); - } else { - $text .= $matches[1]; - } - - // newline only if not EOF - if ($notEOF = $this->moveToNextLine()) { - $text .= "\n"; - $isCurrentLineBlank = $this->isCurrentLineBlank(); - } - } - } elseif ($notEOF) { - $text .= "\n"; - } - - if ($notEOF) { - $this->moveToPreviousLine(); - } - - // replace all non-trailing single newlines with spaces in folded blocks - if ('>' === $separator) { - preg_match('/(\n*)$/', $text, $matches); - $text = preg_replace('/(?getCurrentLineIndentation(); - $EOF = !$this->moveToNextLine(); - - while (!$EOF && $this->isCurrentLineEmpty()) { - $EOF = !$this->moveToNextLine(); - } - - if ($EOF) { - return false; - } - - $ret = false; - if ($this->getCurrentLineIndentation() > $currentIndentation) { - $ret = true; - } - - $this->moveToPreviousLine(); - - return $ret; - } - - /** - * Returns true if the current line is blank or if it is a comment line. - * - * @return bool Returns true if the current line is empty or if it is a comment line, false otherwise - */ - private function isCurrentLineEmpty() - { - return $this->isCurrentLineBlank() || $this->isCurrentLineComment(); - } - - /** - * Returns true if the current line is blank. - * - * @return bool Returns true if the current line is blank, false otherwise - */ - private function isCurrentLineBlank() - { - return '' == trim($this->currentLine, ' '); - } - - /** - * Returns true if the current line is a comment line. - * - * @return bool Returns true if the current line is a comment line, false otherwise - */ - private function isCurrentLineComment() - { - //checking explicitly the first char of the trim is faster than loops or strpos - $ltrimmedLine = ltrim($this->currentLine, ' '); - - return $ltrimmedLine[0] === '#'; - } - - /** - * Cleanups a YAML string to be parsed. - * - * @param string $value The input YAML string - * - * @return string A cleaned up YAML string - */ - private function cleanup($value) - { - $value = str_replace(array("\r\n", "\r"), "\n", $value); - - // strip YAML header - $count = 0; - $value = preg_replace('#^\%YAML[: ][\d\.]+.*\n#u', '', $value, -1, $count); - $this->offset += $count; - - // remove leading comments - $trimmedValue = preg_replace('#^(\#.*?\n)+#s', '', $value, -1, $count); - if ($count == 1) { - // items have been removed, update the offset - $this->offset += substr_count($value, "\n") - substr_count($trimmedValue, "\n"); - $value = $trimmedValue; - } - - // remove start of the document marker (---) - $trimmedValue = preg_replace('#^\-\-\-.*?\n#s', '', $value, -1, $count); - if ($count == 1) { - // items have been removed, update the offset - $this->offset += substr_count($value, "\n") - substr_count($trimmedValue, "\n"); - $value = $trimmedValue; - - // remove end of the document marker (...) - $value = preg_replace('#\.\.\.\s*$#s', '', $value); - } - - return $value; - } - - /** - * Returns true if the next line starts unindented collection. - * - * @return bool Returns true if the next line starts unindented collection, false otherwise - */ - private function isNextLineUnIndentedCollection() - { - $currentIndentation = $this->getCurrentLineIndentation(); - $notEOF = $this->moveToNextLine(); - - while ($notEOF && $this->isCurrentLineEmpty()) { - $notEOF = $this->moveToNextLine(); - } - - if (false === $notEOF) { - return false; - } - - $ret = false; - if ( - $this->getCurrentLineIndentation() == $currentIndentation - && - $this->isStringUnIndentedCollectionItem($this->currentLine) - ) { - $ret = true; - } - - $this->moveToPreviousLine(); - - return $ret; - } - - /** - * Returns true if the string is un-indented collection item. - * - * @return bool Returns true if the string is un-indented collection item, false otherwise - */ - private function isStringUnIndentedCollectionItem() - { - return (0 === strpos($this->currentLine, '- ')); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/yaml/README.md b/sitecake/2.2.9/server/vendor/symfony/yaml/README.md deleted file mode 100644 index 85a9786..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/yaml/README.md +++ /dev/null @@ -1,21 +0,0 @@ -Yaml Component -============== - -YAML implements most of the YAML 1.2 specification. - -```php -use Symfony\Component\Yaml\Yaml; - -$array = Yaml::parse(file_get_contents(filename)); - -print Yaml::dump($array); -``` - -Resources ---------- - -You can run the unit tests with the following command: - - $ cd path/to/Symfony/Component/Yaml/ - $ composer install - $ phpunit diff --git a/sitecake/2.2.9/server/vendor/symfony/yaml/Unescaper.php b/sitecake/2.2.9/server/vendor/symfony/yaml/Unescaper.php deleted file mode 100644 index 93206f9..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/yaml/Unescaper.php +++ /dev/null @@ -1,146 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Yaml; - -/** - * Unescaper encapsulates unescaping rules for single and double-quoted - * YAML strings. - * - * @author Matthew Lewinski - */ -class Unescaper -{ - /** - * Parser and Inline assume UTF-8 encoding, so escaped Unicode characters - * must be converted to that encoding. - * - * @deprecated since version 2.5, to be removed in 3.0 - * @internal - */ - const ENCODING = 'UTF-8'; - - /** - * Regex fragment that matches an escaped character in a double quoted string. - */ - const REGEX_ESCAPED_CHARACTER = "\\\\([0abt\tnvfre \\\"\\/\\\\N_LP]|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8})"; - - /** - * Unescapes a single quoted string. - * - * @param string $value A single quoted string. - * - * @return string The unescaped string. - */ - public function unescapeSingleQuotedString($value) - { - return str_replace('\'\'', '\'', $value); - } - - /** - * Unescapes a double quoted string. - * - * @param string $value A double quoted string. - * - * @return string The unescaped string. - */ - public function unescapeDoubleQuotedString($value) - { - $self = $this; - $callback = function ($match) use ($self) { - return $self->unescapeCharacter($match[0]); - }; - - // evaluate the string - return preg_replace_callback('/'.self::REGEX_ESCAPED_CHARACTER.'/u', $callback, $value); - } - - /** - * Unescapes a character that was found in a double-quoted string. - * - * @param string $value An escaped character - * - * @return string The unescaped character - */ - public function unescapeCharacter($value) - { - switch ($value{1}) { - case '0': - return "\x0"; - case 'a': - return "\x7"; - case 'b': - return "\x8"; - case 't': - return "\t"; - case "\t": - return "\t"; - case 'n': - return "\n"; - case 'v': - return "\xB"; - case 'f': - return "\xC"; - case 'r': - return "\r"; - case 'e': - return "\x1B"; - case ' ': - return ' '; - case '"': - return '"'; - case '/': - return '/'; - case '\\': - return '\\'; - case 'N': - // U+0085 NEXT LINE - return "\xC2\x85"; - case '_': - // U+00A0 NO-BREAK SPACE - return "\xC2\xA0"; - case 'L': - // U+2028 LINE SEPARATOR - return "\xE2\x80\xA8"; - case 'P': - // U+2029 PARAGRAPH SEPARATOR - return "\xE2\x80\xA9"; - case 'x': - return self::utf8chr(hexdec(substr($value, 2, 2))); - case 'u': - return self::utf8chr(hexdec(substr($value, 2, 4))); - case 'U': - return self::utf8chr(hexdec(substr($value, 2, 8))); - } - } - - /** - * Get the UTF-8 character for the given code point. - * - * @param int $c The unicode code point - * - * @return string The corresponding UTF-8 character - */ - private static function utf8chr($c) - { - if (0x80 > $c %= 0x200000) { - return chr($c); - } - if (0x800 > $c) { - return chr(0xC0 | $c >> 6).chr(0x80 | $c & 0x3F); - } - if (0x10000 > $c) { - return chr(0xE0 | $c >> 12).chr(0x80 | $c >> 6 & 0x3F).chr(0x80 | $c & 0x3F); - } - - return chr(0xF0 | $c >> 18).chr(0x80 | $c >> 12 & 0x3F).chr(0x80 | $c >> 6 & 0x3F).chr(0x80 | $c & 0x3F); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/yaml/Yaml.php b/sitecake/2.2.9/server/vendor/symfony/yaml/Yaml.php deleted file mode 100644 index b6def51..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/yaml/Yaml.php +++ /dev/null @@ -1,105 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Yaml; - -use Symfony\Component\Yaml\Exception\ParseException; - -/** - * Yaml offers convenience methods to load and dump YAML. - * - * @author Fabien Potencier - * - * @api - */ -class Yaml -{ - /** - * Parses YAML into a PHP array. - * - * The parse method, when supplied with a YAML stream (string or file), - * will do its best to convert YAML in a file into a PHP array. - * - * Usage: - * - * $array = Yaml::parse(file_get_contents('config.yml')); - * print_r($array); - * - * - * As this method accepts both plain strings and file names as an input, - * you must validate the input before calling this method. Passing a file - * as an input is a deprecated feature and will be removed in 3.0. - * - * Note: the ability to pass file names to the Yaml::parse method is deprecated since version 2.2 and will be removed in 3.0. Pass the YAML contents of the file instead. - * - * @param string $input Path to a YAML file or a string containing YAML - * @param bool $exceptionOnInvalidType True if an exception must be thrown on invalid types false otherwise - * @param bool $objectSupport True if object support is enabled, false otherwise - * @param bool $objectForMap True if maps should return a stdClass instead of array() - * - * @return array The YAML converted to a PHP array - * - * @throws ParseException If the YAML is not valid - * - * @api - */ - public static function parse($input, $exceptionOnInvalidType = false, $objectSupport = false, $objectForMap = false) - { - // if input is a file, process it - $file = ''; - if (strpos($input, "\n") === false && is_file($input)) { - @trigger_error('The ability to pass file names to the '.__METHOD__.' method is deprecated since version 2.2 and will be removed in 3.0. Pass the YAML contents of the file instead.', E_USER_DEPRECATED); - - if (false === is_readable($input)) { - throw new ParseException(sprintf('Unable to parse "%s" as the file is not readable.', $input)); - } - - $file = $input; - $input = file_get_contents($file); - } - - $yaml = new Parser(); - - try { - return $yaml->parse($input, $exceptionOnInvalidType, $objectSupport, $objectForMap); - } catch (ParseException $e) { - if ($file) { - $e->setParsedFile($file); - } - - throw $e; - } - } - - /** - * Dumps a PHP array to a YAML string. - * - * The dump method, when supplied with an array, will do its best - * to convert the array into friendly YAML. - * - * @param array $array PHP array - * @param int $inline The level where you switch to inline YAML - * @param int $indent The amount of spaces to use for indentation of nested nodes. - * @param bool $exceptionOnInvalidType true if an exception must be thrown on invalid types (a PHP resource or object), false otherwise - * @param bool $objectSupport true if object support is enabled, false otherwise - * - * @return string A YAML string representing the original PHP array - * - * @api - */ - public static function dump($array, $inline = 2, $indent = 4, $exceptionOnInvalidType = false, $objectSupport = false) - { - $yaml = new Dumper(); - $yaml->setIndentation($indent); - - return $yaml->dump($array, $inline, 0, $exceptionOnInvalidType, $objectSupport); - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/yaml/composer.json b/sitecake/2.2.9/server/vendor/symfony/yaml/composer.json deleted file mode 100644 index b07b439..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/yaml/composer.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "name": "symfony/yaml", - "type": "library", - "description": "Symfony Yaml Component", - "keywords": [], - "homepage": "https://symfony.com", - "license": "MIT", - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "require": { - "php": ">=5.3.9" - }, - "require-dev": { - "symfony/phpunit-bridge": "~2.7" - }, - "autoload": { - "psr-4": { "Symfony\\Component\\Yaml\\": "" } - }, - "minimum-stability": "dev", - "extra": { - "branch-alias": { - "dev-master": "2.7-dev" - } - } -} diff --git a/sitecake/2.2.9/server/vendor/symfony/yaml/phpunit.xml.dist b/sitecake/2.2.9/server/vendor/symfony/yaml/phpunit.xml.dist deleted file mode 100644 index 418b2c6..0000000 --- a/sitecake/2.2.9/server/vendor/symfony/yaml/phpunit.xml.dist +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - ./Tests/ - - - - - - ./ - - ./vendor - ./Tests - - - - diff --git a/sitecake/credential.php.default b/sitecake/credential.php.default deleted file mode 100644 index 781e332..0000000 --- a/sitecake/credential.php.default +++ /dev/null @@ -1,8 +0,0 @@ - \ No newline at end of file diff --git a/sitecake/credentials.php b/sitecake/credentials.php deleted file mode 100644 index c68e295..0000000 --- a/sitecake/credentials.php +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/sitecake/editor.cfg b/sitecake/editor.cfg deleted file mode 100644 index d31dabe..0000000 --- a/sitecake/editor.cfg +++ /dev/null @@ -1,25 +0,0 @@ -# Toolbar configuration -# Toolbar.components - the list of content type available on the toolbar -# Possible components: -# HEADING1 - text - H1 -# HEADING2 - text - H2 -# HEADING3 - text - H3 -# HEADING4 - text - H4 -# HEADING5 - text - H5 -# HEADING6 - text - H6 -# TEXT - text -# TEXTLIST - text list -# IMAGE - image -# FLASH - any flash/swf content -# VIDEO - youtube/vimeo/etc. flash/html5 video -# MAP - google map widget -# HTML - row HTML block -# FILE - generic file upload -# SEP - toolbar decoration separator -Toolbar.components = HEADING1,HEADING2,HEADING3,TEXTLIST,TEXT,SEP,IMAGE,VIDEO,SEP,FLASH,MAP,HTML,FILE - -# upload size limit in KB -FileUploaderItem.uploadSizeLimit = 8192 - -# interface language (en, sl, sr, es, de, fr, dk, it, ru, cs, sk, pt, pt-br, auto) -Locale.code = auto \ No newline at end of file diff --git a/styles/forms.css b/styles/forms.css new file mode 100644 index 0000000..1ed9412 --- /dev/null +++ b/styles/forms.css @@ -0,0 +1,36 @@ +@import url(https://fonts.googleapis.com/css?family=Roboto); + +.wufoo .info h2{ + font-size:200%; + color:#333; +} +.wufoo label.desc, .wufoo legend.desc{ + font-size:150%; + font-weight:normal; + color:#333; +} + +.wufoo input.text{ +/* heght:0px; */ + border-radius:4px; +} + +.wufoo li.focused{ + background-color:white; +} + +form li.buttons input{ + background-color: RoyalBlue; + color: white; + padding: 15px 32px; + text-align: center; + font-size: 24px; + border-radius:4px; + border:none; +} +body{ + font-family: 'Roboto', sans-serif ; +} +.wufoo input.text, .wufoo textarea.textarea, .wufoo input.file, .wufoo select.select{ + font-size:200%; +} \ No newline at end of file diff --git a/styles/style.css b/styles/style.css index 3d44e68..4c9ef8e 100644 --- a/styles/style.css +++ b/styles/style.css @@ -7,6 +7,15 @@ height: 70px; } +.img-partners { + display:inline-block; + margin:25px; +} +.img-partners2 { + margin:0 auto 25px; +} + + #hope { background-color: white; padding-bottom: 20px; @@ -74,7 +83,12 @@ p{ font-size: 100%; } -[id^=section] { +#who-we-are, +#programs, +#team, +#students, +#partners, +#clients { padding-top: 90px; } @@ -167,11 +181,12 @@ p { padding-bottom: 15px; } -#section1, -#section2, -#section3, -#section4, -#section5 { +#who-we-are, +#programs, +#team, +#students, +#partners, +#clients{ margin-bottom: 125px; } @@ -275,7 +290,7 @@ p { z-index: 0; } -.name { +.name, .title { text-align:center } @@ -383,8 +398,8 @@ p { width:100%; height:670px; background-image: - url(../images/black-linen.png), - url(../images/thth.jpg); + url(../images/hero-image-overlay.png), + url(../images/hero-image.jpg); background-color: #fcfcfc; background-size:100%, cover; background-repeat:no-repeat; @@ -448,5 +463,12 @@ p { margin-bottom: 5%; margin-top: 5%; } + +} +@media(max-width: 1024px) { +.img-partners2 { + margin:0px 0px 25px 25px; + width:20%; +} } \ No newline at end of file