PHP APPLICATION Examples

Programming Language: PHP
Class/Type: APPLICATION
Examples at hotexamples.com: 8
PHP is a server-side scripting language commonly used in web development that is easy to learn and offers a wide range of functionalities. Below are some examples and code snippets of PHP applications that are commonly used.

1. Content Management Systems (CMS) - CMS allow website owners to manage their websites easily by organizing, editing and publishing content without needing any programming knowledge. Some popular PHP-based CMS include WordPress, Joomla and Drupal.

Example code for WordPress:






// Start the loop.
while ( have_posts() ) : the_post();

// Include the page content template.
get_template_part( 'template-parts/content', 'page' );

// If comments are open or we have at least one comment, load up the comment template.
if ( comments_open() || get_comments_number() ) :
comments_template();
endif;

// End of the loop.
endwhile;
?>






Package/Library used: WordPress is a complete CMS and includes its own library of functions and modules.

2. E-commerce Websites - E-commerce platforms allow business owners to sell products and services online. PHP frameworks such as Magento, WooCommerce and OpenCart are commonly used for building e-commerce websites.

Example code for WooCommerce:

global $product;

$price = $product->get_regular_price();
$discount = $product->get_sale_price();
?>



$
$

$



Package/Library used: WooCommerce is built on top of WordPress and adds e-commerce functionality to it.

3. Social Networking Websites - PHP is also used for building social networking websites such as Facebook, LinkedIn, Twitter, and Instagram.

Example code for Twitter:

require_once('TwitterAPIExchange.php');

$settings = array(
'oauth_access_token' => "YOUR_OAUTH_ACCESS_TOKEN",
'oauth_access_token_secret' => "YOUR_OAUTH_ACCESS_TOKEN_SECRET",
'consumer_key' => "YOUR_CONSUMER_KEY",
'consumer_secret' => "YOUR_CONSUMER_SECRET"
);

$url = "https://api.twitter.com/1.1/statuses/user_timeline.json";
$requestMethod = "GET";
$getfield = '?screen_name=twitterapi&count=20';
$twitter = new TwitterAPIExchange($settings);
$response = $twitter->setGetfield($getfield)
->buildOauth($url, $requestMethod)
->performRequest();

echo $response;
?>

