Skip to content

Commit

Permalink
Merge pull request #18 in WP/idx-broker-plugin from feature/WP-46 to …
Browse files Browse the repository at this point in the history
…release/2.0.0

* commit '6550982c96cace6aee8e9db4af70e414236dac41':
  Add bullets to all tabs and add help to Wrappers UI as well per QA's request.
  Add IDX Pages tab to the Help Section.
  Add API Key Tab.
  Add links to kb articles and remove notification from settings page.
  Add Help information to settings page and when editing a page.
  • Loading branch information
sheparddw committed Nov 25, 2015
2 parents 4587366 + 6550982 commit 8b3c162
Show file tree
Hide file tree
Showing 3 changed files with 127 additions and 19 deletions.
123 changes: 123 additions & 0 deletions idx-broker-platinum/idx/help.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
<?php
namespace IDX;

class Help
{
public function __construct()
{
add_action('load-post.php', array($this, 'add_pages_help_tabs'), 20);
add_action('load-post-new.php', array($this, 'add_pages_help_tabs'), 20);
add_action('load-edit.php', array($this, 'add_wrappers_help'), 20);
add_action('current_screen', array($this, 'settings_help'));
}

public function settings_help()
{
if (!empty($_GET['page']) && $_GET['page'] === 'idx-broker') {
$this->add_settings_help_tabs();
}
}

public function add_wrappers_help()
{
if (!empty($_GET['post_type']) && $_GET['post_type'] === 'idx-wrapper') {
$this->add_settings_help_tabs();
}
}

public $tabs = array(
// The assoc key represents the ID
// It is NOT allowed to contain spaces
'idx_api_key' => array(
'title' => 'API Key'
, 'content' => '
<strong>API Key</strong>
<br>&bull; The API key can be found in your <a href="https://middleware.idxbroker.com/mgmt/apikey.php" target="_blank">IDX Control Panel</a> under Home > API Control.
<br>&bull; For more information, see <a href="http://support.idxbroker.com/customer/en/portal/articles/1911631-api-key-control?b_id=10433" target="_blank">this article</a>.
',
),
'idx_create_wrapper' => array(
'title' => 'Create Wrapper'
, 'content' => '
<strong>Create Wrapper</strong> - Wrappers set the overall styling of your IDX Broker pages.
<br>&bull; Create new page wrappers by entering a unique page name and selecting Update.
<br>&bull; These pages are added to your Wrappers menu, not your WordPress pages.
<br>&bull; For more information, see <a href="http://support.idxbroker.com/customer/en/portal/articles/1919274-automatically-create-wordpress-dynamic-wrapper" target="_blank">this article</a>.
',
),
'idx_pages' => array(
'title' => 'IDX Pages'
, 'content' => '
<strong>IDX Pages</strong> - Integrating IDX Pages into your website.
<br>&bull; We recommend linking to IDX pages from your navigation by adding IDX Pages to your menus.
<br>&bull; You can add pages under the IDX Pages category under Appearance > Menus or Appearance > Customize > Menus.
<br>&bull; For more information, see <a href="http://support.idxbroker.com/customer/en/portal/articles/1917460-wordpress-plugin" target="_blank">this article</a>.
',
),
'idx_apply_wrapper' => array(
'title' => 'Apply Wrapper'
, 'content' => '
<strong>Apply Wrapper</strong> - You may create many wrappers and use different ones for each category or page.
<br>&bull; To apply a new wrapper within WordPress, edit the Wrapper page from the IDX Broker/Wrappers menu.
<br>&bull; In edit mode select where to apply the wrapper in the upper right of the screen.
<br>&bull; For more information, see <a href="http://support.idxbroker.com/customer/en/portal/articles/1919274-automatically-create-wordpress-dynamic-wrapper" target="_blank">this article</a>.
',
),
'idx_shortcodes' => array(
'title' => 'IDX Shortcodes'
, 'content' => '
<strong>Insert Shortcode</strong> - Insert IDX Broker content in any page or post.
<br>&bull; Select the Insert IDX Shortcode button
<br>&bull; System and Saved Links add an external link to IDX Broker pages
<br>&bull; Widgets add widget content into your page.
<br>&bull; Omnibar adds a property listing search bar to any of your pages
<br>&bull; For more information, see <a href="http://support.idxbroker.com/customer/en/portal/articles/1917460-wordpress-plugin" target="_blank">this article</a>.
',
),
);

public function add_pages_help_tabs()
{
$id = 'idx_shortcodes';
$data = $this->tabs['idx_shortcodes'];
$screen = get_current_screen();
$screen->add_help_tab(array(
'id' => $id
, 'title' => __($data['title'], 'idxbroker')
// Use the content only if you want to add something
// static on every help tab. Example: Another title inside the tab
, 'callback' => array($this, "prepare"),
));
}

public function add_settings_help_tabs()
{
$tabs = $this->tabs;
foreach ($tabs as $id => $data) {
$screen = get_current_screen();
$screen->add_help_tab(array(
'id' => $id
, 'title' => __($data['title'], 'idxbroker')
// Use the content only if you want to add something
// static on every help tab. Example: Another title inside the tab
, 'callback' => array($this, 'prepare'),
));
$screen->set_help_sidebar(
'<p><a href="https://middleware.idxbroker.com/mgmt/login.php" target="_blank">IDX Control Panel</a></p>' .
'<p><a href="http://support.idxbroker.com/customer/en/portal/topics/784215-wordpress/articles" target="_blank">IDX Plugin Knowledgebase</a></p>' .
'<p><a href="http://support.idxbroker.com" target="_blank">IDX Support</a></p>'
);
}
}

public function prepare($screen, $tab)
{
printf(
'<p>%s</p>',
__(
$tab['callback'][0]->tabs[$tab['id']]['content'],
'idxbroker'
)
);
}
}
10 changes: 1 addition & 9 deletions idx-broker-platinum/idx/initiate-plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public function __construct()
new Shortcodes\Register_Impress_Shortcodes();
new Widgets\Omnibar\Create_Omnibar();
new Shortcodes\Shortcode_Ui();
new Help();
}

