Table of Contents
Preface
Chapter 1: CMS Architecture
Chapter 2: Organizing Code
Chapter 3: Database and Data Objects
Chapter 4: Administrators, Users, and Guests
Chapter 5: Sessions and Users
Chapter 6: Caches and Handlers
Chapter 7: Access Control
Chapter 8: Handling Extensions
Chapter 9: Menus
Chapter 10: Languages
Chapter 11: Presentation Services
Chapter 12: Other Services
Chapter 13: SEF and RESTful Services
Chapter 14: Error Handling
Chapter 15: Real Content
Appendix A: Packaging Extensions
Appendix B: Packaging XML Example
Index
- Chapter 1: CMS Architecture
- The idea of a CMS
- Critical CMS features
- Desirable CMS features
- System management
- Technology for CMS building
- Leveraging PHP5
- Some PHP policies
- Globalness in PHP
- Classes and objects
- Objects, patterns, and refactoring
- The object-relational compromise
- Basics of combining PHP and XHTML
- Model, view, and controller
- The CMS environment
- Hosting the CMS
- Basic browser matters
- Security of a CMS
- Some CMS terminology
- Summary
- The idea of a CMS
- Chapter 2: Organizing Code
- The problem
- Discussion and considerations
- Security
- Methods of code inclusion
- Practicality in coding
- Exploring PHP and object design
- Autoloading
- Namespaces and class visibility
- Singletons
- Objections to use of singletons
- Framework solution
- Autoloading
- Finding a path to the class
- Populating the dynamic class map
- Saving map elements
- Obtaining class information
- Summary
- Chapter 3: Database and Data Objects
- The problem
- Discussion and considerations
- Database dependency
- The role of the database
- Level of database abstraction
- Ease of development
- Keeping up with change
- Database security
- Pragmatic error handling
- Exploring PHP—indirect references
- Framework solution
- Class structure
- Connecting to a database
- Handling databases easily
- Prefixing table names in SQL
- Making the database work
- Getting hold of data
- Higher level data access
- Assisted update and insert
- What happened?
- Database extended services
- Getting data about data
- Easier data about data
- Aiding maintenance
- Data objects
- Rudimentary data object methods
- Data object input and output
- Setting data in data objects
- Sequencing database rows
- Database maintenance utility
- Class structure
- Summary
- Chapter 4: Administrators, Users, and Guests
- The problem
- Discussion and considerations
- Who needs users?
- Secure authentication
- Secure storage of passwords
- Blocking SQL injection
- Login
- Managing user data
- User self service
- Customizing for users
- Extended user information
- Exploring PHP—arrays and SQL
- Framework solution
- The user database table
- Indexes on users
- Keeping user tables in step
- Achieving login
- Administering users
- Generating passwords
- Summary
- Chapter 5: Sessions and Users
- The problem
- Discussion and considerations
- Why sessions?
- How sessions work
- Avoiding session vulnerabilities
- Search engine bots
- Session data and scalability
- Exploring PHP—frameworks of classes
- Framework solution
- Building a session handler
- Creating a session
- Finding the IP address
- Validating a session
- Remembering users
- Completing session handling
- Session data
- Session data and bots
- Retrieving session data
- Keeping session data tidy
- Summary
- Chapter 6: Caches and Handlers
- Discussion and considerations
- Why build information handlers?
- The singleton cache
- The disk cache
- Scalability and database cache
- The XHTML cache
- Other caches
- Exploring PHP—static elements and helpers
- Abstract cache class
- Creating the base class cached singleton
- Generalized cache
- Summary
- Discussion and considerations
- Chapter 7: Access Control
- The problem
- Discussion and considerations
- Adding hierarchy
- Adding constraints
- Avoiding unnecessary restrictions
- Some special roles
- Implementation efficiency
- Where are the real difficulties?
- Exploring SQL—MySQL and PHP
- Framework solution
- Database for RBAC
- Administering RBAC
- The general RBAC cache
- Asking RBAC questions
- Summary
- Chapter 8: Handling Extensions
- The problem
- Discussion and considerations
- An extension ecosystem
- Templates in the ecosystem
- Modules in the ecosystem
- Components in the ecosystem
- Component templates
- Modules everywhere
- More on extensions
- Templates
- Modules
- Components
- Plugins
- Extension parameters
- An extension ecosystem
- Exploring PHP—XML handling
- Framework solution
- Packaging extensions
- Module interface and structure
- The logic of module activation
- Component interface and structure
- A standardized component structure
- Plugin interface and structure
- Invoking plugins
- Applications
- Installing and managing extensions
- Structuring installer tasks
- Putting extension files in place
- Extensions and the database
- Knowing about extension classes
- Summary
- Chapter 9: Menus
- The problem
- Discussion and considerations
- Page management by URI
- Menu database requirements
- Menu management
- Menu construction
- Menu presentation
- Exploring PHP—array functions
- Framework solution
- Building the menu handler
- Interfacing to components
- The menu creator
- An example of a menu module
- Summary
- Chapter 10: Languages
- The problem
- Discussion and considerations
- Character sets
- UTF-8 and XHTML
- Specifying languages
- Handling multiple languages in code
- Languages in CMS extensions
- Handling languages in data
- Exploring PHP—character sets
- Framework solution
- The gettext implementation
- File formats for gettext
- Functions for gettext
- The PHPgettext classes
- The language class
- Administrator language application
- Handling extensions
- Managing extension translations
- Installing translations with CMS extensions
- Handling multilingual data
- The gettext implementation
- Summary
- Chapter 11: Presentation Services
- The problem
- Discussion and considerations
- Differing points of view
- Model View Controller
- XHTML, CSS, and themes
- PHP for XHTML creation
- GUI widgets and XHTML
- Page control and navigation
- WYSIWYG editors
- XHTML cleaning
- The administrator interface
- Exploring PHP—clarity and succinctness
- Framework solution
- Using "heredoc" to define XHTML
- Using templating engines
- Some widgets
- Building page control
- Supporting editors
- Cleaning up XHTML
- Administrator database management
- Customization through subclassing
- Summary
- Chapter 12: Other Services
- The problem
- Discussion and considerations
- Parsing XML
- Configuration handling
- WYSIWYG editing
- File and directory handling
- Sending mail
- Parameter objects
- Administrator ready-made functionality
- Exploring PHP—file issues in web hosting
- Basic file and directory permissions
- Hosting and ownership
- Living with split ownership
- Avoiding split ownership
- Framework solution
- Reading XML files easily
- Storing configuration data
- Incorporating a WYSIWYG editor
- Dealing with files and directories
- Compound parameter objects
- Administrator ready-made table handlers
- Summary
- Chapter 13: SEF and RESTful Services
- The problem
- Discussion
- Transforming query strings
- Direct URI handling and REST
- Mechanics of URI handling
- Essential HTTP result codes
- The importance of metadata
- Exploring PHP—PHP and HTTP
- Framework solution
- Efficient lookup of very long keys
- Cache and database transformation
- Looking at SEF transformation code
- Decoding an incoming URI
- Encoding an outgoing URI
- Direct URI handling
- The future of direct URIs
- Summary
- Chapter 14: Error Handling
- The problem
- Discussion
- PHP error handling
- Database errors
- Application errors
- Exploring PHP—error handling
- Framework solution
- Handling database errors
- 404 and 403 errors
- Summary
- Chapter 15: Real Content
- The problem
- Discussion and considerations
- Articles, blogs, magazines, and FAQ
- Comments and reviews
- Forums
- Galleries, repositories, and streaming
- E-commerce and payments
- Forms
- Calendars
- Integrators
- RSS readers
- Other categories
- Exploring technology—accessibility
- General good practice
- Use of JavaScript
- Validation
- Framework solution
- A simple blog application
- The database table for blog
- A blog data object
- Administering blog items—controller
- Administering blog items—viewer
- Showing blogs to visitors
- Menu building
- A simple blog application
- Summary
- Appendix A: Packaging Extensions
- The XML setup file
- Parameters
- Parameter types