Package/Library used: TwitterAPIExchange is a package library that allows easy integration with Twitter's API.
PHP APPLICATION - 8 examples found. These are the top rated real world PHP examples of APPLICATION extracted from open source projects. You can rate examples to help us improve the quality of examples.
 /**
  * Add classes to the {@link $classes} object factory.
  * @access private
  */
 protected function _initialize_class_registry()
 {
     parent::_initialize_class_registry();
     $this->register_class('APPLICATION_TABLE_NAMES', 'TEST_HARNESS_APPLICATION_TABLE_NAMES');
 }
 /**
  * Add classes to the {@link $classes} object factory.
  * @access private
  */
 protected function _initialize_class_registry()
 {
     parent::_initialize_class_registry();
     $this->register_class('ENTRY', 'DRAFTABLE_ENTRY', 'webcore/obj/entry.php');
     $this->register_class('EXPLORER_COMMANDS', 'DRAFTABLE_EXPLORER_COMMANDS');
     $this->register_class('MULTIPLE_OBJECT_MOVER_FORM', 'MULTIPLE_DRAFTABLE_OBJECT_MOVER_FORM');
     $this->register_class('FOLDER_ENTRY_QUERY', 'FOLDER_DRAFTABLE_ENTRY_QUERY', 'webcore/db/folder_entry_query.php');
     $this->register_class('USER_ENTRY_QUERY', 'USER_DRAFTABLE_ENTRY_QUERY', 'webcore/db/user_entry_query.php');
 }
 /**
  * Make this application the main application for the given page.
  * @param PAGE $page
  * @param APPLICATION $app
  * @access private
  */
 protected function _apply_to($page, $app)
 {
     /* Set the main name of the page. (this uses a PAGE_TITLE object; see the
      * documentation for more information.) Also sets up some values in the page
      * template.
      */
     $page->title->group = $app->title;
     $page->template_options->title = $app->short_title;
     $page->template_options->app_info = '<a href="' . $app->support_url . '">' . $app->description() . '</a>';
     $page->template_options->icon = $app->resolve_file($app->icon);
     /* Finally, make this the "main" application for the page. */
     $page->app = $app;
 }
 /**
  * Add classes to the {@link $classes} object factory.
  * @access private
  */
 protected function _initialize_class_registry()
 {
     parent::_initialize_class_registry();
     $this->register_class('FOLDER', 'PROJECT', 'projects/obj/project.php');
     $this->register_class('USER', 'PROJECT_USER', 'projects/obj/project_user.php');
     $this->register_class('COMMENT', 'PROJECT_COMMENT', 'projects/obj/project_comment.php');
     $this->register_class('USER_ENTRY_QUERY', 'PROJECT_USER_ENTRY_QUERY', 'projects/db/project_user_entry_query.php');
     $this->register_class('USER_COMMENT_QUERY', 'PROJECT_USER_COMMENT_QUERY', 'projects/db/project_user_comment_query.php');
     $this->register_class('USER_FOLDER_QUERY', 'USER_PROJECT_QUERY', 'projects/db/user_project_query.php');
     $this->register_class('FOLDER_COMMENT_QUERY', 'PROJECT_COMMENT_QUERY', 'projects/db/project_comment_query.php');
     $this->register_class('FOLDER_ENTRY_QUERY', 'PROJECT_ENTRY_QUERY', 'projects/db/project_entry_query.php');
     $this->register_class('FOLDER_GRID', 'PROJECT_GRID', 'projects/gui/project_grid.php');
     $this->register_class('ENTRY_GRID', 'JOB_GRID', 'projects/gui/job_grid.php', 'job');
     $this->register_class('ENTRY_GRID', 'CHANGE_GRID', 'projects/gui/change_grid.php', 'change');
     $this->register_class('ENTRY_FORM', 'JOB_FORM', 'projects/forms/job_form.php', 'job');
     $this->register_class('ENTRY_FORM', 'CHANGE_FORM', 'projects/forms/change_form.php', 'change');
     $this->register_class('FOLDER_FORM', 'PROJECT_FORM', 'projects/forms/project_form.php');
     $this->register_class('MULTIPLE_OBJECT_PRINTER_FORM', 'PROJECT_MULTIPLE_OBJECT_PRINTER_FORM', 'projects/forms/project_multiple_object_printer_form.php', 'change');
     $this->register_class('PRINT_PREVIEW', 'PROJECT_PRINT_PREVIEW', 'projects/gui/project_print_preview.php');
     $this->register_class('ENTRY_SUMMARY_GRID', 'JOB_SUMMARY_GRID', 'projects/gui/job_grid.php', 'job');
     $this->register_class('ENTRY_SUMMARY_GRID', 'CHANGE_SUMMARY_GRID', 'projects/gui/change_grid.php', 'change');
     $this->register_class('ENTRY_LIST', 'JOB_LIST', 'projects/gui/job_list.php', 'job');
     $this->register_class('ENTRY_PANEL', 'JOB_PANEL', 'projects/gui/project_panel.php', 'job');
     $this->register_class('ENTRY_PANEL', 'CHANGE_PANEL', 'projects/gui/project_panel.php', 'change');
     $this->register_class('PUBLISHER', 'PROJECT_PUBLISHER', 'projects/mail/project_publisher.php');
     $this->register_class('APPLICATION_TABLE_NAMES', 'PROJECT_APPLICATION_TABLE_NAMES');
     $this->register_class('APPLICATION_PAGE_NAMES', 'PROJECT_APPLICATION_PAGE_NAMES');
     $this->register_class('CONTEXT_DISPLAY_OPTIONS', 'PROJECT_APPLICATION_DISPLAY_OPTIONS', 'projects/config/project_application_config.php');
     $this->register_class('INDEX_PANEL_MANAGER', 'PROJECT_INDEX_PANEL_MANAGER', 'projects/gui/project_panel.php');
     $this->register_class('FOLDER_PANEL_MANAGER', 'PROJECT_FOLDER_PANEL_MANAGER', 'projects/gui/project_panel.php');
     $this->register_class('USER_PANEL_MANAGER', 'PROJECT_USER_PANEL_MANAGER', 'projects/gui/project_panel.php');
     $this->register_entry_class('job', 'JOB', 'projects/obj/job.php');
     $this->register_entry_class('change', 'CHANGE', 'projects/obj/change.php');
     $this->register_search('job', 'JOB', 'JOB_SEARCH', 'projects/obj/project_search.php');
     $this->register_search('change', 'CHANGE', 'CHANGE_SEARCH', 'projects/obj/project_search.php');
 }
Example #5
0
 /**
  * @param APPLICATION $context Main application.
  */
 public function __construct($context)
 {
     $class_name = $context->final_class_name('SEARCH_FOLDER_FIELDS', 'webcore/forms/search_fields.php');
     parent::__construct($context, new $class_name($context));
 }
Example #6
0
<?php

