Advertisement
Guest User

Custom Connections(WP) Template

a guest
Dec 2nd, 2013
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.47 KB | None | 0 0
  1. <?php
  2.  
  3. /**
  4.  * Plugin Name: SMC Card
  5.  * Plugin URI: http://connections-pro.com/
  6.  * Description: A business directory and address book manager.
  7.  * Version: 0.7.9.3
  8.  * Author: Template Only, Todd Broadbent and Matt Vona
  9.  * Author URI: http://connections-pro.com/
  10.  * Text Domain: connections
  11.  * Domain Path: languages
  12.  *
  13.  * Copyright 2009  Steven A. Zahm  ( email : helpdesk@connections-pro.com )
  14.  *
  15.  * @package     Connections
  16.  * @subpackage  Template : SMC Card
  17.  * @copyright   Copyright (c) 2013, Steven A. Zahm
  18.  * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
  19.  * @since       0.7.9
  20.  */
  21.  
  22. // Exit if accessed directly
  23. if ( ! defined( 'ABSPATH' ) ) exit;
  24.  
  25. if ( ! class_exists( 'CN_SMC_Card' ) ) {
  26.  
  27.     class CN_SMC_Card {
  28.  
  29.         public static function register() {
  30.  
  31.             $atts = array(
  32.                 'class'       => 'CN_SMC_Card',
  33.                 'name'        => 'SMC Entry Card',
  34.                 'slug'        => 'smc-card',
  35.                 'type'        => 'all',
  36.                 'version'     => '2.0',
  37.                 'author'      => 'Steven A. Zahm',
  38.                 'authorURL'   => 'connections-pro.com',
  39.                 'description' => 'This is the SMC template.',
  40.                 'custom'      => FALSE,
  41.                 'path'        => plugin_dir_path( __FILE__ ),
  42.                 'url'         => plugin_dir_url( __FILE__ ),
  43.                 'thumbnail'   => 'thumbnail.png',
  44.                 'parts'       => array(),
  45.                 );
  46.  
  47.             cnTemplateFactory::register( $atts );
  48.         }
  49.  
  50.         public function __construct( $template ) {
  51.  
  52.             $this->template = $template;
  53.  
  54.             $template->part( array( 'tag' => 'smc-card', 'type' => 'action', 'callback' => array( $this, 'smc-card' ) ) );
  55.         }
  56.  
  57.         public function smccard( $entry ) {
  58.  
  59.             ?>
  60.  
  61.             <div class="cn-entry">
  62.                 <div>
  63.                     <?php $entry->getImage(); ?>
  64.                     <div style="clear:both;"></div>
  65.                     <div style="margin-bottom: 10px;">
  66.                         <span style="font-size:larger;font-variant: small-caps"><strong><?php echo $entry->getNameBlock(); ?></strong></span>
  67.                         <?php $entry->getTitleBlock(); ?>
  68.                         <?php $entry->getOrgUnitBlock(); ?>
  69.                         <?php $entry->getContactNameBlock(); ?>
  70.                     </div>
  71.  
  72.                         <?php $entry->getAddressBlock(); ?>
  73.                 </div>
  74.  
  75.                 <div align="right">
  76.  
  77.                     <?php $entry->getFamilyMemberBlock(); ?>
  78.                     <?php $entry->getPhoneNumberBlock(); ?>
  79.                     <?php $entry->getEmailAddressBlock(); ?>
  80.                     <?php $entry->getImBlock(); ?>
  81.                     <?php $entry->getSocialMediaBlock(); ?>
  82.                     <?php $entry->getLinkBlock(); ?>
  83.                     <?php $entry->getDateBlock(); ?>
  84.  
  85.                 </div>
  86.  
  87.                 <div style="clear:both"></div>
  88.                 <div class="cn-meta" align="left" style="margin-top: 6px">
  89.                     <span style="display: block; margin-bottom: 8px;"><?php $entry->getCategoryBlock( array( 'separator' => ', ', 'before' => '<span>', 'after' => '</span>' ) ); ?></span>
  90.                     <?php if ( cnSettingsAPI::get( 'connections', 'connections_display_entry_actions', 'vcard' ) ) $entry->vcard( array( 'before' => '<span>', 'after' => '</span>' ) ); ?>
  91.  
  92.                     <?php
  93.  
  94.                     cnTemplatePart::updated(
  95.                         array(
  96.                             'timestamp' => $entry->getUnixTimeStamp(),
  97.                             'style' => array(
  98.                                 'font-size'    => 'x-small',
  99.                                 'font-variant' => 'small-caps',
  100.                                 'position'     => 'absolute',
  101.                                 'right'        => '36px',
  102.                                 'bottom'       => '24px',
  103.                             )
  104.                         )
  105.                     );
  106.  
  107.                     cnTemplatePart::returnToTop( array( 'style' => array( 'position' => 'absolute', 'right' => '8px', 'bottom' => '5px' ) ) );
  108.  
  109.                     ?>
  110.  
  111.                 </div>
  112.  
  113.             </div>
  114.  
  115.             <?php
  116.         }
  117.  
  118.     }
  119.  
  120.     add_action( 'cn_register_template', array( 'CN_SMC_Card', 'register' ) );
  121. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement