Example #1
0
/**
 * Registers metaboxes for Social Locker.
 * 
 * @see opanda_item_type_metaboxes
 * @since 1.0.0
 */
function opanda_socail_locker_metaboxes($metaboxes)
{
    $metaboxes[] = array('class' => 'OPanda_SocialOptionsMetaBox', 'path' => BIZPANDA_SOCIAL_LOCKER_DIR . '/admin/metaboxes/social-options.php');
    if (OPanda_Items::isCurrentFree()) {
        $metaboxes[] = array('class' => 'OPanda_SocialLockerMoreFeaturesMetaBox', 'path' => BIZPANDA_SOCIAL_LOCKER_DIR . '/admin/metaboxes/more-features.php');
    }
    return $metaboxes;
}
 /**
  * Configures a form that will be inside the metabox.
  * 
  * @see FactoryMetaboxes321_FormMetabox
  * @since 1.0.0
  * 
  * @param FactoryForms328_Form $form A form object to configure.
  * @return void
  */
 public function form($form)
 {
     $options = array(array('type' => 'checkbox', 'way' => 'buttons', 'name' => 'hide_for_member', 'title' => __('Hide For Members', 'bizpanda'), 'hint' => __('If on, hides the locker for registered members.', 'bizpanda'), 'icon' => OPANDA_BIZPANDA_URL . '/assets/admin/img/member-icon.png', 'default' => false), array('type' => 'checkbox', 'way' => 'buttons', 'name' => 'lock_delay', 'title' => __('Lock Delay', 'bizpanda'), 'hint' => __('If on, shows the locker only in posts older than specified age.', 'bizpanda'), 'icon' => OPANDA_BIZPANDA_URL . '/assets/admin/img/icon-delay-lock.png', 'default' => false), array('type' => 'html', 'html' => array($this, 'htmlLockDelayOptions')), array('type' => 'checkbox', 'way' => 'buttons', 'name' => 'relock', 'title' => __('ReLock', 'bizpanda'), 'hint' => __('If on, being unlocked the locker will appear again after specified interval.', 'bizpanda'), 'icon' => OPANDA_BIZPANDA_URL . '/assets/admin/img/icon-relock-3.png', 'default' => false), array('type' => 'html', 'html' => array($this, 'htmlReLockOptions')), array('type' => 'checkbox', 'way' => 'buttons', 'name' => 'mobile', 'title' => __('Mobile', 'bizpanda'), 'hint' => __('If on, the locker will appear on mobile devices.', 'bizpanda'), 'icon' => OPANDA_BIZPANDA_URL . '/assets/admin/img/mobile-icon.png', 'default' => true));
     if (OPanda_Items::isCurrentFree()) {
         $options[] = array('type' => 'html', 'html' => '<div style="display: none;" class="factory-fontawesome-320 opanda-overlay-note opanda-premium-note">' . __('<i class="fa fa-star-o"></i> Go Premium <i class="fa fa-star-o"></i><br />To Unlock These Features <a href="#" class="opnada-button">Learn More</a>', 'bizpanda') . '</div>');
     }
     $options = apply_filters('opanda_visability_options', $options, $this);
     $form->add($options);
 }
 /**
  * Configures a form that will be inside the metabox.
  * 
  * @see FactoryMetaboxes321_FormMetabox
  * @since 1.0.0
  * 
  * @param FactoryForms328_Form $form A form object to configure.
  * @return void
  */
 public function form($form)
 {
     $options = array(array('type' => 'checkbox', 'way' => 'buttons', 'name' => 'close', 'title' => __('Close Icon', 'bizpanda'), 'hint' => __('Shows the Close Icon at the corner.', 'bizpanda'), 'icon' => OPANDA_BIZPANDA_URL . '/assets/admin/img/close-icon.png', 'default' => false), array('type' => 'textbox', 'name' => 'timer', 'title' => __('Timer Interval', 'bizpanda'), 'hint' => __('Sets a countdown interval for the locker.', 'bizpanda'), 'icon' => OPANDA_BIZPANDA_URL . '/assets/admin/img/timer-icon.png', 'default' => false), array('type' => 'checkbox', 'way' => 'buttons', 'name' => 'ajax', 'title' => __('AJAX', 'bizpanda'), 'hint' => __('If On, locked content will be cut from a page source code.', 'bizpanda'), 'icon' => OPANDA_BIZPANDA_URL . '/assets/admin/img/ajax-icon.png', 'default' => false), array('type' => 'html', 'html' => '<div id="opanda-ajax-disabled" class="alert alert-warning">The option AJAX is not applied when the "transparence" or "blurring" overlap modes selected.</div>'), array('type' => 'checkbox', 'way' => 'buttons', 'name' => 'highlight', 'title' => __('Highlight', 'bizpanda'), 'hint' => __('Defines whether the locker must use the Highlight effect.', 'bizpanda'), 'icon' => OPANDA_BIZPANDA_URL . '/assets/admin/img/highlight-icon.png', 'default' => true));
     if (OPanda_Items::isCurrentFree()) {
         $options[] = array('type' => 'html', 'html' => '<div style="display: none;" class="factory-fontawesome-320 opanda-overlay-note opanda-premium-note">' . __('<i class="fa fa-star-o"></i> Go Premium <i class="fa fa-star-o"></i><br />To Unlock These Features <a href="#" class="opnada-button">Learn More</a>', 'bizpanda') . '</div>');
     }
     $options = apply_filters('opanda_advanced_options', $options);
     $form->add($options);
 }
 public static function getAvailable()
 {
     if (self::$_available !== null) {
         return self::$_available;
     }
     $items = array();
     self::$_available = apply_filters('opanda_items', $items);
     return self::$_available;
 }
