Пример #1
0
 public function hookDecryptString($enscrypt)
 {
     return MainWPApiManagerPasswordManagement::decrypt_string($enscrypt);
 }
    public static function renderHeader($shownPage, &$extensions)
    {
        ?>
    <div class="wrap">
        <a href="https://mainwp.com" id="mainwplogo" title="MainWP" target="_blank"><img
                src="<?php 
        echo plugins_url('images/logo.png', dirname(__FILE__));
        ?>
" height="50"
                alt="MainWP"/></a>
        <h2><i class="fa fa-plug"></i> <?php 
        _e('Extensions', 'mainwp');
        ?>
</h2><div style="clear: both;"></div><br/><br/>
        <?php 
        if ($shownPage === '') {
            ?>
        <div id="mainwp-extensions-categories-menu" class="postbox">
                <div class="mainwp-inside"><span id="mainwp-extensions-menu-title"><?php 
            _e('Get MainWP Extensions', 'mainwp');
            ?>
</span></div>
                <div style="border-bottom: 1px Solid #e5e5e5;"></div>
                <div class="mainwp-inside mainwp-align-center" style="clear: both;">
                <div id="mainwp-extensions-cat-menu">
                    <ul id="mainwp-extensions-menu-cat-list">
                        <li class="mainwp-extensions-menu-item mainwp-category-1"><a href="https://extensions.mainwp.com/product-category/mainwp-extensions/administrative/"><?php 
            _e('Administrative', 'mainwp');
            ?>
</a></li>
                        <li class="mainwp-extensions-menu-item mainwp-category-2"><a href="https://extensions.mainwp.com/product-category/mainwp-extensions/content/"><?php 
            _e('Content', 'mainwp');
            ?>
</a></li>
                        <li class="mainwp-extensions-menu-item mainwp-category-3"><a href="https://extensions.mainwp.com/product-category/mainwp-extensions/visitor-data/"><?php 
            _e('Visitor Data', 'mainwp');
            ?>
</a></li>
                        <li class="mainwp-extensions-menu-item mainwp-category-4"><a href="https://extensions.mainwp.com/product-category/mainwp-extensions/free/"><?php 
            _e('Free Extensions', 'mainwp');
            ?>
</a></li>
                        <li class="mainwp-extensions-menu-item mainwp-category-5"><a href="https://extensions.mainwp.com/shop/"><?php 
            _e('All Extensions', 'mainwp');
            ?>
</a></li>
                    </ul>
                </div>
                    <div style="clear: both;"></div>
                </div>
        </div>        
       
<?php 
            $loader_url = '<i class="fa fa-spinner fa-pulse"></i>';
            if (mainwp_current_user_can("dashboard", "bulk_install_and_activate_extensions")) {
                $username = $password = "";
                $checked_save = false;
                if (get_option("mainwp_extensions_api_save_login") == true) {
                    $enscrypt_u = get_option('mainwp_extensions_api_username');
                    $enscrypt_p = get_option('mainwp_extensions_api_password');
                    $username = !empty($enscrypt_u) ? MainWPApiManagerPasswordManagement::decrypt_string($enscrypt_u) : "";
                    $password = !empty($enscrypt_p) ? MainWPApiManagerPasswordManagement::decrypt_string($enscrypt_p) : "";
                    $checked_save = true;
                }
                if (!MainWPUtility::resetUserCookie('api_bulk_install')) {
                    ?>
            <span id="mainwp_api_postbox_reset_showhide"></span>
        <?php 
                }
                ?>
        
    <div class="postbox mainwp_api_postbox" section="1" >
           <!-- <div class="handlediv"><br></div> -->
           <h3 class="mainwp_box_title"><span><i class="fa fa-cog"></i> <?php 
                _e("Bulk Install and Activate Extensions", "mainwp");
                ?>
</span></h3>                          
           <div class="mainwp-inside" style="clear: both;">
            <div style="padding: 0 5px;">
            <?php 
                $apisslverify = get_option('mainwp_api_sslVerifyCertificate');
                if (defined('OPENSSL_VERSION_NUMBER') && OPENSSL_VERSION_NUMBER <= 0x9080bf && $apisslverify === false) {
                    $apisslverify = 0;
                    MainWPUtility::update_option("mainwp_api_sslVerifyCertificate", $apisslverify);
                }
                $_selected_1 = $apisslverify === false || $apisslverify == 1 ? "selected" : '';
                $_selected_0 = empty($_selected_1) ? "selected" : "";
                ?>
                
                <div class="mainwp_info-box-red">
                <?php 
                if (defined('OPENSSL_VERSION_NUMBER') && OPENSSL_VERSION_NUMBER <= 0x9080bf) {
                    ?>
                        <p><?php 
                    _e("<strong style=\"color:#a00\">WARNING:</strong> MainWP has detected an older install of OpenSSL that does not support Server Name Indication (SNI). This will cause API Activation failure.", "mainwp");
                    ?>
</p>
                        <p><?php 
                    _e("We highly recommend, for your security, that you have your host update your OpenSSL to a current version that does support Server Name Indication (SNI).", "mainwp");
                    ?>
</p>
                        <p><?php 
                    _e("If you do not want to or cannot update your OpenSSL to a current version you can change the verify certificate option to No <strong>(Not recommended)</strong>", "mainwp");
                    ?>
</p>
                    <?php 
                } else {
                    ?>
                        <p><?php 
                    _e("<strong>Notice:</strong> We did not detect any SSL issues.", "mainwp");
                    ?>
</p>                         
                        <p><?php 
                    _e("However, if you are having an issue connecting to, logging in or updating Extensions try setting the verify certificate option below to No and pressing Save.", "mainwp");
                    ?>
</p>                         
                    <?php 
                }
                ?>
                    <table class="form-table">
                        </tbody>
                            <tr>
                                <th scope="row"><?php 
                _e('Verify certificate', 'mainwp');
                ?>
 <?php 
                MainWPUtility::renderToolTip(__('Verify the childs SSL certificate. This should be disabled if you are using out of date or self signed certificates.', 'mainwp'));
                ?>
</th>
                                   <td>
                                       <span><select name="mainwp_api_sslVerifyCertificate" id="mainwp_api_sslVerifyCertificate" style="width: 200px;">
                                            <option value="0" <?php 
                echo $_selected_0;
                ?>
 ><?php 
                _e("No", "mainwp");
                ?>
</option>
                                            <option value="1" <?php 
                echo $_selected_1;
                ?>
 ><?php 
                _e("Yes", "mainwp");
                ?>
</option>                                               
                                        </select><label></label></span>&nbsp;&nbsp;&nbsp;&nbsp;
                                        <span class="extension_api_sslverify_loading">
                                            <input type="button" value="<?php 
                _e("Save", "mainwp");
                ?>
" id="mainwp-extensions-api-sslverify-certificate" class="button-primary">
                                            <i class="fa fa-spinner fa-pulse" style="display: none;"></i><span class="status hidden"></span>
                                        </span>
                                </td>
                            </tr>
                        </tbody>
                    </table>                
                </div>
                  
                <strong><?php 
                _e("Step 1", "mainwp");
                ?>
</strong>
                <p><span class="description"><?php 
                _e("Enter your MainWP Extensions (https://extensions.mainwp.com) Login to automatically install and activate purchased extensions.");
                ?>
</span></p>
                <span><?php 
                _e("MainWP Extensions Login:"******"mainwp");
                ?>
</span><br /><br />
                <div class="api-grabbing-fields">              
                    <input type="text" class="input username" placeholder="<?php 
                echo __("Username", "mainwp");
                ?>
" value="<?php 
                echo $username;
                ?>
"/>&nbsp;
                    <input type="password" class="input passwd" placeholder="<?php 
                echo __("Password", "mainwp");
                ?>
" value="<?php 
                echo $password;
                ?>
"/>&nbsp;
                    <label><input type="checkbox" <?php 
                echo $checked_save ? 'checked="checked"' : "";
                ?>
 name="extensions_api_savemylogin_chk" id="extensions_api_savemylogin_chk"><?php 
                _e("Save API login", "mainwp");
                ?>
</label>
                </div>  
                <p>
                    <span class="extension_api_loading">
                        <input type="button" class="button-primary" id="mainwp-extensions-savelogin" value="<?php 
                _e("Save Login", "mainwp");
                ?>
">
                        <i class="fa fa-spinner fa-pulse" style="display: none;"></i><span class="status hidden"></span>
                    </span>
                </p>  
                <p><hr></p>            
                <strong><?php 
                _e("Step 2", "mainwp");
                ?>
</strong>
                <div id="mainwp-install-purchased-extensions">
                <p><span class="description"><?php 
                _e("The Install Purchased Extensions button will automatically install all your MainWP Extensions. You can also install them manually using the directions <a href=\"http://docs.mainwp.com/how-to-install-mainwp-extensions/\" >here</a>.");
                ?>
</span></p>
                <p>
                    <span class="extension_api_loading">
                        <input type="button" class="mainwp-upgrade-button button-primary" id="mainwp-extensions-bulkinstall" value="<?php 
                _e("Install purchased extensions", "mainwp");
                ?>
">
                        <i class="fa fa-spinner fa-pulse" style="display: none;"></i><span class="status hidden"></span>
                    </span>
                </p>                            
                </div>
                <p><hr></p>
                <strong><?php 
                _e("Step 3", "mainwp");
                ?>
</strong>
                <p><span class="description"><?php 
                _e("The Grab API Keys will automatically add your API Keys and activate your Extensions. You can also manually enter your API for each Extension following the steps <a href=\"http://docs.mainwp.com/enter-extensions-api-keys/\" >here</a>.");
                ?>
</span></p>
                <p>
                    <span class="extension_api_loading">
                        <input type="button" class="mainwp-upgrade-button button-primary" id="mainwp-extensions-grabkeys" value="<?php 
                _e("Grab Api Keys", "mainwp");
                ?>
">
                        <i class="fa fa-spinner fa-pulse" style="display: none;"></i><span class="status hidden"></span>
                    </span>
                </p>  
                <div style="clear: both;"></div>
            </div>
        </div>
    </div> 
       <?php 
            }
            ?>
         
<?php 
        }
        ?>
    
        
        <div class="mainwp-tabs" id="mainwp-tabs">            
            <a class="nav-tab pos-nav-tab <?php 
        if ($shownPage === '') {
            echo "nav-tab-active";
        }
        ?>
" href="admin.php?page=Extensions"><?php 
        _e('Manage Extensions', 'mainwp');
        ?>
</a>            
            <?php 
        if (isset($extensions) && is_array($extensions)) {
            foreach ($extensions as $extension) {
                if ($extension['plugin'] == $shownPage) {
                    ?>
                        <a class="nav-tab pos-nav-tab echo nav-tab-active" href="admin.php?page=<?php 
                    echo $extension['page'];
                    ?>
"><?php 
                    echo $extension['name'];
                    ?>
</a>
                        <?php 
                }
            }
        }
        ?>
        </div>
        <div id="mainwp_wrap-inside">
        <?php 
    }
