コード例 #1
0
        public function show_metabox_licenses()
        {
            echo '<table class="sucom-setting licenses-metabox" style="padding-bottom:10px">' . "\n";
            echo '<tr><td colspan="4">' . $this->p->msgs->get('info-plugin-tid') . '</td></tr>' . "\n";
            foreach ($this->p->cf['plugin'] as $lca => $info) {
                $url = '';
                $links = '';
                $qty_used = class_exists('SucomUpdate') ? SucomUpdate::get_option($lca, 'qty_used') : false;
                if (!empty($info['url']['download'])) {
                    $url = $info['url']['download'];
                    $links .= ' | <a href="' . $info['url']['download'] . '" target="_blank">Download the Free Version</a>';
                }
                if (!empty($info['url']['purchase'])) {
                    $url = $info['url']['purchase'];
                    $links .= ' | <a href="' . $info['url']['purchase'] . '" target="_blank">Purchase a Pro License</a>';
                }
                if (!empty($info['img']['icon-small'])) {
                    $img = $info['img']['icon-small'];
                } else {
                    $img = 'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==';
                }
                // logo image
                echo '<tr><td style="width:140px;padding:10px 0;" rowspan="3" valign="top" align="left">';
                if (!empty($url)) {
                    echo '<a href="' . $url . '" target="_blank">';
                }
                echo '<img src="' . $img . '" width="125" height="125" class="highlight">';
                if (!empty($url)) {
                    echo '</a>';
                }
                echo '</td>';
                // plugin name
                echo '<td colspan="3" style="padding:10px 0 0 0;">
					<p><strong>' . $info['name'] . '</strong></p>';
                if (!empty($info['desc'])) {
                    echo '<p>' . $info['desc'] . '</p>';
                }
                if (!empty($links)) {
                    echo '<p>' . trim($links, ' |') . '</p>';
                }
                echo '</td></tr>' . "\n";
                if (!empty($info['url']['purchase']) || !empty($this->p->options['plugin_' . $lca . '_tid'])) {
                    echo '<tr>' . $this->p->util->th('Authentication ID', 'medium');
                    if ($this->p->cf['lca'] === $lca || $this->p->check->aop()) {
                        echo '<td class="tid">' . $this->form->get_input('plugin_' . $lca . '_tid', 'tid mono');
                    } else {
                        echo '<td class="tid blank">' . $this->form->get_no_input('plugin_' . $lca . '_tid', 'tid mono');
                    }
                    echo '</td><td><p>' . (empty($qty_used) ? '' : $qty_used . ' Licenses Assigned') . '</p></td></tr>' . "\n";
                    echo '<tr>' . $this->p->util->th('Site Use', 'medium');
                    echo '<td>' . $this->form->get_select('plugin_' . $lca . '_tid:use', $this->p->cf['form']['site_option_use'], 'site_use');
                    echo '</td><td style="padding-bottom:10px;"><p>&nbsp;</p></td></tr>' . "\n";
                } else {
                    echo '<tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>' . "\n";
                    echo '<tr><td style="padding-bottom:10px;" colspan="3"><p>&nbsp;</p></td></tr>' . "\n";
                }
            }
            echo '</table>' . "\n";
        }
コード例 #2
0
ファイル: advanced.php プロジェクト: kivivuori/jotain
 protected function get_rows($metabox, $key)
 {
     $rows = array();
     switch ($metabox . '-' . $key) {
         case 'plugin-activation':
             $rows[] = $this->p->util->th('Preserve Settings on Uninstall', 'highlight', 'plugin_preserve') . '<td>' . $this->form->get_checkbox('plugin_preserve') . '</td>';
             $rows[] = $this->p->util->th('Add Hidden Debug HTML Messages', null, 'plugin_debug') . '<td>' . $this->form->get_checkbox('plugin_debug') . '</td>';
             // retrieve information on license use, if any
             $qty_used = class_exists('SucomUpdate') ? SucomUpdate::get_option($this->p->cf['lca'], 'qty_used') : false;
             $rows[] = $this->p->util->th($this->p->cf['uca'] . ' Pro Authentication ID', null, 'plugin_tid') . '<td nowrap><p>' . $this->form->get_input('plugin_tid', 'mono') . (empty($qty_used) ? '' : ' &nbsp;' . $qty_used . ' Licenses Assigned</p>') . '</td>';
             // if the pro version code is available, show information about keeping it active for updates
             if ($this->p->is_avail['aop']) {
                 $rows[] = '<th></th><td>' . $this->p->msgs->get('tid-info') . '</td>';
             }
             break;
         case 'cm-custom':
             if (!$this->p->check->is_aop()) {
                 $rows[] = '<td colspan="4" align="center">' . $this->p->msgs->get('pro-feature-msg') . '</td>';
             }
             $rows[] = '<td></td>' . $this->p->util->th('Show', 'left checkbox') . $this->p->util->th('Contact Field Name', 'left medium', 'custom-cm-field-name') . $this->p->util->th('Profile Contact Label', 'left wide');
             $sorted_opt_pre = $this->p->cf['opt']['pre'];
             ksort($sorted_opt_pre);
             foreach ($sorted_opt_pre as $id => $pre) {
                 $cm_opt = 'plugin_cm_' . $pre . '_';
                 // check for the lib website classname for a nice 'display name'
                 $name = empty($this->p->cf['lib']['website'][$id]) ? ucfirst($id) : $this->p->cf['lib']['website'][$id];
                 $name = $name == 'GooglePlus' ? 'Google+' : $name;
                 // not all social websites have a contact method field
                 if (array_key_exists($cm_opt . 'enabled', $this->p->options)) {
                     if ($this->p->check->is_aop()) {
                         $rows[] = $this->p->util->th($name, 'medium') . '<td class="checkbox">' . $this->form->get_checkbox($cm_opt . 'enabled') . '</td>' . '<td>' . $this->form->get_input($cm_opt . 'name', 'medium') . '</td>' . '<td>' . $this->form->get_input($cm_opt . 'label') . '</td>';
                     } else {
                         $rows[] = $this->p->util->th($name, 'medium') . '<td class="blank checkbox">' . $this->form->get_fake_checkbox($cm_opt . 'enabled') . '</td>' . '<td class="blank medium">' . $this->form->get_hidden($cm_opt . 'name') . $this->p->options[$cm_opt . 'name'] . '</td>' . '<td class="blank">' . $this->form->get_hidden($cm_opt . 'label') . $this->p->options[$cm_opt . 'label'] . '</td>';
                     }
                 }
             }
             break;
         case 'cm-builtin':
             if (!$this->p->check->is_aop()) {
                 $rows[] = '<td colspan="4" align="center">' . $this->p->msgs->get('pro-feature-msg') . '</td>';
             }
             $rows[] = '<td></td>' . $this->p->util->th('Show', 'left checkbox') . $this->p->util->th('Contact Field Name', 'left medium', 'wp-cm-field-name') . $this->p->util->th('Profile Contact Label', 'left wide');
             $sorted_wp_contact = $this->p->cf['wp']['cm'];
             ksort($sorted_wp_contact);
             foreach ($sorted_wp_contact as $id => $name) {
                 $cm_opt = 'wp_cm_' . $id . '_';
                 if (array_key_exists($cm_opt . 'enabled', $this->p->options)) {
                     if ($this->p->check->is_aop()) {
                         $rows[] = $this->p->util->th($name, 'medium') . '<td class="checkbox">' . $this->form->get_checkbox($cm_opt . 'enabled') . '</td>' . '<td>' . $this->form->get_fake_input($cm_opt . 'name', 'medium') . '</td>' . '<td>' . $this->form->get_input($cm_opt . 'label') . '</td>';
                     } else {
                         $rows[] = $this->p->util->th($name, 'medium') . '<td class="blank checkbox">' . $this->form->get_hidden($cm_opt . 'enabled') . $this->form->get_fake_checkbox($cm_opt . 'enabled') . '</td>' . '<td>' . $this->form->get_fake_input($cm_opt . 'name', 'medium') . '</td>' . '<td class="blank">' . $this->form->get_hidden($cm_opt . 'label') . $this->p->options[$cm_opt . 'label'] . '</td>';
                     }
                 }
             }
             break;
     }
     return $rows;
 }