Example #5
0
/**
 * Returns a list of the lockers.
 */
function opanda_ajax_get_lockers()
{
    $lockers = get_posts(array('post_type' => OPANDA_POST_TYPE, 'meta_key' => 'opanda_item', 'meta_value' => OPanda_Items::getAvailableNames(), 'numberposts' => -1));
    $result = array();
    foreach ($lockers as $locker) {
        $itemType = get_post_meta($locker->ID, 'opanda_item', true);
        $item = OPanda_Items::getItem($itemType);
        $result[] = array('id' => $locker->ID, 'title' => empty($locker->post_title) ? '(no titled, ID=' . $locker->ID . ')' : $locker->post_title, 'shortcode' => $item['shortcode'], 'isDefault' => get_post_meta($locker->ID, 'opanda_is_default', true));
    }
    echo json_encode($result);
    die;
}
    /**
     * Column 'Shortcode'
     */
    public function columnShortcode($post, $isFullMode)
    {
        $isSystem = get_post_meta($post->ID, 'opanda_is_system', true);
        $itemTypeName = get_post_meta($post->ID, 'opanda_item', true);
        $item = OPanda_Items::getItem($itemTypeName);
        $shortcodeName = $item['shortcode'];
        $shortcode = '[' . $shortcodeName . '] [/' . $shortcodeName . ']';
        if (!$isSystem) {
            $shortcode = '[' . $shortcodeName . ' id="' . $post->ID . '"] [/' . $shortcodeName . ']';
        }
        ?>
        <input class="shortcode" type="text" value='<?php 
        echo $shortcode;
        ?>
' />
        <?php 
    }
/**
 * Returns an URL for purchasing a premium version of the plugin.
 * 
 * @since 1.1.4
 * 
 * @param string $name plugin or item name.
 * @return string|false the URL to purchase
 */
function opanda_get_premium_url($name = null, $campaign = 'na')
{
    if (empty($name)) {
        $name = OPanda_Items::getCurrentItemName();
    }
    $url = null;
    $url = apply_filters('opanda_premium_url', $url, $name, $campaign);
    if (!empty($url)) {
        return $url;
    }
    $url = OPanda_Items::getPremiumUrl($name);
    if (!empty($url)) {
        return $url;
    }
    require_once OPANDA_BIZPANDA_DIR . '/admin/includes/plugins.php';
    $url = OPanda_Plugins::getPremiumUrl($name);
    if (!empty($url)) {
        return $url;
    }
    return OPanda_Items::getPremiumUrl($name);
}
    /**
     * Renders content of the metabox.
     * 
     * @see FactoryMetaboxes321_Metabox
     * @since 1.0.0
     * 
     * @return void
     */
    public function html()
    {
        global $post;
        $isSystem = get_post_meta($post->ID, 'opanda_is_system', true);
        $item = OPanda_Items::getCurrentItem();
        $shortcodeName = $item['shortcode'];
        $shortcode = '[' . $shortcodeName . '] [/' . $shortcodeName . ']';
        if (!$isSystem) {
            $shortcode = '[' . $shortcodeName . ' id="' . $post->ID . '"] [/' . $shortcodeName . ']';
        }
        ?>
        <div class="factory-bootstrap-329 factory-fontawesome-320">
           <p class="onp-sl-description-section">
               <?php 
        _e('Wrap content you want to lock via the following shortcode in your post editor:', 'bizpanda');
        ?>
               <input class="onp-sl-shortcode" type="text" value='<?php 
        echo $shortcode;
        ?>
' />
           </p>
        </div>
        <?php 
    }
