Example #1
1
 function cherry_plugin_settings()
 {
     global $wpdb;
     if (!function_exists('get_plugin_data')) {
         require_once ABSPATH . 'wp-admin/includes/plugin.php';
     }
     $upload_dir = wp_upload_dir();
     $plugin_data = get_plugin_data(plugin_dir_path(__FILE__) . 'cherry-plugin.php');
     //Cherry plugin constant variables
     define('CHERRY_PLUGIN_DIR', plugin_dir_path(__FILE__));
     define('CHERRY_PLUGIN_URL', plugin_dir_url(__FILE__));
     define('CHERRY_PLUGIN_DOMAIN', $plugin_data['TextDomain']);
     define('CHERRY_PLUGIN_DOMAIN_DIR', $plugin_data['DomainPath']);
     define('CHERRY_PLUGIN_VERSION', $plugin_data['Version']);
     define('CHERRY_PLUGIN_NAME', $plugin_data['Name']);
     define('CHERRY_PLUGIN_SLUG', plugin_basename(__FILE__));
     define('CHERRY_PLUGIN_DB', $wpdb->prefix . CHERRY_PLUGIN_DOMAIN);
     define('CHERRY_PLUGIN_REMOTE_SERVER', esc_url('http://tmbhtest.com/cherryframework.com/components_update/'));
     //Other constant variables
     define('CURRENT_THEME_DIR', get_stylesheet_directory());
     define('CURRENT_THEME_URI', get_stylesheet_directory_uri());
     define('UPLOAD_BASE_DIR', str_replace("\\", "/", $upload_dir['basedir']));
     define('UPLOAD_DIR', str_replace("\\", "/", $upload_dir['path'] . '/'));
     // if ( !defined('API_URL') ) {
     // 	define( 'API_URL', esc_url( 'http://updates.cherry.template-help.com/cherrymoto/v3/api/' ) );
     // }
     load_plugin_textdomain(CHERRY_PLUGIN_DOMAIN, false, dirname(plugin_basename(__FILE__)) . '/' . CHERRY_PLUGIN_DOMAIN_DIR);
     do_action('cherry_plugin_settings');
 }
Example #2
0
function userpro_version()
{
    $plugin_data = get_plugin_data(userpro_path . 'index.php');
    $plugin_version = $plugin_data['Version'];
    $plugin_version = str_replace('.', '', $plugin_version);
    return $plugin_version;
}
 private function __construct($slug)
 {
     $this->_slug = $slug;
     $this->_logger = FS_Logger::get_logger(WP_FS__SLUG . '_' . $slug, WP_FS__DEBUG_SDK, WP_FS__ECHO_DEBUG_SDK);
     $bt = debug_backtrace();
     $i = 1;
     while ($i < count($bt) - 1 && false !== strpos($bt[$i]['file'], DIRECTORY_SEPARATOR . 'freemius' . DIRECTORY_SEPARATOR)) {
         $i++;
     }
     $this->_plugin_main_file_path = $bt[$i]['file'];
     $this->_plugin_dir_path = plugin_dir_path($this->_plugin_main_file_path);
     $this->_plugin_basename = plugin_basename($this->_plugin_main_file_path);
     $this->_plugin_data = get_plugin_data($this->_plugin_main_file_path);
     $base_name_split = explode('/', $this->_plugin_basename);
     $this->_plugin_dir_name = $base_name_split[0];
     if ($this->_logger->is_on()) {
         $this->_logger->info('plugin_main_file_path = ' . $this->_plugin_main_file_path);
         $this->_logger->info('plugin_dir_path = ' . $this->_plugin_dir_path);
         $this->_logger->info('plugin_basename = ' . $this->_plugin_basename);
         $this->_logger->info('plugin_dir_name = ' . $this->_plugin_dir_name);
     }
     // Hook to plugin activation
     register_activation_hook($this->_plugin_main_file_path, array(&$this, '_activate_plugin_event'));
     // Hook to plugin uninstall.
     register_uninstall_hook($this->_plugin_main_file_path, array('Freemius', '_uninstall_plugin'));
     $this->_load_account();
 }
Example #4
0
function wck_sas_welcome($hook)
{
    if ('wck_page_sas-page' == $hook) {
        $plugin_path = dirname(__FILE__) . '/wck.php';
        $default_plugin_headers = get_plugin_data($plugin_path);
        $plugin_name = $default_plugin_headers['Name'];
        $plugin_version = $default_plugin_headers['Version'];
        ?>
		<div class="wrap about-wrap">
			<h1><?php 
        printf(__('Welcome to %s', 'wck'), $plugin_name);
        ?>
</h1>
			<div class="about-text"><?php 
        _e('WCK helps you create <strong>repeater custom fields, custom post types</strong> and <strong>taxonomies</strong> in just a couple of clicks, directly from the WordPress admin interface. WCK content types will improve the usability of the sites you build, making them easy to manage by your clients. ', 'wck');
        ?>
</div>
			<div class="wck-badge"><?php 
        printf(__('Version %s', 'wck'), $plugin_version);
        ?>
</div>
		</div>

<?php 
    }
}
 public static function get($name = null)
 {
     $dir = WP_PLUGIN_DIR . '/cc-skeletons/';
     $file = $dir . 'plugin.php';
     $url = plugins_url('', $file);
     if (null === self::$plugin) {
         self::$plugin = get_plugin_data($file);
     }
     switch (strtolower($name)) {
         case 'dir':
             return $dir;
         case 'file':
             return $file;
         case 'url':
             return $url;
         case 'slug':
             return __NAMESPACE__;
         case 'context':
             if (defined('DOING_AJAX') && DOING_AJAX) {
                 return 'ajax';
             } elseif (is_admin()) {
                 return 'backend';
             } else {
                 return 'frontend';
             }
         case null:
             return self::$plugin;
         default:
             if (!empty(self::$plugin[$name])) {
                 return self::$plugin[$name];
             }
             return null;
     }
 }