const IDX_API_DEFAULT_VERSION = '1.2.0';
Expand Down Expand Up @@ -174,7 +175,6 @@ public function idx_inject_script_and_style($page)
if ('toplevel_page_idx-broker' !== $page) {
return;
}
add_action('admin_notices', array($this, 'idx_instructions'));
wp_enqueue_script('idxjs', plugins_url('../assets/js/idx-broker.js', __FILE__), 'jquery');
wp_enqueue_style('idxcss', plugins_url('../assets/css/idx-broker.css', __FILE__));
}
Expand All @@ -190,12 +190,4 @@ public function idx_broker_platinum_admin_page()
include plugin_dir_path(__FILE__) . 'views/admin.php';
}

public function idx_instructions()
{
echo '<div class="updated">';
echo '<p>';
echo 'Not sure how to integrate IDX content? See <a href="http://support.idxbroker.com/customer/portal/articles/1917460-wordpress-plugin">this knowledgebase article.</a>';
echo '</p>';
echo '</div>';
}
}
13 changes: 3 additions & 10 deletions idx-broker-platinum/idx/views/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,26 +33,19 @@

<div id="idxPluginWrap" class="wrap">
<div>
<div class="useful-links">
<ul class="usefulLinks">
<li><a href="http://support.idxbroker.com/customer/portal/articles/1917460-wordpress-plugin" target="_blank">IDX Knowledgebase</a></li>
<li><a href="https://middleware.idxbroker.com/mgmt/login.php" target="_blank">IDX Control Panel</a></li>
</ul>
</div>
<a href="http://www.idxbroker.com" target="_blank" class="logo-link">
<div id="logo"></div>
</a>
<h2 class="flft">IDX Broker&reg; Plugin Settings</h2>
<h2 class="flft">IMPress for IDX Broker&reg; Settings</h2>
</div>
<form method="post" action="options.php" id="idx_broker_options">
<?php wp_nonce_field('update-options');?>
<div id="blogUrl" style="display: none;" ajax="<?php bloginfo('wpurl');?>"></div>
<div id="genSettings">
<h3 class="hndle">
<label>Get an API Key</label>
<label>Get an API Key<a href="https://middleware.idxbroker.com/mgmt/apikey.php" target="_blank"><img class="help-icon" src="<?php echo plugins_url('../../assets/images/helpIcon.svg', __FILE__);?>" alt="help"></a></label>
<a href="http://kb.idxbroker.com/index.php?/Knowledgebase/Article/View/98/16/idx-broker-platinum-wordpress-plugin" class="helpIcon" target="_blank"></a>
</h3>
<div class="help-text">You will find your API Key under Home > API Control in your IDX Control Panel.</div>
<div class="inlineBlock">
<div>
<label for="idx_broker_apikey">Enter Your API Key: </label>
Expand All @@ -74,7 +67,7 @@
</div>
<!-- dynamic wrapper page -->
<div id="dynamic_page">
<h3>Set up the Global Wrapper<a href="http://kb.idxbroker.com/Knowledgebase/Article/View/189/0/automatically-create-dynamic-wrapper-page-in-wordpress" target="_blank"><img class="help-icon" src="<?php echo plugins_url('../../assets/images/helpIcon.svg', __FILE__);?>" alt="help"></a></h3>
<h3>Create the Global Wrapper<a href="http://kb.idxbroker.com/Knowledgebase/Article/View/189/0/automatically-create-dynamic-wrapper-page-in-wordpress" target="_blank"><img class="help-icon" src="<?php echo plugins_url('../../assets/images/helpIcon.svg', __FILE__);?>" alt="help"></a></h3>
<div class="help-text">Setting this up will match the IDX pages to your website design automatically every few hours.<div>Example: Properties</div></div>
<label for="idx_broker_dynamic_wrapper_page_name">Page Name:</label>
<input name="idx_broker_dynamic_wrapper_page_name" type="text" id="idx_broker_dynamic_wrapper_page_name" value="<?php echo $post_title;?>" />
Expand Down

0 comments on commit 8b3c162

Please sign in to comment.