Пример #3
0
 public static function testExtensionsApiLogin()
 {
     $enscrypt_u = get_option('mainwp_extensions_api_username');
     $enscrypt_p = get_option('mainwp_extensions_api_password');
     $username = !empty($enscrypt_u) ? MainWPApiManagerPasswordManagement::decrypt_string($enscrypt_u) : "";
     $password = !empty($enscrypt_p) ? MainWPApiManagerPasswordManagement::decrypt_string($enscrypt_p) : "";
     if ($username == '' || $password == '') {
         die(json_encode(array('error' => __('Login Invalid.', 'mainwp'))));
     }
     $result = array();
     try {
         $test = MainWPApiManager::instance()->test_login_api($username, $password);
     } catch (Exception $e) {
         $return['error'] = $e->getMessage();
         die(json_encode($return));
     }
     if (is_array($test) && isset($test['retry_action'])) {
         die(json_encode($test));
     }
     $result = json_decode($test, true);
     $return = array();
     if (is_array($result)) {
         if (isset($result['success']) && $result['success']) {
             $return['result'] = 'SUCCESS';
         } else {
             if (isset($result['error'])) {
                 $return['error'] = $result['error'];
             }
         }
     } else {
         $apisslverify = get_option('mainwp_api_sslVerifyCertificate');
         if ($apisslverify == 1) {
             MainWPUtility::update_option("mainwp_api_sslVerifyCertificate", 0);
             $return['retry_action'] = 1;
         }
     }
     die(json_encode($return));
 }