/**
 * Displays the about plugin meta box.
 *
 * @since 0.2.0
 */
function members_meta_box_display_about($object, $box)
{
    $plugin_data = get_plugin_data(MEMBERS_DIR . 'members.php');
    ?>

	<p>
		<strong><?php 
    _e('Version:', 'members');
    ?>
</strong> <?php 
    echo $plugin_data['Version'];
    ?>
	</p>
	<p>
		<strong><?php 
    _e('Description:', 'members');
    ?>
</strong>
	</p>
	<p>
		<?php 
    echo $plugin_data['Description'];
    ?>
	</p>
<?php 
}
Example #7
0
 private function get_current_version()
 {
     include_once ABSPATH . '/wp-admin/includes/plugin.php';
     $plugin_file_path = One_And_One_Wizard::get_plugin_file_path();
     $data = get_plugin_data($plugin_file_path);
     return $data['Version'];
 }
Example #8
0
 static function init()
 {
     // get instance
     self::$instance = self::get_instance();
     // build settings
     Kanban::get_instance()->settings = (object) array();
     Kanban::get_instance()->settings->path = dirname(__FILE__);
     Kanban::get_instance()->settings->file = basename(__FILE__, '.php');
     Kanban::get_instance()->settings->plugin_data = get_plugin_data(__FILE__);
     Kanban::get_instance()->settings->basename = strtolower(__CLASS__);
     Kanban::get_instance()->settings->plugin_basename = plugin_basename(__FILE__);
     Kanban::get_instance()->settings->uri = plugin_dir_url(__FILE__);
     Kanban::get_instance()->settings->pretty_name = __('Kanban', Kanban::get_instance()->settings->file);
     // require at least PHP 5.3
     if (version_compare(PHP_VERSION, '5.3', '<')) {
         add_action('admin_notices', array(__CLASS__, 'notify_php_version'));
         return;
     }
     // needs to come first
     include_once Kanban::get_instance()->settings->path . '/includes/class-utils.php';
     include_once Kanban::get_instance()->settings->path . '/includes/class-db.php';
     // Automatically load classes
     $files = glob(Kanban::get_instance()->settings->path . '/includes/class-*.php');
     foreach ($files as $file) {
         include_once $file;
     }
     // check for old records
     Kanban::get_instance()->settings->records_to_move = Kanban_Db::migrate_records_remaining();
     register_activation_hook(__FILE__, array(__CLASS__, 'on_activation'));
     register_deactivation_hook(__FILE__, array(__CLASS__, 'on_deactivation'));
     do_action('kanban_loaded');
 }
 /**
  * Check if any plugins need an update.
  *
  * @return $this
  */
 public function checkPluginUpdates()
 {
     $this->plugin_updates = array();
     if (!function_exists('wp_update_plugins')) {
         require_once ABSPATH . WPINC . '/update.php';
     }
     if (!function_exists('plugins_api')) {
         require_once ABSPATH . '/wp-admin/includes/plugin-install.php';
     }
     wp_update_plugins();
     // Check for Plugin updates
     $update_plugins = get_site_transient('update_plugins');
     if ($update_plugins && !empty($update_plugins->response)) {
         foreach ($update_plugins->response as $plugin => $vals) {
             if (!function_exists('get_plugin_data')) {
                 require_once ABSPATH . '/wp-admin/includes/plugin.php';
             }
             $pluginFile = wfUtils::getPluginBaseDir() . $plugin;
             $data = get_plugin_data($pluginFile);
             $data['pluginFile'] = $pluginFile;
             $data['newVersion'] = $vals->new_version;
             $data['slug'] = $vals->slug;
             $data['wpURL'] = rtrim($vals->url, '/');
             //Check the vulnerability database
             $result = $this->api->call('plugin_vulnerability_check', array(), array('slug' => $vals->slug, 'fromVersion' => $data['Version'], 'toVersion' => $vals->new_version));
             $data['vulnerabilityPatched'] = isset($result['vulnerable']) && $result['vulnerable'];
             $this->plugin_updates[] = $data;
         }
     }
     return $this;
 }
