function initial() { global $status, $debug, $log, $function_name, $argv; // first parse the pmc.ini $ini = parse_ini_file("pmc.ini"); // Set variable $status = $ini["Status"]; $debug = $ini["Debug"]; $log = $ini["Log"]; // Debug_mode service_debug(); // checking... service_status(); // log... service_log(); // parse URL into Params parse_param(); // include module include_module(); // call module function if ($function_name != NULL) { if ($debug == 1) { echo "use function " . $function_name . ".<br>"; } if ($argv == NULL) { $function_name(); } else { $function_name($argv); } } }
function widget($args, $instance) { global $post; $posts = get_field('products', 'widget_' . $args['widget_id']); if ($posts) { echo $args['before_widget']; if (!empty($instance['title'])) { if (!empty($instance['description'])) { echo '<div class="widget-header">'; echo $args['before_title'] . $instance['title'] . $args['after_title']; echo '<div class="widget-description">' . $instance['description'] . '</div>'; echo '</div>'; } else { echo $args['before_title'] . $instance['title'] . $args['after_title']; } } ?> <ul class="products"> <?php foreach ($posts as $post) { ?> <?php setup_postdata($post); ?> <?php $class = array(); $class[] = has_post_thumbnail() ? 'has-thumbnail' : ''; ?> <li <?php post_class(); ?> > <?php include_module('product-item', array('title' => get_the_title(), 'designer' => get_field('designer'), 'price' => get_field('price'), 'url' => get_field('external_url'), 'image_url' => get_post_thumbnail_src(array('width' => 210)))); ?> </li> <?php } ?> </ul> <?php echo $args['after_widget']; wp_reset_postdata(); wp_reset_query(); } }
function widget($args, $instance) { global $post; $args['category_id'] = isset($instance['category_id']) ? $instance['category_id'] : null; $category = get_category($args['category_id']); if ($category) { echo $args['before_widget']; $image_id = get_field('image', 'category_' . $category->term_id); $sub_title = get_field('sub_title', 'category_' . $category->term_id); $image_url = get_image($image_id, array('width' => 400, 'height' => 220)); include_module('category-btn', array('url' => get_term_link($category), 'image_url' => $image_url, 'name' => $category->name, 'sub_title' => $sub_title)); echo $args['after_widget']; wp_reset_postdata(); wp_reset_query(); } }
function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', $instance['title']); echo $args['before_widget']; ?> <span><?php echo $title; ?> </span> <a href="https://twitter.com/G4ASeasons"><?php _e('@G4AS'); ?> </a> <?php include_module('social-links'); ?> <?php echo $args['after_widget']; }
the_content(); ?> <?php } ?> </article> </div> </div> <?php } wp_reset_postdata(); // end of the loop. ?> <div id="back"> <?php $news_id = get_field('news_page', 'options')->ID; ?> <a class="primary-btn back-btn" href="<?php echo get_permalink($news_id); ?> ">Back to News</a> </div> </div><!-- #single --> <?php include_module('related-posts'); ?> <?php get_footer();
<?php /** * Application unit registration * * @author Karel Kozlik * @version $Id: apu_registration.php,v 1.22 2009/12/17 12:11:56 kozlik Exp $ * @package serweb * @subpackage mod_registration */ include_module("uri"); /** * Application unit registration * * * This application unit is used for registration new users * * <pre> * Configuration: * -------------- * * 'mail_file' (string) default: mail_registered_by_admin.txt * Name of file containing text of mail which is send after successfull registration. * * 'mail_file_conf' (string) default: null * Name of file continaing text of mail which is send after successfull registration. * If 'mail_file_conf' is set, 'mail_file_conf' is send when confirmation of * registration is required and 'mail_file' is send when confirmation is not * required. Otherwise (if 'mail_file_conf' is not set) 'mail_file' is always * send. *
function widget($args, $instance) { global $post; $posts = get_field('posts', 'widget_' . $args['widget_id']); $size = $instance['size']; if ($posts) { echo $args['before_widget']; if (!empty($instance['title'])) { echo $args['before_title'] . $instance['title'] . $args['after_title']; ?> <?php if (!empty($instance['description'])) { ?> <div class="widget-description"><?php echo $instance['description']; ?> </div> <?php } ?> <?php } ?> <ul class="posts size-<?php echo $size; ?> "> <?php foreach ($posts as $post) { ?> <?php setup_postdata($post); ?> <?php $class = array($instance['size']); $class[] = has_post_thumbnail() ? 'has-thumbnail' : ''; switch ($size) { case 'small': $image_size = array('width' => 100, 'height' => 100); $title = get_the_title(); break; case 'medium': $image_size = array('width' => 65, 'height' => 65); $title = strlen(get_the_title()) > 25 ? substr(get_the_title(), 0, 25) . ' ...' : get_the_title(); break; case 'large': default: $image_size = array('width' => 200, 'height' => 200); $title = get_the_title(); break; } ?> <li <?php post_class(); ?> > <?php include_module('post-item', array('title' => $title, 'excerpt' => get_excerpt(50), 'url' => get_permalink(), 'image_url' => get_post_thumbnail_src($image_size), 'class' => implode(' ', $class))); ?> </li> <?php } ?> </ul> <?php echo $args['after_widget']; wp_reset_postdata(); wp_reset_query(); } }
<?php /** * File automaticaly included by the framework when module is loaded * * @author Karel Kozlik * @version $Id: include.php,v 1.4 2009/12/17 12:11:56 kozlik Exp $ * @package serweb * @subpackage mod_registration */ /** * module init function * * Is called when all files are included */ function registration_init() { } require_once dirname(__FILE__) . "/classes.php"; include_module('multidomain'); include_module('uri');
/* * $Id: mod_auth.php,v 1.2 2006/04/03 14:56:04 kozlik Exp $ */ /* * Configuration variables for this module * * $config->auth['backend'] = 'db'; allowed values: "db", "radius", "ldap" * notice: "radius" and "ldap" are experimental * */ /* * If config variables are not set, initialize them to default values */ /** * Backend used for authentication * Currently supported values: 'db', 'ldap', 'radius' */ if (!isset($config->auth['backend'])) { $config->auth['backend'] = 'db'; } /** * Include backend */ include_module('auth_' . $config->auth['backend']); /** * Function called on beginning of script execution */ function auth_init() { }
<div class="post-social clearfix"> <div class="comments"> <span class="title"><?php _e("Join the <i>Conversation</i>:", THEME_NAME); ?> </span> <a class="comment-btn" href="#" ><?php _e('Leave a comment', 'thebank'); ?> </a> </div><?php include_module('share-links'); ?> </div>
<div class="share"> <span class="label"><?php _e("Share", 'iamkoo'); ?> </span> <?php include_module('share-links', array('title' => $title, 'url' => $url, 'image_url' => $image_url, 'excerpt' => $excerpt)); ?> </div>
if ($year != $post_year) { ?> <div class="year"> <?php the_date('Y'); ?> </div> <?php $year = $post_year; ?> <?php } ?> <li class="item"> <?php include_module('post-item', array('title' => get_the_title(), 'url' => get_permalink(), 'image_url' => get_post_thumbnail_src($image_size))); ?> </li> <?php $i++; } // end of the loop. ?> </ul> <?php } else { ?> <div class="not-found"> <h3 class="title"><?php _e("No posts found", THEME_NAME);
<?php global $post; get_header(); ?> <?php include_module('parallax-header'); if (get_field('google_maps_shortcode')) { ?> <div id="gmaps"> <?php $map = get_field('google_maps_shortcode'); ?> <?php echo do_shortcode($map); ?> </div> <?php } ?> <div id="page"> <?php while (have_posts()) { the_post(); ?> <div id="content"> <article id="post-<?php the_ID();
> <div id="tortilla"> <header id="header" role="banner"> <a class="menu-btn" href="#"><span></span></a> <div class="inner container"> <h1 class="logo-container"> <a class="logo icon" href="<?php echo home_url('/'); ?> " title="<?php echo esc_attr(get_bloginfo('name', 'display')); ?> " rel="home"><?php //bloginfo( 'name' ); ?> </a> </h1> <?php wp_nav_menu(array('depth' => 0, 'theme_location' => 'primary', 'menu_class' => 'clearfix menu', 'container' => 'nav', 'container_class' => 'primary-navigation navigation')); ?> <a href="http://thebank.co.uk" class="icon icon-logo2-bank"></a> </div> <?php include_module('subnavigation'); ?> </header><!-- #header --> <div id="main" class="site-main" role="main">
/** * Method delete domain * * @return bool return TRUE on success, FALSE on failure */ function delete_domain() { global $data; include_module('subscribers'); $data->add_method('mark_domain_deleted'); $data->add_method('mark_user_deleted'); $data->add_method('reload_domains'); $data->add_method('get_uid_of_domain'); $errors = array(); $opt = array(); if (false === ($uids = $data->get_uid_of_domain($this->did, $opt))) { return false; } foreach ($uids as $v) { if (false === $data->mark_user_deleted(array("uid" => $v))) { return false; } } if (false === $this->create_or_remove_all_symlinks(false)) { return false; } $opt['did'] = $this->did; if (false === $data->mark_domain_deleted($opt)) { return false; } $this->dom_names = array(); /* notify SER to reload domains */ if (false === $data->reload_domains(null, $errors)) { ErrorHandler::add_error($errors); return false; } return true; }
<?php /** * Application unit attributes * * @author Karel Kozlik * @version $Id: apu_attributes.php,v 1.18 2009/10/22 07:44:09 kozlik Exp $ * @package serweb * @subpackage mod_attributes */ include_module('multidomain'); /** * This application unit is used for view and change values of attributes * * <pre> * Configuration: * -------------- * 'attributes' (array) default: array containing all atributes * array containing attributes which should be displayed * * 'exclude_attributes' (array) default: array() * array containing attributes which shouldn't be displayed * * 'attrs_group' (string) default: null * if is set, work only with attributes from specified group * * 'error_messages' (assoc) default: array() * keys are names of attributes, values are custom error messages * displayed when value of attribute is wrong * * 'validate_funct' (string) default: ""
function call_rv($callback, $param, &$opt) { include_module($callback->module); return call_user_func_array($callback->fn, array($param, &$opt)); }
/** * Create new subscriber * * Create credentials, uris and user_attrs * * Options: * - 'disabled' - create the subscriber disabled * * * @param string $username * @param string $did * @param string $password * @param array $attrs * @param array $opts * @return bool * @static */ function add_subscriber($username, $did, $password, $attrs, &$opts) { global $config, $data; $an =& $config->attr_names; include_module("uri"); $data->add_method('add_credentials'); $data->add_method('add_uri'); $o_disabled = isset($opts['disabled']) ? (bool) $opts['disabled'] : false; /* get realm */ $opt = array("did" => $did); if (false === ($realm = Attributes::get_attribute($an['digest_realm'], $opt))) { return false; } $opts['realm'] = $realm; /* generate uid */ if (false === ($uid = Registration::get_uid($username, $realm))) { return false; } $opts['uid'] = $uid; if (false === $data->transaction_start()) { return false; } /* store credentials */ $o = array('disabled' => $o_disabled); if (false === $data->add_credentials($uid, $did, $username, $realm, $password, $o)) { $data->transaction_rollback(); return false; } /* store uri */ $o = array('disabled' => $o_disabled, 'canon' => true); if (false === $data->add_uri($uid, 'sip', $username, $did, $o)) { $data->transaction_rollback(); return false; } /* store attributes */ $ua =& User_Attrs::singleton($uid); foreach ($attrs as $k => $v) { if (false === $ua->set_attribute($k, $v)) { $data->transaction_rollback(); return false; } } if (false === $ua->set_attribute($an['datetime_created'], gmdate("Y-m-d H:i:s"))) { $data->transaction_rollback(); return false; } if (false === $data->transaction_commit()) { return false; } return true; }
?> <div id="related"> <h2 class="section-title"><?php _e('Similar Projects'); ?> </h2> <ul class="posts"> <?php foreach ($posts as $p) { // variable must NOT be called $post (IMPORTANT) ?> <?php $id = $p->ID; $image_size = array('width' => 370, 'height' => 250); $image_src = get_image(get_post_thumbnail_id($id), $image_size); ?> <li> <?php include_module('post-item', array('title' => get_the_title($id), 'url' => get_permalink($id), 'image_url' => $image_src)); ?> </li> <?php } ?> </ul> </div> <?php } ?>
function widget($args, $instance) { global $post; $location = $args['id']; $args['offset'] = $instance['offset'] ? intval($instance['offset']) - 1 : 0; $args['category_id'] = isset($instance['category_id']) && $instance['category_id'] != 0 ? $instance['category_id'] : ''; $args['size'] = isset($instance['size']) ? $instance['size'] : 'small'; $args['post_id'] = isset($instance['post_id']) ? $instance['post_id'] : null; $options = array('posts_per_page' => 1, 'post_type' => array('post'), 'orderby' => 'date', 'order' => 'DESC', 'post_status' => 'publish'); if ($args['post_id']) { $options['p'] = $args['post_id']; } else { $options['offset'] = $args['offset']; if ($args['category_id']) { $options['category__in'] = array($args['category_id']); } } $custom_query = new WP_Query($options); if ($custom_query->have_posts()) { echo $args['before_widget']; $i = 0; while ($custom_query->have_posts()) { $custom_query->the_post(); switch ($args['size']) { case 'large': $image_size = array('width' => 320, 'height' => 222); break; case 'medium': $image_size = array('width' => 320, 'height' => 294); break; case 'small': default: $image_size = array('width' => 320, 'height' => 222); break; } if ($location == 'homepage_carousel') { $image_size = array('width' => 840, 'height' => 480); } $author_id = get_the_author_meta('ID'); $category = get_post_category(); $module = $location == 'homepage_carousel' ? 'post-slide' : 'post-item'; $sub_category = get_post_sub_category(); if (!$sub_category || $location == 'homepage_carousel') { $sub_category = $category; } if ($location != 'homepage_carousel') { include_module('post-top-category', array('name' => $category->name)); } $data = array('title' => get_the_title(), 'excerpt' => get_excerpt(150), 'url' => get_permalink(), 'image_url' => get_post_thumbnail_src($image_size), 'author' => array('name' => get_the_author(), 'image_url' => get_avatar_url(get_the_author_meta('ID'), 40), 'url' => get_author_posts_url($author_id)), 'category' => array('name' => $sub_category->name), 'read_more' => true, 'date' => get_the_date(), 'class' => 'has-sub-category'); include_module($module, $data); $i++; } echo $args['after_widget']; wp_reset_postdata(); wp_reset_query(); } }