Пример #4
0
    public static function renderHeader($shownPage, &$extensions)
    {
        ?>
    <div class="wrap">
        <a href="https://mainwp.com" id="mainwplogo" title="MainWP" target="_blank"><img
                src="<?php 
        echo plugins_url('images/logo.png', dirname(__FILE__));
        ?>
" height="50"
                alt="MainWP"/></a>
        <h2><i class="fa fa-plug"></i> <?php 
        _e('Extensions', 'mainwp');
        ?>
</h2><div style="clear: both;"></div><br/><br/>
        <?php 
        if ($shownPage === '') {
            ?>
        <div id="mainwp-extensions-categories-menu" class="postbox">
                <div class="mainwp-inside"><span id="mainwp-extensions-menu-title"><?php 
            _e('Get MainWP Extensions', 'mainwp');
            ?>
</span></div>
                <div style="border-bottom: 1px Solid #e5e5e5;"></div>
                <div class="mainwp-inside mainwp-align-center" style="clear: both;">
                <div id="mainwp-extensions-cat-menu">
                    <ul id="mainwp-extensions-menu-cat-list">
                        <li class="mainwp-extensions-menu-item mainwp-category-1"><a href="https://extensions.mainwp.com/product-category/mainwp-extensions/administrative/"><?php 
            _e('Administrative', 'mainwp');
            ?>
</a></li>
                        <li class="mainwp-extensions-menu-item mainwp-category-2"><a href="https://extensions.mainwp.com/product-category/mainwp-extensions/content/"><?php 
            _e('Content', 'mainwp');
            ?>
</a></li>
                        <li class="mainwp-extensions-menu-item mainwp-category-3"><a href="https://extensions.mainwp.com/product-category/mainwp-extensions/visitor-data/"><?php 
            _e('Visitor Data', 'mainwp');
            ?>
</a></li>
                        <li class="mainwp-extensions-menu-item mainwp-category-4"><a href="https://extensions.mainwp.com/product-category/mainwp-extensions/free/"><?php 
            _e('Free Extensions', 'mainwp');
            ?>
</a></li>
                        <li class="mainwp-extensions-menu-item mainwp-category-5"><a href="https://extensions.mainwp.com/shop/"><?php 
            _e('All Extensions', 'mainwp');
            ?>
</a></li>
                    </ul>
                </div>
                    <div style="clear: both;"></div>
                </div>
        </div>        
       
<?php 
            $loader_url = '<i class="fa fa-spinner fa-pulse"></i>';
            if (mainwp_current_user_can("dashboard", "bulk_install_and_activate_extensions")) {
                $username = $password = "";
                $checked_save = false;
                if (get_option("mainwp_extensions_api_save_login") == true) {
                    $enscrypt_u = get_option('mainwp_extensions_api_username');
                    $enscrypt_p = get_option('mainwp_extensions_api_password');
                    $username = !empty($enscrypt_u) ? MainWPApiManagerPasswordManagement::decrypt_string($enscrypt_u) : "";
                    $password = !empty($enscrypt_p) ? MainWPApiManagerPasswordManagement::decrypt_string($enscrypt_p) : "";
                    $checked_save = true;
                }
                if (!MainWPUtility::resetUserCookie('api_bulk_install')) {
                    ?>
            <span id="mainwp_api_postbox_reset_showhide"></span>
        <?php 
                }
                ?>
        
    <div class="postbox mainwp_api_postbox" section="1" >
           <!-- <div class="handlediv"><br></div> -->
           <h3 class="mainwp_box_title"><span><i class="fa fa-cog"></i> <?php 
                _e("Bulk Install and Activate Extensions", "mainwp");
                ?>
</span></h3>                          
           <div class="mainwp-inside" style="clear: both;">
            <div style="padding: 0 5px;">
            <?php 
                if (get_option('mainwp_api_sslVerifyCertificate') == 1) {
                    update_option('mainwp_api_sslVerifyCertificate', 0);
                }
                //                $apisslverify = get_option('mainwp_api_sslVerifyCertificate');
                //                if (defined('OPENSSL_VERSION_NUMBER') && (OPENSSL_VERSION_NUMBER <= 0x009080bf) && ($apisslverify === false)) {
                //                    $apisslverify = 0;
                //                    MainWPUtility::update_option("mainwp_api_sslVerifyCertificate", $apisslverify);
                //                }
                //                $_selected_1 = (($apisslverify === false) || ($apisslverify == 1)) ? "selected" : '';
                //                $_selected_0 = empty($_selected_1) ? "selected" : "";
                ?>
      
             
                <strong><?php 
                _e("Step 1", "mainwp");
                ?>
</strong>
                <p><span class="description"><?php 
                _e("Enter your MainWP Extensions (https://extensions.mainwp.com) Login to automatically install and activate purchased extensions.");
                ?>
</span></p>
                <span><?php 
                _e("MainWP Extensions Login:"******"mainwp");
                ?>
</span><br /><br />
                <div class="api-grabbing-fields">              
                    <input type="text" class="input username" placeholder="<?php 
                echo __("Username", "mainwp");
                ?>
" value="<?php 
                echo $username;
                ?>
"/>&nbsp;
                    <input type="password" class="input passwd" placeholder="<?php 
                echo __("Password", "mainwp");
                ?>
" value="<?php 
                echo $password;
                ?>
"/>&nbsp;
                    <label><input type="checkbox" <?php 
                echo $checked_save ? 'checked="checked"' : "";
                ?>
 name="extensions_api_savemylogin_chk" id="extensions_api_savemylogin_chk"><?php 
                _e("Save API login", "mainwp");
                ?>
</label>
                </div>  
                <p>
                    <span class="extension_api_loading">
                        <input type="button" class="button-primary" id="mainwp-extensions-savelogin" value="<?php 
                _e("Save Login", "mainwp");
                ?>
">
                        <i class="fa fa-spinner fa-pulse" style="display: none;"></i><span class="status hidden"></span>
                    </span>
                </p>  
                <p><hr></p>            
                <strong><?php 
                _e("Step 2", "mainwp");
                ?>
</strong>
                <div id="mainwp-install-purchased-extensions">
                <p><span class="description"><?php 
                _e("The Install Purchased Extensions button will automatically install all your MainWP Extensions. You can also install them manually using the directions <a href=\"http://docs.mainwp.com/how-to-install-mainwp-extensions/\" >here</a>.");
                ?>
</span></p>
                <p>
                    <span class="extension_api_loading">
                        <input type="button" class="mainwp-upgrade-button button-primary" id="mainwp-extensions-bulkinstall" value="<?php 
                _e("Install purchased extensions", "mainwp");
                ?>
">
                        <i class="fa fa-spinner fa-pulse" style="display: none;"></i><span class="status hidden"></span>
                    </span>
                </p>                            
                </div>
                <p><hr></p>
                <strong><?php 
                _e("Step 3", "mainwp");
                ?>
</strong>
                <p><span class="description"><?php 
                _e("The Grab API Keys will automatically add your API Keys and activate your Extensions. You can also manually enter your API for each Extension following the steps <a href=\"http://docs.mainwp.com/enter-extensions-api-keys/\" >here</a>.");
                ?>
</span></p>
                <p>
                    <span class="extension_api_loading">
                        <input type="button" class="mainwp-upgrade-button button-primary" id="mainwp-extensions-grabkeys" value="<?php 
                _e("Grab Api Keys", "mainwp");
                ?>
">
                        <i class="fa fa-spinner fa-pulse" style="display: none;"></i><span class="status hidden"></span>
                    </span>
                </p>  
                <div style="clear: both;"></div>
            </div>
        </div>
    </div> 
       <?php 
            }
            ?>
         
<?php 
        }
        ?>
    
        
        <div class="mainwp-tabs" id="mainwp-tabs">            
            <a class="nav-tab pos-nav-tab <?php 
        if ($shownPage === '') {
            echo "nav-tab-active";
        }
        ?>
" href="admin.php?page=Extensions"><?php 
        _e('Manage Extensions', 'mainwp');
        ?>
</a>            
            <?php 
        if (isset($extensions) && is_array($extensions)) {
            foreach ($extensions as $extension) {
                if ($extension['plugin'] == $shownPage) {
                    ?>
                        <a class="nav-tab pos-nav-tab echo nav-tab-active" href="admin.php?page=<?php 
                    echo $extension['page'];
                    ?>
"><?php 
                    echo $extension['name'];
                    ?>
</a>
                        <?php 
                }
            }
        }
        ?>
        </div>
        <div id="mainwp_wrap-inside">
        <?php 
    }