Example #10
0
function ubermenu_update_notifier_bar_menu()
{
    global $uberMenu;
    if (!$uberMenu->getSettings()->op('update-alerts')) {
        return;
    }
    if (!function_exists('simplexml_load_string')) {
        return;
    }
    global $wp_admin_bar, $wpdb;
    if (!is_super_admin() || !is_admin_bar_showing()) {
        return;
    }
    $xml = ubermenu_get_latest_plugin_version(UBERMENU_UPDATE_DELAY);
    //21600); // This tells the function to cache the remote call for 21600 seconds (6 hours)
    $plugin_data = get_plugin_data(WP_PLUGIN_DIR . '/ubermenu/ubermenu.php');
    // Get plugin data (current version is what we want)
    if (!$xml) {
        //we can't retrieve the XML file and parse it properly
        return;
    }
    if (version_compare($plugin_data['Version'], $xml->latest) == -1) {
        $wp_admin_bar->add_menu(array('id' => 'ubermenu_update_notifier', 'title' => '<span> ' . __('UberMenu', 'ubermenu') . ' <span id="ab-updates">' . __('New Updates', 'ubermenu') . '</span></span>', 'href' => get_admin_url() . 'themes.php?page=uber-menu&updates=1'));
    }
}
Example #11
0
 function sbscrbr_init()
 {
     global $sbscrbr_plugin_info;
     /* load textdomain of plugin */
     load_plugin_textdomain('subscriber', false, dirname(plugin_basename(__FILE__)) . '/languages/');
     require_once dirname(__FILE__) . '/bws_menu/bws_functions.php';
     if (empty($sbscrbr_plugin_info)) {
         if (!function_exists('get_plugin_data')) {
             require_once ABSPATH . 'wp-admin/includes/plugin.php';
         }
         $sbscrbr_plugin_info = get_plugin_data(__FILE__);
     }
     /* check version on WordPress */
     bws_wp_version_check(plugin_basename(__FILE__), $sbscrbr_plugin_info, '3.1');
     /* add new user role */
     $capabilities = array('read' => true, 'edit_posts' => false, 'delete_posts' => false);
     add_role('sbscrbr_subscriber', __('Mail Subscriber', 'subscriber'), $capabilities);
     /* register plugin settings */
     $plugin_pages = array('sbscrbr_settings_page', 'sbscrbr_users');
     if (!is_admin() || isset($_GET['page']) && in_array($_GET['page'], $plugin_pages)) {
         sbscrbr_settings();
     }
     /* unsubscribe users from mailout if Subscribe Form  not displayed on home page */
     if (!is_admin()) {
         sbscrbr_update_user();
     }
 }
Example #12
0
/**
 * lg_version()
 * Get Lazyest Gallery Current version from plugin file
 * @return string
 * 
 */
function lg_version()
{
    require_once ABSPATH . 'wp-admin/includes/plugin.php';
    global $lg_gallery;
    $plugin_data = get_plugin_data($lg_gallery->plugin_file);
    return $plugin_data['Version'];
}
Example #13
0
  private static function check_plugins_version(){
    $active_plugins= [];
    foreach(get_option("active_plugins") as $plugin){
      $key= dirname($plugin);
      $plugins= self::$versions["wordpress"]["plugins"];

      $active_plugins[$key]= $plugin;
      if(!in_array($key, array_keys($plugins)))
        throw new PluginNotAllowed("Plugin $plugin  is not allowed to use.");
    }
 
    foreach(self::$versions["wordpress"]["plugins"] as $plugin_name=>$version){
      $required= is_array($version)? $version["required"]: true;
      if(is_array($version))$version= $version["version"];

      preg_match(self::VERSION_FORMAT, $version,$matches);
      if(empty($matches))throw new VersionOperatorIsInvalid;

      if(!$required)continue;

      $comparator= empty($matches[1]) ? "=" : $matches[1];
      $version= $matches[2];

      if(!in_array($plugin_name, array_keys($active_plugins)))
        throw new PluginNotFound("Plugin $plugin_name is not found.");
      $plugin_version= get_plugin_data(WP_PLUGIN_DIR . "/" . $active_plugins[$plugin_name])["Version"];

      if(!version_compare($plugin_version, $version, $comparator))
        throw new VersionIsInvalid("Plugin $plugin_name requires version $comparator $version");
    }
  }
 /**
  * Get plugin data from basename
  *
  * @param string $basename
  *
  * @return string
  */
 public static function get_plugin_version_from_basename($basename)
 {
     require_once ABSPATH . 'wp-admin/includes/plugin.php';
     $plugin_path = WP_PLUGIN_DIR . '/' . $basename;
     $plugin_data = get_plugin_data($plugin_path);
     return $plugin_data['Version'];
 }
    function ubermenu_update_notifier()
    {
        $xml = ubermenu_get_latest_plugin_version(UBERMENU_UPDATE_DELAY);
        $plugin_data = get_plugin_data(WP_PLUGIN_DIR . '/ubermenu/ubermenu.php');
        // Get plugin data (current version is what we want)
        ?>

		<div class="wrap">
		
			<div id="icon-tools" class="icon32"></div>
			<div id="message" class="updated below-h2"><p><strong>There is a new version of UberMenu available.</strong> You have version <?php 
        echo $plugin_data['Version'];
        ?>
 installed. Update to version <?php 
        echo $xml->latest;
        ?>
.</p></div>
			<br/>
			<a href="http://wpmegamenu.com/help/#updates" class="button" target="_blank">Update Instructions</a>
			<a href="http://codecanyon.net/item/ubermenu-wordpress-mega-menu-plugin/154703" class="button" target="_blank">Download update from CodeCanyon</a>
			<br/>
			<div class="clear"></div>
			
			<h3 class="title">Changelog</h3>
			<?php 
        echo $xml->changelog;
        ?>

		</div>
		
	<?php 
    }
 /**
  * Defines constants for the plugin.
  *
  * @since 1.0.0
  */
 function constants()
 {
     if (!function_exists('get_plugin_data')) {
         require_once ABSPATH . 'wp-admin/includes/plugin.php';
     }
     $plugin_data = get_plugin_data(plugin_dir_path(__FILE__) . basename(__FILE__));
     /**
      * Set constant name for the post type name.
      *
      * @since 1.0.0
      */
     define('CHERRY_CUSTOM_SIDEBARS_SLUG', basename(dirname(__FILE__)));
     /**
      * Set the version number of the plugin.
      *
      * @since 1.0.0
      */
     define('CHERRY_CUSTOM_SIDEBARS_VERSION', $plugin_data['Version']);
     /**
      * Set constant path to the plugin directory.
      *
      * @since 1.0.0
      */
     define('CHERRY_CUSTOM_SIDEBARS_DIR', trailingslashit(plugin_dir_path(__FILE__)));
     /**
      * Set constant path to the plugin URI.
      *
      * @since 1.0.0
      */
     define('CHERRY_CUSTOM_SIDEBARS_URI', trailingslashit(plugin_dir_url(__FILE__)));
 }
 function gllr_init()
 {
     global $gllr_plugin_info, $pagenow;
     require_once dirname(__FILE__) . '/bws_menu/bws_include.php';
     bws_include_init(plugin_basename(__FILE__));
     if (!$gllr_plugin_info) {
         if (!function_exists('get_plugin_data')) {
             require_once ABSPATH . 'wp-admin/includes/plugin.php';
         }
         $gllr_plugin_info = get_plugin_data(__FILE__);
     }
     /* Function check if plugin is compatible with current WP version  */
     bws_wp_min_version_check(plugin_basename(__FILE__), $gllr_plugin_info, '3.8', '3.5');
     /* Add media button to the gallery post type */
     if (isset($_GET['post']) && get_post_type($_GET['post']) == 'gallery' || isset($pagenow) && $pagenow == 'post-new.php' && isset($_GET['post_type']) && $_GET['post_type'] == 'gallery') {
         add_action('edit_form_after_title', 'gllr_media_custom_box');
     }
     /* Register post type */
     gllr_post_type_images();
     /* demo data */
     $demo_options = get_option('gllr_demo_options');
     if (!empty($demo_options) || isset($_GET['page']) && $_GET['page'] == 'gallery-plugin.php') {
         gllr_include_demo_data();
     }
 }