Example #9
0
 /**
  * Inits support for dynamic themes.
  * 
  * @since 1.0.0
  * @return void
  */
 public static function iniDynamicThemes()
 {
     $dynamicTheme = get_option('opanda_dynamic_theme', false);
     if (!$dynamicTheme) {
         return;
     }
     add_action('wp_head', 'OPanda_AssetsManager::printDynamicThemesOptions');
     require_once OPANDA_BIZPANDA_DIR . '/includes/panda-items.php';
     $lockers = get_posts(array('post_type' => OPANDA_POST_TYPE, 'meta_key' => 'opanda_item', 'meta_value' => OPanda_Items::getAvailableNames(), 'numberposts' => -1));
     foreach ($lockers as $locker) {
         self::requestAssets($locker->ID);
     }
 }
Example #10
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 
    }
/**
 * Returns available lockers.
 * 
 * @since 1.1.3
 */
function opanda_get_lockers($lockerType = null, $output = null)
{
    $lockers = get_posts(array('post_type' => OPANDA_POST_TYPE, 'meta_key' => 'opanda_item', 'meta_value' => empty($lockerType) ? OPanda_Items::getAvailableNames() : $lockerType, 'numberposts' => -1));
    foreach ($lockers as $locker) {
        $locker->post_title = empty($locker->post_title) ? sprintf(__('(no titled, ID=%s)'), $locker->ID) : $locker->post_title;
    }
    if ('vc' === $output) {
        $result = array();
        foreach ($lockers as $locker) {
            $result[$locker->post_title] = $locker->ID;
        }
        return $result;
    }
    return $lockers;
}
 /**
  * Replaces the 'blurring' overlap with 'transparence' in the free version.
  * 
  * @since 1.0.0
  * @param type $postId
  */
 public function onSavingForm($postId)
 {
     if (!OPanda_Items::isCurrentFree()) {
         return;
     }
     $overlap = isset($_POST['opanda_overlap']) ? $_POST['opanda_overlap'] : null;
     if ($overlap == 'blurring') {
         $_POST['opanda_overlap'] = 'transparence';
     }
 }
Example #13
0
/**
 * Registers default options (lockers, popups, forms).
 * 
 * @since 1.0.0
 */
