コード例 #1
0
    /**
     * Shows an index page where a user can set settings.
     * 
     * @sinve 1.0.0
     * @return void
     */
    public function indexAction()
    {
        // gettings all the items for the item selector
        $dropdownItems = get_posts(array('post_type' => OPANDA_POST_TYPE, 'meta_key' => 'opanda_item', 'meta_value' => OPanda_Items::getAvailableNames(), 'numberposts' => -1));
        // current item
        $itemId = isset($_GET['opanda_id']) ? $_GET['opanda_id'] : null;
        if (empty($itemId)) {
            $itemId = isset($dropdownItems[0]->ID) ? $dropdownItems[0]->ID : 0;
        }
        $itemName = OPanda_Items::getItemNameById($itemId);
        $showPopup = count($dropdownItems) > 1 && !isset($_GET['opanda_id']);
        $screens = apply_filters("opanda_item_type_stats_screens", array(), $itemName);
        $screens = apply_filters("opanda_{$itemName}_stats_screens", $screens);
        $item = get_post($itemId);
        if (empty($item)) {
            die(__('The item with ID = ' . $itemId . ' is not found.', 'bizpanda'));
        }
        $itemTitle = empty($item->post_title) ? sprintf(__('(no titled, id=%s)', 'bizpanda'), $item->ID) : $item->post_title;
        // current item screen
        $currentScreenName = isset($_REQUEST['opanda_screen']) ? $_REQUEST['opanda_screen'] : 'summary';
        $currentScreen = $screens[$currentScreenName];
        require_once OPANDA_BIZPANDA_DIR . '/admin/includes/classes/class.stats-screen.php';
        require_once $currentScreen['path'];
        $screenClass = isset($currentScreen['screenClsss']) ? $currentScreen['screenClsss'] : 'OPanda_StatsScreen';
        $screen = new $screenClass(array('chartClass' => $currentScreen['chartClass'], 'tableClass' => $currentScreen['tableClass']));
        // current post
        $postId = isset($_REQUEST['opanda_post_id']) ? intval($_REQUEST['opanda_post_id']) : false;
        $post = $postId ? get_post($postId) : false;
        // set date range
        $dateStart = isset($_REQUEST['opanda_date_start']) ? $_REQUEST['opanda_date_start'] : false;
        $dateEnd = isset($_REQUEST['opanda_date_end']) ? $_REQUEST['opanda_date_end'] : false;
        $hrsOffset = get_option('gmt_offset');
        if (strpos($hrsOffset, '-') !== 0) {
            $hrsOffset = '+' . $hrsOffset;
        }
        $hrsOffset .= ' hours';
        // by default shows a 30 days' range
        if (empty($dateEnd) || ($dateRangeEnd = strtotime($dateEnd)) === false) {
            $phpdate = getdate(strtotime($hrsOffset, time()));
            $dateRangeEnd = mktime(0, 0, 0, $phpdate['mon'], $phpdate['mday'], $phpdate['year']);
        }
        if (empty($dateStart) || ($dateRangeStart = strtotime($dateStart)) === false) {
            $dateRangeStart = strtotime("-1 month", $dateRangeEnd);
        }
        // getting the chart data
        $chart = $screen->getChart(array('itemId' => $itemId, 'postId' => $postId, 'rangeStart' => $dateRangeStart, 'rangeEnd' => $dateRangeEnd));
        // getting the table data
        $page = isset($_GET['opanda_page']) ? intval($_GET['opanda_page']) : 1;
        if ($page <= 0) {
            $page = 1;
        }
        $table = $screen->getTable(array('itemId' => $itemId, 'postId' => $postId, 'rangeStart' => $dateRangeStart, 'rangeEnd' => $dateRangeEnd, 'per' => 50, 'total' => true, 'page' => $page));
        // the base urls
        $urlBase = add_query_arg(array('opanda_id' => $itemId, 'opanda_post_id' => $postId, 'opanda_screen' => $currentScreenName, 'opanda_date_start' => date('m/d/Y', $dateRangeStart), 'opanda_date_end' => date('m/d/Y', $dateRangeEnd)), opanda_get_admin_url('stats'));
        $dateStart = date('m/d/Y', $dateRangeStart);
        $dateEnd = date('m/d/Y', $dateRangeEnd);
        // extra css classes
        $tableCssClass = '';
        if ($table->getColumnsCount() > 8) {
            $tableCssClass .= ' opanda-concise-table';
        } else {
            $tableCssClass .= ' opanda-free-table';
        }
        ?>
        <div class="wrap">

            <h2><?php 
        _e('Stats & Reports', 'bizpanda');
        ?>
</h2>

            <div id="opanda-control-panel">
                <div class="opanda-left" id="opanda-current-item">
                    <span><?php 
        _e('You are viewing reports for ', 'bizpanda');
        ?>
 <a href="<?php 
        echo admin_url("post.php?post=" . $itemId . "&action=edit");
        ?>
"><strong><?php 
        echo $itemTitle;
        ?>
</strong></a></span>
                </div>
                
                <form method="get" id="opanda-item-selector" class="opanda-right">
                    <input type="hidden" name="post_type" value="<?php 
        echo OPANDA_POST_TYPE;
        ?>
" />
                    <input type="hidden" name="page" value="stats-bizpanda" />
                    <input type="hidden" name="opanda_date_start" class="form-control" value="<?php 
        echo $dateStart;
        ?>
" />
                    <input type="hidden" name="opanda_date_end" class="form-control" value="<?php 
        echo $dateEnd;
        ?>
" />

                    <span><?php 
        _e('Select item to view:', 'optionpanda');
        ?>
</span>
                    <select name="opanda_id">
                        <?php 
        foreach ($dropdownItems as $dropdownItem) {
            ?>
                        <option value="<?php 
            echo $dropdownItem->ID;
            ?>
" <?php 
            if ($dropdownItem->ID == $itemId) {
                echo 'selected="selected"';
            }
            ?>
>
                            <?php 
            if (empty($dropdownItem->post_title)) {
                ?>
                                <?php 
                printf(__('(no titled, id=%s)', 'bizpanda'), $dropdownItem->ID);
                ?>
                            <?php 
            } else {
                ?>
                                <?php 
                echo $dropdownItem->post_title;
                ?>
                            <?php 
            }
            ?>
                        </option>
                        <?php 
        }
        ?>
                    </select>
                    <input class="button" type="submit" value="<?php 
        _e('Select', 'bizpanda');
        ?>
" />
                </form>
                
            </div>

            <div class="factory-bootstrap-329 factory-fontawesome-320">

            <div class="onp-chart-hints">
                <div class="onp-chart-hint onp-chart-hint-errors">
                    <?php 
        printf(__('This chart shows the count of times when the locker was not available to use due to the visitor installed the extensions like Avast or Adblock which may block social networks.<br />By default, the such visitors see the locker without social buttons but with the offer to disable the extensions. You can set another behaviour <a href="%s"><strong>here</strong></a>.', 'bizpanda'), admin_url('admin.php?page=common-settings-' . $this->plugin->pluginName . '&action=advanced'));
        ?>
                </div>
            </div>
            
            <div id="opanda-chart-description">
                <?php 
        echo $currentScreen['description'];
        ?>
            </div>
            
            <div id="onp-sl-chart-area">
                <form method="get"> 
                <div id="onp-sl-settings-bar">
                    
                    <div id="onp-sl-type-select">
                       <div class="btn-group" id="chart-type-group" data-toggle="buttons-radio">
                          <?php 
        foreach ($screens as $screenName => $screen) {
            ?>
                           <a href="<?php 
            echo add_query_arg('opanda_screen', $screenName, $urlBase);
            ?>
" class="btn btn-default <?php 
            if ($screenName == $currentScreenName) {
                echo 'active';
            }
            ?>
 type-<?php 
            echo $screenName;
            ?>
" data-value="<?php 
            echo $screenName;
            ?>
"><?php 
            echo $screen['title'];
            ?>
</a>
                          <?php 
        }
        ?>
                       </div>
                    </div>
                    <div id="onp-sl-date-select">
                        
                        <input type="hidden" name="post_type" value="<?php 
        echo OPANDA_POST_TYPE;
        ?>
" />
                        <input type="hidden" name="page" value="stats-bizpanda" />      
                        <input type="hidden" name="opanda_post_id" value="<?php 
        echo $postId;
        ?>
" />
                        <input type="hidden" name="opanda_screen" value="<?php 
        echo $currentScreenName;
        ?>
" />
                        <input type="hidden" name="opanda_id" value="<?php 
        echo $itemId;
        ?>
" />
                        
                        <span class="onp-sl-range-label"><?php 
        _e('Date range', 'bizpanda');
        ?>
:</span>
                        <input type="text" id="onp-sl-date-start" name="opanda_date_start" class="form-control" value="<?php 
        echo $dateStart;
        ?>
" />
                        <input type="text" id="onp-sl-date-end" name="opanda_date_end" class="form-control" value="<?php 
        echo $dateEnd;
        ?>
" />
                        
                        <a id="onp-sl-apply-dates" class="btn btn-default">
                            <?php 
        _e('Apply', 'bizpanda');
        ?>
                        </a>
                    </div>
                </div>
                </form>

                <div class="chart-wrap">
                    <div id="chart" style="width: 100%; height: 195px;"></div>
                </div>
                
            </div>

            <div id="onp-sl-chart-selector">
                <?php 
        if ($chart->hasSelectors()) {
            ?>
                <?php 
            foreach ($chart->getSelectors() as $name => $field) {
                ?>
                <div class="onp-sl-selector-item onp-sl-selector-<?php 
                echo $name;
                ?>
" data-selector="<?php 
                echo $name;
                ?>
">
                    <span class="chart-color" style="background-color: <?php 
                echo $field['color'];
                ?>
"></span>
                    <?php 
                echo $field['title'];
                ?>
                </div>
                <?php 
            }
            ?>
                <?php 
        }
        ?>
            </div>

            <?php 
        if ($postId) {
            ?>
                <div class="alert alert-warning">
                <?php 
            echo sprintf(__('Data for the post: <strong>%s</strong> (<a href="%s">return back</a>)', 'bizpanda'), $post->post_title, add_query_arg('opanda_post_id', false, $urlBase));
            ?>
                </div>
            <?php 
        } else {
            ?>
                <p><?php 
            _e('Top-50 posts and pages where you put the locker, ordered by their performance:', 'bizpanda');
            ?>
</p>
            <?php 
        }
        ?>

            <div id="opanda-data-table-wrap">
            <table id="opanda-data-table" class="<?php 
        echo $tableCssClass;
        ?>
">
                <thead>
                    <?php 
        if ($table->hasComplexColumns()) {
            ?>
                    
                    <tr>
                        <?php 
            foreach ($table->getHeaderColumns() as $name => $column) {
                ?>
                            <th rowspan="<?php 
                echo $column['rowspan'];
                ?>
" colspan="<?php 
                echo $column['colspan'];
                ?>
" class="opanda-col-<?php 
                echo $name;
                ?>
 <?php 
                echo isset($column['cssClass']) ? $column['cssClass'] : '';
                ?>
 <?php 
                if (isset($column['highlight'])) {
                    echo 'opanda-column-highlight';
                }
                ?>
">
                                <?php 
                echo $column['title'];
                ?>
                                <?php 
                if (isset($column['hint'])) {
                    ?>
                                <i class="opanda-hint" title="<?php 
                    echo $column['hint'];
                    ?>
"></i>
                                <?php 
                }
                ?>
                            </th>
                        <?php 
            }
            ?>
                    </tr>
                    <tr>
                        <?php 
            foreach ($table->getHeaderColumns(2) as $name => $column) {
                ?>
                            <th class="opanda-col-<?php 
                echo $name;
                ?>
 <?php 
                echo isset($column['cssClass']) ? $column['cssClass'] : '';
                ?>
 <?php 
                if (isset($column['highlight'])) {
                    echo 'opanda-column-highlight';
                }
                ?>
">
                                <?php 
                echo $column['title'];
                ?>
                                <?php 
                if (isset($column['hint'])) {
                    ?>
                                <i class="opanda-hint" title="<?php 
                    echo $column['hint'];
                    ?>
"></i>
                                <?php 
                }
                ?>
                            </th>
                        <?php 
            }
            ?>
                    </tr>
                    
                    <?php 
        } else {
            ?>
                    
                        <?php 
            foreach ($table->getColumns() as $name => $column) {
                ?>
                        <th class="opanda-column-<?php 
                echo $name;
                ?>
 <?php 
                echo isset($column['cssClass']) ? $column['cssClass'] : '';
                ?>
 <?php 
                if (isset($column['highlight'])) {
                    echo 'opanda-column-highlight';
                }
                ?>
">
                            <?php 
                echo $column['title'];
                ?>
                            <?php 
                if (isset($column['hint'])) {
                    ?>
                            <i class="opanda-hint" title="<?php 
                    echo $column['hint'];
                    ?>
"></i>
                            <?php 
                }
                ?>
                        </th>
                        <?php 
            }
            ?>
                        
                    <?php 
        }
        ?>
                </thead>
                <tbody>
                <?php 
        for ($i = 0; $i < $table->getRowsCount(); $i++) {
            if ($i >= 50) {
                break;
            }
            ?>
                <tr>
                    <?php 
            foreach ($table->getDataColumns() as $name => $column) {
                ?>
                        <td class="opanda-col-<?php 
                echo $name;
                ?>
 <?php 
                echo isset($column['cssClass']) ? $column['cssClass'] : '';
                ?>
 <?php 
                if (isset($column['highlight'])) {
                    echo 'opanda-column-highlight';
                }
                ?>
">
                            <?php 
                $table->printValue($i, $name, $column);
                ?>
                        </td>
                    <?php 
            }
            ?>
                </tr>
                <?php 
        }
        ?>
                </tbody>

            </table>

            </div>

            </div>
        </div>

        <!-- Load the AJAX API -->
        <script type="text/javascript" src="https://www.google.com/jsapi"></script>
        <script type="text/javascript">

          // Load the Visualization API and the piechart package.
          google.load('visualization', '1.0', {'packages':['corechart']});

          // Set a callback to run when the Google Visualization API is loaded.
          google.setOnLoadCallback(function(){
              window.bizpanda.statistics.drawChart({
                  'type': '<?php 
        echo $chart->type;
        ?>
'
              });
          });
          
          window.opanda_default_selectors = [<?php 
        echo join(',', $chart->getSelectorsNames());
        ?>
];

          window.chartData = [
            <?php 
        $chart->printData();
        ?>
          ];
        </script>
        
        <?php 
        if ($showPopup) {
            ?>
        
            <!-- Locker Select Popup -->

            <div id="opanda-locker-select-overlap" style="display: none;"></div>      
            <div id="opanda-locker-select-popup" style="display: none;">
                <strong><?php 
            _e('Select Locker', 'bizpanda');
            ?>
</strong>
                <p><?php 
            _e('Please select a locker to view reports.', 'bizpanda');
            ?>
</p>

                <select id="opanda-locker-select">
                    <?php 
            foreach ($dropdownItems as $dropdownItem) {
                ?>
                    <option value="<?php 
                echo opanda_get_admin_url('stats', array('opanda_id' => $dropdownItem->ID));
                ?>
" <?php 
                if ($dropdownItem->ID == $itemId) {
                    echo 'selected="selected" data-default="true"';
                }
                ?>
>
                        <?php 
                if (empty($dropdownItem->post_title)) {
                    ?>
                            <?php 
                    printf(__('(no titled, id=%s)', 'bizpanda'), $dropdownItem->ID);
                    ?>
                        <?php 
                } else {
                    ?>
                            <?php 
                    echo $dropdownItem->post_title;
                    ?>
                        <?php 
                }
                ?>
                    </option>
                    <?php 
            }
            ?>
                </select>
                <input class="button" type="submit" value="<?php 
            _e('Select', 'bizpanda');
            ?>
" id="opanda-locker-select-submit" />
            </div>

        <?php 
        }
        ?>
    <?php 
    }