Example #18
0
function ecommerce_product_catalog_upgrade()
{
    if (is_admin()) {
        $plugin_data = get_plugin_data(AL_PLUGIN_MAIN_FILE);
        $plugin_version = $plugin_data["Version"];
        $database_plugin_version = get_option('ecommerce_product_catalog_ver', $plugin_version);
        if ($database_plugin_version != $plugin_version) {
            update_option('ecommerce_product_catalog_ver', $plugin_version);
            $first_version = (string) get_option('first_activation_version', $plugin_version);
            if (version_compare($first_version, '1.9.0') < 0) {
                $hide_info = 0;
                enable_advanced_mode($hide_info);
            }
            if (version_compare($first_version, '2.0.0') < 0) {
                $archive_multiple_settings = get_multiple_settings();
                $archive_multiple_settings['product_listing_cats'] = 'off';
                $archive_multiple_settings['cat_template'] = 'link';
                update_option('archive_multiple_settings', $archive_multiple_settings);
            }
            if (version_compare($first_version, '2.0.1') < 0) {
                add_product_caps();
            }
            if (version_compare($first_version, '2.0.4') < 0) {
                delete_transient('implecode_extensions_data');
            }
            flush_rewrite_rules();
        }
    }
}
Example #19
0
 function BMP()
 {
     // constructor
     global $wpdb;
     require_once ABSPATH . '/wp-admin/includes/plugin.php';
     $this->AllCategories = get_terms('category', array('fields' => 'ids', 'get' => 'all'));
     $this->PluginOptionName = 'BMP_Options';
     $this->TablePrefix = $wpdb->prefix . 'bmp_';
     $this->OptionsTable = $this->TablePrefix . 'options';
     // character encoding
     $this->BlogCharset = get_option('blog_charset');
     $pluginfile = WP_PLUGIN_DIR . '/' . MLM_PLUGIN_NAME . '/mlm-loader .php';
     $this->PluginInfo = (object) get_plugin_data($pluginfile);
     $this->Version = $this->PluginInfo->Version;
     $this->WPVersion = $GLOBALS['wp_version'] + 0;
     $this->pluginPath = $pluginfile;
     $this->pluginDir = dirname($this->pluginPath);
     $this->PluginFile = basename(dirname($pluginfile)) . '/' . basename($pluginfile);
     $this->PluginSlug = sanitize_title_with_dashes($this->PluginInfo->Name);
     $this->pluginBasename = plugin_basename($this->pluginPath);
     //			$this->pluginURL = get_bloginfo('wpurl') . '/' . PLUGINDIR . '/' . dirname(plugin_basename($this->pluginPath));
     //			$this->pluginURL = plugins_url('', $this->pluginPath);
     // this method works even if the WLM folder is just a symlink
     $this->pluginURL = plugins_url('', '/') . basename($this->pluginDir);
 }
 /**
  * put your comment there...
  * 
  * @param mixed $data
  * @param mixed $action
  * @param mixed $args
  */
 public function _overridePluginInformation($data, $action, $args)
 {
     # Act only with plugins_information action
     switch ($action) {
         case 'plugin_information':
             # INitialize
             $store =& $this->getStore();
             # Try to Get Plugin information
             try {
                 $pluginInfo = $store->getPluginInformation();
                 $pluginData = get_plugin_data($store->getPluginFile());
                 # Make sure the requested Plugin is the one
                 # associated with this object
                 if ($args && $args->slug && $this->getStore()->getSlug() == $args->slug) {
                     # Fill Plugin information data and return it back
                     $data = (object) array('version' => $pluginInfo['currentVersion'], 'last_updated' => $pluginInfo['lastUpdated'], 'author' => $pluginData['Author'], 'requires' => $pluginInfo['requires'], 'tested' => $pluginInfo['tested'], 'homepage' => $pluginInfo['url'], 'downloaded' => $pluginInfo['downloadsCount'], 'slug' => $store->getSlug(), 'name' => $pluginData['Name'], 'sections' => array('description' => $pluginInfo['description'], 'installation' => $pluginInfo['installation'], 'faq' => $pluginInfo['faq'], 'screenshots' => $pluginInfo['screenshots'], 'changelog' => $pluginInfo['changeLog'], 'reviews' => $pluginInfo['reviews'], 'other_notes' => $pluginInfo['otherNotes']));
                 }
             } catch (CJTServicesAPICallException $exception) {
                 # We will do nothing if CJT Store Server if not availabel
                 # Just wait for subsequence requestes to get response!!!
             }
             break;
     }
     # Return either FALSE or plugin information if
     # the plugin is belongs to CJT store
     return $data;
 }
 /**
  * Get the plugins that installed and activated from predefined third party list
  *
  * @return array|void
  */
 function get_enable_plugins()
 {
     if (!$this->_third_parties) {
         return;
     }
     if (!$this->_plugins) {
         if (!function_exists('is_plugin_activate')) {
             require_once ABSPATH . '/wp-includes/plugin.php';
         }
         $active = array();
         $inactive = array();
         foreach ($this->_third_parties as $class_name => $options) {
             $plugin_file = $options['plugin_file'];
             $plugin_path = WP_PLUGIN_DIR . '/' . $plugin_file;
             if (file_exists($plugin_path)) {
                 $plugin_data = get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin_file);
                 $plugin_data['slug'] = $class_name;
                 if (is_plugin_active($plugin_file)) {
                     $active[$plugin_file] = $plugin_data;
                     $active[$plugin_file]['status'] = 'activated';
                 } else {
                     $inactive[$plugin_file] = $plugin_data;
                     $inactive[$plugin_file]['status'] = 'inactive';
                 }
             }
         }
         $this->_plugins = array_merge($active, $inactive);
     }
     return $this->_plugins;
 }
 function initialize_plugin_data()
 {
     $this->plugin_data = get_plugin_data($this->plugin_file);
     $this->base_name = plugin_basename($this->plugin_file);
     $this->slug = dirname($this->base_name);
     if (empty($this->last_checked)) {
         $this->last_checked = (int) get_site_option($this->prefix . '_last_checked');
     }
     if (get_site_option($this->prefix . '_installed_version') != $this->plugin_data['Version']) {
         update_site_option($this->prefix . '_installed_version', $this->plugin_data['Version']);
     }
     if (get_site_option($this->prefix . '_live_version') == '' || get_site_option($this->prefix . '_live_version') < get_site_option($this->prefix . '_installed_version')) {
         update_site_option($this->prefix . '_live_version', $this->plugin_data['Version']);
     }
     if (empty($this->license_key)) {
         $this->license_key = get_site_option($this->prefix . '_license_key');
     }
     if (empty($this->changelog)) {
         $this->changelog = get_site_option($this->prefix . '_changelog');
     }
     if (empty($this->login_link)) {
         $this->login_link = get_site_option($this->prefix . '_login_link');
     }
     if (empty($this->due_date)) {
         $this->due_date = get_site_option($this->prefix . '_due_date');
     }
     add_action('after_plugin_row_' . $this->base_name, array($this, 'update_row'), 99, 2);
 }
 protected function outputPluginInfo($plugin)
 {
     $plugin_path = WP_PLUGIN_DIR . '/' . $plugin . '/' . $plugin . '.php';
     $plugin_type_dir = true;
     if (!file_exists($plugin_path)) {
         $plugin_path = WP_PLUGIN_DIR . '/' . $plugin . '.php';
         $plugin_type_dir = false;
         if (!file_exists($plugin_path)) {
             throw new \InvalidArgumentException("Plugin '{$plugin}' is not found.");
         }
     }
     $plugin_data = get_plugin_data($plugin_path, false, true);
     $this->line("<info>[Plugin file]</info> '{$plugin_path}'");
     $properties_wordpress = ['name' => 'Name', 'title' => 'Title', 'version' => 'Version', 'plugin_uri' => 'PluginURI', 'description' => 'Description', 'author' => 'Author', 'author_name' => 'AuthorName', 'author_uri' => 'AuthorURI', 'text_domain' => 'TextDomain', 'domain_path' => 'DomainPath', 'network' => 'Network'];
     foreach ($properties_wordpress as $property => $key) {
         $value = array_get($plugin_data, $key);
         if (is_array($value)) {
             $value = '[' . implode(', ', $value) . ']';
         }
         $this->line("<info>[{$property}]</info> {$value}");
     }
     $properties_extra = ['php_namespace' => 'PHP Namespace'];
     foreach ($properties_extra as $property => $key) {
         $value = array_get($plugin_data, $key);
         if (is_array($value)) {
             $value = '[' . implode(', ', $value) . ']';
         }
         $this->line("<info>[{$property}]</info> {$value}");
     }
 }
 public static function get($name = null)
 {
     $path = WP_PLUGIN_DIR . '/cc-structures';
     $file = $path . '/plugin.php';
     $dir = basename($path);
     $url = plugins_url('', $file);
     if (null === self::$data) {
         self::$data = get_plugin_data($file);
     }
     switch (strtolower($name)) {
         case 'file':
             return $file;
         case 'dir':
             return $dir;
         case 'path':
             return $path;
         case 'url':
             return $url;
         case 'slug':
             return __NAMESPACE__;
         case null:
             return self::$data;
         default:
             if (!empty(self::$data[$name])) {
                 return self::$data[$name];
             }
             return null;
     }
 }
 public function page_init()
 {
     global $klikbayi_settings, $klikbayi_sanitize;
     $this->options = $klikbayi_settings;
     $this->groups = $this->mb_group();
     $this->default_setting = klikbayi_default_setting('reset');
     $this->url = klikbayi_url('url');
     $this->domain = klikbayi_url('domain');
     $this->blog = klikbayi_blog();
     $this->validate = $klikbayi_sanitize;
     $this->type = $this->validate->type_array();
     $this->style = $this->validate->style_array();
     $this->plugin_data = get_plugin_data(KLIKBAYI_PLUGIN_PATH . '/klikbayi.php');
     register_setting('option_klikbayi', 'klikbayi_option', array($this, 'sanitize'));
     foreach ($this->groups as $t => $arr) {
         add_settings_section('setting_section_' . $t, '', array($this, 'print_section_info_' . $t), 'klikbayi_option_' . $t);
         add_meta_box('meta-box-' . $t, __($arr[0], 'klikbayi'), array($this, 'box_' . $t), 'klikbayi_option_' . $t, 'normal', 'high');
         foreach ($arr[1] as $k => $v) {
             if ('shortcode' == $k || 'sidebar' == $k) {
                 continue;
             }
             add_settings_field($k, __($v, 'klikbayi'), array($this, $k . '_cb'), 'klikbayi_option_' . $t, 'setting_section_' . $t);
         }
     }
 }