コード例 #3
0
ファイル: network.php プロジェクト: kivivuori/jotain
        protected function get_rows($metabox, $key)
        {
            $ret = array();
            $use = array('default' => 'As Default Value', 'empty' => 'If Value is Empty', 'force' => 'Force This Value');
            // generic tooltip message for site option use
            $use_msg = esc_attr('Individual sites / blogs may use this value as a default when the plugin is first activated, 
			if the current site / blog option value is blank, or force every site / blog to use this value (disabling editing of this field).');
            switch ($metabox . '-' . $key) {
                case 'network-settings':
                    // retrieve information on license use, if any
                    $qty_used = class_exists('SucomUpdate') ? SucomUpdate::get_option($this->p->cf['lca'], 'qty_used') : false;
                    $ret[] = $this->p->util->th($this->p->cf['uca'] . ' Pro Authentication ID', 'highlight', 'plugin_tid_network') . '<td nowrap><p>' . $this->form->get_input('plugin_tid', 'mono') . (empty($qty_used) ? '' : ' &nbsp;' . $qty_used . ' Licenses Assigned</p>') . '</td>' . '<td nowrap>Site Use <img src="' . NGFB_URLPATH . 'images/question-mark.png" class="sucom_tooltip' . '" alt="' . $use_msg . '" /> ' . $this->form->get_select('plugin_tid:use', $use, 'medium') . '</td>';
                    $ret[] = $this->p->util->th('Object Cache Expiry', null, 'plugin_object_cache_exp') . '<td nowrap>' . $this->form->get_input('plugin_object_cache_exp', 'short') . ' seconds</td>' . '<td nowrap>Site Use <img src="' . NGFB_URLPATH . 'images/question-mark.png" class="sucom_tooltip' . '" alt="' . $use_msg . '" /> ' . $this->form->get_select('plugin_object_cache_exp:use', $use, 'medium') . '</td>';
                    break;
                    break;
            }
            return $ret;
        }
コード例 #4
0
ファイル: check.php プロジェクト: christocmp/bingopaws
 public function aop($lca = '', $active = true)
 {
     $lca = empty($lca) ? $this->p->cf['lca'] : $lca;
     $uca = strtoupper($lca);
     $installed = defined($uca . '_PLUGINDIR') && is_dir(constant($uca . '_PLUGINDIR') . 'lib/pro/') ? true : false;
     return $active === true ? !empty($this->p->options['plugin_' . $lca . '_tid']) && $installed && class_exists('SucomUpdate') && ($umsg = SucomUpdate::get_umsg($lca) ? false : $installed) ? $umsg : false : $installed;
 }
コード例 #5
0
ファイル: check.php プロジェクト: kivivuori/jotain
 public function is_aop()
 {
     return !empty($this->p->options['plugin_tid']) && self::$a && class_exists('SucomUpdate') && ($u = SucomUpdate::get_umsg($this->p->cf['lca']) ? self::$n : self::$a) ? $u : self::$n;
 }
コード例 #6
0
ファイル: notice.php プロジェクト: sonvq/passioninvestment
 public function show_admin_notices()
 {
     $hidden = array();
     $msg_html = '';
     $nag_msgs = '';
     $all_opts = $this->get_all_options();
     $all_msgs = array();
     $have_changes = false;
     $user_id = get_current_user_id();
     $dis_arr = empty($user_id) ? false : get_user_option($this->dis_name, $user_id);
     // get dismissed message ids
     if (isset($this->p->cf['plugin']) && class_exists('SucomUpdate')) {
         foreach (array_keys($this->p->cf['plugin']) as $lca) {
             if (!empty($this->p->options['plugin_' . $lca . '_tid'])) {
                 $umsg = SucomUpdate::get_umsg($lca);
                 if ($umsg !== false && $umsg !== true) {
                     $all_opts['log']['err'][$umsg] = array();
                 }
             }
         }
     }
     foreach (array('opt', 'usr', 'log') as $name) {
         foreach (array_keys($this->log) as $type) {
             foreach ($all_opts[$name][$type] as $msg_txt => $payload) {
                 if (empty($msg_txt) || isset($all_msgs[$msg_txt])) {
                     continue;
                 }
                 $all_msgs[$msg_txt] = true;
                 // avoid duplicates
                 switch ($type) {
                     case 'nag':
                         $nag_msgs .= $msg_txt;
                         // append to echo a single message
                         continue;
                     default:
                         if (!empty($payload['dismiss']) && isset($dis_arr[$payload['msg_id']])) {
                             $now_time = time();
                             $dis_time = $dis_arr[$payload['msg_id']];
                             if (empty($dis_time) || $dis_time > $now_time) {
                                 $payload['hidden'] = true;
                                 if (isset($hidden[$type])) {
                                     $hidden[$type]++;
                                 } else {
                                     $hidden[$type] = 1;
                                 }
                             } else {
                                 $have_changes = true;
                                 unset($dis_arr[$payload['msg_id']]);
                             }
                         }
                         $msg_html .= $this->get_notice_html($type, $msg_txt, $payload);
                         break;
                 }
             }
         }
     }
     $this->trunc();
     // don't save unless we've changes something
     if ($have_changes === true && !empty($user_id)) {
         if (empty($dis_arr)) {
             delete_user_option($user_id, $this->dis_name);
         } else {
             update_user_option($user_id, $this->dis_name, $dis_arr);
         }
     }
     echo "\n";
     echo '<!-- ' . $this->lca . ' admin notices begin -->' . "\n";
     if (!empty($nag_msgs)) {
         echo $this->get_nag_style();
         echo $this->get_notice_html('nag', $nag_msgs);
     }
     // remind the user that there are hidden warning messages
     if (isset($hidden['err'])) {
         if ($hidden['err'] > 1) {
             echo $this->get_notice_html('inf', sprintf(__('%1$d warning messages have been hidden &mdash; <a id="%2$s">unhide these notices temporarily</a>.', $this->text_dom), $hidden['err'], $this->lca . '-unhide-notices'));
         } elseif ($hidden['err'] > 0) {
             echo $this->get_notice_html('inf', sprintf(__('%1$d warning message has been hidden &mdash; <a id="%2$s">unhide this notice temporarily</a>.', $this->text_dom), $hidden['err'], $this->lca . '-unhide-notices'));
         }
     }
     echo $msg_html;
     echo '<!-- ' . $this->lca . ' admin notices end -->' . "\n";
 }
コード例 #7
0
ファイル: admin.php プロジェクト: jamesvillarrubia/uniken-web
        public function licenses_metabox($network = false)
        {
            echo '<table class="sucom-setting ' . $this->p->cf['lca'] . ' licenses-metabox"
				style="padding-bottom:10px">' . "\n";
            echo '<tr><td colspan="' . ($network ? 5 : 4) . '">' . $this->p->msgs->get('info-plugin-tid') . '</td></tr>' . "\n";
            $num = 0;
            $total = count($this->p->cf['plugin']);
            foreach ($this->p->cf['plugin'] as $lca => $info) {
                $num++;
                $links = '';
                $img_href = '';
                $view_text = 'View Plugin Details';
                if (!empty($info['slug']) && (empty($info['url']['latest_zip']) || $this->p->is_avail['util']['um'])) {
                    $img_href = add_query_arg(array('tab' => 'plugin-information', 'plugin' => $info['slug'], 'TB_iframe' => 'true', 'width' => 600, 'height' => 550), get_admin_url(null, 'plugin-install.php'));
                    if (is_dir(WP_PLUGIN_DIR . '/' . $info['slug'])) {
                        $update_plugins = get_site_transient('update_plugins');
                        if (isset($update_plugins->response)) {
                            foreach ((array) $update_plugins->response as $file => $plugin) {
                                if ($plugin->slug === $info['slug']) {
                                    $view_text = '<strong>View Plugin Details and Update</strong>';
                                    break;
                                }
                            }
                        }
                    } else {
                        $view_text = '<em>View Plugin Details and Install</em>';
                    }
                    $links .= ' | <a href="' . $img_href . '" class="thickbox">' . $view_text . '</a>';
                } else {
                    if (!empty($info['url']['download'])) {
                        $img_href = $info['url']['download'];
                        $links .= ' | <a href="' . $img_href . '" target="_blank">Plugin Description Page</a>';
                    }
                }
                if (!empty($info['url']['latest_zip'])) {
                    $img_href = $info['url']['latest_zip'];
                    $links .= ' | <a href="' . $img_href . '">Download the Latest Version</a> (zip file)';
                }
                if (!empty($info['url']['purchase'])) {
                    $img_href = $info['url']['purchase'];
                    if ($this->p->cf['lca'] === $lca || $this->p->check->aop()) {
                        $links .= ' | <a href="' . $img_href . '" target="_blank">Purchase Pro License(s)</a>';
                    } else {
                        $links .= ' | <em>Purchase Pro License(s)</em>';
                    }
                }
                if (!empty($info['img']['icon_small'])) {
                    $img_icon = $info['img']['icon_medium'];
                } else {
                    $img_icon = 'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==';
                }
                // logo image
                echo '<tr><td style="width:148px; padding:10px;" rowspan="3" valign="top" align="left">';
                if (!empty($img_href)) {
                    echo '<a href="' . $img_href . '"' . (strpos($img_href, 'TB_iframe') ? ' class="thickbox"' : ' target="_blank"') . '>';
                }
                echo '<img src="' . $img_icon . '" width="128" height="128">';
                if (!empty($img_href)) {
                    echo '</a>';
                }
                echo '</td>';
                // plugin name
                echo '<td colspan="' . ($network ? 4 : 3) . '" style="padding:10px 0 0 0;">
					<p><strong>' . $info['name'] . '</strong></p>';
                if (!empty($info['desc'])) {
                    echo '<p>' . $info['desc'] . '</p>';
                }
                if (!empty($links)) {
                    echo '<p>' . trim($links, ' |') . '</p>';
                }
                echo '</td></tr>' . "\n";
                if ($network) {
                    if (!empty($info['url']['purchase']) || !empty($this->p->options['plugin_' . $lca . '_tid'])) {
                        if ($this->p->cf['lca'] === $lca || $this->p->check->aop()) {
                            echo '<tr>' . $this->p->util->get_th('Authentication ID', 'medium nowrap') . '<td class="tid">' . $this->form->get_input('plugin_' . $lca . '_tid', 'tid mono') . '</td>' . $this->p->util->get_th('Site Use', 'site_use') . '<td>' . $this->form->get_select('plugin_' . $lca . '_tid:use', $this->p->cf['form']['site_option_use'], 'site_use') . '</td></tr>' . "\n";
                        } else {
                            echo '<tr>' . $this->p->util->get_th('Authentication ID', 'medium nowrap') . '<td class="blank">' . (empty($this->p->options['plugin_' . $lca . '_tid']) ? $this->form->get_no_input('plugin_' . $lca . '_tid', 'tid mono') : $this->form->get_input('plugin_' . $lca . '_tid', 'tid mono')) . '</td><td>' . $this->p->msgs->get('pro-option-msg') . '</td>
									<td>&nbsp;</td><td>&nbsp;</td></tr>' . "\n";
                        }
                    } else {
                        echo '<tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>' . "\n";
                    }
                } else {
                    if (!empty($info['url']['purchase']) || !empty($this->p->options['plugin_' . $lca . '_tid'])) {
                        if ($this->p->cf['lca'] === $lca || $this->p->check->aop()) {
                            $qty_used = class_exists('SucomUpdate') ? SucomUpdate::get_option($lca, 'qty_used') : false;
                            echo '<tr>' . $this->p->util->get_th('Authentication ID', 'medium nowrap') . '<td class="tid">' . $this->form->get_input('plugin_' . $lca . '_tid', 'tid mono') . '</td><td><p>' . (empty($qty_used) ? '' : $qty_used . ' Licenses Assigned') . '</p></td></tr>' . "\n";
                        } else {
                            echo '<tr>' . $this->p->util->get_th('Authentication ID', 'medium nowrap') . '<td class="blank">' . (empty($this->p->options['plugin_' . $lca . '_tid']) ? $this->form->get_no_input('plugin_' . $lca . '_tid', 'tid mono') : $this->form->get_input('plugin_' . $lca . '_tid', 'tid mono')) . '</td><td>' . $this->p->msgs->get('pro-option-msg') . '</td></tr>' . "\n";
                        }
                    } else {
                        echo '<tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</tr>' . "\n";
                    }
                }
                if ($num < $total) {
                    echo '<tr><td style="border-bottom:1px dotted #ddd;" colspan="' . ($network ? 4 : 3) . '">&nbsp;</td></tr>' . "\n";
                } else {
                    echo '<tr><td colspan="' . ($network ? 4 : 3) . '">&nbsp;</td></tr>' . "\n";
                }
            }
            echo '</table>' . "\n";
        }
コード例 #8
0
ファイル: check.php プロジェクト: sonvq/passioninvestment
 public function aop($lca = '', $lic = true, $rv = true)
 {
     $lca = empty($lca) ? $this->p->cf['lca'] : $lca;
     $kn = $lca . '-' . $lic . '-' . $rv;
     if (isset(self::$c[$kn])) {
         return self::$c[$kn];
     }
     $uca = strtoupper($lca);
     if (defined($uca . '_PLUGINDIR')) {
         $pdir = constant($uca . '_PLUGINDIR');
     } elseif (isset($this->p->cf['plugin'][$lca]['slug'])) {
         $slug = $this->p->cf['plugin'][$lca]['slug'];
         if (!defined('WPMU_PLUGIN_DIR') || !is_dir($pdir = WPMU_PLUGIN_DIR . '/' . $slug . '/')) {
             if (!defined('WP_PLUGIN_DIR') || !is_dir($pdir = WP_PLUGIN_DIR . '/' . $slug . '/')) {
                 return self::$c[$kn] = false;
             }
         }
     } else {
         return self::$c[$kn] = false;
     }
     $on = 'plugin_' . $lca . '_tid';
     $ins = is_dir($pdir . 'lib/pro/') ? $rv : false;
     return self::$c[$kn] = $lic === true ? !empty($this->p->options[$on]) && $ins && class_exists('SucomUpdate') && ($um = SucomUpdate::get_umsg($lca) ? false : $ins) ? $um : false : $ins;
 }
コード例 #9
0
ファイル: nextgen-facebook.php プロジェクト: kivivuori/jotain
 public function set_objects($activate = false)
 {
     /*
      * basic plugin setup (settings, check, debug, notices, utils)
      */
     $this->set_options();
     require_once NGFB_PLUGINDIR . 'lib/com/debug.php';
     if (!empty($this->options['plugin_tid'])) {
         require_once NGFB_PLUGINDIR . 'lib/com/update.php';
     }
     $this->check = new NgfbCheck($this);
     $this->is_avail = $this->check->get_avail();
     // uses options
     if ($this->is_avail['aop']) {
         $this->cf['full'] = $this->cf['full_pro'];
     }
     // load and config debug class
     $html_debug = !empty($this->options['plugin_debug']) || defined('NGFB_HTML_DEBUG') && NGFB_HTML_DEBUG ? true : false;
     $wp_debug = defined('NGFB_WP_DEBUG') && NGFB_WP_DEBUG ? true : false;
     if ($html_debug || $wp_debug) {
         $this->debug = new SucomDebug($this, array('html' => $html_debug, 'wp' => $wp_debug));
     } else {
         $this->debug = new NgfbNoDebug();
     }
     $this->notice = new SucomNotice($this);
     $this->util = new NgfbUtil($this);
     $this->opt = new NgfbOptions($this);
     $this->cache = new SucomCache($this);
     // object and file caching
     $this->style = new SucomStyle($this);
     // admin styles
     $this->script = new SucomScript($this);
     // admin jquery tooltips
     $this->webpage = new SucomWebpage($this);
     // title, desc, etc., plus shortcodes
     $this->user = new NgfbUser($this);
     // contact methods and metabox prefs
     $this->media = new NgfbMedia($this);
     // images, videos, etc.
     $this->head = new NgfbHead($this);
     // open graph and twitter card meta tags
     if (is_admin()) {
         $this->msgs = new NgfbMessages($this);
         // admin tooltip messages
         $this->admin = new NgfbAdmin($this);
         // admin menus and page loader
     }
     if ($this->is_avail['opengraph']) {
         $this->og = new NgfbOpengraph($this);
     } else {
         $this->og = new SucomOpengraph($this);
     }
     // read open graph html tags
     if ($this->is_avail['ssb']) {
         $this->sharing = new NgfbSharing($this);
     }
     // wp_head and wp_footer js and buttons
     if (!$this->check->is_aop() || get_option($this->cf['lca'] . '_umsg') || SucomUpdate::get_umsg($this->cf['lca'])) {
         require_once NGFB_PLUGINDIR . 'lib/gpl/addon.php';
         $this->gpl = new NgfbAddonGpl($this);
     } else {
         $this->pro = new NgfbAddonPro($this);
     }
     do_action($this->cf['lca'] . '_init_addon');
     /*
      * check and create the default options array
      *
      * execute after all objects have been defines, so hooks into 'ngfb_get_defaults' are available
      */
     if (is_multisite() && (!is_array($this->site_options) || empty($this->site_options))) {
         $this->site_options = $this->opt->get_site_defaults();
     }
     if ($activate == true || !empty($_GET['action']) && $_GET['action'] == 'activate-plugin' && !empty($_GET['plugin']) && $_GET['plugin'] == NGFB_PLUGINBASE) {
         $this->debug->log('plugin activation detected');
         if (!is_array($this->options) || empty($this->options) || defined('NGFB_RESET_ON_ACTIVATE') && NGFB_RESET_ON_ACTIVATE) {
             $this->options = $this->opt->get_defaults();
             delete_option(NGFB_OPTIONS_NAME);
             add_option(NGFB_OPTIONS_NAME, $this->options, null, 'yes');
             $this->debug->log('default options have been added to the database');
         }
         $this->debug->log('exiting early: init_plugin() to follow');
         return;
         // no need to continue, init_plugin() will handle the rest
     }
     /*
      * check and upgrade options if necessary
      */
     $this->options = $this->opt->check_options(NGFB_OPTIONS_NAME, $this->options);
     if (is_multisite()) {
         $this->site_options = $this->opt->check_options(NGFB_SITE_OPTIONS_NAME, $this->site_options);
     }
     /*
      * configure class properties based on plugin settings
      */
     $this->cache->object_expire = $this->options['plugin_object_cache_exp'];
     if (!empty($this->options['plugin_file_cache_hrs'])) {
         if ($this->debug->is_on('wp') === true) {
             $this->cache->file_expire = NGFB_DEBUG_FILE_EXP;
         } else {
             $this->cache->file_expire = $this->options['plugin_file_cache_hrs'] * 60 * 60;
         }
     } else {
         $this->cache->file_expire = 0;
     }
     // just in case
     $this->is_avail['cache']['file'] = $this->cache->file_expire > 0 ? true : false;
     // disable the transient and object cache ONLY if the html debug mode is on
     if ($this->debug->is_on('html') === true) {
         foreach (array('object', 'transient') as $name) {
             $constant_name = 'NGFB_' . strtoupper($name) . '_CACHE_DISABLE';
             $this->is_avail['cache'][$name] = defined($constant_name) && !constant($constant_name) ? true : false;
         }
         $cache_msg = 'object cache ' . ($this->is_avail['cache']['object'] ? 'could not be' : 'is') . ' disabled, and transient cache ' . ($this->is_avail['cache']['transient'] ? 'could not be' : 'is') . ' disabled.';
         $this->debug->log('HTML debug mode active: ' . $cache_msg);
         $this->notice->inf('HTML debug mode active &ndash; ' . $cache_msg . ' ' . __('Informational messages are being added to webpages as hidden HTML comments.', NGFB_TEXTDOM));
     }
     // setup the update checks if we have an Authentication ID
     if (!empty($this->options['plugin_tid'])) {
         add_filter($this->cf['lca'] . '_ua_plugin', array(&$this, 'filter_ua_plugin'), 10, 1);
         add_filter($this->cf['lca'] . '_installed_version', array(&$this, 'filter_installed_version'), 10, 1);
         $this->update = new SucomUpdate($this, $this->cf['lca'], $this->cf['slug'], NGFB_PLUGINBASE, $this->cf['url']['pro_update']);
         if (is_admin()) {
             // if update_hours * 2 has passed without an update, then force one now
             $last_update = get_option($this->cf['lca'] . '_utime');
             if (empty($last_update) || !empty($this->cf['update_hours']) && $last_update + $this->cf['update_hours'] * 7200 < time()) {
                 $this->update->check_for_updates();
             }
         }
     }
 }
コード例 #10
0
ファイル: advanced.php プロジェクト: christocmp/bingopaws
 protected function get_rows($metabox, $key)
 {
     $rows = array();
     switch ($metabox . '-' . $key) {
         case 'plugin-settings':
             // retrieve information on license use, if any
             $qty_used = class_exists('SucomUpdate') ? SucomUpdate::get_option($this->p->cf['lca'], 'qty_used') : false;
             $rows[] = $this->p->util->th('Plugin Settings to Display', 'highlight', 'plugin_display') . '<td>' . $this->form->get_select('plugin_display', $this->p->cf['form']['display_options']) . '</td>';
             $rows[] = $this->p->util->th('Preserve Settings on Uninstall', 'highlight', 'plugin_preserve') . '<td>' . $this->form->get_checkbox('plugin_preserve') . '</td>';
             $rows[] = $this->p->util->th('Add Hidden Debug Messages', null, 'plugin_debug') . '<td>' . $this->form->get_checkbox('plugin_debug') . '</td>';
             break;
         case 'cm-custom':
             if (!$this->p->check->aop()) {
                 $rows[] = '<td colspan="4" align="center">' . $this->p->msgs->get('pro-feature-msg') . '</td>';
             }
             $rows[] = '<td></td>' . $this->p->util->th('Show', 'left checkbox') . $this->p->util->th('Contact Field Name', 'left medium', 'custom-cm-field-name') . $this->p->util->th('Profile Contact Label', 'left wide');
             $sorted_opt_pre = $this->p->cf['opt']['pre'];
             ksort($sorted_opt_pre);
             foreach ($sorted_opt_pre as $id => $pre) {
                 $cm_opt = 'plugin_cm_' . $pre . '_';
                 // check for the lib website classname for a nice 'display name'
                 $name = empty($this->p->cf['*']['lib']['website'][$id]) ? ucfirst($id) : $this->p->cf['*']['lib']['website'][$id];
                 $name = $name == 'GooglePlus' ? 'Google+' : $name;
                 switch ($id) {
                     case 'facebook':
                     case 'gplus':
                     case 'twitter':
                     case $this->p->options['plugin_display'] === 'all' ? true : false:
                         // not all social websites have a contact method field
                         if (array_key_exists($cm_opt . 'enabled', $this->p->options)) {
                             if ($this->p->check->aop()) {
                                 $rows[] = $this->p->util->th($name, 'medium') . '<td class="checkbox">' . $this->form->get_checkbox($cm_opt . 'enabled') . '</td>' . '<td>' . $this->form->get_input($cm_opt . 'name', 'medium') . '</td>' . '<td>' . $this->form->get_input($cm_opt . 'label') . '</td>';
                             } else {
                                 $rows[] = $this->p->util->th($name, 'medium') . '<td class="blank checkbox">' . $this->form->get_no_checkbox($cm_opt . 'enabled') . '</td>' . '<td class="blank">' . $this->form->get_no_input($cm_opt . 'name', 'medium') . '</td>' . '<td class="blank">' . $this->form->get_no_input($cm_opt . 'label') . '</td>';
                             }
                         }
                         break;
                 }
             }
             break;
         case 'cm-builtin':
             if (!$this->p->check->aop()) {
                 $rows[] = '<td colspan="4" align="center">' . $this->p->msgs->get('pro-feature-msg') . '</td>';
             }
             $rows[] = '<td></td>' . $this->p->util->th('Show', 'left checkbox') . $this->p->util->th('Contact Field Name', 'left medium', 'wp-cm-field-name') . $this->p->util->th('Profile Contact Label', 'left wide');
             $sorted_wp_contact = $this->p->cf['wp']['cm'];
             ksort($sorted_wp_contact);
             foreach ($sorted_wp_contact as $id => $name) {
                 $cm_opt = 'wp_cm_' . $id . '_';
                 if (array_key_exists($cm_opt . 'enabled', $this->p->options)) {
                     if ($this->p->check->aop()) {
                         $rows[] = $this->p->util->th($name, 'medium') . '<td class="checkbox">' . $this->form->get_checkbox($cm_opt . 'enabled') . '</td>' . '<td>' . $this->form->get_no_input($cm_opt . 'name', 'medium') . '</td>' . '<td>' . $this->form->get_input($cm_opt . 'label') . '</td>';
                     } else {
                         $rows[] = $this->p->util->th($name, 'medium') . '<td class="blank checkbox">' . $this->form->get_hidden($cm_opt . 'enabled') . $this->form->get_no_checkbox($cm_opt . 'enabled') . '</td>' . '<td>' . $this->form->get_no_input($cm_opt . 'name', 'medium') . '</td>' . '<td class="blank">' . $this->form->get_no_input($cm_opt . 'label') . '</td>';
                     }
                 }
             }
             break;
     }
     return $rows;
 }
コード例 #11
0
        public function admin_notices()
        {
            $all_nag_msgs = '';
            foreach (array_keys($this->log) as $type) {
                $user_id = get_current_user_id();
                // since wp 3.0
                $msg_opt = $this->lca . '_notices_' . $type;
                $msg_arr = array_unique(array_merge((array) get_option($msg_opt), (array) get_user_option($msg_opt, $user_id), $this->log[$type]));
                $this->trunc($type);
                if ($type === 'err' && isset($this->p->cf['plugin']) && class_exists('SucomUpdate')) {
                    foreach (array_keys($this->p->cf['plugin']) as $lca) {
                        if (!empty($this->p->options['plugin_' . $lca . '_tid'])) {
                            $umsg = SucomUpdate::get_umsg($lca);
                            if ($umsg !== false && $umsg !== true) {
                                $msg_arr[] = $umsg;
                            }
                        }
                    }
                }
                if (!empty($msg_arr)) {
                    if ($type == 'nag') {
                        echo $this->get_nag_style($this->lca);
                    }
                    foreach ($msg_arr as $key => $msg) {
                        if (!empty($msg)) {
                            $label = '';
                            $class = '';
                            $cssid_attr = strpos($key, $type . '_') === 0 ? ' id="' . $key . '"' : '';
                            switch ($type) {
                                case 'nag':
                                    $all_nag_msgs .= $msg;
                                    // append to echo later in single div block
                                    break;
                                case 'err':
                                    if (empty($class)) {
                                        $class = 'error';
                                    }
                                    if (empty($label) && !empty($this->label)) {
                                        $label = $this->label . ' Notice';
                                    }
                                    // or 'Warning'
                                    // no break
                                // or 'Warning'
                                // no break
                                case 'inf':
                                    // allow for variable definitions in previous case blocks
                                    if (empty($class)) {
                                        $class = 'updated fade';
                                    }
                                    if (empty($label) && !empty($this->label)) {
                                        $label = $this->label . ' Notice';
                                    }
                                    // or 'Info'
                                    echo '<div class="' . $class . '"' . $cssid_attr . '>';
                                    if (!empty($label)) {
                                        echo '<div style="display:table-cell;">
											<p style="margin:5px 0;white-space:nowrap;">
												<b>' . $label . '</b>:</p></div>';
                                    }
                                    echo '<div style="display:table-cell;">
										<p style="margin:5px;text-align:left">' . $msg . '</p></div>';
                                    echo '</div>';
                                    break;
                            }
                        }
                    }
                }
            }
            if (!empty($all_nag_msgs)) {
                echo '<div class="update-nag ' . $this->lca . '-update-nag">', $all_nag_msgs, '</div>', "\n";
            }
        }
コード例 #12
0
ファイル: notice.php プロジェクト: christocmp/bingopaws
        public function admin_notices()
        {
            $all_nag_msgs = '';
            foreach (array('nag', 'err', 'inf') as $type) {
                $user_id = get_current_user_id();
                // since wp 3.0
                $msg_opt = $this->lca . '_notices_' . $type;
                $msg_arr = array_unique(array_merge((array) get_option($msg_opt), (array) get_user_option($msg_opt, $user_id), $this->log[$type]));
                $this->trunc($type);
                if ($type === 'err' && class_exists('SucomUpdate')) {
                    foreach ($this->p->cf['plugin'] as $lca => $info) {
                        if (($umsg = SucomUpdate::get_umsg($lca)) !== false && $umsg !== true) {
                            $msg_arr[] = $umsg;
                        }
                    }
                }
                if (!empty($msg_arr)) {
                    if ($type == 'nag') {
                        echo '<style type="text/css">
							.' . $this->lca . '-update-nag {
								display:block;
								line-height:1.4em;
								background-image: url("' . constant($this->p->cf['uca'] . '_URLPATH') . 'images/background.jpg");
								background-position:top;
								background-size:cover;
								border:1px dashed #ccc;
								padding:10px 40px 10px 40px;
								margin-top:0;
							}
							.' . $this->lca . '-update-nag p,
							.' . $this->lca . '-update-nag ul {
								max-width:900px;
								margin:15px auto 15px auto;
								text-align:center;
							}
							.' . $this->lca . '-update-nag li {
								list-style:circle outside none;
								text-align:left;
								margin:5px 0 5px 20px;
							}
						</style>';
                    }
                    foreach ($msg_arr as $key => $msg) {
                        if (!empty($msg)) {
                            $cssid = strpos($key, $type . '_') === 0 ? $cssid = ' id="' . $key . '"' : '';
                            switch ($type) {
                                case 'nag':
                                    $all_nag_msgs .= $msg;
                                    break;
                                case 'err':
                                    echo '<div class="error"' . $cssid . '><div style="float:left;"><p style="white-space:nowrap;"><b>' . $this->p->cf['menu'] . ' Warning</b> :</p></div> <p style="text-align:left">' . $msg . '</p></div>' . "\n";
                                    break;
                                case 'inf':
                                    echo '<div class="updated fade"' . $cssid . '><div style="float:left;"><p style="white-space:nowrap;"><b>' . $this->p->cf['menu'] . ' Info</b> :</p></div> <p style="text-align:left">' . $msg . '</p></div>' . "\n";
                                    break;
                            }
                        }
                    }
                }
            }
            if (!empty($all_nag_msgs)) {
                echo '<div class="update-nag ' . $this->lca . '-update-nag">', $all_nag_msgs, '</div>', "\n";
            }
        }
コード例 #13
0
ファイル: admin.php プロジェクト: leotaillard/btws2016
        public function licenses_metabox_content($network = false)
        {
            echo '<table class="sucom-setting ' . $this->p->cf['lca'] . ' licenses-metabox"
				style="padding-bottom:10px">' . "\n";
            echo '<tr><td colspan="' . ($network ? 5 : 4) . '">' . $this->p->msgs->get('info-plugin-tid' . ($network ? '-network' : '')) . '</td></tr>' . "\n";
            $num = 0;
            $total = count($this->p->cf['plugin']);
            foreach ($this->p->cf['plugin'] as $ext => $info) {
                $num++;
                $links = '';
                $img_href = '';
                $view_text = _x('View Plugin Details', 'plugin action link', 'nextgen-facebook');
                if (!empty($info['slug']) && (empty($info['url']['latest_zip']) || $this->p->is_avail['util']['um'])) {
                    $img_href = add_query_arg(array('tab' => 'plugin-information', 'plugin' => $info['slug'], 'TB_iframe' => 'true', 'width' => 600, 'height' => 550), get_admin_url(null, 'plugin-install.php'));
                    // check to see if plugin is installed or not
                    if (is_dir(WP_PLUGIN_DIR . '/' . $info['slug'])) {
                        $update_plugins = get_site_transient('update_plugins');
                        if (isset($update_plugins->response)) {
                            foreach ((array) $update_plugins->response as $file => $plugin) {
                                if ($plugin->slug === $info['slug']) {
                                    $view_text = '<font color="red">' . _x('View Plugin Details + Update', 'plugin action link', 'nextgen-facebook') . '</font>';
                                    break;
                                }
                            }
                        }
                    } else {
                        $view_text = _x('View Plugin Details + Install', 'plugin action link', 'nextgen-facebook');
                    }
                    $links .= ' | <a href="' . $img_href . '" class="thickbox">' . $view_text . '</a>';
                } elseif (!empty($info['url']['download'])) {
                    $img_href = $info['url']['download'];
                    $links .= ' | <a href="' . $img_href . '" target="_blank">' . _x('Plugin Description Page', 'plugin action link', 'nextgen-facebook') . '</a>';
                }
                if (!empty($info['url']['latest_zip'])) {
                    $links .= ' | <a href="' . $info['url']['latest_zip'] . '">' . _x('Download Latest Version', 'plugin action link', 'nextgen-facebook') . '</a> (ZIP)';
                }
                if (!empty($info['url']['purchase'])) {
                    if ($this->p->cf['lca'] === $ext || $this->p->check->aop($this->p->cf['lca'], false, $this->p->is_avail['aop'])) {
                        $links .= ' | <a href="' . $info['url']['purchase'] . '" target="_blank">' . _x('Purchase Pro License(s)', 'plugin action link', 'nextgen-facebook') . '</a>';
                    } else {
                        $links .= ' | <em>' . _x('Purchase Pro License(s)', 'plugin action link', 'nextgen-facebook') . '</em>';
                    }
                }
                if (!empty($info['img']['icon_small'])) {
                    $img_src = 'src="' . $info['img']['icon_small'] . '"';
                } else {
                    $img_src = 'src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="';
                }
                if (!empty($info['img']['icon_medium'])) {
                    $img_src .= ' srcset="' . $info['img']['icon_medium'] . ' 256w"';
                }
                // logo image
                echo '<tr><td style="width:148px; padding:10px;" rowspan="3" valign="top" align="left">' . "\n";
                if (!empty($img_href)) {
                    echo '<a href="' . $img_href . '"' . (strpos($img_href, 'TB_iframe') ? ' class="thickbox"' : ' target="_blank"') . '>';
                }
                echo '<img ' . $img_src . ' width="128" height="128">';
                if (!empty($img_href)) {
                    echo '</a>';
                }
                echo '</td>' . "\n";
                // plugin name
                echo '<td colspan="' . ($network ? 4 : 3) . '" style="padding:10px 0 0 0;">
					<p><strong>' . $info['name'] . '</strong></p>';
                if (!empty($info['desc'])) {
                    echo '<p>' . _x($info['desc'], 'plugin description', 'nextgen-facebook') . '</p>';
                }
                if (!empty($links)) {
                    echo '<p>' . trim($links, ' |') . '</p>';
                }
                echo '</td></tr>' . "\n";
                if ($network) {
                    if (!empty($info['update_auth']) || !empty($this->p->options['plugin_' . $ext . '_tid'])) {
                        if ($this->p->cf['lca'] === $ext || $this->p->check->aop($this->p->cf['lca'], true, $this->p->is_avail['aop'])) {
                            echo '<tr>' . $this->p->util->get_th(_x('Pro Authentication ID', 'option label', 'nextgen-facebook'), 'medium nowrap') . '<td class="tid">' . $this->form->get_input('plugin_' . $ext . '_tid', 'tid mono') . '</td>' . $this->p->admin->get_site_use($this->form, true, 'plugin_' . $ext . '_tid');
                        } else {
                            echo '<tr>' . $this->p->util->get_th(_x('Pro Authentication ID', 'option label', 'nextgen-facebook'), 'medium nowrap') . '<td class="blank">' . (empty($this->p->options['plugin_' . $ext . '_tid']) ? $this->form->get_no_input('plugin_' . $ext . '_tid', 'tid mono') : $this->form->get_input('plugin_' . $ext . '_tid', 'tid mono')) . '</td><td colspan="2">' . ($this->p->check->aop($this->p->cf['lca'], true, $this->p->is_avail['aop']) ? '' : $this->p->msgs->get('pro-option-msg')) . '</td></tr>' . "\n";
                        }
                    } else {
                        echo '<tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>' . "\n";
                    }
                } else {
                    if (!empty($info['update_auth']) || !empty($this->p->options['plugin_' . $ext . '_tid'])) {
                        if ($this->p->cf['lca'] === $ext || $this->p->check->aop($this->p->cf['lca'], true, $this->p->is_avail['aop'])) {
                            $qty_used = class_exists('SucomUpdate') ? SucomUpdate::get_option($ext, 'qty_used') : false;
                            echo '<tr>' . $this->p->util->get_th(_x('Pro Authentication ID', 'option label', 'nextgen-facebook'), 'medium nowrap') . '<td class="tid">' . $this->form->get_input('plugin_' . $ext . '_tid', 'tid mono') . '</td><td><p>' . (empty($qty_used) ? '' : $qty_used . ' Licenses Assigned') . '</p></td></tr>' . "\n";
                        } else {
                            echo '<tr>' . $this->p->util->get_th(_x('Pro Authentication ID', 'option label', 'nextgen-facebook'), 'medium nowrap') . '<td class="blank">' . (empty($this->p->options['plugin_' . $ext . '_tid']) ? $this->form->get_no_input('plugin_' . $ext . '_tid', 'tid mono') : $this->form->get_input('plugin_' . $ext . '_tid', 'tid mono')) . '</td><td>' . ($this->p->check->aop($this->p->cf['lca'], true, $this->p->is_avail['aop']) ? '' : $this->p->msgs->get('pro-option-msg')) . '</td></tr>' . "\n";
                        }
                    } else {
                        echo '<tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</tr>' . "\n";
                    }
                }
                echo '<tr><td' . ($num < $total ? ' style="border-bottom:1px dotted #ddd;"' : '') . ' colspan="' . ($network ? 4 : 3) . '">&nbsp;</td></tr>' . "\n";
            }
            echo '</table>' . "\n";
        }