$has_bootstrap = @(include_once realpath(dirname(__FILE__) . "/../..") . "/framework/boot/bootstrap.inc");
if (!$has_bootstrap) {
    header("location: /unavailable/");
    die;
}
BASE_APPLICATION::initialize_web_application();
$application = APPLICATION::get_instance();
$application->initialize();
$application->process();
 /**
  * Add classes to the {@link $classes} object factory.
  * @access private
  */
 protected function _initialize_class_registry()
 {
     parent::_initialize_class_registry();
     $this->register_class('FOLDER', 'ALBUM', 'albums/obj/album.php');
     $this->register_class('FOLDER_ENTRY_QUERY', 'ALBUM_ENTRY_QUERY', 'albums/db/album_entry_query.php');
     $this->register_class('USER_ENTRY_QUERY', 'ALBUM_USER_ENTRY_QUERY', 'albums/db/album_user_entry_query.php');
     $this->register_class('USER_FOLDER_QUERY', 'USER_ALBUM_QUERY', 'albums/db/user_album_query.php');
     $this->register_class('USER_COMMENT_QUERY', 'USER_MULTI_TYPE_COMMENT_QUERY');
     $this->register_class('FOLDER_COMMENT_QUERY', 'FOLDER_MULTI_TYPE_COMMENT_QUERY');
     $this->register_class('FOLDER_GRID', 'ALBUM_GRID', 'albums/gui/album_grid.php');
     $this->register_class('ENTRY_GRID', 'PICTURE_GRID', 'albums/gui/picture_grid.php', 'picture');
     $this->register_class('ENTRY_GRID', 'JOURNAL_GRID', 'albums/gui/journal_grid.php', 'journal');
     $this->register_class('ENTRY_FORM', 'PICTURE_FORM', 'albums/forms/picture_form.php', 'picture');
     $this->register_class('FOLDER_FORM', 'ALBUM_FORM', 'albums/forms/album_form.php');
     $this->register_class('ENTRY_FORM', 'JOURNAL_FORM', 'albums/forms/journal_form.php', 'journal');
     $this->register_class('PURGE_OBJECT_FORM', 'PURGE_PICTURE_FORM', 'albums/forms/purge_picture_form.php', 'picture');
     $this->register_class('MULTIPLE_OBJECT_MOVER_FORM', 'ALBUM_MULTIPLE_OBJECT_MOVER_FORM', 'albums/forms/album_multiple_object_mover_form.php');
     $this->register_class('MULTIPLE_OBJECT_PRINTER_FORM', 'ALBUM_MULTIPLE_OBJECT_PRINTER_FORM', 'albums/forms/album_multiple_object_printer_form.php');
     $this->register_class('MULTIPLE_OBJECT_PURGER_FORM', 'ALBUM_MULTIPLE_OBJECT_PURGER_FORM', 'albums/forms/album_multiple_object_purger_form.php');
     $this->register_class('PRINT_PREVIEW', 'ALBUM_PRINT_PREVIEW', 'albums/gui/album_print_preview.php');
     $this->register_class('ENTRY_SUMMARY_GRID', 'PICTURE_SUMMARY_GRID', 'albums/gui/picture_grid.php', 'picture');
     $this->register_class('ENTRY_SUMMARY_GRID', 'JOURNAL_SUMMARY_GRID', 'albums/gui/journal_grid.php', 'journal');
     $this->register_class('ENTRY_LIST', 'ALBUM_ENTRY_LIST', 'albums/gui/album_entry_list.php');
     $this->register_class('APPLICATION_TABLE_NAMES', 'ALBUM_APPLICATION_TABLE_NAMES');
     $this->register_class('APPLICATION_PAGE_NAMES', 'ALBUM_APPLICATION_PAGE_NAMES');
     $this->register_class('CONTEXT_DISPLAY_OPTIONS', 'ALBUM_APPLICATION_DISPLAY_OPTIONS', 'albums/config/album_application_config.php');
     $this->register_class('INDEX_PANEL_MANAGER', 'ALBUM_INDEX_PANEL_MANAGER', 'albums/gui/album_panel.php');
     $this->register_class('FOLDER_PANEL_MANAGER', 'ALBUM_FOLDER_PANEL_MANAGER', 'albums/gui/album_panel.php');
     $this->register_class('USER_PANEL_MANAGER', 'ALBUM_USER_PANEL_MANAGER', 'albums/gui/album_panel.php');
     $this->register_entry_class('picture', 'PICTURE', 'albums/obj/picture.php');
     $this->register_entry_class('journal', 'JOURNAL', 'albums/obj/journal.php');
     $this->register_search('picture', 'PICTURE', 'PICTURE_SEARCH', 'albums/obj/album_search.php');
     $this->register_search('journal', 'JOURNAL', 'JOURNAL_SEARCH', 'albums/obj/album_search.php');
 }
Example #8
0
<h1>Views &amp; Actions</h1>

<?php 
APPLICATION::include_template("generate", "component_mvc", $this->get_vars());
?>
<script>
	$(function() {
		
		$("#row-2,#row-3,#row-5").hide();
		
		$("input[type='checkbox']").change(function() {
												vc = $("input[name='mva_components[]'][value='V']").is(":checked");
												ac = $("input[name='mva_components[]'][value='A']").is(":checked");

												tn = [];

												if(vc) {
													tn.push("View");

													$("#row-2").show();
													$("#row-3").show();
													$("#row-5").show();
												}  else {
													$("#row-2").hide();
													$("#row-3").hide();		
													$("#row-5").hide();	
												}

												if(ac) 
													tn.push("Action");