function opanda_add_meta_boxes()
{
    global $bizpanda;
    $type = OPanda_Items::getCurrentItem();
    if (empty($type)) {
        return;
    }
    $typeName = $type['name'];
    $data = array();
    if (OPanda_Items::isCurrentPremium()) {
        $data[] = array('class' => 'OPanda_BasicOptionsMetaBox', 'path' => OPANDA_BIZPANDA_DIR . '/includes/metaboxes/basic-options.php');
        $data[] = array('class' => 'OPanda_PreviewMetaBox', 'path' => OPANDA_BIZPANDA_DIR . '/includes/metaboxes/preview.php');
        $data[] = array('class' => 'OPanda_ManualLockingMetaBox', 'path' => OPANDA_BIZPANDA_DIR . '/includes/metaboxes/manual-locking.php');
        $data[] = array('class' => 'OPanda_BulkLockingMetaBox', 'path' => OPANDA_BIZPANDA_DIR . '/includes/metaboxes/bulk-locking.php');
        $data[] = array('class' => 'OPanda_VisabilityOptionsMetaBox', 'path' => OPANDA_BIZPANDA_DIR . '/includes/metaboxes/visability-options.php');
        $data[] = array('class' => 'OPanda_AdvancedOptionsMetaBox', 'path' => OPANDA_BIZPANDA_DIR . '/includes/metaboxes/advanced-options.php');
    } else {
        $data[] = array('class' => 'OPanda_BasicOptionsMetaBox', 'path' => OPANDA_BIZPANDA_DIR . '/includes/metaboxes/basic-options.php');
        $data[] = array('class' => 'OPanda_PreviewMetaBox', 'path' => OPANDA_BIZPANDA_DIR . '/includes/metaboxes/preview.php');
        $data[] = array('class' => 'OPanda_ManualLockingMetaBox', 'path' => OPANDA_BIZPANDA_DIR . '/includes/metaboxes/manual-locking.php');
        $data[] = array('class' => 'OPanda_BulkLockingMetaBox', 'path' => OPANDA_BIZPANDA_DIR . '/includes/metaboxes/bulk-locking.php');
    }
    $data = apply_filters("opanda_item_type_metaboxes", $data, $typeName);
    $data = apply_filters("opanda_{$typeName}_type_metaboxes", $data);
    foreach ($data as $metabox) {
        require_once $metabox['path'];
        FactoryMetaboxes321::registerFor(new $metabox['class']($bizpanda), OPANDA_POST_TYPE, $bizpanda);
    }
}
    /**
     * Shows the screen.
     * 
     * @sinve 1.0.0
     * @return void
     */
    public function indexAction()
    {
        $types = OPanda_Items::getAvailable();
        // checkes extra items which are not installed yet
        require_once OPANDA_BIZPANDA_DIR . '/admin/includes/plugins.php';
        $suggestions = OPanda_Plugins::getSuggestions();
        ?>

        <div class="wrap factory-fontawesome-320">

            <div class="opanda-items ">
                
                <h2><?php 
        _e('Creating New Item', 'bizpanda');
        ?>
</h2>
                <p style="margin-top: 0px;"><?php 
        _e('Choose which items you would like to create.', 'bizpanda');
        ?>
</p>

                <?php 
        foreach ($types as $name => $type) {
            ?>
                <div class="postbox opanda-item opanda-item-<?php 
            echo $type['type'];
            ?>
">

                    <h4 class="opanda-title">
                        <?php 
            echo $type['title'];
            ?>
                    </h4>
                    <div class="opanda-description">
                        <?php 
            echo $type['description'];
            ?>
                    </div>
                    <div class="opanda-buttons">

                        <a href="<?php 
            echo admin_url('post-new.php?post_type=opanda-item&opanda_item=' . $name);
            ?>
" class="button button-large opanda-create">
                            <i class="fa fa-plus"></i><span><?php 
            _e('Create Item', 'bizpanda');
            ?>
</span>
                        </a>

                        <?php 
            if (isset($type['help'])) {
                ?>
                        <a href="<?php 
                echo $type['help'];
                ?>
" class="button button-large opanda-help opanda-right" title="<?php 
                _e('Click here to learn more', 'bizpanda');
                ?>
">
                            <i class="fa fa-question-circle"></i>
                        </a>
                        <?php 
            }
            ?>
                    </div>
                </div>

                <?php 
        }
        ?>
            </div>
            
            <?php 
        if (!empty($suggestions)) {
            ?>
            
            <div class="opanda-separator"></div>
            
            <div class="opanda-extra-items">
                <div class="opanda-inner-wrap">
                    
                    <h2>
                        <?php 
            _e('More Marketing Tools To Grow Your Business', 'bizpanda');
            ?>
                    </h2>
                    <p style="margin-top: 0px;">
                        <?php 
            _e('Check out other plugins which add more features to your lockers.', 'bizpanda');
            ?>
                    </p>
                    
                    <?php 
            foreach ($suggestions as $suggestion) {
                $url = $suggestion['url'];
                if (false === strpos($url, 'utm_source')) {
                    if (BizPanda::isSinglePlugin()) {
                        $plugin = BizPanda::getPlugin();
                        $args = array('utm_source' => 'plugin-' . $plugin->options['name'], 'utm_medium' => $plugin->license && isset($plugin->license->data['Category']) ? $plugin->license->data['Category'] . '-version' : 'unknown-version', 'utm_campaign' => 'suggestions', 'tracker' => isset($plugin->options['tracker']) ? $plugin->options['tracker'] : null);
                        $url = add_query_arg($args, $url);
                    } else {
                        $url = add_query_arg(array('utm_source' => 'plugin-bizpanda', 'utm_medium' => 'mixed-versions', 'utm_campaign' => 'suggestions', 'utm_term' => implode(',', BizPanda::getPluginNames(true))), $url);
                    }
                }
                ?>
                    
                        <div class="postbox opanda-item opanda-item-<?php 
                echo $suggestion['type'];
                ?>
">
                            <div class="opanda-item-cover"></div>
                            
                            <i class="fa fa-plus-circle opanda-plus-background"></i>
                            
                            <h4 class="opanda-title">
                                <?php 
                echo $suggestion['title'];
                ?>
                            </h4>
                            <div class="opanda-description">
                                <?php 
                echo $suggestion['description'];
                ?>
                            </div>
                            <div class="opanda-buttons">
                                <a href='<?php 
                echo $url;
                ?>
' class="button button-large" title="<?php 
                _e('Click here to learn more', 'bizpanda');
                ?>
">
                                    <i class="fa fa-external-link"></i><span>Learn More</span>
                                </a>
                            </div>
                        </div>
                    
                    <?php 
            }
            ?>

                    <img class="opanda-arrow" src='<?php 
            echo OPANDA_BIZPANDA_URL . '/assets/admin/img/new-item-arrow.png';
            ?>
' />
                    
                </div>
            </div>
            
            <?php 
        }
        ?>
        </div>
        <?php 
    }