コード例 #2
0
 /**
  * Column 'Created'
  */
 public function columnStats($post)
 {
     global $optinpanda;
     $imperessions = intval(get_post_meta($post->ID, 'opanda_imperessions', true));
     $conversion = '0';
     $unlocks = intval(get_post_meta($post->ID, 'opanda_unlocks', true));
     if (!empty($imperessions)) {
         $conversion = round($unlocks / $imperessions * 100, 2);
     } elseif (!empty($unlocks)) {
         $conversion = 100;
     }
     $strong = $unlocks > 0;
     $url = opanda_get_admin_url('stats', array('opanda_id' => $post->ID));
     if ($strong) {
         echo '<a href="' . $url . '"><strong>' . $unlocks . '</strong> / ' . $imperessions . ' / ' . sprintf('%.02f', $conversion) . '%' . '</a>';
     } else {
         echo '<a href="' . $url . '" class="opanda-empty">' . $unlocks . ' / ' . $imperessions . ' / ' . sprintf('%.02f', $conversion) . '%' . '</a>';
     }
     ?>
         
     <?php 
 }
コード例 #3
0
function opanda_get_settings_url($screen)
{
    return opanda_get_admin_url('settings', array('opanda_screen' => $screen));
}
コード例 #4
0
 /**
  * Shows how the lead was generated.
  * 
  * @since 1.0.7
  * @return void
  */
 public function column_channel($record)
 {
     $itemId = $record->lead_item_id;
     $itemTitle = $record->lead_item_title;
     $item = get_post($itemId);
     $itemTitle = empty($item) ? '<i>' . __('(unknown)', 'bizpanda') . '</i>' : $item->post_title;
     $via = empty($item) ? $itemTitle : '<a href="' . opanda_get_admin_url('stats', array('opanda_id' => $itemId)) . '"><strong>' . $itemTitle . '</strong></a>';
     $via = sprintf(__("Via: %s", 'bizpanda'), $via);
     $postUrl = $record->lead_referer;
     $postTitle = $record->lead_post_title;
     $post = get_post($record->lead_post_id);
     if (!empty($post)) {
         $postUrl = get_permalink($post->ID);
         $postTitle = $post->post_title;
     }
     if (empty($postTitle)) {
         $postTitle = '<i>' . __('(no title)', 'bizpanda') . '</i>';
     }
     $referer = '<a href="' . $postUrl . '"><strong>' . $postTitle . '</strong></a>';
     $where = sprintf(__("On Page: %s", 'bizpanda'), $referer);
     $text = $via . '<br />' . $where;
     echo $text;
 }
