Skip to content

Commit

Permalink
tidying up
Browse files Browse the repository at this point in the history
  • Loading branch information
ebellempire committed Nov 6, 2014
1 parent 832b39c commit 72fc382
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 90 deletions.
142 changes: 70 additions & 72 deletions IntenseDebatePlugin.php
Original file line number Diff line number Diff line change
@@ -1,92 +1,90 @@
<?php
class IntenseDebatePlugin extends Omeka_Plugin_AbstractPlugin
{
protected $_hooks = array(
'install',
'uninstall',
'config_form',
'config',
'public_items_show',
'public_collections_show',
);


protected $_options = array(
'id_account'=>null,
'id_items'=>1,
'id_collections'=>0,
);

/*

protected $_hooks = array(
'install',
'uninstall',
'config_form',
'config',
'public_items_show',
'public_collections_show',
);


protected $_options = array(
'id_account'=>null,
'id_items'=>1,
'id_collections'=>0,
);


/*
** Plugin options
*/

public function hookConfigForm()
{
require dirname(__FILE__) . '/config_form.php';
}

public function hookConfig()
{

set_option('id_account', $_POST['id_account']);
set_option('id_items', (bool)(int)$_POST['id_items']);
set_option('id_collections', (bool)(int)$_POST['id_collections']);

}

/*

public function hookConfigForm()
{
require dirname(__FILE__) . '/config_form.php';
}

public function hookConfig()
{
set_option('id_account', $_POST['id_account']);
set_option('id_items', (bool)(int)$_POST['id_items']);
set_option('id_collections', (bool)(int)$_POST['id_collections']);
}

/*
** Public display
*/

public function hookPublicItemsShow(){


public function hookPublicItemsShow()
{

echo id_display_comments(get_option('id_items'));

}

public function hookPublicCollectionsShow(){

echo id_display_comments(get_option('id_collections'));

}


/**
* Install the plugin.
*/
public function hookInstall()
{
$this->_installOptions();
}

/**
* Uninstall the plugin.
*/
public function hookUninstall()
{
$this->_uninstallOptions();
}
/**
* Install the plugin.
*/
public function hookInstall()
{
$this->_installOptions();

}

/**
* Uninstall the plugin.
*/
public function hookUninstall()
{
$this->_uninstallOptions();

}
}

function id_display_comments($option=null){

if( ($id=get_option('id_account')) && ($option==1) ){
$html = '<div id="id_comments">';
$html .= '<script>';
$html .= 'var idcomments_acct = "'.$id.'";';
$html .= 'var idcomments_post_id;';
$html .= 'var idcomments_post_url;';
$html .= '</script>';
$html .= '<span id="IDCommentsPostTitle" style="display:none"></span>';
$html .= '<script type="text/javascript" src="http://www.intensedebate.com/js/genericCommentWrapperV2.js"></script>';
$html .= '</div>';

return $html;
}

function id_display_comments($option=null)
{
if( ($id=get_option('id_account')) && ($option==1) ){
$html = '<div id="id_comments">';
$html .= '<script>';
$html .= 'var idcomments_acct = "'.$id.'";';
$html .= 'var idcomments_post_id;';
$html .= 'var idcomments_post_url;';
$html .= '</script>';
$html .= '<span id="IDCommentsPostTitle" style="display:none"></span>';
$html .= '<script type="text/javascript" src="http://www.intensedebate.com/js/genericCommentWrapperV2.js"></script>';
$html .= '</div>';

return $html;
}
}
33 changes: 15 additions & 18 deletions config_form.php
Original file line number Diff line number Diff line change
@@ -1,46 +1,43 @@
<style>
.helper{
font-size:.85em;
}
.helper{font-size:.85em;}
</style>

<h2><?php echo __('Account Settings'); ?></h2>

<fieldset id="account">

<div class="field">
<div class="two columns alpha">
<label for="id_account"><?php echo __('Site Account'); ?></label>
</div>

<div class="inputs five columns omega">
<p class="explanation"><?php echo __("Enter the IntenseDebate site acct id."); ?></p>

<div class="input-block">
<input type="text" class="textinput" name="id_account" value="<?php echo get_option('id_account'); ?>">
<p class="helper"><?php echo __('Log into your account at <a target="_blank" href="http://intensedebate.com/">intensedebate.com</a>. Choose or create a site. Click "View Site Key" and copy the value for "IntenseDebate site acct." <br>Need help? View an <a target="_blank" href="' .WEB_ROOT. '/plugins/IntenseDebate/assets/screenshot.png' . '">example screenshot</a> or visit <a target="_blank" href="http://support.intensedebate.com/">intensedebate.com</a>.'); ?></p>
</div>
</div>
</div>

</fieldset>



<h2><?php echo __('Display Settings'); ?></h2>

<fieldset id="display">


<div class="field">
<div class="two columns alpha">
<label for="id_items"><?php echo __('Items'); ?></label>
</div>

<div class="inputs five columns omega">
<?php echo get_view()->formCheckbox('id_items', true,
array('checked'=>(boolean)get_option('id_items'))); ?>
<?php echo get_view()->formCheckbox('id_items', true,
array('checked'=>(boolean)get_option('id_items'))); ?>

<p class="explanation"><?php echo __('Display comments on item record.'); ?></p>
</div>
</div>
Expand All @@ -49,11 +46,11 @@
<div class="two columns alpha">
<label for="id_collections"><?php echo __('Collections'); ?></label>
</div>

<div class="inputs five columns omega">
<?php echo get_view()->formCheckbox('id_collections', true,
array('checked'=>(boolean)get_option('id_collections'))); ?>
<?php echo get_view()->formCheckbox('id_collections', true,
array('checked'=>(boolean)get_option('id_collections'))); ?>

<p class="explanation"><?php echo __('Display comments on collection record.'); ?></p>
</div>
</div>

0 comments on commit 72fc382

Please sign in to comment.