Example #26
0
/**
 *
 */
function get_documentation_data()
{
    $docs = array('wordpress-com-themes' => array('name' => 'WordPress.com Themes', 'type' => 'general', 'related' => array('wordpress-com-vs-wordpress-org', 'transfer-from-wordpress-com')), 'support-vs-customization' => array('name' => 'Support vs. Customization', 'type' => 'general'), 'transfer-from-wordpress-com' => array('name' => 'WordPress.com theme Transfer', 'type' => 'general', 'related' => array('wordpress-com-vs-wordpress-org', 'wordpress-com-themes', 'refunds')), 'theme-installation' => array('name' => 'Theme Installation', 'type' => 'general'), 'child-theme-installation' => array('name' => 'Child Theme Installation', 'type' => 'general'), 'demo-content' => array('name' => 'Theme Demo Content', 'type' => 'general', 'description' => 'Demo content to help you get started with your theme.'), 'refunds' => array('name' => 'Refunds', 'type' => 'general', 'related' => array('transfer-from-wordpress-com')), 'affiliates' => array('name' => 'Affiliates', 'type' => 'general'), 'translating-your-website-content' => array('name' => 'Translating Your Website Content', 'type' => 'general'), 'license' => array('name' => 'Software License', 'type' => 'general'), 'localization' => array('name' => 'Localization', 'type' => 'general', 'description' => 'View your theme in your native language.', 'icon' => 'language'), 'theme-customization' => array('name' => 'Theme Customization', 'type' => 'general', 'description' => 'Some basic information on how to customize your theme purchase'), 'wordpress-com-vs-wordpress-org' => array('name' => 'The Difference Between WordPress.com and WordPress.org', 'type' => 'general', 'related' => array('transfer-from-wordpress-com', 'wordpress-com-themes')), 'theme-updates' => array('name' => 'Theme Updates', 'type' => 'general'), 'wordpress-requirements' => array('name' => 'Theme Requirements', 'type' => 'general'), 'keeping-website-up-to-date' => array('name' => 'Keeping Your Website Up To Date', 'type' => 'general'), 'speeding-up-your-wordpress-site' => array('name' => 'Speeding Up Your WordPress Website', 'type' => 'general', 'related' => array('image-resizing', 'jetpack')), 'posts-vs-pages' => array('name' => 'The Difference Between Posts and Pages', 'type' => 'general'), 'theme-previews' => array('name' => 'Theme Previews', 'type' => 'general'), 'payment-methods' => array('name' => 'Payment Methods', 'type' => 'general'), 'featured-content' => array('name' => 'Featured Content', 'type' => 'feature', 'requires' => 'jetpack', 'description' => 'Select your best content to appear in a Slider or other special area on the homepage.', 'related' => array('customizer', 'featured-image'), 'icon' => 'thumb-tack'), 'custom-front-page' => array('name' => 'Custom Front Page', 'type' => 'feature', 'description' => 'Change the design of your front page to make it exactly as you want.', 'related' => array('custom-page-templates', 'customizer'), 'icon' => 'home'), 'custom-page-templates' => array('name' => 'Custom Page Templates', 'type' => 'feature', 'description' => 'Different page layouts for static WordPress pages.', 'related' => array('custom-front-page')), 'portfolio' => array('name' => 'Portfolio and Projects', 'type' => 'feature', 'requires' => 'jetpack', 'description' => 'Show off your Portfolio of work.', 'related' => array('testimonials'), 'icon' => 'folder-open'), 'infinite-scroll' => array('name' => 'Infinite Scroll', 'type' => 'feature', 'requires' => 'jetpack', 'description' => 'Continuosly loading content to encourage your readers to stick around.', 'icon' => 'arrow-down'), 'site-logo' => array('name' => 'Site Logo', 'type' => 'feature', 'requires' => 'jetpack', 'description' => 'Add a logo to make your site your own.', 'related' => array('customizer')), 'search-engine-optimization' => array('name' => 'SEO', 'type' => 'feature', 'description' => 'Search Engine Optimization to improve your sites rankings.', 'icon' => 'line-chart'), 'social-menu' => array('name' => 'Social Menu', 'type' => 'feature', 'description' => 'Display links to your social media channels.', 'icon' => 'share-alt'), 'custom-colours-fonts' => array('name' => 'Custom Colours and Fonts', 'type' => 'feature', 'requires' => 'styleguide', 'description' => 'Tweak the fonts and colours on your site without touching any code.', 'related' => array('custom-css', 'customizer'), 'icon' => 'paint-brush'), 'featured-image' => array('name' => 'Featured Images', 'type' => 'feature', 'description' => 'Image thumbnails for your blog posts and pages.', 'related' => array('image-resizing'), 'icon' => 'camera'), 'custom-css' => array('name' => 'Custom CSS', 'type' => 'feature', 'requires' => 'jetpack', 'description' => 'Edit the CSS on your website.', 'related' => array('custom-colours-fonts', 'customizer'), 'icon' => 'css3'), 'image-resizing' => array('name' => 'Image Resizing (Photon)', 'type' => 'feature', 'requires' => 'jetpack', 'description' => 'Resizes all of your images to fit the thumbnails used.', 'related' => array('featured-image', 'speeding-up-your-wordpress-site'), 'icon' => 'picture-o'), 'website-uptime-monitor' => array('name' => 'Website Uptime Monitor', 'type' => 'feature', 'description' => 'Monitor your websites availability', 'requires' => 'jetpack', 'icon' => 'shield'), 'contact-form' => array('name' => 'Contact Form', 'type' => 'feature', 'requires' => 'jetpack', 'description' => 'Add a simple contact form to your website or blog.', 'icon' => 'envelope-o'), 'sticky-post' => array('name' => 'Sticky Posts', 'type' => 'feature', 'description' => 'Stick posts to the top of your blog.', 'icon' => 'sticky-note'), 'testimonials' => array('name' => 'Testimonials', 'type' => 'feature', 'requires' => 'jetpack', 'description' => 'Display comments from your users/ customers showing how much your product/ service benefits them.', 'related' => array('portfolio', 'customizer'), 'icon' => 'comment'), 'social-sharing' => array('name' => 'Social Sharing Buttons', 'type' => 'feature', 'requires' => 'jetpack', 'description' => 'Display social buttons that encourage readers to share your content.', 'icon' => 'share-alt'), 'related-content' => array('name' => 'Related Content', 'type' => 'feature', 'requires' => 'jetpack', 'description' => 'Display content, related to the current blog post, to give your readers something to look at next.', 'icon' => 'arrows-h'), 'customizer' => array('name' => 'Customizer', 'type' => 'feature', 'related' => array('site-logo', 'testimonials', 'custom-front-page', 'custom-css', 'custom-colours-fonts'), 'description' => 'Edit site settings and get a live preview of the changes.', 'icon' => 'cogs'), 'widget-visibility' => array('name' => 'Widget Visibility', 'type' => 'feature', 'related' => array('customizer'), 'description' => 'Show and hide widgets on different pages according to rules you set', 'requires' => 'jetpack', 'icon' => 'eye-slash'));
    // merge in the themes
    $themes = get_theme_data();
    foreach ($themes as $key => $theme) {
        $theme['type'] = 'theme';
        $docs[$key] = $theme;
    }
    // merge in plugins
    $plugins = get_plugin_data();
    foreach ($plugins as $key => $plugin) {
        $plugin['type'] = 'plugin';
        $docs[$key] = $plugin;
    }
    // process them
    $processed = array();
    foreach ($docs as $key => $doc) {
        $doc['url'] = path('documentation/' . $doc['type'] . '/' . $key . '/');
        // ensure required list is array
        if (!empty($doc['requires']) && !is_array($doc['requires'])) {
            $doc['requires'] = array($doc['requires']);
        }
        $processed[$key] = $doc;
    }
    return $processed;
}
Example #27
0
function link_library_modify_http_response($plugins_response)
{
    foreach ($plugins_response as $response_key => $plugin_response) {
        if (plugin_basename(__FILE__) == $plugin_response->plugin) {
            if (3 <= substr_count($plugin_response->new_version, '.')) {
                $plugin_info = get_plugin_data(__FILE__);
                $period_position = link_library_strposX($plugin_info['Version'], '.', 3);
                if (false !== $period_position) {
                    $current_version = substr($plugin_info['Version'], 0, $period_position);
                } else {
                    $current_version = $plugin_info['Version'];
                }
                $period_position2 = link_library_strposX($plugin_response->new_version, '.', 3);
                if (false !== $period_position) {
                    $new_version = substr($plugin_response->new_version, 0, $period_position2);
                } else {
                    $new_version = $plugin_response->new_version;
                }
                $version_diff = version_compare($current_version, $new_version);
                if (-1 < $version_diff) {
                    unset($plugins_response->{$response_key});
                }
            }
        }
    }
    return $plugins_response;
}
Example #28
0
 /**
  * put your comment there...
  * 
  */
 protected function enableAction()
 {
     // Initializing!
     $model = $this->model;
     $cjtWebServer = cssJSToolbox::getCJTWebSiteURL();
     $extensions =& CJTPlugin::getInstance()->extensions();
     // Get all CJT-Plugins (Include CJT Plugin itself + all its extensions) that has activate
     // license key!
     $activeLicenses = $model->getStatedLicenses();
     // Import EDD updater Class!
     cssJSToolbox::import('framework:third-party:easy-digital-download:auto-upgrade.class.php');
     // Activate Automatic upgrade for all activated licenses/components!
     foreach ($activeLicenses as $name => $state) {
         // Get extension def doc.
         // Act only if extension has XMl DOC! This might happened i fthe extension
         // removed while its key still in the database
         if ($extDef = $extensions->getDefDoc(dirname($state['component']['pluginBase']))) {
             // Check CJT Server only if updateSrc points to Wordpress Repository
             $updateSrcServer = (string) $extDef->license->attributes()->updateSrc;
             if (!$updateSrcServer || $updateSrcServer == 'CJT') {
                 // Initializingn vars for a single state/component!
                 $pluginFile = ABSPATH . PLUGINDIR . '/' . $state['component']['pluginBase'];
                 // Stop using Cached Data as it causes issue, always
                 // get fresh plugin data.
                 $plugin = get_plugin_data($pluginFile);
                 $license =& $state['license'];
                 // Edd API parameter to be send along with he check!
                 $requestParams = array('version' => $plugin['Version'], 'author' => $plugin['AuthorName'], 'license' => $license['key'], 'item_name' => $name);
                 // Set EDD Automatic Updater!
                 $updated = new CJT_EDD_SL_Plugin_Updater($cjtWebServer, $pluginFile, $requestParams);
             }
         }
     }
 }