コード例 #5
0
 /**
  * Runs activation actions.
  * 
  * @since 1.0.0
  */
 public function activate()
 {
     $this->setupLicense();
     factory_325_set_lazy_redirect(opanda_get_admin_url('how-to-use', array('opanda_page' => 'optinpanda')));
 }
コード例 #6
0
/**
 * Returns an URL where we should redirect a user to, after the success activation of the plugin.
 * 
 * @since 3.1.0
 * @return string
 */
function sociallocker_license_manager_success_redirect()
{
    return opanda_get_admin_url('how-to-use', array('onp_sl_page' => 'sociallocker'));
}
コード例 #7
0
    /**
     * Renders content of the metabox.
     * 
     * @see FactoryMetaboxes321_Metabox
     * @since 1.0.0
     * 
     * @return void
     */
    public function html()
    {
        global $post;
        $options = get_post_meta($post->ID, 'opanda_bulk_locking', true);
        // current bulk locker for the "skip & lock" and "more tag" modes
        $bulkLockerId = intval(get_option('onp_sl_bulk_locker', 0));
        $bulkLocker = null;
        if ($bulkLockerId !== 0 && $bulkLockerId != $post->ID) {
            $bulkLocker = get_post($bulkLockerId);
            if ($bulkLocker && empty($bulkLocker->post_title)) {
                $bulkLocker->post_title = __('No title', 'bizpanda');
            }
        }
        // gets values for the form
        $setupStateClass = empty($options) ? 'onp-sl-empty-state' : 'onp-sl-has-options-state';
        $wayStateClass = '';
        if (!empty($options) && isset($options['way'])) {
            if ($options['way'] == 'skip-lock') {
                $wayStateClass = 'onp-sl-skip-lock-state';
            } elseif ($options['way'] == 'more-tag') {
                $wayStateClass = 'onp-sl-more-tag-state';
            } elseif ($options['way'] == 'css-selector') {
                $wayStateClass = 'onp-sl-css-selector-state';
            }
        }
        $skipAndLockStateClass = '';
        if (!empty($options) && $options['way'] == 'skip-lock') {
            if ($options['skip_number'] == 0) {
                $skipAndLockStateClass = 'onp-sl-skip-lock-0-state';
            } elseif ($options['skip_number'] == 1) {
                $skipAndLockStateClass = 'onp-sl-skip-lock-1-state';
            } elseif ($options['skip_number'] > 1) {
                $skipAndLockStateClass = 'onp-sl-skip-lock-2-state';
            }
        }
        $ruleStateClass = '';
        $defaultWay = 'skip-lock';
        if (!empty($options)) {
            $defaultWay = $options['way'];
        }
        $skipNumber = 1;
        if (!empty($options) && $options['way'] == 'skip-lock') {
            $skipNumber = intval($options['skip_number']);
        }
        $cssSelector = '';
        if (!empty($options) && $options['way'] == 'css-selector') {
            $cssSelector = urldecode($options['css_selector']);
        }
        $excludePosts = '';
        if (!empty($options) && !empty($options['exclude_posts'])) {
            $excludePosts = implode(', ', $options['exclude_posts']);
            $ruleStateClass .= ' onp-sl-exclude-post-ids-rule-state';
        }
        $excludeCategories = '';
        if (!empty($options) && !empty($options['exclude_categories'])) {
            $excludeCategories = implode(', ', $options['exclude_categories']);
            $ruleStateClass .= ' onp-sl-exclude-categories-ids-rule-state';
        }
        $postTypes = '';
        if (!empty($options) && !empty($options['post_types'])) {
            $postTypes = implode(', ', $options['post_types']);
            $ruleStateClass .= ' onp-sl-post-types-rule-state';
        }
        $checkedPostTypes = array('post', 'page');
        if (!empty($options) && !empty($options['post_types'])) {
            $checkedPostTypes = $options['post_types'];
        }
        $types = get_post_types(array('public' => true), 'objects');
        // get interrelated option
        $interrelated = get_option('opanda_interrelation', false);
        $interrelatedClass = !$interrelated ? 'onp-sl-not-interrelation' : '';
        ?>
        <script>
            if ( !window.bizpanda ) window.bizpanda = {};
            if ( !window.bizpanda.lang ) window.bizpanda.lang = {}; 
 
            window.bizpanda.lang.everyPostWillBeLockedEntirelyExceptFirstsParagraphs = 
                "<?php 
        _e('Every post will be locked entirely except %s paragraphs placed at the beginning.', 'bizpanda');
        ?>
";
        
            window.bizpanda.lang.appliesToTypes = 
                "<?php 
        _e('Applies to types: %s', 'bizpanda');
        ?>
";

            window.bizpanda.lang.excludesPosts = 
                "<?php 
        _e('Excludes posts: %s', 'bizpanda');
        ?>
";

            window.bizpanda.lang.excludesCategories = 
                "<?php 
        _e('Excludes categories: %s', 'bizpanda');
        ?>
";
 
        </script>
  
        <div class="onp-sl-visibility-options-disabled" style="display: none;">
            <div class="alert alert-warning">
                <?php 
        _e('You set the the batch locking based on CSS Selector. The visibility options don\'t support CSS selectors.', 'bizpanda');
        ?>
            </div>
        </div>
        
        <div id="onp-sl-bulk-lock-options">
            <?php 
        if (!empty($options)) {
            ?>
               <?php 
            foreach ($options as $optionKey => $optionValue) {
                ?>
               <?php 
                if (in_array($optionKey, array('exclude_posts', 'exclude_categories', 'post_types'))) {
                    $optionValue = implode(',', $optionValue);
                }
                ?>
               <input type="hidden" name="onp_sl_<?php 
                echo $optionKey;
                ?>
" value="<?php 
                echo $optionValue;
                ?>
" />
               <?php 
            }
            ?>
            <?php 
        }
        ?>
        </div>

        <div class="factory-bootstrap-329 factory-fontawesome-320">
            <div class="onp-sl-description-section">
                <?php 
        _e('Batch Locking allows to apply the locker shortcode to your posts automatically.', 'bizpanda');
        ?>
            </div>
            <div class="onp-sl-setup-section <?php 
        echo $setupStateClass;
        ?>
">
                
                <div class="onp-sl-empty-content">
                    <span class="onp-sl-nolock"><?php 
        _e('No batch lock', 'bizpanda');
        ?>
</span>
                    <a class="btn btn-default" href="#onp-sl-bulk-lock-modal" role="button" data-toggle="factory-modal">
                        <i class="fa fa-cog"></i> <?php 
        _e('Setup Batch Lock', 'bizpanda');
        ?>
                    </a>
                </div>
                
                <div class="onp-sl-has-options-content <?php 
        echo $wayStateClass;
        ?>
 <?php 
        echo $ruleStateClass;
        ?>
">
                    
                    <div class="onp-sl-way-description onp-sl-skip-lock-content <?php 
        echo $skipAndLockStateClass;
        ?>
">
                        <span class="onp-sl-skip-lock-0-content">
                            <?php 
        echo _e('Every post will be locked entirely.', 'bizpanda');
        ?>
                        </span>
                        <span class="onp-sl-skip-lock-1-content">
                            <?php 
        echo _e('Every post will be locked entirely except the first paragraph.', 'bizpanda');
        ?>
                        </span>
                        <span class="onp-sl-skip-lock-2-content">
                            <?php 
        echo sprintf(__('Every post will be locked entirely except %s paragraphs placed at the beginning.', 'bizpanda'), $skipNumber);
        ?>
                        </span>
                    </div>
                    
                    <div class="onp-sl-way-description onp-sl-more-tag-content">
                        <?php 
        echo _e('Content placed after the More Tag will be locked in every post.', 'bizpanda');
        ?>
                    </div>
                    
                    <div class="onp-sl-way-description onp-sl-css-selector-content">
                        <p><?php 
        echo _e('Every content matching the given CSS selector will be locked on every page:', 'bizpanda');
        ?>
</p>
                        <p><strong class="onp-sl-css-selector-view"><?php 
        echo $cssSelector;
        ?>
</strong></p>                       
                    </div>
                    
                    <div class='onp-sl-rules'>
                        <span class='onp-sl-post-types-rule'>
                            <?php 
        printf(__('Applies to types: %s', 'bizpanda'), $postTypes);
        ?>
                        </span>
                        <span class='onp-sl-exclude-post-ids-rule'>
                            <?php 
        printf(__('Excludes posts: %s', 'bizpanda'), $excludePosts);
        ?>
                        </span>
                        <span class='onp-sl-exclude-categories-ids-rule'>
                            <?php 
        printf(__('Excludes categories: %s', 'bizpanda'), $excludeCategories);
        ?>
                        </span>       
                    </div>
                    
                    <div class="onp-sl-controls">
                        <a class="btn btn-primary onp-sl-cancel" href="#onp-sl-bulk-lock-modal" role="button" data-toggle="modal" id="onp-sl-setup-bult-locking-btn">
                            <i class="fa fa-times-circle"></i> <?php 
        _e('Cancel', 'bizpanda');
        ?>
                        </a>
                        <a class="btn btn-primary onp-sl-setup-bulk-locking" href="#onp-sl-bulk-lock-modal" role="button" data-toggle="factory-modal">
                            <i class="fa fa-cog"></i> <?php 
        _e('Setup Batch Lock', 'bizpanda');
        ?>
                        </a>
                    </div>
                </div> 
            </div>
            
            <div class="<?php 
        echo $setupStateClass;
        ?>
 <?php 
        echo $interrelatedClass;
        ?>
 onp-sl-interrelation-hint">
                <?php 
        printf(__('Recommended to turn on the Interrelation option on the <a target="_blank" href="%s">Common Settings</a> page. It allows to unlock all lockers when one is unlocked.', 'bizpanda'), opanda_get_admin_url("settings", array('opanda_screen' => 'lock')));
        ?>
            </div>
            
            <div class="onp-sl-after-change-hint">
                <i class="fa fa-exclamation-triangle"></i>
                <?php 
        _e('Don\'t forget to apply made changes via the Update button above.', 'bizpanda');
        ?>
            </div>

            <div class="modal fade" id="onp-sl-bulk-lock-modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
              <div class="modal-dialog">
                <div class="modal-content">
                  <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4 class="modal-title" id="myModalLabel"><?php 
        _e('Select Way Of Batch Locking', 'bizpanda');
        ?>
</h4>
                  </div>
                  <div class="modal-body">
                      
                    <div class="btn-group" id="onp-sl-bulk-locking-way-selector" data-toggle="buttons-radio">
                        <button data-target="#onp-sl-skip-lock-options" type="button" class="btn btn-default value skip-lock <?php 
        if ($defaultWay == 'skip-lock') {
            echo 'active';
        }
        ?>
" data-name="skip-lock"><i class="fa fa-sort-amount-desc"></i> <?php 
        _e('Skip & Lock', 'bizpanda');
        ?>
</button>
                        <button data-target="#onp-sl-more-tags-options" type="button" class="btn btn-default value more-tag <?php 
        if ($defaultWay == 'more-tag') {
            echo 'active';
        }
        ?>
" data-name="more-tag"><i class="fa fa-scissors"></i> <?php 
        _e('More Tag', 'bizpanda');
        ?>
</button>
                        <button data-target="#onp-sl-css-selector-options" type="button" class="btn btn-default value css-selector <?php 
        if ($defaultWay == 'css-selector') {
            echo 'active';
        }
        ?>
" data-name="css-selector"><i class="fa fa-hand-o-up"></i> <?php 
        _e('CSS Selector', 'bizpanda');
        ?>
</button>     
                    </div>
                      
                    <div id="onp-sl-skip-lock-options" class="onp-sl-bulk-locking-options <?php 
        if ($defaultWay !== 'skip-lock') {
            echo 'hide';
        }
        ?>
">
                        <div class="onp-sl-description">
                            <?php 
        _e('Enter the number of paragraphs which will be visible for users at the beginning of your posts and which will be free from locking. The remaining paragraphs will be locked.', 'bizpanda');
        ?>
                        </div>
                        <div class="onp-sl-content">
                            
                            <div class="onp-sl-form">

                                <div class='onp-sl-skip-number-row'>
                                    <label><?php 
        _e('The number of paragraphs to skip', 'bizpanda');
        ?>
</label>
                                    <input type="text" class="form-control onp-sl-skip-number" maxlength="3" min="0" value="<?php 
        echo $skipNumber;
        ?>
" />
                                    <div class="help-block help-block-error">
                                        <?php 
        _e('Please enter a positive integer value.');
        ?>
                                    </div>
                                </div>

                                <div class="onp-sl-limits">
                                    <div class='onp-sl-exclude'>
                                        <div class='onp-sl-row'>
                                            <label><?php 
        _e('Exclude Posts', 'bizpanda');
        ?>
</label>
                                            <input type="text" class="form-control onp-sl-exclude-posts" value="<?php 
        echo $excludePosts;
        ?>
" />
                                            <div class="help-block">
                                                <?php 
        _e('(Optional) Enter posts IDs comma separated, for example, "19,25,33".', 'bizpanda');
        ?>
                                            </div>
                                        </div>
                                        <div class='onp-sl-row'>
                                            <label><?php 
        _e('Exclude Categories', 'bizpanda');
        ?>
</label>
                                            <input type="text" class="form-control onp-sl-exclude-categories" value="<?php 
        echo $excludeCategories;
        ?>
" />
                                            <div class="help-block">
                                                <?php 
        _e('(Optional) Enter categories IDs comma separated, for example, "4,7".', 'bizpanda');
        ?>
                                            </div>
                                        </div>                        
                                    </div>

                                    <div class='onp-sl-post-types'>
                                        <strong><?php 
        _e('Posts types to lock', 'bizpanda');
        ?>
</strong>
                                        <div class="help-block">
                                            <?php 
        _e('Choose post types for batch locking.', 'bizpanda');
        ?>
                                        </div>
                                        <ul>
                                        <?php 
        foreach ($types as $type) {
            ?>
                                            <li>
                                                <label for='onp-sl-post-type-<?php 
            echo $type->name;
            ?>
-lock-skip'>
                                                    <input type='checkbox' class='onp-sl-post-type onp-sl-<?php 
            echo $type->name;
            ?>
' id='onp-sl-post-type-<?php 
            echo $type->name;
            ?>
-lock-skip' value='<?php 
            echo $type->name;
            ?>
' <?php 
            if (in_array($type->name, $checkedPostTypes)) {
                echo 'checked="checked"';
            }
            ?>
 />
                                                    <?php 
            echo $type->label;
            ?>
   
                                                </label>
                                            </li>
                                        <?php 
        }
        ?>
 
                                        </ul>
                                        <div class="help-block help-block-error">
                                            <?php 
        _e('Please choose at least one post type to lock. Otherwise, nothing to lock.', 'bizpanda');
        ?>
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <div class="onp-sl-example">
                                <div class="onp-sl-description">
                                    <strong><?php 
        _e('For example,', 'bizpanda');
        ?>
</strong>
                                    <?php 
        _e('If you enter 2, two first paragraphs will be visible, others will be locked.', 'bizpanda');
        ?>
                                </div>
                                <div class="onp-sl-page">
                                    <div class="onp-sl-skipped">
                                        <div class="onp-sl-p"></div> 
                                        <div class="onp-sl-p"></div>
                                    </div>
                                    <div class="onp-sl-locked">
                                        <div class="onp-sl-hint">
                                            <i class="fa fa-lock"></i> 
                                            <?php 
        _e('this will be locked', 'bizpanda');
        ?>
                                            <i class="fa fa-lock"></i>
                                        </div>
                                        <div class="onp-sl-p"></div> 
                                        <div class="onp-sl-p"></div>
                                        <div class="onp-sl-p"></div>
                                    </div>
                                </div>
                            </div>  

                        </div>                 
                    </div>
                      
                    <div id="onp-sl-more-tags-options" class="onp-sl-bulk-locking-options <?php 
        if ($defaultWay !== 'more-tag') {
            echo 'hide';
        }
        ?>
">
                        <div class="onp-sl-description">
                            <?php 
        _e('All content after the More Tag will be locked in all your posts. If a post doesn\'t have the More Tag, the post will be shown without locking.', 'bizpanda');
        ?>
                        </div>
                        <div class="onp-sl-content">
                            
                            <div class="onp-sl-form onp-sl-limits">
                                <div class='onp-sl-exclude'>
                                    <div class='onp-sl-row'>
                                        <label><?php 
        _e('Exclude Posts', 'bizpanda');
        ?>
</label>
                                        <input type="text" class="form-control onp-sl-exclude-posts" value="<?php 
        echo $excludePosts;
        ?>
" />
                                        <div class="help-block">
                                            <?php 
        _e('(Optional) Enter posts IDs comma separated, for example, "19,25,33".', 'bizpanda');
        ?>
                                        </div>
                                    </div>
                                    <div class='onp-sl-row'>
                                        <label><?php 
        _e('Exclude Categories', 'bizpanda');
        ?>
</label>
                                        <input type="text" class="form-control onp-sl-exclude-categories" value="<?php 
        echo $excludeCategories;
        ?>
" />
                                        <div class="help-block">
                                            <?php 
        _e('(Optional) Enter categories IDs comma separated, for example, "4,7".', 'bizpanda');
        ?>
                                        </div>
                                    </div>                        
                                </div>

                                <div class='onp-sl-post-types'>
                                    <strong><?php 
        _e('Posts types to lock', 'bizpanda');
        ?>
</strong>
                                    <div class="help-block">
                                        <?php 
        _e('Choose post types for batch locking.', 'bizpanda');
        ?>
                                    </div>
                                    <ul>
                                    <?php 
        foreach ($types as $type) {
            ?>
                                        <li>
                                            <label for='onp-sl-post-type-<?php 
            echo $type->name;
            ?>
-more-tag'>
                                                <input type='checkbox' class='onp-sl-post-type onp-sl-<?php 
            echo $type->name;
            ?>
' id='onp-sl-post-type-<?php 
            echo $type->name;
            ?>
-more-tag' value='<?php 
            echo $type->name;
            ?>
' <?php 
            if (in_array($type->name, $checkedPostTypes)) {
                echo 'checked="checked"';
            }
            ?>
 />
                                                <?php 
            echo $type->label;
            ?>
   
                                            </label>
                                        </li>
                                    <?php 
        }
        ?>
 
                                    </ul>
                                    <div class="help-block help-block-error">
                                        <?php 
        _e('Please choose at least one post type to lock. Otherwise, nothing to lock.', 'bizpanda');
        ?>
                                    </div>
                                </div>
                            </div>

                            <strong class="onp-sl-title"><?php 
        _e('What is the More Tag?', 'bizpanda');
        ?>
</strong>
                            <div class="onp-sl-image"></div>
                            <p>
                                <?php 
        _e('Check out <a href="http://en.support.wordpress.com/splitting-content/more-tag/" target="_blank">Splitting Content > More Tag</a> to lean more.', 'bizpanda');
        ?>
                            </p>

                        </div>
                    </div>   
                      
                    <div id="onp-sl-css-selector-options" class="onp-sl-bulk-locking-options <?php 
        if ($defaultWay !== 'css-selector') {
            echo 'hide';
        }
        ?>
">
                        <div class="onp-sl-description">
                            <p>
                                <?php 
        _e('CSS selectors allow accurately choose which content will be locked by usign CSS classes or IDs of elements placed on pages. If you don\'t know what is it, please don\'t use it.', 'bizpanda');
        ?>
                            </p>
                            <p>
                                <?php 
        _e('Check out <a href="http://www.w3schools.com/cssref/css_selectors.asp" target="_blank">CSS Selector Reference</a> to lean more.', 'bizpanda');
        ?>
                            </p>
                        </div>
                        <div class="onp-sl-content">
                            <div class="onp-sl-form">
                                <label><?php 
        _e('CSS Selector', 'bizpanda');
        ?>
</label>
                                <input type="text" class="form-control onp-sl-css-selector" value="<?php 
        echo htmlentities($cssSelector);
        ?>
" />
                                <div class="help-block">
                                    <?php 
        _e('For example, "#somecontent .my-class, .my-another-class"', 'bizpanda');
        ?>
                                </div>                     
                                <div class="help-block help-block-error">
                                    <?php 
        _e('Please enter a css selector to lock.', 'bizpanda');
        ?>
                                </div>
                            </div>
                        </div>
                    </div> 
                      
                  </div>
                  <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal"><?php 
        _e('Cancel', 'bizpanda');
        ?>
</button>
                    <button type="button" class="btn btn-primary" id="onp-sl-save-bulk-locking-btn"><?php 
        _e('Save', 'bizpanda');
        ?>
</button>
                  </div>
                </div>
              </div>
            </div>
        </div>
        <?php 
    }