Plugin Directory

Changeset 1823814

Timestamp:
02/17/2018 12:41:16 PM (6 years ago)
Author:
muratbtn
Message:

güncelleme

File:
1 edited

Legend:

Unmodified
Added
Removed
  • woo-paytr-taksit-tab/trunk/WoocommercePaytrTaksitTab_OptionsManager.php

    r1814019 r1823814  
    11<?php
    2 
    32class WoocommercePaytrTaksitTab_OptionsManager {
    43
     
    76    }
    87
     8
    99    public function getOptionMetaData() {
    1010        return array();
    1111    }
    1212
     13
    1314    public function getOptionNames() {
    1415        return array_keys($this->getOptionMetaData());
    1516    }
    1617
    17 
     18   
    1819    protected function initOptions() {
    1920    }
    2021
     22
    2123    protected function deleteSavedOptions() {
    2224        $optionMetaData = $this->getOptionMetaData();
    2325        if (is_array($optionMetaData)) {
    2426            foreach ($optionMetaData as $aOptionKey => $aOptionMeta) {
    25                 $prefixedOptionName = $this->prefix($aOptionKey);
     27                $prefixedOptionName = $this->prefix($aOptionKey);
    2628                delete_option($prefixedOptionName);
    2729            }
     
    2931    }
    3032
     33
    3134    public function getPluginDisplayName() {
    3235        return get_class($this);
    3336    }
    3437
     38
    3539    public function prefix($name) {
    3640        $optionNamePrefix = $this->getOptionNamePrefix();
     
    4145    }
    4246
     47
    4348    public function &unPrefix($name) {
    4449        $optionNamePrefix = $this->getOptionNamePrefix();
     
    4954    }
    5055
     56
    5157    public function getOption($optionName, $default = null) {
    52         $prefixedOptionName = $this->prefix($optionName);
     58        $prefixedOptionName = $this->prefix($optionName);
    5359        $retVal = get_option($prefixedOptionName);
    5460        if (!$retVal && $default) {
     
    5864    }
    5965
     66
    6067    public function deleteOption($optionName) {
    61         $prefixedOptionName = $this->prefix($optionName);
     68        $prefixedOptionName = $this->prefix($optionName);
    6269        return delete_option($prefixedOptionName);
    6370    }
    6471
    65 
     72   
    6673    public function addOption($optionName, $value) {
    67         $prefixedOptionName = $this->prefix($optionName);
     74        $prefixedOptionName = $this->prefix($optionName);
    6875        return add_option($prefixedOptionName, $value);
    6976    }
    7077
     78
    7179    public function updateOption($optionName, $value) {
    72         $prefixedOptionName = $this->prefix($optionName);
     80        $prefixedOptionName = $this->prefix($optionName);
    7381        return update_option($prefixedOptionName, $value);
    7482    }
     83
     84
    7585    public function getRoleOption($optionName) {
    7686        $roleAllowed = $this->getOption($optionName);
     
    8191    }
    8292
     93
    8394    protected function roleToCapability($roleName) {
    8495        switch ($roleName) {
     
    101112    }
    102113
     114
    103115    public function isUserRoleEqualOrBetterThan($roleName) {
    104116        if ('Anyone' == $roleName) {
     
    109121    }
    110122
     123
    111124    public function canUserDoRoleOption($optionName) {
    112125        $roleAllowed = $this->getRoleOption($optionName);
     
    117130    }
    118131
     132
    119133    public function createSettingsMenu() {
    120134        $pluginName = $this->getPluginDisplayName();
    121         //create new top-level menu
     135       
    122136        add_menu_page($pluginName . ' Plugin Settings',
    123137                      $pluginName,
     
    127141        /*,plugins_url('/images/icon.png', __FILE__)*/); // if you call 'plugins_url; be sure to "require_once" it
    128142
     143
    129144        add_action('admin_init', array(&$this, 'registerSettings'));
    130145    }
     
    138153    }
    139154
     155
    140156    public function settingsPage() {
    141157        if (!current_user_can('manage_options')) {
     
    145161        $optionMetaData = $this->getOptionMetaData();
    146162
     163
    147164        if ($optionMetaData != null) {
    148165            foreach ($optionMetaData as $aOptionKey => $aOptionMeta) {
    149                 if (isset($value[$aOptionKey])) {
    150                     $this->updateOption($aOptionKey, $value[$aOptionKey]);
     166                if (isset($[$aOptionKey])) {
     167                    $this->updateOption($aOptionKey, $[$aOptionKey]);
    151168                }
    152169            }
    153170        }
    154171
     172
    155173        $settingsGroup = get_class($this) . '-settings-group';
    156174        ?>
    157175        <div class="wrap">
    158            
    159 
    160           <h2><?php echo $this->getPluginDisplayName(); echo ' '; _e('Ayarları', 'woocommerce-paytr-taksit-tab'); ?></h2>
    161             <p>Merchant Id'nizi <a href="https://www.paytr.com/" target="_blank">PayTr</a>'den Öğrenebilirsiniz.</p>
    162             <p>Eklenti her türlü destek ve geliştirmeler için <a href="http://www.muratbutun.com/" title="Freelancer Web Tasarımcı" target="_blank" rel="nofollow">Murat Bütün</a> ile <a href="https://www.muratbutun.com/iletisim" target="_blank">iletişime</a> geçebilirisiniz.</p>
     176            <h2><?php _e('System Settings', 'woocommerce-paytr-taksit-tab'); ?></h2>
     177            <table cellspacing="1" cellpadding="2"><tbody>
     178            <tr><td><?php _e('System', 'woocommerce-paytr-taksit-tab'); ?></td><td><?php echo php_uname(); ?></td></tr>
     179            <tr><td><?php _e('PHP Version', 'woocommerce-paytr-taksit-tab'); ?></td>
     180                <td><?php echo phpversion(); ?>
     181                <?php
     182                if (version_compare('5.2', phpversion()) > 0) {
     183                    echo '&nbsp;&nbsp;&nbsp;<span style="background-color: #ffcc00;">';
     184                    _e('(WARNING: This plugin may not work properly with versions earlier than PHP 5.2)', 'woocommerce-paytr-taksit-tab');
     185                    echo '</span>';
     186                }
     187                ?>
     188                </td>
     189            </tr>
     190            <tr><td><?php _e('MySQL Version', 'woocommerce-paytr-taksit-tab'); ?></td>
     191                <td><?php echo $this->getMySqlVersion() ?>
     192                    <?php
     193                    echo '&nbsp;&nbsp;&nbsp;<span style="background-color: #ffcc00;">';
     194                    if (version_compare('5.0', $this->getMySqlVersion()) > 0) {
     195                        _e('(WARNING: This plugin may not work properly with versions earlier than MySQL 5.0)', 'woocommerce-paytr-taksit-tab');
     196                    }
     197                    echo '</span>';
     198                    ?>
     199                </td>
     200            </tr>
     201            </tbody></table>
     202
     203            <h2><?php echo $this->getPluginDisplayName(); echo ' '; _e('Settings', 'woocommerce-paytr-taksit-tab'); ?></h2>
    163204
    164205            <form method="post" action="">
     
    192233                <p class="submit">
    193234                    <input type="submit" class="button-primary"
    194                            value="<?php _e('Ayarlarınızı Kaydedin', 'woocommerce-paytr-taksit-tab') ?>"/>
    195               </p>
     235                           value="<?php _e('', 'woocommerce-paytr-taksit-tab') ?>"/>
     236              </p>
    196237            </form>
    197238        </div>
     
    200241    }
    201242
     243
    202244    protected function createFormControl($aOptionKey, $aOptionMeta, $savedOptionValue) {
    203245        if (is_array($aOptionMeta) && count($aOptionMeta) >= 2) { // Drop-down list
     
    225267        }
    226268    }
     269
     270
    227271    protected function getOptionValueI18nString($optionValue) {
    228272        switch ($optionValue) {
     
    247291        return $optionValue;
    248292    }
     293
     294
    249295    protected function getMySqlVersion() {
    250296        global $wpdb;
     
    256302    }
    257303
     304
    258305    public function getEmailDomain() {
     306
    259307        $sitename = strtolower($_SERVER['SERVER_NAME']);
    260308        if (substr($sitename, 0, 4) == 'www.') {
     
    264312    }
    265313}
     314
Note: See TracChangeset for help on using the changeset viewer.