function get_plugins($plugin_folder = '') {
	
	if ( ! $cache_plugins = wp_cache_get('plugins', 'plugins') )
		$cache_plugins = array();
	
	if ( isset($cache_plugins[ $plugin_folder ]) )
		return $cache_plugins[ $plugin_folder ];
	
	$wp_plugins = array ();
	$plugin_root = WP_PLUGIN_DIR;
	if( !empty($plugin_folder) )
		$plugin_root .= $plugin_folder;

	// Files in wp-content/plugins directory
	$plugins_dir = @ opendir( $plugin_root);
	if ( $plugins_dir ) {
		while (($file = readdir( $plugins_dir ) ) !== false ) {
			if ( substr($file, 0, 1) == '.' )
				continue;
			if ( is_dir( $plugin_root.'/'.$file ) ) {
				$plugins_subdir = @ opendir( $plugin_root.'/'.$file );
				if ( $plugins_subdir ) {
					while (($subfile = readdir( $plugins_subdir ) ) !== false ) {
						if ( substr($subfile, 0, 1) == '.' )
							continue;
						if ( substr($subfile, -4) == '.php' )
							$plugin_files[] = "$file/$subfile";
					}
				}
			} else {
				if ( substr($file, -4) == '.php' )
					$plugin_files[] = $file;
			}
		}
	}
	@closedir( $plugins_dir );
	@closedir( $plugins_subdir );

	if ( !$plugins_dir || !$plugin_files )
		return $wp_plugins;

	foreach ( $plugin_files as $plugin_file ) {
		if ( !is_readable( "$plugin_root/$plugin_file" ) )
			continue;

		$plugin_data = get_plugin_data( "$plugin_root/$plugin_file" );

		if ( empty ( $plugin_data['Name'] ) )
			continue;

		$wp_plugins[plugin_basename( $plugin_file )] = $plugin_data;
	}

	uasort( $wp_plugins, create_function( '$a, $b', 'return strnatcasecmp( $a["Name"], $b["Name"] );' ));

	$cache_plugins[ $plugin_folder ] = $wp_plugins; 
	wp_cache_set('plugins', $cache_plugins, 'plugins'); 

	return $wp_plugins;
}
 /**
  * @param Plugin_Upgrader $upgrader
  * @param array $extra
  */
 public function hooks_plugin_install_or_update($upgrader, $extra)
 {
     if (!isset($extra['type']) || 'plugin' !== $extra['type']) {
         return;
     }
     if ('install' === $extra['action']) {
         $path = $upgrader->plugin_info();
         if (!$path) {
             return;
         }
         $data = get_plugin_data($upgrader->skin->result['local_destination'] . '/' . $path, true, false);
         aal_insert_log(array('action' => 'installed', 'object_type' => 'Plugin', 'object_name' => $data['Name'], 'object_subtype' => $data['Version']));
     }
     if ('update' === $extra['action']) {
         if (isset($extra['bulk']) && true == $extra['bulk']) {
             $slugs = $extra['plugins'];
         } else {
             if (!isset($upgrader->skin->plugin)) {
                 return;
             }
             $slugs = array($upgrader->skin->plugin);
         }
         foreach ($slugs as $slug) {
             $data = get_plugin_data(WP_PLUGIN_DIR . '/' . $slug, true, false);
             aal_insert_log(array('action' => 'updated', 'object_type' => 'Plugin', 'object_name' => $data['Name'], 'object_subtype' => $data['Version']));
         }
     }
 }